tools: rockchip: boot_merger: add option to enable rc4 flag

The legacy chips like rk3188 maskrom require all IDB data with RC4,
the boot_merger pack the loader with a rc4 flag in header,
and the upgrade_tool will write the data with rc4 to IDB area.

usage:
boot_merger --rc4 RKBOOT/RK310BMINIALL.ini

and you can see log below if success with RC4:
* enable RC4 for IDB data(both ddr and preloader)

Test on rk3188.

Change-Id: If221a32a462bb43bef67aae802adff5e1e8436ac
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
Joseph Chen 2019-06-24 10:26:29 +08:00 committed by Jianhong Chen
parent 52243bce13
commit 24f9e652a5
2 changed files with 7 additions and 3 deletions

View File

@ -26,6 +26,7 @@ char gSubfix[MAX_LINE_LEN] = OUT_SUBFIX;
char gEat[MAX_LINE_LEN];
char *gConfigPath;
uint8_t *gBuf;
bool enableRC4 = false;
static uint32_t g_merge_max_size = MAX_MERGE_SIZE;
@ -770,9 +771,8 @@ static inline void getBoothdr(rk_boot_header *hdr)
hdr->loaderNum = gOpts.loaderNum;
hdr->loaderOffset = hdr->code472Offset + gOpts.code472Num * hdr->code472Size;
hdr->loaderSize = sizeof(rk_boot_entry);
#ifndef USE_P_RC4
hdr->rc4Flag = 1;
#endif
if (!enableRC4)
hdr->rc4Flag = 1;
}
static inline uint32_t getCrc(const char *path)
@ -1021,6 +1021,9 @@ int main(int argc, char **argv)
merge = true;
} else if (!strcmp(OPT_UNPACK, argv[i])) {
merge = false;
} else if (!strcmp(OPT_RC4, argv[i])) {
printf("enable RC4 for IDB data(both ddr and preloader)\n");
enableRC4 = true;
} else if (!strcmp(OPT_SUBFIX, argv[i])) {
i++;
snprintf(gSubfix, sizeof(gSubfix), "%s", argv[i]);

View File

@ -188,6 +188,7 @@ typedef struct {
#define OPT_REPLACE "--replace"
#define OPT_PREPATH "--prepath"
#define OPT_SIZE "--size"
#define OPT_RC4 "--rc4"
#define OPT_CHIP "-c"
#define OPT_471 "-1"