Knowledgebase: Debian
How to Modify Debian Installer
Posted by Gurpreet Singh on 22 August 2011 03:42 AM
Problem
It is not possible to insert Drivers while installing Debian. Here is a Quick How to Do Modify the installer for your own requirements.

Solution
DebianInstaller/Modify

Debian-Installer: How to modify an existing CD image

DebianInstaller itself is based on udebs. Many of those udebs are on the CD, but some of them are in an initrd. If you want to modify the udeb's in the initrd, then you should follow the instructions in the custom-kernel.txt file in the installer/doc directory.

But when you want to modify non-initrd udeb's or you want to substitute or amend the *.debs, you can do this without the source code.

Create copy of image
You need one of already built ISO images from http://cdimage.debian.org/cdimage/daily-builds/sid_d-i/. It will be used as the basis that we modify. Because you can't modify an ISO9660 image, you've to copy it first:

# 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
Files and hooks
A list of hooks available for debian-installer: http://d-i.alioth.debian.org/svn/debian-installer/installer/doc/devel/available-hooks.txt

(filepaths as seen from the installer)
List of packages (udebs) to install or not install in into the d-i ramdisk.

''cdrom''.disk/udeb_include ["anna"]
''cdrom''.disk/udeb_exclude
The content of these files are taken as lists of packages to install or not into the target area.

''cdrom''.disk/base_include [base-installer]
''cdrom''.disk/base_exclude
If the file ''cdrom''.disk/base_installable exists, the base-installer udeb selects the cdrom as source for the installation.

Modify Image
Now drop all packages that you want in your image to pool/main (or below) in this copy. You also have to change/add md5 checksum in md5sum.txt in cd

Create new Release and Packages files
This step is only required if you have added or changed packages.

Create a config file with something like this :

Dir {
ArchiveDir "''home''<usr>/src/d-i/cd";
OverrideDir "indices";
CacheDir "indices";
};

TreeDefault {
Directory "pool/";
};

BinDirectory "pool/main" {
Packages "dists/sarge/main/debian-installer/binary-i386/Packages";
BinOverride "override";
ExtraOverride "override.extra";
};

Default {
Packages {
Extensions ".udeb";
};
};
Because of the BinOverride line you also need the override file, you can get it from any debian mirror, e.g. get http://ftp.de.debian.org/debian/indices/override.sarge.main.gz and extract it to the indices/override.

Now go into the directory with your config file and run

# apt-ftparchive generate config
to generate the Packages and Releases files.

Alternate Method
If you use apt-move to store the packages apt downloads when updating your system, you can use the mirror it creates to fill the cdrom with all the packages on your current system. Remember to call "apt-move sync" before mastering the image, to make sure, all dependencies are met.

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
or, if your extra dists and pool (the apt-move mirror) are in a separate place

# mkisofs -o test.iso -r -J -no-emul-boot -boot-load-size 4
-boot-info-table -b isolinux/isolinux.bin -c isolinux/boot.cat
extra/dists=pathto/mirror/dists extra/pool=pathto/mirror/pool
-graft-points ./cd
if you want you could do a (very) quick test of the iso using qemu (you need to apt-get it):

# qemu -user-net -cdrom test.iso
burn the image to cdrom

# cdrecord -dev /dev/hd? test.iso
Finally, from the build directory (please adapt to your local paths):

# #!/bin/sh
# make clean
# TYPE=cdrom fakeroot make image
# cp myudebs/*udeb
/home/vmware/bubulle/src/debian/d-i/archive/pool/main
# MYPWD=`pwd`
# cd /home/vmware/bubulle/src/debian/d-i/archive
# apt-ftparchive generate config
# cd $MYPWD
# mkisofs -r -J -b cdrom-image.img -o test.iso dest
/home/vmware/bubulle/src/debian/d-i/archive
# mkisofs -r -J -b cdrom-image.img -o test.iso dest /mnt/loop
(1 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).