[PATCH] tools/mrvl_uart.sh: Remove script

Pali Rohár pali at kernel.org
Sat Feb 5 01:25:19 CET 2022


On Saturday 05 February 2022 01:01:28 Marcel Ziswiler wrote:
> Addendum.
> 
> On Sat, 2022-02-05 at 00:43 +0100, Marcel Ziswiler wrote:
> 
> > 
> [snip]
> 
> > > Kosta, do you see any problems with removing this script? As you might
> > > have seen, Pali and Marek did some great work on kwboot in the mean
> > > time. Is there anything left in mrvl_uart.sh that kwboot can't handle?
> > 
> > Disclaimer: I am not really a Kirkwood developer or at least not yet (;-p).
> > 
> > Recently, we started playing with mainline U-Boot/Linux kernel as part of an effort to port OpenWrt to the
> > MikroTik RB5009UG [1]. It features an Armada 7040 which is a 64-bit Arm SoC while kwboot mentions 32-bit
> > platforms only. Anyway, so far I was able to boot it using the good oldé mrvl_uart.sh script as follows:
> > 
> > ⬢[zim at toolbox ~]$ ~/u-boot/tools/mrvl_uart.sh /dev/ttyUSB3 ~/arm-trusted-
> > firmware/build/a70x0_rb5009/release/flash-image.bin
> > Using device connected on serial port "/dev/ttyUSB3"
> > Loading flash image file "/var/home/zim/arm-trusted-firmware/build/a70x0_rb5009/release/flash-image.bin"
> > Recovery will run at 115200 baud
> > ========================================
> > Press the "Reset" button on the target board and the "Enter" key on the host keyboard simultaneously
> > Sending /var/home/zim/Sources/arm-trusted-firmware.git/build/a70x0_rb5009/release/flash-image.bin, 11377
> > blocks: Give your local XMODEM receive command now.
> > Bytes Sent:1456384   BPS:7871                            
> > 
> > Transfer complete
> > 
> > Trying this with kwboot instead I was not successful as of yet. Not sure whether I am just missing something
> > or
> > support for booting 64-bit platforms would yet need to be added.
> 
> If I patch it as follows it actually starts transferring but does not really get too far.

64-bit Armada SoCs use different image format than 32-bit Armada SoCs.
This format is not supported by U-Boot as U-Boot does not even build
images for this format. You even cannot boot U-Boot directly on those
64-bit Armada SoCs. It is TF-A what is booted and it is TF-A project
which generate images compatible for those SoCs. So U-Boot does not have
any support for those 64-bit images.

So you should use TF-A tools which generates these 64-bit Armada
bootable images.

Probably you could use kwboot just for sending boot pattern and then
generic "sx" tool (which is used also by that shell script). And after
that kwboot again for terminal support. But this does not verify that
image is correct and also may have issues if header part contains
executable code which prints something to UART...

$ kwboot -b /dev/ttyUSB0
$ sx flash-image.bin 0<>/dev/ttyUSB0 1>&0
$ kwboot -t /dev/ttyUSB0

> diff --git a/tools/kwboot.c b/tools/kwboot.c
> index d22e6ea96a..4f40da4f7a 100644
> --- a/tools/kwboot.c
> +++ b/tools/kwboot.c
> @@ -1500,7 +1500,8 @@ kwboot_img_patch(void *img, size_t *size, int baudrate)
>         image_ver = kwbimage_version(img);
>         if (image_ver != 0 && image_ver != 1) {
>                 fprintf(stderr, "Invalid image header version\n");
> -               goto err;
> +fprintf(stderr, "IGNORING\n");
> +//             goto err;
>         }
>  
>         hdrsz = kwbheader_size(hdr);
> @@ -1782,7 +1783,8 @@ main(int argc, char **argv)
>                 rc = kwboot_img_patch(img, &size, baudrate);
>                 if (rc) {
>                         fprintf(stderr, "%s: Invalid image.\n", imgpath);
> -                       goto out;
> +fprintf(stderr, "IGNORING\n");
> +//                     goto out;
>                 }
>         }
>  
> 
> ⬢[zim at toolbox Research]$ ./kwboot -b ~/arm-trusted-firmware/build/a70x0_rb5009/release/flash-image.bin
> /dev/ttyUSB3
> kwboot version 2022.01-00018-g666d9a62e0-dirty
> Invalid image header version
> IGNORING
> /var/home/zim/arm-trusted-firmware/build/a70x0_rb5009/release/flash-image.bin: Invalid image.
> IGNORING
> Sending boot message. Please reboot the target...|
> Waiting 2s and flushing tty
> Sending boot image header (13356800 bytes)...
>   0 % [......................................................................]
> 
> [snip: 40 more lines]
> 
>   2 % [...................................................................++.]
>   2 % [+++++++++++++++++
> xmodem: Bad message
> 
> > Suggestions welcome. Thanks!
> > 
> > > Thanks,
> > > Stefan
> > 
> > [1] https://forum.openwrt.org/t/add-support-for-mikrotik-rb5009ug
> > 
> > Cheers
> > 
> > Marcel
> 
> [snip]


More information about the U-Boot mailing list