*** Pimp my OpenBSD bootfloppy *** (C)opyleft 2005 by Dettus *** as of October 08th, 2005 ****************************** Subject: Pimp my OpenBSD bootfloppy Platform: i386, OpenBSD Author: dettus, dettus net General Information -------------------- This short howto gives you some basic hints on how to customize the OpenBSD bootfloppy, and how to setup an easy accessable shellskript. Requirements ------------- An OpenBSD installation on your local machine. Okay, I toyed a bit with the OpenBSD installation process. Luckily it is an open-source OS, and the installation process fits on a single 1.44-floppy. Which is kinda cool. Anyhow, the default setup is one with a ramdisk, and the filesystem is somehow linked to the kernel. That makes it a bit hard to customize it, don't you think? So, I want to show you a way to make changes to the bootfloppy a tiny bit easier... Not very far though... Just enough to show you how to run an easier to access shell-skript after every boot. Btw: You'll have to do everything as root... Sorry!! -------------------------------------------------------------------------------- ==> 1 Installation of your basic tools. You need OpenBSD running on a local machine for this. The default installation comes without the stuff under /usr/src, so just grab it and unpack it: % mkdir /usr/src % cd /usr/src % ftp -o- ftp://ftp.openbsd.org/pub/OpenBSD/3.7/src.tar.gz | tar xvfz - After that, you can install crunch: % cd /usr/src/distrib/crunch % make install -------------------------------------------------------------------------------- ==> 2 Let your computer find a shellskript Remember your last installation of OpenBSD? The computer asked you if you wanted to (I)nstall, (U)pgrade or (S)hell. The file which does that is located under /usr/src/distrib/miniroot and called "dot.profile" It is the first file to be started after your computer booted. Therefore, as a quick-and-dirty hack, it is not a bad idea to edit it. My idea was to let it mount the bootdevice, copy a file from there, umount the bootdevice, and run it. Of course, i had no clue on how to find the correct boot-device. So I made my hack a bit dirtier... Just find the lines # set up some sane defaults echo 'erase ^?, werase ^W, kill ^U, intr ^C, status ^T' stty newcrt werase ^W intr ^C kill ^U erase ^? status ^T in it, and add mkdir /mnt2 mount /dev/fd0c /mnt2 ; cp /mnt2/autoexec.ksh / ; umount /mnt2 mount /dev/fd1c /mnt2 ; cp /mnt2/autoexec.ksh / ; umount /mnt2 mount /dev/wd0c /mnt2 ; cp /mnt2/autoexec.ksh / ; umount /mnt2 mount /dev/wd1c /mnt2 ; cp /mnt2/autoexec.ksh / ; umount /mnt2 mount /dev/cd0c /mnt2 ; cp /mnt2/autoexec.ksh / ; umount /mnt2 mount /dev/cd1c /mnt2 ; cp /mnt2/autoexec.ksh / ; umount /mnt2 ksh /autoexec.ksh beneath them. -------------------------------------------------------------------------------- ==> 3 Make your own bootfloppy Save your /usr/src/distrib/miniroot/dot.profile. And now type in: % cd /usr/src/distrib/i386/ramdiskA % make % mv floppyXX.fs floppyXX_autoexec.ksh.fs # (XX=37, 38, 39...) As long as you don't have any virtual filesystems mounted on svnd0, this will hopfully give you a file called floppyXX_autoexec.ksh.fs, where XX is the release-number. In my case it was 37. -------------------------------------------------------------------------------- ==> 4 Setting up your shellskript Now you have told your computer where to find a shellskript called autoexec.ksh. All you have to do now is to write it. First of all, mount your new floppy-image % vnconfig svnd0c floppyXX_autoexec.ksh.fs % mount /dev/svnd0c /mnt % cd /mnt and then edit a file called autoexec.ksh with your favourite editor, for example echo: % echo "ifconfig ne3 10.0.0.2 netmask 255.255.255.0 up" >autoexec.ksh % echo "route -n flush" >>autoexec.ksh % echo "route add default 10.0.0.1" >>autoexec.ksh then umount your floppy-image % umount /mnt % vnconfig -u svnd0c aaaaand done. The floppy you have now is great to test whether a computer with- out a monitor or serial console boots or not. (Take a root-server, for example). Theoretically, this can be used to "depenguinate" a box, because you just pimped the installation-floppy, remember? ;-) Anyway... That is something I haven't really tried yet, but I am working on it at the moment. And because we are talking about less then 2mb here, let us just hope that Theo keeps up his good work, and those bootfloppy will never become obsolete. I have already written a howto on how to use an OpenBSD bootfloppy to boot up your dedicated-/root-/hosted server, get it at http://www.dettus.net/openbsd_at_strato.txt or at http://www.bsdguides.org/guides/openbsd/misc/openbsd_at_strato.php Get the latest version of this document at http://www.dettus.net/howto_pimp_my_openbsd_bootfloppy.txt ________ __ __ .____ ____ ___ ___\./ \______ \ _____/ |__/ |_ __ __ ______ | _| \ \/ /___ ___ |_ /|\ | | \_/ __ \ __\ __\ | \/ ___/ | | \ / \ \/ / | | | ` \ ___/| | | | | | /\___ \ | | / \ > < | | /_______ /\___ >__| |__| |____//____ > | |_ /___/\ \/__/\_ \ _| | \/ \/ \/ |____| \_/ \/ |____|