Annotation of wikisrc/ports/evbarm/install_using_sysinst.mdwn, revision 1.10

1.1       leot        1: [[!meta title="NetBSD/evbarm install via sysinst(8) on a SATA hard disk, USB stick or (u)SD card"]]
                      2: 
                      3: In this document we will see step by step how to install NetBSD/evbarm on an
                      4: external media (SATA hard disk, USB stick or (u)SD card) using
                      5: [[!template id=man name="sysinst" section="8"]].
                      6: 
1.7       leot        7: As practical example a BananaPI and a SATA hard disk will be used.
                      8: However, the following instructions can be probably easily applied
                      9: on other SoCs and medias with little adjustments.
                     10: 
1.1       leot       11: 
                     12: # Populating (u)SD card with `armv7.img`
                     13: 
1.6       leot       14: - Download or build `armv7.img`, e.g.:
1.8       leot       15: 
                     16: [[!template id=programlisting text="""
1.6       leot       17: $ ftp http://cdn.NetBSD.org/pub/NetBSD/NetBSD-8.0/evbarm-earmv7hf/binary/gzimg/armv7.img.gz
                     18: $ gunzip armv7.img.gz
1.8       leot       19: """]]
                     20: 
1.6       leot       21: - Write the image to (u)SD card:
1.8       leot       22: 
                     23: [[!template id=programlisting text="""
                     24: # dd if=armv7.img of=/dev/rsd0d bs=1m conv=sync
                     25: """]]
                     26: 
1.6       leot       27: - Write u-boot to (u)SD card. `u-boot` images are provided by
1.9       leot       28: `sysutils/u-boot-<boardname>` packages, for example for Allwinner SoC:
1.8       leot       29: 
                     30: [[!template id=programlisting text="""
                     31: # dd if=/usr/pkg/share/u-boot/&lt;boardname&gt;/u-boot-sunxi-with-spl.bin of=/dev/rld0d bs=1k seek=8 conv=sync
                     32: """]]
1.1       leot       33: 
1.10    ! leot       34: NetBSD/evbarm 8.0 does not automatically boot on the BananaPI.
        !            35: We can use the following commands to boot from the (u)SD cards in u-boot:
        !            36: 
        !            37: [[!template id=programlisting text="""
        !            38: mmc dev 0
        !            39: setenv kernel netbsd-BPI.ub
        !            40: fatload mmc 0:1 82000000 $kernel
        !            41: bootm 82000000 root=ld0a console=fb
        !            42: """]]
        !            43: 
        !            44: Or, to avoid typing them at every boot we can prepare an u-boot script via
        !            45: [[!template id=man name="mkubootimage" section="1"]].
        !            46: 
        !            47: [[!template id=programlisting text="""
        !            48: $ cat boot.cmd
        !            49: mmc dev 0
        !            50: setenv kernel netbsd-BPI.ub
        !            51: fatload mmc 0:1 82000000 $kernel
        !            52: bootm 82000000 root=ld0a console=fb
        !            53: $ mkubootimage -A arm -n armv7 -T script boot.cmd boot.scr
        !            54: """]]
        !            55: 
        !            56: ...and copy it on the populated (u)SD card:
        !            57: 
        !            58: [[!template id=programlisting text="""
        !            59: # mount /dev/sd0e /mnt
        !            60: # cp /mnt/boot.scr /mnt/boot.scr.orig
        !            61: # cp boot.scr /mnt/
        !            62: """]]
1.1       leot       63: 
                     64: 
                     65: # Installing via sysinst(8)
                     66: 
1.2       leot       67: *TODOleot*: Document all sysinst(8) "screenshot"!
                     68: 
1.3       leot       69: Now that the SD card is populated with `armv7.img` we can login as `root` (by
                     70: default the password is empty) and run `sysinst`:
1.2       leot       71: 
1.4       leot       72: [[!template id=programlisting text="""
1.2       leot       73: # sysinst
1.4       leot       74: """]]
1.2       leot       75: 
1.3       leot       76: The first menu is about the system type (Respberry PI or Other), we select the
                     77: latter ("Other"):
                     78: 
1.4       leot       79: [[!template id=programlisting text="""
1.2       leot       80: 
                     81: 
                     82: 
                     83: 
                     84: 
                     85: 
                     86: 
                     87: 
                     88: 
                     89: 
                     90:                     +-------------------------------------+
                     91:                     | What kind of system do you have?    |
                     92:                     |                                     |
                     93:                     | a: Raspberry PI                     |
                     94:                     |>b: Other                            |
                     95:                     +-------------------------------------+
                     96: 
                     97: 
                     98: 
                     99: 
                    100: 
                    101: 
                    102: 
                    103: 
                    104: 
                    105: 
1.4       leot      106: """]]
1.2       leot      107: 
1.3       leot      108: We want to install NetBSD/evbarm on the hard disk so let's select
                    109: "Install NetBSD to hard disk":
                    110: 
1.4       leot      111: [[!template id=programlisting text="""
1.2       leot      112: 
                    113:  NetBSD/evbarm 8.0
                    114: 
                    115:  This menu-driven tool is designed to help you install NetBSD to a hard disk,
                    116:  or upgrade an existing NetBSD system, with a minimum of work.
                    117:  In the following menus type the reference letter (a, b, c, ...) to select an
                    118:  item, or type CTRL+N/CTRL+P to select the next/previous item.
                    119:  The arrow keys and Page-up/Page-down may also work.
                    120:  Activate the current selection from the menu by typing the enter key.
                    121: 
                    122:  If you booted from a floppy, you may now remove the disk.
                    123:  Thank you for using NetBSD!
                    124:                +-----------------------------------------------+
                    125:                | NetBSD-8.0 Install System                     |
                    126:                |                                               |
                    127:                |>a: Install NetBSD to hard disk                |
                    128:                | b: Upgrade NetBSD on a hard disk              |
                    129:                | c: Re-install sets or install additional sets |
                    130:                | d: Reboot the computer                        |
                    131:                | e: Utility menu                               |
                    132:                | f: Config menu                                |
                    133:                | x: Exit Install System                        |
                    134:                +-----------------------------------------------+
                    135: 
                    136: 
                    137: 
1.4       leot      138: """]]
1.2       leot      139: 
1.3       leot      140: Before proceeding with the installation, if the hard disk had any important data
                    141: it is better to stop and doing a backup before proceeding. If it is empty and/or
                    142: we can safetely remove its data we can proceed:
                    143: 
1.4       leot      144: [[!template id=programlisting text="""
1.2       leot      145: 
                    146:  You have chosen to install NetBSD on your hard disk.  This will change
                    147:  information on your hard disk.  You should have made a full backup before
                    148:  this procedure!  This procedure will do the following things:
                    149:          a) Partition your disk
                    150:          b) Create new BSD file systems
                    151:          c) Load and install distribution sets
                    152:          d) Some initial system configuration
                    153: 
                    154:  (After you enter the partition information but before your disk is changed,
                    155:  you will have the opportunity to quit this procedure.)
                    156: 
                    157:  Shall we continue?
                    158:                                +---------------+
                    159:                                | yes or no?    |
                    160:                                |               |
                    161:                                | a: No         |
                    162:                                |>b: Yes        |
                    163:                                +---------------+
                    164: 
                    165: 
                    166: 
                    167: 
                    168: 
                    169: 
                    170: 
1.4       leot      171: """]]
1.2       leot      172: 
1.3       leot      173: Now we can see all the available disks. The hard disk attached via SATA is a
                    174: 120GB SSD recognized as `wd0`:
                    175: 
1.4       leot      176: [[!template id=programlisting text="""
1.2       leot      177: 
                    178:  On which disk do you want to install NetBSD?
                    179: 
                    180: 
                    181:                      +-----------------------------------+
                    182:                      | Available disks                   |
                    183:                      |                                   |
                    184:                      |>a: wd0 (112G, SanDisk SDSSDA120G) |
                    185:                      | b: Extended partitioning          |
                    186:                      | x: Exit                           |
                    187:                      +-----------------------------------+
                    188: 
                    189: 
                    190: 
                    191: 
                    192: 
                    193: 
                    194: 
                    195: 
                    196: 
                    197: 
                    198: 
                    199: 
                    200: 
                    201: 
                    202: 
1.4       leot      203: """]]
1.2       leot      204: 
1.3       leot      205: We now need to edit MBR partition table. We will create two MBR partitions: the
                    206: first one a FAT32 for `/boot` and the other for NetBSD. We select "Edit the MBR
                    207: partition table":
                    208: 
1.4       leot      209: [[!template id=programlisting text="""
1.2       leot      210: 
                    211:  We are now going to install NetBSD on the disk wd0.
                    212: 
                    213:  NetBSD requires a single partition in the disk's MBR partition table, this is
                    214:  split further by the NetBSD disklabel.  NetBSD can also access file systems
                    215:  in other MBR partitions.
                    216: 
                    217:  If you select 'Use the entire disk' then the previous contents of the disk
                    218:  will be overwritten and a single MBR partition used to cover the entire disk.
                    219:  If you want to install more than one operating system then edit the MBR
                    220:  partition table and create a partition for NetBSD.
                    221: 
                    222:  A few hundred MB is enough for a basic installation, but you should allow
                    223:  extra for additional software and user files.
                    224:  Allow at least 5GB if you want to build NetBSD itself.
                    225:                       +---------------------------------+
                    226:                       | Which would you like to do?     |
                    227:                       |                                 |
                    228:                       |>a: Edit the MBR partition table |
                    229:                       | b: Use the entire disk          |
                    230:                       +---------------------------------+
                    231: 
                    232: 
                    233: 
                    234: 
                    235: 
1.4       leot      236: """]]
1.2       leot      237: 
1.3       leot      238: First we select the second entry ("b"), set the "type:" to "NetBSD":
                    239: 
1.4       leot      240: [[!template id=programlisting text="""
1.2       leot      241: 
                    242:  The Current MBR partition table is shown below.
                    243:  Flgs: a => Active partition, I => Install here.
                    244:  Select the partition you wish to change:
                    245: 
                    246:     Total disk size 114473 MB.
                    247:                +-----------------------------------------------------------+
                    248:     Start( MB) |>a:       type: unused                                     |
                    249:     ---------- | b:      start: 0 MB                                       |
                    250:  a:            | c:       size: 0 MB                                       |
                    251: >b:            | d:        end: 0 MB                                       |
                    252:  c:            | e:     active: No                                         |
                    253:  d:          +-----------------------------------+                         |
                    254:  e: Change in| a: Don't change                   |linders/MB)              |
                    255:  x: Partition| b: Delete partition               |                         |
                    256:              |>c: NetBSD                         |-------------------------+
                    257:              | d: Extended partition, LBA        |
                    258:              | e: FreeBSD/386BSD                 |
                    259:              | f: OpenBSD                        |
                    260:              | g: Linux native                   |
                    261:              | h: Linux swap                     |
                    262:              | i: DOS FAT12                      |
1.5       leot      263:              | &lt;: page up, &gt;: page down          |
1.2       leot      264:              +-----------------------------------+
                    265: 
                    266: 
1.4       leot      267: """]]
1.2       leot      268: 
1.3       leot      269: We reserve for the NetBSD MBR partition all the end of the disk,
                    270: starting at 92MB (1MB that will be empty and 91MB that will be for
                    271: the FAT32), we also select to make it active ("active: Yes") and
                    272: we will use it to install NetBSD ("install: Yes"):
                    273: 
1.4       leot      274: [[!template id=programlisting text="""
1.2       leot      275: 
                    276:  The Current MBR partition table is shown below.
                    277:  Flgs: a => Active partition, I => Install here.
                    278:  Select the partition you wish to change:
                    279: 
                    280:     Total disk size 114473 MB.
                    281:                +-----------------------------------------------------------+
                    282:     Start( MB) | a:       type: NetBSD                                     |
                    283:     ---------- | b:      start: 92 MB                                      |
                    284:  a:            | c:       size: 114381 MB                                  |
                    285: >b:            | d:        end: 114473 MB                                  |
                    286:  c:            | e:     active: Yes                                        |
                    287:  d:            | f:    install: Yes                                        |
                    288:  e: Change inpu| g: Change input units (sectors/cylinders/MB)              |
                    289:  x: Partition t|>x: Partition OK                                           |
                    290:                +-----------------------------------------------------------+
                    291: 
                    292: 
                    293: 
                    294: 
                    295: 
                    296: 
                    297: 
                    298: 
                    299: 
                    300: 
1.4       leot      301: """]]
1.2       leot      302: 
1.3       leot      303: We now select the first partition ("a") and create a "Windows FAT32", starting
                    304: at 1MB and ending at 92MB before the "NetBSD" partition. We also make it active
                    305: ("active: Yes"):
                    306: 
1.4       leot      307: [[!template id=programlisting text="""
1.2       leot      308: 
                    309:  The Current MBR partition table is shown below.
                    310:  Flgs: a => Active partition, I => Install here.
                    311:  Select the partition you wish to change:
                    312: 
                    313:     Total disk size 114473 MB.
                    314:                +-----------------------------------------------------------+
                    315:     Start( MB) | a:       type: Windows FAT32                              |
                    316:     ---------- | b:      start: 1 MB                                       |
                    317: >a:            | c:       size: 91 MB                                      |
                    318:  b:         92 | d:        end: 92 MB                                      |
                    319:  c:            | e:     active: Yes                                        |
                    320:  d:            | f:    install: No                                         |
                    321:  e: Change inpu| g: Change input units (sectors/cylinders/MB)              |
                    322:  x: Partition t|>x: Partition OK                                           |
                    323:                +-----------------------------------------------------------+
                    324: 
                    325: 
                    326: 
                    327: 
                    328: 
                    329: 
                    330: 
                    331: 
                    332: 
                    333: 
1.4       leot      334: """]]
1.2       leot      335: 
1.3       leot      336: Here the final MBR partition table:
                    337: 
1.4       leot      338: [[!template id=programlisting text="""
1.2       leot      339: 
                    340:  The Current MBR partition table is shown below.
                    341:  Flgs: a => Active partition, I => Install here.
                    342:  Select the partition you wish to change:
                    343: 
                    344:     Total disk size 114473 MB.
                    345: 
                    346:     Start( MB)  Size( MB) Flg Kind
                    347:     ---------- ---------- --- ----------------
                    348: >a:          1         91 a   Windows FAT32
                    349:  b:         92     114381   I NetBSD
                    350:  c:                           unused
                    351:  d:                           unused
                    352:  e: Change input units (sectors/cylinders/MB)
                    353:  x: Partition table OK
                    354: 
                    355: 
                    356: 
                    357: 
                    358: 
                    359: 
                    360: 
                    361: 
                    362: 
                    363: 
                    364: 
1.4       leot      365: """]]
1.2       leot      366: 
1.3       leot      367: Now that the MBR partition table is written we can proceed to set
                    368: sizes of NetBSD partitions:
                    369: 
1.4       leot      370: [[!template id=programlisting text="""
1.2       leot      371: 
                    372:  NetBSD uses a BSD disklabel to carve up the NetBSD portion of the disk into
                    373:  multiple BSD partitions.  You must now set up your BSD disklabel.
                    374: 
                    375:  You can use a simple editor to set the sizes of the NetBSD partitions, or
                    376:  keep the existing partition sizes and contents.
                    377: 
                    378:  You will then be given the opportunity to change any of the disklabel fields.
                    379: 
                    380:  The NetBSD part of your disk is 114381 Megabytes.  A full installation
                    381:  requires at least 288 Megabytes without X and at least 348 Megabytes if the X
                    382:  sets are included.
                    383:                      +-----------------------------------+
                    384:                      | Choose your installation          |
                    385:                      |                                   |
                    386:                      |>a: Set sizes of NetBSD partitions |
                    387:                      | b: Use existing partition sizes   |
                    388:                      +-----------------------------------+
                    389: 
                    390: 
                    391: 
                    392: 
                    393: 
                    394: 
                    395: 
                    396: 
1.4       leot      397: """]]
1.2       leot      398: 
1.3       leot      399: We set the swap size to 4G and we reserve the rest of the space for "/":
                    400: 
1.4       leot      401: [[!template id=programlisting text="""
1.2       leot      402: 
                    403:  You can now change the sizes for the system partitions.  The default is to
                    404:  allocate all the space to the root file system.  However, you may wish to
                    405:  have separate /usr (additional system files), /var (log files etc) or /home
                    406:  (users' home directories) file systems.
                    407: 
                    408:  Free space will be added to the partition marked with a '+'.
                    409: 
                    410:         MB         Cylinders   Sectors   Filesystem
                    411:     a:   2208(110284)      4488   4523904 + /
                    412:     b:   4096              8323   8389584   swap
                    413:     c:      0                 0         0   /tmp (mfs)
                    414:     d:      0                 0         0   /usr
                    415:     e:      0                 0         0   /var
                    416:     f:      0                 0         0   /home
                    417:     g: Add a user defined partition
                    418:     h: Change input units (sectors/cylinders/MB)
                    419:    >x: Accept partition sizes.  Free space 108076 MB, 13 free partitions.
                    420: 
                    421: 
                    422: 
                    423: 
                    424: 
                    425: 
                    426: 
                    427: 
1.4       leot      428: """]]
1.2       leot      429: 
1.3       leot      430: The summary of the current BSD disklabel is:
                    431: 
1.4       leot      432: [[!template id=programlisting text="""
1.2       leot      433: 
                    434:  We now have your BSD disklabel partitions as:
                    435:  This is your last chance to change them.
                    436: 
                    437:     Start  MB   End  MB  Size  MB FS type    Newfs Mount Mount point
                    438:     --------- --------- --------- ---------- ----- ----- -----------
                    439: >a:        92    110375    110284 FFSv1      Yes   Yes   /
                    440:  b:    110376    114472      4096 swap
                    441:  c:         0    114472    114473 Whole disk
                    442:  d:         0         0         0 unused
                    443:  e:         1        91        91 Boot partition
                    444:  f:         0         0         0 unused
                    445:  g: Show all unused partitions
                    446:  h: Change input units (sectors/cylinders/MB)
                    447:  x: Partition sizes ok
                    448: 
                    449: 
                    450: 
                    451: 
                    452: 
                    453: 
                    454: 
                    455: 
                    456: 
                    457: 
                    458: 
1.4       leot      459: """]]
1.2       leot      460: 
1.3       leot      461: We can adjust the disklabel, for example we can use FFSv2 for "/"
                    462: and for the disklabel "e" set its mount point to "/boot" in order
                    463: that an `/etc/fstab` entry will be populated (please note
                    464: that "/boot" will not be automatically mounted by default):
                    465: 
1.4       leot      466: [[!template id=programlisting text="""
1.2       leot      467: 
                    468:  We now have your BSD disklabel partitions as:
                    469:  This is your last chance to change them.
                    470: 
                    471:     Start  MB   End  MB  Size  MB FS type    Newfs Mount Mount point
                    472:     --------- --------- --------- ---------- ----- ----- -----------
                    473:  a:        92    110375    110284 FFSv2      Yes   Yes   /
                    474:  b:    110376    114472      4096 swap
                    475:  c:         0    114472    114473 Whole disk
                    476:  d:         0         0         0 unused
                    477:  e:         1        91        91 Boot partition             /boot
                    478:  f:         0         0         0 unused
                    479:  g: Show all unused partitions
                    480:  h: Change input units (sectors/cylinders/MB)
                    481: >x: Partition sizes ok
                    482: 
                    483: 
                    484: 
                    485: 
                    486: 
                    487: 
                    488: 
                    489: 
                    490: 
                    491: 
                    492: 
1.4       leot      493: """]]
1.2       leot      494: 
1.3       leot      495: We have finally ready to proceed with
                    496: [[!template id=man name="sysinst" section="8"]] as usual and install
                    497: the installation sets.  If you choose to install via FTP/HTTP please
                    498: note that the "Binary set directory" needs to be adjusted from
                    499: `/evbarm/binary/sets` to `/evbarm-earmv7hf/binary/sets` (it's
                    500: missing an `-earmv7hf' due different evbarm-s):
                    501: 
1.4       leot      502: [[!template id=programlisting text="""
1.2       leot      503: 
                    504:  The following are the http site, directory, user, and password that will be
                    505:  used.  If "user" is "ftp", then the password is not needed.
                    506: 
                    507:  a: Host                      ftp.NetBSD.org
                    508:  b: Base directory            pub/NetBSD/NetBSD-8.0
                    509: >c: Binary set directory      /evbarm-earmv7hf/binary/sets
                    510:  d: Source set directory      /source/sets
                    511:  e: User                      ftp
                    512:  f: Password
                    513:  g: Proxy
                    514:  h: Transfer directory        /usr/INSTALL
                    515:  i: Delete after install      No
                    516:  j: Configure network
                    517:  k: Exit
                    518:  x: Get Distribution
                    519: 
                    520: 
                    521: 
                    522: 
                    523: 
                    524: 
                    525: 
                    526: 
                    527: 
                    528: 
1.4       leot      529: """]]
1.2       leot      530: 
1.3       leot      531: The installation will proceed as usual and for more information
                    532: please give a look to
                    533: [The NetBSD Guide](https://www.netbsd.org/docs/guide/en/chap-exinst.html#exinst-choose-media).
                    534: 
                    535: *TODOleot*: add information how to populate `/boot` and prepare `boot.cmd`,
                    536: `boot.scr`.
                    537: 
1.4       leot      538: [[!template id=programlisting text="""
1.2       leot      539: # mount /dev/wd0e /mnt
                    540: # cp -r /boot/* /mnt/
1.4       leot      541: """]]
1.1       leot      542: 
                    543: 
                    544: # References
                    545: 
                    546: *TODOleot*: add a reference to the instructions shared via PR port-evbarm/50806.

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb