Question Trying to build the kernel - OnePlus Nord N200 5G

I've not built a kernel since my Samsung Galaxy Nexus, so bear with me. I'm trying to learn and see if I can't be of some service somehow.
So I've forked the repository for the kernel source from here, to my Github HERE. After working through learning more than I though I would about gcc and clang toolchains, I attempted to build the kernel. Turns out, I think the kernel is missing at least one folder.
Code:
techpack/oneplus/Makefile:58: "techpack LINUXINCLUDE " -I./arch/arm64/include -I./arch/arm64/include/generated -I./include -I./arch/arm64/include/uapi -I./arch/arm64/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -I./techpack/oneplus/include -I./techpack/oneplus/overlay -include ./techpack/oneplus/config/oneplus.h -include ./techpack/oneplus/config/coretech.h -include ./techpack/oneplus/config/oneplus.h -I./techpack/oneplus/include
scripts/Makefile.clean:15: techpack/oneplus/power/Makefile: No such file or directory
When I look in the source code, I see that the techpack/oneplus/power folder is not there, so it would not be able to be made.
Any ideas on how to get it, or if I could bring it from a different oneplus device?
The main idea was to work on some governors and IO Schedulers, but mainly to see if we could disable dm-verity for the TWRP build. Honestly, I don't know how people get into this anymore. Every time I go to build, I get errors such as above, or I try to Make Clean, and I end up with errors that it can't clean. I'll take direction as to where I can go to learn, without attending University.

I think you can flash magisk to disable dm verity. You might be able to manually strip out avb from a boot.img as well (I'm sure guides are somewhere in xda).
Why would you wanna do this for TWRP though?
As for the actual kernel building, I just think OnePlus hasn't shipped out the complete sources, it has happened before. I am no expert though so might be wrong.

Related

[Q] Where to start?

Hello,
I want to compile Android from source. I want to just build a fully default Gingerbread that would run nice on my phone. I got the Android source, kernel source (kernel-2.6.32-U8800-Froyo) and now I don't know what to do next. I compiled the generic one already (lunch full-eng) and it ran fine on the emulator.
My most important question is, if I make it otapackage and flash it, would it start? If it doesn't, can I recover? What folders/files are essential if I make my own device for example in "device/huawei/u8800"
Also, where can I find a GOOD porting guide? I have found some that are old and not used anymore.
Some links
Start by going through source.android.com for the general basics if you havent already.
Also, even though Google removed the PDK (Platform Developer's Kit) from the site, it has been mirrored on kandroid here: http://www.kandroid.org/online-pdk/guide/index.html
The stuff in the the PDK, although inadequate, is still very important and explains how to create the necessary makefiles to add to the build, configuring for a new market, etc. etc.
Also,
watch these two videos over here. These were very helpful in my ROM development:
http://www.youtube.com/watch?v=1_H4AlQaNa0
http://www.youtube.com/watch?v=rFqELLB1Kk8
Learn to use github. It is helpful for you to keep track of your changes as well as incorporate others works into your own.
http://help.github.com/
Finally, Cyanogenmod repos are your BEST friend. Almost all major AOSP ROM devs owe some sort of thanks to those guys who have done so much. If you want to check out some of the code changes and patches that you want to incorporate look here on their gerrit:
review.cyanogenmod.com
If you want to look at the other changes that are actually in the cyanogenmod builds, best to look at their git repos here:
https://github.com/CyanogenMod
I am still learning right now while I create my ROM but your welcome to PM me if you have any questions
Glad someone helped. Now that ICS is available, I will build that instead. Now, I will follow the kandroid tutorial and add hardware_msm7x30 from cyanogenmod's repos. Then I'll make my own makefiles in the huawei/u8800 and I'll see if that works.
Also, some things I am not still clear. If I am not adding any recovery files, it shouldn't replace it, right? I want to make sure I can recover. However, my phone has a bootloader mode, which should still work, even if other's messed up. And the kernel, if I already have a compiled kernel for android 2.2, should it work for newer versions?
Thanks
Well AOSP as far as I know adds the stock recovery into the build so if you have a stock ROM, then you will lose your recovery (unless you change the source to skip the adding of recovery to otapackage).
Your bootloader should be fine. so you will theoretically be able to re-flash a custom recovery with fastboot as long as your bootloader is unlocked (assuming your phone is already rooted and has a custom rom, then it should be unlocked)
If you are using CM7 as base, then you dont have to worry about it as it is configured to NOT replace the recovery during the building and creating the otapackage.
The kernel should not be compatible as there were significant changes from Froyo and you should not use it. By the way, for now, work on the ROM first. Creating a custom kernel from scratch is hard work and should be left as the last task to do (assuming you know linux kernel development). Just use the stock pre-built kernel that comes with the source.
Also, according to Google:
Starting with IceCreamSandwich, the Android Open-Source Project can't be used from pure source code only, and requires additional hardware-related proprietary libraries to run, specifically for hardware graphics acceleration.
Click to expand...
Click to collapse
This means you need to find the correct hardware drivers first. Where to find that is beyond me. Check CM repos. It would be easy if everyone had a Nexus S/ Galaxy Nexus as the drivers are immediately available on source.android.com. Ah...well....
Personally, I am going to wait a few weeks before dabbling into ICS ROMs. Wait till CM7 comes out with a nightly for my nexus one and then rip the drivers from their ROM and use it for mine
I got ICS source and made the necessary Android.mk, AndroidProducts.mk, BoardConfig.mk and u8800(my device).mk, also vendorsetup.sh . Now, when I am trying to build it doesn't give me an error, more of a suggestion. It says to include "LOCAL_MODULE_TAGS := optional" in the hardware/msm7k/liblights/Android.mk. I added that, and tried again. Got that message again, but with other type /libril/Android.mk
About fastboot, I am not sure if my device has that. It can be turned on with volume up and down + power, but it boots to so called "pink screen". When I mount phone using usb to my pc, I can browse the recovery.img and other related stuff. If I have the otapackage, can I just take the recovery out from there or what should I modify in source? Add something to the makefiles?
Yeah I am pretty sure you should add the LOCAL_MODULE_TAGS to all of the relevant pre-built files. maybe they made the compiler less harsh in ICS when compared to the one for gingerbread. In gingerbread, it outright crashed the compile and asked you to add the tags.
According to Google engineers, here is the reason why they use these tags:
Short answer: lack of time.
The urgent concern was to prevent new modules from using a user tag
(implicitly or explicitly), and we took care of that. We haven't had
time to deal with the existing modules, there are over 1000 of those.
JBQ
Click to expand...
Click to collapse
By the way, I hope you have git setup and the changes you have made are being staged and commited to your repo in github. If you ever make a mistake that hardcore crashes your compile and you dont know what you did, git will be there for you to rollback the changes as well as keep track of everything you have done from commit to commit
As far as I know, CM repos dont have everything complete for a full build of ICS but I could be wrong.
So you are working with AOSP correct?
As for the fastboot every android phone should have a fastboot by default but I believe each phone has a slightly different version. I will post how my fastboot looks like in a bit.
As for the removal of recovery, there should be somewhere in either source, makefiles or argument for the otapackage command that should leave out the recovery when making update.zip. You could just remove the recovery from the update.zip, change the updater-script and repackage it but its not a clean solution and those changes should be done in a uniform manner so you dont repeat this step every time you do a new build.
Where exactly is it, I have yet to know. Still learning much of this myself.
I now completely understand what modes of turning on my phone has... First one is normal, second is recovery, third is update-bootloader(I can access all files with it too) and four being the fastboot. The custom recovery I have on has an issue that it wants to boot to charging mode when I type "adb reboot bootloader". I can get to fastboot with the custom ROM I have on right now though. I think I am safe if I have issues.
I edited msm7k Android.mk to remove libaudio and libgralloc (errors with those), and it compiles to the step where it says it has no rule to make kernel requied by boot.img. I have put into BoardConfig.mk the line TARGET_PREBUILT_KERNEL with my kernel. I don't understand, what's wrong now...
My goal is to simply get it booting up. I'll look into libraries and other later.
-e-
Got the kernel thing sorted out. Copied device.mk from tuna device and edited to fit my device. Also modified full_u8800.mk and made the call to inherit from device.mk. Compiling now and I think I got past that.
-e2-
Got it built successfully. Fastboot won't let it install, because it has no mount points. Added mount points and let's see...
Nice to see you are making progress.
Got it built, but the fastboot is kinda buggy in my device, maybe custom rom issue. I can't make otapackage, it says "no rule to make target otapackage". I have a possible fix, trying that later.
Otherwise, I read its possible to flash system.img from recovery via advanced restore, update.zip package or advanced flash_image, but I don't know. Will post results.
Sent from my u8800
-e-
Tried make otapackage again. It still says "make: *** No rule to make target `otapackage'. Stop.". Maybe some things are still missing, I don't know. adb flash_image command will always post -1 to me, update.zip didn't work, advanced restore is not for this. I have a compiled image and I can't wait to test it, but I can't flash it...
If nothing works I'll revert to stock ROM and try again.
Blefish said:
Got it built, but the fastboot is kinda buggy in my device, maybe custom rom issue. I can't make otapackage, it says "no rule to make target otapackage". I have a possible fix, trying that later.
Otherwise, I read its possible to flash system.img from recovery via advanced restore, update.zip package or advanced flash_image, but I don't know. Will post results.
Sent from my u8800
-e-
Tried make otapackage again. It still says "make: *** No rule to make target `otapackage'. Stop.". Maybe some things are still missing, I don't know. adb flash_image command will always post -1 to me, update.zip didn't work, advanced restore is not for this. I have a compiled image and I can't wait to test it, but I can't flash it...
If nothing works I'll revert to stock ROM and try again.
Click to expand...
Click to collapse
If you successfully compiled, take the boot.img and system.img and package them into a zip and use dsixda's kitchen to make it flashable
Blefish, is it possible for you to share your device/vendor structures somewhere? I just finished setting up a build machine for ICS (using Cyanogenmod's repos in my case), and made a working full-eng image that seems to boot just fine in the emulator, so I'm seemingly all ready to hack around our device's specifics. But I would rather not do duplicate work, so I decided to ask
I'm also grabbing Huawei's new 2.6.35-based package to get the new kernel config, can't wait for them to release the actual sources for the update.
I'll share them on GitHib once I get a working build. I haven't got much time, and I changed to CM9 alpha now (repo branch ics). Since we got a 2.3 update, my first task is to port the latest clockworkmod recovery and then the ICS.
Compiling Android is long task and I'll do it in weekends, but the recovery should be available sometime, it shouldn't be hard to port that.
Oh yeah, look up stockwell's, dzo's and genokolar's github, they have done the device configuration. You can get much help from there. This weekend I'll propably test the build, I got otapackage command working now (it needed some things I can't write on mobile).
Sent from my U8800 using Tapatalk

[Q] How would I compile a custom kernel with custom ROM

I just went through the process of compiling a custom ROM and they used a stock kernel. I would like to incorporate a different kernel when I compile and instead of the stock. I know I could compile them separately and have them flash together but I want one zip to flash. Just would like to go through the process to learn.
Any help on how to do this or what I have to do when compiling?'
Thanks.
MAXGEN said:
I just went through the process of compiling a custom ROM and they used a stock kernel. I would like to incorporate a different kernel when I compile and instead of the stock. I know I could compile them separately and have them flash together but I want one zip to flash. Just would like to go through the process to learn.
Any help on how to do this or what I have to do when compiling?'
Thanks.
Click to expand...
Click to collapse
One of the easiest ways of doing this would be to take the boot.img thats contains the custom kernel you want and deleting the stock boot.img containing the stock kernel in your .zip file and replacing that with the boot.img of the custom kernel. Essentially you are just swapping the boot.img file in the .zip files with the one containing the custom kernel rather then the stock kernel. Let me know if you need me to explain things further or have any other questions I'll be happy to help you out.
shimp208 said:
One of the easiest ways of doing this would be to take the boot.img thats contains the custom kernel you want and deleting the stock boot.img containing the stock kernel in your .zip file and replacing that with the boot.img of the custom kernel. Essentially you are just swapping the boot.img file in the .zip files with the one containing the custom kernel rather then the stock kernel. Let me know if you need me to explain things further or have any other questions I'll be happy to help you out.
Click to expand...
Click to collapse
Thanks for the response.
I have to first compile the custom kernel then it seems like an easy process after that. I'm going to try to compile Franco kernel for nexus 5 if u heard of it. Its been pretty good for me.
Any tips for compiling another project or Franco kernel would be great!? I will make a separate folder for that kernel git project and compile it there.
I also want to use tool chain like Linaro and maybe Sabermod but those are for nexus 4, maybe I can port it over.
MAXGEN said:
Thanks for the response.
I have to first compile the custom kernel then it seems like an easy process after that. I'm going to try to compile Franco kernel for nexus 5 if u heard of it. Its been pretty good for me.
Any tips for compiling another project or Franco kernel would be great!? I will make a separate folder for that kernel git project and compile it there.
I also want to use tool chain like Linaro and maybe Sabermod but those are for nexus 4, maybe I can port it over.
Click to expand...
Click to collapse
Franco kernel is an excellent kernel can't really go wrong with it. On your other note, Linaro is not Android device specific it can be used to compile kernels for a plethora of devices, I would recommend taking a look at this great guide on how to use Linaro to compile your kernel and how to customize the Linaro toolchain to suit your needs.
shimp208 said:
Franco kernel is an excellent kernel can't really go wrong with it. On your other note, Linaro is not Android device specific it can be used to compile kernels for a plethora of devices, I would recommend taking a look at this great guide on how to use Linaro to compile your kernel and how to customize the Linaro toolchain to suit your needs.
Click to expand...
Click to collapse
So I tried following the post. Just not sure about a lot of things and got confused and couldn't compile.
So what I'm trying first before I use the LInaro tool chain is to try to compile the Franco kernel without it. I clone Franco hammerhead git and link the arm-eabi-4.6 toolkit
make hammerhead_defconf
make -j7
Seem to compile with no errors, took a minute though which seems quick but not sure where it exported to.
Tried looking in the arch/arm/boot/ but no look.
I want compile a boot.img as well.
MAXGEN said:
So I tried following the post. Just not sure about a lot of things and got confused and couldn't compile.
So what I'm trying first before I use the LInaro tool chain is to try to compile the Franco kernel without it. I clone Franco hammerhead git and link the arm-eabi-4.6 toolkit
make hammerhead_defconf
make -j7
Seem to compile with no errors, took a minute though which seems quick but not sure where it exported to.
Tried looking in the arch/arm/boot/ but no look.
I want compile a boot.img as well.
Click to expand...
Click to collapse
I would recommend trying the following procedure:
Code:
mkdir franco
cd franco
git clone https://github.com/franciscofranco/hammerhead.git
After the clone operation completes rename the cloned folder to hammerhead or make sure it named hammerhead.
Now make sure your are in the franco folder you created and run the following commands:
Code:
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6
export PATH=$(pwd)/arm-eabi-4.6/bin:$PATH
export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=arm-eabi-
cd hammerhead
make hammerhead_defconfig
make -j4
Once it finishes this you should now have a zimage outputted in the path arch/arm/boot/zImage. To make the process of putting your zimage and module together run the following commands:
Code:
mkdir ~/franco/kernel_output
cp ~/franco/hammerhead/arch/arm/boot/zImage ~/franco/kernel_output/zImage
find ~/franco/hammerhead -name "*.ko" -exec cp {} ~/franco/kernel_output \; (You may have to run the command without the ";")
You should now have everything you need to make a boot.img. Let me know how it goes and if you still have questions.
Thanks for your help, W-XC (curious what that means and you have flying shoe is it because you run? You running in the next Boston Marathon?)
The kernel is actually using 4.7 so I just used the right git. I also found out it wasn't compiling because there was any error in that specific driver for CPU governor. The dev actually was about to push a fix and supposedly it will be push tomorrow but shared the commit so I was able to make the fix manually. Either case it compiles now. Working on step 2 which is to compile into the ROM.
I was curious you seem to know your stuff. Are you kernel dev? How did you gain your knowledge? I wanna learn more about Android OS and linux kernel? I taken basic OS classes in college so a lot of introduction to concepts but nothing on coding it though. Any books or anything you can recommend on any of these areas or anything closely related worth knowing? Thanks again.
For making a boot.img I tried the following. What would you suggest for mkbootimg?
I used this script to get my ramdisk.
http://www.enck.org/tools.html
But I'm little confused on where do you get the script for mkbootimg?
Is it from the android source or is it generated when you build the kernel or is it some script that someone made?
I found this posting for building a kernel with mkbootimg but the dilemmaI"m no having is what is correct commands for building.
http://www.droidforums.net/forum/rescue-squad-guides/31452-how-compile-your-own-kernel.html
The dev mention some commands in a posting several months ago.
http://forum.xda-developers.com/showpost.php?p=47167725&postcount=291
That might be a way to go but the argument doesn't take with the mkbootimg from the droid forums. Syntax is not right so it makes me think that mkbootimg is unique.
MAXGEN said:
Thanks for your help, W-XC (curious what that means and you have flying shoe is it because you run? You running in the next Boston Marathon?)
The kernel is actually using 4.7 so I just used the right git. I also found out it wasn't compiling because there was any error in that specific driver for CPU governor. The dev actually was about to push a fix and supposedly it will be push tomorrow but shared the commit so I was able to make the fix manually. Either case it compiles now. Working on step 2 which is to compile into the ROM.
I was curious you seem to know your stuff. Are you kernel dev? How did you gain your knowledge? I wanna learn more about Android OS and linux kernel? I taken basic OS classes in college so a lot of introduction to concepts but nothing on coding it though. Any books or anything you can recommend on any of these areas or anything closely related worth knowing? Thanks again.
Click to expand...
Click to collapse
MAXGEN said:
For making a boot.img I tried the following. What would you suggest for mkbootimg?
I used this script to get my ramdisk.
http://www.enck.org/tools.html
But I'm little confused on where do you get the script for mkbootimg?
Is it from the android source or is it generated when you build the kernel or is it some script that someone made?
I found this posting for building a kernel with mkbootimg but the dilemmaI"m no having is what is correct commands for building.
http://www.droidforums.net/forum/rescue-squad-guides/31452-how-compile-your-own-kernel.html
The dev mention some commands in a posting several months ago.
http://forum.xda-developers.com/showpost.php?p=47167725&postcount=291
That might be a way to go but the argument doesn't take with the mkbootimg from the droid forums. Syntax is not right so it makes me think that mkbootimg is unique.
Click to expand...
Click to collapse
The W-XC in my avatar stands for Watertown Cross-Country which is the team I used to run on and the flying shoe with the track wings represents our track team, as I love to run I thought it was a fitting avatar. As far as running the Boston marathon I am not running this year but I would love to someday, I am unfortunately not in good enough form to run a marathon right now due to a prolonged battle with an injury I sustained last spring, but I'll keep training and keeping running!
I'm glad you were able to make the fix on the kernel, often times errors that seem to pop out of nowhere are related to fixes not being pushed to the repository you were syncing and using to build at the time. Thank you for the nice compliment it is greatly appreciated, I am not a kernel developer just an overall aspiring developer who loves everything Android related and trying to contribute and help others however I can. I would say 99% of my knowledge of everything Android related has come from XDA and hours upon hours of Googling things related to kernel development, reading about something not understanding something then Googling the parts I didn't understand, piecing together things then Googling more things to help me understand, after a while you slowly start putting the pieces of knowledge together as you learn more and then you still keep learning. For resources on learning kernel development I would recommend learning the C programming language as it is the building block of kernel development. A great resource for learning C is the free online e-book Learn C The Hard Way. Another critical element of understanding Android kernel development is the Linux Kernel and it's drivers which is why I would recommend taking a look at Linux Device Driver's Third Edition, while parts of it are outdated the fundamental concepts are still very much applicable. As far as pure Android Kernel aspects and Linux Kernel aspects go the free-electrons group has some invaluable presentations that cover these subjects as well as other critical areas of embedded development that relate to kernels.
For the mkbootimg binary I would recommend downloading these unpack, repack, ramdisk tools. They have proven invaluable for me when working with img files and kernels. Download the scripts and binaries and put them in your ~/bin folder and make sure to give them the proper permissions that way they will be in your path and you can use them properly. Once you have them installed I would recommend obtaining a copy of the Nexus 5's latest boot.img (The factory images Google Provides should have it in the images .zip file included in the factory image). After doing that decompile the stock boot.img file using the umkbootimg binary, this should present you with an output of a ramdisk and a zimage. Next, take the zimage you compiled with the franco kernel source and replace the stock boot.img zimage with the zimage you compiled from franco kernel. Then run the mkbootimg binary with command (In terminal it should give you the command to easily re-pack the boot.img) to re-pack your new boot.img. The output of the new boot.img will have the default name new_boot.img or similar name. Re-name this file to boot.img and delete the old boot.img from your .zip file of your ROM and swap in the boot.img file you just created. You have now included the custom kernel you wanted in your ROM.
As always let me know if you still have questions I'll be happy to answer them :good:.
Thank you so much!!! Probably going to have to take some time to digest everything but definitely will have more questions when I'm done.
Quick question, do you have see "C" being replace? I have read some C code but haven't not yet coded anything in C. I been told that low level access you get with C is not comparable with other languages. I guess you would have to go to ASM to get even more access. ASM personally I run from it, probably should do more of it for practice. We do a lot of high level language C++, java, python and some others in school but no C. I probably can't avoid not being comfortable in it? C is not going to be replace by anything in future??
MAXGEN said:
Thank you so much!!! Probably going to have to take some time to digest everything but definitely will have more questions when I'm done.
Quick question, do you have see "C" being replace? I have read some C code but haven't not yet coded anything in C. I been told that low level access you get with C is not comparable with other languages. I guess you would have to go to ASM to get even more access. ASM personally I run from it, probably should do more of it for practice. We do a lot of high level language C++, java, python and some others in school but no C. I probably can't avoid not being comfortable in it? C is not going to be replace by anything in future??
Click to expand...
Click to collapse
You are correct in that to get even more low level access you start getting into assembly territory. What makes assembly difficult and what makes people from run form it is unlike very high level languages such as Python, Java, etc. it is much less human readable and a lot closer to machine language (Binary code), however like anything practice makes perfect the more you practice with a language the easier things get and the more confidence you have in programming things with it. If you really want to customize and develop kernels C is a must there is no getting around that unfortunately. As far as C being replaced with anything in the future, will it ever be replaced, probably as is the case with technology, but as far as it being replaced with anything equivalent or better in the next 10-20 years I doubt it, as it would take years to develop a new standard and even longer to be adopted and standardized to the point C is used and accepted today.

Finding out which blobs are needed for a device (CM13)

Hi everybody,
I'm currently in process of making my first builds of CM13 for my A310F.
The repositories for CM are unofficial, maintained by a user i tried to get in contact with, who didn't respond yet.
Now, while the stock kernel sources of MM are open sourced and a few hacks were already done in the unofficial CM repositories, the CM device/vendor/kernel sources are already a bit deprecated with a few erroneus configurations in the device repo, so I'm on my way to clean it up a bit.
Currently CM itself builds, but after booting most of the hardware features are broken and they were using the 5.1.1 kernel instead of the 6.0.1, and the blobs were not taken over correctly, or not all blobs were taken.
My question is now, how are you managing to get the correct list of the blobs needed? What is the best way to find out which blobs i need to take from the system.img?
I'm wondering the same thing. How do you know which blobs to pull in the first place when you're trying to build up the first rom?
There will be some dlopen errors for missing files in the logcat. After resolving them, it's mainly trial and error
Believe it or not, there is a method to this, and it requires some trial and error and a good sense of knowing what android needs to boot. If you look at the start up classpath and are just generally aware that the modem/network connection and filesystem utils need to be executed first (though for some reason binder and zygote can't start them themselves, despite the fact they are to running under init, but whatevs) so after bootloader hands off to kernel, you can go through the ramdisk and make sure all the on boot, on init on fs related libs/binaries are present. If you use a qcom device, just assume any lib or binary that starts with "libq" or even just the letter "q" is proprietary and required. Qcom is a bit full of themselves (ironic were talking about cm here) but anyways then there's the rild/crypto/fs libs and binaries. rngd, rmt_storage, rild daemons and anything that starts drmsever or netd will be required as well.
You can get significant hints from boot logs as well.
Aside from that, just keep note of what isn't produced by the aosp tree yet is present on the devices stock system, then determine how important it looks for android to able to start up

[H918]Anyone that wants the 10j kernel source (that actually compiles)... Here it is

So LG released build 10j, with accompanying kernel source for the 10j update.
However, their source includes a lot of "typos" and silly little mishaps and doesn't compile.
Things that had to be fixed (note, not every file type mentioned were fixed, just specific ones) :
Makefile(s)
Kconfig(s)
.c sources
.h headers
The package I am providing stems from @jcadduono initial release (found here). I then replaced all files from the 10j source from LG (found here).
I then compiled with one thread and went error by error. Yes, it took me much longer than it should have, but I've never done anything like this, and the longest part was actually learning on how to figure out what was causing issues. I suppose in the future, it will be much faster for me.
Anyway, it flashes fine, here it is.
No changes to the defconfig, nor was anything customized inside (just fixed). It is stock, and builds Image.lz4 as well as the accompanying modules. This is all thanks to @jcadduono 's beautiful build.sh script, as well as his menuconfig.sh.
To build :
set toolchain in menuconfig.sh as well as build.sh
cd /path_to_dir
./menuconfig (do your changes, exit, follow prompts to save changes)
./build.sh h918
You want /path_to_dir/build/lib/modules and /path_to_dir/build/arch/arm64/boot
Save those things before running menuconfig and/or build.sh again, as they are automatically cleaned per config or build.
Remember you still have to disable verity, and force-encrypt.
Also, here is a full stock, flashable 10j boot.img (with kernel built from source packed inside), with verity and force-encrypt disabled. Also, it flashes the newly-compiled modules, as well as SuperSU2.79-SR3. Stock RAMdisk used as well.
When you do end up customizing the kernel, will you be putting that out as a stand alone custom kernel?
Thanks for all the hard work. Take a week off.
Cheers!
Update
Hey @Tilde88 seems the dreaded no sound on call after switching from wifi calling to data call is active again
I also have another branch going here: https://github.com/jcadduono/android_kernel_lge_msm8996/commits/android-7.0_2
which is 10j with LG's stuff separated from other commits.
I can't seem to figure out why it doesn't want to boot though. For whatever odd reason, seems the bootloader isn't even reading the Image.lz4-dtb and going straight to blank screen -> power off. Makes it darn hard to investigate when you can't get a pstore.
Update: I just realized that lz4 binary changed so all I had to do was change -lz16 to -lz9
Update 2: Nope still doesn't boot, I'm outta ideas.
jcadduono said:
I also have another branch going here: https://github.com/jcadduono/android_kernel_lge_msm8996/commits/android-7.0_2
which is 10j with LG's stuff separated from other commits.
I can't seem to figure out why it doesn't want to boot though. For whatever odd reason, seems the bootloader isn't even reading the Image.lz4-dtb and going straight to blank screen -> power off. Makes it darn hard to investigate when you can't get a pstore.
Update: I just realized that lz4 binary changed so all I had to do was change -lz16 to -lz9
Update 2: Nope still doesn't boot, I'm outta ideas.
Click to expand...
Click to collapse
Is that for 10j? From the H918 source, the Kconfig and Makefile for the DTB image were broken. It would automatically remove the lines from defconfig anytime you did a menuconfig. I'm sure you already picked up on that though
Other than that, I have nothing to offer... I am no expert like yourself
kelvin216 said:
Hey @Tilde88 seems the dreaded no sound on call after switching from wifi calling to data call is active again
Click to expand...
Click to collapse
I'm still on 10d with my 5.5 rom+kernel. Going to make a v6 test rom+kernel and try it out live tomorrow.
I used 5.5 with VoLTE and WiFi calling in the last few days... But I have gotten no issues, even though I'm actually trying to get them to occur.
I was actually in a building for some time with 0.0% radio signal. So I hopped on wifi, and made my calls to the office that way.
When I left the building, WiFi disconnected due to range, 4G came up and I called my office, no issue at all.
When you say "again", do you mean it is occurring again as it once did, or as it recently has? (On what kernel are you having this issue - NSS 5.5 for H918 is fully stable). Other than a few people having high CPU usage (which I also can't replicate), there are no issues on the 5.5 kernel. I suspect the CPU usage thing to be due to me enabling C-States blindly in defconfig; but that has nothing to do with what we are on about.
Thanks for the info.
10j
Hey @Tilde88 it happen it on your new 10j kernal while i was testing didnt have any high Cpu or overheating issue with kernal, just on calls when switching from wifi calling to data, calls can be made and receive but no one can hear me unless i reboot phone and then everything is fine till the switch again from wifi calling and data and vice versa, glad i can help, will get a log when it happens again but the kernal is great for my needs on a 10j base rom
So no ones working on h918 kernel for 10j?
lightninbug said:
So no ones working on h918 kernel for 10j?
Click to expand...
Click to collapse
It's fine the way it is imo. Just get root and tare apart the bloats
Sent from my zeroltetmo using XDA Labs
twidledee said:
It's fine the way it is imo. Just get root and tare apart the bloats
Click to expand...
Click to collapse
That comes NO WHERE close to comparing to tweaks at a kernel level.
Tilde88 said:
Is that for 10j? From the H918 source, the Kconfig and Makefile for the DTB image were broken. It would automatically remove the lines from defconfig anytime you did a menuconfig. I'm sure you already picked up on that though
Other than that, I have nothing to offer... I am no expert like yourself
Click to expand...
Click to collapse
what tools do you guys recommend? Im was going to do some things with my own in regards to ovrclocking and anything else the tools i found on the app store.
I've already downloaded tje files and im going to work it. So if you wouldn't mind suggesting some tools I can go from there. I did some scripting and coding a ling time ago and couriered for several eu topsides in the well. I dual booted NT pro server and Red Hat early a 90s. I cam put together a Lan and maintain the integrity of the network locally or remotely. When ICQ was just a bunch of rooms where allot of hoxor groups tested each others skills. I was good enough track a dos attacker through telnet and a few other scripts that I and And another put together just for such occasion- through 6 proxies...
then i became a truck driver. Got married and had kids.
Kids all grown now... I want to play with some old toys.
twidledee said:
what tools do you guys recommend? Im was going to do some things with my own in regards to ovrclocking and anything else the tools i found on the app store.
I've already downloaded tje files and im going to work it. So if you wouldn't mind suggesting some tools I can go from there. I did some scripting and coding a ling time ago and couriered for several eu topsides in the well. I dual booted NT pro server and Red Hat early a 90s. I cam put together a Lan and maintain the integrity of the network locally or remotely. When ICQ was just a bunch of rooms where allot of hoxor groups tested each others skills. I was good enough track a dos attacker through telnet and a few other scripts that I and And another put together just for such occasion- through 6 proxies...
then i became a truck driver. Got married and had kids.
Kids all grown now... I want to play with some old toys.
Click to expand...
Click to collapse
The only tool you will need on top of this source, is a cross compiler.
There are a few to choose from, but mainly, you might want to use Linaro.
This is the version I use gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu.
Once you have that, set it's path within the 2 files build.sh and menuconfig.sh.
Next step is to do ./menuconfig , do your changes, then do ./build.sh h918
To add features, you have to add source files (.c and .h files, and reference them accordingly in their respective Makefile and Kconfig files.
Thanks to @jcadduono for the realest build scripts. build.sh and menuconfig.sh are epic.
Tilde88 said:
The only tool you will need on top of this source, is a cross compiler.
There are a few to choose from, but mainly, you might want to use Linaro.
This is the version I use gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu.
Once you have that, set it's path within the 2 files build.sh and menuconfig.sh.
Next step is to do ./menuconfig , do your changes, then do ./build.sh h918
To add features, you have to add source files (.c and .h files, and reference them accordingly in their respective Makefile and Kconfig files.
Thanks to @jcadduono for the realest build scripts. build.sh and menuconfig.sh are epic.
Click to expand...
Click to collapse
Hi.
The boot file you linked. I decompressed it and itt produced many double copies. I assume that I have originals + a copy (1) some are identical in size others not so.... What do I do?
twidledee said:
Hi.
The boot file you linked. I decompressed it and itt produced many double copies. I assume that I have originals + a copy (1) some are identical in size others not so.... What do I do?
Click to expand...
Click to collapse
None of the words you just said make sense.
What are you trying to do, and with what.
Be precise.
If what you did was get the boot.img file and decompressed it, you exposed the RAMdisk. This will not help you in any way. This is also not the way in which you create a kernel. boot.img contains the kernel (zImage).
?
Tilde88 said:
None of the words you just said make sense.
What are you trying to do, and with what.
Be precise.
If what you did was get the boot.img file and decompressed it, you exposed the RAMdisk. This will not help you in any way. This is also not the way in which you create a kernel. boot.img contains the kernel (zImage).
?
Click to expand...
Click to collapse
It's my first time. I wanted to see what the package consisted of outside of the tar.zip so I unpacked it. As it was unpacking it was periodically halting due to an existing file already there. So I wasn't sure what to do so I let it rename. I wanted to see what the duplicate file was.
I'm not at the desk at the moment but when i looked at replicas the few I read were Readme and Linux guides.
As far as I can tell they weren't crucial files. I was just curious what made that happen since I haven't seen that with other packages. Then again I haven't embarked on this sort of project before either.
I hope that makes some sense.
Sent from my zeroltetmo using XDA Labs
Bump
twidledee said:
Bump
Click to expand...
Click to collapse
You are doing it wrong.
twidledee said:
It's my first time. I wanted to see what the package consisted of outside of the tar.zip so I unpacked it. As it was unpacking it was periodically halting due to an existing file already there. So I wasn't sure what to do so I let it rename. I wanted to see what the duplicate file was.
I'm not at the desk at the moment but when i looked at replicas the few I read were Readme and Linux guides.
As far as I can tell they weren't crucial files. I was just curious what made that happen since I haven't seen that with other packages. Then again I haven't embarked on this sort of project before either.
I hope that makes some sense.
Sent from my zeroltetmo using XDA Labs
Click to expand...
Click to collapse
Did you ever figure it out?
Not sure which you are using, the source, or the compiled boot.img.
If you want to make a custom kernel, I am more than happy to help. When extracting the source, or anything really, you will not get those errors, unless you already have files/folders that match identically to the structure in which you are extracting to... That would mean that you can have the same folder twice within a compressed file, which, you can't.
So, take the tarball, extract it (I just did it myself right now, there are no duplicates --because impossible), modify menuconfig.sh and build.sh to point them to your cross compiler (i recommend Linaro 6.1.1 for aarch64).
Now, within the source, you WILL find multiple files that are named the same, but they are in different locations, and contain different lines of code (almost usually). But these are NOT to be de-duped. Extract and use as-is.
Once you have set your toolchain in the 2 .sh files that jcadduono has made (and are awesome as can be), open up a terminal (i really hope you are on a Linux environment by this point, because if not, none of the steps in this paragraph will work ). Do not use root, just plain old userspace. Once in the terminal, cd to your source directory.
Type ./menuconfig.sh and hit enter.
Make your edits, save the file, and confirm you want to save.
Now you are back in your terminal session.
Type ./build.sh h918
Wait or watch as it compiles.
When it finishes, you will need 2 things. The kernel (found in your /sourcefolder/build/arch/arm64/boot directory), and the modules (found in your /sourcefolder/build/lib/modules/yourkernelname/kernel. This directory will be wiped the next time you do menuconfig or build, so get your files now. There will be like 20ish or so modules, and they have the .ko extension. Search the folder, and copy all these modules to a new folder, along with your zImage (file called Image.lz4-dtb).
You can either flash the zImage , or pack it into a boot.img with an existing RAMdisk, and flash the boot.img.
Also, all the modules you just compiled, need to go in your ROM. So when you make the flashable zip, make it delete /system/lib/modules, and then extract the new /modules dir into /system/lib.
Congrats, you just compiled your first custom kernel.
Hello
I thank you and @jcadduono for doing this.
Though I myself am not a developer, I will be getting this phone soon and I appreciate the activity on XDA that could potentially make it more fun to own this LG device.
I do know some basic Linux stuff, and I have compiled a few kernels with success so maybe I'll look into it someday, but hopefully there will be many veteran Linux hackers doing it instead the results would be better I think.
Btw, I looked on lg opensource site and found this: "LGH918_Android_Nougat_v10n.zip" I have not seen it mentioned anywhere in the forums yet, it must be very new.
askermk2000 said:
Btw, I looked on lg opensource site and found this: "LGH918_Android_Nougat_v10n.zip" I have not seen it mentioned anywhere in the forums yet, it must be very new.
Click to expand...
Click to collapse
https://forum.xda-developers.com/v20/how-to/h918-10k-kernel-source-potential-10n-t3631920
Plus @Mentalmuso has released a kernel using the 10N source.

Asus Zenwatch 2 (Sparrow) - How to get rebuilt kernel work (need framebuffer console)

Hello XDA developers,
First of all my motivation to write here is to create a commandline GNU/Linux-like UI (and maybe add desktop GUI later) on the Asus Zenwatch 2, so I could see the kernel messages at bootup and use Midnight Commander without starting the entire main system (for example, get a text-mode shell and stop after every devices got initialized, firmwares got loaded, but before loading any Surfaceflinger and Dalvik stuff). I did similar thing on an Android tablet before by writing my own keyboard and touchscreen handlers based on Yaft. But that didn't help with boot-time kernel messages and the built-in framebuffer console in the kernel is probably much better. It's not enabled in the stock kernel, so I tried to recompile the Sparrow kernel from source (I didn't modify the default configs yet). After some tweaks to the kernel-source (which doesn't compile without them) I could build the Momentum-kernel and the stock Sparrow-kernel too using the provided .config files (e.g: make sparrow_defconfig). I used Android NDK's r13b gcc on Lubuntu 18.04, because an earlier attempt with NDK r18b wanted to use clang and compilation stopped early with errors.
My problem is that despite the kernel finally got compiled it doesn't seem to start at all. (I had similar experience with the Android-kernel in the past, but more success with Raspberry PI)...
I used mkbootimg to repack the generated zImage-dtb and the previously decompressed initrd into a boot.img, and ran fastboot boot on it, but booting simply stucked at fastboot screen, the animated ASUS logo never came in.
Can anyone point me into the right direction how I could troubleshoot further why the kernel doesn't work?
(I assume the 4.9 gcc isn't the issue here, though I got a zImage with slightly different filesize. I've read somewhere the earlier 14.04 Ubuntu and 4.8 gcc is advised for Sparrow kernel compilation but do these versions matter here? Should I replace the modules too on the system partition with their newly built versions, as the zImage changed?)
I know others managed to build a working kernel, for example TWRP has its own custom kernel and it works fine on the Sparrow watch... Is there any step I might have missed? Is there a debug-tool or logging which helps me to find out why the kernel doesn't boot? Something to troubleshoot the kernel-loading and booting? (A simulator for example? Or how do the experts do it in practice?)
I hope I declared every aspects to get some help. If for some reason I don't succeed I might try to make more linux-like AsteroidOS or PostmarketOS to get my complete Linux console on the smartwatch. The thing is that these don't support all hardware on the watch, that's why I'm trying with Android in the first place.
I guess if I'll be able to compile and then run the stock original kernel somehow the rest will be easy. (To enable framebuffer-console, set governors, remove unnecessary drivers, etc.)
Thanks in advance for the help, XDA gurus...

Categories

Resources