diff mbox series

[OpenWrt-Devel] ath79: archer-c7-v5: fix initramfs image

Message ID 20200617215657.4330-1-ynezz@true.cz
State Superseded
Delegated to: Petr Štetiar
Headers show
Series [OpenWrt-Devel] ath79: archer-c7-v5: fix initramfs image | expand

Commit Message

Petr Štetiar June 17, 2020, 9:56 p.m. UTC
Currently it's not possible to tftpboot initramfs image as the image
contains tplink-v1-header which leads to:

 ath> bootm
 ## Booting image at 81000000 ...
 Bad Magic Number

Fix this by using uImage wrapped initramfs image.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
 target/linux/ath79/image/generic-tp-link.mk | 1 +
 1 file changed, 1 insertion(+)

Comments

Baptiste Jonglez June 19, 2020, 8:22 a.m. UTC | #1
Hi,

On 17-06-20, Petr Štetiar wrote:
> Currently it's not possible to tftpboot initramfs image as the image
> contains tplink-v1-header which leads to:

Out of curiosity, it looks like booting an initramfs image is only
possible with serial access to the bootloader?

> --- a/target/linux/ath79/image/generic-tp-link.mk
> +++ b/target/linux/ath79/image/generic-tp-link.mk
> @@ -197,6 +197,7 @@ define Device/tplink_archer-c7-v5
>    TPLINK_BOARD_ID := ARCHER-C7-V5
>    BOARDNAME := ARCHER-C7-V5
>    SUPPORTED_DEVICES += archer-c7-v5
> +  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImageArcher lzma
>  endef
>  TARGET_DEVICES += tplink_archer-c7-v5

This is strange, Device/tplink-safeloader-uimage already defines KERNEL
the same way:

  KERNEL := kernel-bin | append-dtb | lzma | uImageArcher lzma

AFAIK, KERNEL_INITRAMFS should default to the same value as KERNEL.

Baptiste
Petr Štetiar June 19, 2020, 9:32 a.m. UTC | #2
Baptiste Jonglez <baptiste@bitsofnetworks.org> [2020-06-19 10:22:57]:

Hi,

> On 17-06-20, Petr Štetiar wrote:
> > Currently it's not possible to tftpboot initramfs image as the image
> > contains tplink-v1-header which leads to:
> 
> Out of curiosity, it looks like booting an initramfs image is only
> possible with serial access to the bootloader?

indeed, my use case is CI automatic testing with labgrid, so I don't want to
trash my flash. In probably weekly CI job I plan to write factory image and
perform sysupgrade in order to test those images as well.

> > --- a/target/linux/ath79/image/generic-tp-link.mk
> > +++ b/target/linux/ath79/image/generic-tp-link.mk
> > @@ -197,6 +197,7 @@ define Device/tplink_archer-c7-v5
> >    TPLINK_BOARD_ID := ARCHER-C7-V5
> >    BOARDNAME := ARCHER-C7-V5
> >    SUPPORTED_DEVICES += archer-c7-v5
> > +  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImageArcher lzma
> >  endef
> >  TARGET_DEVICES += tplink_archer-c7-v5
> 
> This is strange, Device/tplink-safeloader-uimage already defines KERNEL
> the same way:
> 
>   KERNEL := kernel-bin | append-dtb | lzma | uImageArcher lzma
> 
> AFAIK, KERNEL_INITRAMFS should default to the same value as KERNEL.

Indeed, but Device/tplink-v1 redefines that to:

 KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | tplink-v1-header

and Device/tplink-safeloader-uimage inherits from Device/tplink-v1, reusing
that KERNEL_INITRAMFS variable.

Thanks for the review, going to send hopefully proper patch in a moment.

-- ynezz
Baptiste Jonglez June 19, 2020, 10:35 a.m. UTC | #3
On 19-06-20, Petr Štetiar wrote:
> > On 17-06-20, Petr Štetiar wrote:
> > > Currently it's not possible to tftpboot initramfs image as the image
> > > contains tplink-v1-header which leads to:
> > 
> > Out of curiosity, it looks like booting an initramfs image is only
> > possible with serial access to the bootloader?
> 
> indeed, my use case is CI automatic testing with labgrid, so I don't want to
> trash my flash. In probably weekly CI job I plan to write factory image and
> perform sysupgrade in order to test those images as well.

Interesting! https://github.com/labgrid-project/labgrid

> > This is strange, Device/tplink-safeloader-uimage already defines KERNEL
> > the same way:
> > 
> >   KERNEL := kernel-bin | append-dtb | lzma | uImageArcher lzma
> > 
> > AFAIK, KERNEL_INITRAMFS should default to the same value as KERNEL.
> 
> Indeed, but Device/tplink-v1 redefines that to:
> 
>  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | tplink-v1-header
> 
> and Device/tplink-safeloader-uimage inherits from Device/tplink-v1, reusing
> that KERNEL_INITRAMFS variable.

Ah, right, didn't spot that.  It means that other boards using
Device/tplink-safeloader-uimage likely have the same issue.

> Thanks for the review, going to send hopefully proper patch in a moment.
> 
> -- ynezz
diff mbox series

Patch

diff --git a/target/linux/ath79/image/generic-tp-link.mk b/target/linux/ath79/image/generic-tp-link.mk
index bd7eb3fc7608..abb24bfb9a9e 100644
--- a/target/linux/ath79/image/generic-tp-link.mk
+++ b/target/linux/ath79/image/generic-tp-link.mk
@@ -197,6 +197,7 @@  define Device/tplink_archer-c7-v5
   TPLINK_BOARD_ID := ARCHER-C7-V5
   BOARDNAME := ARCHER-C7-V5
   SUPPORTED_DEVICES += archer-c7-v5
+  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImageArcher lzma
 endef
 TARGET_DEVICES += tplink_archer-c7-v5