[U-Boot] [PATCH 4/9] spl: sata: support U-Boot load from raw sata disk

Stefan Roese sr at denx.de
Thu Jul 11 08:57:26 UTC 2019


Hi Baruch,

On 16.05.19 12:03, Baruch Siach wrote:
> Support load of the U-Boot image from raw SATA disk sector. This is
> equivalent to load from MMC raw sector.
> 
> Signed-off-by: Baruch Siach <baruch at tkos.co.il>

This patch breaks cm_t54:

$ ./tools/buildman/buildman cm_t54
Building current source for 1 boards (1 thread, 16 jobs per thread)
        arm:  +   cm_t54
+common/spl/spl_sata.c: In function ?spl_sata_load_image?:
+common/spl/spl_sata.c:90:5: error: ?CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR? undeclared (first use in this function); did you mean ?CONFIG_SPL_SATA_BOOT_DEVICE??
+     CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR);
+     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+     CONFIG_SPL_SATA_BOOT_DEVICE
+common/spl/spl_sata.c:90:5: note: each undeclared identifier is reported only once for each function it appears in
+make[3]: *** [scripts/Makefile.build:278: spl/common/spl/spl_sata.o] Error 1
+make[2]: *** [scripts/Makefile.spl:410: spl/common/spl] Error 2
+make[1]: *** [Makefile:1727: spl/u-boot-spl] Error 2
+make: *** [Makefile:148: sub-make] Error 2
     0    0    1 /1      cm_t54

I'm dropping this one from the upcoming pull request. Please re-send
it, once you've fixed it. And please compile test it for all
targets (Travis).

Thanks,
Stefan

> ---
>   common/spl/Kconfig    | 14 ++++++++++++++
>   common/spl/spl_sata.c | 29 +++++++++++++++++++++++++++++
>   2 files changed, 43 insertions(+)
> 
> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index c7cd34449a52..a90c6adbf68b 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -733,6 +733,20 @@ config SPL_SATA_SUPPORT
>   	  expense and power consumption. This enables loading from SATA
>   	  using a configured device.
>   
> +config SPL_SATA_RAW_U_BOOT_USE_SECTOR
> +	bool "SATA raw mode: by sector"
> +	depends on SPL_SATA_SUPPORT
> +	help
> +	  Use sector number for specifying U-Boot location on SATA disk in
> +	  raw mode.
> +
> +config SPL_SATA_RAW_U_BOOT_SECTOR
> +	hex "Sector on the SATA disk to load U-Boot from"
> +	depends on SPL_SATA_RAW_U_BOOT_USE_SECTOR
> +	help
> +	  Sector on the SATA disk to load U-Boot from, when the SATA disk is being
> +	  used in raw mode. Units: SATA disk sectors (1 sector = 512 bytes).
> +
>   config SPL_SERIAL_SUPPORT
>   	bool "Support serial"
>   	select SPL_PRINTF
> diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c
> index f0af9f38d19f..3ad8a5a58035 100644
> --- a/common/spl/spl_sata.c
> +++ b/common/spl/spl_sata.c
> @@ -25,6 +25,32 @@
>   #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME	"u-boot.img"
>   #endif
>   
> +static int spl_sata_load_image_raw(struct spl_image_info *spl_image,
> +		struct blk_desc *stor_dev, unsigned long sector)
> +{
> +	struct image_header *header;
> +	unsigned long count;
> +	u32 image_size_sectors;
> +	int ret;
> +
> +	header = spl_get_load_buffer(-sizeof(*header), stor_dev->blksz);
> +	count = blk_dread(stor_dev, sector, 1, header);
> +	if (count == 0)
> +		return -EIO;
> +
> +	ret = spl_parse_image_header(spl_image, header);
> +	if (ret)
> +		return ret;
> +
> +	image_size_sectors = DIV_ROUND_UP(spl_image->size, stor_dev->blksz);
> +	count = blk_dread(stor_dev, sector, image_size_sectors,
> +			(void *)spl_image->load_addr);
> +	if (count != image_size_sectors)
> +		return -EIO;
> +
> +	return 0;
> +}
> +
>   static int spl_sata_load_image(struct spl_image_info *spl_image,
>   			       struct spl_boot_device *bootdev)
>   {
> @@ -59,6 +85,9 @@ static int spl_sata_load_image(struct spl_image_info *spl_image,
>   			err = spl_load_image_fat(spl_image, stor_dev,
>   					CONFIG_SYS_SATA_FAT_BOOT_PARTITION,
>   					CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
> +		} else if (IS_ENABLED(CONFIG_SPL_SATA_RAW_U_BOOT_USE_SECTOR)) {
> +			err = spl_sata_load_image_raw(spl_image, stor_dev,
> +				CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR);
>   		}
>   	}
>   	if (err) {
> 

Viele Grüße,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de


More information about the U-Boot mailing list