summaryrefslogtreecommitdiff
path: root/partition_tools
AgeCommit message (Collapse)Author
2024-04-22lpdump: Add info about super partitionSandeep Dhavale
Currently we do not print info about super partition in lpdump. Let's add it so we can get to know super's size and used size. Available space can be inferred from these two. Bug: 335891825 Test: lpdump --json Test: atest CtsEdiHostTestCases Change-Id: Ic3dea6346492c1f94c6432a96c55bfc6164d1b89 Signed-off-by: Sandeep Dhavale <dhavale@google.com>
2024-01-17lpmake: unlink before writingSteven Moreland
If Cuttlefish was starting using an image that was built earlier, the build used to write over this image. Now, we unlink the output first, so we don't break any existing programs which are using the outputs: Though, there are other reasons that CF may not work from multiple builds: > Requested resuming a previous session (the default behavior) but the base images have changed under the overlay, making the overlay incompatible. Wiping the overlay files. Anyway, you can see it works: Test: boot CF with a new image build with an existing version already running List of devices attached 0.0.0.0:6520 device 0.0.0.0:6521 device Bug: 179194264 Change-Id: Ie83c568915880e656c011eda474e2d42dfd1fa17
2023-11-02Create output dir in lpunpack if does not existKelvin Zhang
This saves caller 1 extra step to create the output dir before invoking lpunpack Test: lpunpack super.img /tmp/not_exist_dir Change-Id: Idcadf3ff2d5c3656174f712f00b170d77deaf8ea
2023-07-23lpdumpd: Link to libsnapshot dynamically.David Anderson
This fixes a ~1.5MB regression in binary size. Bug: 291688516 Test: treehugger Change-Id: I70ddb7f74fe251a45e068779deb9729a3ae6fbf0
2023-07-14lpdumpd: Add snapshotctl dump output.David Anderson
This will ensure that anytime the output of "lpdump" is captured (eg for a bugreport), that "snapshotctl dump" is captured as well. Bug: 291083311 Test: lpdump Change-Id: Iab7d010a2c336a3fa0df589f183a11ad53b1be02
2023-04-17Merge "partition_tools: extend lpunpack for split partitions"David Anderson
2023-04-17partition_tools: extend lpunpack for split partitionsDaniel Köster
This is meant for retrofitted dynamic partitions where several super partitions are used. Until now lpunpack fails with the message "Split super devices are not supported." in this case. Extend lpunpack to support zero or more '-i' arguments with which additional super images may be referenced. Before running this new tool, do lpdump on the main super image file and examine the section 'Super partition layout' to get an idea which additional image files may be needed. Change-Id: I67904d6cb2a630d1ebe3903db39d23357603a60b
2023-04-10Add fs_type to lpdumpSandeep Dhavale
Currently lpdump prints the dynamic partitions and fs_size, fs_used. Add fs_type as well so we can know what file system is being used. Bug: 274918611 Test: lpdump --json Test: atest CtsEdiHostTestCases Change-Id: I8b40a5a2adab2b8be456f04798d72c220925cb17 Signed-off-by: Sandeep Dhavale <dhavale@google.com>
2023-02-14Merge "lpmake: Fix some issues in size calculation."David Anderson
2023-02-08lpmake: Fix some issues in size calculation.David Anderson
When using "auto" for the super partition size, the size was computed totally wrong for small alignments. It doesn't show up in production since the default alignment is quite large (1MiB). Also, when specifing image files, the partition size is now automatically calculated if specified as 0. Bug: N/A Test: lpmake Change-Id: I8f3f3ff2d5f0b60163c17edc4bdba647fa1decc1
2022-10-21partition_tools: Include string.h for strerror in lpaddBiswapriyo Nath
This fixes the following error: extras/partition_tools/lpadd.cc:81:26: error: ‘strerror’ was not declared in this scope; did you mean ‘stderr’? 81 | << strerror(saved_errno) << std::endl; | ^~~~~~~~ | stderr Change-Id: I05da9a447be4024943caab73bdc38776d9caa40e
2022-09-28Use proper arg key for --help optionAnatol Pomozov
Running `lpmake --help` leads to a segfault. It happens because invalid key is used for --help option. Test: build lpmake and make sure --help works Issue: https://github.com/nmeum/android-tools/issues/73 Change-Id: I8a2c56b6f2c9dc0a3f254e85469ce10d09c02bc7
2022-02-03Add replace opt to lpadd make build mixing easierRam Muthiah
Needed for both system_dlkm and vendor_dlkm mixing. Bug: 149866755 Bug: 200082547 Test: tested on local super image Change-Id: Id7dea9480b9da4b844de73b35a9dc3a1e7a659d1
2022-01-28lpmake: Allow building on Windows.David Anderson
Bug: 207825850 Test: mmm system/extras/partition_tools Change-Id: I16d4bd515b5059f77d7a50e417943f56ebdf1dea
2022-01-27partition_tools: Use enum for sparse_file_read modeSean Anderson
sparse_file_read now uses an enum instead of a bool for the mode parameter to allow more than two modes. Update our use in lpadd. Change-Id: Ibd264f2d32de988385b0e8893d804a514d816a66
2021-04-01Add auto option to device sizeInseob Kim
Typically device size is determined first, and then lpmake checks if given partitions fit to the device or not. But it could be the case that one wants to minimize the super image size, like microdroid. This change adds "--device-size=auto" option to support minimized super image. If set, the device size will be the sum of partition sizes plus some spaces for metadata. Bug: 181107248 Test: boot microdroid Change-Id: I441f996de10df58bcfeb6f6ee637f15360d3b709
2021-02-19[LSC] Add LOCAL_LICENSE_KINDS to system/extrasBob Badour
Added SPDX-license-identifier-Apache-2.0 to: alloc-stress/Android.bp app-launcher/Android.bp boot_control_copy/Android.bp bootctl/Android.bp boottime_tools/bootanalyze/stressfs/Android.bp boottime_tools/bootio/Android.bp brillo_config/Android.mk checkpoint_gc/Android.bp cppreopts/Android.bp crypto-perf/Android.bp ext4_utils/Android.bp ext4_utils/Android.mk f2fs_utils/Android.bp ioblame/Android.bp ioshark/Android.bp iotop/Android.bp kexec_tools/Android.bp latencytop/Android.bp libfec/Android.bp libfec/test/Android.bp libfscrypt/Android.bp libfscrypt/tests/Android.bp libjsonpb/parse/Android.bp libjsonpb/verify/Android.bp memory_replay/Android.bp memtrack/Android.bp mmap-perf/Android.bp module_ndk_libs/libnativehelper/Android.bp multinetwork/Android.bp pagecache/Android.bp partition_tools/Android.bp partition_tools/aidl/Android.bp perf2cfg/Android.bp postinst/Android.bp preopt2cachename/Android.bp profcollectd/Android.bp profcollectd/libprofcollectd/Android.bp profcollectd/libprofcollectd/bindings/libflags/Android.bp pssbench/Android.mk puncture_fs/Android.bp runconuid/Android.bp sane_schedstat/Android.bp showslab/Android.bp simpleperf/Android.bp simpleperf/runtest/Android.bp simpleperf/scripts/inferno/Android.bp simpleperf/simpleperf_app_runner/Android.bp slideshow/Android.mk sound/Android.bp squashfs_utils/Android.bp su/Android.mk taskstats/Android.bp tests/Android.bp tests/audio/alsa/Android.bp tests/binder/benchmarks/Android.bp tests/bootloader/Android.mk tests/cpueater/Android.bp tests/crypto/Android.bp tests/directiotest/Android.bp tests/ext4/Android.mk tests/framebuffer/Android.bp tests/fstest/Android.bp tests/icachetest/Android.bp tests/iptables/qtaguid/Android.bp tests/kernel.config/Android.mk tests/lib/Android.bp tests/lib/testUtil/Android.bp tests/memeater/Android.mk tests/pagingtest/Android.mk tests/pftest/Android.bp tests/schedtest/Android.bp tests/storage/Android.bp tests/suspend_stress/Android.bp tests/tcp_nuke_addr/Android.bp tests/timetest/Android.bp tests/uevents/Android.bp toolchain-extras/Android.bp vbmeta_tools/Android.bp verity/Android.bp verity/fec/Android.bp zram-perf/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to: cpustats/Android.bp Added SPDX-license-identifier-BSD to: ANRdaemon/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: Ia559848af903a7b6746d9b12b7de8b83bc57f99d
2021-02-16Revert "[LSC] Add LOCAL_LICENSE_KINDS to system/extras"Bob Badour
This reverts commit 044d055c842a5750359ed71dfe50a6a4bf5f4cc3. Reason for revert: Needs to run as multiple roots. Change-Id: I8e06e7eb19e0f634f52fbd8a1c6662f43e347dd5
2021-02-12[LSC] Add LOCAL_LICENSE_KINDS to system/extrasBob Badour
Added SPDX-license-identifier-Apache-2.0 to: boot_control_copy/Android.bp bootctl/Android.bp boottime_tools/bootanalyze/stressfs/Android.bp boottime_tools/bootio/Android.bp checkpoint_gc/Android.bp cppreopts/Android.bp crypto-perf/Android.bp ext4_utils/Android.bp ext4_utils/Android.mk f2fs_utils/Android.bp ioshark/Android.bp iotop/Android.bp kexec_tools/Android.bp latencytop/Android.bp libfec/Android.bp libfec/test/Android.bp libfscrypt/Android.bp libfscrypt/tests/Android.bp libjsonpb/parse/Android.bp libjsonpb/verify/Android.bp memory_replay/Android.bp memtrack/Android.bp mmap-perf/Android.bp module_ndk_libs/libnativehelper/Android.bp multinetwork/Android.bp pagecache/Android.bp partition_tools/Android.bp perf2cfg/Android.bp postinst/Android.bp preopt2cachename/Android.bp profcollectd/Android.bp profcollectd/libprofcollectd/Android.bp profcollectd/libprofcollectd/bindings/libflags/Android.bp puncture_fs/Android.bp runconuid/Android.bp sane_schedstat/Android.bp showslab/Android.bp simpleperf/Android.bp simpleperf/runtest/Android.bp simpleperf/scripts/inferno/Android.bp simpleperf/simpleperf_app_runner/Android.bp slideshow/Android.mk sound/Android.bp squashfs_utils/Android.bp su/Android.mk taskstats/Android.bp tests/Android.bp tests/audio/alsa/Android.bp tests/binder/benchmarks/Android.bp tests/bootloader/Android.mk tests/cpueater/Android.bp tests/crypto/Android.bp tests/directiotest/Android.bp tests/ext4/Android.mk tests/framebuffer/Android.bp tests/fstest/Android.bp tests/icachetest/Android.bp tests/iptables/qtaguid/Android.bp tests/kernel.config/Android.mk tests/lib/Android.bp tests/lib/testUtil/Android.bp tests/memeater/Android.mk tests/pagingtest/Android.mk tests/pftest/Android.bp tests/schedtest/Android.bp tests/storage/Android.bp tests/suspend_stress/Android.bp tests/tcp_nuke_addr/Android.bp tests/timetest/Android.bp tests/uevents/Android.bp toolchain-extras/Android.bp vbmeta_tools/Android.bp verity/Android.bp verity/fec/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to: cpustats/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD legacy_notice to: Android.bp Added SPDX-license-identifier-BSD to: ANRdaemon/Android.bp Added legacy_notice to: alloc-stress/Android.bp app-launcher/Android.bp brillo_config/Android.mk ioblame/Android.bp partition_tools/aidl/Android.bp pssbench/Android.mk zram-perf/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: Ie7c022a4d7f828a89d0cda663684a497af37006e
2020-04-20Mark some aidl_interface modules as unstableJiyong Park
With b/152655547, all aidl_interface modules are considered as stable unless it is explicitly with "unstable: true". This change marks the aidl_interface that are not used across updatable module bounraries as unstable, so that the build system does not run the API dumping/checking on them. Exempt-From-Owner-Approval: cherry-pick from internal Bug: 152655547 Test: m Merged-In: I8291dca96fcca0c45a2501ab88970ace360a7ac7 (cherry picked from commit b755a9ff8814ee241778ed65ff8367766e4f1bab) Change-Id: I8291dca96fcca0c45a2501ab88970ace360a7ac7
2019-12-27Merge "lpdump: Add support for the DISABLED flag."David Anderson
2019-12-18lpdump: Add support for the DISABLED flag.David Anderson
Bug: 134949511 Test: manual test Change-Id: I53d35167bc27d3d8d2516e890697514d64635ad7
2019-12-18Merge "partition_tools: Add support for the VIRTUAL_AB_DEVICE flag."David Anderson
2019-12-17lpdump: Use unsigned value for shiftGreg Kaiser
Shifting a signed 32-bit value by 31 bits is implementation-defined behavior. While our toolchains are most probably doing the expected thing, we make this an unsigned value out of paranoia. Test: TreeHugger Change-Id: I551fcf1ac7a27ebd7c1365cd6a9df7267f569c44
2019-12-13partition_tools: Add support for the VIRTUAL_AB_DEVICE flag.David Anderson
Bug: 134949511 Test: manual test Change-Id: If31234d9da0b15a3dbde7dcc835b2161c5dbba61
2019-12-13lpmake: Use an enum class for option codes.David Anderson
There's no reason to have short-form option codes for everything, this will make that more clear. Bug: 134949511 Test: super.img builds Change-Id: If60f6648ac311b77d68768bb39825d01c663c500
2019-12-13lpdump: Add support for the metadata flags field.David Anderson
Bug: 134949511 Test: manual test Change-Id: Iafc5193c71315b14f192fcc0ae42188a51b0d2cb
2019-11-25Merge "partition_tools: Add an "lpadd" tool for appending images to super.img."David Anderson
2019-11-21Merge "lpdumpd: Do not use stack to store arguments."David Anderson
2019-11-21Merge "lpdump: When using -h, print usage to stdout so lpdumpd prints it."David Anderson
2019-11-20Revert "lpmake: Don't assume a device is retrofit if it has one block device ↵Cody Caldwell
for super." This reverts commit 13945230d36282a0dd2ad7c240f2b88ffc506205. Reason for revert: Potential culprit for Bug b/144809373 - verifying through Forrest before revert submission Change-Id: Ic4ed750a5386f6f45a871ac7112142a6991dfd2c
2019-11-20lpdumpd: Do not use stack to store arguments.David Anderson
Bug: 144052321 Test: manual test Change-Id: I700e22ef5c6c0a0c6a5f05c5bb4ea29b0077b34e
2019-11-20partition_tools: Add an "lpadd" tool for appending images to super.img.David Anderson
Syntax: lpadd [--readonly] SUPER_FILE PART_NAME GROUP_NAME [IMAGE_FILE] The super file can be sparsed, unsparsed, or a "super_empty" image. The source image can either be sparsed or unsparsed as well. The named partition cannot already exist. Usage is further described in README.md. Bug: 144468779 Test: lpadd unsparsed super.img w/ sparsed partition lpadd unsparsed super.img w/ unsparsed partition lpadd sparsed super.img w/ sparsed partition lpadd sparsed super.img w/ unsparsed partition lpadd super_empty.img Change-Id: I0cb5d4432c86689567f2a58a379be0f96b64a88d
2019-11-19lpdump: When using -h, print usage to stdout so lpdumpd prints it.David Anderson
Bug: N/A Test: lpdump -h Change-Id: I7bad9f8b5d5c14b831e42d1f21fe8bfeccba3fb0
2019-10-09lpmake: Don't assume a device is retrofit if it has one block device for super.David Anderson
Bug: 141936600 Test: lpmake with one retrofit partition Change-Id: I3644ce3af68d6f7d037626938615cc5b9a786e15
2019-09-23lpdump: print partitions in super in orderYifan Hong
Easier to understand where are all the extents. Test: run it Change-Id: I88511fe4ed0d23882872c7434422f0a42cd3ee1f
2019-09-09lpdump: Fix slot handling on retrofit devices.David Anderson
On retrofit devices, use the correct super partition when none is explicitly specified. Bug: 140204341 Test: manual test Change-Id: I2753024bd2e7dfdf9d19916f30c1b2bd6b5ee289
2019-09-09lpdump: Add an --all command to dump all metadata slots.David Anderson
Note that this will not correctly dump all slots on retrofit devices. Bug: 140204341 Test: lpdump --all Change-Id: Icb8d8619202221f0c5fc8848abc7172d0b4dafd3
2019-09-05lpdump: Refactor how lpdump reads metadata.David Anderson
This patch prepares lpdump for the addition of an "--all" option to dump all metadata slots. - The slot and super partition name are now determined ahead of time, rather than as part of reading metadata. - The custom IPartitionOpener has been removed as it served no purpose. - The -e option has been removed in favor of IsEmptySuperImage(). - Metadata spew has been factored into a separate function. Bug: 140204341 Test: manual test Change-Id: I810a5f042870f7e072a8939bebe99b8707235f43
2019-08-27Update lpdump to recognize LP_PARTITION_ATTR_UPDATED.David Anderson
Bug: 139154795 Test: lpdump after update Change-Id: I4cbfe80c15cfa0afe3e9d37e3f8818016e57daa2
2019-06-25Merge "lpmake: Add a flag to force building a complete, empty super.img."David Anderson
2019-05-24lpmake: Add a flag to force building a complete, empty super.img.David Anderson
Normally lpmake without images is used to generate super_empty.img, but it is useful to also generate a fully sparse super_empty for flashing in the bootloader. This patch adds a --force-full-image flag to provide this. Bug: N/A Test: lpmake --force-full-image Change-Id: Ica55a7b35f6e1a0282e5a9305f1a3e4b5028755b
2019-05-23lpdump: Add an option to print the metadata size to stdout.David Anderson
This also adds --is-super-empty if the caller knows the file is a super_empty.img, which helps suppress spurious output. Bug: 117997386 Test: lpdump --is-super-empty --dump-metadata-size super_empty.img Change-Id: I5999442c097c0ef1d6a70e844993b2164f3b091d
2019-04-25Add an lpunpack tool for extracting partitions from super.img.David Anderson
This tool performs the inverse of lpmake. It can extract partition images out of a prebuilt super.img. There are a few caveats: - lpunpack does not support retrofit/split images. - lpunpack does not support sparse super images. They must be unsparsed before using with lpunpack. - Partition names will be suffixed on A/B devices, meaning, vendor_a.img will contain vendor.img and vendor_b.img will be 0-length. Note that lpunpack will store output files with holes for zero blocks, as a space-saving measure. Usage: lpunpack [options] SUPER_IMAGE [OUTPUT_DIR] Bug: 131173010 Test: m superimage mm lpunpack lpunpack super.img lpunpack super.img out/ lpunpack -p vendor_a super.img lpunpack -p unknown super.img sha1sum image with precursor image Change-Id: Iad3f7362ae6ce767ddc7de2e8cfa7e4a47190e99
2019-04-03lpmake: allow to build non-sparse super image.Yifan Hong
Bug: 120041578 Test: build without --sparse but with --image. Change-Id: Iaaa8324fa1f9e8e6785f96e787c8a4ee23d37982
2019-03-28lpdump: log warning message.Yifan Hong
Warning messages were placed in the output stream as well. Put them in logcat so that stdout is always a valid JSON string. Test: lpdump --json on walleye Bug: 126233777 Change-Id: If313eeaee9c347c498818f53decdf092328f142c
2019-03-20lpdump: Add --json optionYifan Hong
This option outputs in JSON format. In addition, it emits information like usage data on mounted file systems, and block size of super block devices. Test: `lpdump --json` on host and device Bug: 126233777 Change-Id: Iad68eb3932f317637e07cd692cdebe71e52db769
2019-03-20Make lpdump possible without root.Yifan Hong
Test: adb unroot && adb shell lpdump Bug: 126233777 Change-Id: Ie559072fe53fee43d7c4a9e8f97a89d979e5b9bc
2019-03-19lpdump: refactor to use std::ostreamYifan Hong
... so that the output stream / error stream can be replaced with stringstream later. Test: lpdump Bug: 126233777 Change-Id: I837554b0289a5d669f0f89d35e7da1b79dd33b28
2018-12-12lpdump: Automatically read from super when used directly on devices.David Anderson
It's confusing to figure out how to invoke lpdump, especially on retrofit devices. It should just do the correct thing automatically when no arguments are passed. Bug: N/A Test: lpdump on retrofit device Change-Id: I0563c10ff276763710fa0a4fb9918a2515f9d054