On 07/09/2012 01:54 PM, Rafał Miłecki wrote:
> ---
> I tried to use LZMA-compressed loader for LZMA-compressed kernel. We
> can't juse use CFE's bootloader to load standard LZMA-compressed kernel,
> because CFE doesn't support LZMA compression with dictionary.
> 
> Not using dictionary results in not optimal size of compressed kernel.
> 
> Unfortunately this patch DOES NOT work, booting hangs on
> Starting program at 0x80001000

With "lzma e -d16 -a0" I get the same results with OpenWrt's lzma
encoder as with Netgear's one from ./tools/lzma.

> Does anyone see any mistake in my code? Hauke?
> 
> P.S.
> Don't be angry at me for hardcoding
> /home/zajec/openwrt.git/staging_dir/host
> it was quick hack for not-accessible $(STAGING_DIR_HOST)
You should forward $(STAGING_DIR_HOST) to the Makefile or add that to
the exec search patch for that Makefile, but I do not know a good
solution for doing so.

> ---
>  target/linux/brcm47xx/image/Makefile               |   13 +++++++++++++
>  target/linux/brcm47xx/image/lzma-loader/Makefile   |    2 +-
>  .../linux/brcm47xx/image/lzma-loader/src/Makefile  |    5 ++++-
>  3 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/target/linux/brcm47xx/image/Makefile 
> b/target/linux/brcm47xx/image/Makefile
> index b247571..5243b84 100644
> --- a/target/linux/brcm47xx/image/Makefile
> +++ b/target/linux/brcm47xx/image/Makefile
> @@ -13,12 +13,14 @@ endef
>  
>  define Image/Prepare
>       cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 
> -lp2 -pb2 > $(KDIR)/vmlinux.lzma
> +
>       rm -f $(KDIR)/loader.gz
>       $(MAKE) -C lzma-loader \
>               BUILD_DIR="$(KDIR)" \
>               TARGET="$(KDIR)" \
>               clean install
>       echo -ne "\\x00" >> $(KDIR)/loader.gz
> +
>       rm -f $(KDIR)/fs_mark
>       echo -ne '\xde\xad\xc0\xde' > $(KDIR)/fs_mark
>       $(call prepare_generic_squashfs,$(KDIR)/fs_mark)
> @@ -104,10 +106,20 @@ define Image/Build/Chk
>       $(STAGING_DIR_HOST)/bin/mkchkimg -o $(BIN_DIR)/openwrt-$(2)-$(5).chk -k 
> $(BIN_DIR)/$(IMG_PREFIX)-$(1).trx -b $(3) -r $(4)
>  endef
>  
> +define Image/Build/ChkWNDR4500
> +     $(STAGING_DIR_HOST)/bin/mkchkimg -o $(BIN_DIR)/openwrt-$(2)-$(5).chk -k 
> $(BIN_DIR)/$(IMG_PREFIX)-$(1)-wndr4500.trx -b $(3) -r $(4)
> +endef
> +
>  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))
> +
> +     # Loader compressed with non-optimal LZMA (without dictionary) - for 
> WNDR4500
> +     $(STAGING_DIR_HOST)/bin/trx -o 
> $(BIN_DIR)/$(IMG_PREFIX)-$(1)-wndr4500.trx \
> +             -f $(KDIR)/loader.lzma -f $(KDIR)/vmlinux.lzma \
> +             $(call trxalign/$(1),$(1))
> +
>       $(call Image/Build/$(1),$(1))
>       $(call Image/Build/Motorola,$(1),wr850g,1,$(1))
>       $(call Image/Build/USR,$(1),usr5461,$(1))
> @@ -117,6 +129,7 @@ define Image/Build
>  #    $(call Image/Build/Chk,$(1),wndr3400_v1,U12H155T00_NETGEAR,2,$(patsubst 
> jffs2-%,jffs2,$(1)))
>  #    $(call 
> Image/Build/Chk,$(1),wndr3400_vcna,U12H155T01_NETGEAR,2,$(patsubst 
> jffs2-%,jffs2,$(1)))
>  #    $(call Image/Build/Chk,$(1),wndr4000,U12H181T00_NETGEAR,2,$(patsubst 
> jffs2-%,jffs2,$(1)))
> +#    $(call 
> Image/Build/ChkWNDR4500,$(1),wndr4500,U12H189T00_NETGEAR,1,$(patsubst 
> jffs2-%,jffs2,$(1)))
>       $(call Image/Build/Chk,$(1),wnr834b_v2,U12H081T00_NETGEAR,2,$(patsubst 
> jffs2-%,jffs2,$(1)))
>  #    $(call Image/Build/Chk,$(1),wnr2000v2,U12H114T00_NETGEAR,2,$(patsubst 
> jffs2-%,jffs2,$(1)))
>  #    $(call Image/Build/Chk,$(1),wnr3500L,U12H136T99_NETGEAR,2,$(patsubst 
> jffs2-%,jffs2,$(1)))
> diff --git a/target/linux/brcm47xx/image/lzma-loader/Makefile 
> b/target/linux/brcm47xx/image/lzma-loader/Makefile
> index 5dd6f50..c274f98 100644
> --- a/target/linux/brcm47xx/image/lzma-loader/Makefile
> +++ b/target/linux/brcm47xx/image/lzma-loader/Makefile
> @@ -26,7 +26,7 @@ install:
>  
>  ifneq ($(TARGET),)
>  install: compile
> -     $(CP) $(PKG_BUILD_DIR)/loader.gz $(PKG_BUILD_DIR)/loader.elf $(TARGET)/
> +     $(CP) $(PKG_BUILD_DIR)/loader.gz $(PKG_BUILD_DIR)/loader.lzma 
> $(PKG_BUILD_DIR)/loader.elf $(TARGET)/
>  endif
>  
>  clean:
> diff --git a/target/linux/brcm47xx/image/lzma-loader/src/Makefile 
> b/target/linux/brcm47xx/image/lzma-loader/src/Makefile
> index 3320e56..6de20c5 100644
> --- a/target/linux/brcm47xx/image/lzma-loader/src/Makefile
> +++ b/target/linux/brcm47xx/image/lzma-loader/src/Makefile
> @@ -34,7 +34,7 @@ SEDFLAGS    := 
> s/BZ_TEXT_START/$(BZ_TEXT_START)/;s/TEXT_START/$(TEXT_START)/
>  
>  OBJECTS              := head.o data.o
>  
> -all: loader.gz loader.elf
> +all: loader.gz loader.lzma loader.elf
>  
>  # Don't build dependencies, this may die if $(CC) isn't gcc
>  dep:
> @@ -44,6 +44,9 @@ install:
>  loader.gz: loader
>       gzip -nc9 $< > $@
>  
> +loader.lzma: loader
> +     /home/zajec/openwrt.git/staging_dir/host/bin/lzma e -d16 $< $@
> +
>  loader.elf: loader.o
>       cp $< $@
>  
> 


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

Reply via email to