[OpenWrt-Devel] [PATCH] Firmware-utils: Add support for board id overrides for bcm63xx.

Jonas Gorski jonas.gorski+openwrt at gmail.com
Mon Jun 21 18:35:28 CEST 2010


Add a switch for using the information1 field to hardcode a board
id in the bcm tag for boards that don't provide any usable
identification but need special handling.

Signed-off-by: Jonas Gorski <jonas.gorski+openwrt at gmail.com>
---
 tools/firmware-utils/src/imagetag.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/tools/firmware-utils/src/imagetag.c b/tools/firmware-utils/src/imagetag.c
index 1fb45e9..bfed81f 100644
--- a/tools/firmware-utils/src/imagetag.c
+++ b/tools/firmware-utils/src/imagetag.c
@@ -130,7 +130,8 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin,
 	    const char *boardid, const char *chipid, const uint32_t fwaddr,
 	    const uint32_t loadaddr, const uint32_t entry,
 	    const char *ver, const char *magic2, const uint32_t flash_bs,
-	    const char *rsignature, const char *layoutver)
+	    const char *rsignature, const char *realboardid,
+	    const char *layoutver)
 {
 	struct bcm_tag tag;
 	struct kernelhdr khdr;
@@ -270,6 +271,10 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin,
 	    strncpy(tag.rsa_signature, rsignature, RSASIG_LEN);
 	}
 
+	if (realboardid) {
+	    snprintf(tag.information1, TAGINFO1_LEN, "BRD=%s", realboardid);
+	}
+
         if (layoutver) {
 	    strncpy(tag.flashLayoutVer, layoutver, TAGLAYOUT_LEN);
 	}
@@ -302,12 +307,12 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin,
 int main(int argc, char **argv)
 {
         int c, i;
-	char *kernel, *rootfs, *bin, *boardid, *chipid, *magic2, *ver, *tagid, *rsignature, *layoutver;
+	char *kernel, *rootfs, *bin, *boardid, *chipid, *magic2, *ver, *tagid, *rsignature, *realboardid, *layoutver;
 	uint32_t flashstart, fwoffset, loadaddr, entry;
 	uint32_t fwaddr, flash_bs;
 	int tagidfound = 0;
 
-	kernel = rootfs = bin = boardid = chipid = magic2 = ver = rsignature = layoutver = NULL;
+	kernel = rootfs = bin = boardid = chipid = magic2 = ver = rsignature = realboardid = layoutver = NULL;
 	entry = 0;
 
 	flashstart = DEFAULT_FLASH_START;
@@ -319,7 +324,7 @@ int main(int argc, char **argv)
 	printf("Copyright (C) 2008 Axel Gembe\n");
 	printf("Copyright (C) 2009-2010 Daniel Dickinson\n");
 
-	while ((c = getopt(argc, argv, "i:f:o:b:c:s:n:v:m:k:l:e:h:r:y:")) != -1) {
+	while ((c = getopt(argc, argv, "i:f:o:b:c:s:n:v:m:k:l:e:h:r:d:y:")) != -1) {
 		switch (c) {
 			case 'i':
 				kernel = optarg;
@@ -360,6 +365,9 @@ int main(int argc, char **argv)
 		        case 'r':
 			        rsignature = optarg;
 				break;
+			case 'd':
+				realboardid = optarg;
+				break;
 		        case 'y':
 			        layoutver = optarg;
 				break;
@@ -379,6 +387,7 @@ int main(int argc, char **argv)
 				fprintf(stderr, "	-l <loadaddr>		- Address where the kernel expects to be loaded (defaults to 0x80010000)\n");
 				fprintf(stderr, "	-e <entry>		- Address where the kernel entry point will end up\n");
 				fprintf(stderr, "       -r <signature>          - vendor specific signature, for those that need it");
+				fprintf(stderr, "       -d <boardid>            - force board detection to this board id\n");
 				fprintf(stderr, "       -y <layoutver>          - Flash Layout Version (2.2x code versions need this)");
 				fprintf(stderr, "	-h			- Displays this text\n\n");
 				return 1;
@@ -418,5 +427,5 @@ int main(int argc, char **argv)
 	}
 
 
-	return tagfile(kernel, rootfs, bin, boardid, chipid, fwaddr, loadaddr, entry, ver, magic2, flash_bs, rsignature, layoutver);
+	return tagfile(kernel, rootfs, bin, boardid, chipid, fwaddr, loadaddr, entry, ver, magic2, flash_bs, rsignature, realboardid, layoutver);
 }
-- 
1.5.6.5



More information about the openwrt-devel mailing list