[HOWTO] Built a Pie-GSI

here my new howto for the building chain:

  1. VirtualBox with LM 19.3; HD 125GB
  2. installing the building packages for LineageOS
    sudo apt install bc bison build-essential ccache curl flex g+±multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5 libncurses5-dev libsdl1.2-dev libssl-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev

For Ubuntu versions older than 20.04 (focal), install also:
sudo apt install libwxgtk3.0-dev
and ‘repo’
sudo apt install repo

Then I started the commands:
repo init -u https://gitlab.e.foundation/e/os/releases.git -b v1-pie
git clone https://github.com/MyOxy/e_gsi_localmanifest .repo/local_manifests
repo sync --force-sync

ATM I get the following error:
Checking out projects: 84% (592/700) platform/prebuilts/gcc/linux-x86/arm/arm-lChecking out projects: 84% (593/700) platform/prebuilts/gcc/linux-x86/host/x86_Checking out projects: 84% (594/700) platform/prebuilts/gcc/linux-x86/host/x86_Checking out projects: 85% (595/700) platform/prebuilts/gcc/linux-x86/x86/x86_6Checking out projects: 97% (682/700) LineageOS/android_vendor_codeaurora_telepherror: vendor/lineage/:
prior sync failed; rebase still in progress
error: Cannot checkout e/os/android_vendor_lineage
Checking out projects: 98% (686/700) LineageOS/android_vendor_nxp_opensource_exChecking out projects: 98% (687/700) LineageOS/android_vendor_nxp_opensource_frChecking out projects: 98% (688/700) LineageOS/android_vendor_nxp_opensource_paChecking out projects: 98% (689/700) LineageOS/android_vendor_nxp_opensource_haChecking out projects: 98% (690/700) LineageOS/android_vendor_nxp_opensource_hiChecking out projects: 98% (691/700) LineageOS/android_vendor_nxp_interfaces_opChecking out projects: 98% (692/700) LineageOS/android_vendor_qcom_opensource_aChecking out projects: 99% (693/700) LineageOS/android_vendor_qcom_opensource_cChecking out projects: 99% (694/700) LineageOS/android_vendor_qcom_opensource_dChecking out projects: 99% (695/700) LineageOS/android_vendor_qcom_opensource_dChecking out projects: 99% (696/700) LineageOS/android_vendor_qcom_opensource_iChecking out projects: 99% (697/700) LineageOS/android_vendor_qcom_opensource_tChecking out projects: 99% (699/700), done.

error: Unable to fully sync the tree.
error: Checking out local projects failed.
Failing repos:

What am I missing?

and running the build command
bash treble_build_los/buildbot_treble.sh

I get:

Applying GSI-specific patches
fatal: could not open ‘/home/user/treble_build_los/patches/0001-Revert-Enable-dyanmic-image-size-for-GSI.patch’ for reading: No such file or directory
[detached HEAD 5dcc653] Revert “tinycompress: Use generated kernel headers”
Date: Tue Sep 15 21:52:17 2020 +0200
1 file changed, 1 insertion(+), 1 deletion(-)
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
rm: cannot remove ‘vendor/qcom/opensource/cryptfs_hw’: Is a directory
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git


Couldn’t locate the top of the tree. Try setting TOP.
Trying dependencies-only mode on a non-existing device tree?
cat: /build/envsetup.sh: No such file or directory
cat: /vendor/lineage/build/envsetup.sh: No such file or directory
cat: /build/envsetup.sh: No such file or directory
cat: /vendor/lineage/build/envsetup.sh: No such file or directory

mkdir: cannot create directory ‘/target’: Permission denied
Couldn’t locate the top of the tree. Try setting TOP.
Couldn’t locate the top of the tree. Try setting TOP.
make: *** No rule to make target ‘systemimage’. Stop.

failed to build some targets

mv: cannot stat ‘system.img’: No such file or directory
zip warning: name not matched: e-pie-20200915-JoJo-treble_arm64_beN.img

zip error: Nothing to do! (e-pie-20200915-JoJo-treble_arm64_beN.img.zip)
Buildbot completed in 3 minutes and 47 seconds

Mhm, looks all pretty well. Pls check your source folders. If there is a folder vendor/lineage? If yes, remove it.

And run again ‘repo sync --force-sync’

No way to solve the issue with this repo:
repo init -u https://gitlab.e.foundation/e/os/releases.git -b v1-pie
I’m trying to restart from the following command (which is the same used in your building PIE-GSI script):
repo init -u https://gitlab.e.foundation/e/os/releases.git -b refs/tags/v0.11-pie
I’ll keep you updated…

The download link is dead

can’t change first post https://ecloud.global/s/o3Tyw8t4Rtcoar6

Thanks !
Will try to build a a64 (arm 32 with 64 binder) for my Redmi 7A

but not sure if it is still working. Haven’t build pie for a long time. could be that the sources are changed and build will fail

I’m building on a VPS (for now repo sync) and I tried to automate this a bit with Github Actions :

Manual CI Automated CI


I have now tested your script. First installed a System Linux Mint 20 xfce with VirtualBox, made all updates.
Then I followed the instructions on this page: https://github.com/phhusson/treble_experimentations/wiki/How-to-build-a-GSI%3F and I am not sure if I have to use the “repo commands” as well, i.e. this one:

mkdir -p ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

So SDK platform tools are all installed, as well as all the packages listed there, except libwxgtk3.0-dev, which was already installed with mint 20.

Up to point 4 I went to this page.

After that I took your script and changed it to this:


repo init -u https://gitlab.e.foundation/e/os/releases.git -b refs/tags/v0.12-q

git clone https://github.com/MyOxy/e_gsi_localmanifest .repo/local_manifest

repo sync --force-sync

bash treble_build_los/buildbot_treble.sh

The script started as normal user, the virtual hard disk has increased from about 11GB to about 115GB.
The beginning ran great, apparently everything was downloaded, then I was not there (eating), when I looked again, everything was full of errors.
Among other things I noticed that in your script the localmanifest refers to Android 9, but I refer to Android 10 in the line above.
Question, is there a localmanifest for Android 10 somewhere to download? Or do you have to change the line in LineageOS to 17.1? But if I change it, that’s not really possible, then I would have to create an account at github and upload the script to my site, at github

This one is a fraction of the error messages:

error: Anwendung des Patches fehlgeschlagen: public/vendor_init.te:60
error: public/vendor_init.te: Patch konnte nicht angewendet werden
Failed applying /home/andy/treble_patches/patches/platform_system_sepolicy/0009-Allow-mmap-for-vendor_init.patch
error: Anwendung des Patches fehlgeschlagen: private/storaged.te:49
error: private/storaged.te: Patch konnte nicht angewendet werden
error: Anwendung des Patches fehlgeschlagen: private/vold_prepare_subdirs.te:7
error: private/vold_prepare_subdirs.te: Patch konnte nicht angewendet werden
error: Anwendung des Patches fehlgeschlagen: private/zygote.te:7
error: private/zygote.te: Patch konnte nicht angewendet werden

When I type this command, as specified in the errors:

git on --show-current-patch


fatal: Kein Git-Repository (oder irgendeines der Elternverzeichnisse): .git

Here is another error message:

mkdir: das Verzeichnis »/target“ kann nicht angelegt werden: Keine Berechtigung
Couldn’t locate the top of the tree. Try setting TOP.
Couldn’t locate the top of the tree. Try setting TOP.
make: *** Keine Regel, um „systemimage“ zu erstellen. Schluss.

Why no permission? Everything runs in the home directory of the user…

I’m not quite sure about that yet, maybe you could give me some hints?


I’m looking through it more and more now…

The first command:

repo init -u https://gitlab.e.foundation/e/os/releases.git -b refs/tags/v0.12-q

specifies which sources should be used, correct?

This command:

git clone https://github.com/MyOxy/e_gsi_localmanifest .repo/local_manifest

accesses your file, where you have linked all kinds of things, that is, where you take the sources from.
But this is only Android 9, the way I see it.
If I save and change the manifest file locally now, I don’t need a github account?
However, this will NOT work here in the manifest because the file “new-e-q” does NOT exist in github, or do I get it wrong?

project path=“treble_build_los” name=“treble_build_los” remote=“MyOxy” revision=“new-e-q”/

I still have a lot of work to do until this will work for me…

first, you can’t use it for Q builds. All patches and manifests are different.


because it’s only for pie

Thanks for the answer, where could I find the manifest for “Q”?

I have just made one for you. Hope it will work

check line 11 for your source folder

Thanks, i test it now :slight_smile:

good luck :crossed_fingers:

I simply run it in the home directory, downloads the sources again, had deleted the ones from this morning, were only 44GB, is fast with 1GBit line :slight_smile:
Before I get confused about the directories.

you will need a srv/e directory (see line 11). From there you should start the script

Well, I had really ignored it, reinstall Mint again, had copied the VM in the state with updates, apparently I would have had to copy even more instead of just the 3 files, the copy was not started anymore, the other VM I had already deleted… bad luck…
Cloning took me too long, you already notice when you work with HDD or m.2 SSD…
But you have, thanks to short-time work, some time…

On a VM I think it will need around 3 hours for downloading sources and around 7 hours building. It needs a lot more time as building a rom

Well, the download seemed to work, but now there was an error:

Checking out projects: 100% (756/756), done.
repo sync has finished successfully.
Setting up build environment

./GSI-Q.sh: Zeile 36: Syntaxfehler beim unerwarteten Wort »else«
./GSI-Q.sh: Zeile 36: `else’

This is probably the moment where the building of the ROM should start.

I deleted the section and the next error occurred:

lunch: Befehl nicht gefunden

Maybe you mean “launch”? I’ll just give launch a try.

…launch it was not…