Skip to content

Add initial support for loongarch64

Context

Add support for new architecture: loongarch64

LoongArch is a new instruction set of Loongson 3A5000 CPU, you can read the documents or visit the development community to get more information.

Some projects like Debian and Golang use loong64 as the architecture ID. But I think the Flatpak ecological environment prefers the same one with uname -m.

At this moment, with respect to the minimal VM target, only libseccomp, gnu-efi and systemd need patches or separate branches.

Description

Merge requests for different projects:

Acceptance Criteria

  • Minimal VM is built.

How to build it on an x86_64 system

  1. Setup loongarch64 binfmt with qemu-user version 7.2
  2. Apply the patch for arch-test and build the loong64 target with a cross toolchain on your host. Or just make a fake arch-test command in your $PATH that prints the string loong64.
  3. Apply the patch for buildbox-common and re-build buildbox-common and buildbox-run-bubblewrap.
  4. Checkout the branch of freedesktop-sdk MR
  5. Apply the patch for Buildstream
  6. Run to build: bst -o target_arch loongarch64 build vm/minimal/efi.bst

How to boot the VM on an x86_64 system

  1. Prepare qemu-system-loongarch64 version 7.2
  2. Get the firmware edk2-loongarch64-code.fd
  3. Checkout disk.img from vm/minimal/efi.bst
  4. Run it: qemu-system-loongarch64 -m 4G -smp 2 --cpu la464 --machine virt -bios ./edk2-loongarch64-code.fd --nographic -drive file=./disk.img,format=raw
Edited by Jürg Billeter