I know that setting up a disk with GPT partitions and UEFI booting isn’t 
supported (yet) in NetBSD.  But it seems close and I’d appreciate some hints. 

Picked up a cheap laptop that only supports UEFI booting on the internal eMMC 
disk.  Although it has Legacy boot support, that only works on devices attached 
via USB.  I’ve discovered that NetBSD-current will run on this laptop and I 
have it running off a USB stick, so now I’m trying to get it running on the 
internal eMMC disk.  My last problem is getting boot to work. I know I can do 
this with Grub or rEFInd, but discovered it’s possible under NetBSD if I only 
knew the magic!

By “possible under NetBSD” what I mean is I copied the 
NetBSD-7.99.59-amd64-uefi-install.img over to my internal eMMC disk using dd 
and tried booting and it worked!  The system came up all the way into the 
installer.  So I went looking for what magic is being done setting up the 
bootstrap in that image and I’m lost.

This is what I’ve done so far:
#
# Create the GPT segments
#
gpt create -f ld0
gpt add -s 65536 -t efi -l "EFI System" ld0
gpt add -s 525168 -t ffs -l "NetBSD-root" ld0
gpt add -s 256000 -t swap -l "NetBSD-swap" ld0
gpt add -s 1024000 -t ffs -l "NetBSD-var" ld0
gpt add -s 16264934 -t ffs -l "NetBSD-usr" ld0
gpt add -t ffs -l "NetBSD-home”
#
# Initialize the wedges
#
newfs_msdos -F 16 /dev/rdk0
newfs /dev/dk1
newfs /dev/dk3
newfs /dev/dk4
newfs /dev/dk5
#
# Load NetBSD from the 7.99.59 distribution, make the devices, etc, etc
####
#
# Install the loaders
#
gpt biosboot -A -i 1 ld0
mkdir -p /mnt2/EFI/boot
cp /mnt/usr/mdec/*.efi /mnt2/EFI/boot/
cp /mnt/usr/mdec/boot /mnt
installboot /dev/rdk1 /usr/mdec/bootxx_ffsv1

But this last part on installing the loaders doesn’t quite get me there.  Can 
anyone give me a pointer, clue or information on how this is done on the 
uefi-install image that does work on my system?  I think if I had that I’d have 
a working laptop with a native GPT/EFI boot under NetBSD.

BTW, this is a Lenovo N22 11”.  They’re selling new for less than $200, come 
with a 64Gig eMMC disk, SDHC slot, a USB 3 port, 2 USB 2 ports, camera and 
wireless but come with Windows 10 Pro loaded.  It’s a 1.6 Ghz 64-bit system 
which is a bit underpowered for Windows. The latest versions of Ubuntu and Mint 
Linux install and run much better, but I’d prefer NetBSD.  Great battery life 
and seems to be pretty solid construction for a small, lightweight laptop.

Thanks,
-bob

Reply via email to