ar71xx: update image generation and trx header parsing for the WRT160NL
authorGabor Juhos <juhosg@openwrt.org>
Sat, 27 Mar 2010 17:38:36 +0000 (17:38 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Sat, 27 Mar 2010 17:38:36 +0000 (17:38 +0000)
 * patch by Bernhard Loos
 * note: trailing whitespaces has been removed

SVN-Revision: 20525

target/linux/ar71xx/files/drivers/mtd/wrt160nl_part.c
target/linux/ar71xx/image/Makefile

index da54e0ff49cc4950e449ee8c7f642a0ed4b7a913..e42b3d401988bec0217916b65b2641a8be7a2646 100644 (file)
@@ -123,12 +123,7 @@ static int wrt160nl_parse_partitions(struct mtd_info *master,
                goto free_hdr;
        }
 
-       kernel_len = uheader->ih_size / master->erasesize;
-       if (uheader->ih_size % master->erasesize)
-               kernel_len++;
-
-       kernel_len++;
-       kernel_len *= master->erasesize;
+       kernel_len = le32_to_cpu(theader->offsets[1]) + sizeof(struct cybertan_header);
 
        trx_parts[0].name = "u-boot";
        trx_parts[0].offset = 0;
index e57808e5c51715160603dae8e99f9455688a5ad5..00580fd8a389aa36eceddc250a7595b8eb14b75d 100644 (file)
@@ -318,16 +318,12 @@ endef
 define Image/Build/CyberTAN
        $(call PatchKernelGzip,$(2),$(3))
        $(call MkImageGzip,$(KDIR)/vmlinux-$(2).bin.gz,$(KDIR)/vmlinux-$(2).uImage)
-       ( \
-               dd if=$(KDIR)/vmlinux-$(2).uImage bs=64k conv=sync; \
-               dd if=/dev/zero bs=1 count=65476; \
-               dd if=$(KDIR)/root.$(1) bs=64k; \
-       ) > $(KDIR)/vmlinux-$(2).image
-       $(STAGING_DIR_HOST)/bin/trx -o $(KDIR)/vmlinux-$(2).trx \
-               -f $(KDIR)/vmlinux-$(2).image
-       -$(STAGING_DIR_HOST)/bin/addpattern -B $(2) -v v$(4) -g \
-               -i $(KDIR)/vmlinux-$(2).trx \
+       $(STAGING_DIR_HOST)/bin/trx -o $(KDIR)/image.tmp -f $(KDIR)/vmlinux-$(2).uImage \
+               -x 32 -a 0x10000 -x -32 -f $(KDIR)/root.$(1)
+       -$(STAGING_DIR_HOST)/bin/addpattern -B $(2) -v v$(4) \
+               -i $(KDIR)/image.tmp \
                -o $(call imgname,$(1),$(2)).bin
+       rm $(KDIR)/image.tmp
 endef
 
 wndr3700_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,1024k(kernel),6656k(rootfs),64k(art)ro,7680k@0x70000(firmware)