Skip to contentSkip to conversation

Dockerfile: Install riscv32 toolchain from kernel.org

PATCH New Bin Meng 2 participants 14 messages Mar 26, 2020 – Apr 10, 2020

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/3 Dockerfile: Install riscv32 toolchain from kernel.org

This is required to build GRUB UEFI target for RISC-V 32-bit.

---

 Dockerfile | 1 +
 1 file changed, 1 insertion(+)
Dockerfile +1 -0
index 32d43f7..dc9d6c9 100644
@@ -23,6 +23,7 @@ RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_
 RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/7.3.0/x86_64-gcc-7.3.0-nolibc_microblaze-linux.tar.xz | tar -C /opt -xJ
 RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/7.3.0/x86_64-gcc-7.3.0-nolibc_nios2-linux.tar.xz | tar -C /opt -xJ
 RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/7.3.0/x86_64-gcc-7.3.0-nolibc_powerpc-linux.tar.xz | tar -C /opt -xJ
+RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/7.3.0/x86_64-gcc-7.3.0-nolibc_riscv32-linux.tar.xz | tar -C /opt -xJ
 RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/7.3.0/x86_64-gcc-7.3.0-nolibc_riscv64-linux.tar.xz | tar -C /opt -xJ
 RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/7.3.0/x86_64-gcc-7.3.0-nolibc_sh2-linux.tar.xz | tar -C /opt -xJ
 
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 2/3 Dockerfile: Build GRUB UEFI target for RISC-V 32-bit

Build GRUB UEFI target grubriscv32.efi.

---

 Dockerfile | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
Dockerfile +15 -1
index dc9d6c9..a19067e 100644
@@ -96,7 +96,7 @@ RUN wget http://mirrors.kernel.org/ubuntu/pool/main/m/mpfr4/libmpfr4_3.1.4-1_amd
 # Manually install a new enough version of efitools (must be v1.5.2 or later)
 RUN wget http://mirrors.kernel.org/ubuntu/pool/universe/e/efitools/efitools_1.8.1-0ubuntu2_amd64.deb && sudo dpkg -i efitools_1.8.1-0ubuntu2_amd64.deb && rm efitools_1.8.1-0ubuntu2_amd64.deb
 
-# Build GRUB UEFI targets grubarm.efi and grubaa64.efi
+# Build GRUB UEFI targets for ARM & RISC-V, 32-bit and 64-bit
 RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \
 	cd /tmp/grub && \
 	git checkout grub-2.04 && \
@@ -143,6 +143,20 @@ RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \
 	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 && \
+	./configure --target=riscv32 --with-platform=efi \
+	CC=gcc \
+	TARGET_CC=/opt/gcc-7.3.0-nolibc/riscv32-linux/bin/riscv32-linux-gcc \
+	TARGET_OBJCOPY=/opt/gcc-7.3.0-nolibc/riscv32-linux/bin/riscv32-linux-objcopy \
+	TARGET_STRIP=/opt/gcc-7.3.0-nolibc/riscv32-linux/bin/riscv32-linux-strip \
+	TARGET_NM=/opt/gcc-7.3.0-nolibc/riscv32-linux/bin/riscv32-linux-nm \
+	TARGET_RANLIB=/opt/gcc-7.3.0-nolibc/riscv32-linux/bin/riscv32-linux-ranlib && \
+	make && \
+	./grub-mkimage -O riscv32-efi -o /opt/grub/grubriscv32.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 && \
 	rm -rf /tmp/grub
 
 RUN git clone git://git.qemu.org/qemu.git /tmp/qemu && \
Signature · 1 line
2.7.4
Applied
#2 lore raw

PATCH 2/3 Dockerfile: Build GRUB UEFI target for RISC-V 32-bit

Quoted 3 lines · Bin Meng

Build GRUB UEFI target grubriscv32.efi.

Applied to gitlab-ci-runner/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200410/f87512d1/attachment.sig>
author
#3 lore raw

PATCH 3/3 Dockerfile: Build QEMU for RISC-V 32-bit

In reply to Bin Meng

Build qemu-system-riscv32 executable for U-Boot testing.

---

 Dockerfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Dockerfile +1 -1
index a19067e..3a94eb4 100644
@@ -163,7 +163,7 @@ RUN git clone git://git.qemu.org/qemu.git /tmp/qemu && \
 	cd /tmp/qemu && \
 	git submodule update --init dtc && \
 	git checkout v4.2.0 && \
-	./configure --prefix=/opt/qemu --target-list="aarch64-softmmu,arm-softmmu,i386-softmmu,mips-softmmu,mips64-softmmu,mips64el-softmmu,mipsel-softmmu,ppc-softmmu,riscv64-softmmu,x86_64-softmmu,xtensa-softmmu" && \
+	./configure --prefix=/opt/qemu --target-list="aarch64-softmmu,arm-softmmu,i386-softmmu,mips-softmmu,mips64-softmmu,mips64el-softmmu,mipsel-softmmu,ppc-softmmu,riscv32-softmmu,riscv64-softmmu,x86_64-softmmu,xtensa-softmmu" && \
 	make -j$(nproc) all install && \
 	rm -rf /tmp/qemu
 
Signature · 1 line
2.7.4
Applied
#4 lore raw

PATCH 3/3 Dockerfile: Build QEMU for RISC-V 32-bit

Quoted 3 lines · Bin Meng

Build qemu-system-riscv32 executable for U-Boot testing.

Applied to gitlab-ci-runner/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200410/713f3e04/attachment.sig>
#5 lore raw

PATCH 1/3 Dockerfile: Install riscv32 toolchain from kernel.org

In reply to Bin Meng
Quoted 3 lines · Bin Meng

This is required to build GRUB UEFI target for RISC-V 32-bit.

Since we can use the 64bit toolchain for 32bit U-Boot, can we not pass GRUB the right flags to use the same toolchain? Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200326/a03f3a66/attachment.sig>
author
#6 lore raw

PATCH 1/3 Dockerfile: Install riscv32 toolchain from kernel.org

Hi Tom,

Quoted 10 lines · Tom Rini
Quoted 3 lines · Bin Meng

This is required to build GRUB UEFI target for RISC-V 32-bit.

Since we can use the 64bit toolchain for 32bit U-Boot, can we not pass GRUB the right flags to use the same toolchain? Thanks!

The 32-bit GRUB won't build with the 64-bit toolchain as of the grub-2.04 branch we are using.

Regards,
Bin

#7 lore raw

PATCH 1/3 Dockerfile: Install riscv32 toolchain from kernel.org

Quoted 8 lines · Bin Meng

Hi Tom,

Quoted 5 lines · Tom Rini
Quoted 2 lines · Bin Meng

This is required to build GRUB UEFI target for RISC-V 32-bit.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Since we can use the 64bit toolchain for 32bit U-Boot, can we not pass GRUB the right flags to use the same toolchain? Thanks!

The 32-bit GRUB won't build with the 64-bit toolchain as of the grub-2.04 branch we are using.

Is that something that upstream has fixed or will fix / can be fixed and we can bump the tag we're using for?

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200326/8a31410c/attachment.sig>
author
#8 lore raw

PATCH 1/3 Dockerfile: Install riscv32 toolchain from kernel.org

Hi Tom,

Quoted 12 lines · Tom Rini
Quoted 10 lines · Bin Meng

Hi Tom,

Quoted 7 lines · Tom Rini
Quoted 3 lines · Bin Meng

This is required to build GRUB UEFI target for RISC-V 32-bit.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Since we can use the 64bit toolchain for 32bit U-Boot, can we not pass GRUB the right flags to use the same toolchain? Thanks!

The 32-bit GRUB won't build with the 64-bit toolchain as of the grub-2.04 branch we are using.

Is that something that upstream has fixed or will fix / can be fixed and we can bump the tag we're using for?

I tried the latest upstream GRUB, and it still cannot be built using riscv64 toolchain from kernel.org.

Regards,
Bin

#9 lore raw

PATCH 1/3 Dockerfile: Install riscv32 toolchain from kernel.org

Quoted 18 lines · Bin Meng

Hi Tom,

Quoted 15 lines · Tom Rini
Quoted 13 lines · Bin Meng

Hi Tom,

Quoted 9 lines · Tom Rini
Quoted 3 lines · Bin Meng

This is required to build GRUB UEFI target for RISC-V 32-bit.

Since we can use the 64bit toolchain for 32bit U-Boot, can we not pass GRUB the right flags to use the same toolchain? Thanks!

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

The 32-bit GRUB won't build with the 64-bit toolchain as of the grub-2.04 branch we are using.

Is that something that upstream has fixed or will fix / can be fixed and we can bump the tag we're using for?

I tried the latest upstream GRUB, and it still cannot be built using riscv64 toolchain from kernel.org.

Can that be fixed? Would that be accepted? Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200327/35a70684/attachment.sig>
author
#10 lore raw

PATCH 1/3 Dockerfile: Install riscv32 toolchain from kernel.org

Hi Tom,

Quoted 23 lines · Tom Rini
Quoted 21 lines · Bin Meng

Hi Tom,

Quoted 18 lines · Tom Rini
Quoted 15 lines · Bin Meng

Hi Tom,

Quoted 9 lines · Tom Rini
Quoted 3 lines · Bin Meng

This is required to build GRUB UEFI target for RISC-V 32-bit.

Since we can use the 64bit toolchain for 32bit U-Boot, can we not pass GRUB the right flags to use the same toolchain? Thanks!

The 32-bit GRUB won't build with the 64-bit toolchain as of the grub-2.04 branch we are using.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Is that something that upstream has fixed or will fix / can be fixed and we can bump the tag we're using for?

I tried the latest upstream GRUB, and it still cannot be built using riscv64 toolchain from kernel.org.

Can that be fixed? Would that be accepted? Thanks!

I reported this issue to the grub mailing list. For now I believe we should stick to current 2.04 until upstream has a solution for it.

Regards,
Bin

#11 lore raw

PATCH 1/3 Dockerfile: Install riscv32 toolchain from kernel.org

Quoted 29 lines · Bin Meng

Hi Tom,

Quoted 26 lines · Tom Rini
Quoted 24 lines · Bin Meng

Hi Tom,

Quoted 20 lines · Tom Rini
Quoted 8 lines · Bin Meng

Hi Tom,

Quoted 5 lines · Tom Rini
Quoted 2 lines · Bin Meng

This is required to build GRUB UEFI target for RISC-V 32-bit.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Since we can use the 64bit toolchain for 32bit U-Boot, can we not pass GRUB the right flags to use the same toolchain? Thanks!

The 32-bit GRUB won't build with the 64-bit toolchain as of the grub-2.04 branch we are using.

Is that something that upstream has fixed or will fix / can be fixed and we can bump the tag we're using for?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I tried the latest upstream GRUB, and it still cannot be built using riscv64 toolchain from kernel.org.

Can that be fixed? Would that be accepted? Thanks!

I reported this issue to the grub mailing list. For now I believe we should stick to current 2.04 until upstream has a solution for it.

Has upstream said anything here? Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200331/41252a06/attachment.sig>
author
#12 lore raw

PATCH 1/3 Dockerfile: Install riscv32 toolchain from kernel.org

Quoted 34 lines · Tom Rini
Quoted 32 lines · Bin Meng

Hi Tom,

Quoted 29 lines · Tom Rini
Quoted 26 lines · Bin Meng

Hi Tom,

Quoted 12 lines · Tom Rini
Quoted 10 lines · Bin Meng

Hi Tom,

Quoted 7 lines · Tom Rini
Quoted 3 lines · Bin Meng

This is required to build GRUB UEFI target for RISC-V 32-bit.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Since we can use the 64bit toolchain for 32bit U-Boot, can we not pass GRUB the right flags to use the same toolchain? Thanks!

The 32-bit GRUB won't build with the 64-bit toolchain as of the grub-2.04 branch we are using.

Is that something that upstream has fixed or will fix / can be fixed and we can bump the tag we're using for?

I tried the latest upstream GRUB, and it still cannot be built using riscv64 toolchain from kernel.org.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Can that be fixed? Would that be accepted? Thanks!

I reported this issue to the grub mailing list. For now I believe we should stick to current 2.04 until upstream has a solution for it.

Has upstream said anything here? Thanks!

There are some comments but no help. So far I think we should go with current solution and wait grub upstream for the solution.

Regards,
Bin

Applied
#13 lore raw

PATCH 1/3 Dockerfile: Install riscv32 toolchain from kernel.org

In reply to Bin Meng
Quoted 3 lines · Bin Meng

This is required to build GRUB UEFI target for RISC-V 32-bit.

Applied to gitlab-ci-runner/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200410/4b54303f/attachment.sig>