libbootimg: Fix support of Stock Sony ELF boot images
- Unlike all boot images built for CyanogenMod or AOSP based ROMs over the last years, the elf bootimages from Stock also include additional metadata in the header section that is required for the device to power up with its kernel
- Add a 3900 8bits array at the end of the header, followed by the 16 chars of the added bootimage name, in order to match the Sony ELF 4096 first block and therefore save the additional data from Stock images
- Regular Sony ELF images have about 1200-1600 chars there so filling the 4096 block is more than enough for this, and moving the bootimage name at the end makes things safer
Change-Id: Ic2b619b6f5e862920dcfefa5b86b016987305d4a Signed-off-by: AdrianDC [email protected]
Tested on both Primary and Secondary Stock 4.3 based installations. Stock kernel now injected properly, simple update giving the same binary result.
Confirmed working fine for Huashan ELF stock bootimages.
Up
Updated with support for the newer Sony ELF boot images.
- Tested on the original ELF 8960 devices : SP / T / TX / V
- Tested on the newer ELF 8974 devices : Z2
- Tested on regular bootimage devices : X Performance
- Other device under test
- Also compatible with No-Kexec V4.1 changes to the boot name
Up. Used globally on Sony and non-Sony devices since 2016.
You should fix the build.
include/libbootimg.h
The #include <cutils/klog.h> obviously needs #ifdef DEBUG_KMSG protection!