Black God

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

Pre-requisite

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-11.1.2.242-1.src.rpm
# yum-builddep kudzu-1.2.57.1.26-1.src.rpm

Install the source rpms as shown below

# rpm -ivh anaconda-11.1.2.242-1.src.rpm
# rpm -ivh kudzu-1.2.57.1.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-11.1.2.242.tar.bz2
# cp -R anaconda-11.1.2.242 anaconda-11.1.2.242.org
# cd anaconda-11.1.2.242

—— 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-11.1.2.242.tar.bz2 anaconda-11.1.2.242.tar.bz2.org
# tar jcvf anaconda-11.1.2.242.tar.bz2 anaconda-11.1.2.242
# 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-11.1.2.242/ 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-11.1.2.242.org/isys/devnodes.c anaconda-11.1.2.242/isys/devnodes.c > anaconda-11.1.2.242-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”.

References:

1. http://fedoraproject.org/wiki/Anaconda/Updates

2. http://www.arrfab.net/blog/?p=305

 

1 comment for “How to prepare anaconda updates image for Red Hat Enterprise Linux and Fedora

Leave a Reply

Your email address will not be published. Required fields are marked *