HowTo boot Chuwi HI13 on Linux – Fedora 26 (USB stick)

In this post, I want to share a methodology to be able to boot a linux distribution USB stick, on a Apollo Lake tablet (in my case Chuwi HI13) and handle the issue with Grub ont his platforms.

In this HowTo, I wanted to boot and test (and later install) Fedora Linux 26 on a Chuwi HI 13.

2 problems come with the stock USB sticks from Fedora (or other distributions):

  1. They massively use Grub as the default bootloader and Grub does not support Apollo Lake
  2. The linux content is often on a iso9660 partition which is by default not writable, which could be a real issue with such device since you may want to use a newer kernel / initrd than the one provided by the distribution.

There are some specialized distributions providing rEFInd as the default bootloader (which work perfectly on Apollo Lake) such as AltLinux Rescue but they are not the distribution I wanted to use.

Here are the steps, I followed to create a usable USB with Fedora 26 and easily boot on Chuwi Hi13.

Initialize the USB stick

Use a 4Gb USB stick (or more) that you will dedicate to the boot/test/install process – same as on any linux distribution installation.

This tutorial is based on Linux tool (ie it require an existing linux machine) to complete the steps but it should easily be done on a macOS or Windows machine.

  1. Format the USB stick to remove any existing partition
  2. Create a GTP partition table (which is required on UEFI systems) on the stick with fdisk – in the example usb stick is /dev/sdb – beware to update the correct path to the USB stick everywhere below if sdb is not the path to the USB stick in your case
    [as root] 
    fdisk /dev/sdb
    Command 'g' to create the GTP partition
    Command 'w' to write the partition table to the stick
  3. Create a ESP partition (special partition hosting all the required information for the EFI boot process) – 50 Mb is more than enough but it could be larger – and a standard linux partition for the install files
    [as root] 
    fdisk /dev/sdb
    Command 'n' to create a new partition
    Partion number: 1
    Size: +50M - for 50 Mb
    Command 't' to change the partition type to EFI
    Partition format: 1
    command 'n' to create a new partition
    Partition number: 2
    Size: +4G - or simply enter for all the remaining space on the stick
    Command 'w' to write the partition table
  4. Initialize filesystems on the newly created partitions: The ESP partition is just a standard FAT partition while the partition for the linux distribution will be on a standard ext4 partition. It is mandatory to label the partition properly (especially INSTALL)
    [as root]
    mkfs.fat -F 16 -n "BOOT" /dev/sdb1
    mkfs.ext4 -L "INSTALL" /dev/sdb2
  5. As root, mount both partition for later usage – Gnome may automatically mount the created Linux partition in the user space so umount it if it’s the case before mounting with root
    [as root]
    mkdir /mnt/BOOT
    mkdir /mnt/INSTALL
    mount /dev/sdb1 /mnt/BOOT
    mount /dev/sdb2 /mnt/INSTALL
  6. Retrieve the linux install partition (/dev/sdb2) partUUID for later
    ls -l /dev/disk/by-partuuid/

Copy the linux distribution installation files

Get a ISO of your linux distribution (in my case Fedora 26 Workstation x64) and mount it on your linux box (just mount the iso from Gnome with image mounter).
Copy all the content of the mounted ISO to the /mnt/INSTALL so that the linux partition of the stick contain the same files and directories as the ISO

Populate the ESP partition

We will just need to install rEFInd bootloader
You can download the latest package from rEFInd webpage or use my already setup configuration. Basically, I have remove all the useless stuff and keep what’s needed, install a shell.efi (at the root), renamed refind_x64.efi to BOOTX64.efi (which is the fallback name of the efi code to be started preventing to have to declare the .efi file to use to the UEFI) and setup a refind.conf file.
EFI Partition for Fedora 26
Unzip the my EFI partition file and just copy all its content to /mnt/BOOT

[as root]
cd 'EFI Partition'
cp * /mnt/BOOT/.

Last step is to edit the refind.cfg as root (with any editor such as vi or nano…) and update the partUUID in options line with the one gathered at step 6 during USB stick initialization

# refind.conf
# Configuration file for the rEFInd boot menu

timeout 20 <- Automatic boot after 20 s so that even without keyboard the tablet will boot. You can lower the value to 5 s for quicker start
screensaver 300

enable_touch <- I enable touch support in refind but it does not work yet
showtools shell, about, reboot, exit, firmware, fwupdate
fold_linux_kernels false
scanfor manual I disable any scan so that only booting in Fedora is allowed

menuentry « Fedora Live » {
icon /EFI/BOOT/icons/os_fedora.png <- this the path to the icon relative to the mount point of the ESP partition
volume INSTALL <- It tells that all the below contents refer to the partition labeled INSTALL
loader /images/pxeboot/vmlinuz <- Kernel path taken from Fedora defaulf grub configuration (on the ISO)
options « root=PARTUUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx quiet » <- updated kernel path to access the Install partition. You have to put the partUUID from the linux install partition on the USB stick from step 6 of the USB stick initialization. Default Fedora grub config used label but they were not properly recognize. PartUUID or UUID… are always properly recognize by the kernel
initrd /images/pxeboot/initrd.img <- Initrd path taken from Fedora defaulf grub configuration (on the ISO)

And that’s all folks.
Put the USB key in the Chuwi HI13 and enjoy Fedora or any linux distribution: just replace the installation file (in the /dev/sdb2) and update the refind entry with proper path to kernel, kernel targets and initrd path (look at the existing grub.cfg configuration). Go thing is that the stick will always work without reflashing it.
Chuwi HI13 require at least kernel 4.9 because of the memory (as far as I remember).
If your distribution of choice does not have this kernel level, you can update the kernel and initrd with new one for booting.