Hello!

On Friday 05 November 2021 14:25:14 Tony Dinh wrote:
> Hi Pali,
> 
> On Fri, Nov 5, 2021 at 3:19 AM Pali Rohár <p...@kernel.org> wrote:
> >
> > 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@72000
> > > > 88E1116 Initialized on ethernet-controller@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)
> >
> 
> Thanks, the patch works great! Here is the log.

Perfect! I did not think that I will detect and fix this issue at the
first shot.

I will send this patch with proper commit message.

> ./kwboot-2021/kwboot
> kwboot version 2022.01-rc1-00041-g2a5ad542e6-dirty
> 
> ./kwboot-2021/kwboot -t -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 (512 bytes)...
>  25 % [....                                                                  ]
> Done
> Sending boot image data (534200 bytes)...
>   0 % [......................................................................]
> <snip>
>  98 % [............................................                          ]
> Done
> Finishing transfer
> [Type Ctrl-\ + c to quit]
> 
> 
> U-Boot 2021.07-tld-1 (Nov 02 2021 - 19:48:03 -0700)
> Pogoplug V4
> SoC:   Kirkwood 88F6192_A1
> Model: Pogoplug v4
> DRAM:  128 MiB
> NAND:  128 MiB
> MMC:   mvsdio@90000: 0
> Loading Environment from NAND... *** Warning - bad CRC, using default
> environment
> In:    serial
> Out:   serial
> Err:   serial
> Net:
> Warning: ethernet-controller@72000 (eth0) using random MAC address -
> 12:1c:5b:05:ed:15
> eth0: ethernet-controller@72000
> Hit any key to stop autoboot:  0
> Pogo_V4>
> 
> Also, I have several Kirkwood boards (with various old BootROM
> versions) that I can run the kwboot tests on. Will keep you posted.

Ok! Do you have some Kirkwood board with PCIe slot? If yes, I would like
to see dumps from config space of Kirkwood PCIe Root Port, see:
https://lore.kernel.org/u-boot/20211104154921.b6zxjpczj7t6qlct@pali/

> Thanks,
> Tony
> 
> 
> 
> 
> > > 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

Reply via email to