Replace the prebuilt kernel in the Android Platform Source - android

I have successfully built and run a version of the goldfish kernel in the emulator. What I want to do now is include this in the platform source I have. So that I can build and run the platform from scratch with my custom kernel.
I have looked everywhere for help in replacing the kernel that is already there. I believe I need to change the 'TARGET_PREBUILT_KERNEL=' line in a build file somewhere but I can't find the right place.
Any help would be much appreciated.

You don't need to change the configuration files. You can override them at the command line. If you export TARGET_PREBUILT_KERNEL="Path to my zImage" and then build the platform. When you build the platform, it will use your zImage as part of mkbootimg instead of the default.
However, if you did want to change this its under $(ANDROID_ROOT)/device/<my device>/device.mk.
So if you were building for the Galaxy Nexus, you would modify the file device/samsung/tuna/device.mk.

Related

Why do I get Android errors on Qt projects loading?

I do not use any Android features of Qt, my only purpose is to program some little softwares for Windows with minGW and QMake, no other project configurations is relevant for my needs. I'm simply curious if I missed a part, it does not affect the fonctionnality.
Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable
to point to your Android NDK
And a bunch of other errors like that. Its my 4th clean install of 4 different version of Qt bundle, (now I carefully unselect everything except minGW32 and it still showing up!) God's sake why?
Did I missed a part on How to use Qt? Do I need extra-steps to remove it manually on a project creation?
If you want to code for Windows: just setting up your project with default setting (without Android/IOS setting).
If you want to code for Android: The problem was that the file wasn't the correct NDK file. Make sure you get the correct NDK from the website. Other than that it is pretty easy just unzip it and that directory is the root directory.
So if I understand, I can't remove "Android options" from Qt as it is pre-installed for all platforms.
Then yes, even if I don't use it, I must install Android NDK. Then continue to unselect the kit. Then these Error messages will disapear.

Build kernel with AOSP

I would like to build AOSP code while integrating the kernel as well. I followed these instructions: http://jhshi.me/2014/06/30/build-kernel-in-tree-with-aosp-for-nexus-5-hammerhead/
but they seem to be specific to hammerhead. How would I do a full AOSP build with my custom msm kernel source directory (using flo)?
Thanks
I think you can follow the official guide source.android.com/source/building-kernels
to build your custom kernel, then move the binary file(zImage) into device/lge/mako-kernel/(this path is for Nexus 4) in android source code. This will replace the default kernel file.
Of course you need to change the path which is depends on your device.
Finally, build AOSP as usual.

Is there a nice guide to making android apps by hand with just a text editor (e.g. no eclipse ide)?

I want to create apps manually. Using eclipse is the easy way. Using just a text editor is the hard way, but ensure I will know exactly what I'm doing, which is how I like to work.
Are there any good tutorials out there?
EDIT 3:31pm 10/17/2011: I realized what my question should have really been after googling around: Are there any good resources that describe the directory contents of an Android project in detail? The idea here is to be able to create them manually.
Google tells you all about how to manage things from the command line here. Pretty straight forward.
That said, I think I'd have to recommend against going low level here. I used emacs and ant for several months while learning/tinkering with android programming, but it wasn't really that helpful. The whole android system seems designed for use in an IDE: use of XML for layout, automatically generated values in R.java, a big API with many similar sounding names (layouts vs views, OnTouchListener vs OnClickListener), etc. I can't say I really started to get the big picture of the system until I could see it all organized for me. I'm still on the command line for a lot of C/C++, and even some Java stuff too, but all it did for android was cause frustration.
EDIT
Just saw your edit for the directory structure. Check here.
If you must...
First install ant, then assuming sdk/tools is in your $PATH:
android create-project -n projectname -t android-13 -k here.namespace.your -a MyActivity -p projectname
Where android-13 is an installed platform, run android list targets to see which platforms you have. Then run ant release or ant debug to build, or just ant to get a list of possible targets. When you're ready to test, run ant install to install it onto a running emulator or attached device.
See Tools in the dev guide.
Intel xdk. Do the whole app in html, css, php, and javascript. Inel xdk can build it in different platforms.(android, iphone, and windows.)
Yes, there is a way.
See this link:-
http://animeshrivastava.blogspot.in/2017/07/generate-android-app-apk-on-shell-or.html
I am attaching the relevant parts :-
Generation of Android app at command prompt of Windows will be as follows:
Install Java .Only install version 6 standard edition as it is small size compatible with Android.
Next install Android in folder.
Run Android package manager and put Android API level 23 platform tools for version 6 of Android lollipop in directory
.This will have a file Android.jar containing all class files as a library jar for making a DALVIK-EXECUTABLE file run and execute as app on Android lollipop mobile.
Set path environment variable in advance system settings of Windows. Include java-installation in path variable.
Lets use shortcut mypro for my project. Mypkg means my package. Make directory folder
Note that com.pkg is a package where dot or period separates com and pkg sub directories.
In case your package doesn't have this dot or period, then during compilation no error but when you install in mobile, it will say invalid
Now we generate R class for res directory.
enter code hereaapt p -S res -J ./com/pkg -I android.jar

Compiling Unix tools for android

I want to use some unix tools on my rooted android arm6 based phone. I will be using cross compiler tools provided here. If I want to compile gnu netcat, how can I set the cross compiler prefix to arm-none-linux-gnueabi- and how to enable static linking (no shared library).
I managed to cross-compile rsync for Android using Ubuntu's arm-linux-gnueabi toolchain. See this related question.
Unless you particularly need to build against a more standard libc than bionic, you can just use the ndk's toolchain, either by copying the hello-jni example and changing BUILD_SHARED_LIBRARY to BUILD_EXECUTABLE in the jni/Android.mk or using the script to generate a stand alone toolchain. You may want to use the V=1 option to the ndk-build script to see the commands it's issuing to its gcc.
Otherwise you may need to pass the prefix to the configure script or manually edit it into the Makefile for the project. This often has not gone well as many projects have make systems not really set up for cross compiling, I've had to resort to editing the configure script to set prefixes and skip tests where it tries to execute a test program.
An option that sometimes works when the build system is more complicated than the project requires is to do a configure for your host (let's hope that's linux). Then manually edit the generated Makefile to change anything needed to build for android instead. Might not be a bad idea to do a clean just in case (especially if you did a test host build). And then do the build which will pick up the arm compiler from your Makefile modifications.
Lastly, if you can be content with the original netcat by Hobbit rather than the gnu version, you hardly need to port it to android yourself as that's already been done. There's already an android version in the google tree at https://android.googlesource.com/platform/external/netcat
which may be on your device already (as 'nc'), and is definitely included in alternate ROMs such as Cyanogenmod.

Can the android NDK compile kernel module source?

I want make a dynamic loaded kernel module for android.
I don't want to install a linux, I just have cygwin and android NDK.
Yes, it is possible to build kernel modules with the NDK. Note, this works best with a Linux system (I'm told Linux x86_64 is the supported environment) because it's harder to cross-compile kernel code on case sensitive filesystems (such as those that come by default on Windows and Mac systems), and because building kernel modules requires building ELF-manipulation binaries (modpost) which require ELF headers typically only present on Linux.
That said...
First you need to get the source code to the same exact kernel on your device, and make sure that the configuration is the same as your device. (otherwise there's a chance you will confuse the build system)
Second, you need to determine where in your Android NDK the cross-compiler toolchain is. Here's how I found mine:
$ cd $NDK_HOME
$ find . | grep '\-gcc$'
./toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/arm-eabi-gcc
./toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc
(note, $NDK_HOME is where I installed the Android NDK)
Third, you need to add the $NDK_HOME/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin directory (or wherever it is on your system) to your PATH environment variable.
Then you need to export two environment variables:
export ARCH=arm
export CROSS_COMPILE=arm-eabi-
(note, the arm-eabi- prefix is the same as what we saw in the find command. When the kernel is built, commands such as gcc and ld will be prefixed with this. Note, if you were building for an x86 platform I expect you would have to adjust these. I have only built modules for ARM.)
Next, you should compile the kernel. (to do this, I pulled down /proc/config.gz from my Android device, ran zcat config.gz > .config within the kernel source directory, then ran make menuconfig && make.) Kernel build gurus may know some shortcuts here, but I wasn't able to set up the kernel source directory correctly for building a module without doing an actual build. (If the kernel in your build tree matches your device, you don't have to actually update the kernel, you can just insert the modules.)
Last, I used the normal process to build the kernel modules from source. Typically kernel modules will have a parameterized build which will read in the kernel source tree directory somehow, then invoke the build. At that point, as long as the kernel source tree is set up correctly and ARCH and CROSS_COMPILE are set up, your module should build!
Good luck with this. I'm sure there is some per-device variance.
Just now I found this URL where the user has attempted loading LKM and was successful, though on Android (Kernel core: 2.6.29) and I think it was on Linux and not on Cygwin. Hope you get it too!
There is one more resource here and here too!.
All the best!
Follow this URL, Android developer suggests to go for virtual Ubuntu image for this than cygwin.

Categories

Resources