Repack CM12.1 boot.img using mkbootimg

galets

Senior Member
Apr 1, 2006
279
25
28
Can someone point out what am I doing wrong? I am trying to repack boot.img, but resulting image will not boot. I built mkbootimg/unpackbootimg from source found here: https://github.com/osm0sis/mkbootimg . Then I do following:

Code:
$ mkdir boot2
$ ../unpackbootimg -i boot.img -o boot2
BOARD_KERNEL_CMDLINE androidboot.hardware=qcom user_debug=31 zcache androidboot.bootdevice=msm_sdcc.1
BOARD_KERNEL_BASE 80200000
BOARD_NAME 
BOARD_PAGE_SIZE 2048
BOARD_KERNEL_OFFSET 00008000
BOARD_RAMDISK_OFFSET 01500000
BOARD_TAGS_OFFSET 00000100
This unpacks boot.img into:

Code:
$ ls -l boot2
total 7360
-rw-rw---- 1 galets galets       9 Apr 22 08:59 boot.img-base
-rw-rw---- 1 galets galets       1 Apr 22 08:59 boot.img-board
-rw-rw---- 1 galets galets      81 Apr 22 08:59 boot.img-cmdline
-rw-rw---- 1 galets galets       9 Apr 22 08:59 boot.img-kerneloff
-rw-rw---- 1 galets galets       5 Apr 22 08:59 boot.img-pagesize
-rw-rw---- 1 galets galets  663238 Apr 22 08:59 boot.img-ramdisk.gz
-rw-rw---- 1 galets galets       9 Apr 22 08:59 boot.img-ramdiskoff
-rw-rw---- 1 galets galets       9 Apr 22 08:59 boot.img-tagsoff
-rw-rw---- 1 galets galets 6842760 Apr 22 08:59 boot.img-zImage
Then I repackage files without any modification:

Code:
$ ../mkbootimg --kernel boot2/boot.img-zImage \
>              --ramdisk boot2/boot.img-ramdisk.gz \
>              --cmdline "androidboot.hardware=qcom user_debug=31 zcache androidboot.bootdevice=msm_sdcc.1" \
>              --base 0x80200000 \
>              --pagesize 2048 \
>              --output boot2.img
$ ../boot_info boot2.img 
Page size: 2048 (0x00000800)
Kernel size: 6842760 (0x00686988)
Ramdisk size: 663238 (0x000a1ec6)
Second size: 0 (0x00000000)
Board name: 
Command line: 'androidboot.hardware=qcom user_debug=31 zcache androidboot.bootdevice=msm_sdcc.1'
Base address: 2149580800 (0x80200000)
For comparison, original boot:

Code:
$ ../boot_info boot.img 
Page size: 2048 (0x00000800)
Kernel size: 6842760 (0x00686988)
Ramdisk size: 663238 (0x000a1ec6)
Second size: 0 (0x00000000)
Board name: 
Command line: 'androidboot.hardware=qcom user_debug=31 zcache androidboot.bootdevice=msm_sdcc.1'
Base address: 2149580800 (0x80200000)
All seems fine. Then I flash it:

Code:
$ heimdall flash --BOOT boot2.img 
Heimdall v1.4.0

Copyright (c) 2010-2013, Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au/

This software is provided free of charge. Copying and redistribution is
encouraged.

If you appreciate this software and you would like to support future
development please consider donating:
http://www.glassechidna.com.au/donate/

Initialising connection...
Detecting device...
Claiming interface...
Attempt failed. Detaching driver...
Claiming interface again...
Setting up interface...

Initialising protocol...
Protocol initialisation successful.

Beginning session...

Some devices may take up to 2 minutes to respond.
Please be patient!

Session begun.

Downloading device's PIT file...
PIT file download successful.

Uploading BOOT
100%
BOOT upload successful

Ending session...
Rebooting device...
Releasing device interface...
Re-attaching kernel driver...
and piece of crap won't boot. wtf!? help!
 
  • Like
Reactions: mrbox23
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone