From dfada2a5221bf345034d45034f97cfc9f82d771f Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Fri, 14 Oct 2022 00:12:37 +0200 Subject: [PATCH] pmb: enable riscv64 architecture (MR 2215) Enable pmbootstrap to work on riscv64 packages, and at the same time also expand the alpine_to_hostspec list to match upstream (adding riscv32 and loongarch*). --- pmb/config/__init__.py | 4 ++-- pmb/parse/arch.py | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pmb/config/__init__.py b/pmb/config/__init__.py index 190df0a8..f63bfc69 100644 --- a/pmb/config/__init__.py +++ b/pmb/config/__init__.py @@ -262,7 +262,7 @@ chroot_outdated = 3600 * 24 * 2 # specify architectures supported by Alpine here. For cross-compiling, # we need to generate the "musl-$ARCH", "binutils-$ARCH" and "gcc-$ARCH" # packages (use "pmbootstrap aportgen musl-armhf" etc.). -build_device_architectures = ["armhf", "armv7", "aarch64", "x86_64", "x86"] +build_device_architectures = ["armhf", "armv7", "aarch64", "x86_64", "x86", "riscv64"] # Packages that will be installed in a chroot before it builds packages # for the first time @@ -1004,7 +1004,7 @@ newapkbuild_arguments_switches_other = [ # Patterns of package names to ignore for automatic pmaport upgrading # ("pmbootstrap aportupgrade --all") upgrade_ignore = ["device-*", "firmware-*", "linux-*", "postmarketos-*", - "*-aarch64", "*-armhf", "*-armv7"] + "*-aarch64", "*-armhf", "*-armv7", "*-riscv64"] # # SIDELOAD diff --git a/pmb/parse/arch.py b/pmb/parse/arch.py index b3d241e2..790afc98 100644 --- a/pmb/parse/arch.py +++ b/pmb/parse/arch.py @@ -36,6 +36,7 @@ def from_chroot_suffix(args, suffix): def alpine_to_qemu(arch): """ Convert the architecture to the string used in the QEMU packaging. + This corresponds to the package name of e.g. qemu-system-aarch64. """ mapping = { @@ -44,6 +45,7 @@ def alpine_to_qemu(arch): "armhf": "arm", "armv7": "arm", "aarch64": "aarch64", + "riscv64": "riscv64", } for pattern, arch_qemu in mapping.items(): if fnmatch.fnmatch(arch, pattern): @@ -78,6 +80,9 @@ def alpine_to_hostspec(arch): "armel": "armv5-alpine-linux-musleabi", "armhf": "armv6-alpine-linux-musleabihf", "armv7": "armv7-alpine-linux-musleabihf", + "loongarch32": "loongarch32-alpine-linux-musl", + "loongarchx32": "loongarchx32-alpine-linux-musl", + "loongarch64": "loongarch64-alpine-linux-musl", "mips": "mips-alpine-linux-musl", "mips64": "mips64-alpine-linux-musl", "mipsel": "mipsel-alpine-linux-musl", @@ -85,6 +90,8 @@ def alpine_to_hostspec(arch): "ppc": "powerpc-alpine-linux-musl", "ppc64": "powerpc64-alpine-linux-musl", "ppc64le": "powerpc64le-alpine-linux-musl", + "riscv32": "riscv32-alpine-linux-musl", + "riscv64": "riscv64-alpine-linux-musl", "s390x": "s390x-alpine-linux-musl", "x86": "i586-alpine-linux-musl", "x86_64": "x86_64-alpine-linux-musl",