Skip to content

Instantly share code, notes, and snippets.

@ttsiodras
Last active September 29, 2021 12:44
Show Gist options
  • Save ttsiodras/fb9e1addfe2614e8eb4fdd63e54db2ac to your computer and use it in GitHub Desktop.
Save ttsiodras/fb9e1addfe2614e8eb4fdd63e54db2ac to your computer and use it in GitHub Desktop.
History building alioth LineageOS

Commands I issued:

cd android/lineage/
repo init -u https://github.com/LineageOS/android.git -b lineage-18.1
repo sync
source build/envsetup.sh
breakfast alioth
# intermission, to extract firmware files from latest LineageOS image into ~/android/system_dump/
find . -name extract-files.sh
cd device/xiaomi/alioth/
./extract-files.sh ~/android/system_dump/
# all good, files extracted, no errors
cd -
breakfast alioth
croot
brunch alioth

This ended after some hours with...

Archive:  out/target/product/alioth/obj/PACKAGING/target_files_intermediates/lineage_alioth-target_files-eng.lineageos.zip
  inflating: /home/lineageos/android/lineage/out/soong/.temp/TEMP.UPARDg/IMAGES/vbmeta_system.img
Archive:  out/target/product/alioth/obj/PACKAGING/target_files_intermediates/lineage_alioth-target_files-eng.lineageos.zip
  inflating: /home/lineageos/android/lineage/out/soong/.temp/TEMP.dj8Zig/IMAGES/vendor.img  Archive:  out/target/product/alioth/obj/PACKAGING/target_files_intermediates/lineage_alioth-tar
get_files-eng.lineageos.zip
  inflating: /home/lineageos/android/lineage/out/soong/.temp/TEMP.jHucGf/IMAGES/odm.map
Archive:  out/target/product/alioth/obj/PACKAGING/target_files_intermediates/lineage_alioth-target_files-eng.lineageos.zip
  inflating: /home/lineageos/android/lineage/out/soong/.temp/TEMP.0szZRj/IMAGES/vendor_boot.img  Extracted DST_PARTITIONS[vbmeta_system]: 4096 bytes
Extracted DST_PARTITIONS[odm]: 32448512 bytes
Extracted DST_PARTITIONS[vbmeta]: 8192 bytes

Extracted DST_PARTITIONS[dtbo]: 33554432 bytes


Extracted DST_PARTITIONS[vendor_boot]: 100663296 bytes
Converting Android sparse image system_ext.img to RAW.
Converting Android sparse image product.img to RAW.
Converting Android sparse image system.img to RAW.
Converting Android sparse image vendor.img to RAW.
Extracted DST_PARTITIONS[boot]: 201326592 bytes
Archive:  out/target/product/alioth/obj/PACKAGING/target_files_intermediates/lineage_alioth-target_files-eng.lineageos.zip
  inflating: /home/lineageos/android/lineage/out/soong/.temp/TEMP.6judUL/IMAGES/system_ext.map
Extracted DST_PARTITIONS[system_ext]: 755798016 bytes
Archive:  out/target/product/alioth/obj/PACKAGING/target_files_intermediates/lineage_alioth-target_files-eng.lineageos.zip
  inflating: /home/lineageos/android/lineage/out/soong/.temp/TEMP.v3ZOdS/IMAGES/product.map
Extracted DST_PARTITIONS[product]: 909840384 bytes
Archive:  out/target/product/alioth/obj/PACKAGING/target_files_intermediates/lineage_alioth-target_files-eng.lineageos.zip
  inflating: /home/lineageos/android/lineage/out/soong/.temp/TEMP.MHsrud/IMAGES/system.map
Archive:  out/target/product/alioth/obj/PACKAGING/target_files_intermediates/lineage_alioth-target_files-eng.lineageos.zip
  inflating: /home/lineageos/android/lineage/out/soong/.temp/TEMP.w9znoK/IMAGES/vendor.map
Extracted DST_PARTITIONS[vendor]: 1304940544 bytes
Generating full update.
Running delta_generator with args: --out_file=/home/lineageos/android/lineage/out/soong/.temp/payload-pRjatn.bin --partition_names=boot:dtbo:odm:product:system:system_ext:vbmeta:vbmeta_s$
stem:vendor:vendor_boot --new_partitions=/home/lineageos/android/lineage/out/soong/.temp/boot.img.878Wm9:/home/lineageos/android/lineage/out/soong/.temp/dtbo.img.t5mOZ8:/home/lineageos/a$
droid/lineage/out/soong/.temp/odm.img.B6pr1b:/home/lineageos/android/lineage/out/soong/.temp/product.img.XvhUKb:/home/lineageos/android/lineage/out/soong/.temp/system.img.Fstdpb:/home/li$
eageos/android/lineage/out/soong/.temp/system_ext.img.Culote:/home/lineageos/android/lineage/out/soong/.temp/vbmeta.img.9X6p8d:/home/lineageos/android/lineage/out/soong/.temp/vbmeta_syst$
m.img.ni98Td:/home/lineageos/android/lineage/out/soong/.temp/vendor.img.X58N8g:/home/lineageos/android/lineage/out/soong/.temp/vendor_boot.img.XbCuTg --new_mapfiles=::/home/lineageos/and$
oid/lineage/out/soong/.temp/odm.map.3FOlxc:/home/lineageos/android/lineage/out/soong/.temp/product.map.Ulwz3a:/home/lineageos/android/lineage/out/soong/.temp/system.map.nHIwya:/home/line$
geos/android/lineage/out/soong/.temp/system_ext.map.sLWuQe:::/home/lineageos/android/lineage/out/soong/.temp/vendor.map.6VcCvh: --major_version=2 --max_timestamp=1632905535 --new_postins$
all_config_file=/home/lineageos/android/lineage/out/soong/.temp/postinstall_config.CRfqB4 --dynamic_partition_info_file=/home/lineageos/android/lineage/out/soong/.temp/dynamic_partitions$
info.dBGy76
[0929/125544.119575:ERROR:payload_generation_config.cc(200)] Sum of sizes in qti_dynamic_partitions_partition_list is 4560490496, which is greater than qti_dynamic_partitions_size (45592$
8448)
[0929/125544.119669:FATAL:generate_delta_main.cc(619)] Check failed: payload_config.target.ValidateDynamicPartitionMetadata().
/home/lineageos/android/lineage/out/host/linux-x86/bin/../lib64/libchrome.so(base::debug::StackTrace::StackTrace(unsigned long)+0x17) [0x7f4354e1c7d7]
/home/lineageos/android/lineage/out/host/linux-x86/bin/../lib64/libchrome.so(logging::LogMessage::~LogMessage()+0x8a) [0x7f4354dada1a]
out/host/linux-x86/bin/delta_generator(+0xb6aae) [0x55d62b571aae]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb) [0x7f435486109b]
out/host/linux-x86/bin/delta_generator(+0xb2ac9) [0x55d62b56dac9]

out/host/linux-x86/bin/brillo_update_payload: line 625: 28607 Aborted                 "${GENERATOR}" "${GENERATOR_ARGS[@]}"
2021-09-29 12:55:44 - common.py - INFO    :
2021-09-29 12:55:44 - ota_from_target_files.py - ERROR   :
   ERROR:
Traceback (most recent call last):
  File "/home/lineageos/android/lineage/out/host/linux-x86/bin/ota_from_target_files/ota_from_target_files.py", line 2300, in <module>
  File "/home/lineageos/android/lineage/out/host/linux-x86/bin/ota_from_target_files/ota_from_target_files.py", line 2273, in main
  File "/home/lineageos/android/lineage/out/host/linux-x86/bin/ota_from_target_files/ota_from_target_files.py", line 1916, in GenerateAbOtaPackage
  File "/home/lineageos/android/lineage/out/host/linux-x86/bin/ota_from_target_files/ota_from_target_files.py", line 407, in Generate
  File "/home/lineageos/android/lineage/out/host/linux-x86/bin/ota_from_target_files/ota_from_target_files.py", line 381, in _Run
  File "/home/lineageos/android/lineage/out/host/linux-x86/bin/ota_from_target_files/common.py", line 281, in RunAndCheckOutput
    args, proc.returncode, output))
ExternalError: Failed to run command '['brillo_update_payload', 'generate', '--payload', '/home/lineageos/android/lineage/out/soong/.temp/payload-pRjatn.bin', '--target_image', 'out/targ$
t/product/alioth/obj/PACKAGING/target_files_intermediates/lineage_alioth-target_files-eng.lineageos.zip', '--max_timestamp', '1632905535']' (exit code 134):

12:55:46 ninja failed with: exit status 1

#### failed to build some targets (02:03:35 (hh:mm:ss)) ####

I contacted the LineageOS guys at https://web.libera.chat/ (channel #LineageOS-dev ) and "LuK1337" suggested that I export WITH_GMS=true before invoking brunch alioth.

I tried it - and it fixed the issue!

....
[0929/142350.415849:INFO:generate_delta_main.cc(142)] Signing payload.
[0929/142350.415948:INFO:payload_signer.cc(78)] Signature blob size: 267
[0929/142350.415956:INFO:payload_signer.cc(78)] Signature blob size: 267
[0929/142351.398661:INFO:payload_signer.cc(121)] Metadata signature size: 267
[0929/142351.399215:INFO:payload_signer.cc(246)] Making room for signature in file
[0929/142351.399223:INFO:payload_signer.cc(248)] set? 1
[0929/142351.399389:INFO:payload_signer.cc(152)] Updated protobuf size: 90987
[0929/142351.614791:INFO:payload_signer.cc(164)] Updated payload size: 1016449969
[0929/142351.614815:INFO:payload_signer.cc(165)] Updated metadata size: 91011
[0929/142351.614818:INFO:payload_signer.cc(169)] Signature Blob Offset: 1016449969
[0929/142351.614969:INFO:payload_signer.cc(492)] Signed payload size: 1016450236
[0929/142358.932832:INFO:generate_delta_main.cc(157)] Done signing payload. Final metadata size = 91011
Done signing payload.
2021-09-29 14:23:58 - common.py - INFO    :
2021-09-29 14:23:58 - common.py - INFO    :   Running: "brillo_update_payload properties --payload /home/lineageos/android/lineage/out/soong/.temp/signed-payload-LFUxZs.bin --properties_file /home/lineageos/android/lineage/out/soong/.temp/payload-properties-XjcLj9.txt"
[0929/142401.755894:INFO:generate_delta_main.cc(278)] Generated properties file at /home/lineageos/android/lineage/out/soong/.temp/payload-properties-XjcLj9.txt
2021-09-29 14:24:01 - common.py - INFO    :
2021-09-29 14:24:10 - common.py - INFO    :   Running: "java -Xmx2048m -Djava.library.path=out/host/linux-x86/lib64 -jar out/host/linux-x86/framework/signapk.jar -w build/make/target/product/security/testkey.x509.pem build/make/target/product/security/testkey.pk8 /home/lineageos/android/lineage/out/soong/.temp/tmpA7pSjH.zip /home/lineageos/android/lineage/out/soong/.temp/tmpSGOUoc.zip"
2021-09-29 14:24:22 - common.py - INFO    :   Running: "zip -d /home/lineageos/android/lineage/out/soong/.temp/tmpSGOUoc.zip META-INF/com/android/metadata"
2021-09-29 14:24:22 - common.py - INFO    : deleting: META-INF/com/android/metadata
2021-09-29 14:24:22 - common.py - INFO    :   Running: "java -Xmx2048m -Djava.library.path=out/host/linux-x86/lib64 -jar out/host/linux-x86/framework/signapk.jar -w build/make/target/product/security/testkey.x509.pem build/make/target/product/security/testkey.pk8 /home/lineageos/android/lineage/out/soong/.temp/tmpSGOUoc.zip out/target/product/alioth/lineage_alioth-ota-eng.lineageos.zip"
2021-09-29 14:24:26 - ota_from_target_files.py - INFO    : done.
[100% 26174/26174] build bacon
Package Complete: out/target/product/alioth/lineage-18.1-20210929-UNOFFICIAL-alioth.zip

#### build completed successfully (18:55 (mm:ss)) ####

I now have an image to test on my POCO F3, as soon as my 7-day Xioami-please-wait-to-unlock-bootloader passes. Thanks, Luk1337!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment