how to create linux ISO

BUILD Machines

Current Build machines are

192.168.40.100 <i386>
192.168.50.165 <x86_64>

Chose OS

Currently the build is done on centos5

Build Directories

On 192.168.40.100 <i386>

distros name

On 192.168.50.165 <x86_64>


distros name

Getting Started

eg to create a product TEST ( Test can be any of name you would like to give you distros  )

<arch> ---- i386 or x86_64

Create directory /test of desired <arch> machine.

$ cd /test
$ mkdir <arch>

Copy the centos <arch> cd to /test/<arch>

$ mount /dev/cdrom /media
$ cd /media
$ cp -ar * /test/<arch>/
$ cp .discinfo /test/<arch>/

NOTE : .discinfo file os imp without wich it will give a error of not valid centos

Editing stage2

Editing Default CentOS 5.2 stage2.img

Install squashfs rpm

$ rpm -ivh squashfs-tools-3.0-4.x86_64.rpm 

Copy the stage2.img file from the images folder of the cd

$ cp stage2.img /opt/ 

Make Directory

$ mkdir -p /opt/stage2

Mount the copied stage2.img

$ mount -t squashfs stage2.img /media/ -o loop

Copy Contents

$ cd /media
$ cp -arp * /opt/stage2
$ cp .buildstamp /opt/stage2
$ cd /opt/stage2

$ ls -a
.  ..  .buildstamp  etc  lib  lib64  modules  proc  usr  var

Now to start editing the stage2

All the python files are stored under /opt/stage2/usr/lib/anaconda

$  vi kickstart.py

Hash the lines this is so that kickstart will ask for network if not specified in ks file

       if len(filter(lambda nd: nd.bootProto == "query", self.ksdata.network)) == 0:
dispatch.skipStep("network")

Hash this line so as to ask for the welcome screen

            dispatch.skipStep("welcome")

Copy following image files   (stage2) into /opt/stage2/usr/share/anaconda/pixmaps

anaconda_header.png
first-lowres.png
first.png
progress_first-375.png
progress_first-lowres.png
progress_first.png
splash1.png
splash.png
syslinux-splash.png

Copy /opt/stage2/usr/share/anaconda/pixmaps/rnotes after deleting all the files already present

03-centos5-yum.png
06-centos5-support.png
08-centos5-wiki.png
05-centos5-centosplus.png
01-centos5-welcome.png
02-centos5-donate.png
09-centos5-virtualization.png
07-centos5-docs.png
04-centos5-repos.png

now ur nearly done all thats left is a nice new stage2.img file

$ cd /opt/stage2 
$ mksquashfs . ../stage2.img.new
$ mv stage2.img.new stage2.img

Copy the new stage2.img into /test/<arch>/images/

Creating the kickstart file for auto install

$ cd /test/<arch>
$ vi legacy-mpart.cfg

auth --useshadow --enablemd5
install
cdrom
lang en_US
keyboard us
zerombr
firstboot --disable
firewall --disabled
authconfig --enableshadow --enablemd5
selinux --disabled
bootloader --location=mbr --driveorder=hda
skipx

reboot

%packages
@ msx_packages

Include for auto partition under skipx

clearpart --all                       
part /boot --fstype="ext3" --size=200
part swap --recommended
part / --fstype="ext3" --grow --size=1

Including Scripts

Copy the scripts dir into /test/

$ cd /test/scripts

Make changes in each script according to arch...

Creating Make file

Create a Makefile in /test/ dir

vi Makefile 

MKISOFS=/usr/bin/mkisofs
DATE:=$(shell date +"%d-%m-%Y")
CDDIR=/test
ARCH=x86_64
REPODIR=$(CDDIR)/$(ARCH)
RPMDIR=$(CDDIR)/$(ARCH)/CentOS
INSTDIR=$(CDDIR)/roots/installer/usr/local/net/_install
VER=$(shell scripts/version.sh)
#BUILDRPM=/usr/src/redhat/RPMS/$(ARCH)
BUILDRPM=/usr/src/redhat/RPMS/noarch

test: repoclean repo iso

repoclean:
rm -rf $(REPODIR)/repodata/filelists.xml.gz $(REPODIR)/repodata/other.xml.gz $(REPODIR)/repodata/primary.xml.gz $(REPODIR)/repodata/repomd.xml

svnco:
$(CDDIR)/scripts/svnco.sh $(CDDIR)
$(CDDIR)/scripts/premake $(CDDIR)

initrd:
$(CDDIR)/scripts/makeinitrd.sh $(CDDIR)

repo:
scripts/makecomps.sh $(REPODIR)

iso:
@$(MKISOFS) -o $(CDDIR)/images/MailServ_x64-$(DATE).iso -V MailServ-$(VER) -p 'EMS' -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4\
-boot-info-table -R -J -v -T $(REPODIR)

rpmtest:
$(CDDIR)/scripts/rpmtest.sh $(CDDIR)
$(CDDIR)/scripts/dupshow.pl $(RPMDIR)

dupshow:
$(CDDIR)/scripts/dupshow.pl $(RPMDIR)

isocheck:
$(CDDIR)/scripts/isocheck $(CDDIR)

Generating repos

$ cd /test/<arch>/CentOS/

Keep only the desired packages and delete the rest

Making Initrd

The Makefile includes initrd:

Please run

$ make initrd

This will pick up the kickstart file (legacy.cfg and include it into the initrd)

Isolinux edit

cd /test/<arch>/isolinux
$ vi isolinux.cfg

default linux
prompt 1
timeout 600
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux
kernel vmlinuz
append ks=file:/legacy.cfg initrd=initrd.img
label mpart
kernel vmlinuz
append ks=file:/legacy-mpart.cfg initrd=initrd.img
label text
kernel vmlinuz
append initrd=initrd.img text
label ks
kernel vmlinuz
append ks initrd=initrd.img
label local
localboot 1
label memtest86
kernel memtest
append -

This is to prevent errors of cannot find kickstart file since it is in the initrd

Making CD

$ mkdir /test/images
make test




No comments:

Other Articles

Enter your email address: