summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPawel Dembicki <paweldembicki@gmail.com>2018-04-19 19:36:55 +0200
committerPetr Štetiar <ynezz@true.cz>2019-03-24 01:44:24 +0100
commit1f149fcad38677cc917d249e32b4b791cde95702 (patch)
tree4d082a6e2b1612cf1fda307ad86bca81dce1f060 /tools
parent5f40b519f3b211f440a8f96dc1ce9a1be60aa0c9 (diff)
downloadopenwrt-1f149fcad38677cc917d249e32b4b791cde95702.tar.gz
openwrt-1f149fcad38677cc917d249e32b4b791cde95702.tar.bz2
openwrt-1f149fcad38677cc917d249e32b4b791cde95702.zip
firmware-utils: mkdlinkfw: add kernel image offset
Some boards with JBOOT have partiton between bootloader and kernel image. This patch add possibility to change kernel partition start address. Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/firmware-utils/src/mkdlinkfw.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/tools/firmware-utils/src/mkdlinkfw.c b/tools/firmware-utils/src/mkdlinkfw.c
index 71828bd91a..3b59a5d2df 100644
--- a/tools/firmware-utils/src/mkdlinkfw.c
+++ b/tools/firmware-utils/src/mkdlinkfw.c
@@ -99,6 +99,7 @@ struct file_info image_info;
char *ofname;
char *progname;
uint32_t firmware_size;
+uint32_t image_offset;
uint16_t family_member;
char *rom_id[12] = { 0 };
char image_type;
@@ -403,7 +404,7 @@ int fill_sch2(struct sch2_header *header, char *kernel_ptr, char *rootfs_ptr)
header->image_crc32 = crc32(0, (uint8_t *) kernel_ptr, kernel_info.file_size);
header->start_addr = RAM_ENTRY_ADDR;
header->rootfs_addr =
- JBOOT_SIZE + STAG_SIZE + SCH2_SIZE + kernel_info.file_size;
+ image_offset + STAG_SIZE + SCH2_SIZE + kernel_info.file_size;
header->rootfs_len = rootfs_info.file_size;
header->rootfs_crc32 = crc32(0, (uint8_t *) rootfs_ptr, rootfs_info.file_size);
header->header_crc32 = 0;
@@ -446,9 +447,9 @@ int fill_auh(struct auh_header *header, uint32_t length)
header->lpvs = AUH_LVPS;
header->mbz = 0;
header->time_stamp = jboot_timestamp();
- header->erase_start = JBOOT_SIZE;
+ header->erase_start = image_offset;
header->erase_length = firmware_size;
- header->data_offset = JBOOT_SIZE;
+ header->data_offset = image_offset;
header->data_length = length;
header->space4 = 0;
header->space5 = 0;
@@ -603,11 +604,12 @@ int main(int argc, char *argv[])
image_type = SYSUPGRADE;
family_member = 0;
firmware_size = 0;
+ image_offset = JBOOT_SIZE;
while (1) {
int c;
- c = getopt(argc, argv, "f:F:i:hk:m:o:r:s:");
+ c = getopt(argc, argv, "f:F:i:hk:m:o:O:r:s:");
if (c == -1)
break;
@@ -632,6 +634,9 @@ int main(int argc, char *argv[])
case 'r':
rootfs_info.file_name = optarg;
break;
+ case 'O':
+ sscanf(optarg, "0x%x", &image_offset);
+ break;
case 'o':
ofname = optarg;
break;