* [PATCH v1 1/8] make.sh: Add support for building on loongarch64
2026-08-05 2:39 [PATCH v1 0/8] Add loongarch64 architecture support to IPFire Vincent Li
@ 2026-08-05 2:39 ` Vincent Li
2026-08-05 2:39 ` [PATCH v1 2/8] gcc: Add dynamic linker path for loongarch64 native toolchain build Vincent Li
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Vincent Li @ 2026-08-05 2:39 UTC (permalink / raw)
To: Michael Tremer, development; +Cc: Vincent Li
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
---
make.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/make.sh b/make.sh
index 37f01c1a2..fd8b777a3 100755
--- a/make.sh
+++ b/make.sh
@@ -49,6 +49,7 @@ KVER="${KVER/-rc/.0-rc}${KVER_SUFFIX}"
# All supported architectures
ARCHES=(
aarch64
+ loongarch64
riscv64
x86_64
)
@@ -2415,7 +2416,7 @@ done
# Check the architecture
case "${BUILD_ARCH}" in
- aarch64|x86_64|riscv64)
+ aarch64|x86_64|riscv64|loongarch64)
;;
*)
@@ -2429,6 +2430,10 @@ case "${BUILD_ARCH}" in
BUILD_PLATFORM="arm"
;;
+ loongarch64)
+ BUILD_PLATFORM="loongarch"
+ ;;
+
riscv64)
BUILD_PLATFORM="riscv"
;;
--
2.38.1
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH v1 2/8] gcc: Add dynamic linker path for loongarch64 native toolchain build
2026-08-05 2:39 [PATCH v1 0/8] Add loongarch64 architecture support to IPFire Vincent Li
2026-08-05 2:39 ` [PATCH v1 1/8] make.sh: Add support for building on loongarch64 Vincent Li
@ 2026-08-05 2:39 ` Vincent Li
2026-08-05 2:39 ` [PATCH v1 3/8] lfs/Config: Update config.guess and config.sub for loongarch64 support Vincent Li
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Vincent Li @ 2026-08-05 2:39 UTC (permalink / raw)
To: Michael Tremer, development; +Cc: Vincent Li, Vincent Li
When building GCC natively on loongarch64 as part of the toolchain
bootstrap, the generated spec file incorrectly uses the default system
library path "/lib" for the dynamic linker. This causes the glibc build
to fail during validation because the compiled test program requests
the system runtime linker at /lib/ld-linux-loongarch-lp64d.so.1 instead
of the toolchain-specific path /tools_loongarch64/lib/.
The ABI_GRLEN_SPEC macro in gcc/config/loongarch/gnu-user.h defines
the dynamic linker path pattern. During the initial toolchain bootstrap
stage (PASS=1 with TOOLCHAIN=1), this needs to reference $(TOOLS_DIR)/lib
where the bootstrap runtime linker is installed, rather than the system
/lib path which may not yet have a compatible runtime linker.
Add a conditional sed substitution for loongarch64 builds that replaces
'"/lib" ABI_GRLEN_SPEC' with '"$(TOOLS_DIR)/lib" ABI_GRLEN_SPEC' in
gnu-user.h. This ensures GCC generates the correct dynamic linker path
for the bootstrap environment.
Without this change, the glibc build validation fails with:
readelf -l dummy | grep "Requesting program interpreter: /tools_loongarch64"
make: *** [glibc:131: /usr/src/ipfire-2.x/log_loongarch64/glibc-2.43-tools] Error 1
Assisted-by: DeepSeek-V4-Flash
Signed-off-by: Vincent Li <Vincent Li <vincent.mc.li@gmail.com>
---
lfs/gcc | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lfs/gcc b/lfs/gcc
index c3a8da602..6645b2e03 100644
--- a/lfs/gcc
+++ b/lfs/gcc
@@ -229,6 +229,10 @@ ifeq "$(TOOLCHAIN)" "1"
cd $(DIR_APP) && tar xfa $(DIR_DL)/mpc-$(MPC_VER).tar.gz
cd $(DIR_APP) && mv -v mpc-$(MPC_VER) mpc
+ifeq "$(BUILD_ARCH)" "loongarch64"
+ sed -i '/ABI_GRLEN_SPEC/s@"/lib" ABI_GRLEN_SPEC@"$(TOOLS_DIR)/lib" ABI_GRLEN_SPEC@g' $(DIR_APP)/gcc/config/loongarch/gnu-user.h
+endif
+
for file in $$(find $(DIR_APP)/gcc/config -name linux64.h -o -name linux.h \
-o -name sysv4.h -o -name linux-eabi.h -o -name linux-elf.h -o -name aarch64-linux.h); do \
echo "Processing $${file}..."; \
--
2.38.1
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH v1 3/8] lfs/Config: Update config.guess and config.sub for loongarch64 support
2026-08-05 2:39 [PATCH v1 0/8] Add loongarch64 architecture support to IPFire Vincent Li
2026-08-05 2:39 ` [PATCH v1 1/8] make.sh: Add support for building on loongarch64 Vincent Li
2026-08-05 2:39 ` [PATCH v1 2/8] gcc: Add dynamic linker path for loongarch64 native toolchain build Vincent Li
@ 2026-08-05 2:39 ` Vincent Li
2026-08-05 2:39 ` [PATCH v1 4/8] lfs/Config: Add EFI and GRUB architecture definitions for loongarch64 Vincent Li
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Vincent Li @ 2026-08-05 2:39 UTC (permalink / raw)
To: Michael Tremer, development; +Cc: Vincent Li
Some software packages contain outdated config.guess and config.sub
scripts that do not recognize loongarch64 as a valid architecture.
This causes build failures when configuring packages that use these
scripts to detect the target platform.
Extend the UPDATE_AUTOMAKE macro to also apply to loongarch64 builds,
ensuring that config.guess and config.sub are updated from the system
automake installation for all packages.
This brings loongarch64 in line with the existing behavior for aarch64
and riscv64 architectures, where these scripts are already updated to
support those newer architectures.
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
---
lfs/Config | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lfs/Config b/lfs/Config
index 5abcd0715..2334d5f0a 100644
--- a/lfs/Config
+++ b/lfs/Config
@@ -476,7 +476,7 @@ define INSTALL_INITSCRIPTS
done
endef
-ifeq "$(BUILD_ARCH)" "$(filter $(BUILD_ARCH),aarch64 riscv64)"
+ifeq "$(BUILD_ARCH)" "$(filter $(BUILD_ARCH),aarch64 riscv64 loongarch64)"
define UPDATE_AUTOMAKE
for i in $$(find $(DIR_APP) -name config.guess -o -name config.sub); do \
cp -vf /usr/share/automake*/$$(basename $${i}) $${i} || \
--
2.38.1
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH v1 4/8] lfs/Config: Add EFI and GRUB architecture definitions for loongarch64
2026-08-05 2:39 [PATCH v1 0/8] Add loongarch64 architecture support to IPFire Vincent Li
` (2 preceding siblings ...)
2026-08-05 2:39 ` [PATCH v1 3/8] lfs/Config: Update config.guess and config.sub for loongarch64 support Vincent Li
@ 2026-08-05 2:39 ` Vincent Li
2026-08-05 2:39 ` [PATCH v1 5/8] lfs/Config: Set GOARCH for loongarch64 builds Vincent Li
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Vincent Li @ 2026-08-05 2:39 UTC (permalink / raw)
To: Michael Tremer, development; +Cc: Vincent Li
Add support for building EFI bootable images on loongarch64 by defining
the appropriate architecture variables. This enables the build system
to correctly locate and build the EFI firmware, GRUB bootloader, and
associated boot components for the LoongArch64 architecture.
- Set EFI=1 to enable EFI support
- Set EFI_ARCH=LOONGARCH64 for EFI firmware selection
- Set GRUB_ARCH=loongarch64 to build the correct GRUB target
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
---
lfs/Config | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lfs/Config b/lfs/Config
index 2334d5f0a..06ba065ea 100644
--- a/lfs/Config
+++ b/lfs/Config
@@ -111,7 +111,7 @@ DIR_TMP_PAK = $(DIR_TMP)/package-$(PROG)
# Add the compiler location and version and specs to the ccache hash
CCACHE_COMPILERCHECK += $(shell gcc -dumpspecs 2>/dev/null | md5sum | cut -d ' ' -f1)
-# We support EFI on x86_64 riscv64 and aarch64
+# We support EFI on x86_64 riscv64 aarch64 and loongarch64
ifeq "$(BUILD_ARCH)" "x86_64"
EFI = 1
EFI_ARCH = x64
@@ -130,6 +130,12 @@ ifeq "$(BUILD_ARCH)" "aarch64"
GRUB_ARCH = arm64
endif
+ifeq "$(BUILD_ARCH)" "loongarch64"
+ EFI = 1
+ EFI_ARCH = LOONGARCH64
+ GRUB_ARCH = $(BUILD_ARCH)
+endif
+
CMAKE = cmake
# In the toolchain, we might be cross-compiling and need cmake to know
--
2.38.1
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH v1 5/8] lfs/Config: Set GOARCH for loongarch64 builds
2026-08-05 2:39 [PATCH v1 0/8] Add loongarch64 architecture support to IPFire Vincent Li
` (3 preceding siblings ...)
2026-08-05 2:39 ` [PATCH v1 4/8] lfs/Config: Add EFI and GRUB architecture definitions for loongarch64 Vincent Li
@ 2026-08-05 2:39 ` Vincent Li
2026-08-05 2:39 ` [PATCH v1 6/8] installer: Enable EFI support for loongarch64 Vincent Li
2026-08-05 2:39 ` [PATCH v1 7/8] installer: Add bootloader installation " Vincent Li
6 siblings, 0 replies; 8+ messages in thread
From: Vincent Li @ 2026-08-05 2:39 UTC (permalink / raw)
To: Michael Tremer, development; +Cc: Vincent Li
Define GOARCH=loong64 for loongarch64 architecture builds to enable
proper Go language compilation support. The Go programming language
uses "loong64" as the architecture identifier for LoongArch 64-bit
systems.
This allows any Go packages in the build system to compile correctly
for the loongarch64 target by providing the correct GOARCH value during
the build process.
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
---
lfs/Config | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lfs/Config b/lfs/Config
index 06ba065ea..fea0fcbbd 100644
--- a/lfs/Config
+++ b/lfs/Config
@@ -157,6 +157,10 @@ ifeq "$(BUILD_ARCH)" "aarch64"
GOARCH = arm64
endif
+ifeq "$(BUILD_ARCH)" "loongarch64"
+ GOARCH = loong64
+endif
+
# Rust
ifeq "$(BUILD_ARCH)" "riscv64"
RUST_ARCH = riscv64gc
--
2.38.1
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH v1 6/8] installer: Enable EFI support for loongarch64
2026-08-05 2:39 [PATCH v1 0/8] Add loongarch64 architecture support to IPFire Vincent Li
` (4 preceding siblings ...)
2026-08-05 2:39 ` [PATCH v1 5/8] lfs/Config: Set GOARCH for loongarch64 builds Vincent Li
@ 2026-08-05 2:39 ` Vincent Li
2026-08-05 2:39 ` [PATCH v1 7/8] installer: Add bootloader installation " Vincent Li
6 siblings, 0 replies; 8+ messages in thread
From: Vincent Li @ 2026-08-05 2:39 UTC (permalink / raw)
To: Michael Tremer, development; +Cc: Vincent Li
Add loongarch64 to the list of architectures that support EFI boot mode
in the installer hardware detection logic. This enables the installer
to correctly detect and configure EFI boot installation for LoongArch64
systems, which use UEFI as the standard firmware interface.
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
---
src/installer/hw.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/installer/hw.c b/src/installer/hw.c
index 058671624..0e8e175b3 100644
--- a/src/installer/hw.c
+++ b/src/installer/hw.c
@@ -116,7 +116,8 @@ struct hw* hw_init() {
// Should we install in EFI mode?
if ((strcmp(hw->arch, "x86_64") == 0)
|| (strcmp(hw->arch, "aarch64") == 0)
- || (strcmp(hw->arch, "riscv64") == 0))
+ || (strcmp(hw->arch, "riscv64") == 0)
+ || (strcmp(hw->arch, "loongarch64") == 0))
hw->efi = 1;
return hw;
--
2.38.1
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH v1 7/8] installer: Add bootloader installation support for loongarch64
2026-08-05 2:39 [PATCH v1 0/8] Add loongarch64 architecture support to IPFire Vincent Li
` (5 preceding siblings ...)
2026-08-05 2:39 ` [PATCH v1 6/8] installer: Enable EFI support for loongarch64 Vincent Li
@ 2026-08-05 2:39 ` Vincent Li
6 siblings, 0 replies; 8+ messages in thread
From: Vincent Li @ 2026-08-05 2:39 UTC (permalink / raw)
To: Michael Tremer, development; +Cc: Vincent Li
Add loongarch64-efi to the list of supported bootloader architectures
in the install-bootloader script. This ensures that when installing
on LoongArch64 systems, the correct bootloader components (GRUB for
EFI) are installed during the installation process.
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
---
src/installer/install-bootloader | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/installer/install-bootloader b/src/installer/install-bootloader
index f21578495..a61fcb29c 100644
--- a/src/installer/install-bootloader
+++ b/src/installer/install-bootloader
@@ -104,6 +104,9 @@ function grub_install() {
aarch64)
arches="arm64-efi"
;;
+ loongarch64)
+ arches="loongarch64-efi"
+ ;;
riscv64)
arches="riscv64-efi"
;;
--
2.38.1
^ permalink raw reply [flat|nested] 8+ messages in thread