NOTE:: just seen on the piCore page that they have a version 17 for 32 and 64 bit available. Which means be vigilant, this guide may not work anymore.

Disclaimer

This should be a complete list of commands that I used to setup piCore on my Pi 4B using a SD-card.

It might help you to utilize piCore on your machine. And the Pi specific stuff can be easily adjusted to other target machines.

I won’t get in details about how piCore works but I list some resources in the Appendix. Also networking is not covered as my machines are cable connected and can find each other automagically.

Lot’s of commands shown use sudo to execute with elevated permissions.

Be vigilant about your settings - especially disks and partitions.

Blindly copy and paste that stuff may brake and even destroy your running system.

Definitions

All machines are in the same wired network and are served with DNS/DHCP. piCore detects all at boot time so network works OOTB for me.

Introduction

There’s is no installer for piCore 13.1 but the image will fire smoothly.

Release notes on the welcome page only state version 12.0. There’s some stuff available for a 13.1 version. Checking the ports page http://www.tinycorelinux.net/ports.html there are two links

Manually browsing the repo you can find some more folders like armv7l and aarch64. but as they are not officially exposed I will not use them.

I will start with the piCore 13.1.0 version from http://tinycorelinux.net/13.x/armv6/releases/RPi/ which you can reach when selecting the Stable Release link on the ports page.

Persistance vs Backup

The setup uses just one SD-Card for everything, so in fact there’s no real backup of anything. You will use loose all your data if the SD card gets corrupted.

All options on persistance are there to keep changes between reboots.

So regardless of any of this options you would want to:

Prerequisites

SD-Card preparation

This will be done on the Host.

There are plenty of guides for that. So just brief here.

We now could fire up the raspi using the SD-Card, but let’s tweak it a little bit before.

Resize Data Partition

Over the time you might want to install additional software, store large files in your home, play around… but there is not much space currently.

After burning the USB Stick you will have two partitions on your stick.

After burning the SD-card, this second Partition is currently only 16 MB in size. The rest of the stick is free Space.

This is the Partition we need to resize to get more space for data and applications. There are plenty of guides around how to resize a partition so I won’t go in detail but list a brief example using gparted. The easy one shot option, resizing partition and filesystem.

TCE Persistence

Persistence option is set as a kernel boot parameter specifying the type of persistance and the destination partition tce=PARTITION. I will use the UUID style.

On my host the stick is available as /dev/sda and it will be different on the SD card. So I need the UUID of partition Two (/dev/sda2).

blkid /dev/sda2
## /dev/sda2: LABEL="piCore_TCE" UUID="*a36eaf4a-7bdc-4836-83cd-8001db75865a*" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="e85b7916-02"

Now edit the file cmdline.txt on partition One (/dev/sda1) and append the persistence option using the determined UUID.

sudo mount /dev/sda1 /mnt
cat /mnt/cmdline.txt
## zswap.compressor=lz4 zswap.zpool=z3fold console=tty1 root=/dev/ram0 elevator=deadline rootwait quiet nortc loglevel=3 noembed
sudo sed -i '1 s/$/ tce=UUID=a36eaf4a-7bdc-4836-83cd-8001db75865a/' /mnt/cmdline.txt
cat /mnt/cmdline.txt
## zswap.compressor=lz4 zswap.zpool=z3fold console=tty1 root=/dev/ram0 elevator=deadline rootwait quiet nortc loglevel=3 noembed tce=UUID=a36eaf4a-7bdc-4836-83cd-8001db75865a
sudo umount /mnt

Change keyboard layout

I have a german keyboard, so I want to use that layout automatically.

The TiniCore tcz folder (http://tinycorelinux.net/13.x/armv6/tcz/) is not browseable via HTTP, so you need to know the filenames. If you shoose a browseable mirror (like http://distro.ibiblio.org/tinycorelinux/13.x/armv6/tcz/) you can download the files easily using a browser

We need the keymaps extension and have to:

Install german keyboard

curl http://tinycorelinux.net/13.x/armv6/tcz/kmaps.tcz > kmaps.tcz
curl http://tinycorelinux.net/13.x/armv6/tcz/kmaps.tcz.md5.txt > kmaps.tcz.md5.txt
sudo mount /dev/sda2 /mnt
sudo cp kmaps.tcz /mnt/tce/optional
sudo cp kmaps.tcz.md5 /mnt/tce/optional
sudo sh -c 'echo "kmaps.tcz" >> /mnt/tce/onboot.lst'
sudo umount /mnt

sudo mount /dev/sda1 /mnt
sudo sed -i '1 s/$/ kmap=qwertz\/de-latin1-nodeadkeys/' /mnt/cmdline.txt ## <1>
sudo umount /mnt

A list of available layouts can be found at mirrors in kmaps.tcz.list.

Install SSH

OpenSSH is installed and activated by default. At startup the server will generate SSH host keys. But ofc it will now know your Host users public key and the standard tc user has no password set which disallows ssh logins.

If you have display and keyboard attached you can do the following:

If you can live with that skip the following section

Enable SSH login

We cannot set a password from outside, so we enable login less SSH by adding your hosts users SSH key to the authorized keys of our piCore user tc@box.

For that we have to tweak /dev/sda/tce/mydata.tgz by adding our host users public key to ssh authorized keys.

Warning: this will add your hosts users public key to the USB stick. You might not want that if you plan to carry that to different machines or give it away.

But it will also allow SSH connections for your host user to all machines using a copy of this USB stick.

## just have a clean folder to operate in
mkdir ~rik/mydata
cd ~/mydata
sudo bash ## <1>

mount /dev/sda2 /mnt
sh -c 'gzip -dc /mnt/tce/mydata.tgz | tar -xvpf -'

mkdir home/tc/.ssh
cat  ~rik/.ssh/id_rsa.pub > home/tc/.ssh/authorized_keys
chown -R 1001 home/tc/.ssh ## <2>
chmod 700 home/tc/.ssh
chmod g-s home/tc/.ssh
chmod 600 home/tc/.ssh/authorized_keys

tar -cvp * | gzip -c > ../mydata.tgz
cp ../mydata.tgz /mnt/tce
sudo umount /mnt
exit ## <3>
  1. all following commands need sudo, so ease up typing
  2. 1001 is the user id of the tc user on the box
  3. exit the sudo bash

Ready to Rumble

Now

 [rik@host ~]$ ssh tc@box
    ( '>')
   /) TC (\   Core is distributed with ABSOLUTELY NO WARRANTY.
  (/-_--_-\)           www.tinycorelinux.net
 tc@box:~$

Voila, now we have a working TcCore environment.

[TIP] : Do not forget to backup future changes using filetool.sh.

Appendix

References