[OpenWrt-Devel] [PATCH] brcm47xx: image: build alternative TRX using less optimized LZMA

Mathias Adam m.adam--openwrt at adamis.de
Mon Aug 25 14:25:19 EDT 2014


Hi Rafal,

just gave it a try on a Huawei E970: it didn't work, unfortunately (see
below).

Originally, this device ran into a reboot loop after "Starting program at
0x80001000" with lzma-loader. The device has a hardware watchdog set to
about 1 or 2 seconds, so I thought it may as well be the hang you're
reporting.

When adding support for E970 I had introduced the -gz image variant with
gzipped kernel and no lzma-loader. Still it would be nicer to get rid of
the extra image variant, additional to the fact that .gz is considerably
larger than .lzma image.


This is what I get:

CFE version 1.0.37 for BCM947XX (32bit,SP,LE)
Build Date: <C8><FD>  2<D4><C2> 13 14:50:54 CST 2008
(w114501 at localhost.localdomain)
Copyright (C) 2000,2001,2002,2003 Broadcom Corporation.
[...]
Loader:raw Filesys:raw Dev:flash0.os File: Options:(null)
Loading: . 0 bytes read
Failed.
Could not load flash0.os:: Error
CFE clear reboot_number: reboot_flag0 = 0x12345678, reboot_flag1 =
0x0,reboot_flag2 = 0xffffffff,reboot_number = 0x0
web info: Waiting for connection on socket 0.
CFE>

Loading manually gives some more detail but still doesn't work:

CFE> load -raw flash0.os:
Loader:raw Filesys:raw Dev:flash0.os File: Options:(null)
Loading: Failed.
Could not load flash0.os:: Invalid boot block on disk
*** command status = -31


After reflashing with the -gz image it boots as expected:

Loader:raw Filesys:raw Dev:flash0.os File: Options:(null)
Loading: .......... 3356676 bytes read
Entry at 0x80001000
Closing network.
Starting program at 0x80001000
[    0.000000] Linux version 3.10.12 (fnord at tschunk) (gcc version 4.6.4
(OpenWrt/Linaro GCC 4.6-2013.05 r38170) ) #1 Wed Sep 25 09:54:13 UTC 2013
[    0.000000] CPU revision is: 00029029 (Broadcom BMIPS3300)


I've read that different versions of lzma behave differently, and using
stdin is different than using file input.

I tried using stdin:
$ cat ... | lzma e -si -so -d16 > ...
--> surprisingly the .lzma is different, but doesn't work as well

I also tried the lzma parameters and dd hack mentioned here, but still no
luck:
<https://lists.openwrt.org/pipermail/openwrt-devel/2008-May/002290.html>



To make it short: do you have an idea worth trying? can I check whether
this CFE supports lzma at all? unfortunately the sources I have from
Huawei don't contain CFE...
Thanks!


Mathias



Am Mo, 18.08.2014, 21:44 schrieb Rafał Miłecki:
> There is a group of devices that lzma-loader doesn't work with. They
> simply hang at "Starting program at 0x80001000" which is really hard to
> debug and we didn't find any solution for this for years.
>
> Broadcom doesn't use lzma-loader on these devices anyway. They decided
> to drop lzma-loader and use less optimal LZMA compression that can be
> handled by CFE itself (it doesn't use dictionary).
>
> So support these devices we will need kernel compressed with different
> parameters and trx without a loader.
>
> Signed-off-by: Rafał Miłecki <zajec5 at gmail.com>
> ---
>  target/linux/brcm47xx/image/Makefile | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/target/linux/brcm47xx/image/Makefile
> b/target/linux/brcm47xx/image/Makefile
> index 584bb6c..d19a13e 100644
> --- a/target/linux/brcm47xx/image/Makefile
> +++ b/target/linux/brcm47xx/image/Makefile
> @@ -12,7 +12,12 @@ define Build/Clean
>  endef
>
>  define Image/Prepare
> +	# Optimized LZMA compression (with dictionary), handled by lzma-loader.
>  	cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1
> -lp2 -pb2 > $(KDIR)/vmlinux.lzma
> +
> +	# Less optimal LZMA compression (no dictionary), handled by CFE.
> +	$(STAGING_DIR_HOST)/bin/lzma e -so -d16 $(KDIR)/vmlinux >
> $(KDIR)/vmlinux-nodictionary.lzma
> +
>  	gzip -nc9 $(KDIR)/vmlinux > $(KDIR)/vmlinux.gz
>  ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
>  	cat $(KDIR)/vmlinux-initramfs | $(STAGING_DIR_HOST)/bin/lzma e -si -so
> -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux-initramfs.lzma
> @@ -230,6 +235,9 @@ define Image/Build
>  	$(STAGING_DIR_HOST)/bin/trx -o $(BIN_DIR)/$(IMG_PREFIX)-$(1).trx \
>  		-f $(KDIR)/loader.gz -f $(KDIR)/vmlinux.lzma \
>  		$(call trxalign/$(1),$(1))
> +	$(STAGING_DIR_HOST)/bin/trx -o
> $(BIN_DIR)/$(IMG_PREFIX)-$(1)-noloader-nodictionary.trx \
> +		-f $(KDIR)/vmlinux-nodictionary.lzma \
> +		$(call trxalign/$(1),$(1))
>  	$(STAGING_DIR_HOST)/bin/trx -o $(BIN_DIR)/$(IMG_PREFIX)-$(1)-gz.trx \
>  		-f $(KDIR)/vmlinux.gz \
>  		$(call trxalign/$(1),$(1))
> --
> 1.8.4.5
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list