X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=tools%2Fkwboot.c;h=905ade3b01236d11e4727e32a354c9d866ca618a;hb=f36bbcceba2891bec17add339c7ff3241c3f6d94;hp=c5f4492b5f7ab3d4a3b1a609740316cebcb7dae5;hpb=fbb0c7bd92255bfcb13826a8ac81be6e2f94ba48;p=oweals%2Fu-boot.git diff --git a/tools/kwboot.c b/tools/kwboot.c index c5f4492b5f..905ade3b01 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -9,10 +9,14 @@ * 2008. Chapter 24.2 "BootROM Firmware". */ +#include "kwbimage.h" +#include "mkimage.h" + #include #include #include #include +#include #include #include #include @@ -22,8 +26,6 @@ #include #include -#include "kwbimage.h" - #ifdef __GNUC__ #define PACKED __attribute((packed)) #else @@ -652,6 +654,14 @@ kwboot_img_patch_hdr(void *img, size_t size) hdr->blockid = IBR_HDR_UART_ID; + /* + * Subtract mkimage header size from destination address + * as this header is not expected by the Marvell BootROM. + * This way, the execution address is identical to the + * one the image is compiled for (TEXT_BASE). + */ + hdr->destaddr = hdr->destaddr - sizeof(struct image_header); + if (image_ver == 0) { struct main_hdr_v0 *hdr_v0 = img;