Build a UEFI-bootable Ubuntu RISC-V preinstalled image for the SpacemiT K3 Pico-ITX board.
This project serves two kinds of users:
- Flash only — download a prebuilt package from Releases and flash the board → Flash a board
- Build / customise — modify and rebuild the image from source → Build the image
The resulting image lays out a single GPT disk with raw firmware partitions
(env, bootinfo, fsbl, esos, opensbi, uboot), an
EFI System Partition, a CIDATA cloud-init partition and an ext4
writable rootfs.
Download the latest release from GitHub Releases:
ubuntu-26.04-preinstalled-desktop-riscv64.img.zst— for fastboot (command-line)ubuntu-26.04-preinstalled-desktop-riscv64.tar.gz— for Titantools (GUI)
Pick either method below.
Hardware: put the SpacemiT K3 Pico-ITX board into flash mode.
Install dependencies on an Ubuntu (22.04 or later) host:
sudo apt-get update
sudo apt-get install git ubuntu-dev-tools fastboot
git clone https://github.com/spacemit-com/K3-Ubuntu-Images.git gadget
cd gadgetFlash in one step:
make IMG=/path/to/ubuntu-26.04-preinstalled-desktop-riscv64.img.zst allRun the steps manually:
# 1. Extract partitions from the image into ./temp
python3 image_flash.py \
--img path/to/ubuntu-26.04-preinstalled-desktop-riscv64.img \
--partition partition_universal.json
# 2. Place u-boot.itb (obtained from the PPA) into ./temp.
# The BootROM loads it into RAM over USB; it runs in RAM as a
# temporary fastboot server and is never written to any storage partition.
cp /path/to/u-boot.itb temp/u-boot.itb
# 3. Flash
sudo python3 image_flash.py --fastboot fastboot.yamlTitantools
is SpacemiT’s graphical flashing suite (Windows / Linux). It accepts a
firmware directory or a .tar.gz archive without requiring fastboot
on the host.
- Install Titantools for your OS (Windows installer or Linux AppImage).
- Put the board into flashing mode (hold FDL / Download button while powering on, then connect the USB cable).
- Open Titantools → Dev Tools → USB Download.
- Click Scan Device and select your board.
- Select the downloaded
.tar.gz(or point to the unpacked directory). - Click Start Flashing and wait for completion.
Default credentials: ubuntu / ubuntu.
Warning
You will be prompted to change the password on first login. Choose a strong password immediately.
Note
Before using the image, check the Release Notes for the version you downloaded. Each release may document known issues and required post-flash steps (e.g. firmware updates) that are specific to that release.
The image ships ubuntu-desktop and Chromium.
To customise the image, build it from source.
Install build dependencies on an Ubuntu 26.04 host:
sudo apt-get update
sudo apt-get install git snapd qemu-user-static ubuntu-dev-tools \
python3-yaml fastboot
sudo snap install --classic ubuntu-imageClone and build:
git clone https://github.com/spacemit-com/K3-Ubuntu-Images.git gadget
cd gadget
make image # clean build via ubuntu-imageUseful build variants:
make image-debug # clean build with --debugThe image is produced at:
workdir/ubuntu-26.04-preinstalled-desktop-riscv64.img
After building, choose a flashing method:
# Option A: flash via fastboot
make IMG=workdir/ubuntu-26.04-preinstalled-desktop-riscv64.img all
# Option B: pack as Titantools format (.tar.gz) then flash
make IMG=workdir/ubuntu-26.04-preinstalled-desktop-riscv64.img titan ┌→ ESOS (power mgmt core + RT task core, independent)
BootROM → FSBL (U-Boot SPL) ┤
└→ OpenSBI → EDK2 UEFI → GRUB → Linux
Each stage in detail:
- BootROM reads the
bootinfopartition to locate and verify the FSBL, then transfers control to it. - FSBL (
fsblpartition, U-Boot SPL) initialises clocks, DRAM and peripheral hardware, then launches the following payloads in sequence:- ESOS (
esospartition) — the Energy Service OS, comprising two independent RTOS subsystems running on dedicated management cores, independent of the application core boot flow:- Power Management Core — a multi-task RTOS designed for power management.
- Runtime Real-Time Task Core — a multi-task RTOS designed for real-time task processing.
- OpenSBI (
opensbipartition) — sets up the SBI runtime on the application core and boots the next-stage payload — EDK2.
- ESOS (
- EDK2 UEFI (
ubootpartition, storesedk2.itb) provides the full UEFI environment. Despite the partition name inherited from the U-Boot boot layout, the runtime payload is the EDK2 firmware — not U-Boot. - GRUB is loaded by EDK2 from the ESP as
EFI/boot/bootriscv64.efi. A stubgrub.cfgon the ESP redirects GRUB to/boot/grub/grub.cfgon thewritablepartition. - Linux is booted by GRUB with the parameters defined in
/boot/grub/grub.cfg.
u-boot.itb is not part of the runtime boot chain. It is used solely
as a temporary flashing service:
- The SpacemiT K3 BootROM, when in USB-download mode, accepts a FIT image over USB and loads it entirely into RAM.
- The host uploads
u-boot.itb— a full U-Boot build containing a fastboot server — into the board's RAM. - U-Boot runs in RAM and exposes the fastboot protocol to the host.
- The host then drives
fastbootto write all GPT/NOR partition images to the target storage. - On the next power-cycle the board boots from the freshly written partitions
using the runtime chain above;
u-boot.itbis never persisted to storage.
The image uses a two-phase GRUB setup.
Pre-installed (image-time):
- The ESP is populated with a pre-built
grubriscv64.efiand a minimal stubgrub.cfg(gadget.in/grub.cfg) that redirects GRUB to/boot/grub/grub.cfgon thewritablepartition. - The
writablerootfs ships with a pre-generated/boot/grub/grub.cfg(sourced fromgrub.cfgin this repository). This is sufficient to boot the system on the very first power-on.
First-boot (runtime):
On the first boot a cloud-init job runs:
grub-install— installs the GRUB EFI binary for the running system and registers a UEFI boot entry in NVRAM, replacing the generic pre-installed stub.update-grub— regenerates/boot/grub/grub.cfgfrom the installed kernels,/etc/grub.d/templates and/etc/default/grubsettings, replacing the image-time pre-generated file.
Subsequent kernel upgrades automatically trigger update-grub to keep the
boot menu up to date.
image-definition.yaml ubuntu-image classic build definition
gadget.in/ gadget source (partitions + firmware)
Makefile pulls firmware (.deb) from spacemit/k3 PPA
gadget.yaml GPT layout
edk2.itb EDK2 UEFI FIT (vendored binary)
grub.cfg ESP grub stub
user-data / meta-data cloud-init NoCloud
grub.cfg rootfs /boot/grub/grub.cfg (UEFI menu)
grub.d/ /etc/default/grub.d snippets
setup-scripts.sh in-image customization (apt upgrade)
spacemit-ppa-preference APT pin for spacemit/k3 PPA
Makefile image build + flash workflow entry points
image_flash.py extract, fastboot driver, and titan pack
fastboot.yaml fastboot flash flow
partition_universal.json GPT partition table (UFS/SSD)
partition_4M.json NOR partition table