[Q] Modifying stock AOSP - Nexus 7 Q&A, Help & Troubleshooting

I have built AOSP following the Google tutorial.
I am compiling using the master branch and
Code:
aosp_grouper-userdebug
I have downloaded and extracted the appropriate proprietary binaries.
I am modifying two files from the source (see attachments; search for "// MODIFICATION ADDED HERE" to find my changes). Will these changes work? I am using Eclipse, set up in the exact way the tutorial explains, and I did not receive any errors when these changes were made.
When I compile the source using the following commands
Code:
$ . build/envsetup.sh
$ lunch aosp_grouper-userdebug
$ make fastboot adb
and flash it to my device with
Code:
$ fastboot -w flashall
BEFORE my modifications, it works just fine. The android-info.txt file and all the image files are produced properly.
However, AFTER adding the modifications, the build completes with no errors, but android-info.txt and all image files are no longer produced.
Sometimes (but, oddly, not every time) I receive a warning at the end of compilation that says the source has been modified and changes must be submitted for approval before they are official. I don't want to do that, but more importantly, why does this message not appear every time?
Why am I experiencing these problems? What can I do to make it work the way I want? Do I need to create a custom ROM with my changes? If so, how do I accomplish that? Thank you in advance for any help provided.
P.S. YES, I am aware that my modifications are not secure; these are for my own purposes, not for a public build.

Bump.

Related

How to build AOSP for Nexus 7?

I would like to mess with trying to install my own customized ROM's to my Nexus 7, but the first place to probably start is with being able to build AOSP as-is from source.
As I understand currently, building is only supported on Linux and OS X, but I can easily get Ubuntu 10.04 and re-partition my HDD to give it about 100GB (if that much is even needed).
Looking at:
http://source.android.com/source/initializing.html
I need to choose a branch and setup the Linux environment. I'm a bit confused as to what branch I should choose though. I want the latest source of Android available at the time, so I should pick the master branch? Or since I'm only building for the Nexus 7, should I choose it's device-specific branch instead? Although looking at:
http://source.android.com/source/build-numbers.html
the Nexus 7 is only at android-4.1.1_r1.1, but I could of sworn I heard there was r4 out already.
As for setting up the Linux environment, I hope I can just follow all the commands listed there without any problem.
Proceeding on with:
http://source.android.com/source/downloading.html
It looks like a pretty straightforward process that I'm also hoping can be done successfully if I follow the commands exactly as presented. I don't have a proxy nor the need for a local mirror either.
And then moving onto:
http://source.android.com/source/building-devices.html
Some stuff there I find a little bit confusing. It would seem I have to first get proprietary drivers, which all 4 seem to be placed conveniently at:
https://developers.google.com/android/nexus/drivers#grouper
From there, I imagine I can move the script that's bundled inside to the root of the source folder, run it, and follow the instructions. I don't exactly know what the root of the source folder is, but it would probably be obvious once I did start trying to build this. But once I did find it, I would run (using Nvidia's Graphics driver for the example) sh extract-nvidia-grouper.sh in Terminal, and it would place the right files where they need to be.
I don't understand the make clobber part too well at all; should I run this on the very first build, later builds, or all builds?
And once the source and drivers are all downloaded and available, I should then run lunch full_grouper-userdebug and then finally make -j# (# being some number in accordance with how many cores on my CPU I have). I have a triple-core CPU at 3.5Ghz, and I have the ability to unlock to quad-core at 3.3Ghz (but prefer to stay on triple). Should I just run -j32? Also will this build the Kernel as well, or will I have to get the source for that and compile it separately?
And once the build completes, my plan from there was to just go back to Windows and flash it. And if I managed to get it to flash and boot properly, I assume I would of succeeded with compiling AOSP from source
I noticed that userdebug part on full_grouper-userdebug gives "root access and debuggability". Does this mean it comes with some program like Superuser or SuperSU already installed? Or does this mean I can easily install those?
Perhaps after I get comfortable with the basics of flashing AOSP as-is, I can then try to mess with different types of optimizations, like Linaro and perhaps even messing with many types of optimizations from different kernels like faux123 has done .
I also have a 360kb/s DSL connection, so downloading the entire source the first time will probably take a good while. But once I have the source, I take it I don't have to redownload the entire thing for patches and stuff?
Any and all guidance is welcome
Bump before I go for tonight
Bump
You have a bunch of questions. I will answer some. And while I whole-heartedly support learning to build you don't need to build to flash roms.
The best advice I can give you is to just start building. You have found a bunch of instructions and links, obviously. Go ahead and begin, and tackle problems as they arise.
Environment
Okay...really the hardest part is setting upi the environment, if you don' t know linux. After downloading and installing Java and the SDK, make sure you add them to your path.
Most guides will have adding the path in the directions. But make sure to check that it works! It will be extremely frustrating, and you won't know what is wrong. Go to a random directory, Documents would be good, and enter java -version and then adb devices. If the computer says it cannot find the commands, then your path is the problem.
Make sure to setup udev. It is easy, Google it.
Building
Branch
You want to build from the tags.
Code:
repo init -u https://android.googlesource.com/platform/manifest -b android-4.1.1_r4
For the proprietary blobs, whatever directory you repo sync from (~/android/system or whatever) is the root directory. run the extraction from there.
when the proprietary blobs are extracted, and the source has been downloaded, these are your commands.
Code:
. build/envsetup.sh
lunch
Lunch will return a list of devices, Grouper is the Nexus 7, it is number 4. eng and user-debug do have root access, but SU and SuperSU are more than just root, they manage the root access for your apps as well. You can download them from Play or install them as a flashable-zip.
Choose 4 and then
Code:
make otapackage
don't worry about the -j# part. Your machine almost definitley cannot handle -j32. It is -j4 by default, that should be fine for your cpu.
If you want to enable faster builds, you can enter
ENABLE_CCACHE=1
before make otapackage, but it will take up a lot of space on your hd. Your subsequent builds will use some thing from your intial build instead of rebuilding them each time (kernel and other things). So even if you repo sync, some changes won't be reflected in your later builds. For instance, if you do not clean your prebuilts and build system, your build date in the build.prop will always stay the same as the first build.
The way you clear the build directory and make new everything is with make clean or make clobber. You can run it before any build, but the build will take much much longer than one that uses prebuilts. Non-clobbered and with ccache enabled are the fastest of all. But subsequent builds are pretty fast even without ccache.
When you want to update your source, you can just go to your root dir and repo sync. It will only update your source, it won't take nearly as long.
Okay, I answered more than I intended. There are a million guides that show you every step in the process.
Don't ask anymore generic worry questions...you're ready. You understand more than most people do before their first build before I even posted. Get started and if you run into problems, search. If you can't find the answer, then come back and ask us.
Good luck. it is easy, and very satisfying.
I finally got around to installing a Virtual Machine, and Ubuntu 10.04 After doing that, I fully updated Ubuntu, installed VMWare Tools, and then proceeded to start trying to acquire the AOSP source.
Getting sun-java-6 was a bit tricky, but not too hard (I ran the commands exactly as listed on the site, but the package didn't exist; had to get it from somewhere else). After that, I proceeded to do everything else, except CCache (I didn't know what .bashrc was, but I'll look further into this with future AOSP builds).
I then made the folder, did repo sync, and I'm now acquiring the source now from android-4.1.1_r4. As a quick question, does it matter whether I choose to build from android-4.1.1_r4, or master? Would master be more up-to-date?
espionage724 said:
I finally got around to installing a Virtual Machine, and Ubuntu 10.04 After doing that, I fully updated Ubuntu, installed VMWare Tools, and then proceeded to start trying to acquire the AOSP source.
Getting sun-java-6 was a bit tricky, but not too hard (I ran the commands exactly as listed on the site, but the package didn't exist; had to get it from somewhere else). After that, I proceeded to do everything else, except CCache (I didn't know what .bashrc was, but I'll look further into this with future AOSP builds).
I then made the folder, did repo sync, and I'm now acquiring the source now from android-4.1.1_r4. As a quick question, does it matter whether I choose to build from android-4.1.1_r4, or master? Would master be more up-to-date?
Click to expand...
Click to collapse
Sorry for late answer, no, use the r4 branch as it is more up to date. Also, make clobber every time isn't needed but you should as it remove then entire out folder (wich is where compiled stuff go) and this make sure you rebuild a clean thing.
Building CyanogenMod 10
Dunno if this is of any interest, but I have a thread started with a complete walkthrough for building CyanogenMod10 for Nexus 7.
Most of the info is the same, and there are some tips in the comments as well.
espionage724 said:
I would like to mess with trying to install my own customized ROM's to my Nexus 7, but the first place to probably start is with being able to build AOSP as-is from source.
Click to expand...
Click to collapse
So, how did you get on? I've been following the same path I think - repo sync the source and follow Google's own tutorial on compiling Android but with the added step of incorporating the binary drivers for the grouper.
I've built the .img files using make -j8, that all works, fastboot flash worked, but I get no video out when booting up using the new OS. I can ADB into the Nexus and it's certainly booted and working okay apart from, I'm guessing, the missing binary drivers.
I've used each of the 5 binary driver scripts to populate the "vendor" directory in the root of the downloaded source before compiling from scratch, but perhaps I've missed a step, so I'm curious as to whether you've got a fully working AOSP+binary driver compile working.
(By the way, my build environment was Ubuntu 12.04 64bit, SDK r20.0.3, Android 4.1.1 (JRO03R) source, Sun Java 1.6, and it all seems to work well using 8 threads on a Core i5 2500K + 4GB RAM).
Edit:
I re-ran the binary extraction, did a make clean; make clobber, and re-compiled - and now video works. Everything works now apart from the compass, camera and rotation sensor. I also tried compiling CyanogenMod from source, too, and had the exact same three problems. Everything works, and works well, apart from camera, compass and rotation sensor. All of which work in the stock Google ROM. Weird.
OK, So I've just compiled an OTA update package from AOSP source... my question is this:
I already have unlocked the bootloader on my wife's Nexus 7, installed Clockworkmod, rooted it, installed busybox, etc, manually on the stock 4.2 update I downloaded from Google on the device when it asked me to upgrade.
Is the otapackage I just compiled going to replace my custom recovery if I flash it as is? I've looked, and it has a "recovery" folder in the .zip, whereas any of the custom ROMs I have downloaded for my phone do not. Do I simply delete this recovery folder, and flash away? Do I need to edit the updater-script? I'm still trying to read and learn about this, but I haven't gotten a good answer from google or searching this site for my specific problem... maybe I'm wording my searches incorrectly.
I would just rather not have to go back and reinstall Clockworkmod... I know that if I want to have busybox, SuperSU, and other apps installed when I flash I'm going to have to add them to the zip and resign... I just don't want to mess my recovery. And being that this is my wife's tab (and not mine to play with, as she pointed out ) I don't want her to get the impression that I'm having to "fix" something I "broke" lol.
hallowed.mh said:
OK, So I've just compiled an OTA update package from AOSP source... my question is this:
I already have unlocked the bootloader on my wife's Nexus 7, installed Clockworkmod, rooted it, installed busybox, etc, manually on the stock 4.2 update I downloaded from Google on the device when it asked me to upgrade.
Is the otapackage I just compiled going to replace my custom recovery if I flash it as is? I've looked, and it has a "recovery" folder in the .zip, whereas any of the custom ROMs I have downloaded for my phone do not. Do I simply delete this recovery folder, and flash away? Do I need to edit the updater-script? I'm still trying to read and learn about this, but I haven't gotten a good answer from google or searching this site for my specific problem... maybe I'm wording my searches incorrectly.
I would just rather not have to go back and reinstall Clockworkmod... I know that if I want to have busybox, SuperSU, and other apps installed when I flash I'm going to have to add them to the zip and resign... I just don't want to mess my recovery. And being that this is my wife's tab (and not mine to play with, as she pointed out ) I don't want her to get the impression that I'm having to "fix" something I "broke" lol.
Click to expand...
Click to collapse
Sorry if a bit late, but here are some answers:
yes, the rom will replace your recovery. but if you delete the recovery folder and delete every line containing the word "recovery" in the updater-script, you should be good to go.
And if you accidentally remove the recovery, you can always flash it back very easily using: "fastboot flash recovery [filename.img]" (your n7 has to be in the bootloader)
And again, yes, you will have to put the extra apps into the zip and update the updater-script to install them too.
Also, you will need the gapps package if you want to use the play store and other google apps.
Hope this helped
Nexus 7 3G does not boot after flashing AOSP
Hi,
I followed the steps provided on source.android.com to build and flash the AOSP for Nexus 7 3G Tilapia. After successful flash, the device does not show anything after Google logo. Please help me out.
Thanks,
Veeren
Compile with ccache makes build time extremely fast.
How to do:
_Open a terminal
_Install ccache:
sudo apt-get install ccache
_Open .bashrc:
sudo gedit ~/.bashrc
_Add these lines:
#ccache
export USE_CCACHE=1
_Save and exit
_Sync source code
_After source synced, run in same terminal (in root directory of your source):
prebuilts/misc/linux-x86/ccache/ccache -M 20G (20G is the size in giga of space allocated for ccache, change it as you want)
_Start building
How to see if ccache works:
_Open another terminal in the root directory of your source and type:
watch -n1 -d prebuilts/misc/linux-x86/ccache/ccache -s
First build using ccache may be a little much longer but the others will be faster...
veerndra said:
Hi,
I followed the steps provided on source.android.com to build and flash the AOSP for Nexus 7 3G Tilapia. After successful flash, the device does not show anything after Google logo. Please help me out.
Thanks,
Veeren
Click to expand...
Click to collapse
Did you pull the proprietary files for your nexus and include them in the build? I believe things like your video drivers are included in there, so if those are missing....
I think the prop files are available for download from Google on source.android.com... If not, they tell you how to use an included script to pull them via adb. I can't remember... It's been a while since I built vanilla AOSP.
Sent from my Inspire 4G using xda app-developers app
Modifying stock AOSP
I have built AOSP following the Google tutorial.
I am compiling using the master branch and
Code:
aosp_grouper-userdebug
.
I have downloaded and extracted the appropriate proprietary binaries.
I am modifying two files in the source tree (see attachments; search for "// MODIFICATION ADDED HERE" to find my changes). Will these changes work? I am using Eclipse, set up in the exact way the tutorial explains, and I am not receiving any new errors.
When I compile the source using the following commands
Code:
$ . build/envsetup.sh
$ lunch aosp_grouper-userdebug
$ make fastboot adb
and flash it to my device with
Code:
$ fastboot -w flashall
BEFORE my modifications, it works just fine. The android-info.txt file and all the image files are produced properly.
However, AFTER adding the modifications, the build completes with no errors, but android-info.txt and all image files are no longer produced.
Why am I experiencing these problems? What can I do to make it work the way I want?
P.S. YES, I am aware that my modifications are not secure; these are for my own purposes, not for a public build.

[TOOL] Multiple BLOB retreiver

So, I just built a CM11 for my XT1022 based on @JackpotClavin trees. I found a difficulty in setting up RIL (although Bluetooth was working fine).
I thought maybe, the vendor blobs were a mismatch and they need to be replaced by the stock KK4.4.4 ones.
I found a proprietary-blobs.txt in the vendor directory( again thanks to @JackpotClavin) but the problem was the files list was huge and it would be insane to manually fetch those files
Hence, I wrote a small python script to fetch the vendor blobs from my phone recursively.
The only changes you need to make on the script is to change the paths of proprietary-blobs.txt (path_list variable) and the *croot* path (croot_path variable).
I hope in this way, I am a little helpful to my fellow members in this community
The code:
Code:
#!/usr/bin/python3
#don't forget to put the / at the beginning and the end
path_list="<modify-the-path-to-proprietary-blobs.txt>"
croot_path="<specify croot_path"
try:
f=open(path_list,"r")
except(FileNotFoundError):
print("Invalid file path")
sys.exit(1)
finally:
count=0
a=f.readlines()
for x in a:
count=count+1
b=os.system("adb pull "+a[0].replace("\n","")+" "+croot_path+os.path.split(x)[0].replace("\n",""))
print(b)
print("Job done!")
print("Total files to retreive: "+len(a))
print("No. of retreived files: "+count)
print("Goodbye!")
sys.exit(0)

[HOW-TO] Building TWRP from source with goodies

I decided to put together a guide on how to build TWRP from source, having successfully built it myself and restored a few of the goodies that disappeared in the 3.3.1-0 release (e.g. install kernel). Also, marlin (Pixel XL) has had a few advancements over sailfish (Pixel), so this is a way to get back on par even if unofficially.
Whilst I'll go into a good level of detail, this will not be a hand-holding guide. You are expected to be able to use the Linux command line, and tools such as Git and repo.
Download sources
This guide is based upon building from the Minimal TWRP sources, which are based upon a subset of Omnirom. At the time of writing, the latest branch is twrp-9.0 (Pie). (If you are reading this some months after I have written this guide, check for later branches.) Follow this link for the repo, and the instructions:
https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni/tree/twrp-9.0
Firstly, create a folder to put this in, e.g. $HOME/twrp-minimal-omni, and change to that directory. Then execute the following for a shallow clone (to save space...):
Code:
repo init --depth=1 -u git://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git -b twrp-9.0
Before doing the repo sync, we will need a few extra repositories to be downloaded. Create a subfolder .repo/local_manifests and create an XML file (e.g. custom.xml) with the following content:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="android_device_google_marlin" path="device/google/marlin" remote="TeamWin" revision="android-9.0" />
<project path="hardware/qcom/bootctrl" name="platform/hardware/qcom/bootctrl" groups="pdk-qcom" remote="aosp" />
<project path="hardware/qcom/msm8998" name="platform/hardware/qcom/msm8998" groups="qcom_msm8998,pdk-qcom" remote="aosp" />
</manifest>
android_device_google_marlin - contains the configuration and build instructions for marlin and sailfish
hardware/qcom/bootctrl - this is part of AOSP, and is required for building TWRP
hardware/qcom/msm8998 - extra chipset stuff that is required for marlin/sailfish
You can do a repo sync now to download the sources.
Additionally, we will need some driver binaries that are available from Google. Get the Google (Qcom is not necessary) drivers for the latest Pie release here:
https://developers.google.com/android/drivers#sailfishpq3a.190801.002
Extract the files into the same folder as you created, and execute e.g as follows, and follow the prompts:
Code:
./extract-google_devices-sailfish.sh
The binaries will be extracted into a vendor/google-devices/ sub-folder. Do not rename the sub-folder - the configuration looks for exactly this path.
You now have all of the source files needed.
Do the build
We then more-or-less follow the instructions as per the original minimal manifest page:
Code:
export ALLOW_MISSING_DEPENDENCIES=true
. build/envsetup.sh
lunch omni_sailfish-eng
mka bootimage
The boot image will be created at out/target/product/sailfish/boot.img.
Use fastboot boot out/target/product/sailfish/boot.img to test it in fastboot mode on your device.
Hope this helps someone out there!
XDA:DevDB Information
Building TWRP for Sailfish, Tool/Utility for the Google Pixel
Contributors
NZedPred
Version Information
Status: Stable
Created 2020-01-03
Last Updated 2020-04-26
Downloads
Occasionally I will make available one of my builds. They will be in the folders below.
Please note the following:
You are always encouraged to use the official versions of TWRP instead of these
I am not liable for anything that goes wrong as a consequence of using them
As a general rule, I will not be fixing bugs or adding features to these builds (other than enabling features that already are in the code) - they are built straight from the TWRP sources
Google Pixel (Sailfish) Unofficial TWRP
Google Pixel (Marlin) XL Unofficial TWRP
GPL compliance
The downloads in this folder use pre-compiled Linux kernels. The source for these can be found here (thanks to @razorloves for pointing out the correct URL):
[URL="https://github.com/bigbiff/android_kernel_google_marlin/commits/lineage-16.0[/URL]
Refer to the tags/branches prefixed with "android-msm-marlin-".
Log
20200301 - Added version "3.3.1-4-experimental-multi-user-decrypt" for Sailfish and Marlin, ability to decrypt data for multiple users. Refer to the advanced menu.
20200223 - Added version string "3.3.1-3-unofficial-nzedpred" for Sailfish, very minor updates from TWRP
20200115 - Added a build of OrangeFox Recovery for Sailfish
20200105 - Added f2fs support (consider the f2fs option to be experimental, and it may not even work)
20200104 - Initial version for sailfish with feature parity with marlin
Building other recoveries - Orangefox
Orangefox
Quick guide for the impatient
Create a folder that will be your OrangeFox folder, and change into it. All commands below will be relative to this folder.
Code:
# Initialize the repo
repo init --depth=1 -u https://gitlab.com/OrangeFox/Manifest.git -b fox_9.0
# Create local manifests folder
mkdir .repo/local_manifests
# Create the local manifest for sailfish/marlin - use gedit, kate, leafpad, whatever your text editor is
gedit .repo/local_manifests/orangefox-marlin.xml
After the last command, the text editor window will open. Paste the following content into it.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="TeamWin" fetch="https://github.com/TeamWin" review="https://gerrit.twrp.me" />
<project name="external_magisk-prebuilt" path="external/magisk-prebuilt" remote="TeamWin" revision="master" />
<project name="android_device_google_marlin" path="device/google/marlin" remote="TeamWin" revision="android-9.0" />
<project path="hardware/qcom/bootctrl" name="platform/hardware/qcom/bootctrl" groups="pdk-qcom" remote="aosp" />
<project path="hardware/qcom/msm8998" name="platform/hardware/qcom/msm8998" groups="qcom_msm8998,pdk-qcom" remote="aosp" />
</manifest>
Then save and close the editor, and continue with the following commands.
Code:
# Sync the repos
repo sync -j8
Additionally, we will need some driver binaries that are available from Google. Get the Google (Qcom aren't necessary) drivers for the latest Pie release here:
https://developers.google.com/android/drivers#sailfishpq3a.190801.002
Extract the files into the same folder as you created, and execute as follows, and follow the prompts:
Code:
./extract-google_devices-sailfish.sh
The binaries will be extracted into a vendor/google-devices/ sub-folder. Do not rename the sub-folder - the configuration looks for exactly this path.
You now have all of the source files needed.
At the time of writing, there is a bug that prevents the FB2PNG module building (I think this is FrameBuffer2PNG - screenshots). Edit the file as below
Code:
# Edit sailfish config
gedit device/google/marlin/sailfish/BoardConfig.mk
# Edit marlin config
gedit device/google/marlin/marlin/BoardConfig.mk
Around line 204, change
Code:
TW_INCLUDE_FB2PNG := [U]true[/U]
to
Code:
TW_INCLUDE_FB2PNG := [U]false[/U]
Now continue to build as normal
Code:
. build/envsetup.sh
export ALLOW_MISSING_DEPENDENCIES=true
# For building sailfish use this line
lunch omni_sailfish-eng
# For building marlin use this line
lunch omni_marlin-eng
mka bootimage
NOTE: If you are building for sailfish, don't run the lunch omni_marlin-eng line. Also, you may get an error "Your device can't be found in device sources..". That's actually OK, it's just because there isn't a folder called device/google/sailfish. If the error bothers you, just create the folder and re-run the lunch command (and ignore the warning about device/google/sailfish/omni.dependencies file not found).
This will create a fastboot bootable image in the $OUT folder called boot.img. You can try booting it with your device in fastboot mode:
Code:
fastboot boot $OUT/boot.img
There are also a number of environment variables that OrangeFox has available. I haven't really tested whether or not they are necessary. Will update this post after I do some investigation.
Could you make twrp for marlin with support F2FS? I did but unsuccesed.
chuate92 said:
Could you make twrp for marlin with support F2FS? I did but unsuccesed.
Click to expand...
Click to collapse
You will need to add a flag to the device/google/marlin/marlin/BoardConfig.mk file:
Code:
TARGET_USERIMAGES_USE_F2FS := true
Additionally, the kernel needs to support f2fs. No idea if the one that comes with the repos supports it, but you could always grab one from a kernel that does and try that.
I'll try doing a build later on, but you will have to test at your own risk.
NZedPred said:
You will need to add a flag to the device/google/marlin/marlin/BoardConfig.mk file:
Code:
TARGET_USERIMAGES_USE_F2FS := true
Additionally, the kernel needs to support f2fs. No idea if the one that comes with the repos supports it, but you could always grab one from a kernel that does and try that.
I'll try doing a build later on, but you will have to test at your own risk.
Click to expand...
Click to collapse
I followed your guide but, I didn't know how to do "Create a subfolder .repo/local_manifests and create an XML file (e.g. custom.xml) with the following content:". So I downloaded manual. Then I do build recoveryimage, I still got error them same I posted here https://forum.xda-developers.com/showthread.php?p=81384609#post81384609.
I didn't know why.
chuate92 said:
I followed your guide but, I didn't know how to do "Create a subfolder .repo/local_manifests and create an XML file (e.g. custom.xml) with the following content:". So I downloaded manual. Then I do build recoveryimage, I still got error them same I posted here https://forum.xda-developers.com/showthread.php?p=81384609#post81384609.
I didn't know why.
Click to expand...
Click to collapse
For the above, using the command line, from the folder you originally created you do this:
Code:
mkdir .repo/local_manifests
gedit .repo/local_manifests/custom.xml
If you don't have gedit, use e.g. kate, or whatever other text editor you have.
Also, you don't build a recovery image - you build a boot image.
Code:
mka bootimage
Anyway, I've updated the second post with a folder for Google Pixel XL as well. I'll upload there later (once AFH sorts itself out - I can't upload anything into the new folder yet).
For now, try using the build here (at your own risk):
https://www.dropbox.com/s/gvkvhklmu2fh0tx/twrp-marlin-unofficial-20200105.img?dl=0
tried this unofficial twrp for sailfish. it boots just fine as temporary recovery, when trying to install into ramDisk it acts as the official image, too large to fit the ramDisk
wizardwiz said:
tried this unofficial twrp for sailfish. it boots just fine as temporary recovery, when trying to install into ramDisk it acts as the official image, too large to fit the ramDisk
Click to expand...
Click to collapse
Yes, TWRP is now getting quite big and a lot of features would have to be removed to get it to fit into the ramdisk. This is something I've been spending some time on, but it seems to be a difficult ask at this point. I'll post if I ever get there...
I'm having some trouble with your guide. I am trying to compile not TWRP but orangefox recovery. I have the files and I will link them below. If you could either walk me through building orangefox or building it yourself, that would be amazing. I have a sailfish.
Link: https://gitlab.com/OrangeFox/Recovery
Spookybear said:
I'm having some trouble with your guide. I am trying to compile not TWRP but orangefox recovery. I have the files and I will link them below. If you could either walk me through building orangefox or building it yourself, that would be amazing. I have a sailfish.
Link: https://gitlab.com/OrangeFox/Recovery
Click to expand...
Click to collapse
I've had a look at this, and I don't think it's as straight forward as merely dropping in in the TWRP sailfish device tree and building. It reports success when building, but it hasn't actually built anything...
I'd suggest you go to their Telegram chat for building OrangeFox: https://t.me/OrangeFoxBuilding
@Spookybear - I managed to do a build. If you want to test (at your own risk!) you can get it here:
https://www.androidfilehost.com/?fid=4349826312261701399
@Spookybear - I managed to do a build. If you want to test (at your own risk!) you can get it here:
https://www.androidfilehost.com/?fid=4349826312261701399
NZedPred said:
@Spookybear - I managed to do a build. If you want to test (at your own risk!) you can get it here:
https://www.androidfilehost.com/?fid=4349826312261701399
Click to expand...
Click to collapse
Can you send me the zip file of your build environment, I'm getting ninja error 1. Thank you.
NZedPred said:
@Spookybear - I managed to do a build. If you want to test (at your own risk!) you can get it here:
https://www.androidfilehost.com/?fid=4349826312261701399
Click to expand...
Click to collapse
tested it. Working just fine. to bad it is based on twrp 3.3.1 (naturally) and therefor still to large to fit the RamDisk.
wizardwiz said:
tested it. Working just fine. to bad it is based on twrp 3.3.1 (naturally) and therefor still to large to fit the RamDisk.
Click to expand...
Click to collapse
I meant that you could compress your /scripts folder and so I could try to build different versions for when it gets updated or when I need to fix a bug.
Thank you
Spookybear said:
I meant that you could compress your /scripts folder and so I could try to build different versions for when it gets updated or when I need to fix a bug.
Thank you
Click to expand...
Click to collapse
I'll add a guide into the third post of this thread for it. It's a bit much trying to compress some 40GB of files. Best you use the guide and try to work out where things went wrong. Will update once its up.
Quick and dirty guide to compiling OrangeFox now up
NZedPred said:
I'll add a guide into the third post of this thread for it. It's a bit much trying to compress some 40GB of files. Best you use the guide and try to work out where things went wrong. Will update once its up.
Quick and dirty guide to compiling OrangeFox now up
Click to expand...
Click to collapse
Thank you, I will work on this later.
NZedPred said:
I'll add a guide into the third post of this thread for it. It's a bit much trying to compress some 40GB of files. Best you use the guide and try to work out where things went wrong. Will update once its up.
Quick and dirty guide to compiling OrangeFox now up
Click to expand...
Click to collapse
Thank you, it worked.
Is it possible to merge this patch into your build? It should fix the issue when doing multi-user backup. Thanks.
https://gerrit.omnirom.org/c/android_bootable_recovery/+/33944

[GUIDE] Porting Kernel Source to Snapdragon Device

Some OEMs violating GPL licenses and won't publish linux kernel sources for their Android devices.
On this post I’ll explain how to port kernel source to any android device.
Maybe you can port kernel sources to other SoCs with similiar ways but I've explained qcom way.
What do we need ?
A Computer which has Linux or Mac installation.
Device to test.
Let’s Start, Shall we ?
First of all we need to take dmesg of stock kernel using adb shell dmesg > dmesg.txt command. (I recommend you to take it while device is booting)
You got dmesg ? Nice. Open it with any text editor and search for “hardware” or “machine” and note the result to somewhere. By doing this we’ll get the name of device-tree-blobs.
Download android image kitchen and extract it to somewhere.
Now hold and move your device’s stock boot.img to unpackimg.(bat/sh)
Now your stock kernel got extracted to split_img/boot.img-zImage. After this line I will referance this file as “stock kernel”
Fetch split-appended-dtb using git clone https://github.com/MacTavishAO/split-appended-dtb-mac command. We’ll use this tool to extract dtb from stock kernel.
Copy stock kernel to split-appended-dtb-mac folder.
Now we will extract dtb(device-tree-blobs) from stock kernel. If you are on Linux use ./split-appended-dtb boot.img-zImage command for Mac use ./split-appended-dtb-mac boot.img-zImage command.
Now we have bunch of files named dtbdump_xx.dtb. We have to find out which one our device uses. Use grep -r <machine name that we found at step 2> . to find out which dtb our device using. (Write different parts of machine name to find out)
Install dtc using apt install device-tree-compiler command.
Let’s say it turns out dtbdump_21.dtb is the right one. We have to decompile dtb file to dts using dtc -I dtb -O dts -o extracted.dts dtbdump_21.dtb command.
Now we have to extract defconfig from stock kernel.
Use wget https://github.com/torvalds/linux/raw/master/scripts/extract-ikconfig && chmod a+x extract-ikconfig command to download necessary tool.
Use ./extract-ikconfig boot.img-zImage > extracted_defconfig to get defconfig from stock kernel.
Now we got what we need, we need to download kernel source to start porting to our device.
After this point I’ll start to explain as porting to Qualcomm device but almost same on other system-on-chips.
Go to Settings -> About Phone -> and note “Kernel version”
We need to download soc manufacturer’s sources. From here find msm-X.X that matching with your phone and copy link of it.
And from here find tag matching your chipset and write it down somewhere.
Use git clone <sources from 2 steps up> -b <tag>
Now enter to msm-X.X folder.
Copy extracted_defconfig to arch/<your device's architecture>/configs/ folder.
If your device is arm64 copy extracted.dts to arch/arm64/boot/dts/qcom/ if this directory doesn’t exist copy to arch/arm/boot/dts/qcom/ folder. (If you have 3.x qcom device skip the arm64 part and copy it directly into arm)
Open “Makefile” file in arch/arm(64)/boot/dts/qcom/ and add extracted.dts to the line matching with your chipset.
It’s time to import drivers. After this step I cannot help you because every devices’ hardware isn’t same but I can give some tactics.
To get driver names you can read dts file or install any device info app from Google Play Store etc.
Search these names and GitHub you can find files and commits which will help you to add drivers.
You did all of these without my help ? Excellent! Now it’s time to build kernel. I suggest you to use @natchanchance 's kernel compilation guide.
After compiling kernel. Copy compiled kernel to split_img folder which mentioned at early of this tutorial. rename it to boot.img-zImage and double click repackimg.(bat.sh) and you have new file named image-new.img.
Boot it using fastboot boot image-new.img command and if everything is working you can use fastboot flash boot image-new.img to use it permanently.
Leave a comment here about your questions. I'll try to reply all of them.
Planned to make a guide video about it but I don't have much time. Keep checking this thread may I post soon.
Reserved
Reserved.
Reserved
Thanks Dude!
This is very useful guide especially fir those who want to port the kernel source.
Thanks man. I am following your guide.
Thanks ?
While looking for matching dtbdump file I got a match in all four files for PMI8996, which file should I use?
"We have to decompile dtb file to dts using dtc" stuck at this step.
Any help on which "App" to use to find driver names..
Thanks
CPUZ / AIDA64
ataberkozen said:
It’s time to import drivers. After this step I cannot help you because every devices’ hardware isn’t same but I can give some tactics.
To get driver names you can read dts file or install any device info app from Google Play Store etc.
Search these names and GitHub you can find files and commits which will help you to add drivers.
Click to expand...
Click to collapse
I've found another way to find hardware info using hwinfo tool inside termux. The trick is to use it with root permissions.
Install hwinfo in termux:
Code:
apt-get install hwinfo
Run it with root permission tee into a text file:
Code:
su -c $(which hwinfo) | tee hwinfo.txt

[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