Commit 9d7bf9bf1fba19314a36481185c54b1ea2ec038b
1 parent
48277f0a51
Exists in
smarc-imx-l5.0.0_1.0.0-ga
MA-6580 recovery.img cannot be authenticated by HAB
Remove the authentication size to be a fixed size, due to recovery.img may be much bigger than the boot.img Add signature size to boot or recovery image size, which is added by boot_signer in android build process Signed-off-by: guoyin.chen <guoyin.chen@freescale.com>
Showing 1 changed file with 13 additions and 9 deletions Side-by-side Diff
common/cmd_fastboot.c
... | ... | @@ -1549,7 +1549,10 @@ |
1549 | 1549 | #ifdef CONFIG_SECURE_BOOT |
1550 | 1550 | #define IVT_SIZE 0x20 |
1551 | 1551 | #define CSF_PAD_SIZE 0x2000 |
1552 | -#define ANDROID_BOOT_AUTH_SIZE 0x740000 | |
1552 | +/* Max of bootimage size to be 16MB */ | |
1553 | +#define MAX_ANDROID_BOOT_AUTH_SIZE 0x1000000 | |
1554 | +/* Size appended to boot.img with boot_signer */ | |
1555 | +#define BOOTIMAGE_SIGNATURE_SIZE 0x100 | |
1553 | 1556 | #endif |
1554 | 1557 | int i = 0; |
1555 | 1558 | bootm_headers_t images; |
1556 | 1559 | |
... | ... | @@ -1627,14 +1630,16 @@ |
1627 | 1630 | bootimg_addr = hdr->kernel_addr - hdr->page_size; |
1628 | 1631 | |
1629 | 1632 | #ifdef CONFIG_SECURE_BOOT |
1630 | - /* Default boot.img should be padded to ANDROID_BOOT_AUTH_SIZE | |
1631 | - before appended with IVT&CSF data. If the default boot.img exceed the | |
1632 | - size, the IVT&CSF data cannot appended to the end of boot.img */ | |
1633 | - if (image_size > ANDROID_BOOT_AUTH_SIZE) { | |
1633 | + /* Default boot.img should be padded to 0x1000 | |
1634 | + before appended with IVT&CSF data. Set the threshold of | |
1635 | + boot image for athendication as 16MB | |
1636 | + */ | |
1637 | + image_size += BOOTIMAGE_SIGNATURE_SIZE; | |
1638 | + image_size = ALIGN_SECTOR(image_size, 0x1000); | |
1639 | + if (image_size > MAX_ANDROID_BOOT_AUTH_SIZE) { | |
1634 | 1640 | printf("The image size is too large for athenticated boot!\n"); |
1635 | 1641 | return 1; |
1636 | 1642 | } |
1637 | - image_size = ANDROID_BOOT_AUTH_SIZE; | |
1638 | 1643 | /* Make sure all data boot.img + IVT + CSF been read to memory */ |
1639 | 1644 | bootimg_sectors = image_size/512 + |
1640 | 1645 | ALIGN_SECTOR(IVT_SIZE + CSF_PAD_SIZE, 512)/512; |
1641 | 1646 | |
... | ... | @@ -1720,12 +1725,11 @@ |
1720 | 1725 | image_size = hdr->page_size + |
1721 | 1726 | ALIGN_SECTOR(hdr->kernel_size, hdr->page_size) + |
1722 | 1727 | ALIGN_SECTOR(hdr->ramdisk_size, hdr->page_size) + |
1723 | - ALIGN_SECTOR(hdr->second_size, hdr->page_size); | |
1724 | - if (image_size > ANDROID_BOOT_AUTH_SIZE) { | |
1728 | + ALIGN_SECTOR(hdr->second_size, hdr->page_size) + BOOTIMAGE_SIGNATURE_SIZE; | |
1729 | + if (image_size > MAX_ANDROID_BOOT_AUTH_SIZE) { | |
1725 | 1730 | printf("The image size is too large for athenticated boot!\n"); |
1726 | 1731 | return 1; |
1727 | 1732 | } |
1728 | - image_size = ANDROID_BOOT_AUTH_SIZE; | |
1729 | 1733 | bootimg_addr = addr; |
1730 | 1734 | extern uint32_t authenticate_image(uint32_t ddr_start, |
1731 | 1735 | uint32_t image_size); |