Menu

Remaster Nanolinux

Georg

1. The Nanolinux ISO structure

The ISO has the following directories in its root directory: "boot" and "cde".

The "boot" directory contains the isolinux directory to make the CD a Live CD, the core.gz file and the Linux kernel vmlinuz.

The isolinux directoy contains the isolinux.cfg file which contains boot options for Nanolinux you can edit.

The core.gz file, a gzipped cpio archive, contains the initial directory structure for Nanolinux, e.g. usr, bin, lib, etc, mnt, opt etc.

Most applications that come with Nanolinux are already included in the /usr/bin/deskapps directory. For the SLWM desktop the required files are in /usr/bin/desktop. Also the /usr/lib directory contains libnano-X.so and libNXlib.so instead of X11 as the basis for the FLTK GUI. The /usr/local/lib directory contains libfltk.so, libfltk_images.so, libfltk_forms.so, libfreetype.so and other shared libraries together with their symbolic links.

The "opt" directory contains two scripts that will be run automatically when Nanolinux boots: bootlocal.sh and bootsync.sh. You can add your own commands here if they need to be executed during the boot process. The boot process will not continue while the commands in bootsync.sh are executed while bootsync.sh starts bootlocal.sh which then runs in the background while Nanolinux is booting. So if the commands are not time critical you should put them into bootlocal.sh to speed up the boot process.

The "cde" directory contains in its "optional" subdirectory several extensions made using the squashfs file format that will be loaded when Nanolinux boots. This is the gpm mouse driver, the NTFS file system, files for the OSS sound system, ncurses files and in the extpack.tcz extension files that will be written into the home directory. These files will be used by the applications included with Nanolinux.
The onboot.lst file in the "cde" directory determines which extensions Nanolinux will load from the "optional" subdirectory when booting. If you add an extension file you have to add that as well to the onboot.lst file. See the [How to make new extensions] wiki page how to make your own extensions.

2. Unpack the ISO

You should make a script or scripts that run the following commands since you usually will need to run them frequently.

The following commands will unpack the ISO

echo "Unpack ISO"
#unpack all files from the ISO
sudo mkdir /mnt/tmp
sudo mount nanolinux.iso /mnt/tmp -o loop,ro
cp -a /mnt/tmp/boot /tmp
mv /tmp/boot/core.gz /tmp
sudo umount /mnt/tmp

#extract core.gz
mkdir /tmp/extract
cd /tmp/extract
zcat /tmp/core.gz | sudo cpio -i -H newc -d

Now, the full filesystem is in /tmp/extract. You can add files and libraries to e.g. /usr/bin or /usr/local/lib as you like. Also you can add applications to /usr/bin/deskapps and usr/bin/desktop.

I suggest that you add the required commands for this to your script.

If add shared libraries you have to execute ldconfig:

sudo ldconfig -r /tmp/extract

I also execute depmod:

sudo depmod -a -b /tmp/extract 3.0.21-tinycore

You can also edit bootlocal.sh and bootsync.sh or copy your modified files into the "opt" directory.

To add separate extensions write these into the "cde/optional" directories and add them to the onboot.lst file. You could also update extpack.tcz for settings that should be stored in the home directory.

3. Pack the ISO again

If you then want to make the ISO, first pack the filesystem into core.gz again:

#pack core.gz
cd /tmp/extract
sudo find | sudo cpio -o -H newc | sudo gzip -2 > ../core.gz
cd /tmp
advdef -z4 core.gz

Then copy the files into the newiso directory and use mkisofs to generate the new nanolinux.iso.

#make ISO
cd /tmp
sudo cp core.gz boot
mkdir newiso
sudo cp -r boot newiso
sudo cp -r cde newiso
echo mkisofs
sudo mkisofs -l -J -R -V TC-custom -no-emul-boot -boot-load-size 4 \
  -boot-info-table -b boot/isolinux/isolinux.bin \
  -c boot/isolinux/boot.cat -o nanolinux.iso newiso
#sudo rm -rf newiso

Now the nanolinux.iso image is done can be burned onto a CD.


Related

Wiki: How to make new extensions

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.