Fire Open Gapps Pico - Fire General

*** Mainline OpenGapps is now working ***
*** Go to http://opengapps.org ***
INFO
- This is Open Gapps Pico Modified to be flashable using Cyanogen Recovery.
- It disables to checks in the updater-script which do not pass because of our device characteristics specified in our build.prop
- One check is for Android version and the other is architecture.
DOWNLOAD
- Open Gapps Pico for Amazon Fire 2015
MOD
- Changes made to make flashable
Code:
diff --git a/update-binary-a b/update-binary-b
index f6f2f72..976b9d2 100644
--- a/update-binary-a
+++ b/update-binary-b
@@ -466,36 +466,36 @@ echo ---------------------------------------------------------------------------
log "ROM Android Version" "$rom_android_version";
# Check to make certain user has proper version ROM Installed
-if [ ! "${rom_android_version:0:3}" = "$req_android_version" ]; then
- ui_print "*** Incompatible Android ROM detected ***";
- ui_print " ";
- ui_print "This GApps pkg is for Android $req_android_version.x ONLY";
- ui_print " ";
- ui_print "******* GApps Installation failed *******";
- ui_print " ";
- install_note="${install_note}rom_version_msg"$'\n'; # make note that ROM Version is not compatible with these GApps
- abort "$E_ROMVER";
-fi;
+#if [ ! "${rom_android_version:0:3}" = "$req_android_version" ]; then
+# ui_print "*** Incompatible Android ROM detected ***";
+# ui_print " ";
+# ui_print "This GApps pkg is for Android $req_android_version.x ONLY";
+# ui_print " ";
+# ui_print "******* GApps Installation failed *******";
+# ui_print " ";
+# install_note="${install_note}rom_version_msg"$'\n'; # make note that ROM Version is not compatible with these GApps
+# abort "$E_ROMVER";
+#fi;
# Check to make certain that user device matches the architecture
device_architecture="$(file_getprop $b_prop "ro.product.cpu.abilist=")"
# If the recommended field is empty, fall back to the deprecated one
-if [ -z "$device_architecture" ]; then
- device_architecture="$(file_getprop $b_prop "ro.product.cpu.abi=")"
-fi
-if ! (echo "$device_architecture" | grep -i "armeabi" | grep -qiv "arm64"); then
- ui_print "***** Incompatible Device Detected *****";
- ui_print " ";
- ui_print "This Open GApps package cannot be";
- ui_print "installed on this device's architecture.";
- ui_print "Please download the correct version for";
- ui_print "your device: $device_architecture";
- ui_print " ";
- ui_print "******* GApps Installation failed *******";
- ui_print " ";
- install_note="${install_note}arch_compat_msg"$'\n'; # make note that Open GApps are not compatible with architecture
- abort "$E_ARCH";
-fi;
+#if [ -z "$device_architecture" ]; then
+# device_architecture="$(file_getprop $b_prop "ro.product.cpu.abi=")"
+#fi
+#if ! (echo "$device_architecture" | grep -i "armeabi" | grep -qiv "arm64"); then
+# ui_print "***** Incompatible Device Detected *****";
+# ui_print " ";
+# ui_print "This Open GApps package cannot be";
+# ui_print "installed on this device's architecture.";
+# ui_print "Please download the correct version for";
+# ui_print "your device: $device_architecture";
+# ui_print " ";
+# ui_print "******* GApps Installation failed *******";
+# ui_print " ";
+# install_note="${install_note}arch_compat_msg"$'\n'; # make note that Open GApps are not compatible with architecture
+# abort "$E_ARCH";
+#fi;
# Determine Recovery Type and Version
for rec_log in $rec_tmp_log $rec_cache_log; do

Cool, how can I boot to recovery without adb?
Sent from my KFFOWI using Tapatalk

garzel14 said:
Cool, how can I boot to recovery without adb?
Sent from my KFFOWI using Tapatalk
Click to expand...
Click to collapse
No way as of right now, that requires an unlocked bootloader or Safestrap.
Sent from my XT912 using Tapatalk

Vlasp said:
No way as of right now, that requires an unlocked bootloader or Safestrap.
Sent from my XT912 using Tapatalk
Click to expand...
Click to collapse
OK cool thanks, how far away can we expect a custom rom, do they have to be developed for the device?
Sent from my KFFOWI using Tapatalk

garzel14 said:
OK cool thanks, how far away can we expect a custom rom, do they have to be developed for the device?
Sent from my KFFOWI using Tapatalk
Click to expand...
Click to collapse
Well, we have to develop ROMS based on the boot.img we have right now, because we can't change it right now. I think ggow is working on CM12, and I will be working on it also.
Sent from my XT912 using Tapatalk

Vlasp said:
Well, we have to develop ROMS based on the boot.img we have right now, because we can't change it right now. I think ggow is working on CM12, and I will be working on it also.
Sent from my XT912 using Tapatalk
Click to expand...
Click to collapse
garzel14 said:
OK cool thanks, how far away can we expect a custom rom, do they have to be developed for the device?
Sent from my KFFOWI using Tapatalk
Click to expand...
Click to collapse
- Props to Amazon for providing the kernel source however...
- Been looking into MediaTek - what a pita - no HAL source code available - it's going to be difficult

when logging in to google play store with any browser (both computer and my Fire) google says
" You don't have any devices"
i used this method here to install gapps and still get it
was hopping this would be fixed with gapps
playstore works just fine
...
anyone know how to fix this ?
...
i wanna down load
the developer
"[root] FlashFire
Chainfire Tools"
for
Xposed

Great, thank you. These GApps made some apps available in the Play Store that I couldn't download before.
I'm having the same issue as a1yet, though. I don't know if it's related to the GApps themselves.

Info
- @MastahF has contacted me who is the project owner of Open GApps
- We are going to figure out compatibility for Amazon Fire with the mainline Open GApps package
- Attached here also is the default.prop from the Cyanogen Recovery which we are using to flash which may help

Could you try the following patch against the regular Open GApps and check whether it works for you?
UPDATE: I had an error in the first patch. Please retry the updated version.

MastahF said:
Could you try the following patch against the regular Open GApps and check whether it works for you?
Click to expand...
Click to collapse
me ?
if me how would i use the patch ?
if you are not talking to me ignore this post
---------- Post added at 02:01 PM ---------- Previous post was at 01:22 PM ----------
ggow said:
-Attached here also is the default.prop from the Cyanogen Recovery which we are using to flash which may help
Click to expand...
Click to collapse
ok tried flashing (installing?) the default prop
with your "Cyanogen Recovery"
and get an error then it tries to wipe my cash and get an error there to
so i think I'm to dumb to use your file
sorry :crying:

MastahF said:
Could you try the following patch against the regular Open GApps and check whether it works for you?
UPDATE: I had an error in the first patch. Please retry the updated version.
Click to expand...
Click to collapse
Will test it sometime hopefully tomorrow, Thanks

Does this work on the current firmware release?

shinji257 said:
Does this work on the current firmware release?
Click to expand...
Click to collapse
Yes it does

ggow said:
Will test it sometime hopefully tomorrow, Thanks
Click to expand...
Click to collapse
Did you test it in the end? I also mainlined the patch, so packages from opengapps.org also contain it, and I am very curious if it enables compatibility with the Amazon Fire.

MastahF said:
Did you test it in the end? I also mainlined the patch, so packages from opengapps.org also contain it, and I am very curious if it enables compatibility with the Amazon Fire.
Click to expand...
Click to collapse
I took the liberty of testing the package and it appeared to work ok on my Amazon Fire with Firmware 5.0.1. I downloaded the pico android 5.1 ARM (not ARM64) package dated 11/7/2015 from your website.

MastahF said:
Did you test it in the end? I also mainlined the patch, so packages from opengapps.org also contain it, and I am very curious if it enables compatibility with the Amazon Fire.
Click to expand...
Click to collapse
Sorry no I didn't yet, I had long day at work on Friday and out most of this weekend.
EDIT: Just tested and it works fine

MastahF said:
Did you test it in the end? I also mainlined the patch, so packages from opengapps.org also contain it, and I am very curious if it enables compatibility with the Amazon Fire.
Click to expand...
Click to collapse
I can confirm the packages on opengapps.org worked on my Fire I used todays package (11102015).

Pyrb said:
I can confirm the packages on opengapps.org worked on my Fire I used todays package (11102015).
Click to expand...
Click to collapse
Just tested and can confirm all seems good - mainline opengapps works
Thanks @MastahF
I'll add a note to the OP

MastahF said:
Could you try the following patch against the regular Open GApps and check whether it works for you?
UPDATE: I had an error in the first patch. Please retry the updated version.
Click to expand...
Click to collapse
Hi MastahF,
as mentioned the mainline Open Gapps package now works on the fire. I have noticed though that the play web store doesn't list my Fire as a device now. The Android Device Manager does show it. Is this something we can/should fix in Open Gapps?

Related

[GUIDE][ICS] Compile Cyanogenmod 9 on Mac OS X Lion

There are a lot of toturials for building CM9 on ubuntu or CM7 on Mac but I couldn't find a decent toturial for building CM9 on Mac (specially Lion). Development in AOSP/CM land is rapid and guides frequently need updating. I had to spend a little time to figure everything out and I decided to share it here.
This tutorial is for building CM9 (ICS) for Galaxy Nexus GSM (maguro) on Mac OS X Lion 10.7.3 using Xcode 4.3 and homebrew . You can easily make the instructions work for most other cm9 devices, but I wouldn't know anything about that.
DISCLAIMER: I'm not responsible if you blow yourself up, blah blah blah
However, I've tried to make this as noob friendly as possible because, well I'm a noob myself
Instrunctions:
UPADTE (MAY 29TH) : The Xcode 4.3 default compiler (llvm-gcc) used to be incompatible with CM9. Thanks to jocelyn and topprospect, the LLVM compatibility patches from mainline AOSP are now merged into CM9. Therefore, you can now use Xcode 4.3 and its command line tools without installing another compiler. However, since GCC is still the only officially supported compiler, incompatibilites with llvm-gcc could still be introduced with future updates. Therefore, if your build fails, it might be worth it to try installing and compiling with GCC 4.2. See the Troubleshooting section for more info.
Now that we have Xcode 4.3 and Xcode command line tools (CLT) installed, let's continue.
Open Terminal and run
Code:
java
if you don't have Java, you will get a prompt asking you to download and install Java. Go ahead and install it.
If you don't have adb and fastboot working, download the android-sdk from google (version r18 as of now) and put it in /usr/local/ and rename the folder to "android-sdk".
Install the homebrew package manager
Code:
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
To make sure that homebrew and android-sdk executables are in $PATH:
Code:
touch ~/.bash_profile && echo "PATH=/usr/local/bin:/usr/local/sbin:$PATH:/usr/local/android-sdk/tools:/usr/local/android-sdk/platform-tools" >> ~/.bash_profile
Relaunch Terminal for the change to take effect.
At this point you can run
Code:
brew doctor
to detect any problems there might be (Homebrew may instruct you to use the xcode-select utility to select the xcode installation path). Hopefully, your system is raring to brew
Now we have to install a bunch of packages:
Code:
brew install git coreutils findutils gnu-sed gnupg pngcrush repo
We now need to create a couple of symlinks so that the gnu versions of 'sed' and 'find' are used rather than the osx provided versions :
Code:
ln -s /usr/local/bin/gfind /usr/local/bin/find && ln -s /usr/local/bin/gsed /usr/local/bin/sed && ln -s /usr/local/bin/gstat /usr/local/bin/stat
It's time to create a case sensitive image which will hold our working directory:
Code:
hdiutil create -type SPARSE -fs "Case-sensitive Journaled HFS+" -size 40g -volname "android" -attach ~/Desktop/Android
Now we have a disk image in ~/Desktop/Android. Mount it if it's not mounted already. (Don't be picky about the size, the image will only take as much as space as its contents).
Now we need to create a working directory inside the mounted volume:
Code:
cd /Volumes/android && mkdir cm9 && cd cm9
We can initialize and download the source now:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b ics && repo sync && say 'finished'
Now we need to get the required proprietry files for our device. We can get these from the device itself. Connect your phone (make sure USB Debugging is enabled) and run the following (for maguro):
Code:
cd /Volumes/android/cm9/device/samsung/maguro/ && ./extract-files.sh
[If you see errors in the output from extract-files.sh, see the Troubleshooting section below]
For Google devices,we can also get them directly from google. For maguro, download the 3 files and extract them to /Volumes/android/cm9. Then,
Code:
cd /Volumes/android/cm9
/Volumes/android/cm9/extract-broadcom-maguro.sh
/Volumes/android/cm9/extract-imgtec-maguro.sh
/Volumes/android/cm9/extract-samsung-maguro.sh
We also need the prebuilts (like ROM manager and Term.apk):
Code:
/Volumes/android/cm9/vendor/cm/get-prebuilts
You can optionally tell the build to use the ccache tool. CCache acts as a compiler cache that can be used to speed-up rebuilds :
Code:
export USE_CCACHE=1 && /Volumes/android/cm9/prebuilt/darwin-x86/ccache/ccache -M 20G
Default is 1GB. Anything between 20GB-50GB should be fine.
Before starting the build, we need to workaround an issue with Lion and compiling the QEMU emulator.
[This step doesn't seem to be needed anymore. QEMU is automatically ignored on OS X/Darwin]
If you build now, you're probably gonna get kernel build errors regarding the missing elf.h header (this error might be device specific). Fortunately, we already have this file downloaded, so we only need to copy it to /usr/local/include:
Code:
cp /Volumes/android/cm9/external/elfutils/libelf/elf.h /usr/local/include
FINALLY, we are ready to build:
Code:
cd /Volumes/android/cm9 && source build/envsetup.sh && brunch
Pick your device from the list and enter the number. For maguro, you could use "brunch maguro" instead and skip the menu. Depending on your system, this will take 30min-4hours.
You should now see a beautiful zip file waiting to be flashed:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
​Troubleshooting:
The extract script for maguro seems to be a little outdated, as it doesn't pull the gps proprietary blob. You can either use the google provided scripts, or add koush's git repository for your device to your local_manifest.xml.
As explained above, the CM9 source is currently compatible with llvm-gcc. In the future, if llvm-gcc fails to build correctly, you should try installing and compiling using GCC4.2 (the Xcode 3 compiler). You can install apple-gcc4.2 from homebrew:
Code:
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/apple-gcc42.rb
This version of gcc can happily coexist with Xcode 4.x .
So now you have GCC 4.2 installed, but it won't be used unless we update the corresposing environment variables:
Code:
export CC=/usr/local/bin/gcc-4.2 && export CXX=/usr/local/bin/g++-4.2
Notice that using the export command is temporary. If you relaunch Terminal, you will need to set these again. However, this is a good thing, because changing these values permanently (by putting them in ~/.bash_profile) can interfere with other builds.
If you use this method, the build might fail while compiling "external/zlib/x86/adler32.c". It appears that a recent change in zlib has introduced an incompatibility with gcc 4.2. you have to revert the following 2 commits:
Code:
cd external/zlib
git revert dd6786cae3f4493faa6661d5f74db587932f15d7
git revert 13bf40af68236c961542bdee1d4b7c0176bf15a0
Alternatively, you can add topprospect's zlib on github (which has those commits reverted) to your local_manifast.xml. Simply run:
Code:
nano /Volumes/android/cm9/.repo/local_manifest.xml
and add the following line
Code:
<project name="dferg/android_external_zlib" path="external/zlib" remote="github" />
If you get a build error, and your error is not covered here, copy the last 20-30 lines of the build output AND the output from the following command into pastebin and post the link. Hopefully me or someone else will help you.
Code:
echo -e "\nENV:\n$(env)\n\nWHICH GCC\n:$(which gcc)\n\nWHICH G++:\n$(which g++)\n\nWHICH CC:\n$(which cc)\n\nWHICH C++:\n$(which c++)\n\nBREW DOCTOR:\n$(brew doctor)\n\nBREW LIST:\n$(brew list)\n\n/USR/BIN:\n$(ls -l /usr/bin | grep gcc)\n\n/USR/LOCAL/BIN:\n$(ls -l /usr/local/bin | grep gcc)\n\n"
​Notes/Extras:
To quickly setup your environment, add an alias like the following to ~/.bash_profile:
Code:
alias cm9env="hdiutil attach PATH-TO-DISK-IMAGE -mountpoint /Volumes/android && cd /Volumes/android/cm9 && source ./build/envsetup.sh && export USE_CCACHE=1"
alias cm9build="cm9env && make clobber && reposync && brunch maguro"
Now you can save time by using "cm9env" to get your environment setup or "cm9build" to compile a clean updated build.
To clear your output directory for a new build, run "make clobber". You probably don't need this if you've only changed a few lines of code.
To cherry pick yet-to-be-merged changes from the gerrit instance:
1. Pick an open commit from CM Gerrit
2. Under list of Patch Sets pick the latest and open cherry-pick tab
3. Check what Git repository the url is pointing e.g. http://review.cyanog...frameworks_base
4. In your CM9 working tree go to the corresponding directory, which in this case is something like ~/your-working-directory/frameworks/base/
5. Now simply paste the whole line seen in CM Gerrit cherry-pick tab e.g. "git fetch http://review.cyanog....rameworks_base refs/changes/00/13100/4 && git cherry-pick FETCH_HEAD"
It should be now included in your next compiled build. When doing repo sync again, cherry picks will be lost.[CREDIT Fihlvein from xda]
Click to expand...
Click to collapse
Enjoy your custom built CM9!
I updated OP with some updated info about Xcode 4.3.
Nice work man. Very helpful.
conantroutman said:
Nice work man. Very helpful.
Click to expand...
Click to collapse
thanks! I'll try to keep this topic updated as issues with mac are introduced/resolved.
Nice write up. Thanks.
Before I start again from scratch I have a question. Does this guide apply to previous versions of mac os x (mine is 10.6.8)? I used the official android initializing build environment page & cm7 wiki page for the instructions to setup my build environment.
Also, any tips to switch from macports to homebrew?
In the past I've had to cherry pick to get my OS X build environment set up for CM9. The compile from source fails because I started with macports instead of homebrew (bad idea). I tried to switch to homebrew without success. Any tips to switch from macports to homebrew?
For the sake of keeping this page on topic a pm response is ok if that is what you prefer.
Hi thanks for this !! Helpful one question what do i change so i can do AOSP instead of cm9??
grad061980 said:
Nice write up. Thanks.
Before I start again from scratch I have a question. Does this guide apply to previous versions of mac os x (mine is 10.6.8)? I used the official android initializing build environment page & cm7 wiki page for the instructions to setup my build environment.
Also, any tips to switch from macports to homebrew?
In the past I've had to cherry pick to get my OS X build environment set up for CM9. The compile from source fails because I started with macports instead of homebrew (bad idea). I tried to switch to homebrew without success. Any tips to switch from macports to homebrew?
For the sake of keeping this page on topic a pm response is ok if that is what you prefer.
Click to expand...
Click to collapse
Yes, this guide should work fine on Snow Leopard. It mostly depends on your Xcode version. If you have Xcode 3, you can skip step 1 entirely, since you already have gcc4.2 as part of Xcode.
If you have access to Xcode 4.2 and above, you will need to install gcc4.2 separately, as explained in the guide.
Now regarding Macports, I strongly suggest that you completely uninstall Macports before installing homebrew. Instructions are here: http://guide.macports.org/chunked/installing.macports.uninstalling.html
WonkyYew said:
Hi thanks for this !! Helpful one question what do i change so i can do AOSP instead of cm9??
Click to expand...
Click to collapse
Full instructions are available on android.com : http://source.android.com/source/initializing.html
If you are using this guide, you need to change the repo initialization command to :
Code:
repo init -u https://android.googlesource.com/platform/manifest
and then do repo sync. You can setup ccache as usual. I don't think AOSP has the "brunch command", so you have to use launch and then make.
Run "lunch" and select an option from the menu. You can find more info about the options here: http://source.android.com/source/building.html. For maguro, you should use "full_maguro-userdebug".
To start the build, use
Code:
make -j$(sysctl -n hw.ncpu)
@ArmanUV. Sounds good & thanks for the input. I'll give the link to macports uninstall a go.
Im a real noob, whats the advantage of compiling from source?
Thanks for the help man !
Hi, thanks for your guide, setting up the repo was no problem at all!
But: I'm getting the following error when building.
Code:
external/zlib/x86/adler32.c: In function ‘adler32_MMX’:
external/zlib/x86/adler32.c:747: error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
external/zlib/x86/adler32.c:747: error: ‘asm’ operand has impossible constraints
make: *** [out/host/darwin-x86/obj/STATIC_LIBRARIES/libz_intermediates/adler32.o] Error 1
make: *** Waiting for unfinished jobs....
Seems to be a problem with the compiler, but I'm on xcode 4.3 and I've installed gcc-4.2 and set the env vars. Any help?
ArmanUV,
Thanks so much for posting this guide. Very helpful!
Are you having any trouble with errors like this?
Code:
external/zlib/x86/adler32.c: In function ‘adler32_MMX’:
external/zlib/x86/adler32.c:747: error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
external/zlib/x86/adler32.c:747: error: ‘asm’ operand has impossible constraints
Googling for this error implies that the fix is to use a version of GCC > 4.2. But there does not seem to be a GCC 4.4 in Homebrew.
Thanks again for the guide!
EDIT: Sorry for the double post with empyyy. Seems like there is someone else having my same issue!
topprospect said:
ArmanUV,
Thanks so much for posting this guide. Very helpful!
Are you having any trouble with errors like this?
Code:
external/zlib/x86/adler32.c: In function ‘adler32_MMX’:
external/zlib/x86/adler32.c:747: error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
external/zlib/x86/adler32.c:747: error: ‘asm’ operand has impossible constraints
Googling for this error implies that the fix is to use a version of GCC > 4.2. But there does not seem to be a GCC 4.4 in Homebrew.
Thanks again for the guide!
EDIT: Sorry for the double post with empyyy. Seems like there is someone else having my same issue!
Click to expand...
Click to collapse
empyyy said:
Hi, thanks for your guide, setting up the repo was no problem at all!
But: I'm getting the following error when building.
Code:
external/zlib/x86/adler32.c: In function ‘adler32_MMX’:
external/zlib/x86/adler32.c:747: error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
external/zlib/x86/adler32.c:747: error: ‘asm’ operand has impossible constraints
make: *** [out/host/darwin-x86/obj/STATIC_LIBRARIES/libz_intermediates/adler32.o] Error 1
make: *** Waiting for unfinished jobs....
Seems to be a problem with the compiler, but I'm on xcode 4.3 and I've installed gcc-4.2 and set the env vars. Any help?
Click to expand...
Click to collapse
You guys seem to have the same issue. What sort of Xcode configuration are you using? Can you post the output from "which gcc","which g++", "gcc -v", "g++ -v" and "cc -v"?
ArmanUV said:
You guys seem to have the same issue. What sort of Xcode configuration are you using? Can you post the output from "which gcc","which g++", "gcc -v", "g++ -v" and "cc -v"?
Click to expand...
Click to collapse
I am on Lion 10.7.4 with Xcode 4.3.2. Here is the output that you asked for:
Code:
# echo -n "which gcc: "; which gcc; echo -n "which g++: "; which g++; echo ""; echo "gcc -v:"; gcc -v; echo ""; echo "g++ -v:"; g++ -v; echo ""; echo "cc -v:"; cc -v
which gcc: /usr/bin/gcc
which g++: /usr/bin/g++
gcc -v:
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)
g++ -v:
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.9~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)
cc -v:
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.3.0
Thread model: posix
They are pointing to LLVM, but my CC and CXX variables point to:
Code:
env|grep 4.2
CXX=/usr/local/bin/g++-4.2
CC=/usr/local/bin/gcc-4.2
Do I need to add something to PATH? I'm sure I just missed something obvious in your instructions.. Thanks for helping!
topprospect said:
I am on Lion 10.7.4 with Xcode 4.3.2. Here is the output that you asked for:
Do I need to add something to PATH? I'm sure I just missed something obvious in your instructions.. Thanks for helping!
Click to expand...
Click to collapse
Everything checks out. I'm away from my main machine so I can't run a test build, but I suspect that a recent change is causing problems.
Now, regarding the compiler, Setting CC/CXX *should* take care of everything, but I am currently not 100% sure that somewhere in a makefile, these environment variables aren't being ignored. Since I wrote the guide, I noticed a lot of clang warnings in the build, which means that CC/CXX is not honored and /usr/bin/cc and /usr/bin/c++ is being used.
A more robust method of making sure gcc-4.2 is being used is creating symlinks to gcc-4.2 and g++-4.2 :
Code:
ln -s /usr/local/bin/gcc-4.2 /usr/local/bin/gcc
ln -s /usr/local/bin/gcc-4.2 /usr/local/bin/cc
ln -s /usr/local/bin/g++-4.2 /usr/local/bin/c++
ln -s /usr/local/bin/g++-4.2 /usr/local/bin/g++
Obviousely, a systemic method like this has its downsides but it may be the only choice without having to change CM code (especially since I lack the knowledge to do so )
[I recently found out that master aosp is no longer using CC/CXX to find the compiler (see ./build/core/combo/). Instead, it uses "gcc" and "g++" directly, which means that llvm-gcc will be used no matter what env variable you have. Fortunately, unlike cm9, master aosp is supposed to build fine with llvm-gcc (except for qemu, which doesn't matter for device images). ]
ArmanUV said:
Everything checks out. I'm away from my main machine so I can't run a test build, but I suspect that a recent change is causing problems.
Now, regarding the compiler, Setting CC/CXX *should* take care of everything, but I am currently not 100% sure that somewhere in a makefile, these environment variables aren't being ignored. Since I wrote the guide, I noticed a lot of clang warnings in the build, which means that CC/CXX is not honored and /usr/bin/cc and /usr/bin/c++ is being used.
A more robust method of making sure gcc-4.2 is being used is creating symlinks to gcc-4.2 and g++-4.2 :
Code:
ln -s /usr/local/bin/gcc-4.2 /usr/local/bin/gcc
ln -s /usr/local/bin/gcc-4.2 /usr/local/bin/cc
ln -s /usr/local/bin/g++-4.2 /usr/local/bin/c++
ln -s /usr/local/bin/g++-4.2 /usr/local/bin/g++
Click to expand...
Click to collapse
Okay, just tried this. I created a new dir (/Volumes/Android/bin) that simply houses those softlinks you recommended. Then I put /Volumes/Android/bin at the beginning of my PATH. That should fix it without breaking the rest of the system, e.g. homebrew.
The GENERAL_REGS problem still exists though. Pretty sure b/c gcc 4.2.1 doesn't understand this construct properly (need a newer version of gcc).
So I backed out the change that introduced this adler32.c.
https://github.com/CyanogenMod/android_external_zlib/commit/13bf40af68236c961542bdee1d4b7c0176bf15a0
The compile is getting farther now. I have to run to work so I'll post later if it succeeds.
The weird thing is: This change was made back in December. Why would it have worked for you?
topprospect said:
The compile is getting farther now. I have to run to work so I'll post later if it succeeds.
Click to expand...
Click to collapse
Build works (and boots!) with the following:
Code:
cd external/zlib
git revert dd6786cae3f4493faa6661d5f74db587932f15d7
git revert 13bf40af68236c961542bdee1d4b7c0176bf15a0
Note the 1st revert is just to avoid massive conflicts seen when reverting the 2nd one by itself. The 2nd revert is the one that really matters here.
So this isn't really a solution.. Seems like we need to move to a newer version of gcc or figure out a patch to adler32.c that makes it gcc 4.2 compatible.
topprospect said:
Build works (and boots!) with the following:
Code:
cd external/zlib
git revert dd6786cae3f4493faa6661d5f74db587932f15d7
git revert 13bf40af68236c961542bdee1d4b7c0176bf15a0
Click to expand...
Click to collapse
The first revert works fine, however the second one gives me the following error:
Code:
$ git revert 13bf40af68236c961542bdee1d4b7c0176bf15a0
error: could not revert 13bf40a... Implement vectorized adler32 and optimized slhash
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
error: Could not parse conflict hunks in zlib.h
empyyy said:
The first revert works fine, however the second one gives me the following error:
Code:
$ git revert 13bf40af68236c961542bdee1d4b7c0176bf15a0
error: could not revert 13bf40a... Implement vectorized adler32 and optimized slhash
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
error: Could not parse conflict hunks in zlib.h
Click to expand...
Click to collapse
Well, run git status. You'll see that the only conflict is in the comments in zlib.h. So, you can just ignore it.
topprospect said:
Okay, just tried this. I created a new dir (/Volumes/Android/bin) that simply houses those softlinks you recommended. Then I put /Volumes/Android/bin at the beginning of my PATH. That should fix it without breaking the rest of the system, e.g. homebrew.
The GENERAL_REGS problem still exists though. Pretty sure b/c gcc 4.2.1 doesn't understand this construct properly (need a newer version of gcc).
So I backed out the change that introduced this adler32.c.
https://github.com/CyanogenMod/android_external_zlib/commit/13bf40af68236c961542bdee1d4b7c0176bf15a0
The compile is getting farther now. I have to run to work so I'll post later if it succeeds.
The weird thing is: This change was made back in December. Why would it have worked for you?
Click to expand...
Click to collapse
topprospect said:
Build works (and boots!) with the following:
Code:
cd external/zlib
git revert dd6786cae3f4493faa6661d5f74db587932f15d7
git revert 13bf40af68236c961542bdee1d4b7c0176bf15a0
Note the 1st revert is just to avoid massive conflicts seen when reverting the 2nd one by itself. The 2nd revert is the one that really matters here.
So this isn't really a solution.. Seems like we need to move to a newer version of gcc or figure out a patch to adler32.c that makes it gcc 4.2 compatible.
Click to expand...
Click to collapse
Nice find. I tried to compile this morning and I ran into the same issue. This is what I don't understand: I did a couple of builds about a week ago without running into this issue. But, the latest commits on zlib are from 2 months ago.
Amazingly, the Xcode 4.3 toolchain (clang and llvm-gcc) builds this external/zlib/adler32.c just fine.
An alternative to this problem is to install an up to date gcc 4.7 :
Code:
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/gcc.rb
and then create symlinks to gcc-4.7/g++-4.7. I have not tested this yet.

Temporary workarounds for Omni

As Omni is in its infancy, there are some rough edges to it. Until those are polished, I'm going to keep a tips/tricks/workarounds thread here.
Root
The most important thing right now is - SuperSU is not yet integrated, and flashing Omni will clobber any existing SuperSU installation.
Backuptool to the rescue! This is the same tool that allows gapps to survive CM/Omni/etc. flashes.
Place the attached file (51-su.sh) into /system/addon.d/ and change its permissions to 755. Once you do this, the core components of SuperSU will survive flashes. I don't back up the APK in this script, as you can install the APK from the Play Store itself as long as the binaries are there and working.
EDIT: grrr, xda isn't allowing .sh files. Here's the content:
Code:
#!/sbin/sh
#
# /system/addon.d/51-su.sh
# During a firmware upgrade, this script backs up /system/xbin/su
# /system is formatted and reinstalled, then the file is restored.
. /tmp/backuptool.functions
list_files() {
cat <<EOF
xbin/su
xbin/daemonsu
etc/init.d/99SuperSUDaemon
EOF
}
case "$1" in
backup)
list_files | while read FILE DUMMY; do
backup_file $S/"$FILE"
done
;;
restore)
list_files | while read FILE REPLACEMENT; do
R=""
[ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
[ -f "$C/$S/$FILE" ] && restore_file $S/"$FILE" "$R"
done
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
# Stub
;;
post-restore)
# Stub
;;
esac
Recovery on Sony devices
SECTION DELETED - TWRP is now working on devices with unified recovery (Sonys and older Samsungs)
Couldn't you zip the sh file and then upload?
Sent From:
Oppo X909/Cm10.1 Or
Gt-i9100/Cm10.1
Hrc4u said:
Couldn't you zip the sh file and then upload?
Sent From:
Oppo X909/Cm10.1 Or
Gt-i9100/Cm10.1
Click to expand...
Click to collapse
didn't have time before leaving this morning.
I hope to make a flashable ZIP this weekend (if it's even still needed at that point...)
Entropy512 said:
didn't have time before leaving this morning.
I hope to make a flashable ZIP this weekend (if it's even still needed at that point...)
Click to expand...
Click to collapse
I think this is the best thread for this question since i'm doing a workaround... I'm compiling the manta kernel inline now. I've forked device_samsung_manta and adjusted the BoardConfig.mk to do this and it works. I got a warning that there was no omni.dependencies file when the build started.
I see this on the gerrit: https://gerrit.omnirom.org/#/c/1816/
Code:
[
{
"repository": "android_kernel_samsung_manta",
"target_path": "kernel/samsung/manta",
"branch": "android-4.3"
}
]
Question 1: if i cherry-pick this as-is, do i need to make any changes to BoardConfig, potentially I don't need to specify TARGET_KERNEL_SOURCE there anymore.
Question 2: if I were to fork the kernel as well, I assume I'd have to adjust the branch to whatever my branch name is but is there a "remote" command I'd have to add to point to my git? Or does this reference the repository in my manifest (which I've already forked).
mrRobinson said:
I think this is the best thread for this question since i'm doing a workaround... I'm compiling the manta kernel inline now. I've forked device_samsung_manta and adjusted the BoardConfig.mk to do this and it works. I got a warning that there was no omni.dependencies file when the build started.
I see this on the gerrit: https://gerrit.omnirom.org/#/c/1816/
Code:
[
{
"repository": "android_kernel_samsung_manta",
"target_path": "kernel/samsung/manta",
"branch": "android-4.3"
}
]
Question 1: if i cherry-pick this as-is, do i need to make any changes to BoardConfig, potentially I don't need to specify TARGET_KERNEL_SOURCE there anymore.
Question 2: if I were to fork the kernel as well, I assume I'd have to adjust the branch to whatever my branch name is but is there a "remote" command I'd have to add to point to my git? Or does this reference the repository in my manifest (which I've already forked).
Click to expand...
Click to collapse
You still need to add TARGET_KERNEL_SOURCE and specify the config.
See my ommit https://gerrit.omnirom.org/#/c/1815/
The config referes to the cyanogenmod config, it gets a booting kernel, but with me the performance options do not work as they should. For the rest its working. You could try the manta_defconfig. That is i quess the aosp kernel config.
Sent from my Nexus 10 using Tapatalk 4
scanno said:
You still need to add TARGET_KERNEL_SOURCE and specify the config.
See my ommit https://gerrit.omnirom.org/#/c/1815/
The config referes to the cyanogenmod config, it gets a booting kernel, but with me the performance options do not work as they should. For the rest its working. You could try the manta_defconfig. That is i quess the aosp kernel config.
Sent from my Nexus 10 using Tapatalk 4
Click to expand...
Click to collapse
Ok so that confirms #1. I did leave target_kernel_source and used the cyanogenmod def config. All works. Just leaves question 2 open.
mrRobinson said:
Ok so that confirms #1. I did leave target_kernel_source and used the cyanogenmod def config. All works. Just leaves question 2 open.
Click to expand...
Click to collapse
If you are using your own repository for the kernel, the best thing g to do is to specify the repository in a local manifest.
The dependency file is just adding an entry in a local repository file.
Sent from my Xperia T using Tapatalk

Firefox OS Porting to Motorola G

I and my friend are trying to port Firefox OS on Motorola G device. Because of our lack of experience in the field, we are stuck. Mozilla's documentation is not that helpful and we don't know at the moment how to continue.
What we did:
- created manifest xml for the device, based on unofficial cyanogenmod for Moto G.
- synced all sources
- added manually prebuilt kernel.
- tried to build everything but it doesn't build, of course, we don't know why.
The error seem to be:
Code:
make: *** No rule to make target `out/target/product/xt1032/obj/SHARED_LIBRARIES/libwpa_client_intermediates/export_includes', needed by `out/target/product/xt1032/obj/SHARED_LIBRARIES/libhardware_legacy_intermediates/import_includes'. Stop.
Welcome to the forums !
coldSense said:
I and my friend are trying to port Firefox OS on Motorola G device. Because of our lack of experience in the field, we are stuck. Mozilla's documentation is not that helpful and we don't know at the moment how to continue.
What we did:
- created manifest xml for the device, based on unofficial cyanogenmod for Moto G.
- synced all sources
- added manually prebuilt kernel.
- tried to build everything but it doesn't build, of course, we don't know why.
The error seem to be:
Code:
make: *** No rule to make target `out/target/product/xt1032/obj/SHARED_LIBRARIES/libwpa_client_intermediates/export_includes', needed by `out/target/product/xt1032/obj/SHARED_LIBRARIES/libhardware_legacy_intermediates/import_includes'. Stop.
Click to expand...
Click to collapse
Now I haven't been on these forums long but I'd like to say congrats on ur first post ! ;0 That error
Code:
make: *** No rule to make target `out/target/product/xt1032/obj/SHARED_LIBRARIES/libwpa_client_intermediates/export_includes', needed by `out/target/product/xt1032/obj/SHARED_LIBRARIES/libhardware_legacy_intermediates/import_includes'. Stop.
means there is no target to build the path. I need more info. What compiler are you using. Or are you just using the command prompt?What's the custom kernel, you could try using CM #2 Unoffical However that'd only work if ur Moto G is currently running android with CWM (to flash the kernel when u build it) Can u link to the mozilla post, I didn't bookmark it and I can be bothered to google it Can u send me what you've done so far pls. Thanks
Or are you just using the command prompt?
Click to expand...
Click to collapse
Yes, I'm using terminal to compile everything. Actually a specialized script for that purpose. Environment versions are:
g++ - 4.6
gcc - 4.6
Actually I'm using this guide .
Yes, I use Clockwork but before that there is building problem. Anyway, the link for porting is this.
The kernel I got is from here.
Admittedly, I know jack **** about android development, but I was under the impression that Firefox OS was based on an ICS kernel? I don't think the CM11 kernel works.
coldSense said:
Yes, I'm using terminal to compile everything. Actually a specialized script for that purpose. Environment versions are:
g++ - 4.6
gcc - 4.6
Actually I'm using this guide .
Yes, I use Clockwork but before that there is building problem. Anyway, the link for porting is this.
The kernel I got is from here.
Click to expand...
Click to collapse
Never seen that error before. Know wat it means tho. Have u tried complieing with Xcode (mac) or another 3rd part app ?
Apph3x said:
Never seen that error before. Know wat it means tho. Have u tried complieing with Xcode (mac) or another 3rd part app ?
Click to expand...
Click to collapse
No. I don't have and don't use mac computers, at least for now. I did this in Linux. It seems that it just doesn't read kernel/ directory or just ignores it.
Yeah
coldSense said:
No. I don't have and don't use mac computers, at least for now. I did this in Linux. It seems that it just doesn't read kernel/ directory or just ignores it.
Click to expand...
Click to collapse
It's like its invisible....
I solved (apparently) that problem by modifying variable TARGET_KERNEL_SOURCE (device/motorola/msm8226-common/BoardConfigCommon.mk) to be absolute path but now I have another error
Code:
make: *** No rule to make target `out/host/linux-x86/bin/acp', needed by `out/debug/host/linux-x86/bin/validatekeymaps'. Stop.
@coldSense
Try this way please
Code:
rm -rf out
rm -rf objdir-gecko
./build.sh gecko
then run
Code:
./build.sh gaia
and copy file from <build_path>/gaia/profile/webapps to <build_path>/out/project/<device_name>/system/b2g/webapps
Then replace all file from out/target/<product>/system to /system of AOSP ROM
then edit ramdisk follow https://developer.mozilla.org/en-US/Firefox_OS/Porting
and flash boot.img and /system you were edit to your Motolola G
Try this way please
Any luck with this? I might try myself, but curious if you can update.
Hi everyone !
I'm currently tryaing to build Firefox OS on own device.
I have this error :
Code:
$ lunch
You're building on Linux
Lunch menu... pick a combo:
1. aosp_arm-eng
2. aosp_x86-eng
3. aosp_mips-eng
4. vbox_x86-eng
5. cm_falcon-userdebug
6. mini_armv7a_neon-userdebug
Which would you like? [aosp_arm-eng] full_falcon
build/core/product_config.mk:222: *** Can not locate config makefile for product "falcon". Arrêt.
** Don't have a product spec for: 'full_falcon'
** Do you have the right repo manifest?
Could someone help me ?
Thanks a lot !
feherneoh said:
try full_falcon instead
Click to expand...
Click to collapse
Code:
$ lunch
You're building on Linux
Lunch menu... pick a combo:
1. aosp_arm-eng
2. aosp_x86-eng
3. aosp_mips-eng
4. vbox_x86-eng
5. cm_falcon-userdebug
6. mini_armv7a_neon-userdebug
Which would you like? [aosp_arm-eng] full_falcon
Invalid lunch combo: full_falcon
OR
Code:
$ ./build.sh full_falcon
including device/motorola/falcon/vendorsetup.sh
including device/generic/armv7-a-neon/vendorsetup.sh
build/core/product_config.mk:222: *** Can not locate config makefile for product "full_flo". Arrêt.
** Don't have a product spec for: 'full_flo'
** Do you have the right repo manifest?
> Build failed! <
Build with |./build.sh -j1| for better messages
If all else fails, use |rm -rf objdir-gecko| to clobber gecko and |rm -rf out| to clobber everything else.
A modification in device/motorola/falcon/vendorsetup.sh maybe ?
UPDATE :
Modifying vendorsetup.sh like this
add_lunch_combo full_falcon-eng
Can somebody explain me how to use a prebuilt kernel to build that please ?
Thank You
I have this error ... (in french)
Code:
No private recovery resources for TARGET_DEVICE falcon
make: *** Pas de règle pour fabriquer la cible « out/target/product/falcon/kernel », nécessaire pour « prebuilt ». Arrêt.
make: *** Attente des tâches non terminées....
h2o64 said:
Can somebody explain me how to use a prebuilt kernel to build that please ?
Thank You
I have this error ... (in french)
Code:
No private recovery resources for TARGET_DEVICE falcon
make: *** Pas de règle pour fabriquer la cible « out/target/product/falcon/kernel », nécessaire pour « prebuilt ». Arrêt.
make: *** Attente des tâches non terminées....
Click to expand...
Click to collapse
You can try to create the folder falcon-kernel inside device/motorola/ and put into it your kernel image.
In device/motorola/(your model) create the file AndroidBoard.mk and put inside:
ifeq ($(TARGET_PREBUILT_KERNEL),)
TARGET_PREBUILT_KERNEL := device/motorola/falcon-kernel/kernel
endif
Than try to rebuild.

Disable forced encryption! Patched version of FED-Patcher by gladiac

The Android CDD (Compatibility Definition Document) suggests that all devices SHOULD enable full disk-encryption (FDE) by default.
This includes ours. The only way to disable encryption on this phone is to patch the kernel, so I modified the @gladiac's FED Patcher to work with our device.
Why would you want to disable encryption?
Better performance
Faster boot
To use DualBootPatcher
Tested on Ressurection Remix ONLY. Make a backup of your boot partition, ESPECIALLY ON MIUI.
INSTRUCTIONS:
Create a TWRP backup of your data
Back up important files from the internal storage, including the backup you just made
Flash the attached zip
FORMAT your data partition (not wipe)
Restore the backup
Copy everything else back.
If this doesn't work, make sure you pressed the "Format data button in TWRP". Try booting without restoring the backup. If it's still not working, try this.
How did I do this?
I looked in the updater script inside the zip file and found this:
Code:
case ${RO_PRODUCT_DEVICE} in
angler)
BOOT_BLKDEV=$(${BUSYBOX} readlink -f /dev/block/platform/soc.0/f9824900.sdhci/by-name/boot)
FSTAB_LIST=fstab.angler
unpack_bootimg_utils_arm64
;;
bullhead)
BOOT_BLKDEV=$(${BUSYBOX} readlink -f /dev/block/platform/soc.0/f9824900.sdhci/by-name/boot)
FSTAB_LIST=fstab.bullhead
unpack_bootimg_utils_arm64
;;
flounder|flounder_lte)
BOOT_BLKDEV=$(${BUSYBOX} readlink -f /dev/block/platform/sdhci-tegra.3/by-name/LNX)
FSTAB_LIST='fstab.flounder fstab.flounder64'
unpack_bootimg_utils_arm64
;;
shamu)
BOOT_BLKDEV=$(${BUSYBOX} readlink -f /dev/block/platform/msm_sdcc.1/by-name/boot)
FSTAB_LIST=fstab.shamu
unpack_bootimg_utils_arm32
;;
*)
ui_print "! This device is not supported!"
exit 1
;;
So I added a natrium switch and added the fstab file name from the ramdisk and the boot partition file, and set it to use the 64-bit bootimg_utils.
Code:
natrium)
BOOT_BLKDEV=$(${BUSYBOX} readlink -f /dev/block/platform/soc/624000.ufshc/by-name/boot)
FSTAB_LIST=fstab.qcom
unpack_bootimg_utils_arm64
;;
Changelog:
19/10/2017: Initial release
Or simply flash SuperSU/Magisk.
khanjui said:
Or simply flash SuperSU/Magisk.
Click to expand...
Click to collapse
Flashing SuperSU/Magisk does not de-encrypt your phone.
EDIT: Hmm, I looked that up and it looks like it's supposed to, but it didn't for me...
theOriginalSuperl2 said:
Flashing SuperSU/Magisk does not de-encrypt your phone.
EDIT: Hmm, I looked that up and it looks like it's supposed to, but it didn't for me...
Click to expand...
Click to collapse
Or you can "re-flash" twrp from bootloader and format the phone.
This will break the encryption and allows you to install your own ROM. >_>
khanjui said:
Or simply flash SuperSU/Magisk.
Click to expand...
Click to collapse
deleted due here totally dead thread and solved by myself!

[GUIDE] Re-locking the bootloader on the OnePlus 8t with a self-signed build of LOS 18.1

What is this tutorial?
This tutorial will:
Creating an unofficial build of LineageOS 18.1 suitable for using to re-lock the bootloader on a OnePlus 8t
Take you through the process of re-locking your bootloader after installing the above
This tutorial will NOT:
Remove *all* warning messages during boot (the yellow "Custom OS" message will be present though the orange "Unlocked bootloader" message will not)
Allow you to use official builds of LineageOS 18.1 on your device with a re-locked bootloader (more details near the end of the tutorial)
This tutorial will assume you are working on an Ubuntu 18.04 installation, if you are using Windows or another Linux distro, the commands may be different.
Supported devices:
The following devices have been tested and confirmed to work:
OnePlus 7 Pro (guacamole)
OnePlus 8t (kebab)
Pixel 4 (flame)
Other OnePlus devices that support AVBv2 (OnePlus 6t and newer as well as most Pixel devices) and LineageOS 18.1 (see current support list over on the LineageOS download page) should work as well.
For simplicities sake, all further references will only be to the 8t (kebab).
Pre-requisites:
a mid level knowledge of terminal commands and features
a supported phone
a PC with enough CPU/RAM to build LineageOS 18.1 (recommended 8 cores, 24g of RAM)
a working USB cable
fastboot/adb installed and functional
LineageOS 18.1 source code downloaded
at least one successful build of LineageOS
at least one successful signing of your build with your own keys
Misc. notes:
the basics of building/signing of LineageOS is outside the scope of this tutorial, refer to the LineageOS Wiki for details on how to complete these tasks
you'll be modifying some code in LineageOS, so if you are not comfortable using basic editing utilities as well as patch, do not proceed any further
the path to your LineageOS source code is going to be assumed to be ~/android/lineageos, if it is somewhere else, substitute the correct path in the tutorial
the path to your private certificate files is going to be assumed to be ~/android-certs, if it is somewhere else, substitute the correct path in the tutorial
*** WARNING ****
This process may brick your device. Do not proceed unless you are comfortable taking this risk.
*** WARNING ****
This process will delete all data on your phone! Do not proceed unless you have backed up your data!
*** WARNING ****
Make sure you have read through this entire process at least once before attempting, if you are uncomfortable with any steps include in this guide, do not continue.
And now on with the show!
Step 1: Basic setup
You need a few places to store things, so create some working directories:
Code:
mkdir ~/android/kebab
mkdir ~/android/kebab/patches
mkdir ~/android/kebab/pkmd
You also need to add "~/android/lineageos/out/host/linux-x86/bin" to your shell's profile path. Make sure to close and restart your session afterwards otherwise the signing will fail later on with a "file not found" error message (this may no longer be required).
Step 2: Update kebab's BoardConfig.mk
You will need to add a few parameters to the end of ~/android/lineageos/device/oneplus/kebab/BoardConfig.mk, they are:
Code:
BOARD_AVB_ALGORITHM := SHA256_RSA2048
BOARD_AVB_KEY_PATH := /home/<userid>/.android-certs/releasekey.key
Note you cannot use "~" in the path names above to signify your home directory, so give the full absolute path to make sure the files are found.
Step 3: Update sm8250-common's BoardConfigCommon.mk
LineageOS by default disables Android Verified Boot's partition verification, but you can enable it now as all the required parts will be in place.
To enable partition verification do the following:
Code:
cd ~/android/lineageos/device/oneplus/sm8250-common
sed -i 's/^BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flags 2/#BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flags 2/' BoardConfigCommon.mk
sed -i 's/^BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --set_hashtree_disabled_flag/#BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --set_hashtree_disabled_flag/' BoardConfigCommon.mk
sed -i 's/^BOARD_AVB_VBMETA_SYSTEM_KEY_PATH := external\/avb\/test\/data\/testkey_rsa2048.pem/BOARD_AVB_KEY_PATH := \/home\/<userid>\/.android-certs\/releasekey.key/' BoardConfigCommon.mk
Don't forget to replace your <userid> in the third sed command above with your current logged in user id.
Step 4: Patch the AOSP and Device Makefile
You also need to patch the Makefile included with AOSP as it will otherwise fail during the build.
The required patch can be found here:
https://raw.githubusercontent.com/Wunderment/build_tasks/master/source/core-Makefile-fix-18.1.patch
Download it and store in ~/android/kebab/patches.
Now apply it with the following command:
Code:
cd ~/android/lineageos/build/core
patch Makefile ~/android/kebab/patches/core-Makefile-fix-18.1.patch
If you would like to know more about this patch, see the additional info at the bottom of this post.
There is also a small addition to the device's common.mk required to enable the OEM unlock option in developers options, do this via the following commands:
Code:
cd ~/android/lineageos/device/oneplus/sm8250-common
sed -i 's/^# OMX/# OEM Unlock reporting\nPRODUCT_DEFAULT_PROPERTY_OVERRIDES += \\\n ro.oem_unlock_supported=1\n\n# OMX/' common.mk
Step 5: Build LineageOS
You are now ready to build:
Code:
cd ~/android/lineageos
breakfast kebab
source build/envsetup.sh
croot
mka target-files-package otatools
Step 6: Sign the APKs
You are now ready to sign the apks with sign_target_files_apks:
Code:
./build/tools/releasetools/sign_target_files_apks -o -d ~/.android-certs $OUT/obj/PACKAGING/target_files_intermediates/*-target_files-*.zip signed-target_files.zip
Step 7: Build the OTA
Now it is time to complete the OTA package:
Code:
./build/tools/releasetools/ota_from_target_files -k ~/.android-certs/releasekey --block signed-target_files.zip lineage-18.1-[date]-UNOFFICIAL-kebab-signed.zip
Note, replace [date] with today's date in YYYYMMDD format.
Step 8: Create pkmd.bin for your phone
Before you can lock your phone, you have to tell it what your public key is so it knows it can trust your build.
To do this you need to create a pkmd.bin file:
Code:
~/android/lineageos/external/avb/avbtool extract_public_key --key ~/.android-certs/releasekey.key --output ~/android/kebab/pkmd/pkmd.bin
Step 9: Flashing your LineageOS build
It's time to flash your build to your phone. The following steps assume you have already unlocked your phone and have flashed an official version of LineageOS to it. You don't need to have flashed LineageOS yet, you could use TWRP through "fastboot boot" if you prefer. Or, if you want to use the recovery that was just created, it is located in ~/android/lineageos/out/target/product/kebab and is called recovery.img.
Reboot your phone in to recovery mode
In LineageOS Recovery return to the main menu and select "Apply update"
From your PC, run:
Code:
adb sideload ~/android/lineageos/lineage-18.1-[date]-UNOFFICIAL-kebab-signed.zip
When the sideload is complete, reboot in to LineageOS. Make sure everything looks good with your build.
You may also need to format your data partition at this time depending on what you had installed on your phone previously.
Step 10: Flashing your signing key
Now it's time to add your signing key to the Android Verified Boot process. To do so, do the following:
Reboot your phone in to fastboot mode
From your PC, run:
Code:
fastboot flash avb_custom_key ~/android/kebab/pkmd/pkmd.bin
fastboot reboot bootloader
fastboot oem lock
On your phone, confirm you want to re-lock and it will reboot
Your phone will then factory reset and then reboot in to LineageOS.
Which of course means you have to go through the first time setup wizard, so do so now.
Step 11: Disable OEM unlock
Congratulations! Your boot loader is now locked, but you can still unlock it again using fastboot, so it's time to disable that as well.
Unlock you phone and go to Settings->About phone
Scroll to the bottom and find "Build number"
Tap on it you enable the developer options
Go to Settings->System->Advanced->Developer options
Disable the "OEM unlocking" slider
Reboot
Step 12: Profit!
Other things
The above will build a standard USERDEBUG version of LineageOS, however this will still allow LineageOS Recovery to sideload non-signed files as well as give you root shell access through ADB. Step 3/4 above protects your system/vendor/boot/dtbo/etc. partitions, but none of the others. Likewise USERDEBUG builds will allow for rolling back to a previous builds/versions of LineageOS. To increase security and disallow both of these scenarios you may want to build a USER version of LineageOS to install. However this brings in other issues, such as flashing newer firmware from OnePlus so make sure you understand the implications of both choices. For more details on build types, see https://source.android.com/setup/develop/new-device#build-variants.
In the above example the releasekey from your LineageOS install has been used to sign AVB, but AVB supports other key strengths up to SHA512_RSA8192. You could create a key just for signing AVB that used different options than the default keys generated to sign LineageOS.
If you want to remove you signing key from your phone, you can do it by running "fastboot erase avb_custom_key".
The changes you made to the AOSP Makefile may conflict with future updates that you pull from LineageOS through repo sync, if you have to reset the file to get repo sync to complete successfully, you'll have to reapply the changes afterwards.
So why can't I do this with official LineageOS builds?
NEW: You can! See this thread for more details.
For Android Verified Boot (AVB) to work, it must have the hash values for each of the system/vendor/boot/dtbo/etc. partitions stored in vbmeta. Official LineageOS builds for kebab do include the vendor.img in them along with everything else that is needed, however that is not true for all phones.
There are two "issues" that stop someone from using the official kebab builds:
LineageOS does not provide a pkmd.bin file to flash to your phone to include the public key in your AVB process (NEW: this thread shows you how to extract the key).
AVB is enabled in the official LineageOS builds but does not validate the hash trees during boot which limits the protection offered.
Ok, what messages do I see during the boot process then?
During a boot you will of course see the standard OnePlus power up screen, followed by the yellow "custom os" message and then the standard LineageOS boot animation.
For more details on AVB boot messages, see https://source.android.com/security/verifiedboot/boot-flow
So what does that patch to the Makefile do?
AOSP's default Makefile makes an assumption that when AVB is enabled, that all the img files will be available well before vbmeta.img is created. This is simply NOT true and AOSP seems to know this as well from the following comment in the Makefile:
Code:
# Not using INSTALLED_VBMETA_SYSTEMIMAGE_TARGET as it won't be set yet.
ifdef BOARD_AVB_VBMETA_SYSTEM
$(eval $(call check-and-set-avb-args,vbmeta_system))
endif
ifdef BOARD_AVB_VBMETA_VENDOR
$(eval $(call check-and-set-avb-args,vbmeta_vendor))
endif
These two calls eventual evaluate to returning the path to the partitions based upon the INSTALLED_*IMAGE_TARGET variable, which isn't created until later in the build process.
Because of this, the command to build vbmeta.img gets corrupted due to the missing make variable being empty and an invalid command line is passed to avbtool near the end of the build.
The corruption happens due to the fact that the following line from the original Makefile:
Code:
--include_descriptors_from_image $(call images-for-partitions,$(1))))))
Gets added to the avbtool call even if "$(call images-for-partitions,$(1))" turns out to be an empty string. Avbtool then throws an error message as it is expecting a parameter after the "--include_descriptors_from_image" flag that is added for the "empty" partition path.
The fix is to call "$(call images-for-partitions,$(1))" earlier, set it to a variable and check to make sure it isn't an empty string before letting the "--include_descriptors_from_image" be added to the avbtool command line to be used later.
This technically generates an incomplete vbmeta.img file during the build process, but since the signing process recreates it from scratch anyway; no harm, no foul.
Thank You's
Obviously to all of the members of the LineageOS team!
LuK1337 for supporting kebab
optimumpro for the OnePlus 5/5t re-locking guide (https://forum.xda-developers.com/oneplus-5/how-to/guide-relock-bootloader-custom-rom-t3849299)which inspired this one
Quark.23 for helping with the process and testing on enchilada for my previous guide (https://forum.xda-developers.com/t/...s-6t-with-a-self-signed-build-of-los.4113743/) with the Oneplus 6/6t and LineageOS 17.1
Is root with magisk possibe with an locked bootloader? Would that require signing the magisk
-patched boot.img or packing magisk into the boot.img at build time?
coloneyescolon said:
Is root with magisk possibe with an locked bootloader? Would that require signing the magisk
-patched boot.img or packing magisk into the boot.img at build time?
Click to expand...
Click to collapse
You would have to include magisk in the build process, if you tried to "patch" the boot image after signing it would fail to boot as it would no longer have the right hash and you'd get the "currupt OS" message.
Is it possible signing the boot image after patching it with magisk?
Hello,
I followed the exact steps, and The build failed for OnePlus 7 Pro (guacamole), with this error:
error: device/oneplus/sm8150-common/fod/Android.bp:16:1: "[email protected]us_msmnile" depends on undefined module "//device/oneplus/
common:[email protected]"
error: device/oneplus/sm8150-common/fod/Android.bp:16:1: "[email protected]us_msmnile" depends on undefined module "//device/oneplus/
common:[email protected]"
16:07:07 soong bootstrap failed with: exit status 1
#### failed to build some targets (10 seconds) ####
ahmed.elsersi said:
Hello,
I followed the exact steps, and The build failed for OnePlus 7 Pro (guacamole), with this error:
error: device/oneplus/sm8150-common/fod/Android.bp:16:1: "[email protected]us_msmnile" depends on undefined module "//device/oneplus/
common:[email protected]"
error: device/oneplus/sm8150-common/fod/Android.bp:16:1: "[email protected]us_msmnile" depends on undefined module "//device/oneplus/
common:[email protected]"
16:07:07 soong bootstrap failed with: exit status 1
#### failed to build some targets (10 seconds) ####
Click to expand...
Click to collapse
That looks like you're missing some of the proprietery blobs, did you verify LineageOS comipled successfully before making any changes? Did you use the extract files script or use the muppets repo?
WhitbyGreg said:
That looks like you're missing some of the proprietery blobs, did you verify LineageOS comipled successfully before making any changes? Did you use the extract files script or use the muppets repo?
Click to expand...
Click to collapse
Hello,
I did extract the proprietary blobs from payload-based.
Do you mean I should compile LinageOS successfully first using:
source build/envsetup.sh
breakfast guacamole
croot
brunch guacamole
before i follow the steps listed here in this guide??
Thank You
ahmed.elsersi said:
Hello,
I did extract the proprietary blobs from payload-based.
Do you mean I should compile LinageOS successfully first using:
source build/envsetup.sh
breakfast guacamole
croot
brunch guacamole
before i follow the steps listed here in this guide??
Thank You
Click to expand...
Click to collapse
Check the extraction script for errors or switch to the muppets, sometimes the extraction script isn't up to date.
In general, yes, make sure you have a version of LineageOS that compiles successfully, that way you know you have a valid base to start from.
Pre-requisites:
at least one successful build of LineageOS
at least one successful signing of your build with your own keys
Click to expand...
Click to collapse
WhitbyGreg said:
Check the extraction script for errors or switch to the muppets, sometimes the extraction script isn't up to date.
In general, yes, make sure you have a version of LineageOS that compiles successfully, that way you know you have a valid base to start from.
Click to expand...
Click to collapse
Thank You so much.
One last question if i may, can these steps applied on LinageOS 4 MicroG using the automated build by their docker image docker-lineage-cicd ?
Thank You
ahmed.elsersi said:
Thank You so much.
One last question if i may, can these steps applied on LinageOS 4 MicroG using the automated build by their docker image docker-lineage-cicd ?
Thank You
Click to expand...
Click to collapse
You'd have to modify the docker image from my understanding as it includes all the source and tools required to do the build.
Hello,
Kindly Please, Could you clarify what do you mean by ~/.android-certs/releasekey.key and ~/.android-certs/releasekey.key/ ??
I created my own signing keys, and the output contains releasekey.pk8 and releasekey.x509.pem, that is why I'm confused.
Note: I did a successful build of LineageOS with OEM unlock support and its option show in development menu and I flashed it to my OnePlus 7 Pro, I used only that option:
cd ~/android/lineageos/device/oneplus/sm8250-common
sed -i 's/^# OMX/# OEM Unlock reporting\nPRODUCT_DEFAULT_PROPERTY_OVERRIDES += \\\n ro.oem_unlock_supported=1\n\n# OMX/' common.mk
Thank You
ahmed.elsersi said:
Hello,
Kindly Please, Could you clarify what do you mean by ~/.android-certs/releasekey.key and ~/.android-certs/releasekey.key/ ??
I created my own signing keys, and the output contains releasekey.pk8 and releasekey.x509.pem, that is why I'm confused.
Click to expand...
Click to collapse
You might need to convert your pk8 in to plain text using openssl like so:
openssl pkcs8 -in releasekey.pk8 -out releasekey.key
Click to expand...
Click to collapse
WhitbyGreg said:
You might need to convert your pk8 in to plain text using openssl like so:
Click to expand...
Click to collapse
Thank You for the help.
I'm sorry, it did not work, that's what i got:
Error reading key
139625476420992:error:0909006C:EM routines:get_name:no start line:../crypto/pem/pem_lib.c:745:Expecting: ENCRYPTED PRIVATE KEY
WhitbyGreg said:
You might need to convert your pk8 in to plain text using openssl like so:
Click to expand...
Click to collapse
I used the releasekey.x509.pem file, it is a PEM certificate text file, the build failed.
Hello,
Kindly please, clarify what is releasekey.key stands for, is it the private key or the public ? Is it data file or text file.
the build fail to the same.
avbtool extract_public_key --key ~/keys/releasekey.x509.pem --output ~/public_key.key
/android/lineageos/out/host/linux-x86/bin/avbtool: Error getting public key: unable to load Public Key
140081520305536:error:0909006C:EM routines:get_name:no start line:../crypto/pem/pem_lib.c:745:Expecting: PUBLIC KEY
avbtool extract_public_key --key ~/keys/releasekey.pk8 --output ~/public_key.key
/android/lineageos/out/host/linux-x86/bin/avbtool: Error getting public key: unable to load Public Key
140477081752960:error:0909006C:EM routines:get_name:no start line:../crypto/pem/pem_lib.c:745:Expecting: PUBLIC KEY
ahmed.elsersi said:
Thank You for the help.
I'm sorry, it did not work, that's what i got:
Error reading key
139625476420992:error:0909006C:EM routines:get_name:no start line:../crypto/pem/pem_lib.c:745:Expecting: ENCRYPTED PRIVATE KEY
Click to expand...
Click to collapse
What commandline did you use exactly?
ahmed.elsersi said:
I used the releasekey.x509.pem file, it is a PEM certificate text file, the build failed.
Click to expand...
Click to collapse
You can't use that.
WhitbyGreg said:
You can't use that.
Click to expand...
Click to collapse
I'm trying to understand, What is releasekey.key file??, it contains private key or public key, or both, and is it a data file or text file??
I did this:
openssl x509 -in releasekey.x509.pem -pubkey -out releasekey.key
The outputfile is a text and contains the public key and the certificate
when i delete the certificate part and start the build, i get this error:
/android/lineageos/out/host/linux-x86/bin/avbtool: Error signing: unable to load Private Key
140394811372928:error:0909006C:EM routines:get_name:no start line:../crypto/pem/pem_lib.c:745:Expecting: ANY PRIVATE KEY
if i delete the public key part, i get this error:
/android/lineageos/out/host/linux-x86/bin/avbtool: Error getting public key: unable to load Public Key
139655441114496:error:0909006C:EM routines:get_name:no start line:../crypto/pem/pem_lib.c:745:Expecting: PUBLIC KEY
if i didn't change anything and used the output file releasekey.key and start the build, i get this error:
/android/lineageos/out/host/linux-x86/bin/avbtool: Error signing: unable to load Private Key
139736685180288:error:0909006C:EM routines:get_name:no start line:../crypto/pem/pem_lib.c:745:Expecting: ANY PRIVATE KEY
I did a successful LineageOS signed build with my own generated keys and flashed on my mobile and working fine.
So, Kindly please, Could you please just tell us, What is this releasekey.key file, and how can we generate this releasekey.key ?
Thank You
ahmed.elsersi said:
when i delete the certificate part and start the build, i get this error:
Click to expand...
Click to collapse
Why did you delete anything?
ahmed.elsersi said:
So, Kindly please, Could you please just tell us, What is this releasekey.key file, and how can we generate this releasekey.key ?
Click to expand...
Click to collapse
releasekey.key is the plaintext private key for the release certificate.
WhitbyGreg said:
Why did you delete anything?
releasekey.key is the plaintext private key for the release certificate.
Click to expand...
Click to collapse
Following the LineageOS signing build steps, these files are generated:
media.pk8, networkstack.pk8, platform.pk8, releasekey.x509.pem, shared.x509.pem, testkey.x509.pem, media.x509.pem , networkstack.x509.pem , platform.x509.pem , releasekey.pk8, shared.pk8, testkey.pk8
I'm sorry, for the last 2 days I'm spinning around myself to figure out how to complete your guide and get a successful build.
Could you please, if you do not mind, just tell me how to generate this releasekey.key plaintext private key for the release certificate?
Your help is highly appreciated, thank you

Categories

Resources