aboutsummaryrefslogtreecommitdiffstats
path: root/tools/firmware-utils/src
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2008-09-08 12:39:33 +0000
committerGabor Juhos <juhosg@openwrt.org>2008-09-08 12:39:33 +0000
commit9f40ecda1f5d604022aa28e5d7fbeea3697fe5e2 (patch)
treee4498ab041f00d4e0a44da65ca6e8818e42b000f /tools/firmware-utils/src
parent91f79c22030c24a9fe25db26fe974b0057843216 (diff)
downloadupstream-9f40ecda1f5d604022aa28e5d7fbeea3697fe5e2.tar.gz
upstream-9f40ecda1f5d604022aa28e5d7fbeea3697fe5e2.tar.bz2
upstream-9f40ecda1f5d604022aa28e5d7fbeea3697fe5e2.zip
[tools] firmware-utils/mkmylofw: WP543 support
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12552 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'tools/firmware-utils/src')
-rw-r--r--tools/firmware-utils/src/mkmylofw.c67
-rw-r--r--tools/firmware-utils/src/myloader.h6
2 files changed, 47 insertions, 26 deletions
diff --git a/tools/firmware-utils/src/mkmylofw.c b/tools/firmware-utils/src/mkmylofw.c
index 7a69f6ef53..aa0a2e1bd3 100644
--- a/tools/firmware-utils/src/mkmylofw.c
+++ b/tools/firmware-utils/src/mkmylofw.c
@@ -1,7 +1,5 @@
/*
- * $Id$
- *
- * Copyright (C) 2006,2007 Gabor Juhos <juhosg at openwrt.org>
+ * Copyright (C) 2006-2008 Gabor Juhos <juhosg@openwrt.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -72,15 +70,24 @@ struct cpx_board {
uint16_t svid; /* sub vendor id */
uint16_t sdid; /* sub device id */
uint32_t flash_size; /* size of flash */
+ uint32_t part_offset; /* offset of the partition_table */
+ uint32_t part_size; /* size of the partition_table */
};
-#define BOARD(_vid, _did, _svid, _sdid, _flash, _mod, _name, _desc) { \
- .model = _mod, .name = _name, .desc = _desc, \
+#define BOARD(_vid, _did, _svid, _sdid, _flash, _mod, _name, _desc, _po, _ps) { \
+ .model = _mod, .name = _name, .desc = _desc, \
.vid = _vid, .did = _did, .svid = _svid, .sdid = _sdid, \
- .flash_size = (_flash << 20) }
+ .flash_size = (_flash << 20), \
+ .part_offset = _po, .part_size = _ps }
+
+#define CPX_BOARD(_did, _flash, _mod, _name, _desc, _po, _ps) \
+ BOARD(VENID_COMPEX, _did, VENID_COMPEX, _did, _flash, _mod, _name, _desc, _po, _ps)
+
+#define CPX_BOARD_ADM(_did, _flash, _mod, _name, _desc) \
+ CPX_BOARD(_did, _flash, _mod, _name, _desc, 0x10000, 0x10000)
-#define CPX_BOARD(_did, _flash, _mod, _name, _desc) \
- BOARD(VENID_COMPEX, _did, VENID_COMPEX, _did, _flash, _mod, _name, _desc)
+#define CPX_BOARD_AR71XX(_did, _flash, _mod, _name, _desc) \
+ CPX_BOARD(_did, _flash, _mod, _name, _desc, 0x20000, 0x8000)
#define ALIGN(x,y) ((x)+((y)-1)) & ~((y)-1)
@@ -95,44 +102,48 @@ int verblevel = 0;
struct mylo_fw_header fw_header;
struct mylo_partition fw_partitions[MYLO_MAX_PARTITIONS];
struct fw_block fw_blocks[MAX_FW_BLOCKS];
+struct cpx_board *board;
struct cpx_board boards[] = {
- CPX_BOARD(DEVID_COMPEX_NP18A, 4,
+ CPX_BOARD_ADM(DEVID_COMPEX_NP18A, 4,
"NP18A", "Compex NetPassage 18A",
"Dualband Wireless A+G Internet Gateway"),
- CPX_BOARD(DEVID_COMPEX_NP26G8M, 2,
+ CPX_BOARD_ADM(DEVID_COMPEX_NP26G8M, 2,
"NP26G8M", "Compex NetPassage 26G (8M)",
"Wireless-G Broadband Multimedia Gateway"),
- CPX_BOARD(DEVID_COMPEX_NP26G16M, 4,
+ CPX_BOARD_ADM(DEVID_COMPEX_NP26G16M, 4,
"NP26G16M", "Compex NetPassage 26G (16M)",
"Wireless-G Broadband Multimedia Gateway"),
- CPX_BOARD(DEVID_COMPEX_NP27G, 4,
+ CPX_BOARD_ADM(DEVID_COMPEX_NP27G, 4,
"NP27G", "Compex NetPassage 27G",
"Wireless-G 54Mbps eXtended Range Router"),
- CPX_BOARD(DEVID_COMPEX_NP28G, 4,
+ CPX_BOARD_ADM(DEVID_COMPEX_NP28G, 4,
"NP28G", "Compex NetPassage 28G",
"Wireless 108Mbps Super-G XR Multimedia Router with 4 USB Ports"),
- CPX_BOARD(DEVID_COMPEX_NP28GHS, 4,
+ CPX_BOARD_ADM(DEVID_COMPEX_NP28GHS, 4,
"NP28GHS", "Compex NetPassage 28G (HotSpot)",
"HotSpot Solution"),
- CPX_BOARD(DEVID_COMPEX_WP18, 4,
+ CPX_BOARD_ADM(DEVID_COMPEX_WP18, 4,
"WP18", "Compex NetPassage WP18",
"Wireless-G 54Mbps A+G Dualband Access Point"),
- CPX_BOARD(DEVID_COMPEX_WP54G, 4,
+ CPX_BOARD_ADM(DEVID_COMPEX_WP54G, 4,
"WP54G", "Compex WP54G",
"Wireless-G 54Mbps XR Access Point"),
- CPX_BOARD(DEVID_COMPEX_WP54Gv1C, 2,
+ CPX_BOARD_ADM(DEVID_COMPEX_WP54Gv1C, 2,
"WP54Gv1C", "Compex WP54G rev.1C",
"Wireless-G 54Mbps XR Access Point"),
- CPX_BOARD(DEVID_COMPEX_WP54AG, 4,
+ CPX_BOARD_ADM(DEVID_COMPEX_WP54AG, 4,
"WP54AG", "Compex WP54AG",
"Wireless-AG 54Mbps XR Access Point"),
- CPX_BOARD(DEVID_COMPEX_WPP54G, 4,
+ CPX_BOARD_ADM(DEVID_COMPEX_WPP54G, 4,
"WPP54G", "Compex WPP54G",
"Outdoor Access Point"),
- CPX_BOARD(DEVID_COMPEX_WPP54AG, 4,
+ CPX_BOARD_ADM(DEVID_COMPEX_WPP54AG, 4,
"WPP54AG", "Compex WPP54AG",
"Outdoor Access Point"),
+ CPX_BOARD_AR71XX(DEVID_COMPEX_WP543, 2,
+ "WP543", "Compex WP543",
+ "BareBoard"),
{.model = NULL}
};
@@ -213,6 +224,7 @@ usage(int status)
" a: this is the active partition. The bootloader loads\n"
" the firmware from this partition.\n"
" h: the partition data have a header.\n"
+" l: the partition data uses LZMA compression.\n"
" p: the bootloader loads data from this partition to\n"
" the RAM before decompress it.\n"
" -h show this screen\n"
@@ -624,11 +636,10 @@ write_out_blocks(FILE *outfile, uint32_t *crc)
* for the partition table
*/
if (fw_num_partitions > 0) {
-
desc.type = HOST_TO_LE32(FW_DESC_TYPE_USED);
- desc.addr = HOST_TO_LE32(0x10000);
+ desc.addr = HOST_TO_LE32(board->part_offset);
desc.dlen = HOST_TO_LE32(sizeof(struct mylo_partition_table));
- desc.blen = HOST_TO_LE32(0x10000);
+ desc.blen = HOST_TO_LE32(board->part_size);
if (write_out_desc(outfile, &desc, crc) != 0)
return -1;
@@ -1014,6 +1025,9 @@ parse_opt_partition(char ch, char *arg)
case 'p':
part->flags |= PARTITION_FLAG_PRELOAD;
break;
+ case 'l':
+ part->flags |= PARTITION_FLAG_LZMA;
+ break;
case 'h':
part->flags |= PARTITION_FLAG_HAVEHDR;
break;
@@ -1068,8 +1082,6 @@ err_out:
int
parse_opt_board(char ch, char *arg)
{
- struct cpx_board *board;
-
if (required_arg(ch, arg)) {
goto err_out;
}
@@ -1189,6 +1201,11 @@ main(int argc, char *argv[])
goto out;
}
+ if (!board) {
+ errmsg(0, "no board specified");
+ goto out;
+ }
+
if (flash_size == 0) {
errmsg(0, "no flash size specified");
goto out;
diff --git a/tools/firmware-utils/src/myloader.h b/tools/firmware-utils/src/myloader.h
index 3c0c6021b1..d01bce951a 100644
--- a/tools/firmware-utils/src/myloader.h
+++ b/tools/firmware-utils/src/myloader.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006,2007 Gabor Juhos
+ * Copyright (C) 2006-2008 Gabor Juhos <juhosg@openwrt.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -56,6 +56,9 @@
#define DEVID_COMPEX_WPP54AG 0x0550
#define DEVID_COMPEX_WPP54G 0x0555
+/* Devices based on the Atheros AR71xx */
+#define DEVID_COMPEX_WP543 0x0640
+
/* Devices based on the IXP422 */
#define DEVID_COMPEX_WP18 0x047E
#define DEVID_COMPEX_NP18A 0x0489
@@ -108,6 +111,7 @@ struct mylo_partition {
#define PARTIIION_FLAG_RAMLOAD 0x1000 /* FIXME: load this partition into the RAM? */
#define PARTITION_FLAG_PRELOAD 0x0800 /* the partition data preloaded to RAM
* before decompression */
+#define PARTITION_FLAG_LZMA 0x0100 /* the partition data compressed with LZMA */
#define PARTITION_FLAG_HAVEHDR 0x0002 /* the partition data have a header */
#define PARTITION_TYPE_FREE 0