[OpenWrt-Devel] [RFC][DONT APPLY][PATCH] brcm47xx: BROKEN image for Netgear WNDR4500

2012-07-09 Thread Rafał Miłecki
---
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

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)
---
 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 $ $@
 
-- 
1.7.7

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


Re: [OpenWrt-Devel] [RFC][DONT APPLY][PATCH] brcm47xx: BROKEN image for Netgear WNDR4500

2012-07-09 Thread Hauke Mehrtens
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 

Re: [OpenWrt-Devel] [RFC][DONT APPLY][PATCH] brcm47xx: BROKEN image for Netgear WNDR4500

2012-07-09 Thread Rafał Miłecki
2012/7/10 Hauke Mehrtens ha...@hauke-m.de:
 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.

Hm, so far I didn't play with -a{N}, I didn't have to set it do 0 to
make LZMA-encoded kernel work with Netgear's CFE bootloader. So I
think it doesn't matter, CFE probably works with both LZMA formats:
-a0 and -a1. Just like it does with any values of -lc{N}, -lp{N} and
-pb{N}.

But I'll give it a change if you think it can be important.

-- 
Rafał
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel