Quartz64 UEFI with U-Boot

From PINE64
Revision as of 21:04, 28 July 2023 by CounterPillow (talk | contribs) (WIP Page for U-Boot EFI Booting, not yet tested)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Note: This article is a work-in-progress

This article is a guide to installing an U-Boot capable of booting generic aarch64 EFI images on a Quartz64 or SOQuartz board.

Prerequisites

We need two to three storage mediums:

- an SD card or eMMC module for U-Boot (advanced users may use the SPI flash on Model B) - an SD card, eMMC module, USB thumb drive or NVMe drive for our installed system - an SD card, eMMC module, USB thumb drive or NVMe drive for the installer

In practice, you can usually combine some of these into one, e.g. if you start your partitions at 16MiB you can have u-boot and your installed system reside on the same storage medium.

A good way to go about things is to put U-Boot on an SD card, and install the system on eMMC or NVMe, and boot the installer from an USB thumb drive.

Flashing U-Boot

The first step is to flash U-Boot to our first device, either an SD card or an eMMC module. U-Boot here is the system's firmware, similar to the BIOS in an x86 PC.

You'll need a Linux or macOS computer (any CPU architecture is fine), and a GitHub account to download Kwiboo's u-boot-build pipeline outputs with.

Download the U-Boot build for your specific device from the latest RK356x Actions run of Kwiboo's u-boot-build workflow repository. Make sure you are downloading the correct build for your device, e.g. don't use rk3566-quartz64-a on a SOQuartz!

Extract the u-boot-rockchip.bin from the zip archive.

Next, insert the microSD card into your microSD reader, or attach the eMMC module to your eMMC to USB adapter and plug it in. Identify which /dev/ device node it showed up at, and ideally wipe any filesystems and partitions on the device. From now on, we'll refer to it as /dev/sdX.

To flash U-Boot, write u-boot-rockchip.bin to byte 32768 of /dev/sdX. You can do this with dd as follows:

sudo dd if=u-boot-rockchip.bin of=/dev/sdX bs=32k seek=1 conv=fsync
Note: Double-check you have the right device before doing this! You don't want to flash this to one of your computer's actual disks.

Flashing a Distro Installer

Assuming you want to boot an installer rather than some image, you'll want to flash a distribution's aarch64 EFI installation ISO to e.g. an USB thumb drive.

Some examples for installers that fit this criteria:

If you're going to use something else, then please make sure the distribution image you're going to use has a not too ancient kernel; check Quartz64 Development for which kernel versions bring which drivers. Also make sure the distribution's kernel has the right drivers enabled in its kernel configuration.

To prepare the installation medium, simply use your preferred image flashing utility to write the ISO to e.g. a USB thumb drive. You can also use dd for this.

Performing the Installation

Attach your two to three storage mediums (U-Boot medium, installer medium and target drive) and attach power. If everything went well, you should be booted into the distribution's guided installer. If everything did not go well, use a serial adapter like the PINE64 Woodpecker to get serial output from U-Boot at 1500000 bauds.

Complete the installation. If you want to use your U-Boot medium as your target drive here, make sure to manually partition and leave 16MiB or more space at the start of the drive, so that U-Boot is not overwritten.

After the installation completes, power off the board, remove the installer medium, and power it back on. You should now be booted into your freshly installed system.