[PATCH] tools/mrvl_uart.sh: Remove script

Marcel Ziswiler marcel at ziswiler.com
Sat Feb 5 03:07:00 CET 2022


On Sat, 2022-02-05 at 01:54 +0100, Pali Rohár wrote:
> On Saturday 05 February 2022 01:40:23 Marcel Ziswiler wrote:
> > On Sat, 2022-02-05 at 01:25 +0100, Pali Rohár wrote:
> > > 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.
> > 
> > Yes, we do know that.
> > 
> > > So U-Boot does not have any support for those 64-bit images.
> > 
> > Yes, U-Boot proper basically has to be combined with TF-A using some
> > external tooling.
> > 
> > > So you should use TF-A tools which generates these 64-bit Armada
> > > bootable images.
> > 
> > Exactly.
> > 
> > 
> > > 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
> > 
> > Hm, at least kwboot from today's master does not allow -b without also
> > giving it an image.
> 
> This commit is part of master branch and added support for it:
> https://source.denx.de/u-boot/u-boot/-/commit/c513fe47dca24de87a904ce7d71cfd8a390e1154
> 
> If it does not work then there is some bug which should be fixed. I have
> tested it and it works on my setup.
> 
> Can you check if you have that commit to ensure that we are not going to
> test / debug older version?

Yes, sure. I debugged it a little and I believe I found the issue. I guess the intention was for it to be run
giving it a dash '-' as image argument for skipping. (Even though that usually would mean using stdin). Anyway,
it fails as it then uses such dash as ttypath because optind did not get incremented. The following fixes it
for me:

diff --git a/tools/kwboot.c b/tools/kwboot.c
index 2684f0e75a..d490c026e9 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -1768,7 +1768,8 @@ main(int argc, char **argv)
                        if (prev_optind == optind)
                                goto usage;
                        if (argv[optind] && argv[optind][0] != '-')
-                               imgpath = argv[optind++];
+                               imgpath = argv[optind];
+                       optind++;
                        break;
 
                case 'D':

Let me know if that is indeed the intention and I can send a proper fix for it. Maybe I can also update the
documentation/usage in that respect. Thanks again.

> > > $ sx flash-image.bin 0<>/dev/ttyUSB0 1>&0
> > > $ kwboot -t /dev/ttyUSB0
> > 
> > Remember, it is not that we do not have a solution or do not know how
> > this all works. It is rather that we currently use that mrvl_uart.sh
> > script which this patch is about to remove and Stefan enquired about.
> 
> I see...
> 
> But I do not know what is the best option for now. If issue with -b is
> investigated / fixed then that script can be replaced by two (or three)
> commands. And I think it is better than maintaining two different tools
> in U-Boot which do same thing. On the other hand kwboot does not support
> 64-bit Armada format, which mrvl_uart.sh can handle (but only because it
> does not do any verification nor does not understand image format), so
> for this purpose it is better. But because U-Boot does not support
> 64-bit Armada image format, I do not know if this script should be in
> U-Boot because whole image building is outside of U-Boot responsibility
> and... probably this tool should be part of TF-A project instead. So at
> the end, should be this tool maintained in U-Boot project at all if
> U-Boot itself does not support nor provide tooling for 64-bit Armada
> images?
> 
> Any opinion?
> 
> > Thanks, Pali.
> > 
> > [snip]


More information about the U-Boot mailing list