OpenBSD
Contents
Custom Kernel in OpenBSD bsd.rd
The bsd.rd file is a kernel and compressed ramdisk of a file system including the goodies required to install/upgrade OpenBSD. I have a system with a block device that isn't included in the default bsd.rd. I needed to create a custom bsd.rd to install OpenBSD.
Customize the Kernel
There are a few different RAMDISK kernels, and I chose to work with RAMDISK_CD. Go to /usr/src/sys/arch/i386/conf. Copy RAMDISK_CD to RAMDISK_CD.bak. Edit RAMDISK_CD to include your changes. Build the kernel the usual way (config RAMDISK_CD; cd ../compile/RAMDISK_CD; make depend ; make clean ; make ).
Install crunchgen
Go to /usr/src/distrib/crunch. Run "make" and "make install".
Install distrib/special
Go to /usr/src/distrib/special. Run "make" and "make install".
Build bsd.rd
Go to /usr/src/distrib/i386/ramdisk_cd. Type "make". You'll find bsd.rd, cdrom??.fs and a few more friends in the 'obj' directory.
make a bootable CD
- customize the GENERIC and RAMDISK_CD kernels
- do a "make build" to create all the nifty install sets
- create custom bsd.rd as above
go to /usr/src/distrib/i386/ramdisk_cd
- create a dir called 'cd'
- copy install sets (base.tgz etc..) to 'cd'
- copy obj/cdrom40.fs to 'cd'
- make sure you are in the directory that contains 'cd'
- Run mkhybrid like this:
mkhybrid -r -b cdrom40.fs -c "boot.catalog" -o obsd40.iso cd
Making a Local Install Mirror
Just copy all the install sets to a web directory
AND!
ls > index.txt
Without the index.txt file, the installer will not think the install sets are really there, and it will not say anything about index.txt.
Binary Patches
The traditional and supported method for distributing patches in OpenBSD is either to build the src on each machine, or make a complete OpenBSD distro for each errata and install that. I figured there had to be a better way.
I asked on a mailing list (don't remember which) and got this great answer
From: Antoine Jacoutot (ajacoutotlphp.org)
Date: Fri Jun 30 2006 - 14:18:14 CDT
On Fri, 30 Jun 2006, Dylan Martin wrote:
> If there is a better or best way to do this, let me know!
You could try something like :
#!/bin/sh
DESTDIR=/tmp/sendmail
mtree -qdef /etc/mtree/4.4BSD.dist -p ${DESTDIR}/ -u
touch ${DESTDIR}/timestamp
cd /path_to_sendmail_src
env DESTDIR=${DESTDIR} make -f Makefile.bsd-wrapper install
cd ${DESTDIR}
find . \! -name "plist" -newer timestamp -type f > plist
cat plist | xargs tar czpf ${DESTDIR}/patch.tgz
--
AntoineSee http://archives.neohapsis.com/archives/openbsd/2006-06/2013.html
Note on Includes
Somehow setting DESTDIR seems to have screwed up the includes part of cc when I was building openssl. I just had to export CFLAGS -I/usr/include to make it happy.
oh...
I should only set DESTDIR during make install. Otherwise it makes includes and CFLAGS and everything all wonky
Upgrades
see OS Upgrades
/etc
Here's some of the file's I've manually changed. Don't blow these away on update.
- /etc/mtree/special - dmartin owns /usr/src
- /etc/security - on celeste only - removed bit that looks for "Login celeste is off but still has a valid shell and alternate
- access files in home directory are still readable."
