Commit Graph

152 Commits

Author SHA1 Message Date
Michael Bestas
561ce192be extract_utils: Remove super.raw after dumping partitions
This saves some space in case we want to keep the extracted content
via the KEEP_DUMP flag.

Change-Id: I0f5812853b5bff8b303a276047bb30d58690920d
2023-06-12 19:58:46 +03:00
Michael Bestas
7e3eb4d7d1 extract_utils: Don't extract multiple times for the same run
Just reuse already extracted content.

Change-Id: I6d41f12258255aedb1db46d619b55abb7527110b
2023-06-12 19:58:46 +03:00
Michael Bestas
c1ea677d24 extract_utils: Add option to save extracted content
Change-Id: Ia38ebcd616d17fc64c59bdb245c4f18e97c322f4
2023-06-12 19:58:43 +03:00
Michael Bestas
40dbd6b9cd extract_utils: Add helper function for carriersettings_extractor.py
Change-Id: Iaa0196054f39fccc86a34dea1243db0963216f31
2023-06-12 14:41:27 +03:00
Michael Bestas
d469bc3a95 extract_utils: Add helper functions to generate RRO package structure
To be used for CarrierSettings extract integration.

Change-Id: I116efbb75aa53d9117076ff0e4e8fa239ab8002f
2023-06-12 13:02:35 +03:00
Michael Bestas
d5ad621ad4 extract_utils: Add helper functions for single items
Allows copying single files or building single packages.
To be used for CarrierSettings extract integration.

Change-Id: I9238355c56673f633e7a0a4afe70e9a9ad62af56
2023-06-12 13:02:35 +03:00
Michael Bestas
0f8eccc3f5 extract_utils: Add support to generate carriersettings file list
Change-Id: Ia92e4f12c22eaf1a25f116f6928540345e3a5e1d
2023-06-12 13:02:35 +03:00
Michael Bestas
09c751c242 Support extracting from sparsechunk super images
Change-Id: If029d717f8001079dab4382b1c91e8b092aae017
2023-03-31 20:47:26 +03:00
pjgowtham
9724a2a410 extract-utils: Allow overriding VENDOR with VENDOR_COMMON
Co-authored-by: LuK1337 <priv.luk@gmail.com>
Change-Id: Ie2f2d686d0803269bb6a7f7ef5796c7cbce75854
2023-03-06 23:51:55 +01:00
Chirayu Desai
cf1fe40c78 Stop using TMPDIR
* This is used by a lot of things, and the script removes
  the entire directory. That can cause issues with other things,
  that don't expect the root TMPDIR to go away, or some contents
  within it.
* Let's use our own variable
* You can still keep setting TMPDIR since mktemp respects that

Change-Id: I6c71ce38bab781cd7a8d285499f127c2bf248eb8
2022-10-26 11:15:00 +02:00
LuK1337
56fbdef3ee extract_utils: Sync adb pull paths with local extract
Fixes extracting the following example line from device:
* system/framework/WfdCommon.jar

Change-Id: I690a871026b89ca591943a3bba3c09310ae821dc
2022-10-15 22:58:51 +02:00
Mohd Faraz
3d1e865abe extract-utils: Fix for sh_binary
* srcs, prefer isn't available in sh_binary

Change-Id: I5f94432748aba4a417520ba850b7a9c4d7dddbe7
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
2022-10-13 10:34:28 +02:00
Mohd Faraz
23e4b57ec0 extract_utils: extract recovery and vendor_ramdisk
* This will be beneficial for copying firmware and other stuff to recovery.

Change-Id: Ibc7e887d32f9c00d5914ed4d2c9d79864f1f4745
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
Signed-off-by: Mohd Faraz <mohd.faraz.abc@gmail.com>
2022-10-12 23:21:04 +02:00
Chirayu Desai
ebdf73f5b4 extract-utils: egrep: warning: egrep is obsolescent; using grep -E
Change-Id: I99afd62ec559af16ce09eb3d8df8ad29fdb54231
2022-09-28 00:05:07 +02:00
Luca Weiss
04563775b3 extract_utils: fix generating system/bin & system/etc blueprint
Previously the wrong variables were checked to see if the prefix
matches, so e.g. no cc_prebuilt_binary were generated for those
binaries.

Change-Id: I744c6f6a4584921a26547478ac14a160c56e07b7
2022-09-27 14:52:41 +02:00
Chirayu Desai
929c9b99ec Allow re-using extracted content
Usage:
export TMPDIR=/some/dir/$device
export SKIP_CLEANUP=true

Change-Id: I41b992708ca5fc7bc377b22a418f5fd1395cd08a
2022-08-04 20:10:38 +02:00
Chirayu Desai
7ae0b6f6ec Split up setup_vendor
* For usage by regen-vendor.sh

Change-Id: Ideb3d4ea68e7aa6ef4a5a73c15d507d47fda4b56
2022-04-05 03:32:25 +05:30
Michael Bestas
a3457803b7 extract_utils: export SIGSCAN
For use in device scripts

Change-Id: I7a8c9abd0b585a67963e65d5ad042da79d4d3c77
2022-03-23 23:15:35 +02:00
Michael Bestas
ebae91b493 extract_utils: Support extracting from super.img
Change-Id: I2a30da25f2d55df1080b1795e08a14195c1e3ec0
2022-03-23 23:14:41 +02:00
Chirayu Desai
d5dc2b694c Use simg2img from prebuilts/extract-tools
Change-Id: I15772394a24c2ff1fdd6eece86548a72a5d4d748
2022-03-17 06:27:33 +05:30
Chenyang Zhong
2c5c8df873 extract_utils: sort the package list before writing blueprints
"comm" requires both input to be sorted. The T_X_LIB32 and T_X_LIB64
arrays from prefix_match-ing PRODUCT_PACKAGES_LIST may not always
be sorted, which causes certain multilib to be mis-categorized as
32-bit and 64-bit separately. The final blueprint would then have
duplicated targets.

Therefore, sort the package list first so that arrays generated
from the package list are also sorted. Set LC_ALL=C to avoid "sort"
using system locale.

Change-Id: Ia2bc9733d89de66eda52059237a54d624ba4b0ad
Signed-off-by: Chenyang Zhong <zhongcy95@gmail.com>
2022-02-15 23:54:33 +01:00
Michael Bestas
3521e25edc extract_utils: Remove support for /sbin
Android 11 has removed /sbin support completely
Remove rootfs handling as that was only added for /sbin
Remove write_makefile_packages since it's no longer used

Change-Id: Ie44656d5e30da9637a850df53c4bf3fa1ab0fb2b
2022-02-15 15:48:23 +01:00
Tim Zimmermann
64ed76481c extract_utils: do not cut off extension for cc_binary_prebuilt
* Otherwise extracting HAL services breaks

Change-Id: Ic6302df5c9b512adf4ca81c49cfb1d472aa15c84
2022-01-29 05:29:46 +01:00
Tim Zimmermann
75bcf7f337 extract_utils: disable strip for ELF binaries as well
* Just like we do for libraries
* Without this some binaries might break

Change-Id: Ida82f5ee35f02112eb3a35be66c2f7e1642d56b1
2022-01-29 05:29:46 +01:00
Tim Zimmermann
91767c5d9b extract_utils: allow overriding package name
* Useful for BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES
  if package name conflicts with something source-built but the output location differs

Change-Id: I3af45eae6b2d2cfc583128628edfef9e37ea3976
2022-01-29 05:29:46 +01:00
Alexander Koskovich
33012bff42 extract_utils: Support copying out to /vendor_dlkm.
Change-Id: I600c9d9eb8295e92da2016093462c6d658ca4062
2022-01-22 22:35:58 -07:00
Pablo Cholaky
9c6948b058 extract_utils: Ensure comm uses LC_COLLATE=C
comm behavior will fail if does not receive a properly lexicographic
sort.

Not using appropiated LC_COLLATE leads to error. This is matching
current LC_ALL=C already used at sort commands.

Change-Id: I77f8acb419545a74812d3b36ba608719c2aa89e3
2022-01-16 14:50:31 -05:00
Chirayu Desai
47851781e7 extract_utils: Support A/B OTAs
Change-Id: I52e66fa392f7a8fb5401db179b1242d5d216d137
2021-12-09 01:40:35 +02:00
Chirayu Desai
c1566eb2c3 extract_utils: Avoid requiring sudo
* We can use the available debugfs function, which works without root

Change-Id: Ic24f8a7441fe53af3dd18bafd5f6afce7411999c
2021-12-09 01:40:34 +02:00
Chirayu Desai
48f78ad780 regen-vendor: Support directly extracting from sparse images
Change-Id: I1707b013fe661c45ede57960fa448eccfc4350d5
2021-12-09 01:40:34 +02:00
Michael Bestas
3e6a2fe5eb regen-vendor: Allow proprietary list generation for all partitions
Change-Id: I7fa77cc0406e47b2553ea20f8eb527fd3f7a0296
2021-12-09 01:40:34 +02:00
Chirayu Desai
4af145c186 extract_utils: Support images as a source
* Handles both sparse images as well as filesystem images
* Uses debugfs to extract, no root needed!
* Usecase: Factory images

Change-Id: I3e1bc3834dea108e63ab707a1a89dc2d0743913e
2021-12-09 01:24:49 +02:00
Michael Bestas
376460eac2 extract_utils: Update debugfs error message
Change-Id: I3fb0a3a0c4f52de03009b68036a16cef01ead9c6
2021-12-09 01:24:48 +02:00
Chirayu Desai
a12add2279 extract_utils: Handle prebuilt APEX
Change-Id: I38314fc54d67c3f44374fa945d82954d4c1bd2bc
2021-12-09 01:24:48 +02:00
Michael Bestas
d4c47bf0b8 extract_utils: Automatically add apk/jar/vintf fragments to PRODUCT_PACKAGES
Change-Id: I9d12e00c294d02b40fde2b66d7797f69f6504c35
2021-12-09 01:22:10 +02:00
Michael Bestas
acaaa7b60e Remove default skipped files from generate_prop_list_from_image()
* This list hasn't been updated in a long time and doesn't contain
  all the default vendor modules. Simply drop it and regenerate the
  full list device side automatically with a script.

Change-Id: I8cf99d1b726f390f9a3bc2903e69eb26da7ebea9
2021-11-15 20:13:55 +02:00
Michael Bestas
484e2db8c1 Use LC_ALL=C sorting in generate_prop_list_from_image()
* Generate consistent output

Change-Id: Ibab238d15a64fbad83fcfad19cb7c6f266d6ecb1
2021-11-15 19:28:56 +02:00
Arian
d3e0c026bc extract_utils: Seperate multiple override targets with comma
This follows the style google uses, for example in [1].

With this change it will generate 'overrides: ["TargetOne", "TargetTwo"],'
instead of 'overrides: ["TargetOne TargetTwo"],' for this line:
-system/app/TargetZero/TargetZero.apk;OVERRIDES=TargetOne,TargetTwo

[1]: 2daf3ecf89/Android.bp (L53)

Change-Id: I154ee3a4cc51e0938c860dcfc125eacf279d102e
2021-09-27 22:05:37 +02:00
Arian
8b335032f4 extract_utils: Don't fixup pinned files when they are supposed to be kept
Change-Id: I6f38bf5928061b0f09eda04f85e00b11912d0227
2021-09-09 15:40:02 +02:00
Arian
302226bb77 extract_utils: Display the fixup hash when keeping pinned files
Change-Id: I32e288b1b06f103179d894d0a68a2ce34df31913
2021-09-09 15:18:35 +02:00
LuK1337
72d5bdfb73 fixup! extract_utils: Add support for overriding packages
This unifies arguments parsing + fixes case where OVERRIDES=pkg would
generate .bp without `certificate: "platform"`.

Change-Id: I0036e0e942ff9272da10f14aeb7235f0b6b92b00
2021-08-23 18:21:58 +02:00
TheStrix
3749ce5b29 extract_utils: Add support for overriding packages
* An example of how this can be used is say a device
   wants to use the original OEM camera, e.g. Essential PH-1.
   Klik is required in order to use the external camera
   module that you could buy for the device so it's preferred
   to use it over Camera2 or Snap.

  * An example of how to use this argument:
    -system/priv-app/Klik/Klik.apk;OVERRIDES=Camera2

Change-Id: I2504cbb760b20ed86c2dc088cc4bd74b78ba64d9
2021-08-23 17:58:01 +02:00
Bruno Martins
eed0c8ca3b extract_utils: Skip colored echo when piped
Change-Id: I8a03a36f3fa022e6858cc5c1dbca8b8037efed03
2021-08-23 11:20:39 +02:00
Bruno Martins
f12ce8b81d extract_utils: Add a bit of color to the output
Change-Id: I2a779362121645d6d1cee7858a305425190eab56
2021-08-23 11:20:33 +02:00
Bruno Martins
ac8ec32080 extract_utils: Introduce colored echo helper function
Change-Id: I25db42087232c646525f281cc0a1404fe60d1c8c
2021-08-23 11:20:25 +02:00
Sebastiano Barezzi
b49ac3f9a9 extract_utils: Add "check_elf_files: false" also for binaries
Change-Id: I93c1524fac13d8bcb0558277b7f0bc76706457c2
2021-07-14 21:43:15 +02:00
Sebastiano Barezzi
7f0c788e9c extract_utils: Implement versioned patchelf and patchelf 0.8
* Result of patchelf v0.9:
E dlopen failed: "/vendor/lib64/libvendor.goodix.hardware.fingerprint@1.0-service.so" loaded phdr 0x70d4cd6000 not in loadable segment
* While searching up this issue, I found a LineageOS Gerrit change (Ibeb09b6ec37ef62b6a5abe40bae1e8bd8d92e7af) with the same error
* Hamsi2k mentioned in the change that patchelf v0.8 is needed to fix the issue
* Building patchelf v0.8 and trying to patch the blobs works
* Implement versioned patchelf logic, allowing the script to both select the default patchelf and a specific patchelf version only for some files
* Leave 0.9 as the default version to not change the default behaviour

Change-Id: I6c0cbe76baf241233fdd125f5ed1eccbd5855124
2021-02-23 18:12:01 +01:00
Michael Bestas
41cd5a0798 Replace Apache 2.0 boilerplate/reference with SPDX
Change-Id: I691c4893e500aa791868adb82573ef2357805faf
2020-12-29 03:47:01 +02:00
Michael Bestas
8e4a039f11 Remove copyright headers from automatically generated files
It doesn't make sense to place a copyright header in
automatically generated makefiles, plus this is a grey
area since we are extracting proprietary OEM files.

Let's be safe and replace the Apache 2.0 header with
a warning regarding manual modification of the makefiles.

Change-Id: I7cafd3f0def33efff96af60280646c44c1ba9a53
2020-12-28 10:14:46 +00:00
Michael Bestas
ab77884b8e Remove branding from script variables
No need to force branding down everyone's throat,
most of the other android forks using these scripts are
rebranding the variables anyway.
Let's reduce fragmentation.

Change-Id: Ie9c223d1a42728076f45b40a11cd0820010db8b1
2020-12-28 10:14:46 +00:00