Tiny Core Linux: Difference between revisions

From Leo's Notes
This page was last edited on 24 February 2017, at 19:07.
No edit summary
No edit summary
Line 4: Line 4:


If you use TinyCore with PXE, all you need to do is to create a menu entry with:
If you use TinyCore with PXE, all you need to do is to create a menu entry with:
{{highlight|lang=text|code=
  LABEL Core
  LABEL Core
  MENU LABEL Core
  MENU LABEL Core
         kernel /images/core/vmlinuz
         kernel /images/core/vmlinuz
         INITRD /images/core/core.gz
         INITRD /images/core/core.gz
 
}}


== Altering Initrd ==
== Altering Initrd ==
Line 15: Line 16:
To remaster the base image with additional packages, do the following:
To remaster the base image with additional packages, do the following:


mkdir -p /tmp/tinycore/extract
{{highlight|lang=terminal|code=
mv core.gz /tmp/tinycore  # where core.gz is the initrd file
$ mkdir -p /tmp/tinycore/extract
cd /tmp/tinycore/extract
$ mv core.gz /tmp/tinycore  # where core.gz is the initrd file
zcat ../core.gz | cpio -i
$ cd /tmp/tinycore/extract
$ zcat ../core.gz | cpio -i
}}


The extract directory should now contain the contents of the initrd file system.  
The extract directory should now contain the contents of the initrd file system.  


=== Adding Additional Packages ===
=== Adding Additional Packages ===
To add additional packages to the system, download the .tcz files you want installed from the repository. Store them in /tmp/tinycore/packages, then run:
To add additional packages to the system, download the .tcz files you want installed from the repository. Store them in {{code|/tmp/tinycore/packages}}, then run:


cd /tmp/tinycore/extract
{{highlight|lang=terminal|code=
for i in `ls ../packages/*.tcz` ; do unsquashfs -f -d . $i ; done
$ cd /tmp/tinycore/extract
$ for i in `ls ../packages/*.tcz` ; do unsquashfs -f -d . $i ; done
}}


This will extract the squashfs package files and dump them into the root directory of the extracted initrd file system.  
This will extract the squashfs package files and dump them into the root directory of the extracted initrd file system.  


If you wish to run something on startup, put it in /opt/bootsync.sh or /opt/bootlocal.sh. /opt/bootsync.sh gets called by /etc/init.d/tc-config. Just note that networking might not be up immediately since the dhcp client runs asynchronously. I got around this by running `while true ; do wget -O - http://somewhere.com && break ; done` just to verify networking is up.
If you wish to run something on startup, put it in {{code|/opt/bootsync.sh}} or {{code|/opt/bootlocal.sh}}. {{code|/opt/bootsync.sh}} gets called by {{code|/etc/init.d/tc-config}}. Just note that networking might not be up immediately since the dhcp client runs asynchronously. I got around this by running {{code|while true ; do wget -O - http://somewhere.com && break ; done}} just to verify networking is up.


=== Remastering ===
=== Remastering ===
With the changes made to the root file system, you will want to package the directory back up to create the initrd image.  To do this, do:
With the changes made to the root file system, you will want to package the directory back up to create the initrd image.  To do this, do:


cd /tmp/tinycore/extract
{{highlight|lang=terminal|code=
find | cpio -o -H newc > ../core
$ cd /tmp/tinycore/extract
cd ..
$ find | cpio -o -H newc > ../core
gzip core
$ cd ..
advdef -z4 core.gz # this step is optional, but may save you ~2% of space.
$ gzip core
$ advdef -z4 core.gz # this step is optional, but may save you ~2% of space.
}}


[[Category:Linux]]
[[Category:Linux]]

Revision as of 19:07, 24 February 2017

TinyCore is a nifty linux distro that's extremely small. Similar to DamnSmallLinux, but even smaller.

Booting

If you use TinyCore with PXE, all you need to do is to create a menu entry with:

LABEL Core
 	MENU LABEL Core
         kernel /images/core/vmlinuz
         INITRD /images/core/core.gz

Altering Initrd

Extract

To remaster the base image with additional packages, do the following:

$ mkdir -p /tmp/tinycore/extract
$ mv core.gz /tmp/tinycore  # where core.gz is the initrd file
$ cd /tmp/tinycore/extract
$ zcat ../core.gz

The extract directory should now contain the contents of the initrd file system.

Adding Additional Packages

To add additional packages to the system, download the .tcz files you want installed from the repository. Store them in /tmp/tinycore/packages, then run:

$ cd /tmp/tinycore/extract
$ for i in `ls ../packages/*.tcz` ; do unsquashfs -f -d . $i ; done

This will extract the squashfs package files and dump them into the root directory of the extracted initrd file system.

If you wish to run something on startup, put it in /opt/bootsync.sh or /opt/bootlocal.sh. /opt/bootsync.sh gets called by /etc/init.d/tc-config. Just note that networking might not be up immediately since the dhcp client runs asynchronously. I got around this by running while true ; do wget -O - http://somewhere.com && break ; done just to verify networking is up.

Remastering

With the changes made to the root file system, you will want to package the directory back up to create the initrd image. To do this, do:

$ cd /tmp/tinycore/extract
$ find