Niels de Vos wrote:
Thanks for all your help,
Its been an absolute pleasure actually ! I've struggled with this thing
on various platforms a number of times and its great to get it working.
For completeness, I've attched my script, ks.cfg and syslinux.cfg files.
The dd.img file referenced in the script is just your standard driver
disk whose modules.cgz file contains drivers for the standard, BOOT, smp
and bigmen kernels.
Here's hoping others will also find useful.
Enjoy !
#
# Last Updated JBC: Wed Aug 9 16:47:22 EST 2006
#
# This script (MkCustomDvd) expects the following hierarchy of resources.
# .
# ./MkCustomDvd
# ./Distro/valhalla-i386-disc?.iso
# ./Distro/updates/i386/modutils-2.4.18-3.7x.i386.rpm"
# ./MyPatches/dd.img
# ./MyPatches/ks.cfg
# ./MyPatches/syslinux.cfg
#
# ----------------------
# Some useful functions
# ----------------------
#
CopyBranch()
{
Cwd=`pwd`
cd $1
if [ "" != "$2" ] ; then
rm -rf $2/*
find . -print | cpio -pdmv $2
if [ $? != 0 ] ; then
echo "****************** ERROR. Target space ($2) too small for copy **************"
exit 10
fi
fi
cd $Cwd
}
#
# Syntax: RemakeInitrdFs <imageCopyDir> <imageCopyFile>
#
# WARNING: Don't remove the + 1000 in this function. It ensures that the initrd.img
# file created here is big enough to provided a reasonable workspace for the
# running boot kernel !!!
#
# IMPORTANT: Don't use this with cdboot.img or boot.img. You need to patch the Distro's
# version directly because it contains the boot sector which is lost if
# you make a copy of the image !
#
RemakeInitrdFs()
{
ImgCopyDir=$1
NewImgFile=$2
rm -f $NewImgFile
NewImgFileMountPoint=/tmp/RH73.mountpoint
mkdir -p $NewImgFileMountPoint
NewSizeK=`du -k -s $ImgCopyDir | awk '{print $1}'`;
NewSizeK=`expr $NewSizeK + 1000`;
dd if=/dev/zero bs=1k count=$NewSizeK of=$NewImgFile
echo "y" | mke2fs $NewImgFile > /dev/null
mount -o loop $NewImgFile $NewImgFileMountPoint
CopyBranch $ImgCopyDir $NewImgFileMountPoint
Result=$?
umount $NewImgFileMountPoint
rmdir $NewImgFileMountPoint
if [ $Result != 0 ] ; then
echo "Error creating image file: $NewImgFile"
exit 11
fi
}
CopyIso()
{
Iso=$1
Target=$2
echo "Copying $Iso contents to work directory $Target"
mount -o loop $Iso /mnt
cd /mnt
find . -print | cpio -pdmv $Target
cd -
umount /mnt
find $Target -name TRANS.TBL -exec rm -f {} \;
}
#
# Step 00: 1) Forget everything you ever read about masterfully patching
# modules.cgz inside initrd of the cdboot.img file with a BOOT
# kernel compatible driver etc,etc,etc IT ISN'T NECESSARY !
#
# 2) Once you have built your lovely new DVD, NEVER leave it in
# the drive of the machine you used to build it. This is because
# if you forget it's there and the machine is rebooted, the DVD
# will autoload and, after a timeout period, ruthlessly TRASH YOUR
# HARD DRIVE !!
#
# Step 01: Set up some variables and clean up from past attempts.
#
BASE=`pwd`
BUILD=$BASE/rh
TOPLEVELDIR=$BUILD/ONE_CD
RHROOT=$TOPLEVELDIR/i386
RHVERSION=7.3
CUSTOM_ISO=$BASE/custom.iso
MODUTILS=$BASE/Distro/updates/i386/modutils-2.4.18-3.7x.i386.rpm
PATH=$PATH:/usr/lib/anaconda-runtime
#
# Step 02: Assert some key assumptions.
#
if [ `uname -r` != "2.4.18-3" ] ; then
echo "Please run this on the vanilla kernel"
exit 1
fi
if [ ! -d ./Distro ] ; then
echo "Please check that you adhere to the following hierarchy:."
echo " ./MkCustomDvd"
echo " ./Distro/valhalla-i386-disc?.iso"
echo " ./Distro/updates/i386/modutils-2.4.18-3.7x.i386.rpm"
echo " ./MyPatches/dd.img"
echo " ./MyPatches/ks.cfg"
echo " ./MyPatches/syslinux.cfg"
echo ""
exit 2
fi
if [ ! -f $MODUTILS ] ; then
echo "You need $MODUTILS"
exit 3
fi
#
# Step 03: Get prepared and tidy up past attempts
#
mkdir -p $RHROOT
rm -rf $RHROOT/* ./work
# Step 04: Copy the standard Valhalla distro's ISO files into a
# suitable workspace hierarchy
CopyIso ./Distro/valhalla-i386-disc1.iso $RHROOT
CopyIso ./Distro/valhalla-i386-disc2.iso $RHROOT
CopyIso ./Distro/valhalla-i386-disc3.iso $RHROOT
#
# Step 05: Ensure we've got everything we need to build a new DVD hierarchy
# that will form the basis for our new ISO.
#
rpm -Uhv $MODUTILS
rpm -ihv $RHROOT/RedHat/RPMS/anaconda-runtime*
rpm -ihv $RHROOT/RedHat/RPMS/dvdrecord*
#
# Step 06: Rebuild the new DVD hierarchy
#
genhdlist $RHROOT
chmod 644 $RHROOT/RedHat/base/hdlist{,2}
export LANG=en_AU
#
buildinstall --pkgorder $TOPLEVELDIR/pkgorder.txt --comp dist-$RHVERSION --version $RHVERSION $RHROOT
genhdlist --fileorder $TOPLEVELDIR/pkgorder.txt --withnumbers $RHROOT
#
# ===========================================================================
# ------- So far so good. Now we modify cdboot.img with our kickstart changes.
# ===========================================================================
#
# Step 11: Prepare a work area and some mount points for image tinkering
#
mkdir -p ./work ./work/unpacked.initrd ./work/mntC ./work/mntI
#
# Step 12: Extract the vanilla cdboot.img from the DVD hierarchy and mount it
#
cd ./work
cp $RHROOT/dosutils/autoboot/cdboot.img .
chmod 644 cdboot.img
mount -o loop cdboot.img mntC
#
# Step 13: Uncompress and expand the vanilla initrd.img, taking it from inside the
# mounted cdboot.img.
#
gzip -cd <./mntC/initrd.img >initrd.unzipped.img
mount -o loop initrd.unzipped.img ./mntI
cd ./mntI
find . -print | cpio -pdm ../unpacked.initrd
cd ..
umount ./mntI
rm unpacked.initrd.img
# -------
#
# Step 14: Copy our custom kickstart file (ks.cfg) into initrd
# The ks.cfg file MUST be copied to /tmp of the initrd.
#
# At a minimum, you need to have included the following line in ks.cfg
# (you can put it pretty much anywhere you like before the %packages
# marker)
#
# driverdisk hda --type=iso9660
#
# Note that the use of 'hda' here means that our new DVD will only
# install on systems where the DVD drive itself is physically
# connected as an IDE primary master. I also found that hda and hda0
# both worked here.
#
cp ../MyPatches/ks.cfg ./unpacked.initrd/tmp/
# -------
#
# Step 15: Reconstruct a new initrd.img using our patched hierarchy.
#
RemakeInitrdFs unpacked.initrd unpacked.initrd.img
gzip -c < unpacked.initrd.img >mntC/initrd.img
# Our modified initrd.img is now safely back inside cdboot.img
# -------
#
# Step 16: Copy our custom syslinux.cfg into cdboot.img to tell the installer that
# we intend to do a kickstart install using the kickstart file we just embedded
# in cdboot.img. Remember that the cd boots by using cdboot.img which is floppy
# image sneakily loaded from the DVD at cold start. The correct syslinux instruction is
# therefore ks=floppy
#
# At a minimum, you therefore need to have done the following to the default syslinux.cfg
#
# CHANGE append initrd=initrd.img lang= devfs=nomount ramdisk_size=8192 vga=788
# TO append initrd=initrd.img lang= devfs=nomount ks=floppy ramdisk_size=32768 vga=788
#
cp ../MyPatches/syslinux.cfg mntC
umount mntC
# -------
#
# Step 17: Put our shiny new custom cdboot back into the DVD hierarchy
#
mv cdboot.img $RHROOT/dosutils/autoboot/
cd ..
#
# Step 18: Leave no trace !
#
rm -r work
# -------
#
# Step 19: Copy the custom driver diskette into the correct place.
# For kickstart to be able to find the drivers we want to use,
# we need to place the CONTENTS (i.e. NOT a copy of the img file!!)
# of the driver disk into the root of the DVD.
#
DD_IMG=./MyPatches/dd.img
if [ -f $DD_IMG ] ; then
mount -o loop $DD_IMG /mnt
cd /mnt
find . -print | cpio -pdmvu $RHROOT
cd -
umount /mnt
fi
#
#
cd $RHROOT
mkisofs -r -J -T -v -V "$PRODUCT" -c boot.cat -b dosutils/autoboot/cdboot.img -o $CUSTOM_ISO .
#
#
# ---------------------------------------------
# Burn the DVD using the new DVD-ready ISO File
# ---------------------------------------------
#
dvdrecord blank=fast dev=1,0,0
dvdrecord -v -dev=1,0,0 -dao -data -eject speed=4 $CUSTOM_ISO
#
# Kickstart file automatically generated by anaconda.
install
lang en_US
langsupport --default en_AU en_AU en_US.iso885915
keyboard us
mouse generic3ps/2 --device psaux
xconfig --card "ATI Mach64" --videoram 8192 --hsync 31.5-48.5 --vsync 50-70 --resolution 1024x768 --depth 16 --startxonboot
network --device eth0 --bootproto static --ip 192.168.2.132 --netmask 255.255.255.0 --gateway 192.168.2.1 --nameserver 192.168.2.1 --hostname rh73
rootpw --iscrypted $1$ûsÁñ2Ojú$OW97/dcOspuufxVp.ZFaw/
firewall --medium --dhcp --port smtp:tcp --port http:tcp --port ftp:tcp --port ssh:tcp --port telnet:tcp --trust eth0
authconfig --enableshadow --enablemd5
timezone Australia/Melbourne
bootloader --append hda=ide-scsi --useLilo
driverdisk hda --type=iso9660
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
clearpart --all --drives=sda
part /boot --fstype ext3 --size=50 --ondisk=sda
part /usr --fstype ext3 --size=1400 --grow --ondisk=sda
part swap --size=1000 --grow --maxsize=2000 --ondisk=sda
part /home --fstype ext3 --size=512 --grow --ondisk=sda
part / --fstype ext3 --size=384 --ondisk=sda
part /var --fstype ext3 --size=256 --ondisk=sda
%packages
@ Printing Support
@ Classic X Window System
@ KDE
@ Sound and Multimedia Support
@ Network Support
@ Dialup Support
@ Messaging and Web Tools
@ NFS File Server
@ Windows File Server
@ Anonymous FTP Server
@ SQL Database Server
@ Web Server
@ DNS Name Server
@ Server
sash
esound-devel
cdparanoia-devel
mozilla-chat
compat-libstdc++
koncd
VFlib2-devel
knode
kdesdk-kbabel
ddd
xine
kdemultimedia-arts
rsync
pspell-devel
cups-devel
SDL
asp2php-gtk
sane-backends-devel
kppp
licq-kde
libogg-devel
doxygen
glib2-devel
php-imap
Glide3-devel
rhn_register-gnome
kregexpeditor-devel
kernel-smp
lesstif-devel
qt2
lesstif
openmotif-devel
pygtk-devel
libvorbis-devel
nmap-frontend
kdegames-devel
unixODBC-devel
mozilla-psm
libkscan
smpeg
kdoc
mozilla-nspr
kscd
xisdnload
zsh
Xaw3d-devel
lm_sensors-devel
libcap-devel
kdelibs-devel
SDL-devel
kmail
alchemist-devel
SDL_net
qt-devel
kdict
php-devel
PyQt-devel
kpf
kernel-debug
SDL_image-devel
freetype-devel
kdegames
kdemultimedia-devel
SDL_net-devel
vnc
libao-devel
apacheconf
kljettool
xmms-devel
sip
pilot-link-devel
sip-devel
kdevelop
audiofile-devel
pygtk2-devel
firewall-config
xpdf
licq
imlib-devel
kernel-bigmem
kdenetwork-libs
kdbg
bind-devel
XFree86-devel
kview
usbview
klprfax
netscape-common
php-pgsql
gtk+-devel
korn
plugger
kviewshell
gnuplot
ksirc
arpwatch
mozilla-mail
cervisia
kdesdk-kompare
python2-devel
sane-backends
aspell-devel
shapecfg
SDL_image
kernel-BOOT
kdesdk-kapptemplate
kdesdk-kbugbuster
libpcap
pygnome-devel
exmh
kit
apache-devel
kdesdk-kmtrace
kaboodle
kdeaddons-knewsticker
busybox-anaconda
memprof
arts-devel
xawtv
kernel-source
openssh-askpass
kdesdk-kspy
kdeaddons-noatun
kviewshell-devel
sox-devel
up2date-gnome
qt-designer
karm
knotes
PyQt
kdepim-cellphone
vnc-server
autorun
netscape-communicator
kdebase-devel
ktalkd
SDL_mixer
noatun
pdksh
libkscan-devel
isdn4k-utils-devel
kdemultimedia-libs
kmidi
mozilla-nss
libmng-devel
libungif-devel
bindconf
kdemultimedia-kfile
libxml-devel
glib-devel
SDL_mixer-devel
mc
mozilla
kdenetwork-devel
kmix
kmid
kdepim-devel
kpppload
kxmlrpcd
netpbm-devel
smpeg-devel
libxslt-devel
knewsticker
kernel-pcmcia-cs
xmms
timidity++
lisa
ical
klpq
cdrecord-devel
busybox
%post
default linux
prompt 1
timeout 600
display boot.msg
F1 boot.msg
F2 general.msg
F3 param.msg
F4 rescue.msg
F7 snake.msg
label linux
kernel vmlinuz
append initrd=initrd.img lang= devfs=nomount ks=floppy ramdisk_size=32768 vga=788
label text
kernel vmlinuz
append initrd=initrd.img lang= text devfs=nomount ramdisk_size=32768
label expert
kernel vmlinuz
append expert initrd=initrd.img lang= devfs=nomount ramdisk_size=32768
label ks
kernel vmlinuz
append ks initrd=initrd.img lang= devfs=nomount ramdisk_size=32768
label nofb
kernel vmlinuz
append initrd=initrd.img lang= devfs=nomount nofb ramdisk_size=32768
label lowres
kernel vmlinuz
append initrd=initrd.img lang= lowres devfs=nomount ramdisk_size=32768