Diff for /wikisrc/Installation_on_UEFI_systems.mdwn between versions 1.1 and 1.4

version 1.1, 2018/06/12 11:06:18 version 1.4, 2020/02/11 11:03:02
Line 1 Line 1
 ## Installing NetBSD 8.0 on a x86 system with UEFI  # Installing NetBSD on a x86 system with UEFI
   
 Modern x86 machines have UEFI instead of BIOS firmware. Unfortunately, as of the upcoming NetBSD 8.0 release the installer does not fully support this setup. We hope to address this shortcoming quickly after the NetBSD 8.0 release and provide full automatic installations for this kind of systems (and also mixed operating system setups) in NetBSD 8.1.  Modern x86 machines have UEFI instead of BIOS firmware.
   The boot procedure is slightly different, and the installation needs to take care of this.
   
 This tutorial shows how to semi-manually do it. For simplicity we assume that you have booted the UEFI install image from a USB stick and want to install NetBSD onto the whole disk in the machine.  Starting with NetBSD 9.0 the installer should be able to handle this automatically. Earlier NetBSD versions were able to boot in this setups, but needed a bit manual help to get everything installed.
   
   As of now NetBSD/amd64 provide separate images for installation, depending on how your machine boots. This will be integrated into a single image in the (near?) future. If you look at the <a href="//nycdn.NetBSD.org/pub/NetBSD-daily/HEAD/latest/images/">images</a> directory of your NetBSD release you will find 
   a `NetBSD-XXX-amd64-uefi-install.img.gz`, which is intended to be written to a USB disk and booted via UEFI. Alternatively there are `NetBSD-XXX-amd64-install.img.gz` and `NetBSD-XXX-i386-install.img.gz`, also intended to be written to USB sticks and booted via BIOS. Or if your machine has a DVD drive, there are `NetBSD-XXX-i386.iso` and `NetBSD-XXX-amd64.iso`, intended to be burned to a CD or DVD.
   
   Preparing the USB medium on NetBSD works like this:
   
           # gunzip NetBSD-9.0-amd64-uefi-install.img.gz
           # sudo dd if=NetBSD-9.0-amd64-uefi-install.img of=/dev/rsd0d bs=1m conv=sync
   
   If you do not (yet) have a NetBSD machine installed, you can use <a href="//www.NetBSD.org/~martin/rawrite32">Rawrite32</a> on a Windows machine.
   
   ## Installing NetBSD 9.0 or newer on a x86 system with UEFI
   
   After booting from the USB stick there is nothing special you need to do to get UEFI booting set up properly. The installer will recognize the way you booted your install medium (either BIOS or UEFI) and prepare the installation on your hard disk for the same boot method.
   
   First you need to select the target disk. The installation USB stick will usually show up as sd0.
   
   ![screenshot of sysinst disk selection](https://netbsd.org/images/misc/uefi/uefi9_01.png "Select Disk")
   
   Here we have an (artificially tiny) harddisk wd0 and select that as install target. In this setup the disk had been completely wiped before, so now we can choose what type of partitioning scheme we want to use. GPT is the more universal method, and also allows using disks of arbitrary size.
   
   ![screenshot of sysinst partitioning scheme selection](https://netbsd.org/images/misc/uefi/uefi9_02.png "Select type of partitions")
   
   After the partitioning scheme selection (which will be skipped if the installer already finds valid partitions on your disk) you are presented size suggestions for the to-be-created NetBSD partitions.
   
   ![screenshot of sysinst partition size display](https://netbsd.org/images/misc/uefi/uefi9_03.png "Partition Sizes")
   
   Details depend on the size of the target disk and available memory (swap is also used to store kernel crash dumps, so with more installed RAM the installer will suggest bigger swap partitions). Note the MSDOS partition on the above screenshot, it is used by UEFI instead of bootblocks to load the bootloader.
   
   Just continue the regular installation process from here - it should automatically create a UEFI bootable hard disk.
   
   ## Installing NetBSD 8 on a x86 system with UEFI
   
   Unfortunately the installer on the netbsd-8 branch does not fully support an UEFI setup.
   
   The tutorial below shows (__only for NetBSD 8.x!__) how to semi-manually do it. For simplicity we assume that you have booted the UEFI install image from a USB stick and want to install NetBSD onto the whole disk in the machine.
   
 ### Getting out of the Installer  ### Getting out of the Installer
   
Line 33  Let us look at another example, this tim Line 70  Let us look at another example, this tim
         # sysctl hw.disknames          # sysctl hw.disknames
         hw.disknames = wd0 dk0 dk1 dk2 dk3 sd0 dk4 dk5          hw.disknames = wd0 dk0 dk1 dk2 dk3 sd0 dk4 dk5
   
 Here the internal SSD is showing up as wd0, and has Windows pre installed (dk0 .. dk3). The install image USB stick again shows up as sd0 with two wedges dk4 and dk5.  Here the internal SSD is showing up as wd0, and has Windows pre-installed (dk0 .. dk3). The install image USB stick again shows up as sd0 with two wedges dk4 and dk5.
   
 Just to be sure let us check which device the installer booted from:  Just to be sure let us check which device the installer booted from:
   
Line 68  You can check more details about individ Line 105  You can check more details about individ
         wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA moded 6 (Ultra/133)          wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA moded 6 (Ultra/133)
         wd0(ahcisata1:0:0): using PIO mode 4, DMA mode 2, Ultra-DMA mode 6 (Ultra/133) (using DMA)          wd0(ahcisata1:0:0): using PIO mode 4, DMA mode 2, Ultra-DMA mode 6 (Ultra/133) (using DMA)
   
 **NOTE** for this tutorial screenshots have been created using VirtualBox. The following example uses a strange tiny 30 GB (virtual) hard disk. Also on VirtualBox it is quite tricky (or impossible?) to actually boot from a USB device - instead the USB install image was converted to a virtual disk image and the machine booted from that. This makes the install image show up as *wd1*.  **NOTE** for this tutorial screenshots have been created using VirtualBox. The following example uses a strange tiny 30 GB (virtual) hard disk. Also on VirtualBox it is quite tricky (or impossible?) to actually boot from a USB device - instead the USB install image was converted to a virtual disk image, and the machine booted from that. This makes the install image show up as *wd1*.
   
 Here are the target disk details:  Here are the target disk details:
   
Line 78  Here are the target disk details: Line 115  Here are the target disk details:
   
 So now that we have identified the disk and got the details, we need to plan our disk layout.  So now that we have identified the disk and got the details, we need to plan our disk layout.
   
 We will need two partitions, one for UEFI to boot from, and the NetBSD root disk partition. Depending on planed use for the machine, we also will want a swap partition. This should not be smaller than the machines RAM size, so in case of a kernel panic a crash dump can be saved and recovered on next reboot. For this example let us calculate with 8 GB RAM and no special needs for more swap.  We will need two partitions, one for UEFI to boot from, and the NetBSD root disk partition. Depending on planned use for the machine, we also will want a swap partition. This should not be smaller than the machine's RAM size, so in case of a kernel panic a crash dump can be saved and recovered on next reboot. For this example let us calculate with 8 GB RAM and no special needs for more swap.
   
 So we have a 30 GB disk, we subtract 8 GB of swap and a bit of space for the UEFI boot partition. That leaves us with (rounded down) 21 GB of space for the main NetBSD partition.  So we have a 30 GB disk, we subtract 8 GB of swap and a bit of space for the UEFI boot partition. That leaves us with (rounded down) 21 GB of space for the main NetBSD partition.
   
Line 97  Next we create a new partition table and Line 134  Next we create a new partition table and
         # gpt add -a 2m -l NetBSD -t ffs -s 21g wd0          # gpt add -a 2m -l NetBSD -t ffs -s 21g wd0
         # gpt add -a 2m -l swap -t swap wd0          # gpt add -a 2m -l swap -t swap wd0
   
 Then we check the result  Then we check the result:
   
         # gpt show wd0          # gpt show wd0
   

Removed from v.1.1  
changed lines
  Added in v.1.4


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