All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 0/9] LoongArch64 initial support
@ 2025-06-07 18:12 Jiaxun Yang
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 1/9] package/gcc: Introduce BR2_GCC_TARGET_SIMD option Jiaxun Yang
                   ` (9 more replies)
  0 siblings, 10 replies; 24+ messages in thread
From: Jiaxun Yang @ 2025-06-07 18:12 UTC (permalink / raw)
  To: buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Dick Olsson,
	Jiaxun Yang

Hi all,

This series enabled LoongArch64 support to buildroot.

It added LoongArch bits to toolchain and kernel & grub packages
and then introduced new loongarch64-efi board as a generic target.

Please review.
Thanks!

---
Sorry for taking so long to get back, I was trapped by EDK2 build
when I was making initial reversion and eventually lost track.

v2 Addressed most comments in v1.

To: buildroot@buildroot.org
Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
Cc: Romain Naour <romain.naour@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Dick Olsson <hi@senzilla.io>
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>

---
Jiaxun Yang (9):
      package/gcc: Introduce BR2_GCC_TARGET_SIMD option
      arch: Introduce LoongArch64
      package/glibc: Enable LoongArch64 support
      package/musl: Enable LoongArch64 support
      linux: Introduce {vmlinux, vmlinuz}.efi kernel binary format
      boot/grub2: Introduce loongarch64-efi target
      board/loongarch64-efi: Introduce the new board
      boot/edk2: Add LoongArch64 OVMF support
      board/qemu: Add loongarch64-virt-efi variant

 DEVELOPERS                                         |   7 ++
 arch/Config.in                                     |  19 +++
 arch/Config.in.loongarch                           | 129 +++++++++++++++++++++
 arch/arch.mk                                       |   1 +
 board/loongarch64-efi/genimage-efi.cfg             |  33 ++++++
 board/loongarch64-efi/grub.cfg                     |   6 +
 .../patches/linux-headers/linux-headers.hash       |   1 +
 board/loongarch64-efi/patches/linux/linux.hash     |   2 +
 board/loongarch64-efi/post-image.sh                |   5 +
 board/loongarch64-efi/readme.txt                   |  34 ++++++
 board/qemu/loongarch64-virt-efi/genimage.cfg       |  33 ++++++
 board/qemu/loongarch64-virt-efi/grub.cfg           |   6 +
 board/qemu/loongarch64-virt-efi/post-image.sh      |   5 +
 board/qemu/loongarch64-virt-efi/readme.txt         |  31 +++++
 boot/edk2/Config.in                                |  14 ++-
 boot/edk2/edk2.mk                                  |   6 +
 boot/grub2/Config.in                               |  10 ++
 boot/grub2/grub2.mk                                |   9 ++
 configs/loongarch64_efi_defconfig                  |  22 ++++
 configs/qemu_loongarch64_virt_efi_defconfig        |  23 ++++
 linux/Config.in                                    |   8 ++
 linux/linux.mk                                     |   4 +
 package/gcc/gcc.mk                                 |   4 +
 package/glibc/Config.in                            |   2 +
 package/musl/Config.in                             |   1 +
 toolchain/toolchain-buildroot/Config.in            |   4 +
 .../toolchain-external/pkg-toolchain-external.mk   |   4 +
 toolchain/toolchain-wrapper.c                      |   3 +
 28 files changed, 425 insertions(+), 1 deletion(-)
---
base-commit: 5080f0af166d2fff26f0c661b0cc7da0b3eaddd8
change-id: 20250607-loongarch-8abe88258242

Best regards,
-- 
Jiaxun Yang <jiaxun.yang@flygoat.com>

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH v2 1/9] package/gcc: Introduce BR2_GCC_TARGET_SIMD option
  2025-06-07 18:12 [Buildroot] [PATCH v2 0/9] LoongArch64 initial support Jiaxun Yang
@ 2025-06-07 18:12 ` Jiaxun Yang
  2025-06-14 12:47   ` Romain Naour via buildroot
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 2/9] arch: Introduce LoongArch64 Jiaxun Yang
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Jiaxun Yang @ 2025-06-07 18:12 UTC (permalink / raw)
  To: buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Dick Olsson,
	Jiaxun Yang

Introduce BR2_GCC_TARGET_SIMD for gcc to handle --with-simd/-msimd
present at loongarch's gcc options.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
v2: Add missing toolchain wrapper code
---
 arch/Config.in                                         | 6 ++++++
 arch/arch.mk                                           | 1 +
 package/gcc/gcc.mk                                     | 4 ++++
 toolchain/toolchain-external/pkg-toolchain-external.mk | 4 ++++
 toolchain/toolchain-wrapper.c                          | 3 +++
 5 files changed, 18 insertions(+)

diff --git a/arch/Config.in b/arch/Config.in
index 6b54c65df9cc7430e9d99e0dd9e29fef3cc527e4..ec720e74e193021ed01749945aed1457ec0789a1 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -349,6 +349,12 @@ config BR2_GCC_TARGET_FPU
 config BR2_GCC_TARGET_FLOAT_ABI
 	string
 
+# The value of this option will be passed as --with-simd=<value> when
+# building gcc (internal backend) or -simd=<value> in the toolchain
+# wrapper (external toolchain)
+config BR2_GCC_TARGET_SIMD
+	string
+
 # The value of this option will be passed as --with-mode=<value> when
 # building gcc (internal backend) or -m<value> in the toolchain
 # wrapper (external toolchain)
diff --git a/arch/arch.mk b/arch/arch.mk
index 4174d33df548b0f7bc754c89076142c41fe3f867..4a7851a9fdcebc4720415f5b0fba771bb4993ef6 100644
--- a/arch/arch.mk
+++ b/arch/arch.mk
@@ -16,6 +16,7 @@ GCC_TARGET_FP32_MODE := $(call qstrip,$(BR2_GCC_TARGET_FP32_MODE))
 GCC_TARGET_CPU := $(call qstrip,$(BR2_GCC_TARGET_CPU))
 GCC_TARGET_FPU := $(call qstrip,$(BR2_GCC_TARGET_FPU))
 GCC_TARGET_FLOAT_ABI := $(call qstrip,$(BR2_GCC_TARGET_FLOAT_ABI))
+GCC_TARGET_SIMD := $(call qstrip,$(BR2_GCC_TARGET_SIMD))
 GCC_TARGET_MODE := $(call qstrip,$(BR2_GCC_TARGET_MODE))
 
 # Explicitly set LD's "max-page-size" instead of relying on some defaults
diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
index 658f5a6b4fe21fb302333fcff3012e624ce241a7..ea96286c322f6aac0ad26ad633db6b73c544dac0 100644
--- a/package/gcc/gcc.mk
+++ b/package/gcc/gcc.mk
@@ -251,6 +251,10 @@ ifneq ($(GCC_TARGET_FLOAT_ABI),)
 HOST_GCC_COMMON_CONF_OPTS += --with-float=$(GCC_TARGET_FLOAT_ABI)
 endif
 
+ifneq ($(GCC_TARGET_SIMD),)
+HOST_GCC_COMMON_CONF_OPTS += --with-simd=$(GCC_TARGET_SIMD)
+endif
+
 ifneq ($(GCC_TARGET_MODE),)
 HOST_GCC_COMMON_CONF_OPTS += --with-mode=$(GCC_TARGET_MODE)
 endif
diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
index c08bf0a65391833de840c2f5ca112bb0b7802471..2c2afa76c06920389f10595ddbecb9e0455cecce 100644
--- a/toolchain/toolchain-external/pkg-toolchain-external.mk
+++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
@@ -217,6 +217,10 @@ ifneq ($(GCC_TARGET_FLOAT_ABI),)
 TOOLCHAIN_EXTERNAL_CFLAGS += -mfloat-abi=$(GCC_TARGET_FLOAT_ABI)
 TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_FLOAT_ABI='"$(GCC_TARGET_FLOAT_ABI)"'
 endif
+ifneq ($(GCC_TARGET_SIMD),)
+TOOLCHAIN_EXTERNAL_CFLAGS += -msimd=$(GCC_TARGET_SIMD)
+TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_SIMD='"$(GCC_TARGET_SIMD)"'
+endif
 ifneq ($(GCC_TARGET_MODE),)
 TOOLCHAIN_EXTERNAL_CFLAGS += -m$(GCC_TARGET_MODE)
 TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_MODE='"$(GCC_TARGET_MODE)"'
diff --git a/toolchain/toolchain-wrapper.c b/toolchain/toolchain-wrapper.c
index e644c1e7bb906caa24ea673a865c934f9094a030..a6974ba78f8a53535c6cd6517e1af1bb5ec12431 100644
--- a/toolchain/toolchain-wrapper.c
+++ b/toolchain/toolchain-wrapper.c
@@ -74,6 +74,9 @@ static char *predef_args[] = {
 #ifdef BR_SOFTFLOAT
 	"-msoft-float",
 #endif /* BR_SOFTFLOAT */
+#ifdef BR_SIMD
+	"-msimd=" BR_SIMD,
+#endif
 #ifdef BR_MODE
 	"-m" BR_MODE,
 #endif

-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH v2 2/9] arch: Introduce LoongArch64
  2025-06-07 18:12 [Buildroot] [PATCH v2 0/9] LoongArch64 initial support Jiaxun Yang
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 1/9] package/gcc: Introduce BR2_GCC_TARGET_SIMD option Jiaxun Yang
@ 2025-06-07 18:12 ` Jiaxun Yang
  2025-06-14 12:54   ` Romain Naour via buildroot
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 3/9] package/glibc: Enable LoongArch64 support Jiaxun Yang
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Jiaxun Yang @ 2025-06-07 18:12 UTC (permalink / raw)
  To: buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Dick Olsson,
	Jiaxun Yang

Introduce LoongArch64 at architecture level.

Config.in.loongarch is prepared for possible loongarch32
enablement in future.

Internal toolchain is supported, as our minimal binutils
version is already beyond LoongArch minimal version and
GCC option is limited by BR2_ARCH_NEEDS_GCC_AT_LEAST_12.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
v2:
	- Style fixes
	- add commit message about internal toolchain
---
 arch/Config.in           |  13 +++++
 arch/Config.in.loongarch | 129 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 142 insertions(+)

diff --git a/arch/Config.in b/arch/Config.in
index ec720e74e193021ed01749945aed1457ec0789a1..cc8b774a448913a7195f0dc12a1b452b6af80fd1 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -80,6 +80,15 @@ config BR2_i386
 	  Intel i386 architecture compatible microprocessor
 	  http://en.wikipedia.org/wiki/I386
 
+config BR2_loongarch64
+	bool "LoongArch64"
+	select BR2_USE_MMU
+	select BR2_ARCH_IS_64
+	help
+	  LoongArch64 is 64-bit architecture developed by Loongson.
+	  http://www.loongson.cn/
+	  https://en.wikipedia.org/wiki/Loongson
+
 config BR2_m68k
 	bool "m68k"
 	# MMU support is set by the subarchitecture file, arch/Config.in.m68k
@@ -379,6 +388,10 @@ if BR2_arm || BR2_armeb || BR2_aarch64 || BR2_aarch64_be
 source "arch/Config.in.arm"
 endif
 
+if BR2_loongarch64
+source "arch/Config.in.loongarch"
+endif
+
 if BR2_m68k
 source "arch/Config.in.m68k"
 endif
diff --git a/arch/Config.in.loongarch b/arch/Config.in.loongarch
new file mode 100644
index 0000000000000000000000000000000000000000..e53432ab50a150818a0a4b8cceabeeeea505be69
--- /dev/null
+++ b/arch/Config.in.loongarch
@@ -0,0 +1,129 @@
+# LoongArch CPU
+
+choice
+	prompt "Target Architecture Variant"
+	default BR2_loongarch64_generic
+
+config BR2_loongarch64_generic
+	bool "Generic LoongArch 64-bit"
+	depends on BR2_ARCH_IS_64
+	select BR2_ARCH_NEEDS_GCC_AT_LEAST_12
+	help
+	  Generic LoongArch 64-bit processor.
+
+config BR2_loongarch64_v1_0
+	bool "LoongArch64 ISA version 1.0"
+	depends on BR2_ARCH_IS_64
+	select BR2_ARCH_NEEDS_GCC_AT_LEAST_13
+	help
+	  LoongArch64 ISA version 1.0 processor.
+
+config BR2_loongarch64_v1_1
+	bool "LoongArch64 ISA version 1.1"
+	depends on BR2_ARCH_IS_64
+	select BR2_ARCH_NEEDS_GCC_AT_LEAST_13
+	help
+	  LoongArch64 ISA version 1.1 processor.
+
+endchoice
+
+choice
+	prompt "FPU Type"
+	default BR2_LOONGARCH_FPU_64
+
+config BR2_LOONGARCH_FPU_64
+	bool "64"
+	help
+	  Allow the use of hardware floating-point instructions for
+	  32-bit and 64-bit operations.
+
+config BR2_LOONGARCH_FPU_32
+	bool "32"
+	help
+	  Allow the use of hardware floating-point instructions for
+	  32-bit operations only.
+
+config BR2_LOONGARCH_FPU_NONE
+	bool "none"
+	help
+	  Prevent the use of hardware floating-point instructions.
+endchoice
+
+choice
+	prompt "SIMD Type"
+	default BR2_LOONGARCH_SIMD_NONE
+
+config BR2_LOONGARCH_SIMD_NONE
+	bool "none"
+	help
+	  Prevent the use of hardware SIMD instructions.
+
+config BR2_LOONGARCH_SIMD_LSX
+	bool "LSX"
+	help
+	  Enable generating instructions from the 128-bit LoongArch SIMD
+	  Extension (LSX).
+
+config BR2_LOONGARCH_SIMD_LASX
+	bool "LASX"
+	help
+	  Enable generating instructions from the 256-bit LoongArch
+	  Advanced SIMD Extension (LASX) and the 128-bit LoongArch
+	  SIMD Extension (LSX).
+endchoice
+
+choice
+	prompt "Target ABI"
+	default BR2_LOONGARCH_ABI_LP64D if BR2_ARCH_IS_64 && BR2_LOONGARCH_FPU_64
+	default BR2_LOONGARCH_ABI_LP64F if BR2_ARCH_IS_64 && BR2_LOONGARCH_FPU_32
+	default BR2_LOONGARCH_ABI_LP64S if BR2_ARCH_IS_64 && BR2_LOONGARCH_SIMD_NONE
+
+config BR2_LOONGARCH_ABI_LP64D
+	bool "lp64d"
+	depends on BR2_ARCH_IS_64
+	depends on BR2_LOONGARCH_FPU_64
+
+config BR2_LOONGARCH_ABI_LP64F
+	bool "lp64f"
+	depends on BR2_ARCH_IS_64
+	depends on BR2_LOONGARCH_FPU_64 || BR2_LOONGARCH_FPU_32
+
+config BR2_LOONGARCH_ABI_LP64S
+	bool "lp64d"
+	depends on BR2_ARCH_IS_64
+endchoice
+
+config BR2_ARCH
+	default "loongarch64" if BR2_ARCH_IS_64
+
+config BR2_NORMALIZED_ARCH
+	default "loongarch"
+
+config BR2_ENDIAN
+	default "LITTLE"
+
+config BR2_GCC_TARGET_ARCH
+	default "loongarch64" if BR2_loongarch64_generic
+	default "la64v1.0" if BR2_loongarch64_v1_0
+	default "la64v1.1" if BR2_loongarch64_v1_1
+
+config BR2_GCC_TARGET_FPU
+	default "64" if BR2_LOONGARCH_FPU_64
+	default "32" if BR2_LOONGARCH_FPU_32
+	default "none" if BR2_LOONGARCH_FPU_NONE
+
+config BR2_GCC_TARGET_SIMD
+	default "lasx" if BR2_LOONGARCH_SIMD_LASX
+	default "lsx" if BR2_LOONGARCH_SIMD_LSX
+	default "none" if BR2_LOONGARCH_FPU_NONE
+
+config BR2_GCC_TARGET_ABI
+	default "lp64d" if BR2_LOONGARCH_ABI_LP64D
+	default "lp64f" if BR2_LOONGARCH_ABI_LP64F
+	default "lp64s" if BR2_LOONGARCH_ABI_LP64S
+
+config BR2_READELF_ARCH_NAME
+	default "LoongArch"
+
+# vim: ft=kconfig
+# -*- mode:kconfig; -*-

-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH v2 3/9] package/glibc: Enable LoongArch64 support
  2025-06-07 18:12 [Buildroot] [PATCH v2 0/9] LoongArch64 initial support Jiaxun Yang
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 1/9] package/gcc: Introduce BR2_GCC_TARGET_SIMD option Jiaxun Yang
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 2/9] arch: Introduce LoongArch64 Jiaxun Yang
@ 2025-06-07 18:12 ` Jiaxun Yang
  2025-06-14 12:57   ` Romain Naour via buildroot
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 4/9] package/musl: " Jiaxun Yang
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Jiaxun Yang @ 2025-06-07 18:12 UTC (permalink / raw)
  To: buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Dick Olsson,
	Jiaxun Yang

Glibc introduced LoongArch64 support in 2.36, it requires kernel
5.19 to build.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 package/glibc/Config.in                 | 2 ++
 toolchain/toolchain-buildroot/Config.in | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/package/glibc/Config.in b/package/glibc/Config.in
index 52752e975e494aabe67b27b601defc504dbba94a..9a4fe6f3db0a1ca4f1ad37f7e1ea709664e254d5 100644
--- a/package/glibc/Config.in
+++ b/package/glibc/Config.in
@@ -5,6 +5,7 @@ config BR2_PACKAGE_GLIBC_ARCH_SUPPORTS
 	default y if BR2_aarch64
 	default y if BR2_aarch64_be
 	default y if BR2_i386
+	default y if BR2_loongarch64
 	default y if BR2_m68k_m68k
 	default y if BR2_mips
 	default y if BR2_mipsel
@@ -35,6 +36,7 @@ config BR2_PACKAGE_GLIBC_SUPPORTS
 	# toolchain/toolchain-buildroot/Config.in
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_2
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_10 || !BR2_powerpc64le
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_19 || !BR2_loongarch64
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_5 || !BR2_MIPS_NAN_2008
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_4 || !BR2_RISCV_32
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_0 || !BR2_RISCV_64
diff --git a/toolchain/toolchain-buildroot/Config.in b/toolchain/toolchain-buildroot/Config.in
index 0173f40d9768bc279dab7c6a50fe64d7501aa192..0bccdc817cc9f7e15d2285285e8c93cd432288f6 100644
--- a/toolchain/toolchain-buildroot/Config.in
+++ b/toolchain/toolchain-buildroot/Config.in
@@ -48,6 +48,10 @@ comment "glibc needs a toolchain w/ kernel headers >= 3.2"
 	depends on BR2_PACKAGE_GLIBC_ARCH_SUPPORTS
 	depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_2
 
+comment "glibc on LoongArch64 needs a toolchain w/ headers >= 5.19"
+	depends on BR2_loongarch64
+	depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_19
+
 # glibc >= 2.26 require kernel headers >= 3.10 on powerpc64le.
 comment "glibc on powerpc64le needs a toolchain w/ headers >= 3.10"
 	depends on BR2_powerpc64le

-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH v2 4/9] package/musl: Enable LoongArch64 support
  2025-06-07 18:12 [Buildroot] [PATCH v2 0/9] LoongArch64 initial support Jiaxun Yang
                   ` (2 preceding siblings ...)
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 3/9] package/glibc: Enable LoongArch64 support Jiaxun Yang
@ 2025-06-07 18:12 ` Jiaxun Yang
  2025-06-14 12:58   ` Romain Naour via buildroot
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 5/9] linux: Introduce {vmlinux, vmlinuz}.efi kernel binary format Jiaxun Yang
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Jiaxun Yang @ 2025-06-07 18:12 UTC (permalink / raw)
  To: buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Dick Olsson,
	Jiaxun Yang

musl introduced LoongArch64 support in 1.2.5.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 package/musl/Config.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/musl/Config.in b/package/musl/Config.in
index a6e2af054c354fb1078ff918f1058da3367a46a0..70475326f5b29f4b903e91e2be9d52f3b547907d 100644
--- a/package/musl/Config.in
+++ b/package/musl/Config.in
@@ -5,6 +5,7 @@ config BR2_PACKAGE_MUSL_ARCH_SUPPORTS
 	default y if BR2_arm
 	default y if BR2_armeb
 	default y if BR2_i386
+	default y if BR2_loongarch64
 	default y if BR2_m68k_m68k
 	default y if BR2_microblaze
 	default y if BR2_mips

-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH v2 5/9] linux: Introduce {vmlinux, vmlinuz}.efi kernel binary format
  2025-06-07 18:12 [Buildroot] [PATCH v2 0/9] LoongArch64 initial support Jiaxun Yang
                   ` (3 preceding siblings ...)
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 4/9] package/musl: " Jiaxun Yang
@ 2025-06-07 18:12 ` Jiaxun Yang
  2025-06-14 13:11   ` Romain Naour via buildroot
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 6/9] boot/grub2: Introduce loongarch64-efi target Jiaxun Yang
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Jiaxun Yang @ 2025-06-07 18:12 UTC (permalink / raw)
  To: buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Dick Olsson,
	Jiaxun Yang

vmlinux.efi and vmlinuz.efi are standard file names for LoongArch
EFISTUB kernel.

Introduce them to build system.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 linux/Config.in | 8 ++++++++
 linux/linux.mk  | 4 ++++
 2 files changed, 12 insertions(+)

diff --git a/linux/Config.in b/linux/Config.in
index ddd65154464f9949161c04c07a25d5035407e4f1..970cc3b63f1cc95a2f56c6abc30f6ff7571af41b 100644
--- a/linux/Config.in
+++ b/linux/Config.in
@@ -294,6 +294,10 @@ config BR2_LINUX_KERNEL_VMLINUX_BIN
 	bool "vmlinux.bin"
 	depends on BR2_mips || BR2_mipsel || BR2_sh
 
+config BR2_LINUX_KERNEL_VMLINUX_EFI
+	bool "vmlinux.efi"
+	depends on BR2_loongarch64
+
 config BR2_LINUX_KERNEL_VMLINUX
 	bool "vmlinux"
 
@@ -305,6 +309,10 @@ config BR2_LINUX_KERNEL_VMLINUZ_BIN
 	bool "vmlinuz.bin"
 	depends on BR2_mips || BR2_mipsel
 
+config BR2_LINUX_KERNEL_VMLINUZ_EFI
+	bool "vmlinuz.efi"
+	depends on BR2_loongarch64
+
 config BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM
 	bool "custom target"
 	help
diff --git a/linux/linux.mk b/linux/linux.mk
index 16762ac2e63a9510dccc2f626b7515694e113256..0520394931ce7950a750d4f57dab451377886612 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -262,12 +262,16 @@ else ifeq ($(BR2_LINUX_KERNEL_LINUX_BIN),y)
 LINUX_IMAGE_NAME = linux.bin
 else ifeq ($(BR2_LINUX_KERNEL_VMLINUX_BIN),y)
 LINUX_IMAGE_NAME = vmlinux.bin
+else ifeq ($(BR2_LINUX_KERNEL_VMLINUX_EFI),y)
+LINUX_IMAGE_NAME = vmlinux.efi
 else ifeq ($(BR2_LINUX_KERNEL_VMLINUX),y)
 LINUX_IMAGE_NAME = vmlinux
 else ifeq ($(BR2_LINUX_KERNEL_VMLINUZ),y)
 LINUX_IMAGE_NAME = vmlinuz
 else ifeq ($(BR2_LINUX_KERNEL_VMLINUZ_BIN),y)
 LINUX_IMAGE_NAME = vmlinuz.bin
+else ifeq ($(BR2_LINUX_KERNEL_VMLINUZ_EFI),y)
+LINUX_IMAGE_NAME = vmlinuz.efi
 endif
 # The if-else blocks above are all the image types we know of, and all
 # come from a Kconfig choice, so we know we have LINUX_IMAGE_NAME set

-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH v2 6/9] boot/grub2: Introduce loongarch64-efi target
  2025-06-07 18:12 [Buildroot] [PATCH v2 0/9] LoongArch64 initial support Jiaxun Yang
                   ` (4 preceding siblings ...)
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 5/9] linux: Introduce {vmlinux, vmlinuz}.efi kernel binary format Jiaxun Yang
@ 2025-06-07 18:12 ` Jiaxun Yang
  2025-06-14 13:14   ` Romain Naour via buildroot
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 7/9] board/loongarch64-efi: Introduce the new board Jiaxun Yang
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Jiaxun Yang @ 2025-06-07 18:12 UTC (permalink / raw)
  To: buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Dick Olsson,
	Jiaxun Yang

loongarch64-efi target presents in GRUB can be utilised
by any EFI compatible LoongArch64 machine to boot kernel.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 boot/grub2/Config.in | 10 ++++++++++
 boot/grub2/grub2.mk  |  9 +++++++++
 2 files changed, 19 insertions(+)

diff --git a/boot/grub2/Config.in b/boot/grub2/Config.in
index ecee9ef74cdca0847d4ad386a0dc281ced07725b..3a50ec0ad74897cc89793d7c49cd98eb53e74cef 100644
--- a/boot/grub2/Config.in
+++ b/boot/grub2/Config.in
@@ -5,6 +5,7 @@ config BR2_TARGET_GRUB2_ARCH_SUPPORTS
 	default y if BR2_arm
 	default y if BR2_aarch64
 	default y if BR2_RISCV_64
+	default y if BR2_loongarch64
 	depends on BR2_USE_MMU
 
 menuconfig BR2_TARGET_GRUB2
@@ -112,6 +113,15 @@ config BR2_TARGET_GRUB2_RISCV64_EFI
 	  64bit RISC-V platform and you want to boot Grub 2 as an EFI
 	  application.
 
+config BR2_TARGET_GRUB2_LOONGARCH64_EFI
+	bool "loongarch64-efi"
+	depends on BR2_loongarch64
+	select BR2_TARGET_GRUB2_HAS_EFI_BOOT
+	help
+	  Select this option if the platform you're targetting is a
+	  64bit LoongArch platform and you want to boot Grub 2 as an EFI
+	  application.
+
 if BR2_TARGET_GRUB2_HAS_LEGACY_BOOT
 
 comment "Options for the x86 legacy BIOS or ARM U-Boot support"
diff --git a/boot/grub2/grub2.mk b/boot/grub2/grub2.mk
index 22d609c004834adc09da061ab8839f4aa561a2dd..4562e57a4f2bfa6b6fb086c7ebf8ef4304615e36 100644
--- a/boot/grub2/grub2.mk
+++ b/boot/grub2/grub2.mk
@@ -102,6 +102,15 @@ GRUB2_BUILTIN_CONFIG_riscv64-efi = $(GRUB2_BUILTIN_CONFIG_EFI)
 GRUB2_BUILTIN_MODULES_riscv64-efi = $(GRUB2_BUILTIN_MODULES_EFI)
 GRUB2_TUPLES-$(BR2_TARGET_GRUB2_RISCV64_EFI) += riscv64-efi
 
+GRUB2_IMAGE_loongarch64-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/bootloongarch64.efi
+GRUB2_CFG_loongarch64-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/grub.cfg
+GRUB2_PREFIX_loongarch64-efi = /EFI/BOOT
+GRUB2_TARGET_loongarch64-efi = loongarch64
+GRUB2_PLATFORM_loongarch64-efi = efi
+GRUB2_BUILTIN_CONFIG_loongarch64-efi = $(GRUB2_BUILTIN_CONFIG_EFI)
+GRUB2_BUILTIN_MODULES_loongarch64-efi = $(GRUB2_BUILTIN_MODULES_EFI)
+GRUB2_TUPLES-$(BR2_TARGET_GRUB2_LOONGARCH64_EFI) += loongarch64-efi
+
 # Grub2 is kind of special: it considers CC, LD and so on to be the
 # tools to build the host programs and uses TARGET_CC, TARGET_CFLAGS,
 # TARGET_CPPFLAGS, TARGET_LDFLAGS to build the bootloader itself.

-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH v2 7/9] board/loongarch64-efi: Introduce the new board
  2025-06-07 18:12 [Buildroot] [PATCH v2 0/9] LoongArch64 initial support Jiaxun Yang
                   ` (5 preceding siblings ...)
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 6/9] boot/grub2: Introduce loongarch64-efi target Jiaxun Yang
@ 2025-06-07 18:12 ` Jiaxun Yang
  2025-06-14 13:43   ` Romain Naour via buildroot
  2025-06-14 20:50   ` Julien Olivain
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 8/9] boot/edk2: Add LoongArch64 OVMF support Jiaxun Yang
                   ` (2 subsequent siblings)
  9 siblings, 2 replies; 24+ messages in thread
From: Jiaxun Yang @ 2025-06-07 18:12 UTC (permalink / raw)
  To: buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Dick Olsson,
	Jiaxun Yang

Introduce bread new loongarch64-efi board, with skeleton
from aarch64-efi board.

It corverd most LoongArch64 systems.

Linux 6.12, as the most recent LTS kernel, was chosen
to ensure proper architecture support is included.

A developer entry is created for myself for future contacts
as well.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 DEVELOPERS                                         |  5 ++++
 board/loongarch64-efi/genimage-efi.cfg             | 33 +++++++++++++++++++++
 board/loongarch64-efi/grub.cfg                     |  6 ++++
 .../patches/linux-headers/linux-headers.hash       |  1 +
 board/loongarch64-efi/patches/linux/linux.hash     |  2 ++
 board/loongarch64-efi/post-image.sh                |  5 ++++
 board/loongarch64-efi/readme.txt                   | 34 ++++++++++++++++++++++
 configs/loongarch64_efi_defconfig                  | 22 ++++++++++++++
 8 files changed, 108 insertions(+)

diff --git a/DEVELOPERS b/DEVELOPERS
index a7bb3bd83460017a183f59d05f6a560d7316a6ac..600cd6c22ff6db57f9ef1da5ba9b6c15b37ca7f8 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1642,6 +1642,11 @@ F:	package/libuhttpd/
 F:	package/libuwsc/
 F:	package/rtty/
 
+N:	Jiaxun Yang <jiaxun.yang@flygoat.com>
+F:	arch/Config.in.loongarch
+F:	board/loongarch64-efi
+F:	configs/loongarch64_efi_defconfig
+
 N:	Joachim Wiberg <troglobit@gmail.com>
 F:	configs/globalscale_espressobin_defconfig
 F:	board/globalscale/espressobin/
diff --git a/board/loongarch64-efi/genimage-efi.cfg b/board/loongarch64-efi/genimage-efi.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..95fb59c97c38db772485372a60ee1fe5dad717c6
--- /dev/null
+++ b/board/loongarch64-efi/genimage-efi.cfg
@@ -0,0 +1,33 @@
+image efi-part.vfat {
+	vfat {
+		file EFI {
+			image = "efi-part/EFI"
+		}
+		file vmlinux.efi {
+			image = "vmlinux.efi"
+		}
+	}
+
+	size = 64M
+}
+
+image disk.img {
+	hdimage {
+		partition-table-type = "gpt"
+	}
+
+	partition boot {
+		image = "efi-part.vfat"
+		partition-type-uuid = U
+		offset = 32K
+		bootable = true
+	}
+
+	partition root {
+		# For partition-type-uuid value, see:
+		# https://uapi-group.org/specifications/specs/discoverable_partitions_specification/
+		# SD_GPT_ROOT_LOONGARCH64
+		partition-type-uuid = 77055800-792c-4f94-b39a-98c91b762bb6
+		image = "rootfs.ext2"
+	}
+}
diff --git a/board/loongarch64-efi/grub.cfg b/board/loongarch64-efi/grub.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..2006f6d60d9b4bde1f8a12c87d76476f9401c6ca
--- /dev/null
+++ b/board/loongarch64-efi/grub.cfg
@@ -0,0 +1,6 @@
+/set default="0"
+set timeout="5"
+
+menuentry "Buildroot" {
+	linux /vmlinux.efi root=PARTLABEL=root rootwait console=ttyS0,115200
+}
diff --git a/board/loongarch64-efi/patches/linux-headers/linux-headers.hash b/board/loongarch64-efi/patches/linux-headers/linux-headers.hash
new file mode 120000
index 0000000000000000000000000000000000000000..5808d92afe89015ae416e941adf041644162d996
--- /dev/null
+++ b/board/loongarch64-efi/patches/linux-headers/linux-headers.hash
@@ -0,0 +1 @@
+../linux/linux.hash
\ No newline at end of file
diff --git a/board/loongarch64-efi/patches/linux/linux.hash b/board/loongarch64-efi/patches/linux/linux.hash
new file mode 100644
index 0000000000000000000000000000000000000000..381f3427a60dda4476631271787ff752bca52204
--- /dev/null
+++ b/board/loongarch64-efi/patches/linux/linux.hash
@@ -0,0 +1,2 @@
+# From https://www.kernel.org/pub/linux/kernel/v6.x/sha256sums.asc
+sha256  a9b020721778384507010177d3929e7d4058f7f6120f05a99d56b5c5c0346a70  linux-6.12.32.tar.xz
diff --git a/board/loongarch64-efi/post-image.sh b/board/loongarch64-efi/post-image.sh
new file mode 100755
index 0000000000000000000000000000000000000000..fdb17ece7003611d0cd6de84ed4dbd14767e5b68
--- /dev/null
+++ b/board/loongarch64-efi/post-image.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname "$0")"
+
+cp -f "${BOARD_DIR}/grub.cfg" "${BINARIES_DIR}/efi-part/EFI/BOOT/grub.cfg"
diff --git a/board/loongarch64-efi/readme.txt b/board/loongarch64-efi/readme.txt
new file mode 100644
index 0000000000000000000000000000000000000000..4c4e06874c1fce1bd8e44cd989b7e971304aa4f0
--- /dev/null
+++ b/board/loongarch64-efi/readme.txt
@@ -0,0 +1,34 @@
+The loongarch64_efi_defconfig allows to build a minimal Linux system that
+can boot on all loongarch64 systems providing an EFI firmware.
+
+This includes almost all Loongson-3 series workstations and servers.
+
+Building and booting
+====================
+
+$ make loongarch64_efi_defconfig
+$ make
+
+The file output/images/disk.img is a complete disk image that can be
+booted, it includes the grub2 bootloader, Linux kernel and root
+filesystem.
+
+Testing under Qemu
+==================
+
+This image can also be tested using Qemu:
+
+qemu-system-loongarch64 \
+	-M virt \
+	-cpu la464 \
+	-nographic \
+	-bios </path/to/QEMU_EFI.fd> \
+	-drive file=output/images/disk.img,if=none,format=raw,id=hd0 \
+	-device virtio-blk-pci,drive=hd0 \
+	-netdev user,id=eth0 \
+	-device virtio-net-pci,netdev=eth0
+
+Note that </path/to/QEMU_EFI.fd> needs to point to a valid loongarch64 UEFI
+firmware image for qemu.
+It may be provided by your distribution as a edk2-loongarch64 package,
+in path such as /usr/share/edk2/loongarch64/QEMU_EFI.fd .
diff --git a/configs/loongarch64_efi_defconfig b/configs/loongarch64_efi_defconfig
new file mode 100644
index 0000000000000000000000000000000000000000..c98699330d3cd9907043573465a9c8b189d47384
--- /dev/null
+++ b/configs/loongarch64_efi_defconfig
@@ -0,0 +1,22 @@
+BR2_loongarch64=y
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y
+BR2_GLOBAL_PATCH_DIR="board/loongarch64-efi/patches"
+BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/loongarch64-efi/post-image.sh support/scripts/genimage.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/loongarch64-efi/genimage-efi.cfg"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.32"
+BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
+BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_TARGET_ROOTFS_EXT2_SIZE="200M"
+# BR2_TARGET_ROOTFS_TAR is not set
+BR2_TARGET_GRUB2=y
+BR2_TARGET_GRUB2_LOONGARCH64_EFI=y
+BR2_PACKAGE_HOST_DOSFSTOOLS=y
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_PACKAGE_HOST_MTOOLS=y

-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH v2 8/9] boot/edk2: Add LoongArch64 OVMF support
  2025-06-07 18:12 [Buildroot] [PATCH v2 0/9] LoongArch64 initial support Jiaxun Yang
                   ` (6 preceding siblings ...)
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 7/9] board/loongarch64-efi: Introduce the new board Jiaxun Yang
@ 2025-06-07 18:12 ` Jiaxun Yang
  2025-06-14 13:50   ` Romain Naour via buildroot
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 9/9] board/qemu: Add loongarch64-virt-efi variant Jiaxun Yang
  2025-06-14 14:24 ` [Buildroot] [PATCH v2 0/9] LoongArch64 initial support Romain Naour via buildroot
  9 siblings, 1 reply; 24+ messages in thread
From: Jiaxun Yang @ 2025-06-07 18:12 UTC (permalink / raw)
  To: buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Dick Olsson,
	Jiaxun Yang

LoongArch64 OVMF target is introduced to EDK2 in edk2-202408.

Enable architecture support here.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 boot/edk2/Config.in | 14 +++++++++++++-
 boot/edk2/edk2.mk   |  6 ++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/boot/edk2/Config.in b/boot/edk2/Config.in
index 4e6e7d122cb550cbf57ce8fde31779e2d2cbc9a9..734826a8be722c1c45ab157b43fee60ebb4a30a0 100644
--- a/boot/edk2/Config.in
+++ b/boot/edk2/Config.in
@@ -2,6 +2,7 @@ config BR2_TARGET_EDK2_ARCH_SUPPORTS
 	bool
 	default y if BR2_aarch64
 	default y if BR2_i386
+	default y if BR2_loongarch64
 	default y if BR2_RISCV_64
 	default y if BR2_x86_64
 
@@ -21,6 +22,8 @@ if BR2_TARGET_EDK2
 choice
 	prompt "Platform"
 	default BR2_TARGET_EDK2_PLATFORM_OVMF_I386 if BR2_i386
+	default BR2_TARGET_EDK2_PLATFORM_OVMF_LOONGARCH64 if \
+		BR2_loongarch64
 	default BR2_TARGET_EDK2_PLATFORM_OVMF_RISCV if BR2_RISCV_64
 	default BR2_TARGET_EDK2_PLATFORM_OVMF_X64 if BR2_x86_64
 	default BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU if BR2_aarch64
@@ -31,7 +34,15 @@ config BR2_TARGET_EDK2_PLATFORM_OVMF_I386
 	help
 	  Platform configuration for a generic i386 target.
 	  This platform will boot from flash address 0x0.
-	  It should therefore be used as the first bootloader.
+
+config BR2_TARGET_EDK2_PLATFORM_OVMF_LOONGARCH64
+	bool "LoongArch64"
+	depends on BR2_loongarch64
+	help
+	  Platform configuration for LoongArch QEMU targeting the
+	  Virt machine. This platform will only boot from flash
+	  address 0x1c000000. It should therefore be used as the first
+	  bootloader.
 
 config BR2_TARGET_EDK2_PLATFORM_OVMF_RISCV
 	bool "RISC-V"
@@ -139,6 +150,7 @@ config BR2_TARGET_EDK2_FD_NAME
 	default "OVMF" if BR2_TARGET_EDK2_PLATFORM_OVMF_X64
 	default "QEMU_EFI" if BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU
 	default "QEMU_EFI" if BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU_KERNEL
+	default "QEMU_EFI" if BR2_TARGET_EDK2_PLATFORM_OVMF_LOONGARCH64
 	default "BL33_AP_UEFI" if BR2_TARGET_EDK2_PLATFORM_ARM_SGI575
 	default "FVP_AARCH64_EFI" if BR2_TARGET_EDK2_PLATFORM_ARM_VEXPRESS_FVP_AARCH64
 	default "FVP_AARCH64_EFI" if BR2_TARGET_EDK2_PLATFORM_SOCIONEXT_DEVELOPERBOX
diff --git a/boot/edk2/edk2.mk b/boot/edk2/edk2.mk
index bc4049b2def3e75a1e95ba85696de77d58335a3e..4540a9bdea88e682dedd02ab43937127e3e464e7 100644
--- a/boot/edk2/edk2.mk
+++ b/boot/edk2/edk2.mk
@@ -142,6 +142,12 @@ EDK2_PACKAGE_NAME = OvmfPkg/RiscVVirt
 EDK2_PLATFORM_NAME = RiscVVirtQemu
 EDK2_BUILD_DIR = $(EDK2_PLATFORM_NAME)
 
+else ifeq ($(BR2_TARGET_EDK2_PLATFORM_OVMF_LOONGARCH64),y)
+EDK2_ARCH = LOONGARCH64
+EDK2_PACKAGE_NAME = OvmfPkg/LoongArchVirt
+EDK2_PLATFORM_NAME = LoongArchVirtQemu
+EDK2_BUILD_DIR = $(EDK2_PLATFORM_NAME)
+
 endif
 
 EDK2_BASETOOLS_OPTS = \

-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH v2 9/9] board/qemu: Add loongarch64-virt-efi variant
  2025-06-07 18:12 [Buildroot] [PATCH v2 0/9] LoongArch64 initial support Jiaxun Yang
                   ` (7 preceding siblings ...)
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 8/9] boot/edk2: Add LoongArch64 OVMF support Jiaxun Yang
@ 2025-06-07 18:12 ` Jiaxun Yang
  2025-06-14 13:32   ` Julien Olivain
  2025-06-14 14:24 ` [Buildroot] [PATCH v2 0/9] LoongArch64 initial support Romain Naour via buildroot
  9 siblings, 1 reply; 24+ messages in thread
From: Jiaxun Yang @ 2025-06-07 18:12 UTC (permalink / raw)
  To: buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Dick Olsson,
	Jiaxun Yang

Add qemu_loongarch64_virt_efi_defconfig, which builds EDK2
and host QEMU to test LoongArch64 buildroot.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 DEVELOPERS                                    |  2 ++
 board/qemu/loongarch64-virt-efi/genimage.cfg  | 33 +++++++++++++++++++++++++++
 board/qemu/loongarch64-virt-efi/grub.cfg      |  6 +++++
 board/qemu/loongarch64-virt-efi/post-image.sh |  5 ++++
 board/qemu/loongarch64-virt-efi/readme.txt    | 31 +++++++++++++++++++++++++
 configs/qemu_loongarch64_virt_efi_defconfig   | 23 +++++++++++++++++++
 6 files changed, 100 insertions(+)

diff --git a/DEVELOPERS b/DEVELOPERS
index 600cd6c22ff6db57f9ef1da5ba9b6c15b37ca7f8..cac88b6be1dd0daccbba7f26f2e5961274cd3871 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1645,7 +1645,9 @@ F:	package/rtty/
 N:	Jiaxun Yang <jiaxun.yang@flygoat.com>
 F:	arch/Config.in.loongarch
 F:	board/loongarch64-efi
+F:	qemu/loongarch64-virt-efi
 F:	configs/loongarch64_efi_defconfig
+F:	configs/qemu_loongarch64_virt_efi_defconfig
 
 N:	Joachim Wiberg <troglobit@gmail.com>
 F:	configs/globalscale_espressobin_defconfig
diff --git a/board/qemu/loongarch64-virt-efi/genimage.cfg b/board/qemu/loongarch64-virt-efi/genimage.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..95fb59c97c38db772485372a60ee1fe5dad717c6
--- /dev/null
+++ b/board/qemu/loongarch64-virt-efi/genimage.cfg
@@ -0,0 +1,33 @@
+image efi-part.vfat {
+	vfat {
+		file EFI {
+			image = "efi-part/EFI"
+		}
+		file vmlinux.efi {
+			image = "vmlinux.efi"
+		}
+	}
+
+	size = 64M
+}
+
+image disk.img {
+	hdimage {
+		partition-table-type = "gpt"
+	}
+
+	partition boot {
+		image = "efi-part.vfat"
+		partition-type-uuid = U
+		offset = 32K
+		bootable = true
+	}
+
+	partition root {
+		# For partition-type-uuid value, see:
+		# https://uapi-group.org/specifications/specs/discoverable_partitions_specification/
+		# SD_GPT_ROOT_LOONGARCH64
+		partition-type-uuid = 77055800-792c-4f94-b39a-98c91b762bb6
+		image = "rootfs.ext2"
+	}
+}
diff --git a/board/qemu/loongarch64-virt-efi/grub.cfg b/board/qemu/loongarch64-virt-efi/grub.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..dc3452fe6a3dba9279c6bd8e0d48542e37555338
--- /dev/null
+++ b/board/qemu/loongarch64-virt-efi/grub.cfg
@@ -0,0 +1,6 @@
+set default="0"
+set timeout="5"
+
+menuentry "Buildroot" {
+	linux /vmlinux.efi root=PARTLABEL=root rootwait console=ttyS0
+}
diff --git a/board/qemu/loongarch64-virt-efi/post-image.sh b/board/qemu/loongarch64-virt-efi/post-image.sh
new file mode 100755
index 0000000000000000000000000000000000000000..fdb17ece7003611d0cd6de84ed4dbd14767e5b68
--- /dev/null
+++ b/board/qemu/loongarch64-virt-efi/post-image.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname "$0")"
+
+cp -f "${BOARD_DIR}/grub.cfg" "${BINARIES_DIR}/efi-part/EFI/BOOT/grub.cfg"
diff --git a/board/qemu/loongarch64-virt-efi/readme.txt b/board/qemu/loongarch64-virt-efi/readme.txt
new file mode 100644
index 0000000000000000000000000000000000000000..7c35ee1efe56e9b0e7584c544407a0c944373f10
--- /dev/null
+++ b/board/qemu/loongarch64-virt-efi/readme.txt
@@ -0,0 +1,31 @@
+Intro
+=====
+
+This is a LoongArch 64bit UEFI Linux boot demo in QEMU virt machine.
+
+Build
+=====
+
+    make qemu_loongarch64_virt-efi_defconfig
+    make
+
+Emulation
+=========
+
+Run the emulation with:
+
+    qemu-system-loongarch64 \
+        -M virt \
+        -smp 2 \
+        -m 1024 \
+        -nographic \
+        -bios output/images/QEMU_EFI.fd \
+        -drive file=output/images/disk.img,format=raw \
+        -netdev user,id=net0 \
+        -device virtio-net-pci,netdev=net0 # qemu_loongarch64_virt_efi_defconfig
+
+Note: for information, qemu version >= 9.0.0 is needed for this UEFI
+Linux demo. The host-qemu package in Buildroot (enabled in this
+defconfig) is sufficient to run this demo. In case another qemu is
+used (for example, from the host OS), make sure to check the version
+requirement.
diff --git a/configs/qemu_loongarch64_virt_efi_defconfig b/configs/qemu_loongarch64_virt_efi_defconfig
new file mode 100644
index 0000000000000000000000000000000000000000..cc65158c0282b17e4a995bd1d79a403e8112314a
--- /dev/null
+++ b/configs/qemu_loongarch64_virt_efi_defconfig
@@ -0,0 +1,23 @@
+BR2_loongarch64=y
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y
+BR2_GLOBAL_PATCH_DIR="board/qemu/patches"
+BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
+BR2_SYSTEM_DHCP="eth0"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/loongarch64-virt-efi/post-image.sh board/qemu/post-image.sh support/scripts/genimage.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG) -c board/qemu/loongarch64-virt-efi/genimage.cfg"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.27"
+BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
+BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_SIZE="200M"
+# BR2_TARGET_ROOTFS_TAR is not set
+BR2_TARGET_EDK2=y
+BR2_TARGET_GRUB2=y
+BR2_TARGET_GRUB2_LOONGARCH64_EFI=y
+BR2_PACKAGE_HOST_DOSFSTOOLS=y
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_PACKAGE_HOST_MTOOLS=y

-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [Buildroot] [PATCH v2 1/9] package/gcc: Introduce BR2_GCC_TARGET_SIMD option
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 1/9] package/gcc: Introduce BR2_GCC_TARGET_SIMD option Jiaxun Yang
@ 2025-06-14 12:47   ` Romain Naour via buildroot
  0 siblings, 0 replies; 24+ messages in thread
From: Romain Naour via buildroot @ 2025-06-14 12:47 UTC (permalink / raw)
  To: Jiaxun Yang, buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Dick Olsson

Hello Jiaxun, All,

Le 07/06/2025 à 20:12, Jiaxun Yang a écrit :
> Introduce BR2_GCC_TARGET_SIMD for gcc to handle --with-simd/-msimd
> present at loongarch's gcc options.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>

Reviewed-by: Romain Naour <romain.naour@smile.fr>

Best regards,
Romain


> ---
> v2: Add missing toolchain wrapper code
> ---
>  arch/Config.in                                         | 6 ++++++
>  arch/arch.mk                                           | 1 +
>  package/gcc/gcc.mk                                     | 4 ++++
>  toolchain/toolchain-external/pkg-toolchain-external.mk | 4 ++++
>  toolchain/toolchain-wrapper.c                          | 3 +++
>  5 files changed, 18 insertions(+)
> 
> diff --git a/arch/Config.in b/arch/Config.in
> index 6b54c65df9cc7430e9d99e0dd9e29fef3cc527e4..ec720e74e193021ed01749945aed1457ec0789a1 100644
> --- a/arch/Config.in
> +++ b/arch/Config.in
> @@ -349,6 +349,12 @@ config BR2_GCC_TARGET_FPU
>  config BR2_GCC_TARGET_FLOAT_ABI
>  	string
>  
> +# The value of this option will be passed as --with-simd=<value> when
> +# building gcc (internal backend) or -simd=<value> in the toolchain
> +# wrapper (external toolchain)
> +config BR2_GCC_TARGET_SIMD
> +	string
> +
>  # The value of this option will be passed as --with-mode=<value> when
>  # building gcc (internal backend) or -m<value> in the toolchain
>  # wrapper (external toolchain)
> diff --git a/arch/arch.mk b/arch/arch.mk
> index 4174d33df548b0f7bc754c89076142c41fe3f867..4a7851a9fdcebc4720415f5b0fba771bb4993ef6 100644
> --- a/arch/arch.mk
> +++ b/arch/arch.mk
> @@ -16,6 +16,7 @@ GCC_TARGET_FP32_MODE := $(call qstrip,$(BR2_GCC_TARGET_FP32_MODE))
>  GCC_TARGET_CPU := $(call qstrip,$(BR2_GCC_TARGET_CPU))
>  GCC_TARGET_FPU := $(call qstrip,$(BR2_GCC_TARGET_FPU))
>  GCC_TARGET_FLOAT_ABI := $(call qstrip,$(BR2_GCC_TARGET_FLOAT_ABI))
> +GCC_TARGET_SIMD := $(call qstrip,$(BR2_GCC_TARGET_SIMD))
>  GCC_TARGET_MODE := $(call qstrip,$(BR2_GCC_TARGET_MODE))
>  
>  # Explicitly set LD's "max-page-size" instead of relying on some defaults
> diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
> index 658f5a6b4fe21fb302333fcff3012e624ce241a7..ea96286c322f6aac0ad26ad633db6b73c544dac0 100644
> --- a/package/gcc/gcc.mk
> +++ b/package/gcc/gcc.mk
> @@ -251,6 +251,10 @@ ifneq ($(GCC_TARGET_FLOAT_ABI),)
>  HOST_GCC_COMMON_CONF_OPTS += --with-float=$(GCC_TARGET_FLOAT_ABI)
>  endif
>  
> +ifneq ($(GCC_TARGET_SIMD),)
> +HOST_GCC_COMMON_CONF_OPTS += --with-simd=$(GCC_TARGET_SIMD)
> +endif
> +
>  ifneq ($(GCC_TARGET_MODE),)
>  HOST_GCC_COMMON_CONF_OPTS += --with-mode=$(GCC_TARGET_MODE)
>  endif
> diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
> index c08bf0a65391833de840c2f5ca112bb0b7802471..2c2afa76c06920389f10595ddbecb9e0455cecce 100644
> --- a/toolchain/toolchain-external/pkg-toolchain-external.mk
> +++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
> @@ -217,6 +217,10 @@ ifneq ($(GCC_TARGET_FLOAT_ABI),)
>  TOOLCHAIN_EXTERNAL_CFLAGS += -mfloat-abi=$(GCC_TARGET_FLOAT_ABI)
>  TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_FLOAT_ABI='"$(GCC_TARGET_FLOAT_ABI)"'
>  endif
> +ifneq ($(GCC_TARGET_SIMD),)
> +TOOLCHAIN_EXTERNAL_CFLAGS += -msimd=$(GCC_TARGET_SIMD)
> +TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_SIMD='"$(GCC_TARGET_SIMD)"'
> +endif
>  ifneq ($(GCC_TARGET_MODE),)
>  TOOLCHAIN_EXTERNAL_CFLAGS += -m$(GCC_TARGET_MODE)
>  TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_MODE='"$(GCC_TARGET_MODE)"'
> diff --git a/toolchain/toolchain-wrapper.c b/toolchain/toolchain-wrapper.c
> index e644c1e7bb906caa24ea673a865c934f9094a030..a6974ba78f8a53535c6cd6517e1af1bb5ec12431 100644
> --- a/toolchain/toolchain-wrapper.c
> +++ b/toolchain/toolchain-wrapper.c
> @@ -74,6 +74,9 @@ static char *predef_args[] = {
>  #ifdef BR_SOFTFLOAT
>  	"-msoft-float",
>  #endif /* BR_SOFTFLOAT */
> +#ifdef BR_SIMD
> +	"-msimd=" BR_SIMD,
> +#endif
>  #ifdef BR_MODE
>  	"-m" BR_MODE,
>  #endif
> 

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Buildroot] [PATCH v2 2/9] arch: Introduce LoongArch64
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 2/9] arch: Introduce LoongArch64 Jiaxun Yang
@ 2025-06-14 12:54   ` Romain Naour via buildroot
  2025-06-14 13:17     ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 24+ messages in thread
From: Romain Naour via buildroot @ 2025-06-14 12:54 UTC (permalink / raw)
  To: Jiaxun Yang, buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Dick Olsson

Hello Jiaxun, All,

Le 07/06/2025 à 20:12, Jiaxun Yang a écrit :
> Introduce LoongArch64 at architecture level.
> 
> Config.in.loongarch is prepared for possible loongarch32
> enablement in future.
> 
> Internal toolchain is supported, as our minimal binutils
> version is already beyond LoongArch minimal version and
> GCC option is limited by BR2_ARCH_NEEDS_GCC_AT_LEAST_12.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> v2:
> 	- Style fixes
> 	- add commit message about internal toolchain
> ---
>  arch/Config.in           |  13 +++++
>  arch/Config.in.loongarch | 129 +++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 142 insertions(+)
> 
> diff --git a/arch/Config.in b/arch/Config.in
> index ec720e74e193021ed01749945aed1457ec0789a1..cc8b774a448913a7195f0dc12a1b452b6af80fd1 100644
> --- a/arch/Config.in
> +++ b/arch/Config.in
> @@ -80,6 +80,15 @@ config BR2_i386
>  	  Intel i386 architecture compatible microprocessor
>  	  http://en.wikipedia.org/wiki/I386
>  
> +config BR2_loongarch64
> +	bool "LoongArch64"
> +	select BR2_USE_MMU
> +	select BR2_ARCH_IS_64

For now and without any libc available, loongarch64 option needs to select
BR2_ARCH_HAS_NO_TOOLCHAIN_BUILDROOT since we can't yet build a complete
toolchain with only this patch applied.

In addition, you should add the minimal gcc version supported by loongarch64
generic (BR2_ARCH_NEEDS_GCC_AT_LEAST_12) otherwise you could enable loongarch64
without any target architecture variant.

> +	help
> +	  LoongArch64 is 64-bit architecture developed by Loongson.
> +	  http://www.loongson.cn/
> +	  https://en.wikipedia.org/wiki/Loongson
> +
>  config BR2_m68k
>  	bool "m68k"
>  	# MMU support is set by the subarchitecture file, arch/Config.in.m68k
> @@ -379,6 +388,10 @@ if BR2_arm || BR2_armeb || BR2_aarch64 || BR2_aarch64_be
>  source "arch/Config.in.arm"
>  endif
>  
> +if BR2_loongarch64
> +source "arch/Config.in.loongarch"
> +endif
> +
>  if BR2_m68k
>  source "arch/Config.in.m68k"
>  endif
> diff --git a/arch/Config.in.loongarch b/arch/Config.in.loongarch
> new file mode 100644
> index 0000000000000000000000000000000000000000..e53432ab50a150818a0a4b8cceabeeeea505be69
> --- /dev/null
> +++ b/arch/Config.in.loongarch
> @@ -0,0 +1,129 @@
> +# LoongArch CPU
> +
> +choice
> +	prompt "Target Architecture Variant"
> +	default BR2_loongarch64_generic
> +
> +config BR2_loongarch64_generic
> +	bool "Generic LoongArch 64-bit"
> +	depends on BR2_ARCH_IS_64
> +	select BR2_ARCH_NEEDS_GCC_AT_LEAST_12

This can be moved under BR2_loongarch64.

Best regards,
Romain


> +	help
> +	  Generic LoongArch 64-bit processor.
> +
> +config BR2_loongarch64_v1_0
> +	bool "LoongArch64 ISA version 1.0"
> +	depends on BR2_ARCH_IS_64
> +	select BR2_ARCH_NEEDS_GCC_AT_LEAST_13
> +	help
> +	  LoongArch64 ISA version 1.0 processor.
> +
> +config BR2_loongarch64_v1_1
> +	bool "LoongArch64 ISA version 1.1"
> +	depends on BR2_ARCH_IS_64
> +	select BR2_ARCH_NEEDS_GCC_AT_LEAST_13
> +	help
> +	  LoongArch64 ISA version 1.1 processor.
> +
> +endchoice
> +
> +choice
> +	prompt "FPU Type"
> +	default BR2_LOONGARCH_FPU_64
> +
> +config BR2_LOONGARCH_FPU_64
> +	bool "64"
> +	help
> +	  Allow the use of hardware floating-point instructions for
> +	  32-bit and 64-bit operations.
> +
> +config BR2_LOONGARCH_FPU_32
> +	bool "32"
> +	help
> +	  Allow the use of hardware floating-point instructions for
> +	  32-bit operations only.
> +
> +config BR2_LOONGARCH_FPU_NONE
> +	bool "none"
> +	help
> +	  Prevent the use of hardware floating-point instructions.
> +endchoice
> +
> +choice
> +	prompt "SIMD Type"
> +	default BR2_LOONGARCH_SIMD_NONE
> +
> +config BR2_LOONGARCH_SIMD_NONE
> +	bool "none"
> +	help
> +	  Prevent the use of hardware SIMD instructions.
> +
> +config BR2_LOONGARCH_SIMD_LSX
> +	bool "LSX"
> +	help
> +	  Enable generating instructions from the 128-bit LoongArch SIMD
> +	  Extension (LSX).
> +
> +config BR2_LOONGARCH_SIMD_LASX
> +	bool "LASX"
> +	help
> +	  Enable generating instructions from the 256-bit LoongArch
> +	  Advanced SIMD Extension (LASX) and the 128-bit LoongArch
> +	  SIMD Extension (LSX).
> +endchoice
> +
> +choice
> +	prompt "Target ABI"
> +	default BR2_LOONGARCH_ABI_LP64D if BR2_ARCH_IS_64 && BR2_LOONGARCH_FPU_64
> +	default BR2_LOONGARCH_ABI_LP64F if BR2_ARCH_IS_64 && BR2_LOONGARCH_FPU_32
> +	default BR2_LOONGARCH_ABI_LP64S if BR2_ARCH_IS_64 && BR2_LOONGARCH_SIMD_NONE
> +
> +config BR2_LOONGARCH_ABI_LP64D
> +	bool "lp64d"
> +	depends on BR2_ARCH_IS_64
> +	depends on BR2_LOONGARCH_FPU_64
> +
> +config BR2_LOONGARCH_ABI_LP64F
> +	bool "lp64f"
> +	depends on BR2_ARCH_IS_64
> +	depends on BR2_LOONGARCH_FPU_64 || BR2_LOONGARCH_FPU_32
> +
> +config BR2_LOONGARCH_ABI_LP64S
> +	bool "lp64d"
> +	depends on BR2_ARCH_IS_64
> +endchoice
> +
> +config BR2_ARCH
> +	default "loongarch64" if BR2_ARCH_IS_64
> +
> +config BR2_NORMALIZED_ARCH
> +	default "loongarch"
> +
> +config BR2_ENDIAN
> +	default "LITTLE"
> +
> +config BR2_GCC_TARGET_ARCH
> +	default "loongarch64" if BR2_loongarch64_generic
> +	default "la64v1.0" if BR2_loongarch64_v1_0
> +	default "la64v1.1" if BR2_loongarch64_v1_1
> +
> +config BR2_GCC_TARGET_FPU
> +	default "64" if BR2_LOONGARCH_FPU_64
> +	default "32" if BR2_LOONGARCH_FPU_32
> +	default "none" if BR2_LOONGARCH_FPU_NONE
> +
> +config BR2_GCC_TARGET_SIMD
> +	default "lasx" if BR2_LOONGARCH_SIMD_LASX
> +	default "lsx" if BR2_LOONGARCH_SIMD_LSX
> +	default "none" if BR2_LOONGARCH_FPU_NONE
> +
> +config BR2_GCC_TARGET_ABI
> +	default "lp64d" if BR2_LOONGARCH_ABI_LP64D
> +	default "lp64f" if BR2_LOONGARCH_ABI_LP64F
> +	default "lp64s" if BR2_LOONGARCH_ABI_LP64S
> +
> +config BR2_READELF_ARCH_NAME
> +	default "LoongArch"
> +
> +# vim: ft=kconfig
> +# -*- mode:kconfig; -*-
> 

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Buildroot] [PATCH v2 3/9] package/glibc: Enable LoongArch64 support
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 3/9] package/glibc: Enable LoongArch64 support Jiaxun Yang
@ 2025-06-14 12:57   ` Romain Naour via buildroot
  0 siblings, 0 replies; 24+ messages in thread
From: Romain Naour via buildroot @ 2025-06-14 12:57 UTC (permalink / raw)
  To: Jiaxun Yang, buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Dick Olsson

Hello Jiaxun, All,

Le 07/06/2025 à 20:12, Jiaxun Yang a écrit :
> Glibc introduced LoongArch64 support in 2.36, it requires kernel
> 5.19 to build.

With this patch applied, you can remove BR2_ARCH_HAS_NO_TOOLCHAIN_BUILDROOT
introduced in the previous patch.

Otherwise:
  Reviewed-by: Romain Naour <romain.naour@smile.fr>

Best regards,
Romain

> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>  package/glibc/Config.in                 | 2 ++
>  toolchain/toolchain-buildroot/Config.in | 4 ++++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/package/glibc/Config.in b/package/glibc/Config.in
> index 52752e975e494aabe67b27b601defc504dbba94a..9a4fe6f3db0a1ca4f1ad37f7e1ea709664e254d5 100644
> --- a/package/glibc/Config.in
> +++ b/package/glibc/Config.in
> @@ -5,6 +5,7 @@ config BR2_PACKAGE_GLIBC_ARCH_SUPPORTS
>  	default y if BR2_aarch64
>  	default y if BR2_aarch64_be
>  	default y if BR2_i386
> +	default y if BR2_loongarch64
>  	default y if BR2_m68k_m68k
>  	default y if BR2_mips
>  	default y if BR2_mipsel
> @@ -35,6 +36,7 @@ config BR2_PACKAGE_GLIBC_SUPPORTS
>  	# toolchain/toolchain-buildroot/Config.in
>  	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_2
>  	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_10 || !BR2_powerpc64le
> +	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_19 || !BR2_loongarch64
>  	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_5 || !BR2_MIPS_NAN_2008
>  	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_4 || !BR2_RISCV_32
>  	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_0 || !BR2_RISCV_64
> diff --git a/toolchain/toolchain-buildroot/Config.in b/toolchain/toolchain-buildroot/Config.in
> index 0173f40d9768bc279dab7c6a50fe64d7501aa192..0bccdc817cc9f7e15d2285285e8c93cd432288f6 100644
> --- a/toolchain/toolchain-buildroot/Config.in
> +++ b/toolchain/toolchain-buildroot/Config.in
> @@ -48,6 +48,10 @@ comment "glibc needs a toolchain w/ kernel headers >= 3.2"
>  	depends on BR2_PACKAGE_GLIBC_ARCH_SUPPORTS
>  	depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_2
>  
> +comment "glibc on LoongArch64 needs a toolchain w/ headers >= 5.19"
> +	depends on BR2_loongarch64
> +	depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_19
> +
>  # glibc >= 2.26 require kernel headers >= 3.10 on powerpc64le.
>  comment "glibc on powerpc64le needs a toolchain w/ headers >= 3.10"
>  	depends on BR2_powerpc64le
> 

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Buildroot] [PATCH v2 4/9] package/musl: Enable LoongArch64 support
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 4/9] package/musl: " Jiaxun Yang
@ 2025-06-14 12:58   ` Romain Naour via buildroot
  0 siblings, 0 replies; 24+ messages in thread
From: Romain Naour via buildroot @ 2025-06-14 12:58 UTC (permalink / raw)
  To: Jiaxun Yang, buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Dick Olsson

Hello Jiaxun, All,

Le 07/06/2025 à 20:12, Jiaxun Yang a écrit :
> musl introduced LoongArch64 support in 1.2.5.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>

Reviewed-by: Romain Naour <romain.naour@smile.fr>

Best regards,
Romain


> ---
>  package/musl/Config.in | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/package/musl/Config.in b/package/musl/Config.in
> index a6e2af054c354fb1078ff918f1058da3367a46a0..70475326f5b29f4b903e91e2be9d52f3b547907d 100644
> --- a/package/musl/Config.in
> +++ b/package/musl/Config.in
> @@ -5,6 +5,7 @@ config BR2_PACKAGE_MUSL_ARCH_SUPPORTS
>  	default y if BR2_arm
>  	default y if BR2_armeb
>  	default y if BR2_i386
> +	default y if BR2_loongarch64
>  	default y if BR2_m68k_m68k
>  	default y if BR2_microblaze
>  	default y if BR2_mips
> 

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Buildroot] [PATCH v2 5/9] linux: Introduce {vmlinux, vmlinuz}.efi kernel binary format
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 5/9] linux: Introduce {vmlinux, vmlinuz}.efi kernel binary format Jiaxun Yang
@ 2025-06-14 13:11   ` Romain Naour via buildroot
  0 siblings, 0 replies; 24+ messages in thread
From: Romain Naour via buildroot @ 2025-06-14 13:11 UTC (permalink / raw)
  To: Jiaxun Yang, buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Dick Olsson

Hello Jiaxun, All,

Le 07/06/2025 à 20:12, Jiaxun Yang a écrit :
> vmlinux.efi and vmlinuz.efi are standard file names for LoongArch
> EFISTUB kernel.
> 
> Introduce them to build system.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>  linux/Config.in | 8 ++++++++
>  linux/linux.mk  | 4 ++++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/linux/Config.in b/linux/Config.in
> index ddd65154464f9949161c04c07a25d5035407e4f1..970cc3b63f1cc95a2f56c6abc30f6ff7571af41b 100644
> --- a/linux/Config.in
> +++ b/linux/Config.in
> @@ -294,6 +294,10 @@ config BR2_LINUX_KERNEL_VMLINUX_BIN
>  	bool "vmlinux.bin"
>  	depends on BR2_mips || BR2_mipsel || BR2_sh
>  
> +config BR2_LINUX_KERNEL_VMLINUX_EFI
> +	bool "vmlinux.efi"
> +	depends on BR2_loongarch64

Note: vmlinux.efi is not specific to loongarch, it's also supported by aarch64
and riscv since kernel 6.1:

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=c37b830fef1396f9f2ad79a65700e152ec362543

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=f55793403c53ffaaaca43948498ed2b8896d9615

Your patch is fine as is, other architectures can be added later by followup
patches.

Reviewed-by: Romain Naour <romain.naour@smile.fr>

Best regards,
Romain


> +
>  config BR2_LINUX_KERNEL_VMLINUX
>  	bool "vmlinux"
>  
> @@ -305,6 +309,10 @@ config BR2_LINUX_KERNEL_VMLINUZ_BIN
>  	bool "vmlinuz.bin"
>  	depends on BR2_mips || BR2_mipsel
>  
> +config BR2_LINUX_KERNEL_VMLINUZ_EFI
> +	bool "vmlinuz.efi"
> +	depends on BR2_loongarch64
> +
>  config BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM
>  	bool "custom target"
>  	help
> diff --git a/linux/linux.mk b/linux/linux.mk
> index 16762ac2e63a9510dccc2f626b7515694e113256..0520394931ce7950a750d4f57dab451377886612 100644
> --- a/linux/linux.mk
> +++ b/linux/linux.mk
> @@ -262,12 +262,16 @@ else ifeq ($(BR2_LINUX_KERNEL_LINUX_BIN),y)
>  LINUX_IMAGE_NAME = linux.bin
>  else ifeq ($(BR2_LINUX_KERNEL_VMLINUX_BIN),y)
>  LINUX_IMAGE_NAME = vmlinux.bin
> +else ifeq ($(BR2_LINUX_KERNEL_VMLINUX_EFI),y)
> +LINUX_IMAGE_NAME = vmlinux.efi
>  else ifeq ($(BR2_LINUX_KERNEL_VMLINUX),y)
>  LINUX_IMAGE_NAME = vmlinux
>  else ifeq ($(BR2_LINUX_KERNEL_VMLINUZ),y)
>  LINUX_IMAGE_NAME = vmlinuz
>  else ifeq ($(BR2_LINUX_KERNEL_VMLINUZ_BIN),y)
>  LINUX_IMAGE_NAME = vmlinuz.bin
> +else ifeq ($(BR2_LINUX_KERNEL_VMLINUZ_EFI),y)
> +LINUX_IMAGE_NAME = vmlinuz.efi
>  endif
>  # The if-else blocks above are all the image types we know of, and all
>  # come from a Kconfig choice, so we know we have LINUX_IMAGE_NAME set
> 

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Buildroot] [PATCH v2 6/9] boot/grub2: Introduce loongarch64-efi target
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 6/9] boot/grub2: Introduce loongarch64-efi target Jiaxun Yang
@ 2025-06-14 13:14   ` Romain Naour via buildroot
  0 siblings, 0 replies; 24+ messages in thread
From: Romain Naour via buildroot @ 2025-06-14 13:14 UTC (permalink / raw)
  To: Jiaxun Yang, buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Dick Olsson

Hello Jiaxun, All,

Le 07/06/2025 à 20:12, Jiaxun Yang a écrit :
> loongarch64-efi target presents in GRUB can be utilised
> by any EFI compatible LoongArch64 machine to boot kernel.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>

Reviewed-by: Romain Naour <romain.naour@smile.fr>

Best regards,
Romain


> ---
>  boot/grub2/Config.in | 10 ++++++++++
>  boot/grub2/grub2.mk  |  9 +++++++++
>  2 files changed, 19 insertions(+)
> 
> diff --git a/boot/grub2/Config.in b/boot/grub2/Config.in
> index ecee9ef74cdca0847d4ad386a0dc281ced07725b..3a50ec0ad74897cc89793d7c49cd98eb53e74cef 100644
> --- a/boot/grub2/Config.in
> +++ b/boot/grub2/Config.in
> @@ -5,6 +5,7 @@ config BR2_TARGET_GRUB2_ARCH_SUPPORTS
>  	default y if BR2_arm
>  	default y if BR2_aarch64
>  	default y if BR2_RISCV_64
> +	default y if BR2_loongarch64
>  	depends on BR2_USE_MMU
>  
>  menuconfig BR2_TARGET_GRUB2
> @@ -112,6 +113,15 @@ config BR2_TARGET_GRUB2_RISCV64_EFI
>  	  64bit RISC-V platform and you want to boot Grub 2 as an EFI
>  	  application.
>  
> +config BR2_TARGET_GRUB2_LOONGARCH64_EFI
> +	bool "loongarch64-efi"
> +	depends on BR2_loongarch64
> +	select BR2_TARGET_GRUB2_HAS_EFI_BOOT
> +	help
> +	  Select this option if the platform you're targetting is a
> +	  64bit LoongArch platform and you want to boot Grub 2 as an EFI
> +	  application.
> +
>  if BR2_TARGET_GRUB2_HAS_LEGACY_BOOT
>  
>  comment "Options for the x86 legacy BIOS or ARM U-Boot support"
> diff --git a/boot/grub2/grub2.mk b/boot/grub2/grub2.mk
> index 22d609c004834adc09da061ab8839f4aa561a2dd..4562e57a4f2bfa6b6fb086c7ebf8ef4304615e36 100644
> --- a/boot/grub2/grub2.mk
> +++ b/boot/grub2/grub2.mk
> @@ -102,6 +102,15 @@ GRUB2_BUILTIN_CONFIG_riscv64-efi = $(GRUB2_BUILTIN_CONFIG_EFI)
>  GRUB2_BUILTIN_MODULES_riscv64-efi = $(GRUB2_BUILTIN_MODULES_EFI)
>  GRUB2_TUPLES-$(BR2_TARGET_GRUB2_RISCV64_EFI) += riscv64-efi
>  
> +GRUB2_IMAGE_loongarch64-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/bootloongarch64.efi
> +GRUB2_CFG_loongarch64-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/grub.cfg
> +GRUB2_PREFIX_loongarch64-efi = /EFI/BOOT
> +GRUB2_TARGET_loongarch64-efi = loongarch64
> +GRUB2_PLATFORM_loongarch64-efi = efi
> +GRUB2_BUILTIN_CONFIG_loongarch64-efi = $(GRUB2_BUILTIN_CONFIG_EFI)
> +GRUB2_BUILTIN_MODULES_loongarch64-efi = $(GRUB2_BUILTIN_MODULES_EFI)
> +GRUB2_TUPLES-$(BR2_TARGET_GRUB2_LOONGARCH64_EFI) += loongarch64-efi
> +
>  # Grub2 is kind of special: it considers CC, LD and so on to be the
>  # tools to build the host programs and uses TARGET_CC, TARGET_CFLAGS,
>  # TARGET_CPPFLAGS, TARGET_LDFLAGS to build the bootloader itself.
> 

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Buildroot] [PATCH v2 2/9] arch: Introduce LoongArch64
  2025-06-14 12:54   ` Romain Naour via buildroot
@ 2025-06-14 13:17     ` Thomas Petazzoni via buildroot
  2025-06-14 15:54       ` Jiaxun Yang
  0 siblings, 1 reply; 24+ messages in thread
From: Thomas Petazzoni via buildroot @ 2025-06-14 13:17 UTC (permalink / raw)
  To: Romain Naour
  Cc: Jiaxun Yang, buildroot, Giulio Benetti, Romain Naour, Dick Olsson

Hello,

On Sat, 14 Jun 2025 14:54:04 +0200
Romain Naour <romain.naour@smile.fr> wrote:


> > +config BR2_loongarch64
> > +	bool "LoongArch64"
> > +	select BR2_USE_MMU
> > +	select BR2_ARCH_IS_64  

Since you have this select BR2_ARCH_IS_64 here...

> > +config BR2_loongarch64_generic
> > +	bool "Generic LoongArch 64-bit"
> > +	depends on BR2_ARCH_IS_64

This depends on is useless.

> > +	select BR2_ARCH_NEEDS_GCC_AT_LEAST_12  
> 
> This can be moved under BR2_loongarch64.
> 
> Best regards,
> Romain
> 
> 
> > +	help
> > +	  Generic LoongArch 64-bit processor.
> > +
> > +config BR2_loongarch64_v1_0
> > +	bool "LoongArch64 ISA version 1.0"
> > +	depends on BR2_ARCH_IS_64

This depends on is useless.

> > +	select BR2_ARCH_NEEDS_GCC_AT_LEAST_13
> > +	help
> > +	  LoongArch64 ISA version 1.0 processor.
> > +
> > +config BR2_loongarch64_v1_1
> > +	bool "LoongArch64 ISA version 1.1"
> > +	depends on BR2_ARCH_IS_64

This depends on is useless.

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Buildroot] [PATCH v2 9/9] board/qemu: Add loongarch64-virt-efi variant
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 9/9] board/qemu: Add loongarch64-virt-efi variant Jiaxun Yang
@ 2025-06-14 13:32   ` Julien Olivain
  2025-06-14 13:59     ` Romain Naour via buildroot
  0 siblings, 1 reply; 24+ messages in thread
From: Julien Olivain @ 2025-06-14 13:32 UTC (permalink / raw)
  To: Jiaxun Yang
  Cc: buildroot, Giulio Benetti, Romain Naour, Thomas Petazzoni,
	Dick Olsson

Hi Jiaxun, All,

Thanks for the patch!

For consistency with other Buildroot commits, could you reword
the commit log title to:

     configs/qemu_loongarch64_virt_efi: new defconfig

Also, I have few other comments, see below.

On 07/06/2025 20:12, Jiaxun Yang wrote:
> Add qemu_loongarch64_virt_efi_defconfig, which builds EDK2
> and host QEMU to test LoongArch64 buildroot.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>  DEVELOPERS                                    |  2 ++
>  board/qemu/loongarch64-virt-efi/genimage.cfg  | 33 
> +++++++++++++++++++++++++++
>  board/qemu/loongarch64-virt-efi/grub.cfg      |  6 +++++
>  board/qemu/loongarch64-virt-efi/post-image.sh |  5 ++++
>  board/qemu/loongarch64-virt-efi/readme.txt    | 31 
> +++++++++++++++++++++++++
>  configs/qemu_loongarch64_virt_efi_defconfig   | 23 +++++++++++++++++++
>  6 files changed, 100 insertions(+)
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 
> 600cd6c22ff6db57f9ef1da5ba9b6c15b37ca7f8..cac88b6be1dd0daccbba7f26f2e5961274cd3871 
> 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -1645,7 +1645,9 @@ F:	package/rtty/
>  N:	Jiaxun Yang <jiaxun.yang@flygoat.com>
>  F:	arch/Config.in.loongarch
>  F:	board/loongarch64-efi
> +F:	qemu/loongarch64-virt-efi

Here, running the command "utils/get-developers -v" generates
a warning:

     WARNING: 'qemu/loongarch64-virt-efi' doesn't match any file, line 
1651

The correct path should be "board/qemu/loongarch64-virt-efi".

>  F:	configs/loongarch64_efi_defconfig
> +F:	configs/qemu_loongarch64_virt_efi_defconfig
> 
>  N:	Joachim Wiberg <troglobit@gmail.com>
>  F:	configs/globalscale_espressobin_defconfig
> diff --git a/board/qemu/loongarch64-virt-efi/genimage.cfg 
> b/board/qemu/loongarch64-virt-efi/genimage.cfg
> new file mode 100644
> index 
> 0000000000000000000000000000000000000000..95fb59c97c38db772485372a60ee1fe5dad717c6
> --- /dev/null
> +++ b/board/qemu/loongarch64-virt-efi/genimage.cfg
> @@ -0,0 +1,33 @@
> +image efi-part.vfat {
> +	vfat {
> +		file EFI {
> +			image = "efi-part/EFI"
> +		}
> +		file vmlinux.efi {
> +			image = "vmlinux.efi"
> +		}
> +	}
> +
> +	size = 64M
> +}
> +
> +image disk.img {
> +	hdimage {
> +		partition-table-type = "gpt"
> +	}
> +
> +	partition boot {
> +		image = "efi-part.vfat"
> +		partition-type-uuid = U
> +		offset = 32K
> +		bootable = true
> +	}
> +
> +	partition root {
> +		# For partition-type-uuid value, see:
> +		# 
> https://uapi-group.org/specifications/specs/discoverable_partitions_specification/
> +		# SD_GPT_ROOT_LOONGARCH64
> +		partition-type-uuid = 77055800-792c-4f94-b39a-98c91b762bb6

genimage includes aliases for partition type UUIDs. See:
https://github.com/pengutronix/genimage/blob/v18/image-hd.c#L290

so for readability, this line could be changed to:

     partition-type-uuid = root-loongarch64

> +		image = "rootfs.ext2"
> +	}
> +}

[...]

> diff --git a/configs/qemu_loongarch64_virt_efi_defconfig 
> b/configs/qemu_loongarch64_virt_efi_defconfig
> new file mode 100644
> index 
> 0000000000000000000000000000000000000000..cc65158c0282b17e4a995bd1d79a403e8112314a
> --- /dev/null
> +++ b/configs/qemu_loongarch64_virt_efi_defconfig
> @@ -0,0 +1,23 @@
> +BR2_loongarch64=y
> +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y
> +BR2_GLOBAL_PATCH_DIR="board/qemu/patches"
> +BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
> +BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
> +BR2_SYSTEM_DHCP="eth0"
> +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/loongarch64-virt-efi/post-image.sh 
> board/qemu/post-image.sh support/scripts/genimage.sh"
> +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG) -c 
> board/qemu/loongarch64-virt-efi/genimage.cfg"
> +BR2_LINUX_KERNEL=y
> +BR2_LINUX_KERNEL_CUSTOM_VERSION=y
> +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.27"
> +BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
> +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
> +BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
> +BR2_TARGET_ROOTFS_EXT2=y
> +BR2_TARGET_ROOTFS_EXT2_SIZE="200M"
> +# BR2_TARGET_ROOTFS_TAR is not set
> +BR2_TARGET_EDK2=y
> +BR2_TARGET_GRUB2=y
> +BR2_TARGET_GRUB2_LOONGARCH64_EFI=y
> +BR2_PACKAGE_HOST_DOSFSTOOLS=y
> +BR2_PACKAGE_HOST_GENIMAGE=y
> +BR2_PACKAGE_HOST_MTOOLS=y

Qemu defconfigs should also select:

     BR2_PACKAGE_HOST_QEMU=y
     BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y

See for example:
https://gitlab.com/buildroot.org/buildroot/-/blob/2025.05/configs/qemu_aarch64_virt_defconfig#L17

This is because the Buildroot Gitlab CI tries to boot qemu defconfigs.
Doing so will also use the host-qemu version available in Buildroot,
which is 10.0.0 as of today (rather than the version in the reference
docker image).

See:
https://gitlab.com/buildroot.org/buildroot/-/blob/2025.05/support/misc/gitlab-ci.yml.in#L65

Before this patch, you'll probably have to declare the host qemu
loongarch support, in package/qemu/Config.in.host,
in BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS, you should probably add:

     default y if BR2_loongarch64

Then, you can check this is working in the docker reference image
with commands:

     utils/docker-run
     make qemu_loongarch64_virt_efi_defconfig
     make
     output/images/start-qemu.sh

Could you send an updated patch addressing those comments, please?

with those changes:

Tested-by: Julien Olivain <ju.o@free.fr>
Reviewed-by: Julien Olivain <ju.o@free.fr>

Best regards,

Julien.
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Buildroot] [PATCH v2 7/9] board/loongarch64-efi: Introduce the new board
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 7/9] board/loongarch64-efi: Introduce the new board Jiaxun Yang
@ 2025-06-14 13:43   ` Romain Naour via buildroot
  2025-06-14 20:50   ` Julien Olivain
  1 sibling, 0 replies; 24+ messages in thread
From: Romain Naour via buildroot @ 2025-06-14 13:43 UTC (permalink / raw)
  To: Jiaxun Yang, buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Dick Olsson

Hello Jiaxun, All,

Le 07/06/2025 à 20:12, Jiaxun Yang a écrit :
> Introduce bread new loongarch64-efi board, with skeleton
> from aarch64-efi board.
> 
> It corverd most LoongArch64 systems.
covered

> 
> Linux 6.12, as the most recent LTS kernel, was chosen
> to ensure proper architecture support is included.
> 
> A developer entry is created for myself for future contacts
> as well.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>  DEVELOPERS                                         |  5 ++++
>  board/loongarch64-efi/genimage-efi.cfg             | 33 +++++++++++++++++++++
>  board/loongarch64-efi/grub.cfg                     |  6 ++++
>  .../patches/linux-headers/linux-headers.hash       |  1 +
>  board/loongarch64-efi/patches/linux/linux.hash     |  2 ++
>  board/loongarch64-efi/post-image.sh                |  5 ++++
>  board/loongarch64-efi/readme.txt                   | 34 ++++++++++++++++++++++
>  configs/loongarch64_efi_defconfig                  | 22 ++++++++++++++
>  8 files changed, 108 insertions(+)
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index a7bb3bd83460017a183f59d05f6a560d7316a6ac..600cd6c22ff6db57f9ef1da5ba9b6c15b37ca7f8 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -1642,6 +1642,11 @@ F:	package/libuhttpd/
>  F:	package/libuwsc/
>  F:	package/rtty/
>  
> +N:	Jiaxun Yang <jiaxun.yang@flygoat.com>
> +F:	arch/Config.in.loongarch

This could have been added with the patch adding the loongarch architecture.

Maybe you could add yourself to toolchain componants (gcc, binutils, musl,
glibc) to receive notification.

Reviewed-by: Romain Naour <romain.naour@smile.fr>

Best regards,
Romain


> +F:	board/loongarch64-efi
> +F:	configs/loongarch64_efi_defconfig
> +
>  N:	Joachim Wiberg <troglobit@gmail.com>
>  F:	configs/globalscale_espressobin_defconfig
>  F:	board/globalscale/espressobin/
> diff --git a/board/loongarch64-efi/genimage-efi.cfg b/board/loongarch64-efi/genimage-efi.cfg
> new file mode 100644
> index 0000000000000000000000000000000000000000..95fb59c97c38db772485372a60ee1fe5dad717c6
> --- /dev/null
> +++ b/board/loongarch64-efi/genimage-efi.cfg
> @@ -0,0 +1,33 @@
> +image efi-part.vfat {
> +	vfat {
> +		file EFI {
> +			image = "efi-part/EFI"
> +		}
> +		file vmlinux.efi {
> +			image = "vmlinux.efi"
> +		}
> +	}
> +
> +	size = 64M
> +}
> +
> +image disk.img {
> +	hdimage {
> +		partition-table-type = "gpt"
> +	}
> +
> +	partition boot {
> +		image = "efi-part.vfat"
> +		partition-type-uuid = U
> +		offset = 32K
> +		bootable = true
> +	}
> +
> +	partition root {
> +		# For partition-type-uuid value, see:
> +		# https://uapi-group.org/specifications/specs/discoverable_partitions_specification/
> +		# SD_GPT_ROOT_LOONGARCH64
> +		partition-type-uuid = 77055800-792c-4f94-b39a-98c91b762bb6
> +		image = "rootfs.ext2"
> +	}
> +}
> diff --git a/board/loongarch64-efi/grub.cfg b/board/loongarch64-efi/grub.cfg
> new file mode 100644
> index 0000000000000000000000000000000000000000..2006f6d60d9b4bde1f8a12c87d76476f9401c6ca
> --- /dev/null
> +++ b/board/loongarch64-efi/grub.cfg
> @@ -0,0 +1,6 @@
> +/set default="0"
> +set timeout="5"
> +
> +menuentry "Buildroot" {
> +	linux /vmlinux.efi root=PARTLABEL=root rootwait console=ttyS0,115200
> +}
> diff --git a/board/loongarch64-efi/patches/linux-headers/linux-headers.hash b/board/loongarch64-efi/patches/linux-headers/linux-headers.hash
> new file mode 120000
> index 0000000000000000000000000000000000000000..5808d92afe89015ae416e941adf041644162d996
> --- /dev/null
> +++ b/board/loongarch64-efi/patches/linux-headers/linux-headers.hash
> @@ -0,0 +1 @@
> +../linux/linux.hash
> \ No newline at end of file
> diff --git a/board/loongarch64-efi/patches/linux/linux.hash b/board/loongarch64-efi/patches/linux/linux.hash
> new file mode 100644
> index 0000000000000000000000000000000000000000..381f3427a60dda4476631271787ff752bca52204
> --- /dev/null
> +++ b/board/loongarch64-efi/patches/linux/linux.hash
> @@ -0,0 +1,2 @@
> +# From https://www.kernel.org/pub/linux/kernel/v6.x/sha256sums.asc
> +sha256  a9b020721778384507010177d3929e7d4058f7f6120f05a99d56b5c5c0346a70  linux-6.12.32.tar.xz
> diff --git a/board/loongarch64-efi/post-image.sh b/board/loongarch64-efi/post-image.sh
> new file mode 100755
> index 0000000000000000000000000000000000000000..fdb17ece7003611d0cd6de84ed4dbd14767e5b68
> --- /dev/null
> +++ b/board/loongarch64-efi/post-image.sh
> @@ -0,0 +1,5 @@
> +#!/bin/sh
> +
> +BOARD_DIR="$(dirname "$0")"
> +
> +cp -f "${BOARD_DIR}/grub.cfg" "${BINARIES_DIR}/efi-part/EFI/BOOT/grub.cfg"
> diff --git a/board/loongarch64-efi/readme.txt b/board/loongarch64-efi/readme.txt
> new file mode 100644
> index 0000000000000000000000000000000000000000..4c4e06874c1fce1bd8e44cd989b7e971304aa4f0
> --- /dev/null
> +++ b/board/loongarch64-efi/readme.txt
> @@ -0,0 +1,34 @@
> +The loongarch64_efi_defconfig allows to build a minimal Linux system that
> +can boot on all loongarch64 systems providing an EFI firmware.
> +
> +This includes almost all Loongson-3 series workstations and servers.
> +
> +Building and booting
> +====================
> +
> +$ make loongarch64_efi_defconfig
> +$ make
> +
> +The file output/images/disk.img is a complete disk image that can be
> +booted, it includes the grub2 bootloader, Linux kernel and root
> +filesystem.
> +
> +Testing under Qemu
> +==================
> +
> +This image can also be tested using Qemu:
> +
> +qemu-system-loongarch64 \
> +	-M virt \
> +	-cpu la464 \
> +	-nographic \
> +	-bios </path/to/QEMU_EFI.fd> \
> +	-drive file=output/images/disk.img,if=none,format=raw,id=hd0 \
> +	-device virtio-blk-pci,drive=hd0 \
> +	-netdev user,id=eth0 \
> +	-device virtio-net-pci,netdev=eth0
> +
> +Note that </path/to/QEMU_EFI.fd> needs to point to a valid loongarch64 UEFI
> +firmware image for qemu.
> +It may be provided by your distribution as a edk2-loongarch64 package,
> +in path such as /usr/share/edk2/loongarch64/QEMU_EFI.fd .
> diff --git a/configs/loongarch64_efi_defconfig b/configs/loongarch64_efi_defconfig
> new file mode 100644
> index 0000000000000000000000000000000000000000..c98699330d3cd9907043573465a9c8b189d47384
> --- /dev/null
> +++ b/configs/loongarch64_efi_defconfig
> @@ -0,0 +1,22 @@
> +BR2_loongarch64=y
> +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y
> +BR2_GLOBAL_PATCH_DIR="board/loongarch64-efi/patches"
> +BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
> +BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
> +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/loongarch64-efi/post-image.sh support/scripts/genimage.sh"
> +BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/loongarch64-efi/genimage-efi.cfg"
> +BR2_LINUX_KERNEL=y
> +BR2_LINUX_KERNEL_CUSTOM_VERSION=y
> +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.32"
> +BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
> +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
> +BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
> +BR2_TARGET_ROOTFS_EXT2=y
> +BR2_TARGET_ROOTFS_EXT2_4=y
> +BR2_TARGET_ROOTFS_EXT2_SIZE="200M"
> +# BR2_TARGET_ROOTFS_TAR is not set
> +BR2_TARGET_GRUB2=y
> +BR2_TARGET_GRUB2_LOONGARCH64_EFI=y
> +BR2_PACKAGE_HOST_DOSFSTOOLS=y
> +BR2_PACKAGE_HOST_GENIMAGE=y
> +BR2_PACKAGE_HOST_MTOOLS=y
> 

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Buildroot] [PATCH v2 8/9] boot/edk2: Add LoongArch64 OVMF support
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 8/9] boot/edk2: Add LoongArch64 OVMF support Jiaxun Yang
@ 2025-06-14 13:50   ` Romain Naour via buildroot
  0 siblings, 0 replies; 24+ messages in thread
From: Romain Naour via buildroot @ 2025-06-14 13:50 UTC (permalink / raw)
  To: Jiaxun Yang, buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Dick Olsson

Hello Jiaxun, All,

Le 07/06/2025 à 20:12, Jiaxun Yang a écrit :
> LoongArch64 OVMF target is introduced to EDK2 in edk2-202408.
> 
> Enable architecture support here.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>  boot/edk2/Config.in | 14 +++++++++++++-
>  boot/edk2/edk2.mk   |  6 ++++++
>  2 files changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/boot/edk2/Config.in b/boot/edk2/Config.in
> index 4e6e7d122cb550cbf57ce8fde31779e2d2cbc9a9..734826a8be722c1c45ab157b43fee60ebb4a30a0 100644
> --- a/boot/edk2/Config.in
> +++ b/boot/edk2/Config.in
> @@ -2,6 +2,7 @@ config BR2_TARGET_EDK2_ARCH_SUPPORTS
>  	bool
>  	default y if BR2_aarch64
>  	default y if BR2_i386
> +	default y if BR2_loongarch64
>  	default y if BR2_RISCV_64
>  	default y if BR2_x86_64
>  
> @@ -21,6 +22,8 @@ if BR2_TARGET_EDK2
>  choice
>  	prompt "Platform"
>  	default BR2_TARGET_EDK2_PLATFORM_OVMF_I386 if BR2_i386
> +	default BR2_TARGET_EDK2_PLATFORM_OVMF_LOONGARCH64 if \
> +		BR2_loongarch64

check-package seems happy even without line breaking.

Reviewed-by: Romain Naour <romain.naour@smile.fr>

Best regards,
Romain


>  	default BR2_TARGET_EDK2_PLATFORM_OVMF_RISCV if BR2_RISCV_64
>  	default BR2_TARGET_EDK2_PLATFORM_OVMF_X64 if BR2_x86_64
>  	default BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU if BR2_aarch64
> @@ -31,7 +34,15 @@ config BR2_TARGET_EDK2_PLATFORM_OVMF_I386
>  	help
>  	  Platform configuration for a generic i386 target.
>  	  This platform will boot from flash address 0x0.
> -	  It should therefore be used as the first bootloader.
> +
> +config BR2_TARGET_EDK2_PLATFORM_OVMF_LOONGARCH64
> +	bool "LoongArch64"
> +	depends on BR2_loongarch64
> +	help
> +	  Platform configuration for LoongArch QEMU targeting the
> +	  Virt machine. This platform will only boot from flash
> +	  address 0x1c000000. It should therefore be used as the first
> +	  bootloader.
>  
>  config BR2_TARGET_EDK2_PLATFORM_OVMF_RISCV
>  	bool "RISC-V"
> @@ -139,6 +150,7 @@ config BR2_TARGET_EDK2_FD_NAME
>  	default "OVMF" if BR2_TARGET_EDK2_PLATFORM_OVMF_X64
>  	default "QEMU_EFI" if BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU
>  	default "QEMU_EFI" if BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU_KERNEL
> +	default "QEMU_EFI" if BR2_TARGET_EDK2_PLATFORM_OVMF_LOONGARCH64
>  	default "BL33_AP_UEFI" if BR2_TARGET_EDK2_PLATFORM_ARM_SGI575
>  	default "FVP_AARCH64_EFI" if BR2_TARGET_EDK2_PLATFORM_ARM_VEXPRESS_FVP_AARCH64
>  	default "FVP_AARCH64_EFI" if BR2_TARGET_EDK2_PLATFORM_SOCIONEXT_DEVELOPERBOX
> diff --git a/boot/edk2/edk2.mk b/boot/edk2/edk2.mk
> index bc4049b2def3e75a1e95ba85696de77d58335a3e..4540a9bdea88e682dedd02ab43937127e3e464e7 100644
> --- a/boot/edk2/edk2.mk
> +++ b/boot/edk2/edk2.mk
> @@ -142,6 +142,12 @@ EDK2_PACKAGE_NAME = OvmfPkg/RiscVVirt
>  EDK2_PLATFORM_NAME = RiscVVirtQemu
>  EDK2_BUILD_DIR = $(EDK2_PLATFORM_NAME)
>  
> +else ifeq ($(BR2_TARGET_EDK2_PLATFORM_OVMF_LOONGARCH64),y)
> +EDK2_ARCH = LOONGARCH64
> +EDK2_PACKAGE_NAME = OvmfPkg/LoongArchVirt
> +EDK2_PLATFORM_NAME = LoongArchVirtQemu
> +EDK2_BUILD_DIR = $(EDK2_PLATFORM_NAME)
> +
>  endif
>  
>  EDK2_BASETOOLS_OPTS = \
> 

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Buildroot] [PATCH v2 9/9] board/qemu: Add loongarch64-virt-efi variant
  2025-06-14 13:32   ` Julien Olivain
@ 2025-06-14 13:59     ` Romain Naour via buildroot
  0 siblings, 0 replies; 24+ messages in thread
From: Romain Naour via buildroot @ 2025-06-14 13:59 UTC (permalink / raw)
  To: Julien Olivain, Jiaxun Yang
  Cc: buildroot, Giulio Benetti, Romain Naour, Thomas Petazzoni,
	Dick Olsson

Hello Jiaxun, Julien, All,

Le 14/06/2025 à 15:32, Julien Olivain a écrit :
> Hi Jiaxun, All,
> 
> Thanks for the patch!
> 
> For consistency with other Buildroot commits, could you reword
> the commit log title to:
> 
>     configs/qemu_loongarch64_virt_efi: new defconfig
> 
> Also, I have few other comments, see below.
> 
> On 07/06/2025 20:12, Jiaxun Yang wrote:
>> Add qemu_loongarch64_virt_efi_defconfig, which builds EDK2
>> and host QEMU to test LoongArch64 buildroot.
>>
>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>> ---
>>  DEVELOPERS                                    |  2 ++
>>  board/qemu/loongarch64-virt-efi/genimage.cfg  | 33 +++++++++++++++++++++++++++
>>  board/qemu/loongarch64-virt-efi/grub.cfg      |  6 +++++
>>  board/qemu/loongarch64-virt-efi/post-image.sh |  5 ++++
>>  board/qemu/loongarch64-virt-efi/readme.txt    | 31 +++++++++++++++++++++++++
>>  configs/qemu_loongarch64_virt_efi_defconfig   | 23 +++++++++++++++++++
>>  6 files changed, 100 insertions(+)
>>
>> diff --git a/DEVELOPERS b/DEVELOPERS
>> index
>> 600cd6c22ff6db57f9ef1da5ba9b6c15b37ca7f8..cac88b6be1dd0daccbba7f26f2e5961274cd3871 100644
>> --- a/DEVELOPERS
>> +++ b/DEVELOPERS
>> @@ -1645,7 +1645,9 @@ F:    package/rtty/
>>  N:    Jiaxun Yang <jiaxun.yang@flygoat.com>
>>  F:    arch/Config.in.loongarch
>>  F:    board/loongarch64-efi
>> +F:    qemu/loongarch64-virt-efi
> 
> Here, running the command "utils/get-developers -v" generates
> a warning:
> 
>     WARNING: 'qemu/loongarch64-virt-efi' doesn't match any file, line 1651
> 
> The correct path should be "board/qemu/loongarch64-virt-efi".
> 
>>  F:    configs/loongarch64_efi_defconfig
>> +F:    configs/qemu_loongarch64_virt_efi_defconfig
>>
>>  N:    Joachim Wiberg <troglobit@gmail.com>
>>  F:    configs/globalscale_espressobin_defconfig
>> diff --git a/board/qemu/loongarch64-virt-efi/genimage.cfg b/board/qemu/
>> loongarch64-virt-efi/genimage.cfg
>> new file mode 100644
>> index
>> 0000000000000000000000000000000000000000..95fb59c97c38db772485372a60ee1fe5dad717c6
>> --- /dev/null
>> +++ b/board/qemu/loongarch64-virt-efi/genimage.cfg
>> @@ -0,0 +1,33 @@
>> +image efi-part.vfat {
>> +    vfat {
>> +        file EFI {
>> +            image = "efi-part/EFI"
>> +        }
>> +        file vmlinux.efi {
>> +            image = "vmlinux.efi"
>> +        }
>> +    }
>> +
>> +    size = 64M
>> +}
>> +
>> +image disk.img {
>> +    hdimage {
>> +        partition-table-type = "gpt"
>> +    }
>> +
>> +    partition boot {
>> +        image = "efi-part.vfat"
>> +        partition-type-uuid = U
>> +        offset = 32K
>> +        bootable = true
>> +    }
>> +
>> +    partition root {
>> +        # For partition-type-uuid value, see:
>> +        # https://uapi-group.org/specifications/specs/
>> discoverable_partitions_specification/
>> +        # SD_GPT_ROOT_LOONGARCH64
>> +        partition-type-uuid = 77055800-792c-4f94-b39a-98c91b762bb6
> 
> genimage includes aliases for partition type UUIDs. See:
> https://github.com/pengutronix/genimage/blob/v18/image-hd.c#L290
> 
> so for readability, this line could be changed to:
> 
>     partition-type-uuid = root-loongarch64
> 
>> +        image = "rootfs.ext2"
>> +    }
>> +}
> 
> [...]
> 
>> diff --git a/configs/qemu_loongarch64_virt_efi_defconfig b/configs/
>> qemu_loongarch64_virt_efi_defconfig
>> new file mode 100644
>> index
>> 0000000000000000000000000000000000000000..cc65158c0282b17e4a995bd1d79a403e8112314a
>> --- /dev/null
>> +++ b/configs/qemu_loongarch64_virt_efi_defconfig
>> @@ -0,0 +1,23 @@
>> +BR2_loongarch64=y
>> +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y
>> +BR2_GLOBAL_PATCH_DIR="board/qemu/patches"
>> +BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
>> +BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
>> +BR2_SYSTEM_DHCP="eth0"
>> +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/loongarch64-virt-efi/post-image.sh
>> board/qemu/post-image.sh support/scripts/genimage.sh"
>> +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG) -c board/qemu/loongarch64-virt-
>> efi/genimage.cfg"
>> +BR2_LINUX_KERNEL=y
>> +BR2_LINUX_KERNEL_CUSTOM_VERSION=y
>> +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.27"
>> +BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
>> +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
>> +BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
>> +BR2_TARGET_ROOTFS_EXT2=y
>> +BR2_TARGET_ROOTFS_EXT2_SIZE="200M"
>> +# BR2_TARGET_ROOTFS_TAR is not set
>> +BR2_TARGET_EDK2=y
>> +BR2_TARGET_GRUB2=y
>> +BR2_TARGET_GRUB2_LOONGARCH64_EFI=y
>> +BR2_PACKAGE_HOST_DOSFSTOOLS=y
>> +BR2_PACKAGE_HOST_GENIMAGE=y
>> +BR2_PACKAGE_HOST_MTOOLS=y
> 
> Qemu defconfigs should also select:
> 
>     BR2_PACKAGE_HOST_QEMU=y
>     BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y
> 
> See for example:
> https://gitlab.com/buildroot.org/buildroot/-/blob/2025.05/configs/
> qemu_aarch64_virt_defconfig#L17
> 
> This is because the Buildroot Gitlab CI tries to boot qemu defconfigs.
> Doing so will also use the host-qemu version available in Buildroot,
> which is 10.0.0 as of today (rather than the version in the reference
> docker image).
> 
> See:
> https://gitlab.com/buildroot.org/buildroot/-/blob/2025.05/support/misc/gitlab-
> ci.yml.in#L65
> 
> Before this patch, you'll probably have to declare the host qemu
> loongarch support, in package/qemu/Config.in.host,
> in BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS, you should probably add:
> 
>     default y if BR2_loongarch64
> 
> Then, you can check this is working in the docker reference image
> with commands:
> 
>     utils/docker-run
>     make qemu_loongarch64_virt_efi_defconfig
>     make
>     output/images/start-qemu.sh
> 
> Could you send an updated patch addressing those comments, please?

Thanks Julien, I noticed the same missing changes.

> 
> with those changes:
> 
> Tested-by: Julien Olivain <ju.o@free.fr>
> Reviewed-by: Julien Olivain <ju.o@free.fr>

# uname -a
Linux buildroot 6.12.27 #1 SMP PREEMPT_DYNAMIC Fri Jun 13 22:11:06 UTC 2025
loongarch64 GNU/Linux

# dmesg | grep DMI
[    0.000000] DMI: QEMU QEMU Virtual Machine, BIOS unknown 02/02/2022

Reviewed-by: Romain Naour <romain.naour@smile.fr>
Tested-by: Romain Naour <romain.naour@smile.fr>

Best regards,
Romain


> 
> Best regards,
> 
> Julien.
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Buildroot] [PATCH v2 0/9] LoongArch64 initial support
  2025-06-07 18:12 [Buildroot] [PATCH v2 0/9] LoongArch64 initial support Jiaxun Yang
                   ` (8 preceding siblings ...)
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 9/9] board/qemu: Add loongarch64-virt-efi variant Jiaxun Yang
@ 2025-06-14 14:24 ` Romain Naour via buildroot
  9 siblings, 0 replies; 24+ messages in thread
From: Romain Naour via buildroot @ 2025-06-14 14:24 UTC (permalink / raw)
  To: Jiaxun Yang, buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Dick Olsson

Hello Jiaxun, All,

Le 07/06/2025 à 20:12, Jiaxun Yang a écrit :
> Hi all,
> 
> This series enabled LoongArch64 support to buildroot.
> 
> It added LoongArch bits to toolchain and kernel & grub packages
> and then introduced new loongarch64-efi board as a generic target.

In addition to this patch series, you may want to enable loongarch64 support for
utils/test-pkg script to enable new package testing.

See arch-internal-glibc config file as example:
$ cat support/config-fragments/autobuild/br-arc-internal-glibc.config
BR2_arcle=y
BR2_archs38=y
BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y

Can you explain how the LoongArch64 initial support was tested (which packages
have been enabled)?
What about the Debian or Yocto loongarch support?

There are many packages with arch specific architecture support that may break
with newcomers.

Can you also have a look to BR2_PACKAGE_{package}_ARCH_SUPPORTS option to add
BR2_loongarch64 when it's supported?
For example: BR2_PACKAGE_SYSTEMD_ARCH_SUPPORTS

Best regards,
Romain


> 
> Please review.
> Thanks!
> 
> ---
> Sorry for taking so long to get back, I was trapped by EDK2 build
> when I was making initial reversion and eventually lost track.
> 
> v2 Addressed most comments in v1.
> 
> To: buildroot@buildroot.org
> Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
> Cc: Romain Naour <romain.naour@gmail.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> Cc: Dick Olsson <hi@senzilla.io>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> 
> ---
> Jiaxun Yang (9):
>       package/gcc: Introduce BR2_GCC_TARGET_SIMD option
>       arch: Introduce LoongArch64
>       package/glibc: Enable LoongArch64 support
>       package/musl: Enable LoongArch64 support
>       linux: Introduce {vmlinux, vmlinuz}.efi kernel binary format
>       boot/grub2: Introduce loongarch64-efi target
>       board/loongarch64-efi: Introduce the new board
>       boot/edk2: Add LoongArch64 OVMF support
>       board/qemu: Add loongarch64-virt-efi variant
> 
>  DEVELOPERS                                         |   7 ++
>  arch/Config.in                                     |  19 +++
>  arch/Config.in.loongarch                           | 129 +++++++++++++++++++++
>  arch/arch.mk                                       |   1 +
>  board/loongarch64-efi/genimage-efi.cfg             |  33 ++++++
>  board/loongarch64-efi/grub.cfg                     |   6 +
>  .../patches/linux-headers/linux-headers.hash       |   1 +
>  board/loongarch64-efi/patches/linux/linux.hash     |   2 +
>  board/loongarch64-efi/post-image.sh                |   5 +
>  board/loongarch64-efi/readme.txt                   |  34 ++++++
>  board/qemu/loongarch64-virt-efi/genimage.cfg       |  33 ++++++
>  board/qemu/loongarch64-virt-efi/grub.cfg           |   6 +
>  board/qemu/loongarch64-virt-efi/post-image.sh      |   5 +
>  board/qemu/loongarch64-virt-efi/readme.txt         |  31 +++++
>  boot/edk2/Config.in                                |  14 ++-
>  boot/edk2/edk2.mk                                  |   6 +
>  boot/grub2/Config.in                               |  10 ++
>  boot/grub2/grub2.mk                                |   9 ++
>  configs/loongarch64_efi_defconfig                  |  22 ++++
>  configs/qemu_loongarch64_virt_efi_defconfig        |  23 ++++
>  linux/Config.in                                    |   8 ++
>  linux/linux.mk                                     |   4 +
>  package/gcc/gcc.mk                                 |   4 +
>  package/glibc/Config.in                            |   2 +
>  package/musl/Config.in                             |   1 +
>  toolchain/toolchain-buildroot/Config.in            |   4 +
>  .../toolchain-external/pkg-toolchain-external.mk   |   4 +
>  toolchain/toolchain-wrapper.c                      |   3 +
>  28 files changed, 425 insertions(+), 1 deletion(-)
> ---
> base-commit: 5080f0af166d2fff26f0c661b0cc7da0b3eaddd8
> change-id: 20250607-loongarch-8abe88258242
> 
> Best regards,

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Buildroot] [PATCH v2 2/9] arch: Introduce LoongArch64
  2025-06-14 13:17     ` Thomas Petazzoni via buildroot
@ 2025-06-14 15:54       ` Jiaxun Yang
  0 siblings, 0 replies; 24+ messages in thread
From: Jiaxun Yang @ 2025-06-14 15:54 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Romain Naour, buildroot, Giulio Benetti, Romain Naour,
	Dick Olsson



> 2025年6月14日 14:17,Thomas Petazzoni <thomas.petazzoni@bootlin.com> 写道:
> 
> Hello,

Hi Thomas,

Thanks for reviewing!

> 
> On Sat, 14 Jun 2025 14:54:04 +0200
> Romain Naour <romain.naour@smile.fr> wrote:
> 
> 
>>> +config BR2_loongarch64
>>> + bool "LoongArch64"
>>> + select BR2_USE_MMU
>>> + select BR2_ARCH_IS_64  
> 
> Since you have this select BR2_ARCH_IS_64 here...
> 
>>> +config BR2_loongarch64_generic
>>> + bool "Generic LoongArch 64-bit"
>>> + depends on BR2_ARCH_IS_64
> 
> This depends on is useless.

Those are mostly in preparation of LoongArch 32 support, I envy it would be
in this file as well.

> 
>>> + select BR2_ARCH_NEEDS_GCC_AT_LEAST_12  
>> 
>> This can be moved under BR2_loongarch64.

Sure, will do.

Thanks.
[…]

- Jiaxun

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [Buildroot] [PATCH v2 7/9] board/loongarch64-efi: Introduce the new board
  2025-06-07 18:12 ` [Buildroot] [PATCH v2 7/9] board/loongarch64-efi: Introduce the new board Jiaxun Yang
  2025-06-14 13:43   ` Romain Naour via buildroot
@ 2025-06-14 20:50   ` Julien Olivain
  1 sibling, 0 replies; 24+ messages in thread
From: Julien Olivain @ 2025-06-14 20:50 UTC (permalink / raw)
  To: Jiaxun Yang
  Cc: buildroot, Giulio Benetti, Romain Naour, Thomas Petazzoni,
	Dick Olsson

Hi Jiaxun, All,

Thanks for the patch!

I have the same kind of comments as I made for the Qemu defconfig in:
https://lore.kernel.org/buildroot/6d266eec-4ea9-4293-8403-b854bf0ed5b1@smile.fr/T/#ma97fe41097b838cc31078d3e59524e531f8e939d

More specifically:

To follow other Buildroot commits, the commit log title could be
reworded to:

     configs/loongarch64_efi: new defconfig

On 07/06/2025 20:12, Jiaxun Yang wrote:
> Introduce bread new loongarch64-efi board, with skeleton
> from aarch64-efi board.
> 
> It corverd most LoongArch64 systems.
> 
> Linux 6.12, as the most recent LTS kernel, was chosen
> to ensure proper architecture support is included.
> 
> A developer entry is created for myself for future contacts
> as well.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>  DEVELOPERS                                         |  5 ++++
>  board/loongarch64-efi/genimage-efi.cfg             | 33 
> +++++++++++++++++++++
>  board/loongarch64-efi/grub.cfg                     |  6 ++++
>  .../patches/linux-headers/linux-headers.hash       |  1 +
>  board/loongarch64-efi/patches/linux/linux.hash     |  2 ++
>  board/loongarch64-efi/post-image.sh                |  5 ++++
>  board/loongarch64-efi/readme.txt                   | 34 
> ++++++++++++++++++++++
>  configs/loongarch64_efi_defconfig                  | 22 ++++++++++++++
>  8 files changed, 108 insertions(+)
> 

[...]

> diff --git a/board/loongarch64-efi/genimage-efi.cfg 
> b/board/loongarch64-efi/genimage-efi.cfg
> new file mode 100644
> index 
> 0000000000000000000000000000000000000000..95fb59c97c38db772485372a60ee1fe5dad717c6
> --- /dev/null
> +++ b/board/loongarch64-efi/genimage-efi.cfg
> @@ -0,0 +1,33 @@
> +image efi-part.vfat {
> +	vfat {
> +		file EFI {
> +			image = "efi-part/EFI"
> +		}
> +		file vmlinux.efi {
> +			image = "vmlinux.efi"
> +		}
> +	}
> +
> +	size = 64M
> +}
> +
> +image disk.img {
> +	hdimage {
> +		partition-table-type = "gpt"
> +	}
> +
> +	partition boot {
> +		image = "efi-part.vfat"
> +		partition-type-uuid = U
> +		offset = 32K
> +		bootable = true
> +	}
> +
> +	partition root {
> +		# For partition-type-uuid value, see:
> +		# 
> https://uapi-group.org/specifications/specs/discoverable_partitions_specification/
> +		# SD_GPT_ROOT_LOONGARCH64
> +		partition-type-uuid = 77055800-792c-4f94-b39a-98c91b762bb6

genimage includes aliases for partition type UUIDs. See:
https://github.com/pengutronix/genimage/blob/v18/image-hd.c#L290

so for readability, this line could be changed to:

      partition-type-uuid = root-loongarch64

> +		image = "rootfs.ext2"
> +	}
> +}

[...]

> diff --git a/board/loongarch64-efi/readme.txt 
> b/board/loongarch64-efi/readme.txt
> new file mode 100644
> index 
> 0000000000000000000000000000000000000000..4c4e06874c1fce1bd8e44cd989b7e971304aa4f0
> --- /dev/null
> +++ b/board/loongarch64-efi/readme.txt
> @@ -0,0 +1,34 @@
> +The loongarch64_efi_defconfig allows to build a minimal Linux system 
> that
> +can boot on all loongarch64 systems providing an EFI firmware.
> +
> +This includes almost all Loongson-3 series workstations and servers.

Even if this defconfig is UEFI (meaning it can work on any UEFI
compatible LoongArch64 board), maybe it would be helpful to have
few links to actual hardware boards on which this defconfig can be
reproduced, by Buildroot users.

What hardware did you used to validate this defconfig? Is there a
"reference board" for LoongArch64?

Usually, we include in Buildroot defconfigs supporting publicly
available boards.

> +
> +Building and booting
> +====================
> +
> +$ make loongarch64_efi_defconfig
> +$ make
> +
> +The file output/images/disk.img is a complete disk image that can be
> +booted, it includes the grub2 bootloader, Linux kernel and root
> +filesystem.
> +
> +Testing under Qemu
> +==================
> +
> +This image can also be tested using Qemu:
> +
> +qemu-system-loongarch64 \
> +	-M virt \
> +	-cpu la464 \
> +	-nographic \
> +	-bios </path/to/QEMU_EFI.fd> \
> +	-drive file=output/images/disk.img,if=none,format=raw,id=hd0 \
> +	-device virtio-blk-pci,drive=hd0 \
> +	-netdev user,id=eth0 \
> +	-device virtio-net-pci,netdev=eth0
> +
> +Note that </path/to/QEMU_EFI.fd> needs to point to a valid loongarch64 
> UEFI
> +firmware image for qemu.
> +It may be provided by your distribution as a edk2-loongarch64 package,
> +in path such as /usr/share/edk2/loongarch64/QEMU_EFI.fd .

Best regards,

Julien.
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2025-06-14 20:51 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-07 18:12 [Buildroot] [PATCH v2 0/9] LoongArch64 initial support Jiaxun Yang
2025-06-07 18:12 ` [Buildroot] [PATCH v2 1/9] package/gcc: Introduce BR2_GCC_TARGET_SIMD option Jiaxun Yang
2025-06-14 12:47   ` Romain Naour via buildroot
2025-06-07 18:12 ` [Buildroot] [PATCH v2 2/9] arch: Introduce LoongArch64 Jiaxun Yang
2025-06-14 12:54   ` Romain Naour via buildroot
2025-06-14 13:17     ` Thomas Petazzoni via buildroot
2025-06-14 15:54       ` Jiaxun Yang
2025-06-07 18:12 ` [Buildroot] [PATCH v2 3/9] package/glibc: Enable LoongArch64 support Jiaxun Yang
2025-06-14 12:57   ` Romain Naour via buildroot
2025-06-07 18:12 ` [Buildroot] [PATCH v2 4/9] package/musl: " Jiaxun Yang
2025-06-14 12:58   ` Romain Naour via buildroot
2025-06-07 18:12 ` [Buildroot] [PATCH v2 5/9] linux: Introduce {vmlinux, vmlinuz}.efi kernel binary format Jiaxun Yang
2025-06-14 13:11   ` Romain Naour via buildroot
2025-06-07 18:12 ` [Buildroot] [PATCH v2 6/9] boot/grub2: Introduce loongarch64-efi target Jiaxun Yang
2025-06-14 13:14   ` Romain Naour via buildroot
2025-06-07 18:12 ` [Buildroot] [PATCH v2 7/9] board/loongarch64-efi: Introduce the new board Jiaxun Yang
2025-06-14 13:43   ` Romain Naour via buildroot
2025-06-14 20:50   ` Julien Olivain
2025-06-07 18:12 ` [Buildroot] [PATCH v2 8/9] boot/edk2: Add LoongArch64 OVMF support Jiaxun Yang
2025-06-14 13:50   ` Romain Naour via buildroot
2025-06-07 18:12 ` [Buildroot] [PATCH v2 9/9] board/qemu: Add loongarch64-virt-efi variant Jiaxun Yang
2025-06-14 13:32   ` Julien Olivain
2025-06-14 13:59     ` Romain Naour via buildroot
2025-06-14 14:24 ` [Buildroot] [PATCH v2 0/9] LoongArch64 initial support Romain Naour via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.