[OpenWrt-Devel] [PATCH] ramips: mt7621: use lzma-loader for D-Link DIR-860L B1

Szabolcs Hubai szab.hu at gmail.com
Sun Apr 26 14:11:53 EDT 2020


Hi David!

Sorry for the long mail, it's full of serial log.

Szabolcs Hubai <szab.hu at gmail.com> ezt írta (időpont: 2020. ápr. 26., V, 16:43):
>
> Hi David!
>
> David Bauer <mail at david-bauer.net> ezt írta (időpont: 2020. ápr. 26., V, 14:42):
> >
> > Hi Szabolcs,
> >
> > On 4/19/20 8:49 PM, Szabolcs Hubai wrote:
> > > -  KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma | uImage lzma
> > > +  LOADER_TYPE := bin
> > > +  KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | \
> > > +  relocate-kernel | lzma -a0 | uImage lzma
> >
> > Sorry for going over this one more time. Is there a specific reason
> > to pack the resulting uImage using lzma? Also the lzma-loader relocates
> > itself afaik, so relocate-kernel shouldn't be necessary when using our
> > own loader (i might be wrong here).
> >
> > Could you try the attached patch on your device?
> >
>
> No problem at all, as it's still not landed. :)
> Meanwhile I started playing with that loader-okli what Guo was referring.
> Looks like it needs more magic. :D
>
>
> I tried your proposed path when the recipe hit master, without lack. [0]
> Will try again for you.

I built your patch, let's see the logs!
Here is the initramfs boot - it works because uncompressed image works
through tftp:


Got it
#################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ##
done
Bytes transferred = 4667492 (473864 hex)
NetBootFileXferSize= 00473864
Automatic boot of image at addr 0x80A00000 ...
## Booting image at 80a00000 ...
   Image Name:   MIPS OpenWrt Linux-5.4.34
   Image Type:   MIPS Linux Kernel Image (uncompressed)
   Data Size:    4667428 Bytes =  4.5 MB
   Load Address: 80001000
   Entry Point:  80001000
   Verifying Checksum ... OK
OK

Starting kernel ...



OpenWrt kernel loader for MIPS based SoC
Copyright (C) 2011 Gabor Juhos <juhosg at openwrt.org>
Decompressing kernel... done!
Starting kernel at 80001000...

[    0.000000] Linux version 5.4.34 (xabolcs at ut1804) (gcc version
8.4.0 (OpenWrt GCC 8.4.0 r13060-471b8bf8c1)) #0 SMP Sat Apr 25
09:31:33 2020
[    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
[    0.000000] MIPS: machine is D-Link DIR-860L B1
[    0.000000] Initrd not found or empty - disabling initrd


And here is the boot from flash:


Please choose the operation:
   1: Load system code to SDRAM via TFTP.
   2: Load system code then write to Flash via TFTP.
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial.
   9: Load Boot Loader code then write to Flash via TFTP.
 0

3: System Boot system code via Flash.
## Booting image at bfc50000 ...
addr:80500000
We have SEAMA, Image Size = 4784068
Verifying Checksum ...
Uncompressing SEAMA linux.lzma ... LZMA ERROR 1 - must RESET board to recover


Adding the lzma repack:
KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | lzma -a0 |
uImage lzma
... doesn't break the initramfs ...:


Got it
#################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ###############
done
Bytes transferred = 4732350 (4835be hex)
NetBootFileXferSize= 004835be
Automatic boot of image at addr 0x80A00000 ...
## Booting image at 80a00000 ...
   Image Name:   MIPS OpenWrt Linux-5.4.34
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    4732286 Bytes =  4.5 MB
   Load Address: 80001000
   Entry Point:  80001000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel ...



OpenWrt kernel loader for MIPS based SoC
Copyright (C) 2011 Gabor Juhos <juhosg at openwrt.org>
Decompressing kernel... done!
Starting kernel at 80001000...

[    0.000000] Linux version 5.4.34 (xabolcs at ut1804) (gcc version
8.4.0 (OpenWrt GCC 8.4.0 r13060-471b8bf8c1)) #0 SMP Sat Apr 25
09:31:33 2020
[    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
[    0.000000] MIPS: machine is D-Link DIR-860L B1
[    0.000000] Initrd not found or empty - disabling initrd


and fixes the lzma error but it hangs ...:


Please choose the operation:
   1: Load system code to SDRAM via TFTP.
   2: Load system code then write to Flash via TFTP.
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial.
   9: Load Boot Loader code then write to Flash via TFTP.
 0

3: System Boot system code via Flash.
## Booting image at bfc50000 ...
addr:80500000
We have SEAMA, Image Size = 4849604
Verifying Checksum ...
Uncompressing SEAMA linux.lzma ... OK
## Transferring control to Linux (at address 00000000) ...
## Giving linux memsize in MB, 128

Starting kernel ...

(hang)


Adding relocate-kernel to the recipe:
KERNEL := kernel-bin | append-dtb | lzma | loader-kernel |
relocate-kernel | lzma -a0 | uImage lzma
... still doesn't break initramfs:


Got it
#################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ###############
done
Bytes transferred = 4732442 (48361a hex)
NetBootFileXferSize= 0048361a
Automatic boot of image at addr 0x80A00000 ...
## Booting image at 80a00000 ...
   Image Name:   MIPS OpenWrt Linux-5.4.34
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    4732378 Bytes =  4.5 MB
   Load Address: 80001000
   Entry Point:  80001000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel ...



OpenWrt kernel loader for MIPS based SoC
Copyright (C) 2011 Gabor Juhos <juhosg at openwrt.org>
Decompressing kernel... done!
Starting kernel at 80001000...

[    0.000000] Linux version 5.4.34 (xabolcs at ut1804) (gcc version
8.4.0 (OpenWrt GCC 8.4.0 r13060-471b8bf8c1)) #0 SMP Sat Apr 25
09:31:33 2020
[    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
[    0.000000] MIPS: machine is D-Link DIR-860L B1
[    0.000000] Initrd not found or empty - disabling initrd


... but boots nicely from flash:


Please choose the operation:
   1: Load system code to SDRAM via TFTP.
   2: Load system code then write to Flash via TFTP.
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial.
   9: Load Boot Loader code then write to Flash via TFTP.
 0

3: System Boot system code via Flash.
## Booting image at bfc50000 ...
addr:80500000
We have SEAMA, Image Size = 4849604
Verifying Checksum ...
Uncompressing SEAMA linux.lzma ... OK
## Transferring control to Linux (at address 00000000) ...
## Giving linux memsize in MB, 128

Starting kernel ...



OpenWrt kernel loader for MIPS based SoC
Copyright (C) 2011 Gabor Juhos <juhosg at openwrt.org>
Decompressing kernel... done!
Starting kernel at 80001000...

[    0.000000] Linux version 5.4.34 (xabolcs at ut1804) (gcc version
8.4.0 (OpenWrt GCC 8.4.0 r13060-471b8bf8c1)) #0 SMP Sat Apr 25
09:31:33 2020
[    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
[    0.000000] MIPS: machine is D-Link DIR-860L B1
[    0.000000] Initrd not found or empty - disabling initrd



My patch does this exactly. All step is mandatory.
And now you see the reasons too! :)

--
BR,
Szabolcs

>
> About the lzma repack: I found out that the U-Boot accepts
> uncompressed and lzma compressed initramfs images.
> It doesn't accepts gzip initramfs, but I didn't tested other compressions.
> I also found that the U-Boot expects lzma compressed kernel images
> from the flash and doesn't care about uImage header.
>
> About relocate-kernel: without it the router hangs after "transferring
> control to Linux", like below!
>
>
> Please choose the operation:
>    1: Load system code to SDRAM via TFTP.
>    2: Load system code then write to Flash via TFTP.
>    3: Boot system code via Flash (default).
>    4: Entr boot command line interface.
>    7: Load Boot Loader code then write to Flash via Serial.
>    9: Load Boot Loader code then write to Flash via TFTP.
>  0
>
> 3: System Boot system code via Flash.
> ## Booting image at bfc50000 ...
> addr:80500000
> We have SEAMA, Image Size = 4759794
> Verifying Checksum ...
> Uncompressing SEAMA linux.lzma ... OK
> ## Transferring control to Linux (at address 00000000) ...
> ## Giving linux memsize in MB, 128
>
> Starting kernel ...
>
> (hang)
>
>
>
> [0] https://forum.openwrt.org/t/optimized-build-for-the-d-link-dir-860l/948/1089?u=xabolcs
>
>
> Regards,
> Szabolcs
>
> > Best wishes
> > David

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list