How to prepare anaconda updates image for Red Hat Enterprise Linux and Fedora
Anaconda is the installer tool for Red Hat Enterprise Linux and Fedora. This tutorial is applicable for their derivatives like CentOS and Scientific Linux also. This tutorial empowers you to fix the bugs or missing features in installer without waiting for Red Hat. The update image you generated is used while installing.
Anaconda update image involves updated files from anaconda itself and/or its dependents. In my case I take kudzu as dependent. BTW kudzu is a hardware detection tool. i.e., I am going to patch two files, one from anaconda package and another one from kudzu package. In your case instead of anaconda/kudzu it may be some thing else. My system is Red Hat Enterprise Linux 5.7
1. Development packages should have been installed
2. The machine should be registered with RHN (Red Hat Network) using “rhn_register” tool.
3. To install build dependency, we need to install yum-utils.
# yum install yum-utils
1. Identify the version of anaconda and kudzu
# yum info anaconda
# yum info kudzu
Note down the version number.
2. Download the corresponding version of source RPMs from Red hat official repository and install the build dependency with following commands.
# yum-builddep anaconda-184.108.40.206-1.src.rpm
# yum-builddep kudzu-220.127.116.11.26-1.src.rpm
Install the source rpms as shown below
# rpm -ivh anaconda-18.104.22.168-1.src.rpm
# rpm -ivh kudzu-22.214.171.124.26-1.src.rpm
3. Here is how to build the anaconda with your code changes. The same step is to be repeated for kudzu also.
# cd /usr/src/redhat/SOURCES
# tar jxvf anaconda-126.96.36.199.tar.bz2
# cp -R anaconda-188.8.131.52 anaconda-184.108.40.206.org
# cd anaconda-220.127.116.11
—— Edit the source code as you want to patch. Don’t forget to upload this patch to upstream ——-
# cd /usr/src/redhat/SOURCES
# mv anaconda-18.104.22.168.tar.bz2 anaconda-22.214.171.124.tar.bz2.org
# tar jcvf anaconda-126.96.36.199.tar.bz2 anaconda-188.8.131.52
# rpmbuild -ba ../SPECS/anaconda.spec
Build should be successful here. We are interested in object files which has our changes. The file may be shared object (.so) file, binary or python script. Let us assume that in my case it is _isys.so. It should be available under BUILD/anaconda-184.108.40.206/ directory. I assume that in _kudzumodule.so is from kudzu build.
It is good to have a patch of what you have changed. Here is how I generated a patch file.
# diff -rup anaconda-220.127.116.11.org/isys/devnodes.c anaconda-18.104.22.168/isys/devnodes.c > anaconda-22.214.171.124-p320.patch
4. Creating anaconda update disk image
# dd if=/dev/zero of=anaconda-update.img bs=512 count=2880
# losetup `losetup -f` anaconda-update.img
# losetup -a
From the the above command identify the loop device for update image, let us say it is /dev/loop1. It is time to format it.
# mkfs.ext2 /dev/loop1
# mount -o loop anaconda-update.img /mnt
# cp _isys.so /mnt
# cp _kudzumodule.so /mnt
# umount /mnt
You can use floppy or USB pen drive to prepare this image disk. In my case it is /dev/sdb.
# dd if=anaconda-update.img of=/dev/sdb bs=512 conv=sync
# eject /dev/sdb
5. Using update disk
Plug in this update pen drive or floppy in your installation target machine. Append “linux updates” to grub’s kernel command line while booting from Live CD to install. If you a third party driver disk also, then it is “linux dd updates”.