[PATCH v2 5/5] rockchip: rockpro64: Build u-boot-rockchip-spi.bin

Jonas Karlman jonas at kwiboo.se
Wed May 17 21:52:38 CEST 2023


Hi Peter,

On 2023-05-17 21:14, Peter Robinson wrote:
> On Wed, May 17, 2023 at 7:41 PM Jonas Karlman <jonas at kwiboo.se> wrote:
>>
>> Enable CONFIG_ROCKCHIP_SPI_IMAGE to build u-boot-rockchip-spi.bin.
>> Define CONFIG_SYS_SPI_U_BOOT_OFFS to write u-boot.itb at the expected
> 
> None of the other rk33* devices enable this offset yet my Pinebook Pro
> works fine booting from SPI flash, what does this fix/enable/change
> over the defaults?

Most other RK3399 devices define the offset in the device tree, even for
the rockpro64. However, the CONFIG_SYS_SPI_U_BOOT_OFFS is used as the
fallback when device tree value is missing, and also as the offset used
when generating the u-boot-rockchip-spi.bin using binman.

puma-rk3399_defconfig is the only other RK3399 board that also generates
a u-boot-rockchip-spi.bin, has CONFIG_ROCKCHIP_SPI_IMAGE=y. That board
override the simple-bin-spi fit offset in rk3399-puma-haikou-u-boot.dtsi
instead of using the Kconfig option.

> 
>> offset. Enable CONFIG_LTO to reduce size of SPL so that the mkimage
>> output fit before the 0x60000 offset in u-boot-rockchip-spi.bin.
> 
> The enabling of LTO seems like a separate change TBH, the changes seem
> to be independent and there's no mention of it in the subject.

Without LTO enabled the idbloader.img grows too large that it does not
fit before the u-boot.itb payload at 0x60000 and bulding of
u-boot-rockchip-spi.bin fails the u-boot build.

In order to generate a valid u-boot-rockchip-spi.bin, LTO was required
to be enabled, there is also a short mention of it in the commit message.
The alternative would be to move the payload offset to e.g. 0x80000 but
that felt like a too big and risky change.

Regards,
Jonas

> 
>>   => sf probe
>>   SF: Detected gd25q128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
>>   => load mmc 1:1 10000000 u-boot-rockchip-spi.bin
>>   1442304 bytes read in 27 ms (50.9 MiB/s)
>>   => sf update $fileaddr 0 $filesize
>>   device 0 offset 0x0, size 0x160200
>>   1421824 bytes written, 20480 bytes skipped in 9.501s, speed 155432 B/s
>>
>> Signed-off-by: Jonas Karlman <jonas at kwiboo.se>
>> Reviewed-by: Kever Yang <kever.yang at rock-chips.com>
>> ---
>> v2:
>> - Collect r-b tag
>>
>>  configs/rockpro64-rk3399_defconfig | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig
>> index 0ca2cecade25..f41c03067903 100644
>> --- a/configs/rockpro64-rk3399_defconfig
>> +++ b/configs/rockpro64-rk3399_defconfig
>> @@ -11,6 +11,7 @@ CONFIG_ENV_OFFSET=0x3F8000
>>  CONFIG_DEFAULT_DEVICE_TREE="rk3399-rockpro64"
>>  CONFIG_DM_RESET=y
>>  CONFIG_ROCKCHIP_RK3399=y
>> +CONFIG_ROCKCHIP_SPI_IMAGE=y
>>  CONFIG_TARGET_ROCKPRO64_RK3399=y
>>  CONFIG_SPL_STACK=0x400000
>>  CONFIG_DEBUG_UART_BASE=0xFF1A0000
>> @@ -20,6 +21,7 @@ CONFIG_SPL_SPI=y
>>  CONFIG_SYS_LOAD_ADDR=0x800800
>>  CONFIG_PCI=y
>>  CONFIG_DEBUG_UART=y
>> +CONFIG_LTO=y
>>  CONFIG_SPL_FIT_SIGNATURE=y
>>  CONFIG_BOOTSTAGE=y
>>  CONFIG_BOOTSTAGE_REPORT=y
>> @@ -37,6 +39,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x2000
>>  CONFIG_SPL_STACK_R=y
>>  CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000
>>  CONFIG_SPL_SPI_LOAD=y
>> +CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000
>>  CONFIG_TPL=y
>>  CONFIG_CMD_BOOTZ=y
>>  CONFIG_CMD_GPT=y
>> --
>> 2.40.1
>>



More information about the U-Boot mailing list