JackLab/How to remaster the JAD DVD

From openSUSE

How to remaster the JAD DVD

Nobody has tested this yet!

Motivation

You want to add some files or you want to change the installation process.

The opensuse installation process, the big picture

It's usefull to know how the installation process works. It helps you to figure out where you have to change things.

dvd-boot -> isolinux.bin -> isolinnux.cfg -> kernel/initrd/linuxrc -> opensuse inst-sys/control.xml -> stage2 -> installed system

dvd-boot

The pc bios is responsible for booting from the dvd (el-torito boot). The bios loads isolinux.bin

isolinux.bin

location dvd://boot/i386/loader/isolinux.bin

loads isolinux.cfg

isolinux.cfg

Holds the configuration for the bootscreen, languages, location of the kernel and initrd

location dvd://boot/i386/loader/isolinux.cfg

kernel/initrd/linuxrc

The kernel and initrd is loaded into memory by isolinux.bin and executed. From now on linux is responsible for the hardware, the bios is not used anymore. initrd contains drivers for the dvd-hardware and the dvd filesystem (and more...) It contains also a program called linuxrc that is responsible to configure the access to the installation media. This can be the network configuration for a network installation, here it loads the needed drivers to acces the dvd. Then it loads the installation system. This is done automatically, but if linurc does not find the installation media, it will tell you that something went wrong and you see a blockgraphics application. There you can try to fix the problem and start the installation again (no reboot needed).

location kernel dvd://boot/i386/loader/linux initrd dvd://boot/i386/loader/initrd

inst-sys/control

The installation system is a mini linux with all the kernel drivers and the yast2 installation programs. It is configured by the file control.xml Yast2 configures the grafics mode and starts the real installation (partitioning/packetselection and so on). It also installes the kernel and configures the bootloader. If the installed kernel is not the same as the one that was used to boot from the installation dvd the pc is rebooted now and the installation (stage2) is continued from the freshly installed system (inst-sys is not used anymore) Otherwise stage2 is called directly witout reboot.

location inst-sys dvd://boot/i386/root control.xml dvd://control.xml

Related: JackLab/Change inst-sys and control.xml in alpha2 for kernel-rt and network

stage2

In this phase things like hardware configuration and user setup is done. After that linux is brought to the default runlevel, usaully the graphical login.

location dvd://boot/i386root or on the installed system.

Remaster


mkisofs is used to make an new dvd image.

with mkisofs you can

- exclude files from the directory tree (-m fileglob)

- add files to the directory tree (-graft-points file_in_tree=file )

- make a bootable dvd (-b "boot/i386/loader/isolinux.bin" -c "boot/i386/loader/boot.cat" -no-emul-boot -boot-load-size 4 -boot-info-table

- sort files in the image (-sort sort_file)

With the options to add and remove there is no need to copy dvd contents to the hard disk you just need read only access to dvd. This can be done by mounting the dvd which is slow, or by loop mounting the dvd-image you have downloaded. You can replace files with a combination of remove and add.

The sort option is used to put boot related files at the beginning of the dvd which make booting from dvd a lot faster.

To make the dvd bootable two files need a special treatment

- boot/i386/loader/boot.cat is generated by mkisofs, but the file is already on the original image, it must be excluded.

- boot/i386/loader/isolinux.bin is modified my mkisofs, but now it is read only. Copy isolinux.bin to the hard disk and make it writable, exclude it from the original and add the version fram the hard disk.

Doing it

In this example I will replace the installation system (boot/i386/root) and the control file (control.xml) which I customized.

loop mount the dvd image as user root

mount -o loop /path/to/dvd-image.iso /mnt

as normal user do

#where the original dvd image is mounted
JAD_MOUNT=/mnt

#where the files to replace are
WORK_DIR=~/Documents/JAD

#where to put the new dvd-image
IMAGE=/tmp/JAD-10.2-alpha2-rt-DVD.iso

#copy isolinux.bin to $WORK_DIR 
cp -f $JAD_MOUNT/boot/i386/loader/isolinux.bin $WORK_DIR
chmod u+rw $WORK_DIR/isolinux.bin

# generate a list of all files in boot/i386/ and boot/i386/loader to make boot faster
cd $JAD_MOUNT/boot/i386
find  . -type f | awk '{print "boot/i386" substr($1,2),2}' > $WORK_DIR/sort_list
cd -

#call mkisofs, exclude $JAD_MOUNT/boot/i386/root and control.xml
#add $WORK_DIR/root and $WORK_DIR/control.xml
mkisofs -v -V JAD-1.0-alpha2-rt -r -J -l -L -P "jacklab.net" -A "JAD-1.0-alpha2-rt DVD"\
    -b "boot/i386/loader/isolinux.bin" \
    -c "boot/i386/loader/boot.cat" \
    -no-emul-boot -boot-load-size 4 -boot-info-table \
    -m boot.cat -m isolinux.bin -m $JAD_MOUNT/boot/i386/root -m control.xml \
    -o $IMAGE \
    -sort $WORK_DIR/sort_list \
    -graft-points \
        boot/i386/loader/isolinux.bin=$WORK_DIR/isolinux.bin \
        boot/i386/root=$WORK_DIR/root \
        control.xml=$WORK_DIR/control.xml \
    $JAD_MOUNT

Now you can burn the image and waste a DVD-R or you test the image first.

Testing

You can use qemu to test the image, it's slow, but you can do other things in the mean time.

make a file to host the virtual hard drive, file size is 3GB

qemu-img create /path/to/myimage.img 3G  

run qemu

qemu  -hda /path/to/myimage.img  -cdrom /path/to/dvd-image -boot d  -m 256

at the boot prompt enter clock=pit to make the 2.6 kernel run better

clock=pit


missing:

- all the links I collected

- more infos for inst-sys and control.xml

- formating