File:  [NetBSD Developer Wiki] / wikisrc / ports / evbarm / install_using_sysinst.mdwn
Revision 1.19: download - view: text, annotated - select for diffs
Tue Mar 10 22:22:10 2020 UTC (18 months, 2 weeks ago) by leot
Branches: MAIN
CVS tags: HEAD
Try to more explicitly says that's for NetBSD 8.0

XXX: Needs to be updated for NetBSD 9.0!

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

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