Dashboard > Linux > Making a Custom Boot CD for Debian
Linux Log In   View a printable version of the current page.
Making a Custom Boot CD for Debian
Added by Scott Kveton, last edited by Scott Kveton on Jan 22, 2005  (view change)
Labels: 
(None)

If you just want a pretty complete ISO, check out this page.

A big thanx goes out to Steve Mickeler for basically handing this to me on a platter ...

Introduction

It wasn't entirely clear from an 'apt-get source boot-floppies' how to make a custom CD image. I just wanted to make a netinst CD with a kernel that had some new driver that I needed so I could get Debian on the box.

I originally wanted to add support of the LSI Fusion MPT SCSI controllers so I had to rebuild the ISO accordingly so I could boot up with one of those controllers. While I was at it, I added the tigon3 driver, e1000, etc. These are all part of the stock kernel now so its just a matter of updating the kernel and plopping it on the CD.

The following lists out the complete steps but V.J. McIntyre was kind enough to make a fantastic shell script for automating these steps. Thanks V.J.!

Building the ISO

I used the following recipe to build the ISO:

I recommend using the kernel-package tool 'make-kpkg' to build a new kernel package. This gives you the added benefit of having a customized kernel for the boot CD but also a package that you can use elsewhere.

Customize your kernel with make menuconfig|xconfig|config and then run:

make-kpkg --append-to-version='-bf2.4' kernel_image

to build your kernel package.

Now grab that kernel package you built from above. Use 'kernel.sh' which is located in the boot-floppies root directory as such:

./kernel.sh . 2.4.25 bf2.4

where 2.4.25 is your kernel version. This will create several files for your consumption in the current directory: configbf2.4.gz, sys_mapbf2.4.gz, linuxbf2.4.bin, modcontbf2.4 and modulesbf2.4.tgz.

I've made some modifications to kernel.sh so you might want to grab mine if you run into problems.

The ./kernel.sh command might bark about directory problems. Make sure you have your kernel package is located directly below the boot-floppies directory (..).

You can now take the files that have been created to build your own CD.

Grab the file mini-iso.sh and put it in the root of boot-floppies source directory.

In your boot-floppies source directory run as follows:

./mini-iso.sh bf2.4 http://debian.oregonstate.edu/debian yes

This will download the bf2.4 boot / root / drivers / rescue files from http://debian.oregonstate.edu/debian as well as the basedebs and build the file bootbf2.4.iso

You will see that it downloads resc2880bf2.4.bin which is the rescue disk image. Mount this locally using the loopback device:

mount -t auto -o loop resc2880bf2.4.bin /var/tmp/bf2.4

You need some special kernel options to mount that .bin file. Namely, CONFIG_BLK_DEV_LOOP, CONFIG_MSDOS_FS and CONFIG_FAT_FS. Use my kernel configuration to get a head start. If you can't mount this then you are probably missing msdos file system support. If you are running the 2.6 kernel and you are trying to mount this .bin you will also need CONFIG_NLS_CODEPAGE_437=y in your kernel configuration.

Once mounted copy the file linuxbf2.4.bin created from the ./kernel.sh command to /var/tmp/bf2.4/linux.bin. You'll also want to copy the sys_mapbf2.4.gz and configbf2.4.gz in as well replacing sys_map.gz and config.gz in /var/tmp/bf2.4. Depending on your kernel version you may want to edit /var/tmp/bf2.4/install.sh.

Also, don't forget to edit the version of the kernel you are installing on the ISO in /var/tmp/bf2.4/debian.txt.

You can now umount /var/tmp/bf2.4 and copy resc2880bf2.4.bin back into your boot-floppies source directory (if you moved it from there when you mounted it).

There was a another file that was downloaded when you ran mini-iso.sh called driversbf2.4.tgz. Grab this file and put it in a temp directory and tar zxf it. In this directory you will copy modcontbf2.4 and modulesbf2.4.tgz over modcont and modules.tgz. Rebuild the driversbf2.4.tgz with 'tar zcf driversbf2.4.tgz *' in the temp directory (of course you would have deleted the original driversbf2.4.tgz. so its not included in your new archive.

Now copy the driversbf2.4.tgz back to the boot-floppies source directory and run the mini-iso.sh command from above. You'll have yourself one customized Debian boot ISO.

For specific info on what you absolutely require for the boot kernel, check out:

http://www.debian.org/releases/stable/i386/ch-boot-floppy-techinfo.en.html#s-rescue-replace-kernel

– A paste from the above debian.org link:

If you find it necessary to replace the kernel on the rescue floppy, you must configure your new kernel with these features linked in, not in loadable modules:

  • RAM disk support (CONFIG_BLK_DEV_RAM)
  • Initial RAM disk (initrd) support (CONFIG_BLK_DEV_INITRD)
  • Kernel support for ELF binaries (CONFIG_BINFMT_ELF)
  • Loop device support (CONFIG_BLK_DEV_LOOP)
  • FAT, Minix, and Ext2 file systems (some architectures don't need FAT and/or Minix file systems ? see the source) For Intel x86, Minix file support is not required, but MSDOS and ext2 are.
  • Socket filtering for DHCP (CONFIG_FILTER)
  • Packet socket, also for DHCP (CONFIG_PACKET)
  • Unix domain sockets for system logging ? is provided as a module in the vanilla flavor (CONFIG_UNIX)

Be sure that the kernel you plan to use does NOT have CONFIG_DEVFS set. CONFIG_DEVFS is not compatible with the installer.

You may want to build your own custom kernel now.

hi!I need help please!

my recompiled kernel package is 'kernel-image-2.4.26-1750-smp-gblink-no100m-9_rev.09_i386.deb'
and it works fine.

i wanna make a custom boot cd with the kernel above.

i got the source package 'boot-floppies-3.0.23' and extract it .
but i got these error mesg when i exec './kernel . 2.4.26 1750-smp-gblink-no100m-9'

I: downloading kernel-image-2.4.26-1750-smp-gblink-no100m-9
I: Retrieving debootstrap.invalid_dists_woody_Release
I: Validating debootstrap.invalid_dists_woody_Release
./kernel.sh: eval: line 3: syntax error near unexpected token `)'
./kernel.sh: eval: line 3: ` )'
./kernel.sh: eval: line 3: syntax error near unexpected token `)'
./kernel.sh: eval: line 3: ` )'
./kernel.sh: eval: line 3: syntax error near unexpected token `)'
./kernel.sh: eval: line 3: ` )'
E: Invalid Release file, no valid components
E: ./kernel.sh abort

why???
is my command wrong??
what's the correct?
where can i get your own kernel.sh instead of the standard one?

thanks!

Posted by cwin liu at Jun 17, 2004 22:35 | Permalink


Somebody help me!

Posted by cwin liu at Jun 22, 2004 01:12 | Permalink

Hey Matt,

> I'm running into an issue and have been racking my head all day.
> I have everything in place to create a new mini iso from your
> instrcutions on confluence.
>
> It runs all the way until it gets to this point:
>
> #current dir /var/tmp/tmp.make-new-iso.sh.16209
> total 2844
> 4 configbf2.4.gz 4 drivers/ 4 floppy/ 1616 linuxbf2.4.bin
> 4 debian.txt 1040 drivers.tgz 4 install.sh 168 sys_mapbf2.4.gz
> Replacing these files
> linux.bin 1263339 bytes
> config.gz 4358 bytes
> sys_map.gz 144934 bytes
> install.sh 1526 bytes
> driversbf2.4.tgz 5849360 bytes
>
> cp: writing `/var/tmp/make-new-iso.sh.16209/bf2.4/linux.bin': No space
> left on device

The boot image actually has to stay within 2.88Mb ... believe me this is
what I spend most of my time making happen ...

> For some reason /var/tmp/make-new-iso.sh.16209/bf2.4 mount doesn't get
> enought space to copy linux.bin onto it.
> My kernel-image is about 2.3 MB but i'm putting this on CD not floppy so
> size isn't a big deal. I couldn't find anyplace where the size was being
> specified. The creation of the mount point is here:

The goal with the boot ISO is to have a small base kernel and then
leverage drivers.tgz where you can (those don't go in the 2.88Mb image).

> so i guess whatever made the /floppy/resc2880bf2.4.bin needs to be
> readjusted and i think that is either in your mini-iso.sh file or in
> .kernel.sh.

This is a limitation of the format of teh rescue bin file ... it cannot
be any larger.

> (also you say in your tutorial "I've made some modifications to
> kernel.sh so you might want to grab mine if you run into problems." but
> nowhere on the page do you give a link to your kernel.sh file)

Doh ... lemme see if I can dig this up. This would help immensely ...

Scott

Posted by Scott Kveton at Nov 05, 2004 07:22 | Permalink

Yeah, I'd like to see it too.

Thanks!!!

Posted by David A. Ulevitch at Nov 06, 2004 23:07 | Permalink


Oops, you've added the link. Thanks Scott!

Posted by David A. Ulevitch at Nov 06, 2004 23:08 | Permalink

Greetings, Scott.

I've been trying to make my own Debian CDs, I'm currently using the iswraid to access my Raid-0 array on ICH5R, and I want to make a CD (a DVD, actually), I'm running it smoothly after installling first on normal IDE than migrating it. I have already an initrd and a kernel image, I need to put these into a bootable CD that I can install Debian from, so I can clean install if I need (I actually do, hehe).
I've been trying to follow the guide, but I don't know where to find the boot-floppies root directory you talked about... What package do I need ? When I run kernel.sh, it complains about common.sh missing...
Thanks in advance !

Diego MOlina

Posted by Diego Molina at Jul 04, 2005 18:58 | Permalink
Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.7 Build:#524 Jul 28, 2006) - Bug/feature request - Contact Administrators