May 172011
 

Hi All,

In my previous post regarding booting Tiny Core Linux over PXE, we were booting a premade image that did not have much installed by default.
In this post, we will remaster the image into something usable that we can boot off by extracting all the files that we need and merging the directories then repacking it all into one. One of the advantages of doing it this way is that it lets you modify all the files in the root file system before you repack it all up.

What we will need to do is to get the tcz files for the applications we want to install, and merge them into the default tinycore.gz image. This will result in a larger tinycore.gz file but when the image is booted, applications will be pre-installed. This can be useful for diskless workstations in an office or netcafe for example.

So, onto the hard parts.


Step 1 – Getting the TCZ files

Ok, so once we’ve decided what software we want, we will need the TCZ files for the software we want.
This Site has a list of all the software we need and their dependencies, though it’s a bit tedious to download every single file as I haven’t found any other way to download what we need.

So, I took a shortcut.
Boot up Tiny Core Linux either using a virtual machine or real machine using PXE or some other boot media.
Install all the software you want via the app manager, and then all the files you need are in /tmp/tce/optional/.
To do this, you will need an internet connection on the computer that you’re booting Tiny Core on.

For me, I will install Firefox, OpenSSH (SSH Client and server), conky, pci-utils, and util-linux-ng, but you can choose what you want to install.
After I have installed the software, all the tcz files I need will be in /tmp/tce/optional/ and should look something like this :

After all the files are there, we will need to transfer them to a different computer to do the remastering.
In this case, I will be transferring them to my PXE server which will be doing the remastering.

Step 2 – Uncompressing Everything

Once we have all the tcz files where we need them, we will need to uncompress them as they are all compressed using squashfs.
We will need to install some additional tools to do that, namely squashfs-tools.

apt-get install squashfs-tools

Once that is installed, we can unsquash all the files so that we can access them like a normal filesystem.
I’ve written up a little script to do it all for me in this case :


#!/bin/bash
for i in $( ls ); do
if [ ! $i == "unsquashall.sh" ] && [ -f $i ]; then
unsquashfs -f $i
fi
done

I’ve named this unsquashall.sh, and have put this into the directory where all the tcz files are.
If you copy and paste this into a .sh file, don’t forget to make it an executable file by running :

chmod +x unsquashall.sh

After you run unsquashall.sh, you will have a directory called squashfs-root which will contain the contents of all the tcz files.

What you will also need, is the core of Tiny Core, the tinycore.gz file. This is a gzipped cpio file which contains the main file system of Tiny Core Linux.
You will want tinycore.gz in it’s own directory when you extract it to make things easier, I have used /tftpboot/tc/temp for that.
To extract tinycore.gz, you will need to run this command as root, or alternatively use sudo before this command.


zcat tinycore.gz | cpio -i -H newc -d

Step 3 – The Merge

Once you’ve extracted the contents, you should see something similar to this :

Looks just like the root file system of a Linux distribution doesn’t it ?
Now, we need to copy the contents of that squashfs-root directory that we created before into this directory.
I have the squashfs-root directory in the /tftpboot/tc/tcz directory, so the command I will be running is :


cp -Rp /tftpboot/tc/tcz/squashfs-root/usr/ /tftpboot/tc/temp/

Step 4 – Repacking Everything

After doing that, we need to repack everything up.
I have made another script for that –


#!/bin/bash
find | cpio -o -H newc | gzip -2 > /tftpboot/tc/tc.gz

Once again, you will need to make the file executable and it should be placed in /tftpboot/tc/temp/.
Once run, this script will create the tc.gz file in /tftpboot/tc which will replace the tinycore.gz file.
I have also copied the kernel bzImage from the iso file into the /tftpboot/tc directory also.

Step 5 – Configuring PXE

Once all that is done, we now need to reconfigure pxe to boot the new Tiny Core initrd file.


LABEL tinycorerm
MENU LABEL Tiny Core 3.6 Remaster
kernel tc/bzImage
append initrd=tc/tc.gz

Should look something like :


So when you boot up the remastered Tiny Core, you should see Firefox in the dock – that’s if you chose to install it.

Share

  14 Responses to “How To : Remaster Tiny Core Linux”

  1. 10MB tinycore.gz needs more than 3 minutes to load on old USB 1.0 hardware… Making it bigger is a fail idea.

    • Good thing I wasn’t writing it for the users who still use USB1 then πŸ™‚
      This was more aimed at people who want a somewhat more featured distro than base tinycore and wanted to netboot it.
      To be honest, I haven’t come across computers with USB1 that could boot off usb so the size didn’t even cross my mind as an issue.

  2. Love your post, is there a way to pxe tiny with ff, flash installed and on boot open webpage in kiosk mode using kiosk plugin? maybe some kinda of a script?

    • Thanks

      I’m sure there is a way to do it but I haven’t investigated that particular situation.
      Though I have gotten flash installed in one of my pxeboot tinycore setups.
      I would assume there would also be a way to open up certain programs on startup as well.

  3. There is an app\extension in the repos called “ezremaster” that makes creating a remastered TinyCore iso, very easy. It includes boot code options and installation of additional tcz and scm files. I highly recommend that you check it out.

  4. first , thanks for the nice post
    second the steps works great until step 5 , where suppose i write

    LABEL tinycorerm
    MENU LABEL Tiny Core 3.6 Remaster
    kernel tc/bzImage
    append initrd=tc/tc.gz

    and from where i get pexlinux.cfg
    and how to get ISO file

    best regards

  5. images aren’t loading

  6. Thank God for people like you who are willing to take the time to post things like this. This just saved me sooo much time for a project I was working on.
    Thank you so much!

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

This site uses Akismet to reduce spam. Learn how your comment data is processed.