ARM: Multi PBL: Fix image calculation for certain toolchains
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hello Sascha,
Thank you for this patch. Happy to test it here on rk3188 (radxa rock pro).
Using bb v2018.09.0. Applied your patches below. CONFIG_PBL_RELOCATABLE is fixed in menuconfig. Common config:
grep RELOCAT .configCONFIG_PBL_RELOCATABLE=yCONFIG_RELOCATABLE=y
Built using this script:
export ARCH=arm
#export CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf-
export CROSS_COMPILE=/opt/OSELAS.Toolchain-2018.02.0/arm-v7m-eabi/gcc-7.3.1- newlib-2.5.0-binutils-2.30/bin/arm-v7m-eabi-
rm .config
make clean
make ARCH=arm rk3188_defconfig && make -j 10
/rk-makebootable FlashData barebox-flash-image rrboot.bin sudo dd if=rrboot.bin of=/dev/sdc bs=$((0x200)) seek=$((0x40))
Using Debian/Ubuntu cross compiler:
###########################
CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf-
DDR Version 1.04 20140217
In
DDR3
300MHz
Bus Width=32 Col=10 Bank=8 Row=15 CS=2 Die Bus-Width=16 Size=2048MB Memory OK
OUT
barebox 2018.09.0-dirty #43 Mon Sep 17 15:19:59 CEST 2018
Board: Radxa Rockclk_register clk xin24m is already registered, skipping! arc-emac 10204000.ethernet: ARC EMAC detected with id: 0x7fd02mdio_bus: miibus0: probeddw_mmc 10214000.dwmmc: registered as 10214000.dwmmc
mshc1: detected SD card version 1.0
mshc1: registered mshc1
netconsole: registered as netconsole-1
i2c-gpio i2c-gpio0: using pins 58 (SDA) and 59 (SCL) malloc space: 0x9fefd660 -> 0xdfdfacbf (size 1023 MiB) gpio-leds.6: probe permanently deferred
envfs: no envfs (magic mismatch) - envfs never written? running /env/bin/init...
Hit any key to stop autoboot: 0
booting 'mshc1'
mount: No such file or directory
ext4 ext40: EXT2 rev 1, inode_size 128, descriptor size 32 mounted /dev/mshc1.0 on /mnt/mshc1.0
setting root node failed: Device or resource busy
oftree: Device or resource busy
Loading ARM Linux zImage '/mnt/mshc1.0/zImage'
commandline: console=ttyS2,115200 root=/dev/mmcblk0p2 rootwaitarch_number: 3066
=> bb boot success.
=> kernel boot failure.
Using OSELAS:
##########
export CROSS_COMPILE=/opt/OSELAS.Toolchain-2018.02.0/arm-v7m-eabi/gcc-7.3.1- newlib-2.5.0-binutils-2.30/bin/arm-v7m-eabi-
DDR Version 1.04 20140217
In
DDR3
300MHz
Bus Width=32 Col=10 Bank=8 Row=15 CS=2 Die Bus-Width=16 Size=2048MB Memory OK
OUT
barebox 2018.09.0-dirty #44 Mon Sep 17 15:22:34 CEST 2018
Board: Radxa Rockclk_register clk xin24m is already registered, skipping! arc-emac 10204000.ethernet: ARC EMAC detected with id: 0x7fd02mdio_bus: miibus0: probeddw_mmc 10214000.dwmmc: registered as 10214000.dwmmc
mshc1: detected SD card version 1.0
mshc1: registered mshc1
netconsole: registered as netconsole-1
i2c-gpio i2c-gpio0: using pins 58 (SDA) and 59 (SCL) malloc space: 0x9fefd660 -> 0xdfdfacbf (size 1023 MiB) gpio-leds.6: probe permanently deferred
envfs: no envfs (magic mismatch) - envfs never written? running /env/bin/init...
Hit any key to stop autoboot: 1
booting 'mshc1'
mount: No such file or directory
ext4 ext40: EXT2 rev 1, inode_size 128, descriptor size 32 mounted /dev/mshc1.0 on /mnt/mshc1.0
setting root node failed: Device or resource busy
oftree: Device or resource busy
Loading ARM Linux zImage '/mnt/mshc1.0/zImage'
commandline: console=ttyS2,115200 root=/dev/mmcblk0p2 rootwaitarch_number: 3066
=> bb boot success.
=> kernel boot failure.
There still are a couple of (possibly unrelated) issues, independent of the compiler used:
1) envfs: no envfs (magic mismatch) - envfs never written?
2) mount: No such file or directory
3) setting root node failed: Device or resource busy
4) oftree: Device or resource busy
5) arch_number: 3066 [note: boot failure]
cheers
Quoted 49 lines · On Montag, 17. September 2018 09:29:42 CEST you wrote:
The current way to calculate the compressed image position works with the OSELAS toolchains, but not with the Debian/Ubuntu toolchains. For these toolchains
&image_end_markeralready returns the correct address, addingglobal_variable_offset()to it is wrong.The solution seems to be to put the
image_end_markerinto a different object file so that the compiler cannot play any tricks to resolve the address internally in the object file.Signed-off-by Sascha Hauer <[email protected]>---
arch/arm/cpu/sections.c | 2 ++ arch/arm/cpu/uncompress.c | 5 +---- arch/arm/include/asm/sections.h | 2 ++ arch/arm/lib/pbl.lds.S | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-)arch/arm/cpu/sections.c +1
-0@@ -1,4 +1,5 @@#include <asm/sections.h> +#include <linux/types.h> char __rel_dyn_start[0] __attribute__((section(".__rel_dyn_start"))); char __rel_dyn_end[0] __attribute__((section(".__rel_dyn_end")));@@ -9,3 +10,4 @@ char __bss_start[0]__attribute__((section(".__bss_start"))); char __bss_stop[0] __attribute__((section(".__bss_stop")));
char __image_start[0] __attribute__((section(".__image_start"))); char __image_end[0] __attribute__((section(".__image_end"))); +uint32_t __image_end_marker[1] __attribute__((section(".__image_end_marker"))) = {0xdeadbeef}; diff --gita/arch/arm/cpu/uncompress.cb/arch/arm/cpu/uncompress.cindexb07087e4cf..43b49b4212100644arch/arm/cpu/uncompress.c +0
-3@@ -36,9 +36,6 @@unsigned long free_mem_ptr;unsigned long free_mem_end_ptr; -static int __attribute__((__section__ (".image_end" ))) - image_end_marker =0xdeadbeef ; -void __noreturn barebox_multi_pbl_start (unsigned long membase,unsigned long memsize,void *boarddata) {
arch/arm/cpu/uncompress.c void __noreturn barebox_multi_pbl_start(unsigned long · line 53
Quoted 8 lines
arch/arm/cpu/uncompress.c +1
-1@@ -50,7 +47,7 @@ void __noreturn barebox_multi_pbl_start(unsigned long membase, void *pg_start;unsigned long pc =get_pc (); - image_end = (void *)&image_end_marker +global_variable_offset (); + image_end = (void *)__image_end_marker +global_variable_offset ();if (IS_ENABLED (CONFIG_PBL_RELOCATABLE )) {/*
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Hi!
Thanks, with this patch barebox boots on rk3188.
I've tested with two cards, on one environment can be saved, on other this is not always work.
And newer kernels (above circa 4.10) will not boot with barebox because of clk driver change in Linux kernel. Looks like It wants DRAM clock change routine that is present in current u-boot, but not in barebox.
mount failure can be fixed by this patch:
arch/arm/boards/radxa-rock/env/boot/mshc1 +1 -1
@@ -1,6 +1,6 @@ #!/bin/sh -mount /dev/mshc1.0 +mount /dev/mshc1.0 /mnt/mshc1.0 global.bootm.boot_atag=true oftree -l /mnt/mshc1.0/rk3188-radxarock.dtb
Or just by removal of "mount..." command.
Earlier mount command accepted only device parameter, now it need mountpoint too.
17.09.2018, 18:31, "[email protected]" <[email protected]>:
Quoted 192 lines
Hello Sascha,
Thank you for this patch. Happy to test it here on rk3188 (radxa rock pro).
Using bb v2018.09.0. Applied your patches below.
CONFIG_PBL_RELOCATABLEis fixed in menuconfig. Common config:grep RELOCAT .config
CONFIG_PBL_RELOCATABLE=yCONFIG_RELOCATABLE=yBuilt using this script:
export ARCH=arm
#export CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf-
export CROSS_COMPILE=/opt/OSELAS.Toolchain-2018.02.0/arm-v7m-eabi/gcc-7.3.1- newlib-2.5.0-binutils-2.30/bin/arm-v7m-eabi-rm .config
make clean
make ARCH=armrk3188_defconfig&& make -j 10/rk-makebootable FlashData barebox-flash-image rrboot.bin sudo dd if=rrboot.bin of=/dev/sdc bs=$((0x200)) seek=$((0x40))
Using Debian/Ubuntu cross compiler:
###########################CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf-
DDR Version 1.04 20140217
In
DDR3
300MHz
Bus Width=32 Col=10 Bank=8 Row=15 CS=2 Die Bus-Width=16 Size=2048MB Memory OK
OUTbarebox 2018.09.0-dirty #43 Mon Sep 17 15:19:59 CEST 2018
Board: Radxa Rock
clk_registerclk xin24m is already registered, skipping! arc-emac 10204000.ethernet: ARC EMAC detected with id:0x7fd02mdio_bus: miibus0: probeddw_mmc10214000.dwmmc: registered as 10214000.dwmmc
mshc1: detected SD card version 1.0
mshc1: registered mshc1
netconsole: registered as netconsole-1
i2c-gpio i2c-gpio0: using pins 58 (SDA) and 59 (SCL) malloc space:0x9fefd660->0xdfdfacbf(size 1023 MiB) gpio-leds.6: probe permanently deferred
envfs: no envfs (magic mismatch) - envfs never written? running /env/bin/init...Hit any key to stop autoboot: 0
booting 'mshc1'
mount: No such file or directory
ext4 ext40: EXT2 rev 1,inode_size128, descriptor size 32 mounted/dev/mshc1.0on/mnt/mshc1.0
setting root node failed: Device or resource busy
oftree: Device or resource busyLoading ARM Linux zImage '
/mnt/mshc1.0/zImage'
commandline: console=ttyS2,115200 root=/dev/mmcblk0p2 rootwaitarch_number: 3066=> bb boot success.
=> kernel boot failure.Using OSELAS:
##########export CROSS_COMPILE=/opt/OSELAS.Toolchain-2018.02.0/arm-v7m-eabi/gcc-7.3.1- newlib-2.5.0-binutils-2.30/bin/arm-v7m-eabi-
DDR Version 1.04 20140217
In
DDR3
300MHz
Bus Width=32 Col=10 Bank=8 Row=15 CS=2 Die Bus-Width=16 Size=2048MB Memory OK
OUTbarebox 2018.09.0-dirty #44 Mon Sep 17 15:22:34 CEST 2018
Board: Radxa Rock
clk_registerclk xin24m is already registered, skipping! arc-emac 10204000.ethernet: ARC EMAC detected with id:0x7fd02mdio_bus: miibus0: probeddw_mmc10214000.dwmmc: registered as 10214000.dwmmc
mshc1: detected SD card version 1.0
mshc1: registered mshc1
netconsole: registered as netconsole-1
i2c-gpio i2c-gpio0: using pins 58 (SDA) and 59 (SCL) malloc space:0x9fefd660->0xdfdfacbf(size 1023 MiB) gpio-leds.6: probe permanently deferred
envfs: no envfs (magic mismatch) - envfs never written? running /env/bin/init...Hit any key to stop autoboot: 1
booting 'mshc1'
mount: No such file or directory
ext4 ext40: EXT2 rev 1,inode_size128, descriptor size 32 mounted/dev/mshc1.0on/mnt/mshc1.0
setting root node failed: Device or resource busy
oftree: Device or resource busyLoading ARM Linux zImage '
/mnt/mshc1.0/zImage'
commandline: console=ttyS2,115200 root=/dev/mmcblk0p2 rootwaitarch_number: 3066=> bb boot success.
=> kernel boot failure.There still are a couple of (possibly unrelated) issues, independent of the compiler used:
1) envfs: no envfs (magic mismatch) - envfs never written?
2) mount: No such file or directory
3) setting root node failed: Device or resource busy
4) oftree: Device or resource busy
5)
arch_number: 3066 [note: boot failure]cheers
Quoted 52 lines · On Montag, 17. September 2018 09:29:42 CEST you wrote:
The current way to calculate the compressed image position works with the OSELAS toolchains, but not with the Debian/Ubuntu toolchains. For these toolchains
&image_end_markeralready returns the correct address, addingglobal_variable_offset()to it is wrong.The solution seems to be to put the
image_end_markerinto a different object file so that the compiler cannot play any tricks to resolve the address internally in the object file.Signed-off-by Sascha Hauer <[email protected]>---
arch/arm/cpu/sections.c | 2 ++
arch/arm/cpu/uncompress.c | 5 +----
arch/arm/include/asm/sections.h | 2 ++
arch/arm/lib/pbl.lds.S | 2 +-4 files changed, 6 insertions(+), 5 deletions(-)diff --git
a/arch/arm/cpu/sections.cb/arch/arm/cpu/sections.cindex5874da2b82..ab08ebf42e100644
---a/arch/arm/cpu/sections.c
+++b/arch/arm/cpu/sections.c
@@ -1,4 +1,5 @@
#include <asm/sections.h>
+#include <linux/types.h>char __rel_dyn_start[0] __attribute__((section(".__rel_dyn_start"))); char __rel_dyn_end[0] __attribute__((section(".__rel_dyn_end"))); @@ -9,3 +10,4 @@ char __bss_start[0] __attribute__((section(".__bss_start"))); char __bss_stop[0] __attribute__((section(".__bss_stop")));
char __image_start[0] __attribute__((section(".__image_start"))); char __image_end[0] __attribute__((section(".__image_end"))); +uint32_t __image_end_marker[1] __attribute__((section(".__image_end_marker"))) = {0xdeadbeef}; diff --gita/arch/arm/cpu/uncompress.cb/arch/arm/cpu/uncompress.cindexb07087e4cf..43b49b4212100644
---a/arch/arm/cpu/uncompress.c
+++b/arch/arm/cpu/uncompress.c
@@ -36,9 +36,6 @@
unsigned longfree_mem_ptr;
unsigned longfree_mem_end_ptr;-static int __attribute__((__section__(".image_end")))
-image_end_marker=0xdeadbeef;
-
void__noreturnbarebox_multi_pbl_start(unsigned long membase, unsigned long memsize, void *boarddata)
{
@@ -50,7 +47,7 @@ void__noreturnbarebox_multi_pbl_start(unsigned long membase, void*pg_start;
unsigned long pc =get_pc();Quoted 5 lines
-
image_end= (void *)&image_end_marker +global_variable_offset();
+image_end= (void *)__image_end_marker +global_variable_offset();if (
IS_ENABLED(CONFIG_PBL_RELOCATABLE)) {
/*_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 7 lines
Андрей _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 11 lines · On Mon, Sep 17, 2018 at 05:30:56PM +0200, [email protected] wrote:
Hello Sascha,
Thank you for this patch. Happy to test it here on rk3188 (radxa rock pro).
Using bb v2018.09.0. Applied your patches below.
CONFIG_PBL_RELOCATABLEis fixed in menuconfig. Common config:grep RELOCAT .config
CONFIG_PBL_RELOCATABLE=yCONFIG_RELOCATABLE=y
Quoted 6 lines
Built using this script:
export ARCH=arm
#export CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf-
export CROSS_COMPILE=/opt/OSELAS.Toolchain-2018.02.0/arm-v7m-eabi/gcc-7.3.1- newlib-2.5.0-binutils-2.30/bin/arm-v7m-eabi-
Not sure if this is intentional – you are using thre ARMv7-M toolchain here but as far as I understand, your could use the ARMv7-A variant (arm-v7a-linux-gnueabi/hf) for the rk3188.
- Roland
Signature · 9 lines
Roland Hieber | [email protected] | Pengutronix e.K. | https://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim | Phone: +49-5121-206917-5086 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox