Friday 28 December 2007

Headless FreeBSD Installation CD

Objective To create a bootable FreeBSD cd that will output to serial console. I had been previously creating headless BSD boot floppies however the preperarion & installation is quicker via cd.

on FreeBSD 5:
mdconfig -a -t vnode -f /path/to/image.iso -u 1

mount the device file.
mount -t cd9660 /dev/md1 /mnt/

on solaris:
mount 6.2-RELEASE-i386-bootonly.iso to a device file.
# lofiadm -a /export/home/philip/Desktop/6.2-RELEASE-i386-bootonly.iso /dev/lofi/1

mount the device file.
#mount -T hsfs /dev/lofi/1 /mnt

Once mounted: copy entire contents of cd to ~/Desktop/headlessBSD.
# cp -R /mnt /export/home/philip/Desktop/headlessBSD

edit loader.rc to output to serial port.
vi /export/home/philip/Desktop/headlessBSD/mnt/boot/loader.rc
"/export/home/philip/Desktop/headlessBSD/mnt/boot/loader.rc" [Read only] 17 lines, 389 characters
\ Loader.rc
\ $FreeBSD: src/sys/boot/i386/loader/loader.rc,v 1.4.2.1 2005/10/30 14:37:02 scottl Exp $
\
\ Set output to serial port
set console="comconsole"
\ Includes additional commands
include /boot/loader.4th

\ Reads and processes loader.conf variables
start

\ Tests for password -- executes autoboot first if a password was defined
check-password

\ Load in the boot menu
include /boot/beastie.4th

\ Start the boot menu
beastie-start

make an iso file from ammended headlessBSD folder. This will output headlessBSD.iso in home directory.
# mkisofs -U -no-emul-boot -b boot/cdboot -o /export/home/philip/headlessBSD.iso /export/home/philip/headlessBSD/mnt/
Warning: creating filesystem that does not conform to ISO-9660.
Size of boot image is 4 sectors -> No emulation
40.38% done, estimate finish Fri Dec 28 19:39:21 2007
80.77% done, estimate finish Fri Dec 28 19:39:22 2007
Total translation table size: 2048
Total rockridge attributes bytes: 0
Total directory bytes: 26624
Path table size(bytes): 68
Max brk space used 78000
12381 extents written (24 MB)


Burn ~/headlessBSD.iso to cd to create bootable headless BSD installation disc.

No comments: