Logo

Tinycore: UEFI booting 

UEFI

This article was prompted by my use of the Wyse 3040 and the Wyse 5070 thin clients. Both of these have UEFI rather than an old style BIOS and, as far as I can see, do not have a 'compatibility module' and so do not support legacy booting with the old style boot sector and MBR. A while ago I found that in circumstances like these rufus could create a bootable USB flash drive for me, but what I now needed was a way of installing Tiny Core to the internal flash memory of a non-legacy booting thin client.

My starting point for installing Tiny Core on the 5070 was a USB pen drive running the 64-bit version of Tiny Core. For no particular reason I decided to use syslinux as the boot loader for the Thin Client installation.

My thanks to this article on the Tiny Core forum pages on which this is based.

There is also a thread that covers using grub.

Partition Table

This needs to be a GPT partition table, not a MBR. Also one partition has to be an EFI partition. The EFI system partition (also called ESP) is an OS independent partition that acts as the storage place for the EFI bootloaders, applications and drivers to be launched by the UEFI firmware. It is mandatory for UEFI boot. The EFI partition is not particularly large, maybe 100MB in size. It has to be formatted as a FAT partition (FAT12, FAT16 or FAT32). It can be any partition, it does not have to be in a particular location.

The linux utility gdisk works in a similar fashion to fdisk but creates a GPT rather than a legacy MBR. This is what I used. There are other alternatives.

In the description that follows I was working on the Wyse 5070 where the flash is onboard eMMC memory that appears as /dev/mmcblk0. With the more usual SATA SSDs you'll probably be working with sda.

I used gdisk to partition the 16GB mmblk0 into five partitions: 4G/4G/4G/100M/2.7G. (The last partition took what was left). The intention behind this was that I might be installing other experimental software/operating systems in the other partitions. Partitions 1,2,3 and 5 were set as type 8300 (linux). Partition 4, the ESP partition, is set as type EF00.

Having (re)partitioned the flash it is worth sacrificing 60 seconds and rebooting to ensure that the OS is using the new partition table.

Formatting

The next step is to prepare the partitions for use. For this you'll need to be sure that you've got the app dosfstools loaded. I formatted the first three partitions as Linux ext4 file systems. Depending on what you're trying to do you may want one of them to be a NTFS partition if you are aiming to dual boot Windows and Linux. As noted earlier the EFI partition must be a FAT partition. In my example this is partition 4.

mkfs.ext4 /dev/mmcblk0p1
mkfs.ext4 /dev/mmcblk0p2
mkfs.ext4 /dev/mmcblk0p3
mkfs.vfat /dev/mmcblk0p4

The UEFI software expects to find a specific path in the EFI partition so we need to create it. I chose to mount the EFI partition as /mnt/efi. (efi is shorter and easier to type than the alternative of mmcblk0p4 !)

mkdir /mnt/efi
sudo mount /dev/mmcblock0p4 /mnt/efi
mkdir -p /mnt/efi/EFI/BOOT

Install Tiny Core

Installing Tiny Core involves copying over two files and one directory. The two files are the kernel vmlinuz64 and initrd corepure64.gz. The directory is the tce directory. On my dual-boot USB flash drive this actually named tce64. Once again a reminder that in this description, having just eMMC flash on the thin client, the boot USB flash drive appears as sda and is mounted as /mnt/sda1.

I chose to use partition 3 for Tiny Core. We need to mount this before copying over the data. I also chose to place the Tiny Core kernel and initrd in the root directory of the EFI partition.

sudo mount /dev/mmcblk0p3
sudo cp /mnt/sda1/tc/boot/vmlinuz64 /mnt/efi/
sudo cp /mnt/sda1/tc/boot/corepure64.gz /mnt/efi/core64.gz
sudo cp -R /mnt/sda1/tce64 /mnt/mmcblk0p3

Install syslinux boot loader

A prerequisite here is that you have used the App Browser to add the syslinux package to your system.

After this it is just a matter of installing the syslinux boot loader and copying over the various support files that it needs. As we're using an ext4 file system we need to use the extlinux boot loader.

extlinux -i /mnt/efi
cp /usr/local/share/syslinux/efi*/syslinux.efi /mnt/efi/EFI/BOOT/BOOTX64.EFI
# use "BOOTIA32.EFI" for 32-bit UEFI
# sudo dd if=/usr/local/share/syslinux/gptmbr.bin of=/dev/sdb bs=440 count=1
cp /usr/local/share/syslinux/efi*/ldlinux.e64 /mnt/efi/EFI/BOOT
cp /usr/local/share/syslinux/efi*/libutil.c32 /mnt/efi/EFI/BOOT
cp /usr/local/share/syslinux/efi*/libcom32.c32 /mnt/efi/EFI/BOOT
cp /usr/local/share/syslinux/efi*/vesamenu.c32 /mnt/efi/EFI/BOOT
cp /usr/local/share/syslinux/libutil.c32 /mnt/efi
cp /usr/local/share/syslinux/libcom32.c32 /mnt/efi
cp /usr/local/share/syslinux/vesamenu.c32 /mnt/efi

Boot Menu

The final step is to create the syslinux boot menu in syslinux.cfg. The original guidance I was following suggested you should place this in both the root directory and the EFI/BOOT/ directory of the EFI partition. I found that the boot loader used the copy I had in the root directory.

We need to tell Tiny Core where to find the tce directory. My attempt to use tce=UUID=... approach didn't work so I ended up using the explicit tce=mmcblk0p3/tce64.

My syslinux.cfg file looks like this:

UI  vesamenu.c32
DEFAULT TC64

menu resolution 1024 768
menu title UEFI Boot for Wyse 5070
menu timeout 20

LABEL TC64
MENU LABEL Tiny Core 64-bit
KERNEL /vmlinuz64
INITRD /core64.gz
APPEND kmap=qwerty/uk  tce=mmcblk0p3/tce64 host=twinkle

 


Any comments? email me.    Last update July 2021