On the date of the release of the newest version of OpenBSD you have a few choices concerning install media. We highly suggest purchasing the CDs from the OpenBSD group so they can receive monetary support for their efforts. But, what if you have not received the CDs by the time the newest release is available on the ftp site? You could install from the ftp server using a bootable floppy or you can use this method to make a bootable cd.
The OpenBSD group offers iso's you can download and use to install your system. The problem is they may have install sets you will never use or you want to add another set with custom software. With a custom made cd you can choose the sets you want to be on the default install. If you never use X windows then take out all of the X server files. If you do not play games then take out the game tgz file. Lets say you have custom programs you want installed by default, add your tgz file to the cd and have it available in the default install.
Below you will find a detailed description of building a bootable OpenBSD CD using OpenBSD or Linux. At the bottom of the page is a script to better automate the process once you understand the basics.
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 v5.1 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/5.1/amd64 directory structure and change into it.
/tmp ] mkdir -p /tmp/OpenBSD/5.1/amd64 /tmp ] cd /tmp/OpenBSD/5.1/amd64
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/5.1/amd64 ] wget --passive-ftp --reject "*iso" ftp://ftp.openbsd.org/pub/OpenBSD/5.1/amd64/*
Step 3: If you want to, you can customize the bootable cd by removing the tgz files you know you will never need. For example, we usually remove the "games45.tgz" as we do not play games on the BSD box. By taking out unused files they will not show up in the install options and you do not need to disable them from being installed. This is an example list of the files we use:
/tmp/OpenBSD/5.1/amd64 ] ls base51.tgz bsd.mp cdboot comp51.tgz INSTALL.amd64 MD5 xbase51.tgz xfont51.tgz xshare51.tgz bsd bsd.rd cdbr etc51.tgz man51.tgz misc51.tgz xetc51.tgz xserv51.tgz
Step 4: 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/5.1/amd64 ] cd /tmp/OpenBSD /tmp/OpenBSD ] mkisofs -r -no-emul-boot -b 5.1/amd64/cdbr -c boot.catalog -o OpenBSD.iso /tmp/OpenBSD/
Step 5: 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
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="5.1" # 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." #
Can I use the amd64 boot image on an i386 machine?No, you can not. The amd64 boot image will not even boot on an i386 architecture machine. On the other hand, the i386 image will boot on an i386 or amd64 architecture machine. Our best advise is to make a bootable cd for the specific architecture you want to run on. Using an i386 image on an amd64 machine will work, but OpenBSD will not run as efficiently compared to running an amd64 image on an amd64 machine.
How can I test the bootable image?To test the iso image on the current system without burning it to a cd you can use "qemu" if it is installed. The following command will boot the iso inside of the virtual machine created by qemu.
qemu -cdrom /tmp/OpenBSD/OpenBSD.iso -boot d
I have heard of people having problems booting the retail OpenBSD v4.2 cds. If I use this method will I have the same problems?No, you will not. According to the OpenBSD group the problem with the retail cds was the location of the boot.catalog in the cd file system. [The] guess is some older BIOS's can not handle a boot.catalog if it is more than 32,768 2K blocks into the file system image. By chance, in [the OpenBSD 4.2] release it is beyond that line by a little bit, for the first time. On the amd64 CD, the boot.catalog is in front of that line, but cdbr is beyond that line.