White Box Enterprise Linux


Menu

Home
News
FAQ
Download
Known Bugs
Howto

How I did it, or "HOWTO Roll your own"

Update 05/03/15:
The current version of my scripts is available. It includes scripts to create chrooted build environments for 3.0, 3.0 Respin 2, the beta of RHEL4 and a early draft of the scripts for WBEL4.
whitebox-buildutils.tar.gz

So far this has been question #1, so here are some details on how this distro was assembled. I didn't take enough detailed notes to answer every question. I am however planning to rebuild White Box on itself as the next step, to make sure it is self hosting. More details will be posted then.

Preparation

To begin I installed Taroon-beta on a midrange server, a Dual Xeon 2.4Ghz with 2GB of memory and an Intel RAID controller. To begin I started rebuilding taroon-beta on itself. As anyone who did any rebuilding on the beta will attest, it was missing a LOT of -devel packages. There was also a nice circular dependency between Ghostscript and Gimp-Print. But several loops of build, install -devel, debug, repeat yielded a high success percentage and the failed builds were limited to userland packages such as OOo and emacs.

Update 03/11/15:
Below should be the complete list of packages you need to track down to rebuild RHEL3/Whitebox-RC1, not counting -devel packages where the main package and srpm is aleady present on the RHEL3 CDs but the -devel is missing:

bonobo-1.0.22-6.src.rpm
gal-0.23-1.src.rpm
GConf-1.0.9-12.src.rpm
gnome-print-0.37-4.src.rpm
gnome-vfs-1.0.5-13.src.rpm
gtkhtml-1.1.9-0.9.src.rpm
Gtk-Perl-0.7008-31.src.rpm
libcapplet0-1.4.0.1-12.1.src.rpm
libglade-0.17-12.1.src.rpm
libunicode-0.4-12.src.rpm
lynx-2.8.5-11.src.rpm
nasm-0.98.35-3.src.rpm
oaf-0.6.10-7.src.rpm
perl-PDL-2.3.4-4.src.rpm
skkdic-20020724-1.src.rpm

If you can't find them elsewhere, I have a local copy but please be gentle, we are in a bandwidth poor area and I found them all at RPMFind.

During this phase the only custom scripting needed was these two mind numbingly trivial bash scripts:

bin/generaterpmlist
#!/bin/bash

SPATH="/usr/src/redhat/SRPMS"
DATAPATH=~/rebuilder/
PKGLIST="${DATAPATH}/pkglist"

# Make the log directory if it doesn't already exist
if [ ! -d $PKGLIST ]
then
	echo "Creating $PKGLIST"	
	mkdir -p $PKGLIST
fi

#Make an entry for each package.

for package in `cd $SPATH ; ls *.src.rpm `
do
	touch ${PKGLIST}/$package
done


bin/buildpackages
#!/bin/bash

SPATH="/usr/src/redhat/SRPMS"
DATAPATH=~/rebuilder/
PKGLIST="${DATAPATH}/pkglist"
LOGDIR="${DATAPATH}/logs"

# Bail if the packagelist directory does not exist
if [ ! -d $PKGLIST ]
then
	echo "No packagelist.  Try generaterpmlist."	
	exit 1
fi

# Make the log directory if it doesn't already exist, otherwise clean out
# the logs from the last build attempt.
if [ ! -d $LOGDIR ]
then
	echo "Making $LOGDIR"
	mkdir -p $LOGDIR
else
	rm -f ${LOGDIR}/*
fi

#Try making each package. If it builds, remove the log and packagelist entry
#otherwise leave both.  

for package in `cd $PKGLIST ; ls *.src.rpm `
do
	rpmbuild --rebuild ${SPATH}/$package &>$LOGDIR/$package
	if [ $? -eq 0 ] ; then
		rm ${PKGLIST}/${package} ${LOGDIR}/${package}
	fi
done

btw, a full run on the hardware I have available takes around 25 hours.

Building the RHEL SRPMS

When the SRPMS for RHEL3 became available I was ready. All I had to do was clean out /usr/src/redhat and start building. Found a couple of missing build dependencies in the final SRPMS (Bugzilla #108566 and #108566) but things worked better than expected. Remember to build the i686 kernel, glibc and openssl packages and the athlon kernel manually because the script above won't.

Note that a user named buildsys needs to exist to build the comps and rpmdb packages, but has no special requirements. Also, to build the rpmdb package you either need to make sure one isn't installed on the build machine or patch the .spec file. I opted for leaving it uninstalled.

Also, several rpm macros need setting. Here is the ~/.rpmmacros file on my build machine:

%basedir	/usr/local/rebuild/en/3.0/i386/RedHat/base
%compsversion	3.0.0whitebox

%rpmdbname	whitebox
%rpmdbversion	3.0
%rpmdbtree	/usr/local/rebuild/en/3.0

%_signature gpg
%_gpg_path /root/.gnupg/
%_gpg_name 73307DE6
%_gpgbin /usr/bin/gpg

The next step was actually rebuilding a running distro. To populate the tree I dumped the taroon-beta CD1 into /usr/local/rebuild/en/3.0/i386 and filled the RedHat/RPMS and SRPMS directories.

Next was figuring out how to do all the fiddly bits. First of all, go ahead and do export PYTHONPATH=/usr/lib/anaconda because several of the scripts will fail without it.

RHEL is similar to previous RedHat releases so the existing HOWTOs are very useful here. I used these:

In rough order, here are the steps to get to bootable CDs:

  1. Edit comps.xml.

  2. rebuild the comps rpm.

  3. Drop the binary RPM into RedHat/RPMS

  4. Rebuild the rpmdb package, again moving the RPM into place and removing any existing copy.

  5. build a package list with:
    /usr/lib/anaconda-runtime/pkgorder \
    /usr/local/rebuild/en/3.0/i386 i386 \
    >/usr/local/rebuild/en/3.0/pkgorder-i386.txt
    
  6. Regenerate the hdlist with:
    /usr/lib/anaconda-runtime/genhdlist \
    --fileorder /usr/local/rebuild/en/3.0/pkgorder-i386.txt \
    /usr/local/rebuild/en/3.0/i386
    

    p.s. There is method in my apparent madness of typing out complete paths. Several of the utilities failed in unexpected places with relative paths so I got into a habit of just spelling them out completely even when a file was in the current directory.

  7. If any warnings appeared in either of the two steps above, hit the UP arrow and run them again. They depend on each other so just run em til they stop complaining.

  8. Now you can run buildinstall. But unless you have the White Box anaconda-runtime rpm installed you need to fix a fatal bug on line 165. Edit it and add double quotes around $RELEASESTR and $PRODUCTSTR.

  9. Here is how I ran buildinstall:
    /usr/lib/anaconda-runtime/buildinstall --comp dist-3.0 \
    	--pkgorder /usr/local/rebuild/en/3.0/pkgorder-i386.txt \
    	--release "White Box Enterprise Linux 3.0 (Liberation)" \
    	--product "White Box Enterprise Linux 3.0 (Liberation)" \
    	--version 3.0 /usr/local/rebuild/en/3.0/i386/
    
  10. From here you can copy /usr/local/rebuild/en/3.0/i386/images/bootdisk.img and /usr/local/rebuild/en/3.0/i386/images/drvnet.img to floppies, share out /usr/local/rebuild/en/3.0/i386/ and perform a network install. If you also got my openssl problem in your build it will install and fail when running firstboot, discussed elsewhere.

  11. Once you have a set of packages that run, if you used the RedHat SRPMS you need to move on to trademark removal, a topic discussed below.

  12. Eventually you will be satified with your distro and be ready to roll ISO images. This short script will do the first step and fix a problem with crazy directory names that I haven't figured out a cause for yet. Run it from /usr/local/rebuild/en/3.0/
    #!/bin/bash
    
    /usr/lib/anaconda-runtime/splittree.py --arch=i386 --total-discs=6 \
    	--bin-discs=3 --src-discs=3 \
    	--release-string="White Box Enterprise Linux 3.0 (Liberation)" \
    	--pkgorderfile=/usr/local/rebuild/en/3.0/pkgorder-i386.txt \
    	--distdir=/usr/local/rebuild/en/3.0/i386/ \
    	--srcdir=/usr/local/rebuild/en/3.0/i386/SRPMS/
    
    mv i386/-disc1/ i386-disc1
    mv i386/-disc2/ i386-disc2
    mv i386/-disc3/ i386-disc3
    mv i386/-disc4/ i386-disc4
    mv i386/-disc5/ i386-disc5
    mv i386/-disc6/ i386-disc6
    

    This gets you six subdirectories in your current directory full of hard links back to the main tree. Now you need to regenerate the hdlist with disc numbers. If you want to keep the main tree untouched you should delete i386-disc1/RedHat/base/hdlist* before the next step, but it shouldn't matter since a set of CD's dumped into a directory will work for network installs.

    /usr/lib/anaconda-runtime/genhdlist \
    --withnumbers --fileorder /usr/local/rebuild/en/3.0/pkgorder-i386.txt \
    /usr/local/rebuild/en/3.0/i386-disc[123]
    
  13. Now you can generate the actual .ISO files. Here is the script I used:
    #!/bin/bash
    
    publisher='Beauregard Parish Public Library'
    bootimg='isolinux/isolinux.bin'
    bootcat='isolinux/boot.cat'
    distname='liberation'
    distvers='3.0'
    mkisopts='-r -N -L -d -D -J'
    today="$(date '+%d %b %Y')"
    mkisofs $mkisopts \
    	-V "WhiteBox $distvers ($distname) Disk 1" \
    	-A "WhiteBox $distvers ($distname) created on $today" \
    	-P "$publisher" \
    	-p "$publisher" \
    	-b "$bootimg" \
    	-c "$bootcat" \
    	-no-emul-boot -boot-load-size 4 -boot-info-table \
    	-x lost+found \
    	-o "$distname"-1.iso \
    	i386-disc1
    
    /usr/lib/anaconda-runtime/implantisomd5 "$distname"-1.iso
    
    for i in 2 3 4 5 6 ; do
    	mkisofs $mkisopts \
    	-V "WhiteBox $distvers ($distname) Disk $i" \
    	-A "WhiteBox $distvers ($distname) created $today" \
    	-P "$publisher" \
    	-p "$publisher" \
    	-x lost+found \
    	-o "$distname"-${i}.iso \
    	i386-disc${i}
    
    	/usr/lib/anaconda-runtime/implantisomd5 "$distname"-${i}.iso
    
    done
    
  14. Burn the ISOs and test.

Filing off the serial numbers....

Ok, you have a home rolled RHEL. But you can't redistribute RHEL without incurring the wrath of Red Hat's trademark lawyers so now begins the fun part. The EULA only says you must change the redhat-logos and anaconda-images packages. Yea, right. I know I didn't want to put up ISO images with RedHat's name all over it on a server in the reach of US law.

So I pretty much pulled RedHat's name off of just about everything that might imply that White Box was a relative of RHEL or anyway connected with Red Hat, Inc. I did leave their name on individual packages created by them. There is a difference between creating an impression of being connected with RedHat and stealing credit for their copyrighted works. So I left all copyright notices intact and left their name in where it would be appropriate to leave anyone else's name in place. So you do get the option to install Red Hat's server configuration tools but nowhere will Red Hat Linux or Red Hat Enterprise Linux appear to an end user. (At least in theory.... I probably missed a few.)

Here is an incomplete list of places I made edits:

  • Changed /etc/redhat-release to whitebox-release This implies several other changes, including inittools and multiple references inside anaconda.

  • I whacked away for a day or so on anaconda to replace references to RedHat. Also anaconda-help and anaconda-product. Had to replace a lot of graphics in anaconda-images

  • Only a small edit was required to get rpmdb-whitebox.

  • Replaced the RedHat advert in indexhtml so that a big RedHat logo wouldn't appear on the first launch of Mozilla. Still need to fix Mozilla itself to expunge the RHN link and other RH mods.

  • Loopback mount /usr/local/rebuild/en/3.0/i386/RedHat/base/product.img and replace pixmaps/splash.png with your own splash screen, dump /usr/lib/anaconda/installclasses/*py into installclasses (edit as appropriate to your needs) and edit .buildstamp to use your name/version. Yes there is a script to remake it from anaconda-product but I found it quicker to manually fix it than figure it out.

  • Made a small patch to RPM so it would still behave 'Red Hat like' in the absence of /etc/redhat-release. (Not in RC1)