IoT Bytes

Bits and Bytes of IoT

piCore (Tiny Core) Linux on Raspberry Pi

Pradeep Singh | 31st Aug 2017

Raspberry_Pi_Logo.svg

piCore is the Raspberry Pi port of Tiny Core Linux, which is an independent system architected by Robert Shingledecker and now developed by a small team of developers with strong community support. As piCore runs entirely in RAM, boot media is not used after boot and there is no installation in conventional terms.

Let’s explore how to install and configure piCore on RaspberryPi –

1. Download the piCore image:

You can download the latest piCore image from the following download link (for this article I am using the piCore-9.0.3.zip image) –

http://distro.ibiblio.org/tinycorelinux/ports.html

2. Download and Install Etcher:

After downloading the piCore image, you need to flash it into the SD Card of your Raspberry Pi. Etcher is a great utility to flash the OS images into SD Cards or USB Drives. You can download it from Etcher home page –

https://etcher.io/

3. Burn the piCore image into SD Card:

Connect your SD Card with your computer and use Etcher to flash it with OS.

screenshot

4. Boot Raspberry Pi with piCore:

Connect the flashed SD Card on your Raspberry Pi and power it on.

5. SD Card Partitions:

The first partition (/dev/mmcblk0p1) is Win95 FAT32 (VFAT) type partition; it contains the basic piCore system and the Raspberry Pi boot loader, firmware and other support files. This partition is unmounted during operation, and the system does not use it after the boot process gets completed.

The second one (/dev/mmcblk0p2) is ext4 type partition; it is used for pre-installed extensions like ssh. However, the size of this partition is very small and it won’t allow you to install any additional extensions. You must expand this partition to have enough free space for additional extensions and backups.

6. Expand the /dev/mmcblk0p2 Partition:

6.1 Start fdisk partitioning tool as root, using the following command –

sudo fdisk -u /dev/mmcblk0

6.2 Now list partitions with ‘p‘ command and write down the starting and
ending cylinders of the second partition.

6.3 Delete the second partition with ‘d‘ command and then enter ‘2‘ as ‘Partition Number’.

6.4 Create a new partition using ‘n‘ command. Select ‘p’ for ‘Primary Partition‘ and ‘2‘ for ‘Partition Number’. For ‘First Cylinder’ use the same value as you had in the original partition (you made note of this value in step # 6.2). You may use the default value for ‘Last Cylinder’ or may use the smaller value if you want to create more partitions (for ex: swap disk).

following is the screenshot for steps 6.1 to 6.4 –

piCore_fdisk

6.5 Reboot the system using the following command –

sudo reboot

6.6 After the system boots up, expand the ‘/dev/mmcblk0p2‘ partition using the “sudo resize2fs /dev/mmcblk0p2” command –

tc@box:~$ sudo resize2fs /dev/mmcblk0p2
resize2fs 1.43.4 (31-Jan-2017)
Filesystem at /dev/mmcblk0p2 is mounted on /mnt/mmcblk0p2; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 104
The filesystem on /dev/mmcblk0p2 is now 13561088 (1k) blocks long.
tc@box:~$ 

With this, your Raspberry Pi is ready with piCore.

7. Reinstall SSH Extension (If you accidentally mess-up tce directory):

Though the piCore comes with SSH extension included, if you aren’t careful during the partition expansion process, it may stop working (if you lose tce directory from /dev/mmcblk0p2 partition). If you find yourself in this position, you can reinstall SSH using the following article –

Configure SSH Server on Tiny Core Linux using openSSH

The default user ssh or shell user for piCore is “tc” and its default password is “piCore“.

For “root” user, login to piCore shell using “tc” user and run “sudo passwd” command to change the root password.

Conclusion:

piCore is a really slim OS and because of this, it takes some efforts to set it up on Raspberry Pi. However, the effort pays off when you utilize the Raspberry Pi hardware to its maximum potential with a minimalistic OS. It would allow you to use the most part of the hardware for the application or the process that you want to run on your Raspberry Pi.


 

References:

https://github.com/mxmxmx/terminal_tedium/wiki/piCore

http://tinycorelinux.net/book.html

http://forum.tinycorelinux.net/index.php

 

One thought on “piCore (Tiny Core) Linux on Raspberry Pi

Leave a comment