this is obsolete doc -- see http://doc.nethence.com/ instead
NetBSD USB installation media
Introduction
Here's how to make a NetBSD USB installation media (i386 or amd64).
Ref. http://ftp.netbsd.org/pub/NetBSD/misc/jmcneill/mkmemstick.sh
Get the sets
Choice 1) copy the CDrom
Get and mount the install ISO (ftp://ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.1/iso/),
wget ftp://ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.1/iso/i386cd-5.1.iso
vnconfig -c vnd0 i386cd-5.1.iso
mkdir -p loop/
mount_cd9660 /dev/vnd0d `pwd`/loop
Copy the CDrom installation media and unmount,
cp -R loop/ inst/
umount loop/
rmdir loop/
vnconfig -u vnd0
Fix the boot loader,
cd inst/
mv boot.cfg boot.cfg.dist
sed 's/installation CD/installation memory stick/' boot.cfg.dist > boot.cfg
rm -f boot.cfg.dist
ls -l boot
cd ../
Choice 2) fetch the stuff
Fetch the installation kernel and miniroot module,
cd inst/
mkdir -p i386/binary/sets/
ftp -a ftp: //ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.1_RC3/i386/binary/kernel/netbsd-GENERIC.gz
ftp -a ftp: //ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.1_RC3/i386/installation/miniroot/miniroot.kmod
mv netbsd-GENERIC.gz netbsd
Note. there's also netbsd-INSTALL_FLOPPY.gz but it's not like we don't have enought space on an USB stick. We simply use netbsd-GENERIC.gz even for installation : the miniroot module makes it happy happy
Fetch the needed sets,
cd i386/binary/sets
ftp -a ftp://ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.1_RC3/i386/binary/sets/base.tgz
ftp -a ftp://ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.1_RC3/i386/binary/sets/comp.tgz
ftp -a ftp://ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.1_RC3/i386/binary/sets/etc.tgz
ftp -a ftp://ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.1_RC3/i386/binary/sets/kern-GENERIC.tgz
ftp -a ftp://ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.1_RC3/i386/binary/sets/man.tgz
ftp -a ftp://ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.1_RC3/i386/binary/sets/misc.tgz
ftp -a ftp://ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.1_RC3/i386/binary/sets/text.tgz
cd ../../..
Configure the boot loader,
cp -f /usr/mdec/boot .
cat > boot.cfg <<EOF9
banner=PWET PWET YOUPLA BOOM
menu=Install NetBSD:load /miniroot.kmod;boot netbsd
menu=Install NetBSD (no ACPI):load /miniroot.kmod;boot netbsd -2
menu=Install NetBSD (no ACPI, no SMP):load /miniroot.kmod;boot netbsd -12
menu=Drop to boot prompt:prompt
timeout=10
EOF9
cd ..
Make the USB image
Build the image and make it bootable,
makefs netbsdboot.img inst
installboot netbsdboot.img /usr/mdec/bootxx_ffsv1
Write the BSD label to the image,
imgsize=$(stat -L -f %z netbsdboot.img)
cat <<EOF9 | \
sed "s/@SECTORS@/$(expr $imgsize / 512)/" | \
sed "s/@TCYLINDERS@/$(expr $imgsize / 512 / 1000 + 1)/" | \
sed "s/@TSECTORS@/$(expr $imgsize / 512 + 1)/" > disklabel.tmp
type: unknown
disk: Memory Stick
label:
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1000
cylinders: @TCYLINDERS@
total sectors: @TSECTORS@
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0
track-to-track seek: 0
drivedata: 0
16 partitions:
a: @SECTORS@ 0 4.2BSD 1024 8192 0
d: @SECTORS@ 0 unused 0 0
EOF9
unset imgsize
ls -l disklabel.tmp
disklabel -R -F netbsdboot.img `pwd`/disklabel.tmp
rm -f disklabel.tmp
Ready to go
Write the image to the a memory stick.
On NetBSD,
dd if=netbsdboot.img of=/dev/rsd1d bs=1024k
On Linux,
dd if=netbsd-install.img of=/dev/sd1 bs=1024k
On Windows, use "HP Drive Key Boot Utility" or "DD for Windows",
dd --list
dd if=netbsdboot.img of=\\?\Device... bs=1024k --progress
You can now use the memory stick to install NetBSD (i386 or amd64).
Clean up,
rm -rf inst/
References
http://ftp.netbsd.org/pub/NetBSD/misc/jmcneill/mkmemstick.sh
http://old.nabble.com/How-to-create-a-bootable-USB-stick-for-NetBSD-5.0-td25160151.html
http://www.daemonforums.org/showthread.php?t=2824
http://mail-index.netbsd.org/tech-install/2008/11/22/msg000086.html