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

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

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