This is an old revision of the document!


Introduction

The method described here allows you to modify the root filesystem of a TC/MC system without actually modify the tinycore.gz/microcore.gz files. This is particularly useful when you want your remaster to work with a new version of TC/MC or if you for some other reason want to remaster the root filesystem without having to modify the root filesystem files shipped by TC/MC.

The method is based on the capability of the syslinux family bootloaders (syslinux, isolinux, extlinux, pxelinux) to load multiple initramfs images during boot. If you are using Grub you could still use this method by chainloading from Grub to a syslinux family bootloader.

The description here is based on the use of extlinux (since I use this to boot from an ext2 partition), however the same configuration should be possible to use for other syslinux family bootloaders.

Install extlinux

In order to install extlinux to your boot partition you need have the TC syslinux.tgz extension installed on your system and the boot partition mounted. My boot partition is mounted under /mnt/hda1 and I install extlinux at /mnt/hda1/boot/extlinux.

To install extlinux you do:

sudo extlinux -i /mnt/hda1/boot/extlinux

This will make the file extlinux.sys to appear in the installation directory. (Mount the device manually: “mount /dev/xxx /mnt/xxx”. Using the mount tool provided by tinycore extlinux will give you an error (it can't install to devices mounted with loop)

In case extlinux is the only bootloader on your system you need to update the MBR of the boot device (note that if you are using grub and want to keep it that way DO NOT perfom the following action). To update the MBR

sudo cat /usr/local/lib/syslinux/mbr.bin > /dev/XXX

where /dev/XXX is the appropriate master devive (in my case /dev/hda).

To be able to use the menu features of the syslinux family bootloaders you should:

sudo cp /usr/local/lib/syslinux/vesamenu.c32 /mnt/hda1/boot/extlinux

Configure extlinux

extlinux operates according to a configuration file called extlinux.conf and this file should be located in the extlinux installation directory (/mnt/hda1/boot/extlinux).

The content of this file should look something like:

default vesamenu.c32

menu title My Boot Options

timeout 200

prompt 0

ontimeout mc_original
 
label my_remaster
	menu label Microcore with remaster
	kernel /boot/bzImage
	initrd /boot/microcore.gz,/boot/my_initramfs.gz
	append base

label mc_original
	menu label Microcore without remaster
	kernel /boot/bzImage
	initrd /boot/microcore.gz
	append base


menu width 80
menu margin 10
menu rows 12
menu tabmsgrow 18
menu endrow 24
menu timeoutrow 20	

The core part for the remaster function is the line:

	initrd /boot/microcore.gz,/boot/my_initramfs.gz

This tells extlinux to load both microcore.gz AND my_initramfs.gz and create a root file system that is the combination of the two.

Create remaster content

The remaster content should be packed into a gzipped cpio archive. What it should contain is up to you. We here show an example where a couple of TC/MC extensions are placed at /opt/tce/optional. During startup TC/MC will load any extension found in the list /opt/tce/onboot.lst.

First you need to create a working directory that represents the root of the initramfs to be created:

$ mkdir my_root
$ cd my_root

Now create the directory where the extensions are going and copy the extensions to that directory:

$ mkdir -p opt/tce/optional
$ cp /path_to_extensions/xxx.tcz  opt/tce/optional
$ cp /path_to_extensions/yyy.tcz  opt/tce/optional
$       .
$       .
$ ls -1 opt/tce/optional > opt/tce/onboot.lst

Once all files to be included into the root filesystem are in place it is time to create the archive and copy it to the boot partition.

Chainload from Grub (optional)

In case you are using Grub as your boot loader you could follow the instructions above (except for updating of the MBR) and then create an entry like the following in your Grub configuration:

title		EXT-CHAIN
root		(hd0,0)
makeactive
chainloader +1

When you boot via grub you just select the boot entry named EXT-CHAIN and that would continue the boot process using your extlinux setup. Note that you might need to change (hd0,0) to something that fits your system.

Print/export
QR Code
QR Code wiki:dynamic_root_filesystem_remastering (generated for current page)