From 7c877c5bcea8d1d3fb8afcd0882bc82a32fb3fa2 Mon Sep 17 00:00:00 2001 From: "ctcaer@gmail.com" Date: Tue, 23 Apr 2019 03:41:07 +0300 Subject: [PATCH] [HOS] Normalize new pkg2 identification --- bootloader/hos/hos.c | 4 +--- bootloader/hos/pkg2.c | 5 +++-- bootloader/hos/pkg2.h | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/bootloader/hos/hos.c b/bootloader/hos/hos.c index 3ba1f4a..1471ce9 100644 --- a/bootloader/hos/hos.c +++ b/bootloader/hos/hos.c @@ -488,8 +488,6 @@ int hos_launch(ini_sec_t *cfg) gfx_printf("Loaded warmboot and secmon\n"); // Read package2. - if (!strcmp(ctxt.pkg1_id->id, "20190314172056")) - ctxt.new_pkg2 = true; u8 *bootConfigBuf = _read_emmc_pkg2(&ctxt); if (!bootConfigBuf) return 0; @@ -505,7 +503,7 @@ int hos_launch(ini_sec_t *cfg) } LIST_INIT(kip1_info); - pkg2_parse_kips(&kip1_info, pkg2_hdr); + pkg2_parse_kips(&kip1_info, pkg2_hdr, &ctxt.new_pkg2); gfx_printf("Parsed ini1\n"); diff --git a/bootloader/hos/pkg2.c b/bootloader/hos/pkg2.c index 4e4b472..a8f112c 100644 --- a/bootloader/hos/pkg2.c +++ b/bootloader/hos/pkg2.c @@ -639,14 +639,15 @@ static u32 _pkg2_calc_kip1_size(pkg2_kip1_t *kip1) return size; } -void pkg2_parse_kips(link_t *info, pkg2_hdr_t *pkg2) +void pkg2_parse_kips(link_t *info, pkg2_hdr_t *pkg2, bool *new_pkg2) { u8 *ptr; - // Check for new pkg2 + // Check for new pkg2 type. if (!pkg2->sec_size[PKG2_SEC_INI1]) { u32 kernel_ini1_off = *(u32 *)(pkg2->data + PKG2_NEWKERN_INI1_START); ptr = pkg2->data + kernel_ini1_off; + *new_pkg2 = true; } else ptr = pkg2->data + pkg2->sec_size[PKG2_SEC_KERNEL]; diff --git a/bootloader/hos/pkg2.h b/bootloader/hos/pkg2.h index 78edda1..2274b39 100644 --- a/bootloader/hos/pkg2.h +++ b/bootloader/hos/pkg2.h @@ -139,7 +139,7 @@ typedef struct _kip1_id_t kip1_patchset_t* patchset; } kip1_id_t; -void pkg2_parse_kips(link_t *info, pkg2_hdr_t *pkg2); +void pkg2_parse_kips(link_t *info, pkg2_hdr_t *pkg2, bool *new_pkg2); int pkg2_has_kip(link_t *info, u64 tid); void pkg2_replace_kip(link_t *info, u64 tid, pkg2_kip1_t *kip1); void pkg2_add_kip(link_t *info, pkg2_kip1_t *kip1);