Skip to content

Commit

Permalink
wiki: Initial documentation on using py extract utils
Browse files Browse the repository at this point in the history
Change-Id: I78497af68bc96b8efc6ff66ff4b4cccac1188f46
  • Loading branch information
basamaryan authored and npjohnson committed Jan 11, 2025
1 parent 1ed7a7c commit 3d719af
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
8 changes: 7 additions & 1 deletion _includes/templates/device_build.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,18 @@ This step requires to have a device already running the latest LineageOS, based
{% include alerts/note.html content=extracting_blobs_from_zips %}

Now ensure your {{ device.vendor }} {{ device.name }} is connected to your computer via the USB cable, with ADB and root enabled, and that you are in the
`~/android/lineage/device/{{ device.vendor_short }}/{{ device.codename }}` folder. Then run the `extract-files.sh` script:
`~/android/lineage/device/{{ device.vendor_short }}/{{ device.codename }}` folder. Then run either the `extract-files.sh` or `extract-files.py` script:

```
./extract-files.sh
```

Or, for the Python script:

```
./extract-files.py
```

The blobs should be pulled into the `~/android/lineage/vendor/{{ device.vendor_short }}` folder. If you see "command not found" errors, `adb` may
need to be placed in `~/bin`.

Expand Down
28 changes: 22 additions & 6 deletions pages/extracting_blobs_from_zips.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,18 @@ lpunpack super.img /output/dir

You must also now mount any other image files that you have in their respective directories as shown above with `vendor.img`.

After you have mounted the image(s), move to the root directory of the sources of your device and run `extract-files.sh` as follows:
After you have mounted the image(s), move to the root directory of the sources of your device and run `extract-files.sh` or `extract-files.py` as follows:

```
./extract-files.sh ~/android/system_dump/
```

This will tell `extract-files.sh` to get the files from the mounted system dump rather than from a connected device.
Or, for the Python script:
```
./extract-files.py ~/android/system_dump/
```

This will tell the extract-files script to get the files from the mounted system dump rather than from a connected device.

Once you've extracted all the proprietary files, unmount the vendor dump if you mounted it earlier:

Expand Down Expand Up @@ -160,12 +165,18 @@ unzip path/to/lineage-*.zip system/*
```
where `path/to/` is the path to the installable zip.

After you have extracted the `system` folder, move to the root directory of the sources of your device and run `extract-files.sh` as follows:
After you have extracted the `system` folder, move to the root directory of the sources of your device and run `extract-files.sh` or `extract-files.py` as follows:

```
./extract-files.sh ~/android/system_dump/
```
This will tell `extract-files.sh` to get the files from the extracted system dump rather than from a connected device.

Or, for the Python script:
```
./extract-files.py ~/android/system_dump/
```

This will tell the extract-files script to get the files from the extracted system dump rather than from a connected device.

Once you've extracted all the proprietary files, you can delete the files that were extracted from the zip:

Expand Down Expand Up @@ -221,13 +232,18 @@ sudo mount -o ro product.img system/product/
sudo mount -o ro system_ext.img system/system_ext/
```

Move to the root directory of the sources of your device and run `extract-files.sh` as follows:
Move to the root directory of the sources of your device and run `extract-files.sh` or `extract-files.py` as follows:

```
./extract-files.sh ~/android/system_dump/
```

This will tell `extract-files.sh` to extract the proprietary blobs from the mounted system dump rather than a connected device.
Or, for the Python script:
```
./extract-files.py ~/android/system_dump/
```

This will tell extract-files script to extract the proprietary blobs from the mounted system dump rather than a connected device.

Once it is done, unmount the system dump and remove the now unnecessary files:

Expand Down
4 changes: 3 additions & 1 deletion pages/internal/working_with_blobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ tags:

All devices should have a list of proprietary blobs in their device tree called ```proprietary-files.txt```. This list is used to create the vendor repository for building the device by extracting blobs from a device running the latest copy of LineageOS and/or from a system dump. Generally devices need only one list of blobs although you may encounter devices that have both ```proprietary-files.txt``` and ```proprietary-files-qc.txt``` (or more). There is no need to split the files and the reason for the split is largely historical at this point.

To start, copy the appropriate ```extract-files.sh``` and ```setup-makefiles.sh``` templates from ```tools/extract-utils/templates``` (```vendor/lineage/build/templates``` on LineageOS 17.1 and older) to your device tree and edit them to fill in the three required fields (device, vendor and copyright year).
For LineageOS 21 and below, copy the appropriate ```extract-files.sh``` and ```setup-makefiles.sh``` templates from ```tools/extract-utils/templates``` (```vendor/lineage/build/templates``` on LineageOS 17.1 and older) to your device tree and edit them to fill in the three required fields (device, vendor, and copyright year).

Starting with LineageOS 22, you should use the Python extract utilities, which are faster and more versatile. Copy the ```extract-files.py``` and ```setup-makefiles.py``` templates from ```tools/extract-utils/templates``` to your device tree and edit them similarly to fill in the required fields.

The contents of ```proprietary-files.txt``` is a list of blobs with optional comments (lines beginning with ```#```). Each blob line is of the form:

Expand Down

0 comments on commit 3d719af

Please sign in to comment.