Differences between revisions 2 and 3
Revision 2 as of 2006-08-04 06:14:55
Size: 1755
Editor: ?KrisShannon
Comment: Fix command typo
Revision 3 as of 2006-09-23 15:16:29
Size: 1755
Editor: ?FilipVanRaemdonck
Comment: qemu options did not work from the beginning (old ones?)
Deletions are marked like this. Additions are marked like this.
Line 43: Line 43:
 # qemu -user-net -cdrom test.iso  # qemu -net user -cdrom test.iso

Debian-Installer: How to modify an existing CD image to preseed d-i

If you want to preseed DebianInstaller right from booting the installer CD, you can modify it to use an initrd which has your preseed.cfg file.

Create copy of image

You need one of the already built ISO images, which will be used as the basis that we modify. Because you can't modify an ["ISO9660"] image, you've to copy it first:

... as root ...

 # mkdir -p loopdir
 # mount -o loop your-image.iso loopdir (you need to load loop module: #modprobe loop)
 # rm -rf cd
 # mkdir cd
 # rsync -a -H --exclude=TRANS.TBL loopdir/ cd
 # umount loopdir

Hack the initrd

... as root ...

# mkdir irmod
# cd irmod
# gzip -d < ../cd/install/2.6/initrd.gz | \
        cpio --extract --verbose --make-directories --no-absolute-filenames
# cp ../my_preseed.cfg preseed.cfg
# find . | cpio -H newc --create --verbose | \
        gzip -9 > ../cd/install/2.6/initrd.gz
# cd ../
# rm -fr irmod/

Fix md5sum's

 # cd cd
 # md5sum `find -follow -type f` > md5sum.txt
 # cd ..

Create new image

To make the cdrom bootable, you need to run mkisofs with appropriate parameters. Here is how to do it for x86/amd64, using isolinux.

Change to the top of the cd directory then:

To create the cdrom image using the isolinux boot image:

 # mkisofs -o test.iso -r -J -no-emul-boot -boot-load-size 4 \
 -boot-info-table -b isolinux/isolinux.bin -c isolinux/boot.cat ./cd

If you want you can do a quick test of the iso using qemu:

 # qemu -net user -cdrom test.iso

Burn the image to cdrom

 # cdrecord -dev /dev/hd? test.iso

Much of this information was gleaned from the wiki document ["DebianInstaller/Modify"].