[PATCH u-boot-mvebu 2/7] cmd: mvebu/bubt: a38x: Do not hardcode SATA block size to 512
Stefan Roese
sr at denx.de
Tue Apr 11 14:33:31 CEST 2023
Hi Pali,
On 3/29/23 21:25, Pali Rohár wrote:
> Find SATA block device by blk_get_devnum_by_uclass_id() function and read
> from it the real block size of the SATA disk.
>
> Signed-off-by: Pali Rohár <pali at kernel.org>
> ---
> cmd/mvebu/bubt.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
> index 49797b23144b..bbe9851dfdeb 100644
> --- a/cmd/mvebu/bubt.c
> +++ b/cmd/mvebu/bubt.c
> @@ -925,8 +925,11 @@ static int check_image_header(void)
> offset = le32_to_cpu(hdr->srcaddr);
> size = le32_to_cpu(hdr->blocksize);
>
> - if (hdr->blockid == 0x78) /* SATA id */
> - offset *= 512;
> + if (hdr->blockid == 0x78) { /* SATA id */
> + struct blk_desc *blk_dev = blk_get_devnum_by_uclass_id(UCLASS_SCSI, 0);
A CI world build leads to this error for some targets. Here the log
for "maxbcm_defconfig":
/opt/kernel.org/gcc-12.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd:
cmd/mvebu/bubt.o: in function `check_image_header':
/home/stefan/git/u-boot/u-boot-marvell/cmd/mvebu/bubt.c:928: undefined
reference to `blk_get_devnum_by_uclass_id'
make: *** [Makefile:1757: u-boot] Error 1
Could you please take a look?
Thanks,
Stefan
> + unsigned long blksz = blk_dev ? blk_dev->blksz : 512;
> + offset *= blksz;
> + }
>
> if (offset % 4 != 0 || size < 4 || size % 4 != 0) {
> printf("Error: Bad A38x image blocksize.\n");
Viele Grüße,
Stefan Roese
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
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