Menu

ModifyingTheBootDisk

Juan Jose Pablos

Last modified 2 years ago Last modified on 23/06/12 10:54:22

OK, this is the Plan. We boot a diskless Linux 2.6.x kernel, use the /sys (sysfs) file system and modules.pcimap files to autodetect the network hardware and load its driver(s), use udhcpc (from BusyBox?) to grab a DHCP lease, use mount to map the install share on /z, use sysfs and modules.pcimap again to autodetect the mass storage hardware and load its driver(s), run install.pl to partition the disk (using Parted) and generate unattend.txt.

The Makefile generates the Linux boot disk. To download all required sources from their canonical locations.

svn co https://unattended.svn.sourceforge.net/svnroot/unattended/trunk unattended
cd unattended/linuxboot
make download

This will use gobs of disk space, a fast connection, and lots of time. Do "make iso" to build linuxboot.iso. Do "make tftpboot" to populate the tftpboot/ directory. A simple

make

does both.

First. Create a build environment under Debian/Ubuntu?

This assume that you are familiar with Debian. Install only the base system. See ​http://wiki.freaks-unidos.net/chrooted-debian-server for directions on creating a chrooted virgin Debian base system on either Debian or Red Hat based distros.

aptitude install subversion build-essential bison flex libncurses-dev libncursesw5-dev mkisofs gawk mtools

The Debian package ​firmware-linux-nonfree might be useful if you have a nic that isn't recognized out of the box. E.g. ​Broadcomm Netlink ​BCM57780. Note: This should be ​working now with kernel 2.6.35.8

Or use a Fedora kernel that has the firmware included -> ​kernel-2.6.34.7-61.fc13.src.rpm

rpmbuild --target i386 -bp kernel.spec

will give you a patched kernel source that can use the Broadcom Netlink nic above.

​Advanced info

[LinuxBoot]

How to modify a BootDisk? WITHOUT compile

attention: this method gave me an error: "openvt: unable to open /dev/tty2: No such file or directory."... you have been warned!

Please tell me how to fix that :)

copy /dev/tty2 from linux host to the extracted initrd image :)

2nd. attention:i think the correct way to do this is to uncheck the current release of unattended from cvs an build the bootdisk from source according to the README.txt file in the linuxboot directory. doing this you are able to build new kernel and modules as well.

five steps

  1. get ready

    gunzip unattended-4.6-linuxboot.zip

    cd linuxboot/

    mkdir tmp iso initrd

  2. open default iso and initrd

    mount -t iso9660 -o loop linuxboot.iso tmp/

    cp -rp tmp/* iso/.

    umount tmp/

    rmdir tmp/

    cd initrd/

    cat ../iso/isolinux/initrd | cpio -i

  3. now you can modify everything!

  4. create a brand new iso

    cd initrd

    find . -xdev | cpio -o -H newc > ../iso/isolinux/initrd

    cd ../iso

    mkisofs -o ../MegaCool-linuxboot.iso -V 'MyLinuxBoot' -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 \

    -boot-info-table -R -J -T .

  5. burn it!

funnies

  • If you want to add a message at the start of the boot cd, just edit the isoboot.msg file in the iso/isolinux/ folder.

PXE Booting

  • If you are booting to the linux disk from the network, then you can change a line in the "/var/lib/tftpboot/pxelinux.cfg/default" file to read "append initrd=initrd z_user=myself z_pass=sekrit z_path=_myserver/myshare". _

Patch GLibc

If your custom built kernel panics when starting initrd with something like Inconsistency detected by ld.so: dynamic-link.h: 204: elf_get_dynamic_info: Assertion 'info[15] == ((void *)0)' failed!

You'll need to patch GLibc

--- glibc-2.11.1/elf/dynamic-link.h.orig        2010-10-25 01:24:57.392697801 +0000
+++ glibc-2.11.1/elf/dynamic-link.h     2010-10-25 01:25:35.733821785 +0000
@@ -200,8 +200,8 @@
   assert (info[DT_FLAGS] == NULL
          || info[DT_FLAGS]->d_un.d_val == DF_BIND_NOW);
   /* Flags must not be set for ld.so.  */
-  assert (info[DT_RUNPATH] == NULL);
-  assert (info[DT_RPATH] == NULL);
+  info[DT_RUNPATH] == NULL;
+  info[DT_RPATH] == NULL;
 #else
   if (info[DT_FLAGS] != NULL)
     {

references ​http://devpit.org/wiki/Gnu_Toolchain/GLIBC/Building_GLIBC#patching_32-bit

problems

  • When I modify the initrd that way I only got one tty. Any solution to this?

Related

Wiki: CompileCVS
Wiki: LinuxBoot

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.