Custom Linux bootable CD

From WBITT's Cooker!

(Difference between revisions)
Jump to: navigation, search
(comps.xml)
(comps.xml)
Line 193: Line 193:
<pre>
<pre>
 +
[root@kworkhorse CentOS-5.4-x86_64-core]# grep -v  "xml:lang" repodata/comps.xml > /tmp/no-lang.comps.xml
-
[kamran@test CentOS-5.4-x86_64-test]$ grep -v xml:lang repodata/comps.xml > /tmp/no-lang.comps.xml
+
[root@kworkhorse CentOS-5.4-x86_64-core]# wc -l /tmp/no-lang.comps.xml  
-
 
+
-
[kamran@test CentOS-5.4-x86_64-test]$ wc -l /tmp/no-lang.comps.xml
+
2607 /tmp/no-lang.comps.xml
2607 /tmp/no-lang.comps.xml
-
[kamran@test CentOS-5.4-x86_64-test]$ wc -l repodata/comps.xml
+
</pre>
-
11418 repodata/comps.xml
+
-
About 9000 lines removed! I wonder if it will work without any Language?! The comps.xml from CentOS-5.4-x86_64 has
+
As you can see, only 2607 lines to edit! Great! It's time to edit this file,  remove anything which is not related to us, and replace the repodata/comps.xml file with the new one.

Revision as of 18:14, 1 July 2010

This article is in relation to the article CENTOS Server CD project , and is "heavily" based on http://people.redhat.com/rkeech/custom-distro.txt . So here it goes.

Contents

First, the setup

My machine, on which I am doing all these steps / building the Custom CENTOS CD, is named kworkhorse, but will be referred to as the role buildhost in this text. It runs Fedora 11 64 bit.

I have a directory /data/cdimages, which contains full install tree of original CENTOS 5.4 64 bit CD in CENTOS-5.4-x86_64 subdirectory, and an empty CENTOS-5.4-x86_64-core (build) directory. The directory layout looks like the following:


[root@kworkhorse cdimages]# pwd
/data/cdimages

[root@kworkhorse cdimages]# tree -d
.
├── CentOS-5.4-x86_64
│   ├── CentOS
│   ├── images
│   │   ├── pxeboot
│   │   └── xen
│   ├── isolinux
│   ├── NOTES
│   └── repodata
└── CentOS-5.4-x86_64-core

[root@kworkhorse cdimages]# 

The directory /data/cdimages/CentOS-5.4-x86_64-core (which is empty at the moment), will be the custom install tree, and referred to as $RHROOT in this document. Once again:

  • BuildHost: kworkhorse
  • BuildDirectory ( $RHROOT): /data/cdimages/CentOS-5.4-x86_64-core

Required Packages on the build host

Before you continue, you must install the following packages on your base OS.

yum -y install anaconda anaconda-runtime mkisofs cdrecord

Note: anaconda-runtime is RHEL/CENTOS specific package, and is part of the RHEL/CENTOS distribution. As evident below:

[kamran@kworkhorse CentOS]$ ls /data/cdimages/CentOS-5.4-x86_64/CentOS/anaconda-* -1
anaconda-11.1.2.195-1.el5.centos.x86_64.rpm
anaconda-runtime-11.1.2.195-1.el5.centos.x86_64.rpm
[kamran@kworkhorse CentOS]$ 

This package "anaconda-runtime" provides the following packages:

[kamran@kworkhorse CentOS]$ rpm -qpl anaconda-runtime-11.1.2.195-1.el5.centos.x86_64.rpm
. . . 
/usr/lib/anaconda-runtime
/usr/lib/anaconda-runtime/boot
/usr/lib/anaconda-runtime/boot/boot.msg
/usr/lib/anaconda-runtime/boot/general.msg
/usr/lib/anaconda-runtime/boot/options.msg
/usr/lib/anaconda-runtime/boot/param.msg
/usr/lib/anaconda-runtime/boot/rescue.msg
/usr/lib/anaconda-runtime/boot/syslinux.cfg
/usr/lib/anaconda-runtime/buildinstall
. . . 
 . . . 
/usr/lib/anaconda-runtime/pyrc.pyo
/usr/lib/anaconda-runtime/readmap
/usr/lib/anaconda-runtime/screenfont-x86_64.gz
/usr/lib/anaconda-runtime/scrubtree
/usr/lib/anaconda-runtime/splittree.py
/usr/lib/anaconda-runtime/splittree.pyc
/usr/lib/anaconda-runtime/splittree.pyo
/usr/lib/anaconda-runtime/trimmodalias
/usr/lib/anaconda-runtime/trimpciids
/usr/lib/anaconda-runtime/upd-instroot
/usr/lib/anaconda-runtime/yumcache
. . . 
[kamran@kworkhorse CentOS]$ 


If you are using Fedora, you may not find anaconda-runtime. Instead anaconda and anaconda-runtime are merged into single package, which provides the same functionality :

[root@kworkhorse cdimages]# rpm -ql anaconda  | grep runtime
. . . 
/usr/lib/anaconda-runtime
/usr/lib/anaconda-runtime/boot
/usr/lib/anaconda-runtime/boot/boot.msg
/usr/lib/anaconda-runtime/boot/grub.conf
/usr/lib/anaconda-runtime/boot/syslinux.cfg
/usr/lib/anaconda-runtime/buildinstall
/usr/lib/anaconda-runtime/buildinstall.functions
/usr/lib/anaconda-runtime/genmodinfo
/usr/lib/anaconda-runtime/getkeymaps
/usr/lib/anaconda-runtime/keymaps-override-x86_64
/usr/lib/anaconda-runtime/loader
/usr/lib/anaconda-runtime/loader/init
/usr/lib/anaconda-runtime/loader/loader
. . . 
 . . . 
/usr/lib/anaconda-runtime/pyrc.pyc
/usr/lib/anaconda-runtime/pyrc.pyo
/usr/lib/anaconda-runtime/readmap
/usr/lib/anaconda-runtime/screenfont-x86_64.gz
/usr/lib/anaconda-runtime/scrubtree
/usr/lib/anaconda-runtime/trimpciids
/usr/lib/anaconda-runtime/upd-instroot
/usr/lib/anaconda-runtime/upd-updates
. . . 
[root@kworkhorse cdimages]# 

The environment variables

Quote from the original Howto: Many of the scripts provided in these packages are Python scripts. For them to work properly the PYTHONPATH variable must be set to /usr/lib/anaconda and be exported in the shell environment in which the commands are run. Many of the scripts are from the directory /usr/lib/anaconda-runtime, so either put this in the PATH or provide an absolute path to commands.

So, you should setup the necessary environment variables. I would advise you to add the following two lines to your ~/.bash_profile, so each time you open a terminal, these values are set.

export RHROOT=/data/cdimages/CentOS-5.4-x86_64-core
export PYTHONPATH=/usr/lib/anaconda
export PATH=$PATH:/usr/lib/anaconda-runtime

Note: It is important to note, that even on a 64 bit system (as I have), these two paths are /usr/lib/anaconda and /usr/lib/anacoda-runtime. i.e. These two directories does not exist in /usr/lib64.

Build the install tree

To create my minimal install tree, I first created a copy of the original install tree skipping the CentOS directory.

# rsync -av --exclude CentOS/  \ 
  /data/cdimages/CentOS-5.4-x86_64/  /data/cdimages/CentOS-5.4-x86_64-core/

When done, your buildtree would look like this:

[root@kworkhorse CentOS-5.4-x86_64-core]# pwd 
/data/cdimages/CentOS-5.4-x86_64-core

[root@kworkhorse CentOS-5.4-x86_64-core]# tree -d
.
├── images
│   ├── pxeboot
│   └── xen
├── isolinux
├── NOTES
└── repodata

6 directories
[root@kworkhorse CentOS-5.4-x86_64-core]# 

Now we need to copy selected RPMs from the source directory into the build directory. I created this file, by first creating a test VM using minimal Kickstart, and noted the list of packages installed in it. I could not think of any easier way. The file is located in /tmp/minivm, as installed-rpms.txt . (Look in CENTOS Server CD project to see how I generated it. Or use the Core Packages List CentOS-5.4-x86 64 list for list of packages required for CentOS 5.4 64 bit.)

# mkdir /data/cdimages/CentOS-5.4-x86_64-core/CentOS/

# for filename in $(cat /tmp/minivm/installed-rpms.txt); do 
  cp -v /data/cdimages/CentOS-5.4-x86_64/CentOS/"${filename}.rpm" \ 
    /data/cdimages/CentOS-5.4-x86_64-core/CentOS/ 
done

comps.xml

From the original howot: Comps file. The file $RHROOT/RedHat/base/comps.xml defines the set of packages known to the installer. The set of packages described in comps.xml must be reduced to only those required. It is not necessary to remove the unused package files from $RHROOT/RedHat/RPMS/. Some packages from $RHROOT/RedHat/RPMS/ are necessary in the process of building the install CD even though they might be excluded from the custom build.

Here is an example comps.xml file from the original howto (RHEL3 based).

As I mentioned in the related article, (borrowing the term from another author), th comps.xml has gazillion languages represented in it. I want to at least get rid of the languages stuff from the file, so I can work on it.

Here is something interesting. The original comps.xml file (CentOS-5.4) is 11418 lines.

[root@kworkhorse CentOS-5.4-x86_64-core]# wc -l repodata/comps.xml 
11418 repodata/comps.xml
[root@kworkhorse CentOS-5.4-x86_64-core]#

Interestingly, there are 8811 "xml:lang" lines in it!

[root@kworkhorse CentOS-5.4-x86_64-core]# grep  "xml:lang" repodata/comps.xml | wc -l
8811

Lets create a "language-free" version of this file.

[root@kworkhorse CentOS-5.4-x86_64-core]# grep -v  "xml:lang" repodata/comps.xml > /tmp/no-lang.comps.xml

[root@kworkhorse CentOS-5.4-x86_64-core]# wc -l /tmp/no-lang.comps.xml 
2607 /tmp/no-lang.comps.xml

As you can see, only 2607 lines to edit! Great! It's time to edit this file, remove anything which is not related to us, and replace the repodata/comps.xml file with the new one.

Personal tools