PDA

View Full Version : How to build a STABLE OpenBSD Install CD from source


byron
January 26th, 2006, 12:48
Here are my notes on creating an OpenBSD STABLE install CD. I hope someone finds it the least bit useful. Please let me know if you find any errors in this doc.

It's important to note that there are no official full CD install ISO's of OpenBSD available for download, which is on purpose (http://openbsd.org/faq/faq3.html#ISO). Please respect Theo's wishes and his copyright to the filesystem layout and be sure to order your Official install CDs from (http://openbsd.org/orders.html) and support the project.

This howto assumes that you already have OpenBSD Installed with the needed development tools. It also assumes that all of the commands below are run as root. Not all commands need to be run as root, but in the interest of simplifying this howto I assume you either know when to use sudo or you've su'ed to root before any of the steps below.

First we need to get the release sources before we update them. I prefer to ftp down the release sources and update to stable via CVS (seems faster to me).

# ftp ftp.crimelabs.net
# cd pub
# cd OpenBSD
# cd 3.8
# mget *.gz

Say yes to all the prompts except sys.tar.gz since it is contained within src.tar.gz
You will end up with ports.tar.gz, src.tar.gz and XF4.tar.gz

Untar the sources to their correct locations

# tar zxvf ports.tar.gz -C /usr/
# tar zxvf XF4.tar.gz -C /usr/
# tar zxvf src.tar.gz -C /usr/src/

Now that we have the release sources on our system it's time to update them via cvs

# export CVSROOT=anoncvs@anoncvs.nyc.openbsd.org:/cvs

To update ports

# cd /usr/ports/
# cvs -d$CVSROOT up -rOPENBSD_3_8 -Pd

To update the X sources

# cd /usr/XF4/
# cvs -d$CVSROOT up -rOPENBSD_3_8 -Pd

To update the system sources

# cd /usr/src/
# cvs -d$CVSROOT up -rOPENBSD_3_8 -Pd

To build the X sources you'll need a specific version of TCL and TK (8.4)

# cd /usr/ports/lang/tcl/8.4/
# make install clean

# cd /usr/ports/x11/tk/8.4/
# make install clean

You will also need cdrtools if you plan on making the ISOs on this box.

# cd /usr/ports/sysutils/cdrtools/
# make install clean

Now it's time to basically follow man release(8)

Build and install a new kernel

# cd /sys/arch/i386/conf
# config GENERIC
# cd ../compile/GENERIC
# make clean depend bsd
# mv /bsd /bsd.old && mv bsd / && chown root:wheel /bsd

Reboot into the new kernel

# reboot

If you have troubles booting into the new kernel you can boot bsd.old

Now it's time to build the system

The release(8) man page goes through how to make sure your object directories are clean but since this is a new install we won't worry about it

# cd /usr/src
# make obj
# make build

Once this is done you should be running on stable code

Now we'll basically create new install files from the stable code by making and validating the system release.

# mkdir /destdir-src
# mkdir -p /releasedir/3.8/i386

The /destdir-src directory will contain a full system install minus X when we're done with this process

The /releasedir/3.8/i386 directory will contain a generic kernel and the install tarballs made from stable code.

We need the crunch tool to create the ramdisk images

# cd /usr/src/distrib/crunch
# make obj depend all install

Now to make the release

# export DESTDIR=/destdir-src
# export RELEASEDIR=/releasedir/3.8/i386

The DESTDIR should be empty if your following this howto from the beginning but if you aren't make sure that it is.

# cd /usr/src/etc
# make release

Once that's done we'll validate the release

# cd /usr/src/distrib/sets
# sh checkflist
# unset DESTDIR

Now let's build and install X

First we need an X build directory since building X doesn't work the same as building the system it should be empty but if it isn't it needs to be.

# mkdir /xf4-bld
# cd /xf4-bld
# lndir /usr/XF4
# make build

We need a DESTDIR to make the X release it also needs to be empty so don't try to use the same DESTDIR from earlier.

# mkdir /destdir-xf4
# export DESTDIR=/destdir-xf4
# make release
# unset DESTDIR RELEASEDIR

You should now have all the install files needed in /releasedir/3.8/i386 for a stable install. Now you simply need to rip an ISO of /releasedir

# cd /releasedir
# mkisofs -vrTJV "OpenBSD38" -b 3.8/i386/cdrom38.fs -c boot.catalog -o OpenBSD38.iso /releasedir/

Your ISO is built and just needs to be burned to CD via whatever method you prefer. I use:

# cdrecord -v speed=24 dev=/dev/rcd0c -data /releasedir/OpenBSD38.iso

byron

cod3fr3ak
January 30th, 2006, 15:29
Very good how-to. i'll try it when I get home.

byron
January 30th, 2006, 17:39
Please let me know if you run into any problems or find any errors in this howto. I would like it to be as complete and accurate as possible.

Thanks

cod3fr3ak
February 7th, 2006, 21:15
I'm running a test now. Basically I just created a script from the text of your post. Its running now. I'll let you know how it goes.

cod3fr3ak
February 8th, 2006, 00:37
Looks good. I boot off the cd and installed on another machine just fine.
I saw some MD5 errors, but I do not think they are any problem. Good work.

cod3fr3ak
February 8th, 2006, 00:38
What changes would need to be made to create a disk from CURRENT?

oenone
February 8th, 2006, 03:28
What changes would need to be made to create a disk from CURRENT?
change 3.8 to 3.9 (the directories)
remove -rOPENBSD_3_8 from the cvs statements
change 38 to 39 in the mkhybrid statement (is there still mkisofs?)

rest should be the same (change it to 4.0/40 and higher when current moves on).

regards,
oenone

cod3fr3ak
February 8th, 2006, 10:48
Sweet. thanks oenone.

Nightsdawn trilogy?

oenone
February 8th, 2006, 18:12
Nightsdawn trilogy?
Yeah.. I love these books :)

regards,
oenone

cod3fr3ak
February 9th, 2006, 11:08
Sweet! Yeah they were an excellent series of stories.
You should def check Richard K. Morgans stuff.