Hello,
I actually have successfully build some kernels. Mainly, this is the linux way:
- get kernel sources
- get hardware specific changes
- get the toolchain -> i'm using google prebuilt tree, with ARM tool chain 4.4.3 already compiled
- build with usual steps: def_config, configure, kernel, modules
All is ok.
Now, i found Android.mk files. Precisely, a previous kernel, with sensors related to my device, that i would like to port.
But here comes the trouble. I have hard time to do the link between Linux kernel for ARM and Android makefile. I don't see how it goes with my kernel, how i could compile this using the prebuilt tools i could grab from Google.
In short, how to include .mk files into a classic kernel ? What should i get in the end ? A module ? A replacement binary ? More precisely, what is exactly NDK and where it stands in the above layers ?
ARM Linux Kernel <--> Dalvik JVM <--> APK
Last, is it possible with Google prebuilt to compile the .mk without referencing your kernel ?
Thank you !
Thank you for your help
Damn ! Either the questions is too obvious, either it is too complex. Any help ?
Self reply: downloading the NDK is mandatory
- you can use your favorite toolchain, provided with the NDK
- you can embed the .mk into your application, for Eclipse / Android studio, it will use the NDK to compile
Related
This is about the toolchain kindly posted by chulri in http://forum.xda-developers.com/showthread.php?t=891056 . Since I'm apparently not allowed to post in the devel forum (grr), I'm posting this here.
Chulri's instructions work fine, and I've successfully compiled me a kernel with IPv6 support -- thanks chulri. Beware, though, if building userspace binaries -- this toolchain does not create portable Android binaries.
Apparently there are two sets of Linux libraries available on Gen8 devices. The libraries in /lib and /usr/lib depend on uClibc, while the libraries in /system/lib depend on the usual Android "bionic" libc.
The toolchain posted by chulri builds against uClibc; binaries built that way will most likely not work on other Android devices, although they might work on uClibc-based Linux distributions (e.g. OpenWRT). In order to build binaries portable across Android devices, you'll want to use the toolchain included in Google's "Android NDK" (see the file docs/STANDALONE-TOOLCHAIN.html if you don't want to use Google's somewhat idiosyncratic build system).
Since chulri's toolchain is based on uClibc, most Unix utilities build out of the box. Typically, you just need to do:
Code:
cross ./configure --host armel-unknown-linux
make
(A side note -- Archos' libc is compiled with no IPv6 support, just like their kernel.)
Google's toolchain is more tricky, since it uses a non-standard libc. I've been fairly successful with variants of the following command-line:
Code:
make CC=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc CFLAGS="--sysroot $NDK/platforms/android-5/arch-arm -Os -mthumb"
--jch
Wow does this ever seem appropriate for the development threads...
It sure does. Problem is you have to have ten posts before you can post in Dev sections. Real PITA for new users that aren't noobs.
Sent from my HTC Vision using XDA App
Moved to android development
Hello everybody,
I have the Stock kernel for my device and I downlaoded the Cm-Kernel. Is there a way to create a patch containing all the Kerneltweaks from Cm-Kernel for the Stockkernel. I know how to handle diff, but I don't know which files are changed and which I should leave like they are. Or if its easier to patch the device specific configurations to the CM-Kernel?
These are the folders both Kernels contain:
Code:
arch crypto include kernel net security
block Documentation init lib README sound
drivers ipc MAINTAINERS REPORTING-BUGS tools
COPYING firmware Kbuild Makefile samples usr
CREDITS fs Kconfig mm scripts virt
chaoskoch said:
Hello everybody,
I have the Stock kernel for my device and I downlaoded the Cm-Kernel. Is there a way to create a patch containing all the Kerneltweaks from Cm-Kernel for the Stockkernel. I know how to handle diff, but I don't know which files are changed and which I should leave like they are. Or if its easier to patch the device specific configurations to the CM-Kernel?
These are the folders both Kernels contain:
Code:
arch crypto include kernel net security
block Documentation init lib README sound
drivers ipc MAINTAINERS REPORTING-BUGS tools
COPYING firmware Kbuild Makefile samples usr
CREDITS fs Kconfig mm scripts virt
Click to expand...
Click to collapse
If you are going to be using all the cm kernel tweaks anyway, why not just use the cm-kernel? Maybe there is something I am missing.
lithid-cm said:
If you are going to be using all the cm kernel tweaks anyway, why not just use the cm-kernel? Maybe there is something I am missing.
Click to expand...
Click to collapse
But in the Kernel are some device specific information and drivers,
is there a way to get them all in the CM-Kernel?
Or aren't there any and I just need the .config-file?
Sorry if this has been asked/answered before, but the search terms i can think of are too vague, and come up with results on how to compile the repo itself, or a kernel, etc etc.
After setting up my build environment for android, and pulling the repo with 'repo sync', and building it, how would one compile, say, GNU binutils or busybox for android? More specifically, how do i tell the armv7 cross-compiler/linker to link against libs found in the repo tree? (preferably using command line tools, and not "all-in-one" IDE's or graphical front-ends)
Thanks for any help!
Whilst compiling Cyanogenmod I got this error:
Code:
ccache: FATAL: Could not find compiler "arm-eabi-gcc" in PATH.
Based on the manifest
https://github.com/LineageOS/android/blob/cm-12.1/default.xml#L542
the compiler is platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8
from
https://android.googlesource.com/pl...inux-x86/arm/arm-eabi-4.8/+/android-5.1.1_r37
If I add that full path to my PATH variable I can compile the ROM successfully.
However, that seems wrong to me.
The compiler is already part of the source tree.
Shouldn't something in one of the make files or build scripts be setting this rather than me setting it manually?
Note: I am not using a custom toolchain, it is the standard one from aosp.
opticyclic said:
Whilst compiling Cyanogenmod I got this error:
Code:
ccache: FATAL: Could not find compiler "arm-eabi-gcc" in PATH.
Based on the manifest
https://github.com/LineageOS/android/blob/cm-12.1/default.xml#L542
the compiler is platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8
from
https://android.googlesource.com/pl...inux-x86/arm/arm-eabi-4.8/+/android-5.1.1_r37
If I add that full path to my PATH variable I can compile the ROM successfully.
However, that seems wrong to me.
The compiler is already part of the source tree.
Shouldn't something in one of the make files or build scripts be setting this rather than me setting it manually?
Note: I am not using a custom toolchain, it is the standard one from aosp.
Click to expand...
Click to collapse
Toolchains aren't automatically set, at least for now. Possible causes being...
There are multiple versions of Toolchain that are synced together, and it isn't necessary that the newer version of the same toolchain "must" compile the code with success, which was properly compiled by an older version.
Also, by this, the developer has complete freedom to change the ROM/Kernel toolchain.
Coming to the Question in Thread Title, If you're building a ROM, then toolchain has to be added in PATH
Arvind7352 said:
Toolchains aren't automatically set, at least for now. Possible causes being...
There are multiple versions of Toolchain that are synced together, and it isn't necessary that the newer version of the same toolchain "must" compile the code with success, which was properly compiled by an older version.
Also, by this, the developer has complete freedom to change the ROM/Kernel toolchain.
Coming to the Question in Thread Title, If you're building a ROM, then toolchain has to be added in PATH
Click to expand...
Click to collapse
Thanks for clarifying.
Ideally it should scan the source tree for the compiler by default so it has something to fall back to in case a custom one is not specified.
What confused me is that I don't see this nugget of information specified in any of the guides I read about compiling ROMs.
Hi, I'am doing a piece of coursework and I'm working with a Proof Of Concept that utilises the ashmem driver and must be patched for it to work, so I need to compile a new kernel with this patch.
Patching these files in specific, can do this successfully on "android-msm-marlin-3.18-oreo".
(/drivers/staging/android/ashmem.c)
(/include/uapi/linux/ashmem.h)
The main problem comes when I come to compile the kernels, I've yet to have a single successful compile using the Google Git kernel(Both GCC and Clang) as well as compiling the source code of ElementalX ,PureZ and NiKernel.
I've been following this guide using GCC, I've also tried his Clang guide from github: By nathanchance
I seem to get an error in regards to"find: 'arch/arm64/boot/dts': No such file or directory" even though that directory exists. I've also found it hard to debug with the GCC deprecation coming up, is there a flag to remove this?
I'd ideally like to do this myself but if anyone can compile this for me with the patch included that would also be greatly appreciated. The patch can be found: Here
Any assistance would be greatly appreciated