How to build your own LiveKey ============================= iMil - 05 / 2006 1. Configure a kernel named LIVEKEY with the following options : file-system UNION # union file system pseudo-device vnd 4 # disk-like interface to files options VND_COMPRESSION # compressed vnd(4) options MEMORY_DISK_HOOKS options MEMORY_DISK_IS_ROOT # force root on memory disk options MEMORY_DISK_SERVER=0 # no userspace memory disk support options MEMORY_DISK_ROOT_SIZE=32768 # size of memory disk, in blocks options MEMORY_RBFLAGS=0 2. Compile it the classic way config LIVEKEY cd .. make depend && make 3. Copy mkbootdisk.sh, mkrootdisk.sh and fakeroot.tgz in a single directory Untar fakeroot $ tar zxvf fakeroot.tgz Have a look at fakeroot/etc/rc to see how the system works. Generate the kernel with bundled RAMDISK (files come from fakeroot/) # sh mkbootdisk.sh This will produce a compressed netbsd kernel with fakeroot bundled. 4. Initial files The file initfiles.tgz contains tuned /etc, /dev and /var. If you want to modify configuration scripts or /etc files, untar initfiles.tgz, tune them, then re-tar zxvf it, ensuring you are using a relative path. 5. Create a vnd(4) disk image Edit mkrootdisk.sh and set DISKSIZE to the desired size you want then run the script : # sh mkrootdisk.sh You'll then have a file called livekey.img, this is your uncompressed disk image. Mount it using vnconfig : $ mkdir livekey # vnconfig vnd0 livekey.img # mount /dev/vnd0a livekey And populate it with whatever you want, just dont forget base.tgz and etc.tgz. Umount the image : # umount livekey # vnconfig -u vnd0 Compress the image using vndcompress : $ vndcompress livekey.img livekey.zimg Now just cp all those files to the livekey directory in your usb stick. Assuming the key is mount'ed in /mnt : $ cp netbsd /mnt/livekey/ $ cp livekey.zimg /mnt/livekey/ $ cp initfiles /mnt/livekey/ 6. root's ${HOME} root's home directory is set to /mnt/livekey/root so you can modify dotfile by simply editing files in this directory. Note root directory MUST exist ! 7. Additional packages Create a "pkg" directory in /mnt/livekey $ mkdir /mnt/livekey/pkg Every NetBSD package you'll copy to this directory will be automatically installed at boot time. 8. Make the key boot Make sure grub is installed in your key (see LiveKey homepage for instructions on how to do this), and voila !