All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v2 2/2] CI: Dockerfile: Add LoongArch64 support
       [not found]   ` <23f5f012-589c-4710-8b93-4c6bd509e4c4@gmx.de>
@ 2026-07-31 14:36     ` Yao Zi
  2026-07-31 14:53       ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Yao Zi @ 2026-07-31 14:36 UTC (permalink / raw)
  To: Heinrich Schuchardt, Yao Zi; +Cc: Jiaxun Yang, Tom Rini, u-boot

Adding the list to Cc so at least this discussion could be archived...

On Fri, Jul 31, 2026 at 04:16:38PM +0200, Heinrich Schuchardt wrote:
> On 7/31/26 13:47, Yao Zi wrote:
> > From: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > 
> > Install LoongArch64 toolchains, build LoongArch64 QEMU,
> > build LoongArch64 GRUB.
> > 
> > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > Signed-off-by: Yao Zi <me@ziyao.cc>
> > ---
> >   tools/docker/Dockerfile | 21 ++++++++++++++++++---
> >   1 file changed, 18 insertions(+), 3 deletions(-)
> > 
> > diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
> > index fb8e2c523aad..187320c26d59 100644
> > --- a/tools/docker/Dockerfile
> > +++ b/tools/docker/Dockerfile
> > @@ -17,7 +17,7 @@ ARG BUILDPLATFORM
> >   ENV DEBIAN_FRONTEND=noninteractive
> >   # Set architectures to build for (leaving out ARM which is an exception)
> > -ENV ARCHS="aarch64 arc i386 m68k mips microblaze nios2 powerpc riscv64 riscv32 sh2 x86_64"
> > +ENV ARCHS="aarch64 arc i386 loongarch64 m68k mips microblaze nios2 powerpc riscv64 riscv32 sh2 x86_64"
> >   # Mirror containing the toolchains
> >   ENV MIRROR=https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin
> > @@ -153,7 +153,8 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
> >   	xxd \
> >   	zip
> > -# Build GRUB UEFI targets for ARM & RISC-V, 32-bit and 64-bit
> > +# Build GRUB UEFI targets for ARM & RISC-V, 32-bit and 64-bit, and LoongArch
> > +# 64-bit
> >   RUN git clone https://https.git.savannah.gnu.org/git/grub.git /tmp/grub && \
> >   	cd /tmp/grub && \
> >   	git checkout grub-2.14 && \
> > @@ -189,6 +190,20 @@ RUN git clone https://https.git.savannah.gnu.org/git/grub.git /tmp/grub && \
> >   	search search_fs_file search_fs_uuid search_label serial sleep test \
> >   	true && \
> >   	make clean && \
> > +	./configure --target=loongarch64 --with-platform=efi \
> > +	CC=gcc \
> > +	TARGET_CC=/opt/gcc-${TCVER}-nolibc/loongarch64-linux/bin/loongarch64-linux-gcc \
> > +	TARGET_OBJCOPY=/opt/gcc-${TCVER}-nolibc/loongarch64-linux/bin/loongarch64-linux-objcopy \
> > +	TARGET_STRIP=/opt/gcc-${TCVER}-nolibc/loongarch64-linux/bin/loongarch64-linux-strip \
> > +	TARGET_NM=/opt/gcc-${TCVER}-nolibc/loongarch64-linux/bin/loongarch64-linux-nm \
> > +	TARGET_RANLIB=/opt/gcc-${TCVER}-nolibc/loongarch64-linux/bin/loongarch64-linux-ranlib && \
> > +	make -j$(nproc) && \
> > +	./grub-mkimage -O loongarch64-efi -o /opt/grub/grubloongarch64.efi --prefix= -d \
> > +	grub-core cat chain configfile echo efinet ext2 fat halt help linux \
> > +	lsefisystab loadenv lvm minicmd normal part_msdos part_gpt reboot \
> > +	search search_fs_file search_fs_uuid search_label serial sleep test \
> > +	true && \
> > +	make clean && \
> 
> We repeat ourselves a lot in the Dockerfile for building grub.
> 
> How about:
> 
> for arch in aarch64, i386, loongarch64, riscv64, x86_64; do
> 	./configure --target=$arch --with-platform=efi \
> 	CC=gcc \
> 	TARGET_CC=/opt/gcc-${TCVER}-nolibc/$arch-linux/bin/loongarch64-linux-gcc \
> 	TARGET_OBJCOPY=/opt/gcc-${TCVER}-nolibc/$arch-linux/bin/loongarch64-linux-objcopy \
> 	TARGET_STRIP=/opt/gcc-${TCVER}-nolibc/$arch-linux/bin/loongarch64-linux-strip \
> 	TARGET_NM=/opt/gcc-${TCVER}-nolibc/$arch-linux/bin/loongarch64-linux-nm \
> 	TARGET_RANLIB=/opt/gcc-${TCVER}-nolibc/$arch-linux/bin/loongarch64-linux-ranlib && \
> 	make -j$(nproc) && \
> 	./grub-mkimage -O $arch -o /opt/grub/grubloongarch64.efi --prefix= -d \
> 	grub-core cat chain configfile echo efinet ext2 fat halt help linux \
> 	lsefi lsefimmap lsefisystab loadenv lvm minicmd normal part_msdos part_gpt
> reboot \
> 	search search_fs_file search_fs_uuid search_label serial sleep test tftp \
> 	true && \
> done
> 
> Adding a few more modules to each architecture does not harm.

This is a good idea, but some of grub file names don't match the arch name
in the triple,

- i386: grub_x86.efi
- x86_64: grub_x64.efi
- arm: grubarm.efi
- aarch64: grubaa64.efi
- riscv64: grubriscv64.efi
- loongarch64: grubloongarch64.efi

so we need a mapping between them, maybe a bash array. Or, these names
seem to be refered only in u-boot-test-hooks as
env__efi_loader_grub_file, so I think alternatively we could update the
repository to use file names consistent with the tripple.

I'd prefer the latter since it looks cleaner, though the change might be
a little complex to fit in this series (involving updating workflow and
u-boot-test-hooks in a correct order so no CI run gets broken).

Best regards,
Yao Zi

> Best regards
> 
> Heinrich
> 
> >   	grub_cv_cc_mcmodel=no ./configure --target=riscv64 --with-platform=efi \
> >   	CC=gcc \
> >   	TARGET_CC=/opt/gcc-${TCVER}-nolibc/riscv64-linux/bin/riscv64-linux-gcc \
> > @@ -232,7 +247,7 @@ RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \
> >   	# config user.name and user.email to make 'git am' happy
> >   	git config user.name u-boot && \
> >   	git config user.email u-boot@denx.de && \
> > -	./configure --prefix=/opt/qemu --target-list="aarch64-softmmu,arm-softmmu,i386-softmmu,m68k-softmmu,mips-softmmu,mips64-softmmu,mips64el-softmmu,mipsel-softmmu,ppc-softmmu,riscv32-softmmu,riscv64-softmmu,sh4-softmmu,x86_64-softmmu,xtensa-softmmu" && \
> > +	./configure --prefix=/opt/qemu --target-list="aarch64-softmmu,arm-softmmu,i386-softmmu,loongarch64-softmmu,m68k-softmmu,mips-softmmu,mips64-softmmu,mips64el-softmmu,mipsel-softmmu,ppc-softmmu,riscv32-softmmu,riscv64-softmmu,sh4-softmmu,x86_64-softmmu,xtensa-softmmu" && \
> >   	make -j$(nproc) all install && \
> >   	rm -rf /tmp/qemu
> 

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

* Re: [PATCH v2 2/2] CI: Dockerfile: Add LoongArch64 support
  2026-07-31 14:36     ` [PATCH v2 2/2] CI: Dockerfile: Add LoongArch64 support Yao Zi
@ 2026-07-31 14:53       ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2026-07-31 14:53 UTC (permalink / raw)
  To: Yao Zi; +Cc: Heinrich Schuchardt, Jiaxun Yang, u-boot

[-- Attachment #1: Type: text/plain, Size: 4977 bytes --]

On Fri, Jul 31, 2026 at 02:36:51PM +0000, Yao Zi wrote:
> Adding the list to Cc so at least this discussion could be archived...
> 
> On Fri, Jul 31, 2026 at 04:16:38PM +0200, Heinrich Schuchardt wrote:
> > On 7/31/26 13:47, Yao Zi wrote:
> > > From: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > > 
> > > Install LoongArch64 toolchains, build LoongArch64 QEMU,
> > > build LoongArch64 GRUB.
> > > 
> > > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > > Signed-off-by: Yao Zi <me@ziyao.cc>
> > > ---
> > >   tools/docker/Dockerfile | 21 ++++++++++++++++++---
> > >   1 file changed, 18 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
> > > index fb8e2c523aad..187320c26d59 100644
> > > --- a/tools/docker/Dockerfile
> > > +++ b/tools/docker/Dockerfile
> > > @@ -17,7 +17,7 @@ ARG BUILDPLATFORM
> > >   ENV DEBIAN_FRONTEND=noninteractive
> > >   # Set architectures to build for (leaving out ARM which is an exception)
> > > -ENV ARCHS="aarch64 arc i386 m68k mips microblaze nios2 powerpc riscv64 riscv32 sh2 x86_64"
> > > +ENV ARCHS="aarch64 arc i386 loongarch64 m68k mips microblaze nios2 powerpc riscv64 riscv32 sh2 x86_64"
> > >   # Mirror containing the toolchains
> > >   ENV MIRROR=https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin
> > > @@ -153,7 +153,8 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
> > >   	xxd \
> > >   	zip
> > > -# Build GRUB UEFI targets for ARM & RISC-V, 32-bit and 64-bit
> > > +# Build GRUB UEFI targets for ARM & RISC-V, 32-bit and 64-bit, and LoongArch
> > > +# 64-bit
> > >   RUN git clone https://https.git.savannah.gnu.org/git/grub.git /tmp/grub && \
> > >   	cd /tmp/grub && \
> > >   	git checkout grub-2.14 && \
> > > @@ -189,6 +190,20 @@ RUN git clone https://https.git.savannah.gnu.org/git/grub.git /tmp/grub && \
> > >   	search search_fs_file search_fs_uuid search_label serial sleep test \
> > >   	true && \
> > >   	make clean && \
> > > +	./configure --target=loongarch64 --with-platform=efi \
> > > +	CC=gcc \
> > > +	TARGET_CC=/opt/gcc-${TCVER}-nolibc/loongarch64-linux/bin/loongarch64-linux-gcc \
> > > +	TARGET_OBJCOPY=/opt/gcc-${TCVER}-nolibc/loongarch64-linux/bin/loongarch64-linux-objcopy \
> > > +	TARGET_STRIP=/opt/gcc-${TCVER}-nolibc/loongarch64-linux/bin/loongarch64-linux-strip \
> > > +	TARGET_NM=/opt/gcc-${TCVER}-nolibc/loongarch64-linux/bin/loongarch64-linux-nm \
> > > +	TARGET_RANLIB=/opt/gcc-${TCVER}-nolibc/loongarch64-linux/bin/loongarch64-linux-ranlib && \
> > > +	make -j$(nproc) && \
> > > +	./grub-mkimage -O loongarch64-efi -o /opt/grub/grubloongarch64.efi --prefix= -d \
> > > +	grub-core cat chain configfile echo efinet ext2 fat halt help linux \
> > > +	lsefisystab loadenv lvm minicmd normal part_msdos part_gpt reboot \
> > > +	search search_fs_file search_fs_uuid search_label serial sleep test \
> > > +	true && \
> > > +	make clean && \
> > 
> > We repeat ourselves a lot in the Dockerfile for building grub.
> > 
> > How about:
> > 
> > for arch in aarch64, i386, loongarch64, riscv64, x86_64; do
> > 	./configure --target=$arch --with-platform=efi \
> > 	CC=gcc \
> > 	TARGET_CC=/opt/gcc-${TCVER}-nolibc/$arch-linux/bin/loongarch64-linux-gcc \
> > 	TARGET_OBJCOPY=/opt/gcc-${TCVER}-nolibc/$arch-linux/bin/loongarch64-linux-objcopy \
> > 	TARGET_STRIP=/opt/gcc-${TCVER}-nolibc/$arch-linux/bin/loongarch64-linux-strip \
> > 	TARGET_NM=/opt/gcc-${TCVER}-nolibc/$arch-linux/bin/loongarch64-linux-nm \
> > 	TARGET_RANLIB=/opt/gcc-${TCVER}-nolibc/$arch-linux/bin/loongarch64-linux-ranlib && \
> > 	make -j$(nproc) && \
> > 	./grub-mkimage -O $arch -o /opt/grub/grubloongarch64.efi --prefix= -d \
> > 	grub-core cat chain configfile echo efinet ext2 fat halt help linux \
> > 	lsefi lsefimmap lsefisystab loadenv lvm minicmd normal part_msdos part_gpt
> > reboot \
> > 	search search_fs_file search_fs_uuid search_label serial sleep test tftp \
> > 	true && \
> > done
> > 
> > Adding a few more modules to each architecture does not harm.
> 
> This is a good idea, but some of grub file names don't match the arch name
> in the triple,
> 
> - i386: grub_x86.efi
> - x86_64: grub_x64.efi
> - arm: grubarm.efi
> - aarch64: grubaa64.efi
> - riscv64: grubriscv64.efi
> - loongarch64: grubloongarch64.efi
> 
> so we need a mapping between them, maybe a bash array. Or, these names
> seem to be refered only in u-boot-test-hooks as
> env__efi_loader_grub_file, so I think alternatively we could update the
> repository to use file names consistent with the tripple.
> 
> I'd prefer the latter since it looks cleaner, though the change might be
> a little complex to fit in this series (involving updating workflow and
> u-boot-test-hooks in a correct order so no CI run gets broken).

This sounds like a good cleanup to do, but yes, we should work it
afterwards to keep this small and reviewable.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

end of thread, other threads:[~2026-07-31 14:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260731114720.2212170-1-me@ziyao.cc>
     [not found] ` <20260731114720.2212170-3-me@ziyao.cc>
     [not found]   ` <23f5f012-589c-4710-8b93-4c6bd509e4c4@gmx.de>
2026-07-31 14:36     ` [PATCH v2 2/2] CI: Dockerfile: Add LoongArch64 support Yao Zi
2026-07-31 14:53       ` Tom Rini

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.