Kernel directory structure at compile time - Android Q&A, Help & Troubleshooting

I'm having trouble compiling this kernel for the Realme 2 Pro:
https://github.com/realme-kernel-opensource/Realme2Pro-kernel-source
Firstly, there were misc build errors based around paths and syntax used for .C and .H driver source code files, which needed to be made "standalone compilable" ala OnePlus5:
https://github.com/adin-k/oneplus5-kernel/commit/ec4ec687ba23609b9c323145c7d509262b0f025f
For example, this source file header needed changing from:
#include "pmic-voter.h"
To this:
#include <linux/pmic-voter.h>
In other words, the pmic-voter.h file was not located in the same folder as the source file - but inside the "linux" sub-folder instead.
Once the paths were corrected it then builds successfully (albeit one final outstanding error relating to the fingerprint driver).
My first question then is how on earth might paths within the kernel tree become so messed up as to require such a drastic clean up operation!? Is it deliberate or are sub-folders being moved around or perhaps special environment variables being set at compile time?
I then went inside the make menuconfig to change some default kernel settings - specifically to enable Virtualization and KVM:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
The kernel then failed to compile again! The first place it falls over is building the cpu_errata.c, which can be fixed by having more paths updated within that file, but then it soon falls over again elsewhere.
I tried another Snapdragon 660 device with a similar kernel (Nokia 7 Plus) and the KVM parts compile fine. I even tried compiling the exact same kernel used by the Realme 2 Pro:
https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.78.tar.gz
Of course it compiles fine! Here's the typical steps that were taken:
export CROSS_COMPILE=/home/gilius/Desktop/tool/bin/aarch64-linux-android-
export ARCH=arm64
make O=out clean && make O=out mrproper
make O=out defconfig
make O=out menuconfig (note: here is where we enable Virtualization and KVM)
make O=out -j10
The Realme, Nokia and original kernel sources all share the same tree/directory structure - at least in terms of KVM. I don't know how the KVM modules were originally added to the official Linux Kernel (from version 3.11 onwards) because there are no instructions, but I do know from comparison that the files and directory structures are identical:
/arch/arm64/kvm/hyp
/virt/kvm/arm
/include/kvm
etc.
I then discovered that the original KVM files (perhaps finalised way back in 2014) do not depend on any particular directory structure as per what was required to fix standard OnePlus5/Realme compiles. For example, the kvm_main.c includes the following:
#include <kvm/iodev.h>
#include <linux/kvm_host.h>
#include <asm/processor.h>
But these folders (kvm/linux/asm) are located elsewhere in the kernel tree; the folder containing kvm_main.c has no such sub-folders - yet the compile still works for the Nokia kernel! And to complicate matters further, there happens to be several duplicate directories named "linux" containing different files in need of inclusion by various C and H source code files. In other words: they require files from all different linux folders scattered in all different locations - but without knowing exactly where to find them.
Therefore, the issue with enabling KVM in the Realme 2 Pro must be something to do with environment variables set during at compile time? So I'm guessing a whole of list of them (or symbolic links or some such) are set within a file somewhere to be referenced at compile time? Since all 3 kernels contain identical directory structures, how else might the Realme 2 pro kernel in particular have got messed up so that even basic parts of the kernel, such as kvm, do not compile by default? And how might this be undone and fixed?
Any help would be much appreciated.

Hi gilius2k15,
You can try this kernel source, its by Los dev SamarV121:
https://github.com/SamarV-121/android_kernel_oppo_sdm660
If you manage to compile do let us know how to

please let us know if u managed to compile it

Related

[Root] SimpleRoot 1.5 (Revised - Linux/Windows)

http://www.nickbetcher.com/~nbetcher/SimpleRoot-v1.5-Linux.tar.gzHere you can find the revised version of SimpleRoot. It has somewhat major changes that blend in the combination of Wes and Eugene's findings together and separate from one another. As Wes has silently left the community for the Vibrant (as I understand it - please clarify if you want Wes) I have been unable to contact him.
Consequently I am posting revised version of SimpleRoot for the people whom are new to the community or people who want a more streamlined process that uses Eugene's Clockwork update.zip and Wes' SimpleRoot package. Using Eugene's update.zip fixes problems with gaining root access once you have flashed your ROM (SuperUser APK was apparently missing in Wes').
It's been generally accepted that SimpleRoot is fairly unnecessary once you flash the ENG nbh. There was controversy over the ENG nbh, but Eugene has disproven those opinions. For those of you who still want to use SimpleRoot, here it is.
Download: For Linux v1.5 (4shared).
Download: For Windows v1.5 (4shared).
Changes (for v1.5), they are as follows:
Switched from Wes' update.zip to Eugene's update.zip to eliminate problems gaining root access (SuperUser APK was apparently missing in Wes') after the ROM was flashed.
Changes (for v1.4.1 - WINDOWS ONLY), they are as follows:
Apparently the usb_driver package I had from the Android SDK didn't have the HTC Espresso's hardware IDs present. Added those so it will allow you to use the packaged drivers for device installation.
Added @ECHO off into rootme2.bat.
These changes do not affect the Linux package since the Linux scripts work and Linux doesn't need a special driver.
Changes (for v1.4), they are as follows:
Changed a lot of the text formatting for the Windows scripts, including fixing line feeds, quotation marks, command echoing, and grammatical changes.
Added the most recent copy of the Android SDK's Windows USB driver since users who have never installed the driver need an easier way to get it. (Especially if they are on limited broadband)
Added the USB driver as a requirement in the Windows script since it is a fairly important requirement.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Added a .sh extention to the Linux script filenames.
Added a ./ in front of "adb" in the loop.sh script so it uses the adb in the local directory of the SimpleRoot extracted archive versus erroring out in a loop (in the likely event the user doesn't have adb installed system-wide). This preserves the consistency already in the other scripts.
Packaged the Linux files into a subdirectory in the tar.gz file versus extracting the files into the current directory (which is highly irritating
).
Bumped version number to 1.4.
Added myself into the credits.
Modified the Windows Readme file to reflect the directions provided from the script.
Thanks nbetcher!
As I understand it Wes is working for both devices now, not sure though.
Quick question this worked perfect the first time but when i tried to put a rom on my sd card from clockwork it wouldnt see it when i clicked install from sd so i rebooted and i saw superuser on stock and i couldnt get back into clockwork since then and now i cant re root again it keeps saying device not found any ideas

MID7012 - Kernel Building ERROR - PLS Help!

so far i have downloaded the tcc8902 kernel, it fails to build...
using ubuntu 11.10
am i missing something in my toolchain???
when i "make menuconfig" i get a few error....
and after that i just run "make" it fails.... see image...
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
i would like to finish this build so i can OC this device...
the kernel come pre-setup with the freqtables and voltages from the mid9200
any help would be nice!
would be very nice if it would just build!!!!!
have a look at the cyanogen wiki about setting up your cross compiler.
http://wiki.cyanogenmod.com/wiki/Building_Kernel_from_source
Sent from my Nexus One using XDA App
i will try this.... i understand now, cant build ARM source with out an arm processor, the ia32 doesnt read or write arm source.... wow....
will try later gotta goto school... preparing for a test.... i pray this works, i got a whole ton of people wanting this kernel and android build....
Hi you can still compile for arm on your pc. you just need a compiler that can output arm code.
first download the ARM EABI Toolchain for your computer
then set the environment variable for the arm build toolchain. such as
export CCOMPILER=[extraction directory]/bin/arm-eabi-
then build kernel with new toolchain
make ARCH=arm CROSS_COMPILE=$CCOMPILER menuconfig
make ARCH=arm CROSS_COMPILE=$CCOMPILER -j`grep 'processor' /proc/cpuinfo | wc -l`
and if your .config is correct that should get you a working kernel.
ps. and by your first screenshot it looks like your .config is the default from /boot/config-3.0.0-14.
so back to the wiki with how to get the .config from your android device
adb pull /proc/config.gz /home/user_name/android/kernel/cm-kernel/config.gz
cat config.gz | gunzip > .config
make ARCH=arm CROSS_COMPILE=$CCOMPILER oldconfig
hope that helps and good luck!
Questions or Problems Should Not Be Posted in the Development Forum
Please Post in the Correct Forums
Moving to Q&A
just my luck... i tryed to build the toolchain... and i picked a broken script... stupid download... md5 was correct, just a broken installer script... error code 1 and code 2.... garbage...
recomend any good arm cross-compiler toolchains?
The prebuilt binaries from here should be all you need.
https://sourcery.mentor.com/sgpp/lite/arm/portal/subscription3053
then just make sure to export CCOMPILER=path/to/toolchain/bin/arm-none-eabi-
any progress been made on this? theres a lot of delveopment happening over at the KTZ Forums but not much about developing kernels. you should take a peak.
LemonHead2089 said:
any progress been made on this? theres a lot of delveopment happening over at the KTZ Forums but not much about developing kernels. you should take a peak.
Click to expand...
Click to collapse
I second that, I need a kernel that is OC-able since this rubbish wont run faster than 720mhz.
Has anyone been able to run ICS on this? Any other roms other than the KTZ ones? I really don't like them to be honest (I do appreciate their work) but I would prefer CM7 or something similar, maybe something very light would also be awesome.

Eclipse Android Development Question

I just installed eclipse and I want to start developing some small apps but it seems that Android Training has not been updated and some of the settings have been changed.
Can someone point out which is the correct project to create for apps?... I've tried all in the picture below but on Android Training it says that "Open the main.xml file from the res/layout/ directory (every new Android project includes this file by default)." when trying to create a user interface, but it isn't there for me.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Any advice?
Its weird!
Which version of Eclipse and Java ?
Have you set the Environment variables for Java ?
Anyways I've never faced this problem, as I'm using Eclipse 3.7 with JDK 1.6
Eclipse: Juno Release
Java JDK 6 update 33
It seems like I cannot create a new project from scratch.. I have to start with one of the prebuilt layouts like in the picture:
Anyone know?
Sorry, I'm not sure what exactly is the problem.
Just check whether you've installed eclipse & android-sdk like this : http://www.youtube.com/watch?v=ZoWVeXizfbo (pretty old video, but its a good one)
Also make sure you've set the Environment variables like this :
(Path should be your JDK installation path)
Th problem is that I cannot create a new blank project with all the basic files in the project.
In the android training it says to that you should have main.xml in /layout, but that only happens when I create an activity with that predefined layout.
Is this the only way to get the the necessary files?
isinisterx said:
Th problem is that I cannot create a new blank project with all the basic files in the project.
In the android training it says to that you should have main.xml in /layout, but that only happens when I create an activity with that predefined layout.
Is this the only way to get the the necessary files?
Click to expand...
Click to collapse
I don't think so, because for creating Widgets, there is no need for Activity. Still you could get the main.xml file. Actually in every projects that I've created, main.xml, strings.xml, manifest.xml etc comes by default. That's why I said 'weird' before. I'm confused with the Eclipse version because I'm still using older version 3.7. But that doesn't mean it will not work in new versions.
I guess there is some error with the ADT plugin, and make sure you've downloaded development tools after connecting android-sdk. The video I posted before is the exact steps for preparing the dev environment. So please make sure you've followed the exact steps.
EDIT: Also, this Thread gives the exact steps, for connecting Eclipse with android-sdk.
Will do and then report back, thanks
Sent from my Galaxy Nexus using Tapatalk 2

[Q] Compile modules with preempt mod_unload ARMv7

I've been trying to compile the nfs module for my generic AML 8726 tablet. My steps have been:
Located and downloaded the kernal source
Set up the Sourcery G++ Lite cross-compiler
Found the .config file for my tablet and did "make meson6smp_android_defconfig" to get the kernel config file
modified the .config file for CONFIG_CROSS_COMPILE, CONFIG_LOCAL_VERSION and set the nfs module to compile
Did "make clean"
Did "make modules"
This produced a nfs.ko module, but it would not load with insmod.
Checking dmesg revealed: "nfs: version magic '3.0.8-g3dd9997-dirty preempt mod_unload ARMv5 ' should be '3.0.8-g3dd9997-dirty SMP preempt mod_unload ARMv7 '"
So everything matched except the cpu architecture.
I then googled around, plus reread the cross-compiler user manual, and figured I needed to set the library to ARMv7-A. I eventually managed that using the linker options to specify the sysroot location.
The module still came out as ARMv5.
Next I tried making the .config file again while setting the library to ARMv7-A ... still ARMv5!!!
So I have to conclude that "preempt mod_unload ARMv5" is being set somewhere else.
I did see one suggestion to add "CONFIG_CPU_V7=y" to the .config file. I tried that, but the compiler just overwrote it during the make.
Can anyone tell me where the %^!&# this is set? Any suggestions would me most appreciated - even ones that don't work out
I managed to work this out myself eventually. Since I noticed a couple of other similar threads, I'll write a brief howto.
BE WARNED!!! The reason the version magic didn't match is because there was no config.gz on my tablet. I thought I managed to locate the correct .config file, but clearly it wasn't. If you need to fiddle with these settings, you're probably in the same situation.
While I was experimenting, my tablet froze a couple of times, but fortunately was fine when I rebooted, since the modules don't load when rebooted from an insmod.
So, if you're still game, here is what I did.
I assume you already have a kernel source and a cross compiler ready. If not, there's a good guide here.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Input "make name_of_your_defconfig" in the consonle. Again, you've probably already got this far if you're reading this.
Don't do the edits from Chui's guide to the .config file yet. The menuconfig will override them anyway.
Input "make menuconfig". The following screen appears. Choose "System type" and hit enter.
On the next screen, choose "ARM system type" (the details may differ depending on your architecture).
On the next screen, change the processor. This is where I had to guess a bit, but I also did some research and ARM Ltd. Versatile Express Family" seemed likely. Make your selection, hit enter, and you will return to the previous screen.
Back on the previous screen, select "Versatile Express platform type" and press enter.
In my case, there was only one choice, but it is important to make sure it was selected (use the space bar), otherwise the SMB menu from the next step won't appear.
Exit twice to get back to the main screen, then select "Kernel Features" and press enter.
On the next screen, select "Symmetric Multi-Processing" (using the space bar). If that option is not there, the cpu you selected does not support SMP; you need to select a different processor.
Exit twice, and a dialog box will appear, asking you it you want to save.
Now, you need to make the other changes to the .config file as described in Chui's guide.
Once you're satisfied with the .config file, input "make modules". You may need to answer a question or two during the process.
Open a second console tab, and cd into where your module is. As root, check the version magic string with "modinfo".
Well, that worked for me, and I now have nfs shares mounted on my tablet :victory: Just remember that if you try this, it is at your own risk!!!

[TOOL][LINUX] AD Tools: apktool, signapk and smali/baksmali v1.0.0 [08 May 2016]

AD Tools - Linux
Android Development Tools for Linux
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Well, I just found my self needing a tool for Linux wich could help me to decompile/recompile my files (apks, dex, jars... etc) so I looked for it but had no luck. Then I said: Ok, if I need it then I'm going to do it! I has been REALLY usefull to me, I hope it can also be usefull to all of you.
Introduction
AD Tools is a very simple but usefull tool to help you with everything related to apks, dex or jars modifications. It includes every function needed: decompiling, compiling, signing... etc.​
Usage
Here are some simple instructions to correctly use AD Tools:
Open AD Tools folder in Terminal and execute the 'ADTools' script.
To execute a script in terminal run this command:
Code:
./script
In our case it would be:
Code:
./ADTools
If you can't execute 'ADTools' file run this command and try again.
Code:
chmod +x ADTools
Take into account AD Tools always uses 'builded', 'decompiled', 'input' and 'signed' folders. Avoid creating more folders to do not get confused.
'input' folder to place the files wich are going to be used. Eg: an apk to be decompiled or classes.dex to be baksmalied.
All decompiled/baksmalied files are found in 'decompiled' folder.
Every builded/recomiled/smalied folder is found in 'builded' folder.
Features
Apktool
Signapk
Smali
Baksmali
Autoscanning files to avoid writting file names
Downloads
AD Tools v1.0.0
Older versions:
AD Tools - AndroidFileHost
Credits
@SuperR. I used his ROM Kitchen script as reference for AD Tools​
XDA:DevDB Information
AD Tools, Tool/Utility for the Chef Central
Contributors
sebastiandg7
Version Information
Status: Beta
Created 2016-05-09
Last Updated 2016-05-09
FAQ and TIPS
PD: I want to hear you about bugs, function requests, improvements you may like... etc. The idea is to have a tool for users made by users. Hope you enjoy it.
nice tool thanks a lot , so far working good
#suggestions
1. adding work spaces and the ability to switch between them

Categories

Resources