From 1f149fcad38677cc917d249e32b4b791cde95702 Mon Sep 17 00:00:00 2001 From: Pawel Dembicki Date: Thu, 19 Apr 2018 19:36:55 +0200 Subject: 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 --- tools/firmware-utils/src/mkdlinkfw.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'tools/firmware-utils') 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; -- cgit v1.2.3