Subject: Re: Booting NetBSD from FAT drive
To: didier gaumet <didier.gaumet@libertysurf.fr>
From: Brendon Costa <bcosta@avdat.com.au>
List: netbsd-users
Date: 07/12/2007 14:58:54
didier gaumet wrote:
> Hi,
> Imil NetBSD LiveKey should meet your requirements :
> http://imil.net/nlk/
> 

--- Grub specific ---

The NetBSD LiveKey seems exactly what i am after, however I have had
some problems attempting to get it booting. Running grub-install fails
with:

grub-install --root-directory=/mnt/flash /dev/sd0e
The file /mnt/flash/grub/stage1 not read correctly.

This seems to be a problem with the root directory command line. I am
using grub 0.97.




---- "NetBSD" method (Non-Grub) ----

Anyhow since then i have tried a number of things to boot a NetBSD
kernel from a MSDOS disk. I am trying with both a HDD and flash drive
in case there are issues with booting from the flash drive.

This is the basics of what I have tried:

# I am doing all this with a HDD wd1 to avoid any issues that may
arise from booting from a flash drive...


# Create the partition table
fdisk -iau wd1

* I Create a single partition with sisid: 11 (As primary 0) covering
the entire disk
* I set Primary 0 as the active partition
* I update the bootcode from /usr/mdec/mbr

# Create the new msdos filesystem
newfs_msdos -r 32 /dev/rwd1e

Note: I was trying before without reserved sectors.
Info from:
   http://mail-index.netbsd.org/port-i386/2005/12/29/0002.html
   http://mail-index.netbsd.org/tech-userlevel/2004/03/06/0000.html


# Mount the drive and add the boot secondary loader and a kernel image
# to the drive (Note: Particular kernel is unimportant at the moment
# as it does not manage to find the kernel to boot yet. Also i dont
# bother with the rest of the filesystem for now, just want to start
# it loading a kernel).
mount /dev/wd1e /mnt/flash
cp /netbsd /usr/mdec/boot /mnt/flash/
umount /mnt/flash


# Install the primary boot loader
installboot -t raw /dev/rwd1e /usr/mdec/bootxx_msdos

Then shutdown and reboot from the wd1 HDD.
...

Booting Operating System ...
NetBSD MBR boot

NetBSD/i386 dosfs Primary Bootstrap

>> NetBSD/i386 BIOS Boot, Revision 3.2
...
Press return to boot now, any other key for boot menu
booting hd0a:netbsd - starting in 0
open netbsd: No such file or directory
boot: hd0a:netbsd: No such file or directory
...
> ls
ls: No such file or directory
>

Now if I did all that with the USB Flash disk, then at the boot prompt
i can change to "dev hd1a:" and boot from the working FFS NetBSD.


So it is loading the MBR, entering the primary MSDOS boot loader, then
entering the secondary boot loader /boot. However the secondary boot
loader seems unable to find the netbsd kernel image as i am guessing
it is incapable of reading the MSDOS FAT data.

Is there another version of the secondary boot loader that i need or
have I done something wrong?

Thanks,
Brendon.