kwboot: Testing latest kwboot with Kirkwood SoC boards

Pali Rohár pali at kernel.org
Fri Nov 5 11:19:20 CET 2021


On Friday 05 November 2021 09:38:28 Pali Rohár wrote:
> Hello!
> 
> On Thursday 04 November 2021 23:27:32 Tony Dinh wrote:
> > Hi Marek and Pali,
> > 
> > First off all, thanks for your hughe work on this. I have a few Armada
> > 38x boards that I had quite a hard time running kwboot in the past.
> > Hopefully, I will have more luck with the new kwboot.
> > 
> > Here is a problem I've found running kwboot on the Zyxel NSA310S NAS
> > (Kirkwood 6702). The target is a Pogoplug V4 (Kirkwood 6192 SoC). Same
> > behavior was observed running kwboot on this Pogoplug V4 to boot the
> > NSA310S target.
> > 
> > - kwboot build version
> > 
> > ./kwboot-2021/kwboot
> > kwboot version 2022.01-rc1-00034-gbc18582a14
> > 
> > - kwboot session log
> > 
> > ./kwboot-2021/kwboot -t -p -B 115200 /dev/ttyUSB0 -b
> > uboot.2021.07-tld-1.pogo_v4.mtd0.kwb
> > Patching image boot signature to UART
> > Aligning image header to Xmodem block size
> > Sending boot message. Please reboot the target...\
> > Waiting 2s and flushing tty
> > Sending boot image header (480 bytes)...
> >  26 % [....                                                                  ]
> > Done
> > 
> > U-Boot 2021.04-tld-1 (Jun 10 2021 - 20:46:14 -0700)
> > Pogoplug V4
> > 
> > SoC:   Kirkwood 88F6192_A1
> > DRAM:  128 MiB
> > NAND:  128 MiB
> > MMC:
> > Loading Environment from NAND... *** Warning - bad CRC, using default
> > environment
> > In:    serial
> > Out:   serial
> > Err:   serial
> > Net:   eth0: ethernet-controller at 72000
> > 88E1116 Initialized on ethernet-controller at 72000
> > Hit any key to stop autoboot:  9
> >  8
> >  7
> > 
> > As you can see above, it looks like the u-boot header transfer was
> > completed but the u-boot image transfer did not start. Seems like
> > BootROM did not recognize the header is UART.
> 
> Yes, it looks like that kwbimage header was refused by the bootroom.

Tony, could you try following patch?

diff --git a/tools/kwboot.c b/tools/kwboot.c
index bacca1530110..2470906a38d1 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -1072,6 +1072,7 @@ kwboot_xmodem(int tty, const void *_img, size_t size, int baudrate)
 	size_t hdrsz;
 
 	hdrsz = kwbheader_size(img);
+	hdrsz += (KWBOOT_XM_BLKSZ - hdrsz % KWBOOT_XM_BLKSZ) % KWBOOT_XM_BLKSZ;
 
 	kwboot_printv("Waiting 2s and flushing tty\n");
 	sleep(2); /* flush isn't effective without it */
@@ -1083,12 +1084,13 @@ kwboot_xmodem(int tty, const void *_img, size_t size, int baudrate)
 	if (rc)
 		return rc;
 
-	img += hdrsz;
-	size -= hdrsz;
-
-	rc = kwboot_xmodem_one(tty, &pnum, 0, img, size, 0);
-	if (rc)
-		return rc;
+	if (hdrsz < size) {
+		img += hdrsz;
+		size -= hdrsz;
+		rc = kwboot_xmodem_one(tty, &pnum, 0, img, size, 0);
+		if (rc)
+			return rc;
+	}
 
 	rc = kwboot_xm_finish(tty);
 	if (rc)

> Do you have some older U-Boot binary in .kwb format which you can
> successfully boot? Or are you able to boot that U-Boot binary via some
> older version of kwboot?
> 
> I would like to inspect some working setup, so need some U-Boot binary
> which can be successfully transferred.
> 
> > The Pogoplug V4
> > continued to boot with the image on NAND (U-Boot 2021.04-tld-1). So
> > kwboot_xm_finish() was never executed. At this point we lost the
> > terminal, and could not interrupt the countdown. The system continued
> > booting and at one point, serial console output stopped with an error
> > message that indicated kwboot thinks it is still in xmodem mode (but
> > the BootROM actually started the NAND image).
> > 
> > xmodem: Connection timed out
> > 
> > Please let me know if there is any idea that you want me to try.
> > 
> > Thanks,
> > Tony


More information about the U-Boot mailing list