Commit graph

30 commits

Author SHA1 Message Date
Rashed Abdel-Tawab
8b87b09ef7
extract_files: Add support for paths without system/
Sometime blob directories are contained in dirs not named system
(ex. extracting blobs from another vendor dir) so check if the file
exists without system/ before appending "system/" to filenames.

Change-Id: I4ba946e178260b4f4804b1ac4422645e3085c665
2017-07-30 12:48:18 -04:00
Rashed Abdel-Tawab
855fbdd4bc
extract_files: Add support for specifying blob sections
Sometimes the need arises to update one specific subset of blobs
while holding others steady. Introduce a way to specify the "section"
of blobs to update (obviously requires the proprietary-files to be
properly split up first)

Requires additional changes in device tree extract_files.sh to support
passing the additional arguments

Change-Id: I98feab56f8bfade2818b1b5264e019440d4c57c5
2017-07-30 12:48:18 -04:00
Gabriele M
b6effb3ebb extract_utils: Fix cleanup variables assigment
The current assignment is wrong, we cleanup the files when we tell
not to do so.

Change-Id: I73a9a17f5ebae6f2dbdc3d6d9aaa28cd75fb4f87
2017-07-29 16:46:53 +00:00
Dobroslaw Kijowski
65f03f1408 extract_utils: fix extracting XML files containing binary characters
When a line from the XML file contains a character which grep classifies
as a binary one, it will omit this line at all. Moreover it will append
'Binary file matches' to the stdout. This behavior breaks some XML files.
To fix this issue, let's tell grep to process a binary file as if it were
text.

Change-Id: I6ec5689f73a0926870e502f3f8ee77346b47d05f
2017-05-18 12:37:08 +02:00
Dan Pasanen
7dc287f4b9 extract_utils: support extracting directly from an ota zip
* Specify the ota zip name as the only parameter to extract-files.sh
  * Will extract to $CM_ROOT/system_dump
  * Bail out on A/B OTA zips. We cannot support these.
  * Handles block based OTA zips by using sdat2img.py
  * Store the zip's MD5 and check if its already extracted. If so, don't
    bother extracting again

Change-Id: I03038e38dac51e6cb60d493c7e6362754d1daf02
2017-03-27 08:46:48 -05:00
Paul Keith
85cf0bb8c6 extract_utils: Fix locale issue with sort
* On some machines, LC_ALL=C is set, causing the sort
  order of makefiles to be different than those without
  this locale change that is set
* Set LC_ALL=C on all machines for consistent ordering
* From 'man sort':
  The locale specified by the environment affects sort order.
  Set LC_ALL=C to get the traditional sort order that uses native byte values.
* Thanks to haggertk and rashed for verifying this for me

Change-Id: I5bbb94b0dfe599a67036de4312e8af913e9b8d30
Signed-off-by: Paul Keith <javelinanddart@aidenswann.com>
2017-03-08 15:03:51 -06:00
Christopher R. Palmer
052d9d9384 extract-utils: Fix handling of pulling src:dest pairs from dumps
Currently, the priority of the src and dest is inverted between
pulling from adb and pulling from a system dump.

Assume that we have a camera wrapper and write the proprietary-files.txt

lib/hw/camera.msm8996.so:lib/hw/camera.vendor.msm8996.so

If we pull from a phone running Lineage that has both files, we get

camera.vendor.msm8996.so

as the pulled blob.  If we take the exact same build and pull it
from the system dump (aka, your own $OUT directory that built the
installed software) you get

camera.msm8996.so

pull instead!

Make both paths follow the same logic so that you get the same
file independent of the source.

Change-Id: I479e0ae765339cc38fa05fcaad7943c528129463
2017-03-04 05:16:28 -05:00
Adrian DC
3c6bdac74b extract_utils: Detect output existence before moving it for backup
* Avoids:
    Cleaning output directory (./../../../vendor/.../.../proprietary)..
    mv: cannot stat './../../../vendor/.../.../proprietary/*':
    No such file or directory

Change-Id: I3258e64f3997f139d8db4fb4e07d14964a469c78
2017-01-18 23:20:47 +00:00
Matt Mower
8945f5e8c7 extract_utils: Introduce variable INITIAL_COPYRIGHT_YEAR
Let a device specify INITIAL_COPYRIGHT_YEAR=XXXX in setup-makefiles.sh
so that the correct copyright(s) is/are included in vendor makefiles.
The CyanogenMod copyright is retained when INITIAL_COPYRIGHT_YEAR<2017
and the LineageOS copyright is now included for >=2017.

Change-Id: I6895b5b69bc7ba399042ac3c29e17f3209d15f1b
2017-01-09 01:26:44 +00:00
Gabriele M
4cf635a5ad extract_utils: Update backsmali command
-e no longer exists starting from v2.2b3, so update the
command. While at it, add the logic to deal with Android N
separated boot oat files.

Change-Id: Iab8e3946d6421824fea74e26dc43d2db38573022
2017-01-06 10:23:46 +00:00
Rashed Abdel-Tawab
5b38c4fb34 extract_utils: Use shasum on macOS
macOS doesn't have sha1sum but instead shasum, so use that
if 'uname -s' returns Darwin

Change-Id: I1ab8721327a561e8df78562bbc0b12e884cc4a93
2016-11-23 20:39:44 -08:00
Elektroschmock
082e0ec07b extract_utils: Add option to define the certificate for jars
Change-Id: I3fb4ff29b2ce898989f5599b47f47ee7fcfc5e92
2016-11-04 06:12:04 -07:00
Sam Mortimer
2e994ce952 Update to smali/baksmali v2.2b3
The cli changed slightly:
https://github.com/JesusFreke/smali/wiki/SmaliBaksmali2.2

And, for deodexing angler at least, baksmali needs access to boot*.oat
rather than just boot.oat so point at source rather than copy


Resurrected from http://review.cyanogenmod.org/#/c/164958/

With fixed adb $SRC deodexing

Change-Id: Id6ae0e9d7a5554687124e99fb03a808f3115bb95
2016-10-13 04:13:32 -07:00
HashBang
d303031019 extract_utils: Do not change app SRC if there are arguments
Do not prepend app or priv-app to the src when a path is explicitly
given as an argument. This fixes the SRC path in such conditions.

Change-Id: I43370f17fe224df323fcfa9b0d5eae4ee2996524
2016-10-06 18:01:56 -07:00
Rashed Abdel-Tawab
d53bff1f45
extract_utils: Add ability to set custom device guard
In some cases we may not want to check against TARGET_DEVICE so allow
setting a custom variable to check against

Change-Id: Ia2fb338f453137a95a59c6940b0cc16b261505bf
2016-10-04 16:02:09 -04:00
Rashed Abdel-Tawab
5f173157c4
extract_utils: Add ability to set custom vendor.mk name
In some circumstances we might want to set a custom vendor.mk
filename. If not set, then just default to the current device name

Change-Id: Icb59ebee67ce17b41ac613020685773efb01103d
2016-10-04 16:02:09 -04:00
Steve Kondik
79fa59b3be extract_utils: Add flag to disable pinning
* We might want to disable pinning entirely for an extract run.
 * Set DISABLE_PINNING=1 to turn it off and override everything.

Change-Id: I1be90dda68f0de1c5f5a70c946052d70bfaab7ed
2016-09-04 02:52:04 -07:00
Steve Kondik
7561d19795 extract_utils: Fix device online check
* No need to look for /sbin/recovery as adbd will report
   the device as being in recovery mode already. Also, this
   check appears to hang on N.

Change-Id: I3bcb427835ae3cd37c7ea56cbc57bba0d18fcc04
2016-09-02 20:43:02 -07:00
Hashbang173
3b3a0e1c8b extract_utils.sh: Disable dex preopt on prebuilt apks
Change-Id: I230f1a8bb95cbc1df36bc652b03e58829ec278f5
2016-08-28 20:50:03 -04:00
Steve Kondik
48f8df8ddb extract-utils: Add pinning support
* In many cases, we would like to keep certain files which do not
   exactly match what might be extracted from a factory ROM. This
   becomes extremely annoying over time to manually reconstruct,
   and it's easy to miss these special cases when updating to a
   new vendor release. It's also useful to flag additions which
   aren't found in the upstream release at all.
 * To solve this, we can now "pin" files to a specific sha1 hash.
   Simply append the sha1sum of the file to the appropriate line
   in your bloblist, prepended by a | delimiter.
 * This works by backing up the current files first, running the
   extraction, then checking if any pinned files need to be
   restored.
 * Also add an exit trap to clean up all of our tempfiles

Change-Id: I2010b5175b5701e19a3efb112e8907062ca37d66
2016-08-14 14:10:53 -07:00
Louis Popi
a516c2f0ac cm: extract_utils: Add a firmware extraction method
Change-Id: If14f6932cbdccf45ca0cc91c403e951363e91260
2016-08-05 08:31:55 +01:00
Luca Stefani
3a03012242 cm: extract_utils: Fixup xml files
Change-Id: Icb8efcca0e6e37a3ea7432716fcbfbd631d96c19
2016-08-05 00:01:45 -07:00
Luca Stefani
7f9fff2317 cm: extract_utils: Implement oat2dex
* Shipping baksmali and smali (version 2.1.3) in vendor/cm
   (Official sources: https://github.com/JesusFreke/smali)

Change-Id: Iaca6337fa2d4b5f2d6654ef5142ec0313af63f5a
2016-08-05 00:00:52 -07:00
Steve Kondik
03ce400352 Revert "extract_utils: Don't write multilib tags on 32-bit only devices"
* Not gonna work without preparsing all the lists combined together.

This reverts commit b7b7f88443.

Change-Id: I63ceead414d7f8416e2c2c8e4b12098077b545e2
2016-07-29 04:24:05 -07:00
Bruno Martins
3b96ba5841 cm: extract_utils: Rewrite file existence checks
Change-Id: I7c1584ec7162e0e18fae471e6aceef6123a5d10b
2016-07-28 16:24:28 -07:00
Steve Kondik
b7b7f88443 extract_utils: Don't write multilib tags on 32-bit only devices
Change-Id: I41b6f71c45a566ba1b4dd5cb72c4ebf44388b363
2016-07-28 16:12:19 -07:00
Steve Kondik
a991cf1f9b extract_utils: Add support for files in rootfs
* A final "rootfs" tag in the last column will place
   the chosen file into the ramdisk
 * Currently only supports files in /sbin
 * Cleaned up usage of class-specific flags
 * Simplified code

Change-Id: Id823d70aab51f8767522f697eaf65f52fc64b94b
2016-07-28 16:12:19 -07:00
Steve Kondik
52f3680199 cm: Remove stray echo from extract_utils
Change-Id: I2d893a3f8472a86835feef24540e82c47b69fd67
2016-07-21 09:43:52 -07:00
Steve Kondik
60ef86de1a cm: Underp dumping of 64-bit only libraries
Change-Id: I9c2140b40747fc7f847f1a532c42fb7ae5bfc3fd
2016-07-20 20:08:54 -07:00
Steve Kondik
4e2aaabd13 cm: Add generic tools for extract-files / setup-makefiles scripts
* Instead of having to enumerate packages and do a bunch of tedious
   shit, we now have a way to do it automatically based only on
   the blob lists.
 * Devices still need to implement a short script, but this library
   handles all the core functions.
 * Yes, we should probably be doing this in Python- Bash is
   absolutely horrible at dealing with arrays and lists.

Change-Id: I73b30ff4531c4d1b33ac53db33abf62555f500b4
2016-07-18 10:10:44 -07:00