Build kernel from source - HTC One X+

I was trying to build Kernel from original HTC Source. My rom on phone has version 2.18.401.3, but the original HTC kernel source (enru-3.1.10-g7f360be.zip) with this version did not build, because it contains only hox (endeavour) "in arch\arm\mach-tegra" not HOX+ (enrc2b). I was using the extracted config from my device. The HTC kernel source with the biggest number (2.18.1136.2, enrc2b-3.1.10-42105bd.zip) builds properly but the merged boot.img did not boot. I checked with other boot.img from HOX+ i.e. from cyanogenmod (unpack, repack) whether I generate a correct one, but it was binary same. So I believe the zImage has some defect. Please help.

Trivalik said:
I was trying to build Kernel from original HTC Source. My rom on phone has version 2.18.401.3, but the original HTC kernel source (enru-3.1.10-g7f360be.zip) with this version did not build, because it contains only hox (endeavour) "in arch\arm\mach-tegra" not HOX+ (enrc2b). I was using the extracted config from my device. The HTC kernel source with the biggest number (2.18.1136.2, enrc2b-3.1.10-42105bd.zip) builds properly but the merged boot.img did not boot. I checked with other boot.img from HOX+ i.e. from cyanogenmod (unpack, repack) whether I generate a correct one, but it was binary same. So I believe the zImage has some defect. Please help.
Click to expand...
Click to collapse
use this, I kept it in tact for this reason :
https://github.com/Lloir/htc_kernel_oxp/tree/master
It's the source straight from htc
you'll also need this commit https://github.com/Lloir/htc_kernel_oxp/commit/b3cade38f9d17682778ea767722d20b94696f6ae which has the defconfig unless you already have it.
Enjoy

Lloir said:
use this, I kept it in tact for this reason :
https://github.com/Lloir/htc_kernel_oxp/tree/master
It's the source straight from htc
you'll also need this commit https://github.com/Lloir/htc_kernel_oxp/commit/b3cade38f9d17682778ea767722d20b94696f6ae which has the defconfig unless you already have it.
Enjoy
Click to expand...
Click to collapse
I tried the master branch, but it make boot loop all the time. Another test would be, if you can provide me a boot.img what I can test.

I found the solution, is for me a little bit strange but it works. In case somebody can show me the big difference that I can understand the "why", whould be fine.
I used for build this toolchain: prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin stored: git clone --depth=1 https://android.googlesource.com/platform/prebuilt
before I was using arm-eabi-4.8/bin/ from master branch(not sure about git clone path)
There is now one point I did not understand, I build original source, why is then my SIM not working? (no question for pin), (Answer: Maybe are the orignal modules signed. After change the modules on /system/lib/modules/ it was working like before), because after flashing the android revolution boot.img, it was all working. Any ideas? (Answer: It is because they didn't change th zImage)

Related

[Q] Compiling the newly released p500 gingerbread source code?

I want to try and compile the oficial gb sources, mainly out of curiosity, but I would love having some clues on how to achieve it.
I'm a coder myself, but I don't know **** about android development. I guess I have to start by installing android sdk but then what? Any hints? A link to a begginer's guide or something would be great.
Sure I can find this info on google (starting the research right now) but maybe you guys can point me into the right direction.
Edit: I've found basic build instructions right inside the ZIP file containing the sources:
Code:
1. Android buid
- Download original android source code (gingerbread) from http://source.android.com
- Untar opensource packages of p500_gb_open_source.tar.gz into downloaded android source directory
- And, merge the source into the android source code(gingerbread)
- Run following scripts to build android
a) . build/envsetup.sh
b) make -j4
- When you compile the android source code, you have to add google original prebuilt source(toolchain)
into the android folder
( add prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin to PATH )
- After build, you can find output at out/target/product/generic
2. Kernel Build
- When you compile the kernel source code, you have to add google original prebuilt source(toolchain)
into the android folder.
( Add prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin to PATH
ex) export PATH=$PATH:$HOME/gb_original/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin )
- Untar using following command at the android folder
tar zxvf kernel.tar.gz
- cd Kernel
- make thunderg-perf_defconfig
- make zImage -j4
3. After Build, You Can find the build image at arch/arm/boot
4. Compile environment
- gcc 4.4.1
- Ubuntu 10.10
- Java 1.6.0_22
I'll continue researching and will post any finds and my progress here if there's anyone interested. Meanwhile you can contribute with anything you can and by the end we may have a good tutorial out of it.
Look at first post from Andy's Gingerbread, he describes what you need.
No need to install Android SDK.
I take sources from codeaurora, merge with LG-source.
drakull said:
I want to try and compile the oficial gb sources, mainly out of curiosity, but I would love having some clues on how to achieve it.
I'm a coder myself, but I don't know **** about android development. I guess I have to start by installing android sdk but then what? Any hints? A link to a begginer's guide or something would be great.
Sure I can find this info on google (starting the research right now) but maybe you guys can point me into the right direction.
Edit: I've found basic build instructions right inside the ZIP file containing the sources:
Code:
1. Android buid
- Download original android source code (gingerbread) from http://source.android.com
- Untar opensource packages of p500_gb_open_source.tar.gz into downloaded android source directory
- And, merge the source into the android source code(gingerbread)
- Run following scripts to build android
a) . build/envsetup.sh
b) make -j4
- When you compile the android source code, you have to add google original prebuilt source(toolchain)
into the android folder
( add prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin to PATH )
- After build, you can find output at out/target/product/generic
2. Kernel Build
- When you compile the kernel source code, you have to add google original prebuilt source(toolchain)
into the android folder.
( Add prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin to PATH
ex) export PATH=$PATH:$HOME/gb_original/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin )
- Untar using following command at the android folder
tar zxvf kernel.tar.gz
- cd Kernel
- make thunderg-perf_defconfig
- make zImage -j4
3. After Build, You Can find the build image at arch/arm/boot
4. Compile environment
- gcc 4.4.1
- Ubuntu 10.10
- Java 1.6.0_22
I'll continue researching and will post any finds and my progress here if there's anyone interested. Meanwhile you can contribute with anything you can and by the end we may have a good tutorial out of it.
Click to expand...
Click to collapse
Forget about this. LG did not released Android soures. There are kernel only.
Damn... are you sure, Mik?
Have you looked inside the zip? There's 2 tarballs, one for the Kernel and other reading 'p500_gb_open_source.tar.gz'. I tought it was the p500 gb android source files that needs to be merged with the main source code.
Well... that's a real shame.
drakull said:
Damn... are you sure, Mik?
Have you looked inside the zip? There's 2 tarballs, one for the Kernel and other reading 'p500_gb_open_source.tar.gz'. I tought it was the p500 gb android source files that needs to be merged with the main source code.
Well... that's a real shame.
Click to expand...
Click to collapse
it is on GB, and it was on FROYO - LG didnt release the complete source code,
only some modifications to the android sources - because not all parts of android
are GPLv1, they doesnt MUST release sources for this parts these arent of GPLv2 or GPLv3 in some cases ...
andy572 said:
it is on GB, and it was on FROYO - LG didnt release the complete source code,
only some modifications to the android sources - because not all parts of android
are GPLv1, they doesnt MUST release sources for this parts these arent of GPLv2 or GPLv3 in some cases ...
Click to expand...
Click to collapse
AFAIK Even with froyo LG didn't publish the WHOLE source,only pieces of it (AFAIK).
I'm still downloading sources from codeaurora, as soon as it's finished I'll merge the changes and we'll see what happens
_Arjen_ said:
I'm still downloading sources from codeaurora, as soon as it's finished I'll merge the changes and we'll see what happens
Click to expand...
Click to collapse
I can't even download sources,my internet connection freezes everytime I download something (only if speed goes above 350KB/s),so no Eclair build for meh . Gonna kill Telecom Italia soon
Viva l'Italia
_Arjen_ said:
Viva l'Italia
Click to expand...
Click to collapse
Ahaha lol I do love my country but internet services suck
_Arjen_ said:
I'm still downloading sources from codeaurora, as soon as it's finished I'll merge the changes and we'll see what happens
Click to expand...
Click to collapse
sounds like "i download as fast as i can the sources, do a "make gingerbread"
in the command line and release a build to megaupload.com...
i can say, there is a very small knowledge of how to build a android system from source - you need a lot of hours to get the system compiled so that most stuff
is working^^
andy572 said:
sounds like "i download as fast as i can the sources, do a "make gingerbread"
in the command line and release a build to megaupload.com...
i can say, there is a very small knowledge of how to build a android system from source - you need a lot of hours to get the system compiled so that most stuff
is working^^
Click to expand...
Click to collapse
I know that Andy
I'm not stupid
But you need to download sources and merge LG sourcecode before you can start anyway
So far the simple . build/envsetup.sh, lunch and make seem to work fine with 2.3.4 source, after compiling is complete we'll see if I got a working rom.
If al works fine I can start to modify and build again, so I've got hours and hours of mostly waiting
_Arjen_ said:
I know that Andy
I'm not stupid
But you need to download sources and merge LG sourcecode before you can start anyway
So far the simple . build/envsetup.sh, lunch and make seem to work fine with 2.3.4 source, after compiling is complete we'll see if I got a working rom.
If al works fine I can start to modify and build again, so I've got hours and hours of mostly waiting
Click to expand...
Click to collapse
Lol, look to my sources and compare it to lg's. Theren are nothing usefull except kernel.
After compiling you'll get default android that probably can start in emulator
mik_os said:
Lol, look to my sources and compare it to lg's. Theren are nothing usefull except kernel.
After compiling you'll get default android that probably can start in emulator
Click to expand...
Click to collapse
I love your sources because they gave me some really useful infos
mik_os said:
Lol, look to my sources and compare it to lg's. Theren are nothing usefull except kernel.
After compiling you'll get default android that probably can start in emulator
Click to expand...
Click to collapse
Nope, it runs on the phone,
did similar thing to build eclair (needed to change some things before I could build) and got it booting to our phone with froyo kernel, only a little hacking needed to get all working. Only gsm and bluetooth are not yet fully working on eclair, other things seem fine so far.
but will take a look at your sources, because you could be right there are better ways
Edit:
GB building is ready and working fine after flashing (using new baseband)
Just tried this because it was fun. Now I'm going back to get eclair fully working
The only GB-build I want to use is CM7, no-one needs just another GB while we have three good ones: Miks CM7, Andy's GB/CM7 and Noejns void #forever and with Franco's kernel these builds rock
Sorry Ciaox, forgot your coming GB-rom

[Q] How to add new device tree,new kernel source code to CM source & compile?

Hello everybody.
I have a noob question about compile cyanogenmod for my new device.
Now, i have: CMW recovery, Kernel source code on local computer, full repo cm source + toolchains.
How to add my device tree, kernel source code to CM source and compile CM7 ROm?
Thanks you, cheer
Anyone here?
Did you figure it out yet? I asked the same question and am waiting for an answer, tho I'm on CM 10, HTC Vivid. If I figure it out I'll post back and try and help.
nguyenhonganh said:
Hello everybody.
I have a noob question about compile cyanogenmod for my new device.
Now, i have: CMW recovery, Kernel source code on local computer, full repo cm source + toolchains.
How to add my device tree, kernel source code to CM source and compile CM7 ROm?
Thanks you, cheer
Click to expand...
Click to collapse
I met the same problem, does anyone can help?
Do you have a device tree? Or do you have an unsupported device? If you have an existing device tree from some other ROM, etc, then you just need to edit your .repo/local_manifest/roomservice.xml to pull in the trees that you need.
If you need to create a device tree, then it gets not complicated, as each device is different. The basic process is to create the necessary directories (device/manufacturer/model, kernel/manufacturer/model (may need to be kernel/manufacturer/device_family/model, for reference to that, see CM's repo for the LG G3) and finally vendor/manufacturer/device.
After you have the directories setup, you will need to actually start building the tree. The easiest way is to copy another devices files into your devices tree, and then edit the files. The closer the device you copy in is, the less work you will need to do to the files. Refer to sites like gsmarena.com, PhoneArena.com, etc for phone specs.
That's about as far as I can take you without dealing with a specific device. If you need more info, post back here with your questions, and post your device specs, or at least the model number,and I'll see if I can help.
rassawyer said:
Do you have a device tree? Or do you have an unsupported device? If you have an existing device tree from some other ROM, etc, then you just need to edit your .repo/local_manifest/roomservice.xml to pull in the trees that you need.
If you need to create a device tree, then it gets not complicated, as each device is different. The basic process is to create the necessary directories (device/manufacturer/model, kernel/manufacturer/model (may need to be kernel/manufacturer/device_family/model, for reference to that, see CM's repo for the LG G3) and finally vendor/manufacturer/device.
After you have the directories setup, you will need to actually start building the tree. The easiest way is to copy another devices files into your devices tree, and then edit the files. The closer the device you copy in is, the less work you will need to do to the files. Refer to sites like gsmarena.com, PhoneArena.com, etc for phone specs.
That's about as far as I can take you without dealing with a specific device. If you need more info, post back here with your questions, and post your device specs, or at least the model number,and I'll see if I can help.
Click to expand...
Click to collapse
I have a mt6750 devices... And there is a device from my company manufacturer.. Its a mt6750 device, it have cm device tree.. Both device working on same rom.. I can port that device rom but it always give me bugs.. So my question is how to use it?

Willing to build Lineage OS... But will require community help

As there is no interest nor popularity on this device to stimulate a healthy developer community, I have decided to look into ROM building and what is required. I have followed this three part video in explaining how to build Lineage OS from source to a device. I have made it to part two where I download the Lineage OS source code to my Linux work-space. Where I get stuck is adding the source to the ROM. The question now is How do I attach the Lineage OS source code to the kernel source code for this device?
Information sources...
Part 1 https://www.youtube.com/watch?v=iZmjOlUq_3c&t=1s
Part 2 https://www.youtube.com/watch?v=MGI3NSJFtKA
Part 3 https://www.youtube.com/watch?v=AJCgOHtli64&t=153s
Current Kernel source code from Asus https://www.asus.com/ca-en/Phone/ZenFone-4-ZE554KL/HelpDesk_Download/
Just ordered one. I've never built Lineage OS either, but maybe we can work together to figure it out.
I have the lineage OS sorce code ready to compile on my system. I just need to know how to add the nesary kernel with it. Any ideas?
Any progress?
Sent from my [device_name] using XDA-Developers Legacy app
Nope! Unless you have anything to contribute.
someaguy said:
As there is no interest nor popularity on this device to stimulate a healthy developer community, I have decided to look into ROM building and what is required. I have followed this three part video in explaining how to build Lineage OS from source to a device. I have made it to part two where I download the Lineage OS source code to my Linux work-space. Where I get stuck is adding the source to the ROM. The question now is How do I attach the Lineage OS source code to the kernel source code for this device?
Click to expand...
Click to collapse
I also looked into building Lineage, seems like it's going to be more than I'm willing to commit to, so I'll share what I found in hopes that it will help you or anyone else move forward with this.
I found this restored CM wiki page on the subject: fat-tire.github.io/porting-intro.html (Sorry, can't make it clickable since I'm new)
The gist seems to be that you need to make three directories in the lineage source (note z01kd appears to be the codename for the Zenfone 4 based on the build.prop file I pulled from my phone)
device/asus/z01kd - Device file tree
kernel/asus/z01kd - Kernel
vendor/asus/z01kd - Proprietary blobs
In the above CM guide, it says to use ./build/tools/device/mkvendor.sh to generate the Device file tree from a boot.img file extracted from an update.zip (from Asus) or extracted from the phone, but that didn't work with the version I was trying to do (15.1), mkvendor.sh wasn't there at all. So I explored option #2 which was to fork an existing device file tree repo from a similar device and tweak it for the device you want to port and I found that the Zenfone Max Pro M1 (X00TD) (github.com/LineageOS/android_device_asus_X00TD) is the closest lineage supported device that we could copy from (at least that I could find). It looks like you might even be able to use the same kernel as that device (github.com/LineageOS/android_kernel_asus_sdm660) because the SOCs are pretty close (Snapdragon 630 vs Snapdragon 636), but you may need to use the stock kernel that you linked to in your original post, not sure.
There's a part in the lineage docs about building from source (only for supported devices) (wiki.lineageos.org/devices/X00TD/build#extract-proprietary-blobs) about extracting proprietary blobs (wiki.lineageos.org/extracting_blobs_from_zips.html) for the vendor/asus/z01kd folder. It said that you could use a lineage update.zip, but I was able to do it with the Asus update.zip. Don't know if that will work or not, but it seems like the only option since the Zenfone 4 doesn't have a lineage update.zip to pull proprietary blobs from.
And that's about as far as I got
Once you have those three folders set up and properly configured you should in theory be able to build it.
Update 9/3/2018
I just found the device file tree and kernel for Zenfone 4 that @shakalaca used to build TWRP. Looks like there are some different naming conventions from what lineage would expect (omni_Z01K.mk vs lineage.mk), but a lot of the stuff looks to be the same (eg BoardConfig.mk) and the files that do have a different name look like they're roughly equivalent.
github.com/TeamWin/android_device_asus_Z01K - Zenfone 4 TWRP device file tree
github.com/shakalaca/android_kernel_asus_ze554kl - Zenfone 4 TWRP kernel
Between these and the above X00TD device file tree and kernel links, we should be able to get pretty close to a working config.
What if you compile what you have and see if it boots on your device?
someaguy said:
What if you compile what you have and see if it boots on your device?
Click to expand...
Click to collapse
Sorry...I already deleted the environment I had set up, to reclaim the 50+ GB of disk space.
If it's any consolation, I never made it far enough for it to build successfully.
I am trying to build Lineage OS too
In this guide(https://forum.xda-developers.com/chef-central/android/guide-android-rom-development-t2814763)
It says we need three files(device tree,kernel,vendor) to build it.
We have kernel and device tree from github(https://github.com/TeamWin/android_device_asus_Z01K)
but we still need vendor from our device,and the commend under this guide(https://www.isthnew.com/archives/build-lineageos.html) says that we can get vendor files by running "extract-files.sh".
But where can we find that?
(Sorry for my bad English
rol.
try to look here.https://forum.xda-developers.com/pr.../tool-capire-le-treble-terble-vendor-t3774629
I have tried that CLT project,but it didn't work
Maybe use this?
https://forum.xda-developers.com/axon-7/development/tool-party-v0-1-vendor-partition-t3831517

Need help with errors when compiling kernel from source.

So, I recently got a ASUS Zenfone 4 Selfie Pro, the phone is stuck on android 7.1 and doesn't have any roms, nothing, just TWRP. So I'm on a journey trying to build stuff for this device from the ground up, I already made a device tree based on Zenfone 3 (which has the same SoC) and I tried to build lineage/cyanogenmod 14.1 for it and got a lot of kernel errors, so I went to try to compile the kernel from the source ASUS gave on their website and uploaded it to my github. In this past 3 days was able to fix and workaround some of the errors I got while building, but now I'm stuck on this one: https://hastebin.com/iqisuzegeg.coffeescript | any help would be greatly apreciated .
For easier access to the kernel source I uploaded it to my github and made some fixes/workarounds for some errors: https://github.com/2003Frost/android_kernel_asus_Z01M_stock
I'm using Linaro 7.5.0 as arm64 toolchain.
I'm using Zorin OS 15.2 as OS.
If any more information is needed I'll be glad to give out.
0
Seppppx said:
Hmm. There is probably no definition for 'drivers/platform' and 'drivers/platform/msm' . But there is a reference (probably). Also have you tried to build the kernel with the defconfig "the manual way". If there is something wrong with the kernel I have almost no way of helping you because I'm not a real developer.
EDIT : There is a kernel source for your phone that on a developer's github https://github.com/shakalaca/android_kernel_asus_zd552kl . That is also the person who is the maintainer for official twrp. He has some large commits on the kernel so his kernel should build.
Click to expand...
Click to collapse
I already tried his kernel and got the same exact error :/
I didn't understand fully what you said with "the manual way" but I'm trying to compile the kernel outside the rom build environment, by using my device's defconfig and compiling with linaro.
0
Seppppx said:
By the manual way I mean the with the defconfig. Also I made a pull request to your Device Tree (adds persist partition and Shakalaca's kernel).
Also if you're trying to build with defconfig there is a tutorial by google. https://source.android.com/setup/build/building-kernels-deprecated .
After that you will have to put it to the boot image. Another guide for that. https://source.android.com/setup/build/building-kernels#embedding-into-Android .
Edit : Isn't the Android kernel build with the defconfig when you run a source build? I think it actually builds the kernel when you build android so you don't build the kernel separately.
Click to expand...
Click to collapse
I accepted your pull request. Yes when you build a rom from source it also compiles the kernel, but I wasn't able to build the rom because it gave me kernel errors, so I went and started compiling separately because it's easier to fix kernel errors like this.
I am not using Google's tutorial, I'm following one that has almost the same steps and I'm using the same toolchain.
0
Seppppx said:
By toolchain you mean tools that you need to compile a kernel? Why doesn't one just install the tools needed to compile a kernel source.
The guide I linked doesn't specify any toolchain (thus idk if I need one). It also doesn't have anything to do with build.sh script used to compile a kernel. Instead it uses the defconfig. The commands are actually very simple.
cd kernel-source_code
export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-android-
make ZD552KL-Phoenix_defconfig
make
Also have you tried to build another kernel that you are sure builds? If another kernel builds. The issues have to do something with the kernel itself. If it does not it's most likely something else.
Click to expand...
Click to collapse
To compile a kernel from source you need something a cross compiler or toolchain in my case I'm actually using the exact same commands you commented with linaro toolchain/cross compiler (aarch64-linux-android). As far as I know you need that to compile a kernel and I don't think the toolchain is the problem but the kernel itself. I can try another kernel later to see if it compiles.
0
Seppppx said:
Okay thanks!
If you manage to compile the kernel for your device make sure to mention/quote me. I would like to contribute. I'm on my way to make another pull request (now about cameras).
Click to expand...
Click to collapse
If you want to talk to me more quickly you can message me on telegram https://t.me/Frost_2003
0

what software/packages do you need to get a specific device working from AOSP stock

hello again peeps,
ive been gently banging my head around these past few days because i keep walking into knowledge pockets and nothing i can find, in the form of help or internet information, is filling in these holes. i originally planned to take my oneplus device and obtain the source code for oxygenos so i could build and customise it. this seems to have become a dead end so now i just want to build stock android via AOSP, but i dont understand what software i need to get the AOSP working on any device, so far i understand that you need 3 components; 1) Kernel 2) Vendor files (if any) 3) "Proprietary binaries".
The problems are, i have no idea how to obtain these "proprietary binaries", i have no idea where to put any 3 of them in the downloaded android source tree (after repo sync), and i dont know if thats all the information i need to atleast build and flash a stock image onto any phone. i think i have the kernel files i need on OnePlusOSS github and there is a vendor.img in the OTA update files, and a directory in my phone. if anybody could please guide me in the right direction, it'd be very cool. i just want to get started and have some fun.
0
Seppppx said:
You can't customize Oxygen Os as the source code doesn't exist for that. (It's not required for companies to publish that.)
What phone do you have? You already might have the required trees to build AOSP (or at least LineageOS)
You need
1. A Device Tree
2. The kernel (you can use the prebuilt kernel if you really want)
3. The proprietary vendor blobs located in the vendor partition.
You will probably have to download the aosp-caf source code instead of aosp for it to be more easy.
https://www.youtube.com/channel/UCnGqG_jyyXmTzdamBpKfeHA
This is a great channel about Android building and has about everything you need to know.
Click to expand...
Click to collapse
thank you for every inch of text in your reply. I have a oneplus 8. Ah right, so the vendor folder CONTAINS the proprietary binaries/blobs.
it seems safest for me to use the kernel in the manufacturers github for the first flash as i want to be careful with making changes. may i ask what "aosp-caf" is? or can i find out using the resource you provided? thank you again.
my new understanding is, you need; 1) android source (e.g android-10-r5) 2) kernel 3) proprietary blobs. this helps a lot and is a lot clearer. the last issue i have is with knowing where to put the kernel and the blobs. i think if i am not mistaken you put the blobs in a vendor folder after the build? i am unsure with the kernel. i am going to definitely check this guy out. your time means a lot to me.

Categories

Resources