Nuffnang

Monday, May 2, 2011

OpenBSD 4.9 install CD

In OpenBSD v4.9 you can now just download the bootable iso "install49.iso" if you DO NOT want to customize your cd image. The "install49.iso" image has all of the files you need to install OpenBSD.

Making a custom bootable OpenBSD CD
Step 1: We need to make the directory structure to build the OpenBSD ISO image in. Decide where you have around 450 meg of free space. You need the space for the install files we are going to download _and_ for the ISO image we are going to create.
NOTE: you need to decide what architecture you are going to use. For this example we are going to be making a CD for the amd64 architecture, but you can easily make an i386 CD with the same method by replacing amd64 with i386.
Start by building the directory tree under /tmp as most users have the ability to write there. The ISO will be for OpenBSD v4.9 on the amd64 architecture. You can always replace amd64 with i386 if you have that architecture. Execute the following two lines to make the /tmp/OpenBSD/4.9/amd64 directory structure and change into it.
mkdir -p /tmp/OpenBSD/4.9/amd64
cd /tmp/OpenBSD/4.9/amd64

Getting the latest release
Step 2: Now we need to download the install sets for the release we want to build.
We are going to be getting our packages from the tertiary USA mirror OpenBSD ftp server, but it is suggested that you look at the list of mirror servers and pick the one located closest to your geographic location. To get the files lets use "wget" while in the amd64 directory. Notice we are _not_ retrieving any *.iso files because we are making our own. There is no need to put extra load on the ftp server downloading files we do not need.
/tmp/OpenBSD/4.9/amd64 ] wget --passive-ftp --reject "*iso" ftp://ftp.openbsd.org/pub/OpenBSD/4.9/amd64/*

IMPORTANT NOTE: Starting in OpenBSD v4.9 the file cdrom45.fs is no longer available. Because of this, we will be building the bootable ISO using mkisofs with the argument -no-emul-boot.

Make the ISO image
Step 3: To make the ISO image we will be using "mkisofs". You should verify that all of the files in the ftp directory downloaded without error and match the md5 check sums before continuing. To make the ISO image we need to execute the following line from the "/tmp/OpenBSD" directory. The file OpenBSD.iso will be created in /tmp/OpenBSD when finished.
/tmp/OpenBSD/4.9/amd64 ] cd /tmp/OpenBSD
/tmp/OpenBSD ] mkisofs -r -no-emul-boot -b 4.9/amd64/cdbr -c boot.catalog -o OpenBSD.iso /tmp/OpenBSD/

Burn the ISO to CD
Step 4: You now have a bootable working ISO image for the latest release of OpenBSD. Lets take a look at the last step which is burning the ISO image to a cd. We will be using "cdrecord" to burn the ISO at 32x to the cd writer device "/dev/rcd0c:0,0,0" with a nice level of 18 (prioritizing CPU time to the burn process). The cd will automatically eject after the burn. If you have another cd burning program you are more comfortable with like k3b or nero you are welcome to use those.
/tmp/OpenBSD ] nice -18 cdrecord -eject -v speed=32 dev=/dev/rcd0c:0,0,0 -data -pad /tmp/OpenBSD/OpenBSD.iso

How about a script?
No problem. Here is a shell script to tie the above commands together. Change the variables "version" and "arch" to suit your distribution. This script is named calomel_make_boot_cd.sh which you can cut/paste from this scrollable window.
#!/usr/local/bin/bash
#
## Calomel.org -- Making a bootable OpenBSD CD
## calomel_make_boot_cd.sh
#
arch="amd64" # Architecture
version="4.9" # OS version
#
echo "building the environment"
mkdir -p /tmp/OpenBSD/$version/$arch
cd /tmp/OpenBSD/$version/$arch
#
echo "getting the release files"
wget --passive-ftp --reject "*iso" ftp://ftp.openbsd.org/pub/OpenBSD/$version/$arch/*
#
echo "building the ISO"
cd /tmp/OpenBSD
mkisofs -r -no-emul-boot -b $version/$arch/cdbr -c boot.catalog -o OpenBSD.iso /tmp/OpenBSD/
#
echo "burning the bootable cd"
nice -18 cdrecord -eject -v speed=32 dev=/dev/rcd0c:0,0,0 -data -pad /tmp/OpenBSD/OpenBSD.iso
#
echo "DONE."
#

No comments:

Post a Comment