Commit graph

46 commits

Author SHA1 Message Date
Yuvraj Saxena
bc5a0ecd8a mkbootimg: print addresses and offsets in hex
Change-Id: Ia8a8d68acd8d68750f9ae49ccd341f0f4d3f4e9c
2019-03-07 05:06:09 +00:00
Yuvraj Saxena
ff5e99a6cd mkbootimg: extract to 'second' if size not 0
Change-Id: I5f6804be6372371d51d5757f6a5700c07ed5e57f
2019-03-06 14:23:02 +00:00
Hridya Valsaraju
a057a33e68 Populate header size for boot image header version 2 correctly
Bootimage header size for header version 2 was being populated
incorrectly. Also, throw an error when an unsupported boot header
version is passed in as an argument.

Test: can see correct header size using unpack_bootimg.py
Bug: 111136242
Change-Id: Ia4ed7b2469a5296546627c91f441c496d67f5ce3
2019-01-24 16:48:51 -08:00
Hridya Valsaraju
ad518bd4d7 Modify mkbootimg.py to support boot image header version 2
Boot image with header version 2 supports inclusion of
DTB image within the boot image.

Bug: 111136242
Test: unpack_bootimg.py is able to extract DTB added by
mkbootimg.py

Change-Id: Ie6ae2507aa0c1960c73077d618aacafb83ae8459
2019-01-23 08:35:46 -08:00
Tao Bao
0e5e816185 Revert "Revert "mkbootimg: Build mkbootimg with Soong.""
This reverts commit 55a78bf580.

There's no change in this CL from the initial landing. The earlier crash
was caused by manifest setup in build-tools and clang-tools branches,
which has been addressed by the following CLs.
https://android-review.googlesource.com/c/platform/manifest/+/769045
https://android-review.googlesource.com/c/platform/manifest/+/769044

Bug: 116698229
Change-Id: I33701c9f77e814257cc5c65ad7aa587835ae00ad
Test: TreeHugger
2018-09-27 14:11:51 +00:00
Tao Bao
55a78bf580 Revert "mkbootimg: Build mkbootimg with Soong."
This reverts commit 51360fc349.

Reason for revert: Triggered some crash in Soong.

Bug: 116698229
Change-Id: Iab4827fdadc65cbabb60aa07eeac7b33acea68a0
2018-09-26 15:19:24 +00:00
Tao Bao
51360fc349 mkbootimg: Build mkbootimg with Soong.
Test: mmma -j system/core/mkbootimg
Test: m dist
Change-Id: Ib2588a6e4a559a99f0a35ece50e1e054e7899e01
2018-09-25 15:16:12 -07:00
Chen, ZhiminX
97f1325820 Add a recovery ACPIO section to boot image
For non-A/B devices, the recovery partition should be
self-sufficient and not depend on any other partition.
Since recovery may need load ACPIO before access to devices,
we need to make sure that the the recovery image also contains
the information from the ACPIO image.

Test: can generate image with acpio/acpi
Fixes: 111871613

Change-Id: I77b95a4c78a7e967f5e682ba7053f9d03f4ca51c
2018-09-25 07:48:26 +00:00
Tom Cherry
1151d15be5 Add recovery_available: true to init dependencies
Init needs this in order to be built in Android.bp

Test: build
Change-Id: I695438d69cc71b739b7648c4008ff3760da58ef0
2018-07-24 13:45:50 -07:00
Elliott Hughes
cab23382f4 mkbootimg: add hridya@ to OWNERS.
Bug: N/A
Test: N/A
Change-Id: Ib6a7c74c95855f41b0fe9ad5a4fe5df8c4097450
2018-06-14 10:27:36 -07:00
Hridya Valsaraju
26e01bbdc5 Populate recovery DTBO offset correctly
Also, remove recovery_dtbo_offset argument
for mkbootimg as this is calculated based
on sizes of kernel, ramdisk and second
binaries.

Also, modify unpack_bootimg to use the recovery_dtbo_offset
field to extract recovery_dtbo.

Test: make recoveryimage showcommands -j32
unpack_bootimg --boot_img $OUT/recovery.img
diff recovery_dtbo dtbo.img

Change-Id: I588ccc8b739c169b6f78c17ffe554c5562397d98
2018-06-04 15:26:42 -07:00
Hridya Valsaraju
d0ab4e3701 Correct comment in boot image header
Test: make
Bug: 80207223
Change-Id: I88cf7683e036ff43bbe3ff5418519c7e35e08b79
2018-05-30 10:58:14 -07:00
Elliott Hughes
577e8b44b6 Add fastboot --os-version and --os-patch-level.
Also move -c to --cmdline to match the python mkbootimg tool. Remove
the short options for these rarely-used options.

Remove #if 0 cruft from <bootimg/bootimg.h>.

Bug: http://b/77340848
Test: manual testing (need to fix http://b/77809061 for unit tests)
Change-Id: Ieaa795566611bd89ba3fee39a1d9f6ad0713a587
2018-04-09 18:37:39 +00:00
Jayant Chowdhary
478c7c1eaf Add dummy vndk library libmkbootimg to enable abi checks on boot_img_hdr.
Bug: 74763691

Test: m -j libmkbootimg creates libmkbootimg.so.lsdump.

Test: make -j64

Change-Id: I8d716c560467aaf090f4f7ee9cfbc53a9405f05d
(cherry picked from commit 4cc755dce5)
2018-03-31 07:13:33 -07:00
Treehugger Robot
77a61d3e6e Merge "OWNERS for system/core/mkbootimg." 2018-03-29 00:46:36 +00:00
Elliott Hughes
d08c9102d6 OWNERS for system/core/mkbootimg.
Bug: N/A
Test: N/A
Change-Id: I9007898e29727892a166f4445c9b112987a97d7d
2018-03-28 14:48:59 -07:00
Hridya Valsaraju
02c08cc347 Add a script to unpack boot image
The script prints out the boot image header
contents and extracts the kernel, ramdisk,
second bootloader and recovery DTBO images.

Bug: 74763691
Test: unpack_bootimg --boot_img $OUT/recovery.img

Change-Id: Iadbca81c157d9e4607f808a14468ab5542347507
2018-03-28 21:25:41 +00:00
Hridya Valsaraju
147b355bb3 Add a recovery DTBO section to boot image
For non-A/B devices, the recovery partition should
be self-sufficient and not depend on any other
partition. Since recovery may need access to devices
added to the DT by overlays(for eg.display), we need to
make sure that the the recovery image also contains
the information from the DTBO image.

The following fields are added to the boot image
header for this purpose:
-boot header version
-header size
-recovery dtbo size
-recovery dtbo address

Bug: 74763691
Test: unpack_bootimage --boot_img $OUT/recovery.img
      diff out/extracted_dtbo $TOP/device/google/wahoo-kernel/dtbo.img

Change-Id: I1969859038b84fac1e4a71f79f2f546b9cacffc8
2018-03-28 12:53:21 -07:00
Sami Tolvanen
294eb9dac3 mkbootimg: use int for os_version and os_patch_level
The parse_int function attempts to interpret the string to detect
base, which leads to it assuming strings starting with 0 are base
8. This obviously fails for certain dates, so use int instead.

Bug: 27498078
Bug: 22914603
Change-Id: I50b1fb3d7876f2ec17d00649cc9a2d23af2aec2b
2016-03-29 16:06:37 -07:00
Sami Tolvanen
d162828814 mkbootimg: add os_version
Adds operating system version and security patch level to the boot
image header. This change take into use one of the existing unused
fields to preserve compatibility.

Note: All information is packed into a single field, because there
are a lot of existing devices that break if the first unused field
is set to a non-zero value.

Bug: 27498078
Bug: 22914603
Change-Id: I24953129e06019b95014a050e916fe4f5c199286
2016-03-15 09:38:36 -07:00
Sami Tolvanen
3253092718 Revert "mkbootimg: add version and patch level"
This reverts commit 3edc43234a.

Bug: 27580174
Change-Id: I42dac32eb7a70498accf2b8b4fde1ed0d221ca0b
2016-03-11 00:08:42 +00:00
Sami Tolvanen
3edc43234a mkbootimg: add version and patch level
Adds operating system version and security patch level to the boot
image header. This change takes over two existing unused fields to
preserve compatibility with existing devices.

Bug: 27498078
Bug: 22914603
Change-Id: I57682611e0c27fec5ed284da7d9a788383ff98b1
2016-03-07 08:56:01 -08:00
Bernhard Rosenkränzer
c434cf82d5 Allow building with Python 3.x
Allow the scripts to run with both python 2.x and 3.x

Change-Id: I911118bcf370d09bdb2fb46afa21af64257f1ffb
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
2016-02-23 21:39:35 +00:00
Rom Lemarchand
a8221d3427 mkbootimg: misc typo fixes
- Fix whitespace in parse_int
- Use two dashes for kernel_offset instead of four

Change-Id: I59667da457d0f0d78a946e543d1aa0aec5e682d5
2015-06-04 09:59:01 -07:00
Rom Lemarchand
45f2ce1cb8 mkbootimg: parse hexadecimal ints
Allow passing int arguments as hexadecimal values

Change-Id: If5a199007e9868f994dd740ccd15c455eb536327
2015-06-02 19:01:25 -07:00
Rom Lemarchand
2aa78ce625 mkbootimg: delete obsolete C source
Change-Id: Ic36cbf370b7d54c3dd425a25d938c661e8d3405a
2015-06-02 16:10:52 -07:00
Rom Lemarchand
ad6ec0c7fe mkbootimg: turn into a python script
Turn mkbootimg into a python script instead of a C utility

Change-Id: I36d35dfacfbbef2cc16bd6695ab15ee716bb0cdb
2015-06-02 16:10:52 -07:00
Andres Morales
a190ddf90f pass in correct buffer to print_id
hdr.id is actually larger than sha

Change-Id: Iac33dbaaf4bea9acde5ba49d8601f7ac767677d5
2015-05-08 09:20:22 -07:00
Andres Morales
61fc195401 mkbootimg: make mkbootimg print image cksum to stdout
used by the build system as a fingerprint for the image

Change-Id: Ifaf230b881e68d921a8158ed2e8a3ee41f27a4b3
2015-05-08 09:20:07 -07:00
Rom Lemarchand
dfff829062 mkbootimg: use fixed-size types for image format
Change-Id: I471ef420c3944b3ffefdba9ca7122c6a7f09e5ac
2015-05-07 14:08:31 -07:00
Mark Salyzyn
cc209517e4 mkbootimg: turn on -Werror
- Deal with signedness issues

Change-Id: I61211165eb4ce0fa9a2edeebb3f97fb0ffc62d34
2014-05-05 10:30:04 -07:00
Andrew Boie
f66bd0a079 mkbootimg: fix padding calculation for 2ndstage loader
Change-Id: I8db844cbc52896e51886b725fb86fd1b0fa57899
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2014-04-24 17:12:45 -07:00
Andrew Boie
d35ce3563b mkbootimg: support longer kernel command lines
We can't simply increase the value of BOOT_ARGS_SIZE since that
would break past binary compatibility; the offset of 'id' would
change. This can cause serious problems with incremental OTA updates.

Instead, define a supplemental field which stores command line
information beyond the first 512 bytes. A value of 1024 was chosen
to keep the total size of struct boot_img_hdr under the smallest
page size of 2048 bytes.

Even if the extra_cmdline field is used, the original cmdline
field is still always NULL-terminated to avoid issues with older
bootloaders that haven't been updated.

Change-Id: I887e6f1db351a5b71a61e3a03363cf8856123d74
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2013-09-09 13:13:33 -07:00
Ithamar R. Adema
81ce3a79ff mkbootimg: support 8192/16384 pagesizes
By now these sizes are very common, so make sure we support them.

Change-Id: Ib1963fbabc4ec0b4623f2045a3cbeedffbad7ee8
Signed-off-by: Ithamar R. Adema <ithamar@upgrade-android.com>
2013-03-10 14:11:10 +01:00
Doug Zongker
dd7fafb34b add command-line arguments to mkbootimg to move kernel, ramdisk, etc.
Bug: 6918260
Change-Id: I5d4af6314fded027952941110a520dc9aa234a14
2012-08-02 14:52:39 -07:00
Iliyan Malchev
497de83856 HACK: push ramdisk up by 2M
Change-Id: Idb71ebd25c0b8c765ce8767961f362f6deb45547
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-06-11 14:18:45 -07:00
Ying Wang
1c061b9ea9 dist for dist_files
Change-Id: I665572a2212f1239b02b7816e37ada210afbdb48
2010-12-09 10:33:27 -08:00
Maarten Hooft
65e461c478 Fix the pagesize argument parsing
Change-Id: I8a3d1a2a70c5ad972d3e150b320ee2184c9d5b4a
2010-08-24 15:24:50 -07:00
Ying Wang
fc2f7cb69e Fix usage string.
Change-Id: Iaa99a1bb8bb6998082f3553689b5b812a6471514
2010-08-23 12:59:23 -07:00
Brian Swetland
8417d698cf handle 4096 byte pages if requested via --pagesize
Change-Id: I9299ebeced85dcf5e6e4686b99b28b9786be4f25
Signed-off-by: Brian Swetland <swetland@google.com>
2010-08-11 16:56:49 -07:00
Brian Swetland
2a63bb7abf fastboot, mkbootimg: support alternate base addresses
Add the --base flag to mkbootimg and -b flag to fastboot, to allow
the default kernel base address (0x10000000) to be changed.

Signed-off-by: Brian Swetland <swetland@google.com>
2009-04-28 16:05:07 -07:00
The Android Open Source Project
dd7bc3319d auto import from //depot/cupcake/@135843 2009-03-03 19:32:55 -08:00
The Android Open Source Project
e54eebbf1a auto import from //depot/cupcake/@135843 2009-03-03 18:29:04 -08:00
The Android Open Source Project
8ac3a13816 auto import from //branches/cupcake/...@127101 2009-01-20 14:04:01 -08:00
The Android Open Source Project
35237d1358 Code drop from //branches/cupcake/...@124589 2008-12-17 18:08:08 -08:00
The Android Open Source Project
4f6e8d7a00 Initial Contribution 2008-10-21 07:00:00 -07:00