Add support for Kendryte K210 RISC-V boards
v2 cover Add support for Kendryte K210 RISC-V boards
This patch series adds support for building bootable images for RISC-V boards based on the Kendryte K210 SoC which is supported by the Linux kernel since version 5.8.0. This SoC has no MMU supported by Linux and requires uClibc flatbin binaries as gcc does not yet support FDPIC executables for RISC-V.
The first four patches adjust buildroot configuration to allow building uClibc static no-MMU libraries for RISC-V. The last and fifth patch adds buildroot defconfig for the Kendryte K210 as well as uClibc and busybox configuration.
Building is as simple as:
make kendryte_k210_defconfig
make
Which generate the output/image/loader.bin bootable image.
The result using a SiPeed Dan Dock board is:
[ 0.000000] Linux version 5.8.0 (damien at localhost.localdomain) (riscv64-buildroot-linux-uclibc-gcc.br_real (Buildroot 2020.08-332-g6a6dcd0c4b) 9.3.0, GNU ld (GNU Binutils) 2.32) #6 SMP Tue Sep 8 20:21:30 JST 2020 [ 0.000000] earlycon: sifive0 at MMIO 0x0000000038000000 (options '') [ 0.000000] printk: bootconsole [sifive0] enabled [ 0.000000] Zone ranges: [ 0.000000] DMA32 [mem 0x0000000080000000-0x00000000807fffff] [ 0.000000] Normal empty [ 0.000000] Movable zone start for each node [ 0.000000] Early memory node ranges [ 0.000000] node 0: [mem 0x0000000080000000-0x00000000807fffff] [ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000000807fffff] [ 0.000000] riscv: ISA extensions acdfim [ 0.000000] riscv: ELF capabilities acdfim [ 0.000000] percpu: max_distance=0x18000 too large for vmalloc space 0x0 [ 0.000000] percpu: Embedded 12 pages/cpu s18336 r0 d30816 u49152 [ 0.000000] Built 1 zonelists, mobility grouping off. Total pages: 2020 [ 0.000000] Kernel command line: earlycon console=ttySIF0 [ 0.000000] Dentry cache hash table entries: 1024 (order: 1, 8192 bytes, linear) [ 0.000000] Inode-cache hash table entries: 512 (order: 0, 4096 bytes, linear) [ 0.000000] Sorting __ex_table... [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off [ 0.000000] Memory: 6328K/8192K available (939K kernel code, 119K rwdata, 169K rodata, 289K init, 97K bss, 1864K reserved, 0K cma-reserved) [ 0.000000] rcu: Hierarchical RCU implementation. [ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. [ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 [ 0.000000] riscv-intc: 64 local interrupts mapped [ 0.000000] plic: interrupt-controller at c000000: mapped 65 interrupts with 2 handlers for 4 contexts. [ 0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [0] [ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x3990be68b, max_idle_ns: 881590404272 ns [ 0.000014] sched_clock: 64 bits at 7MHz, resolution 128ns, wraps every 4398046511054ns [ 0.008242] Console: colour dummy device 80x25 [ 0.012480] Calibrating delay loop (skipped), value calculated using timer frequency.. 15.60 BogoMIPS (lpj=31200) [ 0.022682] pid_max: default: 4096 minimum: 301 [ 0.027300] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear) [ 0.034416] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear) [ 0.044878] rcu: Hierarchical SRCU implementation. [ 0.049777] smp: Bringing up secondary CPUs ... [ 0.055056] smp: Brought up 1 node, 2 CPUs [ 0.059453] devtmpfs: initialized [ 0.065614] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns [ 0.074637] futex hash table entries: 16 (order: -2, 1024 bytes, linear) [ 0.084149] Kendryte K210 SoC sysctl [ 0.097621] clocksource: Switched to clocksource riscv_clocksource [ 0.229791] workingset: timestamp_bits=62 max_order=11 bucket_order=0 [ 0.237036] 38000000.serial: ttySIF0 at MMIO 0x38000000 (irq = 1, base_baud = 0) is a SiFive UART v0 [ 0.245617] printk: console [ttySIF0] enabled [ 0.245617] printk: console [ttySIF0] enabled [ 0.254118] printk: bootconsole [sifive0] disabled [ 0.254118] printk: bootconsole [sifive0] disabled [ 0.266224] random: get_random_bytes called from 0x000000008004e75c with crng_init=0 [ 0.274702] Freeing unused kernel memory: 288K [ 0.278417] This architecture does not have kernel memory protection. [ 0.284857] Run /init as init process
+---------------------------+ | Kendryte K210 NOMMU Linux | +---------------------------+
/ # cat /proc/cpuinfo
processor : 0
hart : 0
isa : rv64imafdc
uarch : kendryte,k210
processor : 1
hart : 1
isa : rv64imafdc
uarch : kendryte,k210
/ #
These patches are also available at
git at github.com:damien-lemoal/buildroot.git
(https://github.com/damien-lemoal/buildroot)
Changes from v1:
* Replace uclinux with linux in toolchain tuple name only for RISC-V (patch 4).
* Moved uclibc patches under package/uclibc (new patch 5)
* Simplified board specific support (patch 6):
- Dropped board specific uclibc configuration. Usinf default uclibc.config now.
- Removed board specific device table
- Removed fakeroot.sh script
- Reworked rootfs overlay init script to be similar to fs/cpio/init
- Added the README.txt file to document builds
Christoph Hellwig (2):
package/elf2flt: add RISC-V support package make: build RISC-V nommu builds as linux
Damien Le Moal (4):
toolchain/buildroot: allow uclibc-ng for riscv arch/config: Make RISC-V MMU optional package/uclibc: fix compilation errors
board: Add configuration for Kendryte K210 boards
arch/Config.in | 2 +- board/kendryte/k210/README.txt | 28 + board/kendryte/k210/busybox.config | 1178 +++++++++++++++++ board/kendryte/k210/rootfs_overlay/init | 24 + configs/kendryte_k210_defconfig | 24 + package/Makefile.in | 7 +- .../0002-elf2flt-add-riscv-support.patch | 302 +++++ package/elf2flt/Config.in.host | 2 +- ...evert-Fix-static-linking-with-GCC-10.patch | 43 + ...0002-fix-static-builds-with-gcc-10.x.patch | 25 + ...-utils-getconf-Fix-compilation-error.patch | 103 ++ .../0004-librt-avoid-compilation-error.patch | 42 + package/uclibc/Config.in | 2 + toolchain/toolchain-buildroot/Config.in | 4 +- 14 files changed, 1782 insertions(+), 4 deletions(-) create mode 100644 board/kendryte/k210/README.txt create mode 100644 board/kendryte/k210/busybox.config create mode 100755 board/kendryte/k210/rootfs_overlay/init create mode 100644 configs/kendryte_k210_defconfig create mode 100644 package/elf2flt/0002-elf2flt-add-riscv-support.patch create mode 100644 package/uclibc/0001-Revert-Fix-static-linking-with-GCC-10.patch create mode 100644 package/uclibc/0002-fix-static-builds-with-gcc-10.x.patch create mode 100644 package/uclibc/0003-utils-getconf-Fix-compilation-error.patch create mode 100644 package/uclibc/0004-librt-avoid-compilation-error.patch
Signature · 1 line
2.26.2
PATCH v2 1/6 toolchain/buildroot: allow uclibc-ng for riscv
uclibcb supports RISC-V architecture since version 1.0.31. Allow its selection for that architecture.
--- package/uclibc/Config.in | 2 ++ toolchain/toolchain-buildroot/Config.in | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-)
package/uclibc/Config.in +2 -0
@@ -106,6 +106,8 @@ config BR2_UCLIBC_TARGET_ARCH default "xtensa" if BR2_xtensa default "i386" if BR2_i386 default "x86_64" if BR2_x86_64 + default "riscv64" if BR2_riscv && BR2_ARCH_IS_64 + default "riscv32" if BR2_riscv && !BR2_ARCH_IS_6 config BR2_UCLIBC_MIPS_ABI string
toolchain/toolchain-buildroot/Config.in +3 -1
@@ -32,7 +32,9 @@ config BR2_TOOLCHAIN_BUILDROOT_UCLIBC BR2_i386 || BR2_m68k || BR2_microblaze || \ BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el || \ BR2_or1k || BR2_powerpc || BR2_sh2a || BR2_sh4 || \ - BR2_sh4eb || BR2_sparc || BR2_xtensa || BR2_x86_64 + BR2_sh4eb || BR2_sparc || BR2_xtensa || BR2_x86_64 || \ + BR2_riscv + select BR2_TOOLCHAIN_USES_UCLIBC help This option selects uClibc-ng as the C library for the
Signature · 1 line
2.26.2
PATCH v2 1/6 toolchain/buildroot: allow uclibc-ng for riscv
Damien, All,
+Petr in Cc as he's working on a the same topic:
https://patchwork.ozlabs.org/project/buildroot/patch/20200908145346.198693-1-petr.vorel at gmail.com/
On 2020-09-08 20:33 +0900, Damien Le Moal spake thusly:
Quoted 5 lines
uclibcb supports RISC-V architecture since version 1.0.31. Allow its selection for that architecture.
Signed-off-by Damien Le Moal <[email protected]>---
[--SNIP--]
toolchain/toolchain-buildroot/Config.in config BR2_TOOLCHAIN_BUILDROOT_UCLIBC · line 36
Quoted 11 lines
toolchain/toolchain-buildroot/Config.in +2
-1@@ -32,7 +32,9 @@ config BR2_TOOLCHAIN_BUILDROOT_UCLIBC BR2_i386 || BR2_m68k || BR2_microblaze || \ BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el || \ BR2_or1k || BR2_powerpc || BR2_sh2a || BR2_sh4 || \ - BR2_sh4eb || BR2_sparc || BR2_xtensa || BR2_x86_64 + BR2_sh4eb || BR2_sparc || BR2_xtensa || BR2_x86_64 || \ + BR2_riscv
Please keep alphabetical ordeing in the architecture list, i.e. riscv goes between BR2_powerpc and BR2_sh2a
But as I said to Petr, I guess cleanup the layout of that list would be OK in a separate, preparatory patch, which would make it easier to properly add riscv in the correct place.
Regards,
Yann E. MORIN.
Quoted 10 lines
toolchain/toolchain-buildroot/Config.in +0
-0select BR2_TOOLCHAIN_USES_UCLIBC help This option selects uClibc-ng as the C library for theSignature · 6 lines
2.26.2 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v2 1/6 toolchain/buildroot: allow uclibc-ng for riscv
In reply to Damien Le MoalHello,
package/uclibc/Config.in config BR2_UCLIBC_TARGET_ARCH · line 110
Quoted 10 lines · On Tue, 8 Sep 2020 20:33:19 +0900 Damien Le Moal <[email protected]> wrote:
package/uclibc/Config.in +2
-0@@ -106,6 +106,8 @@ config BR2_UCLIBC_TARGET_ARCH default "xtensa" if BR2_xtensa default "i386" if BR2_i386 default "x86_64" if BR2_x86_64 + default "riscv64" if BR2_riscv && BR2_ARCH_IS_64 + default "riscv32" if BR2_riscv && !BR2_ARCH_IS_6
There was a typo here: BR2_ARCH_IS_6 was truncated.
toolchain/toolchain-buildroot/Config.in config BR2_TOOLCHAIN_BUILDROOT_UCLIBC · line 36
Quoted 11 lines
toolchain/toolchain-buildroot/Config.in +2
-1@@ -32,7 +32,9 @@ config BR2_TOOLCHAIN_BUILDROOT_UCLIBC BR2_i386 || BR2_m68k || BR2_microblaze || \ BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el || \ BR2_or1k || BR2_powerpc || BR2_sh2a || BR2_sh4 || \ - BR2_sh4eb || BR2_sparc || BR2_xtensa || BR2_x86_64 + BR2_sh4eb || BR2_sparc || BR2_xtensa || BR2_x86_64 || \ + BR2_riscv
I fixed the alphabetic ordering.
toolchain/toolchain-buildroot/Config.in config BR2_TOOLCHAIN_BUILDROOT_UCLIBC · line 37
Quoted 1 line
toolchain/toolchain-buildroot/Config.in +1
-0+
Dropped the empty new line.
And applied with some small improvements to the commit log as well.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v2 1/6 toolchain/buildroot: allow uclibc-ng for riscv
Quoted 5 lines · Thomas Petazzoni
Hello,
On Tue, 8 Sep 2020 20:33:19 +0900
Damien Le Moal <[email protected]> wrote:
Quoted 12 lines
package/uclibc/Config.in config BR2_UCLIBC_TARGET_ARCH · line 110
Quoted 10 lines
package/uclibc/Config.in +2
-0@@ -106,6 +106,8 @@ config BR2_UCLIBC_TARGET_ARCH default "xtensa" if BR2_xtensa default "i386" if BR2_i386 default "x86_64" if BR2_x86_64 + default "riscv64" if BR2_riscv && BR2_ARCH_IS_64 + default "riscv32" if BR2_riscv && !BR2_ARCH_IS_6There was a typo here:
BR2_ARCH_IS_6was truncated.
Oops. Sorry about that.
Quoted 15 lines
toolchain/toolchain-buildroot/Config.in config BR2_TOOLCHAIN_BUILDROOT_UCLIBC · line 36
Quoted 12 lines
toolchain/toolchain-buildroot/Config.in +2
-1@@ -32,7 +32,9 @@ config BR2_TOOLCHAIN_BUILDROOT_UCLIBC BR2_i386 || BR2_m68k || BR2_microblaze || \ BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el || \ BR2_or1k || BR2_powerpc || BR2_sh2a || BR2_sh4 || \ - BR2_sh4eb || BR2_sparc || BR2_xtensa || BR2_x86_64 + BR2_sh4eb || BR2_sparc || BR2_xtensa || BR2_x86_64 || \ + BR2_riscvI fixed the alphabetic ordering.
Quoted 5 lines
toolchain/toolchain-buildroot/Config.in config BR2_TOOLCHAIN_BUILDROOT_UCLIBC · line 37
Quoted 1 line
toolchain/toolchain-buildroot/Config.in +1
-0+Dropped the empty new line.
And applied with some small improvements to the commit log as well.
Thanks for fixing these !
Quoted 5 lines
Thanks!
Thomas
Signature · 2 lines
Damien Le Moal Western Digital Research
PATCH v2 1/6 toolchain/buildroot: allow uclibc-ng for riscv
In reply to Thomas PetazzoniHello Damien,
Quoted 1 line · On Tue, 6 Oct 2020 23:40:12 +0200 Thomas Petazzoni…
And applied with some small improvements to the commit log as well.
So it turns out that the riscv32 uClibc-ng toolchain doesn't build. It fails in the uClibc-ng build with:
In file included from ./include/sys/procfs.h:34,
from ./libpthread/nptl/../nptl_db/thread_db.h:28,
from ./libpthread/nptl/descr.h:30,
from ./libpthread/nptl/pthreadP.h:25,
from <stdin>:2:
./include/sys/user.h:32:3: error: unknown type name '__uint128_t'
32 | __uint128_t vregs[32];
| ^~~~~~~~~~~You can see a more complete build log at:
https://gitlab.com/bootlin/toolchains-builder/-/jobs/776340188
The defconfig being built is just:
BR2_riscv=y
BR2_RISCV_32=y
BR2_KERNEL_HEADERS_5_4=y
BR2_TOOLCHAIN_BUILDROOT_LOCALE=y
BR2_PTHREAD_DEBUG=y
BR2_BINUTILS_VERSION_2_34_X=y
BR2_GCC_VERSION_10_X=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_TOOLCHAIN_BUILDROOT_FORTRAN=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_GDB=y
# BR2_TARGET_ROOTFS_TAR is not set
Do you have some idea of what could be wrong here ?
Thanks a lot,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v2 1/6 toolchain/buildroot: allow uclibc-ng for riscv
Quoted 40 lines · Thomas Petazzoni
Hello Damien,
Quoted 1 line · On Tue, 6 Oct 2020 23:40:12 +0200 Thomas Petazzoni…
And applied with some small improvements to the commit log as well.
So it turns out that the riscv32 uClibc-ng toolchain doesn't build. It fails in the uClibc-ng build with:
In file included from
./include/sys/procfs.h:34,from ./libpthread/nptl/../nptl_db/thread_db.h:28, from ./libpthread/nptl/descr.h:30, from ./libpthread/nptl/pthreadP.h:25, from <stdin>:2: ./include/sys/user.h:32:3: error: unknown type name '__uint128_t' 32 | __uint128_t vregs[32]; | ^~~~~~~~~~~You can see a more complete build log at:
https://gitlab.com/bootlin/toolchains-builder/-/jobs/776340188
The defconfig being built is just:
BR2_riscv=y
BR2_RISCV_32=y
BR2_KERNEL_HEADERS_5_4=y
BR2_TOOLCHAIN_BUILDROOT_LOCALE=y
BR2_PTHREAD_DEBUG=y
BR2_BINUTILS_VERSION_2_34_X=y
BR2_GCC_VERSION_10_X=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_TOOLCHAIN_BUILDROOT_FORTRAN=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
#BR2_PACKAGE_BUSYBOXis not set
BR2_PACKAGE_GDB=y
#BR2_TARGET_ROOTFS_TARis not set
Quoted 1 line
Do you have some idea of what could be wrong here ?
No clue. This is very weird since this vregs thing is declared only in libc/sysdeps/linux/aarch64/sys/user.h. So ARM64, not riscv.
The file libc/sysdeps/linux/riscv64/sys/user.h exists but does not use __uint128_t, it is in fact empty. And this file does not exist for riscv32, the entire libc/sysdeps/linux/riscv32 directory does not exist.
Something funky is going on with the arch dependent definitions...
Alistair,
Any idea ?
Quoted 5 lines
Thanks a lot,
Thomas
Signature · 2 lines
Damien Le Moal Western Digital Research
PATCH v2 1/6 toolchain/buildroot: allow uclibc-ng for riscv
Hi,
Uclibc-Ng doesn?t support riscv32!
Best regards
Waldemar
Quoted 74 lines
Am 12.10.2020 um 07:00 schrieb Damien Le Moal <[email protected]>:
Quoted 40 lines · Thomas Petazzoni
Hello Damien,
Quoted 4 lines
On Tue, 6 Oct 2020 23:40:12 +0200
Thomas Petazzoni <[email protected]> wrote:And applied with some small improvements to the commit log as well.
So it turns out that the riscv32 uClibc-ng toolchain doesn't build. It fails in the uClibc-ng build with:
In file included from
./include/sys/procfs.h:34,from ./libpthread/nptl/../nptl_db/thread_db.h:28, from ./libpthread/nptl/descr.h:30, from ./libpthread/nptl/pthreadP.h:25, from <stdin>:2: ./include/sys/user.h:32:3: error: unknown type name '__uint128_t' 32 | __uint128_t vregs[32]; | ^~~~~~~~~~~You can see a more complete build log at:
https://gitlab.com/bootlin/toolchains-builder/-/jobs/776340188
The defconfig being built is just:
BR2_riscv=y
BR2_RISCV_32=y
BR2_KERNEL_HEADERS_5_4=y
BR2_TOOLCHAIN_BUILDROOT_LOCALE=y
BR2_PTHREAD_DEBUG=y
BR2_BINUTILS_VERSION_2_34_X=y
BR2_GCC_VERSION_10_X=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_TOOLCHAIN_BUILDROOT_FORTRAN=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
#BR2_PACKAGE_BUSYBOXis not set
BR2_PACKAGE_GDB=y
#BR2_TARGET_ROOTFS_TARis not setQuoted 1 line
Do you have some idea of what could be wrong here ?
No clue. This is very weird since this vregs thing is declared only in
libc/sysdeps/linux/aarch64/sys/user.h. So ARM64, not riscv.The file
libc/sysdeps/linux/riscv64/sys/user.hexists but does not use__uint128_t, it is in fact empty. And this file does not exist for riscv32, the entire libc/sysdeps/linux/riscv32 directory does not exist.Something funky is going on with the arch dependent definitions...
Alistair,
Any idea ?
Quoted 5 lines
Thanks a lot,
Thomas
Signature · 6 lines
Damien Le Moal Western Digital Research _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
PATCH v2 1/6 toolchain/buildroot: allow uclibc-ng for riscv
Quoted 2 lines · Waldemar Brodkorb
Hi,
Uclibc-Ng doesn?t support riscv32!
That's a simple explanation for the problem :)
Solved !
Thanks.
Thomas,
I think we just need to patch buildroot config to prevent rv32 builds with uclibc. Something like this:
package/uclibc/Config.in +0 -1
@@ -107,7 +107,6 @@ config BR2_UCLIBC_TARGET_ARCH default "i386" if BR2_i386 default "x86_64" if BR2_x86_64 default "riscv64" if BR2_RISCV_64 - default "riscv32" if BR2_RISCV_32 config BR2_UCLIBC_MIPS_ABI string
(quoted diff) +0 -0
b/toolchain/toolchain-buildroot/Config.in
index f34dd84c29..ba2f2cec9b 100644
toolchain/toolchain-buildroot/Config.in +1 -1
@@ -31,7 +31,7 @@ config BR2_TOOLCHAIN_BUILDROOT_UCLIBC BR2_arm || BR2_armeb || \ BR2_i386 || BR2_m68k || BR2_microblaze || \ BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el || \ - BR2_or1k || BR2_powerpc || BR2_riscv || BR2_sh2a || \ + BR2_or1k || BR2_powerpc || BR2_RISCV_64|| BR2_sh2a || \ BR2_sh4 || BR2_sh4eb || BR2_sparc || BR2_xtensa || \ BR2_x86_64 select BR2_TOOLCHAIN_USES_UCLIBC
Totally untested.
Quoted 83 lines
Best regards
WaldemarQuoted 56 lines
Am 12.10.2020 um 07:00 schrieb Damien Le Moal <[email protected]>:
Quoted 40 lines · Thomas Petazzoni
Hello Damien,
Quoted 4 lines
On Tue, 6 Oct 2020 23:40:12 +0200
Thomas Petazzoni <[email protected]> wrote:And applied with some small improvements to the commit log as well.
So it turns out that the riscv32 uClibc-ng toolchain doesn't build. It fails in the uClibc-ng build with:
In file included from
./include/sys/procfs.h:34,from ./libpthread/nptl/../nptl_db/thread_db.h:28, from ./libpthread/nptl/descr.h:30, from ./libpthread/nptl/pthreadP.h:25, from <stdin>:2: ./include/sys/user.h:32:3: error: unknown type name '__uint128_t' 32 | __uint128_t vregs[32]; | ^~~~~~~~~~~You can see a more complete build log at:
https://gitlab.com/bootlin/toolchains-builder/-/jobs/776340188
The defconfig being built is just:
BR2_riscv=y
BR2_RISCV_32=y
BR2_KERNEL_HEADERS_5_4=y
BR2_TOOLCHAIN_BUILDROOT_LOCALE=y
BR2_PTHREAD_DEBUG=y
BR2_BINUTILS_VERSION_2_34_X=y
BR2_GCC_VERSION_10_X=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_TOOLCHAIN_BUILDROOT_FORTRAN=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
#BR2_PACKAGE_BUSYBOXis not set
BR2_PACKAGE_GDB=y
#BR2_TARGET_ROOTFS_TARis not setQuoted 1 line
Do you have some idea of what could be wrong here ?
No clue. This is very weird since this vregs thing is declared only in
libc/sysdeps/linux/aarch64/sys/user.h. So ARM64, not riscv.The file
libc/sysdeps/linux/riscv64/sys/user.hexists but does not use__uint128_t, it is in fact empty. And this file does not exist for riscv32, the entire libc/sysdeps/linux/riscv32 directory does not exist.Something funky is going on with the arch dependent definitions...
Alistair,
Quoted 18 lines
Any idea ?
Quoted 5 lines
Thanks a lot,
Thomas
Signature · 6 lines
Damien Le Moal Western Digital Research _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 2 lines
Damien Le Moal Western Digital Research
PATCH v2 2/6 arch/config: Make RISC-V MMU optional
In reply to Damien Le MoalLinux supports No-MMU RISC-V since kernel version 5.8. Make MMU optional to enable building for RISC-V boards that do not have one.
--- arch/Config.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/Config.in +1 -1
@@ -210,7 +210,7 @@ config BR2_powerpc64le config BR2_riscv bool "RISCV" - select BR2_ARCH_HAS_MMU_MANDATORY + select BR2_ARCH_HAS_MMU_OPTIONAL select BR2_ARCH_NEEDS_GCC_AT_LEAST_7 help RISC-V is an open, free Instruction Set Architecture created
Signature · 1 line
2.26.2
PATCH v2 2/6 arch/config: Make RISC-V MMU optional
Quoted 5 lines · Damien Le Moal
Linux supports No-MMU RISC-V since kernel version 5.8. Make MMU optional to enable building for RISC-V boards that do not have one.
Signed-off-by Damien Le Moal <[email protected]>
Alistair
Quoted 24 lines
--- arch/Config.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/Config.in +1
-2@@ -210,7 +210,7 @@ config BR2_powerpc64le config BR2_riscv bool "RISCV" - select BR2_ARCH_HAS_MMU_MANDATORY + select BR2_ARCH_HAS_MMU_OPTIONAL select BR2_ARCH_NEEDS_GCC_AT_LEAST_7 help RISC-V is an open, free Instruction Set Architecture created --2.26.2
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
PATCH v2 2/6 arch/config: Make RISC-V MMU optional
In reply to Damien Le MoalQuoted 4 lines · On Tue, 8 Sep 2020 20:33:20 +0900 Damien Le Moal <[email protected]> wrote:
Linux supports No-MMU RISC-V since kernel version 5.8. Make MMU optional to enable building for RISC-V boards that do not have one.
Signed-off-by Damien Le Moal <[email protected]>
I think this should come after PATCH 3 and PATCH 4, otherwise the build of the toolchain probably fails if you disable MMU support on RISC-V, doesn't it ?
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v2 2/6 arch/config: Make RISC-V MMU optional
Quoted 11 lines · Thomas Petazzoni
Quoted 4 lines · On Tue, 8 Sep 2020 20:33:20 +0900 Damien Le Moal <[email protected]> wrote:
Linux supports No-MMU RISC-V since kernel version 5.8. Make MMU optional to enable building for RISC-V boards that do not have one.
Signed-off-by Damien Le Moal <[email protected]>I think this should come after PATCH 3 and PATCH 4, otherwise the build of the toolchain probably fails if you disable MMU support on RISC-V, doesn't it ?
Ah. Yes. It is probably better to move it after patch 4. I have not tested the patches individually... Should have done that.
Quoted 3 lines
Thomas
Signature · 2 lines
Damien Le Moal Western Digital Research
PATCH v2 3/6 package/elf2flt: add RISC-V support
In reply to Damien Le MoalFrom: Christoph Hellwig <[email protected]>
Enable selecting elf2flt for RISC-V no MMU builds ad add support for it.
--- .../0002-elf2flt-add-riscv-support.patch | 302 ++++++++++++++++++ package/elf2flt/Config.in.host | 2 +- 2 files changed, 303 insertions(+), 1 deletion(-) create mode 100644 package/elf2flt/0002-elf2flt-add-riscv-support.patch
package/elf2flt/0002-elf2flt-add-riscv-support.patch new file +302 -0
@@ -0,0 +1,302 @@ +From 9a1c84590f31897e681a8142481c73456a7eedcf Mon Sep 17 00:00:00 2001 +From: Christoph Hellwig <[email protected]> +Date: Mon, 10 Jun 2019 09:21:57 +0200 +Subject: elf2flt: add riscv support + +We need a new linker script - riscv has a global_pointer and is +very picky about some section ordering. + +Signed-off-by: Christoph Hellwig <[email protected]> +--- + Makefile.in | 4 +- + elf2flt.c | 15 ++- + riscv64-elf2flt.ld | 222 +++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 239 insertions(+), 2 deletions(-) + create mode 100644 riscv64-elf2flt.ld + +diff --git a/Makefile.in b/Makefile.in +index 52b3347..3b0b604 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -43,7 +43,9 @@ endif + LDFILE= elf2flt.ld + ifeq ($(strip $(CPU)),e1) + SRC_LDFILE= $(srcdir)/$(CPU)-elf2flt.ld +-else ++else ifeq ($(strip $(CPU)),riscv64) ++SRC_LDFILE= riscv64-elf2flt.ld ++else + SRC_LDFILE= elf2flt.ld + endif + +diff --git a/elf2flt.c b/elf2flt.c +index 67f720a..81c9456 100644 +--- a/elf2flt.c ++++ b/elf2flt.c +@@ -80,6 +80,8 @@ const char *elf2flt_progname; + #include <elf/v850.h> + #elif defined(TARGET_xtensa) + #include <elf/xtensa.h> ++#elif defined(TARGET_riscv64) ++#include <elf/riscv.h> + #endif + + #if defined(__MINGW32__) +@@ -122,6 +124,8 @@ const char *elf2flt_progname; + #define ARCH "nios2" + #elif defined(TARGET_xtensa) + #define ARCH "xtensa" ++#elif defined(TARGET_riscv64) ++#define ARCH "riscv64" + #else + #error "Don't know how to support your CPU architecture??" + #endif +@@ -507,7 +511,16 @@ output_relocs ( + them. */ + continue; + } +-#endif /* USE_V850_RELOCS */ ++#endif /* TARGET_v850 */ ++ ++#if defined(TARGET_riscv64) ++ switch ((*p)->howto->type) { ++ case R_RISCV_ADD32: ++ case R_RISCV_SUB32: ++ case R_RISCV_32_PCREL: ++ continue; ++ } ++#endif + + q = *p; + if (q->sym_ptr_ptr && *q->sym_ptr_ptr) { +diff --git a/riscv64-elf2flt.ld b/riscv64-elf2flt.ld +new file mode 100644 +index 0000000..89ac2e8 +--- /dev/null ++++ b/riscv64-elf2flt.ld +@@ -0,0 +1,222 @@ ++ ++ENTRY (_start) ++ ++SECTIONS { ++ ++ .text 0x0 : { ++ . = . + 4; ++ . = ALIGN(0x4) ; ++ _stext = . ; ++ *(.literal .text) ++ *(.literal.* .text.*) ++ *(.gnu.warning) ++ *(.stub) ++ *(.gnu.linkonce.literal.*) ++ *(.gnu.linkonce.t*) ++ *(.glue_7t) ++ *(.glue_7) ++ *(.jcr) ++ *(.init.literal) ++ KEEP (*(.init)) ++ *(.fini.literal) ++ KEEP (*(.fini)) ++ ++W_RODAT *(.rodata) ++W_RODAT *(.rodata1) ++W_RODAT *(.rodata.*) ++W_RODAT *(.gnu.linkonce.r*) ++ ++ /* .ARM.extab name sections containing exception unwinding information */ ++ *(.ARM.extab* .gnu.linkonce.armextab.*) ++ /* This is special code area at the end of the normal ++ text section. It contains a small lookup table at ++ the start followed by the code pointed to by entries ++ in the lookup table. */ ++ . = ALIGN (4) ; ++ PROVIDE(__ctbp = .); ++ *(.call_table_data) ++ *(.call_table_text) ++ } ++ ++ /* .ARM.exidx name sections containing index entries for section unwinding */ ++ /* .ARM.exidx is sorted, so has to go in its own output section. */ ++ __exidx_start = .; ++ .ARM.exidx : ++ { ++ *(.ARM.exidx* .gnu.linkonce.armexidx.*) ++ } ++ __exidx_end = .; ++ ++ . = ALIGN(0x20) ; ++ _etext = . ; ++ ++ .data : { ++ . = ALIGN(0x4) ; ++ _sdata = . ; ++ __data_start = . ; ++ data_start = . ; ++ *(.got) ++ *(.igot) ++ *(.got.plt) ++ *(.igot.plt) ++ FILL(0) ; ++ . = ALIGN(0x20) ; ++ LONG(-1) ++ . = ALIGN(0x20) ; ++ ++ __global_pointer$ = . + 0x800; ++ ++ *(.data) ++ *(.data1) ++ *(.data.*) ++ *(.gnu.linkonce.d*) ++R_RODAT *(.rodata) ++R_RODAT *(.rodata1) ++R_RODAT *(.rodata.*) ++R_RODAT *(.gnu.linkonce.r*) ++ ++ /* Microblaze has .sdata and .sbss (small bss). They must ++ be contiguous, so please don't move any of this. JW */ ++ _ssrw = . ; ++ *(.srodata) ++ *(.srodata.*) ++ *(.sdata) ++ *(.sdata.*) ++ *(.sbss) /* Don't move this! */ ++ *(.gnu.linkonce.sb*) ++ _essrw = . ; ++ ++ _ssrw_size = _essrw - _ssrw; ++ PROVIDE(_SDA_BASE_ = _ssrw + (_ssrw_size / 2)); ++ ++ *(.gnu.linkonce.s.*) ++ *(__libc_atexit) ++ *(__libc_subinit) ++ *(__libc_subfreeres) ++ ++ /* microblaze-specific read-only small data area ++ and associated locating symbols */ ++ _ssro = . ; ++ *(.sdata2) ++ _essro = . ; ++ _ssro_size = _essro - _ssro; ++ PROVIDE(_SDA2_BASE_ = _ssro + (_ssro_size / 2)); ++ ++ . = ALIGN(4) ; ++TOR: __CTOR_LIST__ = .; ++TOR: LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) ++SINGLE_LINK: /* gcc uses crtbegin.o to find the start of ++SINGLE_LINK: the constructors, so we make sure it is ++SINGLE_LINK: first. Because this is a wildcard, it ++SINGLE_LINK: doesn't matter if the user does not ++SINGLE_LINK: actually link against crtbegin.o; the ++SINGLE_LINK: linker won't look for a file to match a ++SINGLE_LINK: wildcard. The wildcard also means that it ++SINGLE_LINK: doesn't matter which directory crtbegin.o ++SINGLE_LINK: is in. */ ++SINGLE_LINK: KEEP (*crtbegin*.o(.ctors)) ++SINGLE_LINK: /* We don't want to include the .ctor section from ++SINGLE_LINK: from the crtend.o file until after the sorted ctors. ++SINGLE_LINK: The .ctor section from the crtend file contains the ++SINGLE_LINK: end of ctors marker and it must be last */ ++SINGLE_LINK: KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) ++SINGLE_LINK: KEEP (*(SORT(.ctors.*))) ++ KEEP (*(.ctors)) ++TOR: LONG(0) ++TOR: __CTOR_END__ = .; ++TOR: __DTOR_LIST__ = .; ++TOR: LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) ++SINGLE_LINK: KEEP (*crtbegin*.o(.dtors)) ++SINGLE_LINK: KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) ++SINGLE_LINK: KEEP (*(SORT(.dtors.*))) ++ KEEP (*(.dtors)) ++TOR: LONG(0) ++TOR: __DTOR_END__ = .; ++ ++ PROVIDE (__preinit_array_start = .); ++ KEEP (*(.preinit_array)) ++ PROVIDE (__preinit_array_end = .); ++ ++ PROVIDE (__init_array_start = .); ++ KEEP (*(SORT(.init_array.*))) ++ KEEP (*(.init_array)) ++ PROVIDE (__init_array_end = .); ++ ++ PROVIDE (__fini_array_start = .); ++ KEEP (*(.fini_array)) ++ KEEP (*(SORT(.fini_array.*))) ++ PROVIDE (__fini_array_end = .); ++ } ++ ++ .note.ABI-tag : { *(.note.ABI-tag) } ++ .eh_frame_hdr : { *(.eh_frame_hdr) } ++ .eh_frame : { KEEP(*(.eh_frame)) } ++ .gcc_except_table : { ++ KEEP(*(.gcc_except_table)) ++ KEEP(*(.gcc_except_table.*)) ++ } ++ ++ . = ALIGN(0x10) ; ++ _edata = . ; ++ ++ .bss : { ++ . = ALIGN(0x4) ; ++ _sbss = ALIGN(0x4) ; ++ __bss_start = . ; ++ *(.dynsbss) ++ *(.sbss) ++ *(.sbss.*) ++ *(.scommon) ++ *(.dynbss) ++ *(.bss) ++ *(.bss.*) ++ *(.bss*) ++ *(.gnu.linkonce.b*) ++ *(COMMON) ++ . = ALIGN(0x10) ; ++ _ebss = . ; ++ _end = . ; ++ end = . ; ++ } ++ ++ .stack : { ++ . = ALIGN(0x4); ++ _stack_start = .; ++ } ++ ++ .junk 0 : { *(.rel*) *(.rela*) } ++ /DISCARD/ : { *(.note.GNU-stack) } ++ /* Stabs debugging sections. */ ++ .stab 0 : { *(.stab) } ++ .stabstr 0 : { *(.stabstr) } ++ .stab.excl 0 : { *(.stab.excl) } ++ .stab.exclstr 0 : { *(.stab.exclstr) } ++ .stab.index 0 : { *(.stab.index) } ++ .stab.indexstr 0 : { *(.stab.indexstr) } ++ .comment 0 : { *(.comment) } ++ /* DWARF debug sections. ++ Symbols in the DWARF debugging sections are relative to the beginning ++ of the section so we begin them at 0. */ ++ /* DWARF 1 */ ++ .debug 0 : { *(.debug) } ++ .line 0 : { *(.line) } ++ /* GNU DWARF 1 extensions */ ++ .debug_srcinfo 0 : { *(.debug_srcinfo) } ++ .debug_sfnames 0 : { *(.debug_sfnames) } ++ /* DWARF 1.1 and DWARF 2 */ ++ .debug_aranges 0 : { *(.debug_aranges) } ++ .debug_pubnames 0 : { *(.debug_pubnames) } ++ /* DWARF 2 */ ++ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } ++ .debug_abbrev 0 : { *(.debug_abbrev) } ++ .debug_line 0 : { *(.debug_line) } ++ .debug_frame 0 : { *(.debug_frame) } ++ .debug_str 0 : { *(.debug_str) } ++ .debug_loc 0 : { *(.debug_loc) } ++ .debug_macinfo 0 : { *(.debug_macinfo) } ++ /* SGI/MIPS DWARF 2 extensions */ ++ .debug_weaknames 0 : { *(.debug_weaknames) } ++ .debug_funcnames 0 : { *(.debug_funcnames) } ++ .debug_typenames 0 : { *(.debug_typenames) } ++ .debug_varnames 0 : { *(.debug_varnames) } ++} +-- +2.20.1 +
package/elf2flt/Config.in.host +1 -1
@@ -1,6 +1,6 @@ config BR2_PACKAGE_HOST_ELF2FLT bool "Enable elf2flt support?" - depends on BR2_arm || BR2_sh || BR2_sparc || BR2_xtensa + depends on BR2_arm || BR2_sh || BR2_sparc || BR2_xtensa || BR2_riscv depends on !BR2_USE_MMU help uCLinux uses a Binary Flat format commonly known as BFLT. It
Signature · 1 line
2.26.2
PATCH v2 3/6 package/elf2flt: add RISC-V support
Quoted 19 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Damien" == Damien Le Moal <[email protected]> writes:
From: Christoph Hellwig <[email protected]>
Enable selecting elf2flt for RISC-V no MMU builds ad add support for it.Signed-off-by Christoph Hellwig <[email protected]>Signed-off-by Damien Le Moal <[email protected]>--- .../0002-elf2flt-add-riscv-support.patch | 302 ++++++++++++++++++ package/elf2flt/Config.in.host | 2 +- 2 files changed, 303 insertions(+), 1 deletion(-) create mode 100644 package/elf2flt/0002-elf2flt-add-riscv-support.patchpackage/elf2flt/0002-elf2flt-add-riscv-support.patch new file +0
-0
package/elf2flt/0002-elf2flt-add-riscv-support.patch line 9
Quoted 9 lines
package/elf2flt/0002-elf2flt-add-riscv-support.patch new file +9
-0@@ -0,0 +1,302 @@ +From 9a1c84590f31897e681a8142481c73456a7eedcf Mon Sep 17 00:00:00 2001 +From: Christoph Hellwig <[email protected]> +Date: Mon, 10 Jun 2019 09:21:57 +0200 +Subject: elf2flt: add riscv support + +We need a new linker script - riscv has a global_pointer and is +very picky about some section ordering. + +Signed-off-by: Christoph Hellwig <[email protected]>
What is the upstream status of this patch? I don't see a PR for it?
https://github.com/uclinux-dev/elf2flt/pulls?q=is%3Apr+is%3Aclosed
Signature · 1 line
Bye, Peter Korsgaard
PATCH v2 3/6 package/elf2flt: add RISC-V support
Quoted 31 lines · Peter Korsgaard
Quoted 19 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Damien" == Damien Le Moal <[email protected]> writes:
From: Christoph Hellwig <[email protected]>
Enable selecting elf2flt for RISC-V no MMU builds ad add support for it.Signed-off-by Christoph Hellwig <[email protected]>Signed-off-by Damien Le Moal <[email protected]>--- .../0002-elf2flt-add-riscv-support.patch | 302 ++++++++++++++++++ package/elf2flt/Config.in.host | 2 +- 2 files changed, 303 insertions(+), 1 deletion(-) create mode 100644 package/elf2flt/0002-elf2flt-add-riscv-support.patchpackage/elf2flt/0002-elf2flt-add-riscv-support.patch new file +0
-0package/elf2flt/0002-elf2flt-add-riscv-support.patch line 9
Quoted 9 lines
package/elf2flt/0002-elf2flt-add-riscv-support.patch new file +9
-0@@ -0,0 +1,302 @@ +From 9a1c84590f31897e681a8142481c73456a7eedcf Mon Sep 17 00:00:00 2001 +From: Christoph Hellwig <[email protected]> +Date: Mon, 10 Jun 2019 09:21:57 +0200 +Subject: elf2flt: add riscv support + +We need a new linker script - riscv has a global_pointer and is +very picky about some section ordering. + +Signed-off-by: Christoph Hellwig <[email protected]>What is the upstream status of this patch? I don't see a PR for it?
Sending it now. Christoph did not send it before and I forgot too.
Signature · 2 lines
Damien Le Moal Western Digital Research
PATCH v2 3/6 package/elf2flt: add RISC-V support
In reply to Damien Le MoalQuoted 18 lines · On Tue, 8 Sep 2020 20:33:21 +0900 Damien Le Moal <[email protected]> wrote:
From: Christoph Hellwig <[email protected]>
Enable selecting elf2flt for RISC-V no MMU builds ad add support for it.
Signed-off-by Christoph Hellwig <[email protected]>Signed-off-by Damien Le Moal <[email protected]>--- .../0002-elf2flt-add-riscv-support.patch | 302 ++++++++++++++++++ package/elf2flt/Config.in.host | 2 +- 2 files changed, 303 insertions(+), 1 deletion(-) create mode 100644 package/elf2flt/0002-elf2flt-add-riscv-support.patchpackage/elf2flt/0002-elf2flt-add-riscv-support.patch new file +0
-0
package/elf2flt/0002-elf2flt-add-riscv-support.patch line 9
Quoted 9 lines
package/elf2flt/0002-elf2flt-add-riscv-support.patch new file +9
-0@@ -0,0 +1,302 @@ +From 9a1c84590f31897e681a8142481c73456a7eedcf Mon Sep 17 00:00:00 2001 +From: Christoph Hellwig <[email protected]> +Date: Mon, 10 Jun 2019 09:21:57 +0200 +Subject: elf2flt: add riscv support + +We need a new linker script - riscv has a global_pointer and is +very picky about some section ordering. + +Signed-off-by: Christoph Hellwig <[email protected]>
We need your Signed-off-by here. However, I see that the upstreaming process hasn't really made progress, and especially you're pointing that binaries built with this elf2flt RISC-V support fail with recent kernels.
Do you have some news about fixing this? It's a bit annoying to merge something that doesn't work with recent kernels.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v2 3/6 package/elf2flt: add RISC-V support
Quoted 27 lines · Thomas Petazzoni
Quoted 24 lines · On Tue, 8 Sep 2020 20:33:21 +0900 Damien Le Moal <[email protected]> wrote:
From: Christoph Hellwig <[email protected]>
Enable selecting elf2flt for RISC-V no MMU builds ad add support for it.
Signed-off-by Christoph Hellwig <[email protected]>Signed-off-by Damien Le Moal <[email protected]>--- .../0002-elf2flt-add-riscv-support.patch | 302 ++++++++++++++++++ package/elf2flt/Config.in.host | 2 +- 2 files changed, 303 insertions(+), 1 deletion(-) create mode 100644 package/elf2flt/0002-elf2flt-add-riscv-support.patchpackage/elf2flt/0002-elf2flt-add-riscv-support.patch new file +6
-0@@ -0,0 +1,302 @@ +From 9a1c84590f31897e681a8142481c73456a7eedcf Mon Sep 17 00:00:00 2001 +From: Christoph Hellwig <[email protected]> +Date: Mon, 10 Jun 2019 09:21:57 +0200 +Subject: elf2flt: add riscv support + +We need a new linker script - riscv has a global_pointer and is
Quoted 8 lines
package/elf2flt/0002-elf2flt-add-riscv-support.patch line 9
Quoted 3 lines
package/elf2flt/0002-elf2flt-add-riscv-support.patch new file +3
-0+very picky about some section ordering. + +Signed-off-by: Christoph Hellwig <[email protected]>We need your Signed-off-by here. However, I see that the upstreaming process hasn't really made progress, and especially you're pointing that binaries built with this elf2flt RISC-V support fail with recent kernels.
The problem is commit 2217b982624680d19a80ebb4600d05c8586c4f96 in kernel 5.9. Without reverting this commit (which is a revert itself), busybox fails to run (invalid instruction or address exception triggers after loading the flat bin and jumping into the init process, which in my case is a shell script). This commit was backported into 5.8.5 too, so all kernels from that version onward fail to run busybox, including 5.9. Everything is fine if that commit is reverted.
Quoted 2 lines
Do you have some news about fixing this? It's a bit annoying to merge something that doesn't work with recent kernels.
Indeed. I am super annoyed by it too :) The kernel commit should not matter as it only changes relocation of sections on load by a factor of 8B. With or without it, the flat bin should be OK, loaded and relocated and run. Yet a bad address is there. No clue yet as to what the exact problem is and I have had no time to explore this in more detail. This is why I did not send an updated PR for buildroot.
The elf2flt PR I sent to uclinux-dev also needs some more work as commented on github PR page. Need to work on that too, but since I suspect the kernel side problem is related to it, I need to find the time to dig into this further. Not quite sure yet if the problem is with the kernel, elf2flt or both.
Quoted 3 lines
Thomas
Signature · 2 lines
Damien Le Moal Western Digital Research
PATCH v2 4/6 package make: build RISC-V nommu builds as linux
In reply to Damien Le MoalFrom: Christoph Hellwig <[email protected]>
Using *-uclinux-* seems like an only partially followed convention. And at least for RISC-V gcc doesn't know about uclinux tuples, so switch back to the normal Linux one for now.
[Damien]
* Make the change conditional on BR2_riscv arch being "y".
--- package/Makefile.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
package/Makefile.in +6 -1
@@ -39,9 +39,14 @@ endif # Compute GNU_TARGET_NAME GNU_TARGET_NAME = $(ARCH)-$(TARGET_VENDOR)-$(TARGET_OS)-$(LIBC)$(ABI) -# FLAT binary format needs uclinux +# FLAT binary format needs uclinux, except RISC-V which needs +# the regular linux name. ifeq ($(BR2_BINFMT_FLAT),y) +ifeq ($(BR2_riscv),y) +TARGET_OS = linux +else TARGET_OS = uclinux +endif else TARGET_OS = linux endif
Signature · 1 line
2.26.2
PATCH v2 4/6 package make: build RISC-V nommu builds as linux
On 2020-09-08 20:33 +0900, Damien Le Moal spake thusly:
Quoted 26 lines
From: Christoph Hellwig <[email protected]>
Using *-uclinux-* seems like an only partially followed convention. And at least for RISC-V gcc doesn't know about uclinux tuples, so switch back to the normal Linux one for now.
Signed-off-by Christoph Hellwig <[email protected]>[Damien]
* Make the change conditional onBR2_riscvarch being "y".Signed-off-by Damien Le Moal <[email protected]>--- package/Makefile.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)package/Makefile.in +1
-1@@ -39,9 +39,14 @@ endif # Compute GNU_TARGET_NAME GNU_TARGET_NAME = $(ARCH)-$(TARGET_VENDOR)-$(TARGET_OS)-$(LIBC)$(ABI) -# FLAT binary format needs uclinux +# FLAT binary format needs uclinux, except RISC-V which needs
package/Makefile.in endif · line 52
Quoted 10 lines
package/Makefile.in +5
-0+# the regular linux name. ifeq ($(BR2_BINFMT_FLAT),y) +ifeq ($(BR2_riscv),y) +TARGET_OS = linux +else TARGET_OS = uclinux +endif else TARGET_OS = linux endif
I think I'd like a more compact solution:
# FLAT binary format needs uclinux, except for riscv which needs the regular linux name. ifeq ($(BR2_riscv):$(BR2_BINFMT_FLAT),:y)
TARGET_OS = uclinux
else
TARGET_OS = linux
endif
No need to resend just for that.
Regards,
Yann E. MORIN.
Quoted 7 lines
Signature · 6 lines
2.26.2 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v2 5/6 package/uclibc: fix compilation errors
In reply to Damien Le MoalAdd four patches to fix compilation errors when building static no MMU uclibc. The first two patches are upstream uclibc patches on top of version 1.0.35 tag. The following two patches are added here as additional fixes.
--- ...evert-Fix-static-linking-with-GCC-10.patch | 43 ++++++++ ...0002-fix-static-builds-with-gcc-10.x.patch | 25 +++++ ...-utils-getconf-Fix-compilation-error.patch | 103 ++++++++++++++++++ .../0004-librt-avoid-compilation-error.patch | 42 +++++++ 4 files changed, 213 insertions(+) create mode 100644 package/uclibc/0001-Revert-Fix-static-linking-with-GCC-10.patch create mode 100644 package/uclibc/0002-fix-static-builds-with-gcc-10.x.patch create mode 100644 package/uclibc/0003-utils-getconf-Fix-compilation-error.patch create mode 100644 package/uclibc/0004-librt-avoid-compilation-error.patch
package/uclibc/0001-Revert-Fix-static-linking-with-GCC-10.patch new file +43 -0
@@ -0,0 +1,43 @@ +From e80384786d7b7f895c97f2447d4b91af8eb5f0f4 Mon Sep 17 00:00:00 2001 +From: Waldemar Brodkorb <[email protected]> +Date: Wed, 2 Sep 2020 09:45:17 +0200 +Subject: [PATCH 1/4] Revert "Fix static linking with GCC-10" + +This reverts commit 5b58a1ebd89a4f05778441814e81817c82193fa3. + +This breaks all static builds earlier to gcc 10 :( +Bad testing on my side. +--- + libc/misc/elf/dl-support.c | 2 +- + libpthread/nptl/sysdeps/generic/libc-tls.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libc/misc/elf/dl-support.c b/libc/misc/elf/dl-support.c +index eaf08f5bb..87cd1bb72 100644 +--- a/libc/misc/elf/dl-support.c ++++ b/libc/misc/elf/dl-support.c +@@ -29,7 +29,7 @@ void (*_dl_init_static_tls) (struct link_map *) = &_dl_nothread_init_static_tls; + + ElfW(Phdr) *_dl_phdr; + size_t _dl_phnum; +-extern size_t _dl_pagesize; ++size_t _dl_pagesize; + + void internal_function _dl_aux_init (ElfW(auxv_t) *av); + void internal_function _dl_aux_init (ElfW(auxv_t) *av) +diff --git a/libpthread/nptl/sysdeps/generic/libc-tls.c b/libpthread/nptl/sysdeps/generic/libc-tls.c +index a1d2ef913..d746c9a38 100644 +--- a/libpthread/nptl/sysdeps/generic/libc-tls.c ++++ b/libpthread/nptl/sysdeps/generic/libc-tls.c +@@ -72,7 +72,7 @@ struct dtv_slotinfo_list *_dl_tls_dtv_slotinfo_list; + /* Number of modules in the static TLS block. */ + size_t _dl_tls_static_nelem; + /* Size of the static TLS block. */ +-extern size_t _dl_tls_static_size; ++size_t _dl_tls_static_size; + /* Size actually allocated in the static TLS block. */ + size_t _dl_tls_static_used; + /* Alignment requirement of the static TLS block. */ +-- +2.26.2 +
package/uclibc/0002-fix-static-builds-with-gcc-10.x.patch new file +25 -0
@@ -0,0 +1,25 @@ +From 4deace34cfcc5476b71a9cdc05828f5a48d1cd74 Mon Sep 17 00:00:00 2001 +From: Waldemar Brodkorb <[email protected]> +Date: Thu, 3 Sep 2020 15:08:24 +0200 +Subject: [PATCH 2/4] fix static builds with gcc 10.x + +--- + Rules.mak | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Rules.mak b/Rules.mak +index f270b7bee..55e88d462 100644 +--- a/Rules.mak ++++ b/Rules.mak +@@ -288,7 +288,7 @@ OPTIMIZATION += $(CFLAG_-fstrict-aliasing) + + # Why -funsigned-char: I hunted a bug related to incorrect + # sign extension of 'char' type for 10 hours straight. Not fun. +-CPU_CFLAGS-y := -funsigned-char -fno-builtin ++CPU_CFLAGS-y := -funsigned-char -fno-builtin -fcommon + + $(eval $(call check-gcc-var,-fno-asm)) + CPU_CFLAGS-y += $(CFLAG_-fno-asm) +-- +2.26.2 +
package/uclibc/0003-utils-getconf-Fix-compilation-error.patch new file +103 -0
103 lines not on this page · raw message
package/uclibc/0004-librt-avoid-compilation-error.patch new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH v2 5/6 package/uclibc: fix compilation errors
Damien, All,
+Petr in Cc.
Can you guys agree on a set of backports
On 2020-09-08 20:33 +0900, Damien Le Moal spake thusly:
Quoted 23 lines
Add four patches to fix compilation errors when building static no MMU uclibc. The first two patches are upstream uclibc patches on top of version 1.0.35 tag. The following two patches are added here as additional fixes.
Signed-off-by Damien Le Moal <[email protected]>--- ...evert-Fix-static-linking-with-GCC-10.patch | 43 ++++++++ ...0002-fix-static-builds-with-gcc-10.x.patch | 25 +++++ ...-utils-getconf-Fix-compilation-error.patch | 103 ++++++++++++++++++ .../0004-librt-avoid-compilation-error.patch | 42 +++++++ 4 files changed, 213 insertions(+) create mode 100644 package/uclibc/0001-Revert-Fix-static-linking-with-GCC-10.patch create mode 100644 package/uclibc/0002-fix-static-builds-with-gcc-10.x.patch create mode 100644 package/uclibc/0003-utils-getconf-Fix-compilation-error.patch create mode 100644 package/uclibc/0004-librt-avoid-compilation-error.patchpackage/uclibc/0001-Revert-Fix-static-linking-with-GCC-10.patch new file +0
-0
package/uclibc/0001-Revert-Fix-static-linking-with-GCC-10.patch line 9
Quoted 9 lines
package/uclibc/0001-Revert-Fix-static-linking-with-GCC-10.patch new file +9
-0@@ -0,0 +1,43 @@ +From e80384786d7b7f895c97f2447d4b91af8eb5f0f4 Mon Sep 17 00:00:00 2001 +From: Waldemar Brodkorb <[email protected]> +Date: Wed, 2 Sep 2020 09:45:17 +0200 +Subject: [PATCH 1/4] Revert "Fix static linking with GCC-10" + +This reverts commit 5b58a1ebd89a4f05778441814e81817c82193fa3. + +This breaks all static builds earlier to gcc 10 :( +Bad testing on my side.
We need that the patches you backport carry your own sob-line, as well as an pointer to upstream:
Applies to the secon backported patch as well.
[--SNIP--]
package/uclibc/0003-utils-getconf-Fix-compilation-error.patch line 4
Quoted 10 lines
package/uclibc/0003-utils-getconf-Fix-compilation-error.patch new file +4
-0@@ -0,0 +1,103 @@ +From 684b80c97a38033cf0065537783ecf29bc2251ee Mon Sep 17 00:00:00 2001 +From: Damien Le Moal <[email protected]> +Date: Mon, 7 Sep 2020 15:12:39 +0900 +Subject: [PATCH 3/4] utils/getconf: Fix compilation error
I would honestly prefer if you had split this Buildroot patch in two:
- one commit that backports the upstream uClibc-ng changes by Waldemar,
- one commit that adds your two new changes.
Applying backported patches is a pretty trivial affair (I tend to just verify that the referenced commit does exist, and this is very fast as I have a lot of git trees on my local machine].
But applying non-upstream commits usually undergo quite some more scrutiny.
package/uclibc/0003-utils-getconf-Fix-compilation-error.patch line 9
Quoted 4 lines
package/uclibc/0003-utils-getconf-Fix-compilation-error.patch new file +4
-0+Avoid "warning: statement will never be executed" compilation error if +none of the cases are defined. + +Signed-off-by: Damien Le Moal <[email protected]>
I know Thomas suggested those to be sent upstream and you agreed. So don't forget to do so! ;-)
If already done, then a pointer to the upstream bugzilla or mailing list thread would be good:
[upstream: pending review: https://some/mailing/list/message.html]
Regards,
Yann E. MORIN.
Quoted 149 lines
package/uclibc/0003-utils-getconf-Fix-compilation-error.patch new file +94
-0+--- + utils/getconf.c | 20 +++++++++++++++++--- + 1 file changed, 17 insertions(+), 3 deletions(-) + +diff --git a/utils/getconf.c b/utils/getconf.c +index 3dd3d75d9..b8d00f90f 100644 +--- a/utils/getconf.c ++++ b/utils/getconf.c +@@ -1154,7 +1154,6 @@ environment SPEC.\n\n"); + + const char *spec = NULL; + char buf[sizeof "POSIX_V6_LPBIG_OFFBIG"]; +- char *argv0 = argv[0]; + if (argc > 1 && strncmp (argv[1], "-v", 2) == 0) + { + if (argv[1][2] == '\0') +@@ -1199,42 +1198,56 @@ environment SPEC.\n\n"); + + switch (specs[i].num) + { ++#undef DO_GETCONF_NAME + #if !defined(_XBS5_ILP32_OFF32) && defined(_SC_XBS5_ILP32_OFF32) ++#define DO_GETCONF_NAME + case _SC_XBS5_ILP32_OFF32: + #endif + #if !defined(_XBS5_ILP32_OFFBIG) && defined(_SC_XBS5_ILP32_OFFBIG) ++#define DO_GETCONF_NAME + case _SC_XBS5_ILP32_OFFBIG: + #endif + #if !defined(_XBS5_LP64_OFF64) && defined(_SC_XBS5_LP64_OFF64) ++#define DO_GETCONF_NAME + case _SC_XBS5_LP64_OFF64: + #endif + #if !defined(_XBS5_LPBIG_OFFBIG) && defined(_SC_XBS5_LPBIG_OFFBIG) ++#define DO_GETCONF_NAME + case _SC_XBS5_LPBIG_OFFBIG: + #endif + #if !defined(_POSIX_V6_ILP32_OFF32) && defined(_SC_V6_ILP32_OFF32) ++#define DO_GETCONF_NAME + case _SC_V6_ILP32_OFF32: + #endif + #if !defined(_POSIX_V6_ILP32_OFFBIG) && defined(_SC_V6_ILP32_OFFBIG) ++#define DO_GETCONF_NAME + case _SC_V6_ILP32_OFFBIG: + #endif + #if !defined(_POSIX_V6_LP64_OFF64) && defined(_SC_V6_LP64_OFF64) ++#define DO_GETCONF_NAME + case _SC_V6_LP64_OFF64: + #endif + #if !defined(_POSIX_V6_LPBIG_OFFBIG) && defined(_SC_V6_LPBIG_OFFBIG) ++#define DO_GETCONF_NAME + case _SC_V6_LPBIG_OFFBIG: + #endif + #if !defined(_POSIX_V7_ILP32_OFF32) && defined(_SC_V7_ILP32_OFF32) ++#define DO_GETCONF_NAME + case _SC_V7_ILP32_OFF32: + #endif + #if !defined(_POSIX_V7_ILP32_OFFBIG) && defined(_SC_V7_ILP32_OFFBIG) ++#define DO_GETCONF_NAME + case _SC_V7_ILP32_OFFBIG: + #endif + #if !defined(_POSIX_V7_LP64_OFF64) && defined(_SC_V7_LP64_OFF64) ++#define DO_GETCONF_NAME + case _SC_V7_LP64_OFF64: + #endif + #if !defined(_POSIX_V7_LPBIG_OFFBIG) && defined(_SC_V7_LPBIG_OFFBIG) ++#define DO_GETCONF_NAME + case _SC_V7_LPBIG_OFFBIG: + #endif ++#ifdef DO_GETCONF_NAME + { + const char *args[argc + 3]; + size_t spec_len = strlen (spec); +@@ -1242,14 +1255,15 @@ environment SPEC.\n\n"); + memcpy (mempcpy (mempcpy (getconf_name, getconf_dir, + getconf_dirlen), + "/", 1), spec, spec_len + 1); +- args[0] = argv0; ++ args[0] = argv[0]; + args[1] = "-v"; + args[2] = spec; + memcpy (&args[3], &argv[1], argc * sizeof (argv[1])); + execv (getconf_name, (char * const *) args); + error (4, errno, _("Couldn't execute %s"), getconf_name); + } +- default: ++#endif ++ default: + break; + } + } +-- +2.26.2 +package/uclibc/0004-librt-avoid-compilation-error.patch new file +42
-0@@ -0,0 +1,42 @@ +From 4f7150086ffc2936d2c0f44e136984fcb232f7c7 Mon Sep 17 00:00:00 2001 +From: Damien Le Moal <[email protected]> +Date: Mon, 7 Sep 2020 16:51:09 +0900 +Subject: [PATCH 4/4] librt: avoid compilation error + +For no MMU builds, LIBC_CANCEL_ASYNC and LIBC_CANCEL_RESET are not +defined. Prevent these to by visible by the compiler in +clock_nanosleep() by replacing "if (SINGLE_THREAD_P) {" with the +pre-compiler directive "#if defined(SINGLE_THREAD_P)". + +Signed-off-by: Damien Le Moal <[email protected]> +--- + librt/clock_nanosleep.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/librt/clock_nanosleep.c b/librt/clock_nanosleep.c +index 4cf1e06b4..1515cf5b0 100644 +--- a/librt/clock_nanosleep.c ++++ b/librt/clock_nanosleep.c +@@ -36,9 +36,9 @@ clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req, + if (clock_id == CLOCK_PROCESS_CPUTIME_ID) + clock_id = MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED); + +- if (SINGLE_THREAD_P) ++#if defined(SINGLE_THREAD_P) + r = INTERNAL_SYSCALL (clock_nanosleep, err, 4, clock_id, flags, req, rem); +- else ++#else + { + int oldstate = LIBC_CANCEL_ASYNC (); + +@@ -47,6 +47,7 @@ clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req, + + LIBC_CANCEL_RESET (oldstate); + } ++#endif + + return (INTERNAL_SYSCALL_ERROR_P (r, err) + ? INTERNAL_SYSCALL_ERRNO (r, err) : 0); +-- +2.26.2 +Signature · 6 lines
2.26.2 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v2 5/6 package/uclibc: fix compilation errors
Hi all,
Quoted 5 lines
Damien, All,
+Petr in Cc.
Can you guys agree on a set of backports
Damien, I also agree you should sent these two patches also to uclibc-ng mailing list (I haven't found them there).
I haven't checked the build on high range of archs (only risc64 and intel), but I suppose these additional two are needed.
Quoted 37 lines
On 2020-09-08 20:33 +0900, Damien Le Moal spake thusly:
Quoted 23 lines
Add four patches to fix compilation errors when building static no MMU uclibc. The first two patches are upstream uclibc patches on top of version 1.0.35 tag. The following two patches are added here as additional fixes.
Signed-off-by Damien Le Moal <[email protected]>--- ...evert-Fix-static-linking-with-GCC-10.patch | 43 ++++++++ ...0002-fix-static-builds-with-gcc-10.x.patch | 25 +++++ ...-utils-getconf-Fix-compilation-error.patch | 103 ++++++++++++++++++ .../0004-librt-avoid-compilation-error.patch | 42 +++++++ 4 files changed, 213 insertions(+) create mode 100644 package/uclibc/0001-Revert-Fix-static-linking-with-GCC-10.patch create mode 100644 package/uclibc/0002-fix-static-builds-with-gcc-10.x.patch create mode 100644 package/uclibc/0003-utils-getconf-Fix-compilation-error.patch create mode 100644 package/uclibc/0004-librt-avoid-compilation-error.patchpackage/uclibc/0001-Revert-Fix-static-linking-with-GCC-10.patch new file +0
-0package/uclibc/0001-Revert-Fix-static-linking-with-GCC-10.patch line 9
Quoted 9 lines
package/uclibc/0001-Revert-Fix-static-linking-with-GCC-10.patch new file +9
-0@@ -0,0 +1,43 @@ +From e80384786d7b7f895c97f2447d4b91af8eb5f0f4 Mon Sep 17 00:00:00 2001 +From: Waldemar Brodkorb <[email protected]> +Date: Wed, 2 Sep 2020 09:45:17 +0200 +Subject: [PATCH 1/4] Revert "Fix static linking with GCC-10" + +This reverts commit 5b58a1ebd89a4f05778441814e81817c82193fa3. + +This breaks all static builds earlier to gcc 10 :( +Bad testing on my side.We need that the patches you backport carry your own sob-line, as well as an pointer to upstream:
Quoted 4 lines
[Damien: backport from https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/commit/?id=e80384786d7b7f895c97f2447d4b91af8eb5f0f4]Signed-off-by Your NAME <your@email>Applies to the secon backported patch as well.
I'm sorry, I forget this in my patchset as well.
Quoted 17 lines
[--SNIP--]
package/uclibc/0003-utils-getconf-Fix-compilation-error.patch line 4
Quoted 10 lines
package/uclibc/0003-utils-getconf-Fix-compilation-error.patch new file +4
-0@@ -0,0 +1,103 @@ +From 684b80c97a38033cf0065537783ecf29bc2251ee Mon Sep 17 00:00:00 2001 +From: Damien Le Moal <[email protected]> +Date: Mon, 7 Sep 2020 15:12:39 +0900 +Subject: [PATCH 3/4] utils/getconf: Fix compilation errorI would honestly prefer if you had split this Buildroot patch in two:
- one commit that backports the upstream uClibc-ng changes by Waldemar,
Quoted 8 lines
- one commit that adds your two new changes.
Applying backported patches is a pretty trivial affair (I tend to just verify that the referenced commit does exist, and this is very fast as I have a lot of git trees on my local machine].
But applying non-upstream commits usually undergo quite some more scrutiny.
+1
Damien, my patchset [1] is almost complete (containing these 2 patches only, missing links to the commits), but feel to sent additional patches to fix this (I sent [1] because I overlooked your patch).
Kind regards,
Petr
[1] https://patchwork.ozlabs.org/project/buildroot/patch/20200908150914.328323-1-petr.vorel at gmail.com/
Quoted 15 lines
package/uclibc/0003-utils-getconf-Fix-compilation-error.patch line 9
Quoted 4 lines
package/uclibc/0003-utils-getconf-Fix-compilation-error.patch new file +4
-0+Avoid "warning: statement will never be executed" compilation error if +none of the cases are defined. + +Signed-off-by: Damien Le Moal <[email protected]>I know Thomas suggested those to be sent upstream and you agreed. So don't forget to do so! ;-)
If already done, then a pointer to the upstream bugzilla or mailing list thread would be good:
[upstream: pending review: https://some/mailing/list/message.html]
Regards,
Yann E. MORIN.
PATCH v2 5/6 package/uclibc: fix compilation errors
Quoted 80 lines · Petr Vorel
Hi all,
Quoted 5 lines
Damien, All,
+Petr in Cc.
Can you guys agree on a set of backports
Damien, I also agree you should sent these two patches also to uclibc-ng mailing list (I haven't found them there).
I haven't checked the build on high range of archs (only risc64 and intel), but I suppose these additional two are needed.
Quoted 37 lines
On 2020-09-08 20:33 +0900, Damien Le Moal spake thusly:
Quoted 23 lines
Add four patches to fix compilation errors when building static no MMU uclibc. The first two patches are upstream uclibc patches on top of version 1.0.35 tag. The following two patches are added here as additional fixes.
Signed-off-by Damien Le Moal <[email protected]>--- ...evert-Fix-static-linking-with-GCC-10.patch | 43 ++++++++ ...0002-fix-static-builds-with-gcc-10.x.patch | 25 +++++ ...-utils-getconf-Fix-compilation-error.patch | 103 ++++++++++++++++++ .../0004-librt-avoid-compilation-error.patch | 42 +++++++ 4 files changed, 213 insertions(+) create mode 100644 package/uclibc/0001-Revert-Fix-static-linking-with-GCC-10.patch create mode 100644 package/uclibc/0002-fix-static-builds-with-gcc-10.x.patch create mode 100644 package/uclibc/0003-utils-getconf-Fix-compilation-error.patch create mode 100644 package/uclibc/0004-librt-avoid-compilation-error.patchpackage/uclibc/0001-Revert-Fix-static-linking-with-GCC-10.patch new file +0
-0package/uclibc/0001-Revert-Fix-static-linking-with-GCC-10.patch line 9
Quoted 9 lines
package/uclibc/0001-Revert-Fix-static-linking-with-GCC-10.patch new file +9
-0@@ -0,0 +1,43 @@ +From e80384786d7b7f895c97f2447d4b91af8eb5f0f4 Mon Sep 17 00:00:00 2001 +From: Waldemar Brodkorb <[email protected]> +Date: Wed, 2 Sep 2020 09:45:17 +0200 +Subject: [PATCH 1/4] Revert "Fix static linking with GCC-10" + +This reverts commit 5b58a1ebd89a4f05778441814e81817c82193fa3. + +This breaks all static builds earlier to gcc 10 :( +Bad testing on my side.We need that the patches you backport carry your own sob-line, as well as an pointer to upstream:
Quoted 4 lines
[Damien: backport from https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/commit/?id=e80384786d7b7f895c97f2447d4b91af8eb5f0f4]Signed-off-by Your NAME <your@email>Applies to the secon backported patch as well.
I'm sorry, I forget this in my patchset as well.
Quoted 22 lines
[--SNIP--]
package/uclibc/0003-utils-getconf-Fix-compilation-error.patch line 4
Quoted 10 lines
package/uclibc/0003-utils-getconf-Fix-compilation-error.patch new file +4
-0@@ -0,0 +1,103 @@ +From 684b80c97a38033cf0065537783ecf29bc2251ee Mon Sep 17 00:00:00 2001 +From: Damien Le Moal <[email protected]> +Date: Mon, 7 Sep 2020 15:12:39 +0900 +Subject: [PATCH 3/4] utils/getconf: Fix compilation errorI would honestly prefer if you had split this Buildroot patch in two:
- one commit that backports the upstream uClibc-ng changes by Waldemar,
- one commit that adds your two new changes.
Applying backported patches is a pretty trivial affair (I tend to just verify that the referenced commit does exist, and this is very fast as I have a lot of git trees on my local machine].
Quoted 5 lines
Quoted 2 lines
But applying non-upstream commits usually undergo quite some more scrutiny.
+1
Damien, my patchset [1] is almost complete (containing these 2 patches only, missing links to the commits), but feel to sent additional patches to fix this (I sent [1] because I overlooked your patch).
OK. Please proceed. I will remove the two upstream patches from my patchset and work on getting the other 2 in uclibc too. Doing so, the backporting in buildroot will be more trivial.
There is also the elf2flt patch from Christoph that should go into uclinux-dev. Will send that out too.
Sending everything out now.
Cheers.
Signature · 2 lines
Damien Le Moal Western Digital Research
PATCH v2 5/6 package/uclibc: fix compilation errors
In reply to Damien Le MoalQuoted 6 lines · On Tue, 8 Sep 2020 20:33:23 +0900 Damien Le Moal <[email protected]> wrote:
Add four patches to fix compilation errors when building static no MMU uclibc. The first two patches are upstream uclibc patches on top of version 1.0.35 tag. The following two patches are added here as additional fixes.
Signed-off-by Damien Le Moal <[email protected]>
Quoted 10 lines
--- ...evert-Fix-static-linking-with-GCC-10.patch | 43 ++++++++ ...0002-fix-static-builds-with-gcc-10.x.patch | 25 +++++ ...-utils-getconf-Fix-compilation-error.patch | 103 ++++++++++++++++++ .../0004-librt-avoid-compilation-error.patch | 42 +++++++ 4 files changed, 213 insertions(+) create mode 100644 package/uclibc/0001-Revert-Fix-static-linking-with-GCC-10.patch create mode 100644 package/uclibc/0002-fix-static-builds-with-gcc-10.x.patch create mode 100644 package/uclibc/0003-utils-getconf-Fix-compilation-error.patch create mode 100644 package/uclibc/0004-librt-avoid-compilation-error.patch
I believe all of those patches are upstream as of uclibc-ng 1.0.35, so I've marked this patch as Rejected.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v2 5/6 package/uclibc: fix compilation errors
Quoted 20 lines · Thomas Petazzoni
Quoted 6 lines · On Tue, 8 Sep 2020 20:33:23 +0900 Damien Le Moal <[email protected]> wrote:
Add four patches to fix compilation errors when building static no MMU uclibc. The first two patches are upstream uclibc patches on top of version 1.0.35 tag. The following two patches are added here as additional fixes.
Signed-off-by Damien Le Moal <[email protected]>Quoted 10 lines
--- ...evert-Fix-static-linking-with-GCC-10.patch | 43 ++++++++ ...0002-fix-static-builds-with-gcc-10.x.patch | 25 +++++ ...-utils-getconf-Fix-compilation-error.patch | 103 ++++++++++++++++++ .../0004-librt-avoid-compilation-error.patch | 42 +++++++ 4 files changed, 213 insertions(+) create mode 100644 package/uclibc/0001-Revert-Fix-static-linking-with-GCC-10.patch create mode 100644 package/uclibc/0002-fix-static-builds-with-gcc-10.x.patch create mode 100644 package/uclibc/0003-utils-getconf-Fix-compilation-error.patch create mode 100644 package/uclibc/0004-librt-avoid-compilation-error.patch
Quoted 2 lines
I believe all of those patches are upstream as of uclibc-ng 1.0.35, so I've marked this patch as Rejected.
Yes, they were all accepted. Thanks !
Quoted 3 lines
Thomas
Signature · 2 lines
Damien Le Moal Western Digital Research
PATCH v2 6/6 board: Add configuration for Kendryte K210 boards
In reply to Damien Le MoalAdd support for RISC-V boards based on the Kendryte K210 dual-core SoC. This SoC has very little memory (8MB of SRAM) and does not have an MMU supported by Linux.
To support boards based on this SoC, this patch provides the following:
- The kendryte_k210_defconfig buildroot configuration file defining a no-MMU uClibc build with Linux kernel 5.8. As support for the SD card on these boards is still lacking in Linux, the rootfs image is built as a cpio initramfs embedded directly in the kernel.
- The board/kendryte/k210/busybox.config minimal busybox configuration file. This file results in a rootfs image that is about 300KB smaller than the default busybox-minimal.config configuration, which saves memory at runtime given that the initramfs is loaded entirely in memory as part of the kernel.
resulting in a tiny rootfs
The kernel configuration used is the default upstream nommu_k210 defconfig present in the kernel since version 5.8. The kernel also provides the device tree.
Finally, to avoid "no memory" errors when using the default busybox initialization script and init process, the rootfs overlay directory board/kendryte/k210/rootfs_overlay provides an init script similar to fs/cpio/init which exec a shell as a last operation instead of executing busybox init process.
--- board/kendryte/k210/README.txt | 28 + board/kendryte/k210/busybox.config | 1178 +++++++++++++++++++++++ board/kendryte/k210/rootfs_overlay/init | 24 + configs/kendryte_k210_defconfig | 24 + 4 files changed, 1254 insertions(+) create mode 100644 board/kendryte/k210/README.txt create mode 100644 board/kendryte/k210/busybox.config create mode 100755 board/kendryte/k210/rootfs_overlay/init create mode 100644 configs/kendryte_k210_defconfig
board/kendryte/k210/README.txt new file +28 -0
@@ -0,0 +1,28 @@ +This is the Buildroot support for RISC-V Kendryte K210 SoC based boards. +Different variants of such boards are available from Sipeed (MAIX Dock, +Maixduino, Maix Go and Dan Dock) but the build procedure is similar for all of +them. + +Steps to create a bootable image for a K210 board: + +1) Configuration + make kendryte_k210_defconfig +2) Build + make +3) Boot the board + The bootable image file loader.bin can be found in output/image. Flash this + file onto the board ROM using the kflash.py utility: + + sudo python3 kflash.py -p /dev/ttyUSB0 -b 1500000 -t loader.bin + + The code for kflash.py is available on github at: + + https://github.com/sipeed/kflash.py + +Note: + +The current Linux support for the K210 is limited and devices such as GPIO or +SD card are not yet supported. As a result, this build procedure creates the +bootable image file by embedding the root filesystem image directly in the +kernel as a cpio initramfs image. Given the limited amount of memory of the +K210 (8MB of SDRAM), large root file system image will not work.
board/kendryte/k210/busybox.config new file +1178 -0
1,178 lines not on this page · raw message
board/kendryte/k210/rootfs_overlay/init new file +24 -0
@@ -0,0 +1,24 @@ +#!/bin/sh + +# devtmpfs does not get automounted for initramfs +/bin/mount -t devtmpfs devtmpfs /dev + +# Same for proc +/bin/mount -t proc proc /proc + +# use the /dev/console device node from devtmpfs if possible to not +# confuse glibc's ttyname_r(). +# This may fail (E.G. booted with console=), and errors from exec will +# terminate the shell, so use a subshell for the test +if (exec 0</dev/console) 2>/dev/null; then + exec 0</dev/console + exec 1>/dev/console + exec 2>/dev/console +fi + +echo "" +echo "+---------------------------+" +echo "| Kendryte K210 NOMMU Linux |" +echo "+---------------------------+" + +exec /bin/sh
configs/kendryte_k210_defconfig new file +24 -0
@@ -0,0 +1,24 @@ +BR2_riscv=y +# BR2_COMPILER_PARANOID_UNSAFE_PATH is not set +# BR2_UCLIBC_INSTALL_UTILS is not set +BR2_GCC_ENABLE_LTO=y +BR2_PACKAGE_HOST_ELF2FLT=y +# BR2_USE_MMU is not set +BR2_INIT_NONE=y +BR2_ROOTFS_MERGED_USR=y +BR2_SYSTEM_DEFAULT_PATH="/bin:/sbin:/usr/bin:/usr/sbin" +BR2_ROOTFS_OVERLAY="board/kendryte/k210/rootfs_overlay" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.8" +BR2_LINUX_KERNEL_DEFCONFIG="nommu_k210" +BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y +BR2_LINUX_KERNEL_IMAGE_NAME="loader.bin" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_DTB_IS_SELF_BUILT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="kendryte/k210" +BR2_PACKAGE_BUSYBOX_CONFIG="board/kendryte/k210/busybox.config" +BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set +BR2_TARGET_ROOTFS_INITRAMFS=y +# BR2_TARGET_ROOTFS_TAR is not set
Signature · 1 line
2.26.2
v2 cover Add support for Kendryte K210 RISC-V boards
In reply to Damien Le MoalQuoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Damien" == Damien Le Moal <[email protected]> writes:
This patch series adds support for building bootable images for RISC-V boards based on the Kendryte K210 SoC which is supported by the Linux kernel since version 5.8.0. This SoC has no MMU supported by Linux and requires uClibc flatbin binaries as gcc does not yet support FDPIC executables for RISC-V.
The first four patches adjust buildroot configuration to allow building uClibc static no-MMU libraries for RISC-V. The last and fifth patch adds buildroot defconfig for the Kendryte K210 as well as uClibc and busybox configuration.
Quoted 5 lines
Building is as simple as:
makekendryte_k210_defconfig
makeWhich generate the output/image/loader.bin bootable image.
Nice! With 2020.08 out the door and kernel 5.8 added, this was next on my todo list, so great timing ;)
Signature · 1 line
Bye, Peter Korsgaard