This is a cross reference from xda-developers , hope someone here knows the solution. I am having trouble re-packaging the existing boot.img from CyanogenMod 12.1 (Lollipop 5.1) for d2spr (Sprint S3). The resulting image will not load. I built mkbootimg / unpackbootimg from the source found here: https://github.com/osm0sis/mkbootimg . Then I do the following:
$ 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 decompresses boot.img into:
$ 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 repack the files without any changes:
$ ../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, the initial download:
$ ../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)
Everything seems beautiful. Then I ran it:
$ 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 PIT file...
PIT file download successful.
Uploading BOOT
100%
BOOT upload successful
Ending session...
Rebooting device...
Releasing device interface...
Re-attaching kernel driver...
and the device will not boot. Help!
EDIT : here is the hexadecimal dump of the start of two images:
$ hexdump -C boot.img | more
00000000 41 4e 44 52 4f 49 44 21 88 69 68 00 00 80 20 80 |ANDROID!.ih... .|
00000010 c6 1e 0a 00 00 00 70 81 00 00 00 00 00 00 10 81 |......p.........|
00000020 00 01 20 80 00 08 00 00 00 00 00 00 00 00 00 00 |.. .............|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000040 61 6e 64 72 6f 69 64 62 6f 6f 74 2e 68 61 72 64 |androidboot.hard|
00000050 77 61 72 65 3d 71 63 6f 6d 20 75 73 65 72 5f 64 |ware=qcom user_d|
00000060 65 62 75 67 3d 33 31 20 7a 63 61 63 68 65 20 61 |ebug=31 zcache a|
00000070 6e 64 72 6f 69 64 62 6f 6f 74 2e 62 6f 6f 74 64 |ndroidboot.bootd|
00000080 65 76 69 63 65 3d 6d 73 6d 5f 73 64 63 63 2e 31 |evice=msm_sdcc.1|
00000090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000240 bc 67 a2 74 d6 d0 01 0e b4 56 47 6f bd ad 4d 85 |.g.t.....VGo..M.|
00000250 30 c1 ee 43 00 00 00 00 00 00 00 00 00 00 00 00 |0..C............|
00000260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000800 00 00 a0 e1 00 00 a0 e1 00 00 a0 e1 00 00 a0 e1 |................|
*
00000820 02 00 00 ea 18 28 6f 01 00 00 00 00 88 69 68 00 |.....(o......ih.|
00000830 01 70 a0 e1 00 00 30 e3 00 80 a0 11 02 80 a0 01 |.p....0.........|
00000840 20 30 9f e5 00 00 93 e5 1c 10 9f e5 01 00 30 e1 | 0............0.|
00000850 06 00 00 1a 00 00 a0 e3 00 00 83 e5 0c 00 93 e5 |................|
00000860 08 10 93 e5 04 f0 93 e5 00 f0 ff ff 07 b0 5d 4a |..............]J|
00000870 00 20 0f e1 03 00 12 e3 01 00 00 1a 17 00 a0 e3 |. ..............|
00000880 56 34 12 ef 00 20 0f e1 c0 20 82 e3 02 f0 21 e1 |V4... ... ....!.|
00000890 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000008a0 5c 41 9f e5 65 00 00 eb 57 0f 8f e2 4e 1c 90 e8 |\A..e...W...N...|
$ hexdump -C boot2.img | more
00000000 41 4e 44 52 4f 49 44 21 88 69 68 00 00 80 20 80 |ANDROID!.ih... .|
00000010 c6 1e 0a 00 00 00 20 81 00 00 00 00 00 00 10 81 |...... .........|
00000020 00 01 20 80 00 08 00 00 00 00 00 00 00 00 00 00 |.. .............|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000040 61 6e 64 72 6f 69 64 62 6f 6f 74 2e 68 61 72 64 |androidboot.hard|
00000050 77 61 72 65 3d 71 63 6f 6d 20 75 73 65 72 5f 64 |ware=qcom user_d|
00000060 65 62 75 67 3d 33 31 20 7a 63 61 63 68 65 20 61 |ebug=31 zcache a|
00000070 6e 64 72 6f 69 64 62 6f 6f 74 2e 62 6f 6f 74 64 |ndroidboot.bootd|
00000080 65 76 69 63 65 3d 6d 73 6d 5f 73 64 63 63 2e 31 |evice=msm_sdcc.1|
00000090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000240 bc 67 a2 74 d6 d0 01 0e b4 56 47 6f bd ad 4d 85 |.g.t.....VGo..M.|
00000250 30 c1 ee 43 00 00 00 00 00 00 00 00 00 00 00 00 |0..C............|
00000260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000800 00 00 a0 e1 00 00 a0 e1 00 00 a0 e1 00 00 a0 e1 |................|
*
00000820 02 00 00 ea 18 28 6f 01 00 00 00 00 88 69 68 00 |.....(o......ih.|
00000830 01 70 a0 e1 00 00 30 e3 00 80 a0 11 02 80 a0 01 |.p....0.........|
00000840 20 30 9f e5 00 00 93 e5 1c 10 9f e5 01 00 30 e1 | 0............0.|
00000850 06 00 00 1a 00 00 a0 e3 00 00 83 e5 0c 00 93 e5 |................|
00000860 08 10 93 e5 04 f0 93 e5 00 f0 ff ff 07 b0 5d 4a |..............]J|
00000870 00 20 0f e1 03 00 12 e3 01 00 00 1a 17 00 a0 e3 |. ..............|
00000880 56 34 12 ef 00 20 0f e1 c0 20 82 e3 02 f0 21 e1 |V4... ... ....!.|
00000890 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000008a0 5c 41 9f e5 65 00 00 eb 57 0f 8f e2 4e 1c 90 e8 |\A..e...W...N...|