Public bug reported: On Ubuntu 16.04, abootimg-0.6-1 sometimes produces corrupted stage2 images during extraction of Android bootimage. I cannot share real boot images that exhibit this problem, but here's artificial way to reproduce it:
$ yes "KERNEL " | dd of=kern.src bs=1 count=5000 5000+0 records in 5000+0 records out 5000 bytes (5.0 kB) copied, 0.00548857 s, 911 kB/s $ yes "RAMDISK" | dd of=ramd.src bs=1 count=5000 5000+0 records in 5000+0 records out 5000 bytes (5.0 kB) copied, 0.0186445 s, 268 kB/s $ yes "STAGE 2" | dd of=s2.src bs=1 count=5000 5000+0 records in 5000+0 records out 5000 bytes (5.0 kB) copied, 0.0157602 s, 317 kB/s $ hexdump -C kern.src 00000000 4b 45 52 4e 45 4c 20 0a 4b 45 52 4e 45 4c 20 0a |KERNEL .KERNEL .| * 00001388 $ hexdump -C ramd.src 00000000 52 41 4d 44 49 53 4b 0a 52 41 4d 44 49 53 4b 0a |RAMDISK.RAMDISK.| * 00001388 $ hexdump -C s2.src 00000000 53 54 41 47 45 20 32 0a 53 54 41 47 45 20 32 0a |STAGE 2.STAGE 2.| * 00001388 $ abootimg --create boot.img -k kern.src -r ramd.src -s s2.src reading kernel from kern.src reading ramdisk from ramd.src reading second stage from s2.src Writing Boot Image boot.img $ abootimg -x boot.img writing boot image config in bootimg.cfg extracting kernel in zImage extracting ramdisk in initrd.img extracting second stage image in stage2.img $ hexdump -C stage2.img 00000000 52 41 4d 44 49 53 4b 0a 52 41 4d 44 49 53 4b 0a |RAMDISK.RAMDISK.| * 00000380 52 41 4d 44 49 53 4b 0a 00 00 00 00 00 00 00 00 |RAMDISK.........| 00000390 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000800 53 54 41 47 45 20 32 0a 53 54 41 47 45 20 32 0a |STAGE 2.STAGE 2.| * 00001388 $ I've looked into sources and found that offset may be calculated incorrectly due to wrong rounding (as you may see STAGE 2 text begins at offset 0x800 - size of one block). You may find fix that I use in attachment. ** Affects: abootimg (Ubuntu) Importance: Undecided Status: New ** Patch added: "0001-Fix-extraction-of-stage2-image.patch" https://bugs.launchpad.net/bugs/1606633/+attachment/4707668/+files/0001-Fix-extraction-of-stage2-image.patch -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1606633 Title: Abootimg sometimes extracts corrupted stage2 images To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/abootimg/+bug/1606633/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs