[PATCH 1/2] tools: mkimage: Add StarFive SPL image support

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Wed Sep 6 13:28:16 CEST 2023


On 06.09.23 12:47, Chanho Park wrote:
> Hi,
> 
>> -----Original Message-----
>> From: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
>> Sent: Wednesday, September 6, 2023 7:08 PM
>> To: Rick Chen <rick at andestech.com>; Leo <ycliang at andestech.com>; Yanhong
>> Wang <yanhong.wang at starfivetech.com>
>> Cc: Simon Glass <sjg at chromium.org>; Marc Kleine-Budde
> <mkl at pengutronix.de>;
>> Chanho Park <chanho61.park at samsung.com>; u-boot at lists.denx.de; Heinrich
>> Schuchardt <heinrich.schuchardt at canonical.com>
>> Subject: [PATCH 1/2] tools: mkimage: Add StarFive SPL image support
>>
>> The StarFive JH7110 base boards require a header to be prefixed to the SPL
>> binary image. This has previously done with a vendor tool 'spl_tool'
>> published under a GPL-2-or-later license. Integrate this capability into
>> mkimage.
>>
>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
>> ---
>>   boot/image.c    |   1 +
>>   include/image.h |   1 +
>>   tools/Makefile  |   1 +
>>   tools/sfspl.c   | 174 ++++++++++++++++++++++++++++++++++++++++++++++++
>>   4 files changed, 177 insertions(+)
>>   create mode 100644 tools/sfspl.c
>>
>> diff --git a/boot/image.c b/boot/image.c
>> index 5c4f9b807d..3a99d2e897 100644
>> --- a/boot/image.c
>> +++ b/boot/image.c
>> @@ -182,6 +182,7 @@ static const table_entry_t uimage_type[] = {
>>   	{	IH_TYPE_SUNXI_TOC0, "sunxi_toc0",  "Allwinner TOC0 Boot
>> Image" },
>>   	{	IH_TYPE_FDT_LEGACY, "fdt_legacy", "legacy Image with Flat
>> Device Tree ", },
>>   	{	IH_TYPE_RENESAS_SPKG, "spkgimage", "Renesas SPKG Image" },
>> +	{	IH_TYPE_STARFIVE_SPL, "sfspl", "StarFive SPL Image" },
>>   	{	-1,		    "",		  "",			},
>>   };
>>
>> diff --git a/include/image.h b/include/image.h
>> index 01a6787d21..5f85bf84a2 100644
>> --- a/include/image.h
>> +++ b/include/image.h
>> @@ -231,6 +231,7 @@ enum image_type_t {
>>   	IH_TYPE_SUNXI_TOC0,		/* Allwinner TOC0 Boot Image */
>>   	IH_TYPE_FDT_LEGACY,		/* Binary Flat Device Tree Blob	in a
>> Legacy Image */
>>   	IH_TYPE_RENESAS_SPKG,		/* Renesas SPKG image */
>> +	IH_TYPE_STARFIVE_SPL,		/* StarFive SPL image */
>>
>>   	IH_TYPE_COUNT,			/* Number of image types */
>>   };
>> diff --git a/tools/Makefile b/tools/Makefile
>> index 3d0c4b0dd6..1aa1e36137 100644
>> --- a/tools/Makefile
>> +++ b/tools/Makefile
>> @@ -123,6 +123,7 @@ dumpimage-mkimage-objs := aisimage.o \
>>   			pblimage.o \
>>   			pbl_crc32.o \
>>   			renesas_spkgimage.o \
>> +			sfspl.o \
>>   			vybridimage.o \
>>   			stm32image.o \
>>   			$(ROCKCHIP_OBS) \
>> diff --git a/tools/sfspl.c b/tools/sfspl.c
>> new file mode 100644
>> index 0000000000..428542d885
>> --- /dev/null
>> +++ b/tools/sfspl.c
>> @@ -0,0 +1,174 @@
>> +// SPDX-License-Identifier: GPL-2.0-or-later
>> +/*
>> + * Copyright Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
>> + *
>> + * The StarFive JH710 requires to prepend a header to u-boot-spl.bin
>> describing
> 
> Nit: JH7110 or JH7100? If you'd like to indicate both, JH71x0?

Thank you for testing. This should be JH7110.

The JH7100 on the BeagleV Starlight Beta uses a different format. Only a 
4 byte length field is prepended to the SPL binary. See
https://github.com/starfive-tech/freelight-u-sdk/blob/JH7100_VisionFive/fsz.sh

Best regards

Heinrich

> 
> Tested-by: Chanho Park <chanho61.park at samsung.com>
> 
> Best Regards,
> Chanho Park



More information about the U-Boot mailing list