Tiny Core Linux: Difference between revisions

From Leo's Notes
This page was last edited on 18 August 2017, at 17:52.
No edit summary
No edit summary
Line 1: Line 1:
TinyCore is a nifty linux distro that's extremely small. Similar to DamnSmallLinux, but even smaller.
TinyCore is a nifty linux distro that's extremely small. It's main appeal is the small size and also the ability to save or revert any changes to the system.
 
== Booting ==


== PXE Boot ==
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=
{{highlight|lang=text|code=
Line 9: Line 8:
         kernel /images/core/vmlinuz
         kernel /images/core/vmlinuz
         INITRD /images/core/core.gz
         INITRD /images/core/core.gz
}}
Depending on the image used, you will boot into a shell. If you want to boot into a GUI of some sort, you will either need to modify the core.gz image or provide it with a NFS server that contains the tce directory.
{{highlight|lang=text|code=
LABEL Core
MENU LABEL Core
        kernel /images/core/vmlinuz
        INITRD /images/core/core.gz nfsmount=10.1.1.1:/tftpboot/images/tinycore
}}
}}


== Installing to Hard Drive ==
== Installing to Hard Drive ==
Get the {{code|tc-install}} package
The installer can be used to install TinyCore on a hard drive. Get the {{code|tc-install}} package and run it.


== Apps ==
== Apps ==
The mirror can be selected by editing {{code|/opt/tcemirror}}. To use CPSC's mirror, enter:
The mirror can be selected by editing {{code|/opt/tcemirror}}.
 
To use CPSC's mirror, edit {{code|/opt/tcemirror}} and replace it with:
{{highlight|lang=text|code=
{{highlight|lang=text|code=
http://mirror.cpsc.ucalgary.ca/mirror/tinycorelinux/
http://mirror.cpsc.ucalgary.ca/mirror/tinycorelinux/
}}
}}


== Modifying {{code|mydata.tgz}} ==
== Modifying {{code|mydata.tgz}} ==
Line 42: Line 51:
Any changes you've made should be visible immediately.
Any changes you've made should be visible immediately.


== Altering Initrd ==
 
== Altering Initrd Image ==
Follow the steps below if you wish to have the system include a set of packages out of the box without needing to load it as extensions.


=== Extract ===
=== Extract ===
To remaster the base image with additional packages, do the following:
Extract the {{code|core.gz}} file.


{{highlight|lang=terminal|code=
{{highlight|lang=terminal|code=
Line 57: Line 68:


=== 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 {{code|/tmp/tinycore/packages}}, then run:
Download the .tcz files you want installed from the repository. Store them somewhere (say {{code|/tmp/tinycore/packages}}). Each package is a squashfs filesystem which can be extracted using the {{code|unsquashfs}} utility.


{{highlight|lang=terminal|code=
{{highlight|lang=terminal|code=
Line 63: Line 74:
$ for i in `ls ../packages/*.tcz` ; do unsquashfs -f -d . $i ; done
$ 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 {{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.
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.

Revision as of 17:52, 18 August 2017

TinyCore is a nifty linux distro that's extremely small. It's main appeal is the small size and also the ability to save or revert any changes to the system.

PXE Boot

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

Depending on the image used, you will boot into a shell. If you want to boot into a GUI of some sort, you will either need to modify the core.gz image or provide it with a NFS server that contains the tce directory.

LABEL Core
 	MENU LABEL Core
         kernel /images/core/vmlinuz
         INITRD /images/core/core.gz nfsmount=10.1.1.1:/tftpboot/images/tinycore

Installing to Hard Drive

The installer can be used to install TinyCore on a hard drive. Get the tc-install package and run it.

Apps

The mirror can be selected by editing /opt/tcemirror.

To use CPSC's mirror, edit /opt/tcemirror and replace it with:

http://mirror.cpsc.ucalgary.ca/mirror/tinycorelinux/

Modifying mydata.tgz

If you are running TinyCore on a NFS share, you might not be able to modify the system and then save the changes like you normally would with filetool.sh -b.

To modify mydata.tgz outside of the TinyCore environment:

# umask 022       # In case you have a weird umask, default to 022.
# mkdir tce       # this dir should be 755 (anything less will kill your tce image)
# cd tce
# tar --numeric-owner -xzpf ../mydata.tgz   # Keep permissions and ownership!
## make your changes
# tar --numeric-owner -czpf ../mydata.tgz *     # Re-create the tarball with permissions

Overwrite the old mydata.tgz on the NFS share and then test the changes on TinyCore by running:

# filetoool.sh -r

Any changes you've made should be visible immediately.


Altering Initrd Image

Follow the steps below if you wish to have the system include a set of packages out of the box without needing to load it as extensions.

Extract

Extract the core.gz file.

$ 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

Download the .tcz files you want installed from the repository. Store them somewhere (say /tmp/tinycore/packages). Each package is a squashfs filesystem which can be extracted using the unsquashfs utility.

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

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