I have a fully functional and previously tested official boot.img for my device.
But when I tried to unpack it and repack it again(with no modifications whatsoever), the kernel fails to start as usual.
I get a "Kernel is not seandroid enforcing" text on the top left of my screen when I try to boot the new kernel and the device seems to be stuck showing the logo.
I'm using the bootimg-tools located here: https://github.com/pbatard/bootimg-tools
Here's how I'm unpacking it:
$ ./unmkbootimg -i stock/boot.img
kernel written to 'kernel' (11273048 bytes)
ramdisk written to 'ramdisk.cpio.gz' (2856269 bytes)
To rebuild this boot image, you can use the command:
mkbootimg --base 0 --pagesize 2048 --kernel_offset 0x00008000 --ramdisk_offset 0x01000000 --second_offset 0x00f00000 --tags_offset 0x00000100 --cmdline 'console=ttyS1,115200n8' --kernel kernel --ramdisk ramdisk.cpio.gz -o stock/boot.img
I'm using the same exact command in the unpack command to re-pack it:
$ ./mkbootimg --base 0 --pagesize 2048 --kernel_offset 0x00008000 --ramdisk_offset 0x01000000 --second_offset 0x00f00000 --tags_offset 0x00000100 --cmdline 'console=ttyS1,115200n8' --kernel kernel --ramdisk ramdisk.cpio.gz -o stock/boot.img
I have no idea whats the issue here, I'm not even sure if this is the correct way to make a zImage bootable.
Any help would be greatly appreciated.
Thank you.
I needed to use up-to-date tools.
It seems the boot.img file format changed in the past few years.
The working tools are located here: https://github.com/GameTheory-/mktool/tree/master/tools . The .jar tool didn't work for me but the backend tools did :)
* To unpack *
$ ./unpackbootimg -i stock/boot.img -o stockoutdir
BOARD_KERNEL_CMDLINE console=ttyS1,115200n8
BOARD_KERNEL_BASE 00000000
BOARD_NAME
BOARD_PAGE_SIZE 2048
BOARD_HASH_TYPE sha1
BOARD_KERNEL_OFFSET 00008000
BOARD_RAMDISK_OFFSET 01000000
BOARD_SECOND_OFFSET 00f00000
BOARD_TAGS_OFFSET 00000100
BOARD_DT_SIZE 673792
* To pack again *
$ ./mkbootimg --kernel stockoutdir/boot.img-zImage --ramdisk stockoutdir/boot.img-ramdisk.gz --cmdline "console=ttyS1,115200n8" --base 00000000 --pagesize 2048 --dt stockoutdir/boot.img-dt --kernel_offset 00008000 --ramdisk_offset 01000000 --second_offset 00f00000 --tags_offset 00000100 --hash sha1 -o custom.img
User contributions licensed under CC BY-SA 3.0