I use Tiny Core Linux to create virtual appliances, and since I like to keep things current I frequently remaster it. I created a script to make this easier, and I am sharing it so that others may benefit (and hopefully improve upon).
FeaturesThe script will optionally do any or all of the following:
1) Rebuild the kernel according to a specific .config
2) Rebuild the tinycore.gz root filesystem, including:
- kernel modules from step #1, and
- custom files
3) Create a new ISO image which includes:
- kernel from step #1
- tinycore.gz from step #2
- custom isolinux files (isolinux.cfg and others)
- any desired extensions
Instructions1) Load the following extensions into Tiny Core:
- advcomp
- bash
- compiletc
- coreutils
- mkisofs-tools
- perl_xml
Not all of these are necessary (especially if the kernel isn't compiled).
2) Copy the following files into a src/ directory in the same directory as the remaster.sh script:
- 2.6.26-tinycore.patch
- config-2.6.26-tinycore
- linux-2.6.26.tar.bz2
- tinycore_1.1.iso (or any other versions)
Here are some helpful links for these files:
ftp://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/release/src/ftp://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/release3) Run the remaster script. It takes two parameters:
- the "project" directory in which all the custom files reside
- the version of Tiny Core to remaster (1.1, 1.2rc1, etc.)
OperationHere is what the script does, step by step:
1) Loop mount the image (tinycore_VERSION.iso) and copy the files into a temporary directory.
2) Look for a tce/ directory in the project directory and copy files from it into the temporary directory.
3) If a rootfs/ directory or "modlist" file exists, then:
- extract the original tinycore.gz into a temporary directory, and
- copy files from rootfs/ into it (if it exists).
4) If a "config" file exists and a kernel/ directory does not exist, then:
- extract the kernel source,
- "make mrproper",
- patch the kernel,
- copy config from the project directory to .config,
- "make oldconfig", and
- build the kernel.
5) If the kernel/linux-2.6.26/arch/x86/boot/bzImage file exists, copy it.
6) If a "modlist" file exists and the kernel/linux-2.6.26 directory exists, copy the specified kernel modules
7) Rebuild the tinycore.gz root filesystem if a new one was created in steps 4 or 6.
8) If an isolinux/ directory exists, then copy the custom isolinux files.
9) Create a new customized ISO image.
The output is placed in the out/ directory within the project directory. If the kernel is built, it will be placed in the project directory unless a kernel/ directory already exists. This will avoid building the kernel next time.
Summary1) To build a new kernel, create a "config" file and place it in the project directory.
2) To use files (bzImage and/or modules) from a previously built kernel, place the kernel tree in a kernel/ directory.
3) To copy kernel modules into tinycore.gz, create a "modlist" file containing pathnames of the kernel modules.
4) To copy custom files into tinycore.gz, create a rootfs/ directory and place files there.
5) To create a custom isolinux boot configuration, create a isolinux/ directory and place files there.
Attached is a file containing a script and an example remaster project based on my VMware customizations. It does not contain a tce/ directory to save space. Extract the file and run the script with "sh remaster.sh example 1.1" to remaster against version 1.1.
The root filesystem customization in the example simply adds a modified /etc/inittab. The kernel is rebuilt to include support for LSI Logic and BusLogic SCSI adapters (emulated by VMware), remove support for the pcnet32 network adapter (so the VMware virtual adapter driver can load), and add support for VMI paravirtualization. The custom isolinux.cfg is almost exactly like the original; I just added a few boot parameters to the default and changed the timeout.
I tested the script quite a bit, but let me know if any improvements or fixes are necessary.
I compiled VMware Tools and created an extension for my personal use, but I am uncertain if distributution is allowed by VMware.