Nethence Pbraun Lab Webmail Your IP BBDock
No bloatware needed print | donate | html/css | terms of use
Home | Unix | Windows | Oracle | Obsolete | Hardware | DIY | Mechanics | Scripts | Configs | Private

NetBSD USB installation media
Here's how to make a NetBSD USB installation media (i386 or amd64).
Get the sets
Choice 1) copy the CDrom
Get and mount the install 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 -a ftp: //
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 -a
ftp -a
ftp -a
ftp -a
ftp -a
ftp -a
cd ../../..
Configure the boot loader,
cp -f /usr/mdec/boot .
cat > boot.cfg <<EOF9
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
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
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
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/

Last update: Jan 08, 2014
Copyright © 2007-2014 Pierre-Philipp Braun