[OpenWrt-Devel] [PATCH] resend: image build fix for siemens se515

2008-08-09 Thread Sven Bachmann
Hi,

sorry, didn't know that I must set wrapping off in Thunderbird even
if using an external editor...

So again:

This patch mainly fixes some CRCs for the CFE of the Siemens SE515.
It also adds a target to set the firmware tag.

A tool to check the image for correctnes can be found here:
http://mcbachmann.de/projects/openwrt/openwrt-patches/rev_11869/imginfo/imginfo.c

An output of OpenWrt on the Siemens SE515 is also available here:
http://mcbachmann.de/projects/openwrt/logs/kernel_2.6.25.15_rev12259.log


Signed-off-by: Sven Bachmann [EMAIL PROTECTED]

Index: target/linux/brcm63xx/image/Makefile
===
--- target/linux/brcm63xx/image/Makefile(revision 12255)
+++ target/linux/brcm63xx/image/Makefile(working copy)
@@ -9,7 +9,8 @@
 
 LOADADDR = 0x8001  # RAM start + 16M 
 KERNEL_ENTRY = $(LOADADDR) # Newer kernels add a jmp to the kernel_entry 
at the start of the binary
-RAMSIZE = 0x0100   # 64MB
+RAMSIZE ?= 0x0100  # 64MB
+FWTAG ?= 96345GW2
 
 LOADER_MAKEOPTS= \
KDIR=$(KDIR) \
@@ -72,7 +73,7 @@
 
 define Image/Build
$(STAGING_DIR_HOST)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD)-$(1).trx -f 
$(KDIR)/loader.gz -f $(KDIR)/vmlinux.lzma $(call trxalign/$(1)) -f 
$(KDIR)/root.$(1)
-   $(call Image/Build/CFE,$(1),96345GW2,6345)
+   $(call Image/Build/CFE,$(1),$(FWTAG),6345)
 endef
 
 $(eval $(call BuildImage))
Index: target/linux/brcm63xx/profiles/SE515.mk
===
--- target/linux/brcm63xx/profiles/SE515.mk (revision 0)
+++ target/linux/brcm63xx/profiles/SE515.mk (revision 0)
@@ -0,0 +1,18 @@
+#
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/SE515
+  NAME:=Siemens SE515
+  RAMSIZE:= 0x0001 # 16MB
+  FWTAG:=RTA770BW
+endef
+
+define Profile/SE515/Description
+   Package set optimized for the Siemens SE515.
+endef
+$(eval $(call Profile,SE515))
+
Index: tools/firmware-utils/src/imagetag.c
===
--- tools/firmware-utils/src/imagetag.c (revision 12255)
+++ tools/firmware-utils/src/imagetag.c (working copy)
@@ -51,11 +51,15 @@
struct imagecompkernel; /* 116 - 137: The offset and 
length of the kernel */
uint8_t dualimage[2];   /* 138 - 139: use 0 here */
uint8_t inactive[2];/* 140 - 141: use 0 here */
-   uint8_t reserved1[74];  /* 142 - 215: reserved */
-   uint32_timagecrc;   /* 216 - 219: crc of the images 
(net byte order) */
-   uint8_t reserved2[16];  /* 220 - 235: reserved */
+   uint8_t reserved1[50];  /* 142 - 191: reserved */
+   uint8_t headerver;  /*   192: header version */
+   uint8_t reserved2[3];   /* 193 - 195: reserved */
+   uint32_tpayloadcrc; /* 196 - 199: crc of the 
payload (net byte order) [kernel, rootfs] */
+   uint8_t reserved3[16];  /* 200 - 215: reserved */
+   uint32_timagecrc;   /* 216 - 219: crc of the images 
(net byte order) [cfe, kernel, rootfs] */
+   uint8_t reserved4[16];  /* 220 - 235: reserved */
uint32_theadercrc;  /* 236 - 239: crc starting from 
sig1 until headercrc (net byte order) */
-   uint8_t reserved3[16];  /* 240 - 255: reserved */
+   uint8_t reserved5[16];  /* 240 - 255: reserved */
 };
 
 static uint32_t crc32tab[256] = {
@@ -123,8 +127,11 @@
struct imagetag tag;
struct kernelhdr khdr;
FILE *kernelfile = NULL, *rootfsfile = NULL, *binfile;
-   size_t kerneloff, kernellen, rootfsoff, rootfslen, read;
+   size_t kerneloff, kernellen, read;
+   size_t rootfsoff, rootfslen, rootfsoff_aligned, rootfslen_aligned;
uint8_t readbuf[1024];
+   uint8_t *padbuf;
+   uint32_t pad_kernel, pad_rootfs;
uint32_t crc;
 
memset(tag, 0, sizeof(struct imagetag));
@@ -168,9 +175,9 @@
 
/* Build the rootfs address and length (start and end do need to be 
aligned on flash erase block boundaries */
rootfsoff = kerneloff + kernellen;
-   rootfsoff = (rootfsoff % FLASH_BS)  0 ? (((rootfsoff / FLASH_BS) + 1) 
* FLASH_BS) : rootfsoff;
+   rootfsoff_aligned = (rootfsoff % FLASH_BS)  0 ? (((rootfsoff / 
FLASH_BS) + 1) * FLASH_BS) : rootfsoff;
rootfslen = getlen(rootfsfile);
-   rootfslen = (rootfslen % FLASH_BS)  0 ? (((rootfslen / FLASH_BS) + 1) 
* FLASH_BS) : rootfslen;
+   rootfslen_aligned = (rootfslen % FLASH_BS)  0 ? (((rootfslen / 
FLASH_BS) + 1) * FLASH_BS) : rootfslen;
 
/* Seek to the start of 

Re: [OpenWrt-Devel] [PATCH] resend: image build fix for siemens se515

2008-08-09 Thread Axel Gembe
Sven Bachmann wrote:
 This patch mainly fixes some CRCs for the CFE of the Siemens SE515.
 It also adds a target to set the firmware tag.
   
Yea, right :) Sorry for not replying earlier on the list.
This patch works good for me, so I just want to give an:

Acked-by: Axel Gembe [EMAIL PROTECTED]

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel