Related
After googling this topic and finding nothing, I figured XDA was the place to go. I am looking for a way to get a C++ compiler working on my phone (mytouch slide) or android in general.
Thanks in advance
Que? Like a C++ compiler to compile for android? Why would u want this C++ don't run native on Android it must be called from java so it would be pointless.
There is an sdl port around that required zero knowledge of.java but I believe it still has to compile the java each time. If not it could be possible...
Sent from my Nexus One
I don't want to run the programs on my phone, just compile
Compile for what?
What is the Android NDK?
The Android NDK is a toolset that lets you embed components that make use of native code in your Android applications.
Android applications run in the Dalvik virtual machine. The NDK allows you to implement parts of your applications using native-code languages such as C and C++. This can provide benefits to certain classes of applications, in the form of reuse of existing code and in some cases increased speed.
The NDK provides:
* A set of tools and build files used to generate native code libraries from C and C++ sources
* A way to embed the corresponding native libraries into an application package file (.apk) that can be deployed on Android devices
* A set of native system headers and libraries that will be supported in all future versions of the Android platform, starting from Android 1.5
* Documentation, samples, and tutorials
The latest release of the NDK supports these ARM instruction sets:
* ARMv5TE (including Thumb-1 instructions)
* ARMv7-A (including Thumb-2 and VFPv3-D16 instructions, with optional support for NEON/VFPv3-D32 instructions)
Future releases of the NDK will also support:
* x86 instructions (see CPU-ARCH-ABIS.TXT for more information)
ARMv5TE machine code will run on all ARM-based Android devices. ARMv7-A will run only on devices such as the Verizon Droid or Google Nexus One that have a compatible CPU. The main difference between the two instruction sets is that ARMv7-A supports hardware FPU, Thumb-2, and NEON instructions. You can target either or both of the instruction sets — ARMv5TE is the default, but switching to ARMv7-A is as easy as adding a single line to the application's Application.mk file, without needing to change anything else in the file. You can also build for both architectures at the same time and have everything stored in the final .apk. For complete information is provided in the CPU-ARCH-ABIS.TXT in the NDK package.
The NDK provides stable headers for libc (the C library), libm (the Math library), OpenGL ES (3D graphics library), the JNI interface, and other libraries, as listed in the section below.
The NDK will not benefit most applications. As a developer, you will need to balance its benefits against its drawbacks; notably, using native code does not result in an automatic performance increase, but does always increase application complexity. Typical good candidates for the NDK are self-contained, CPU-intensive operations that don't allocate much memory, such as signal processing, physics simulation, and so on. Simply re-coding a method to run in C usually does not result in a large performance increase. The NDK can, however, can be an effective way to reuse a large corpus of existing C/C++ code.
Please note that the NDK does not enable you to develop native-only applications. Android's primary runtime remains the Dalvik virtual machine.
The ndk allows u to use c++ c/c++ code in Android. That code must be called from java tho.
Sent from my Nexus One
I don't think you guys are understanding his question... He's not looking to write apps for Android... he's writing stuff in C++ (presumably for desktop or maybe other embedded applications, I dunno) and just wants to be able to compile that code on his Android device...
Now as far as an answer to that question, they did kinda cover it... Since pretty much everything in Android runs in Java, I believe it would be pretty difficult to write a C++ compiler that could run on Android.
To install an compiler in your Android device, google around for how to install Debian in it. Don't be afraid, you install it in parallel of Android, you will need a command or terminal window as well (available in the marketplace).
Debian comes with everything you need to compile in your device.
I hope I was useful.
Cheers
Thank you abrigham for clearing that up for me. You are exactly correct.
Ernestus, that seems like it would cause more problems then it would be worth
hmm.. i was googling for this as well.. thought it'll be useful to have this around.
JDV28 said:
Thank you abrigham for clearing that up for me. You are exactly correct.
Ernestus, that seems like it would cause more problems then it would be worth
Click to expand...
Click to collapse
Next best option then is to cross-compile to Android/ARM from another platform. The arm-eabi toolchain provided by Google's NDK is one option as others have already mentioned.
Codesourcery ARM toolchain is another, for Linux i686 theres link to the downloadable archive see this post (search for 'wget THISLINK' text on that page).
- jc
If your looking to corss compile for android, check this link out.
http://teslacoilsw.com/dropbear
Installing debian isn't too bad, and would give you the most flexibility for compiling on the phone.
You could also ssh into another computer using connectbot or some other terminal and code/compile remotely.
Another way to do remote compiles is continuous integration. Edit/upload the file to your repository, and using a server such as Jenkins, run the compile and view the results through the browser or an app such as Hudson2Go. Jenkins will also auto-compile on edits and can send you a text if the build fails. Jenkins is very easy to setup.
Try finding an online c++ compiler or you could connect to a windows or linux machine/server to upload andcompile your c++ files.
JDV28 said:
After googling this topic and finding nothing, I figured XDA was the place to go. I am looking for a way to get a C++ compiler working on my phone (mytouch slide) or android in general.
Thanks in advance
Click to expand...
Click to collapse
Use "c4droid" this is a paid app.. anywy if you like search on the market.
Another alternitiv is out there now. Not sure how good it works.
C / C++ Compiler
im looking for compiler too i found i market a4droid compiler but it costs... and i couldnt find enywhere free apk
Easiest thing to do would be a chroot Linux environment from an existing distribution, like Ubuntu. Then compilers for nearly any language you can think of are an "apt-get install" away.
If you're running CyanogenMod 7, you have a large SD card, and you don't mind repartitioning the SD card and shaving off 2 GB or 4 GB for Linux, then I'll be posting a howto in the next day or two. I have Ubuntu 11.10 Oneiric Ocelot running out of /sd-ext cleanly, using only files from official sources (<32 MB file from cdimage.ubuntu.com and everything else via apt/dpkg with signature verification) rather than from rapidshare-like sites.
Or about a year ago there were instructions posted for unzipping a ~2 GB image containing an older version of Ubuntu downloaded from a filesharing site. You could do that if you have an immediate need.
you can download from my blog
http://dateno1.egloos.com/855501
it from https://market.android.com/details?id=com.n0n3m4.gcc4droid&feature=more_from_developer
it has some library problem but work well (i already compile few binary for my phone )
I think c4droid maches perfectly what you were looking for. I'm using it to work on my projects "on the road" and so far it works pretty well.
A little tricky to set up, since you need "gcc plugin for c4droid" but to choose g++ compiler, and builds are saved at "data/data/com.n0n2m3.c4droid/files/temp" or something like that...
There's another option, but you still have to pay: DroidEdit Pro. Perhaps better editor (didn't test it though) but without it's own compiler, you have to set up an external compiler from sftp server.
Update 03-04-12:
This project moved to:
http://forum.xda-developers.com/showthread.php?t=1529746
---
Update 02-18-12:
Just to clarify: DONT FLASH THIS ZIP-FILE !!! It's NOT a flashable zip.
On sidenote, maybe the bootloop problem is caused by traing to flash this zip ? Maybe the .txt file in there confuses android ? I don't know but DONT flash this! Use manual installation.
---
Would any OP be willing to move this thread to the Ace Development Subforum ? Thanks a lot !
---
Update 02-09-12 (number 2):
The touchscreen sensitivity tweak was removed from the script as suggested by the posters here. It did not work anyway as the path to the files was non-existant.
Attached the updated script with short installation instructions.
---
Update 02-09-12:
I went through the LagFreeV3 script and cleaned it up / optimized it so there are no more useless repetitions of the same commands. Succesful startup of the script was tested using DDMS.
Attached the cleaned up script with short installation instructions.
---
All,
longtime lurker - first time poster here. Since i'm not allowed to post into the Ace Development subforum i have to post right here.
Looks like there are some bugs in Slaid480's latest LagFreeV3 script. On my ace running DDM during boot i can see it erroring out right here:
Code:
02-08 14:26:50.239: I/run-parts(100): /system/etc/init.d/S95LagfreeV3: 351: Syntax error: word unexpected
02-08 14:26:50.239: I/run-parts(100): run-parts: /system/etc/init.d/S95LagfreeV3 exited with code 2
so it's not even running to its EOF due to this error. Looking at he script the lines around line 351 look like this:
Code:
echo ${READ_AHEAD_KB} > /sys/block/mmcblk1/queue/read_ahead_kb
for i in \ `find /data -iname "*.db"` do \ sqlite3
$i 'VACUUM;'
done
echo "6144 87380 524288" > /proc/sys/net/ipv4/tcp_wmem
with " $i 'VACUUM;' " being on line 351. So: i'm not a BASH pro but maybe someone knows what is the syntax error in here and a way to fix it ?
Also by looking at the script there seem to be a lot of lines / functions doing the same things over and over, like setting minfree or readahead_kb - maybe in a community effort it would be possible to consolidate that script into something smaller and more streamlined ?
Just a thought
Yes I think it might have to do with that word.....try deleting the line .
Herpderp Defy.
maybe slaid can give this a clue?
g_BonE said:
...
Also by looking at the script there seem to be a lot of lines / functions doing the same things over and over, like setting minfree or readahead_kb - maybe in a community effort it would be possible to consolidate that script into something smaller and more streamlined ?
Click to expand...
Click to collapse
slaid did exactly that to
One Script To Roll Them ALL
Click to expand...
Click to collapse
I guess while cutting, pasting and reformatting all of known scripts to streamline them, two more newlines were accidentally added here?
Try to edit the above code snippet to
Code:
for i in \ `find /data -iname "*.db"` do \ sqlite[B][COLOR=Red]3[/COLOR][/B] [COLOR=Blue][B]$[/B][/COLOR]i 'VACUUM;'
and see, if it runs till the end. ...
^^
i will give this a try and come back here to post about the results. meanwhile i was also thinking about shuffling through all the parts in the script that essentially do the same thing, dont know if i'd be allowed to clean this up and repost the cleaned version here ?
I'd PM Slaid and ask him. The android spirit is one of openness, as is the spirit of almost all the work on modifying our favourite android ROMs. LagfreeV3 doesn't specify a software licence so it is not clear what slaid's intentions are in terms of modifications to his code. Ideally code should be licenced (and forkable via github) to make these things clearer. I think the broken bits are supposed to be formatted as in the following (the equivalent function in engengis, written more robustly):
Code:
for i in \
`busybox find /data -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
There are other sorts of errors, like the broken hashbang on line 387 (which is just a stock turboboost copy'n'pasted in) -- and yes, loads of places in which lagfreeV3 does something which is then done again by the inline turboboost. As some ROMs include turboboost and lagfree, when they upgrade to V3, things will often be repeated 3 times!!!
Looking at the code a bit is another good reason to try engengis, which combines many tweaks in a flexible system without all the duplication.
iandol said:
...
LagfreeV3 doesn't specify a software licence so it is not clear what slaid's intentions are in terms of modifications to his code.
...
Click to expand...
Click to collapse
There ain't any, because he also only copied it from several sources. You can find there names and "Copyrights" verbatim in there.
iandol said:
...
Looking at the code a bit is another good reason to try engengis, which combines many tweaks in a flexible system without all the duplication.
Click to expand...
Click to collapse
Good find! I'll take a closer look. Like it already, that the options are well explained and documented.
^^
iandol said:
Looking at the code a bit is another good reason to try engengis, which combines many tweaks in a flexible system without all the duplication.
Click to expand...
Click to collapse
Maybe a little out of topic, but what if we want to switch to engengis from lagfix? I have both lagfix and turboboost installed on my stock rom and i'd love to switch to this new tweak, but how? Is removing S95lagfix in /system/etc/init.d good enough?
As i mention in his thread, if u looks closedly u will find more lines actually not working...its maybe taken from other device tweaks
regards,
•ƒγяύs ργяσ™•
Delete S95Lagfree to get rid of lagfreeV3.
87calibration, S95zipalign S98CFSK and S98system_tweak remove turboboost.
Engengis contains the cache dropping (S98CFSK), zipaligning (S95zipalign) and deep tweaks (S98system_tweak) of turboboost, and I delete 87calibration as all it does is delete batterystats the first time it is run which I'd rather not do (and engengis can do this via the commandline control when I choose to).
Engengis also contains the same sqlite3 version as turboboost to optimise the sqlite databases, and performs both a a vacuum and a reindex, which is more thorough optimisation than the lagfree/turboboost combination seems to do...
Alright, after some ~6 hours of fiddling with the lagfree V3 script i managed to get it semi-cleaned up. I'll post the zip-file in my first post of this thread.
Regarding Engengis: I'll have a look at this soon and give it a shot
Touchscreen tweak will not working coz there are no path name like that exist...
regards,
•ƒγяύs ργяσ™•
will try it later on! So still thiscompatible with turboboost? Delete s78touchscreen part from turboboost, right?
Thanks...6 hours is a lot of work dude!
thanks g_BonE -- you still have the touchscreen tweaks in at line250
Reading through the code this is much better than lagfreeV3 original, and should combine better with turboboost...
Thanks for the nudge to the non-working touchscreen tweak. I removed the tweak alltogether and reuploaded the fixed script. See first post
I'll have a go at the turboboost v8.5 script: maybe i can integrate all / most of it into the cleaned LFv3 script. Maybe also the "journaling disabler" script can be integrated as it is just a matter of mount options.
g_BonE said:
Thanks for the nudge to the non-working touchscreen tweak. I removed the tweak alltogether and reuploaded the fixed script. See first post
I'll have a go at the turboboost v8.5 script: maybe i can integrate all / most of it into the cleaned LFv3 script. Maybe also the "journaling disabler" script can be integrated as it is just a matter of mount options.
Click to expand...
Click to collapse
I am really not an expert, not even close, but doing a script with so many lines will probably not have the desired result?
As member pyronia suggested it's better to do small scripts for a specific task than having one for all. Maybe the one for all script would suit devices with more power to process the script?
Anyway, already thanked, glad someone cleaned that script, watching you closely for the updates!
I was used this fix script. But when I check in terminal manager 'a2sd check' the end value min RAM free change to 14xxx, when used lagfixv3 the value is 23xxx.
So actually it's works or not? Thanks
Sent from my GT-S5830 using Tapatalk
Hello g_BonE!
I'm having an issue with your last version (I got stucked in Android Screen). Is there anything I did wrong? I just entered in /system/init.d/deleted s95lagfix and simply copied you s99 with all permissions (with root explorer) and then I got stucked.
What can I do?
Thank you very much for your script!
I knew it there was something fishy with these scripts.LOL Thank you g_BonE for your effort! I'll be hitting the thanks button buddy. Oh and another thing, should I delete V8.5 TurboBoost too?
---------- Post added at 08:38 AM ---------- Previous post was at 08:26 AM ----------
For the people who don't read the instructions:
You should delete S95Lagfree first, located at etc/init.d. Then paste S99_LFv3gB on the same folder (etc/init.d), then set permissions to rwe-rwe-rwe.
I used to think that it should be at rw-r-r sir g_BonE.
itasoulas said:
I am really not an expert, not even close, but doing a script with so many lines will probably not have the desired result?
As member pyronia suggested it's better to do small scripts for a specific task than having one for all. Maybe the one for all script would suit devices with more power to process the script?
Anyway, already thanked, glad someone cleaned that script, watching you closely for the updates!
Click to expand...
Click to collapse
Yeah bro, i test so many script but not all working well coz of too much lines..the devices itself maybe could not read the script properly when too much lines in it, thats why i make a single line script that actually u can see the different...
regards,
•ƒγяύs ργяσ™•
Preface
OK a lot of people have been asking about building kernels, so here is my best shot at a tutorial. I want to preface this all by saying I AM NOT A DEVELOPER. I am a hacker and modder at best, I like doing my own thing, fiddling, and learning what I can, but I don't claim to know/understand everything about the process of building a kernel. You guys shouldn't expect my little walk through here plus another person’s source to make you a "developer", all it will prove is that you can copy/paste. Also if you follow this guide, I am not responsible for anything that you may do that results in destruction, death, or other negative side-affects. You really shouldn't be messing with this stuff unless you know what you are doing, or doing a LOT of research along the way.
However please use this guide as a springboard for knowledge, to give you some key terms to google, to turn on those lightbulbs in your head and get those gears churning.
Note: This is not a newbie's guide to Linux. Before you post your question please look at it. If it involves the syntax of the command/what a command does you need to do your own research elsewhere before attempting to continue with this guide.
Step 1. Build Environment
A. Install Ubuntu 12.04(Not holding your hand here, if you can't do this you shouldn't be messing with kernels)
B. Required packages: git-core, gnupg, flex, bison, gperf, libsdl-dev, libesd0-dev, libwxgtk2.6-dev, build-essential, zip, curl, libncurses5-dev, zlib1g-dev, ia32-libs, lib32z1-dev, lib32ncurses5-dev, gcc-multilib, g++-multilib, and Adb.
C. Open a terminal
D. Type "mkdir android"
E. Type "cd android"
G.Type "mkdir kernel"
The above steps explained:
A. Installing a linux distro. You could really install any Linux distro(Arch = epicness ) however Ubuntu in my eyes is the easy to use and install, and widely supported.
B. Installing needed packages. I believe are these are needed(I'm sure someone will correct if they aren't), these are just the one's I was told I needed the first time I built CyanogenMod. No I can't tell you what every single package does, it is your job to research and figure that out.
C. Ummm...duh?
D-G. Building a directory structure that will help keep us organized. The "mkdir" command creates a directory, and the "cd" command moves you into that directory. You could also combine these steps using the command "mkdir -p android/kernel", however I left it broken apart up there to enforce the typing bit of this. The more you type these commands the more familiar you will become with them.
Step 2. Your Source
A. Open your Terminal Prompt
B. Type "cd android/kernel"
C. Type "git clone git://github.com/DooMLoRD/android_prebuilt_toolchains.git toolchains"
D. Now comes the tricky part, you need to have some-type of source for your kernel. Check the following two sites for your device as appropriate. Once you have it download it is extracted/cloned into a folder in your kernel directory.
http://www.htcdev.com/
http://opensource.samsung.com/
http://developer.sonymobile.com/wportal/devworld/search-downloads/opensource
http://www.lg.com/global/support/opensource/opensource.jsp
The above steps explained: Ok all we are doing here is grabbing some tool chains and the kernel source.
A. Ok...you got this one!
B. Moving into our working directory
C. Grabbing DooMLoRD's very handy pre-built toolchains. What is a toolchain? Check this out http://en.wikipedia.org/wiki/GNU_toolchain. These toolchains are unstable, and as such they aren't completely endorsed yet. They are the versions I use though, and if you would like to use the stable version(4.5.3 as of 07/06/12) you can find links with Google.
D. I typically put my kernel in a directory like "~/android/kernel/<devicename>_<androidversion>_kernel" but that's just me.
Step 3. Modifications
This is the part people are curious about, they want to make modifications to the kernel to make it "special". Start all these from the root directory of your kernel source.
Mod 1. Applying a patch
A. Download the patch you wish to apply, in this case this one should work.
B. Save that file as "kernelPatch" in your kernel directory.
C. Open a Terminal
D. Move into the root directory of the kernel you wish to patch.
E. Type "patch -p1 < ../kernelPatch"
The above steps explained:
A. Pretty simple, I mean we need a patch. The patch itself is quite simply a diff between the original kernel source tree and the source tree containing the changes. I'll post a quick tutorial on how to create a patch in the third post. The patch above contains multiple governors to be added to your kernel.
B. Self-explanatory
C. Self-explanatory
D. Self-explanatory
E. Basically we run the patch command on our source using the patch we downloaded previously. The "patch" portion is the binary itself, the "-p1" option allows you to control the number of forward slashes to remove from file paths(You'll need to look at this option more if you are using weird directory structures or applying the patches from a odd location). The "<" operator directs the content of our "../kernelPatch" file into the command. Mod 2. Adding a Governor Alone
A. Open "drivers/cpufreq/Kconfig"
B. Add the following lines in appropriate spot amongst the other govenor's
Code:
config CPU_FREQ_DEFAULT_GOV_SMARTASS
bool "smartass"
select CPU_FREQ_GOV_SMARTASS
select CPU_FREQ_GOV_PERFORMANCE
help
Use the CPUFreq governor 'smartass' as default.
Code:
config CPU_FREQ_GOV_SMARTASS
tristate "'smartass' cpufreq governor"
depends on CPU_FREQ
help
smartass' - a "smart" optimized governor!
If in doubt, say N.
C. Open "drivers/cpufreq/Makefile"
D. Add the following line in the appropriate spot.
Code:
obj-$(CONFIG_CPU_FREQ_GOV_SMARTASS) += cpufreq_smartass.o
E. Create a file called "drivers/cpufreq/cpufreq_smartass.c"
F. Put the following code in that file.
http://pastebin.com/f0Bk9kVZ
G. open "include/linux/cpufreq.h"
H. Under the "Cpufreq Default" section add
Code:
#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_SMARTASS)
extern struct cpufreq_governor cpufreq_gov_smartass;
#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_smartass)
Ok there is a governor added, do the exact same steps for any other one's you would like to add.
The above steps explained:
A. Just opening a file, you guys have this. The Kconfig ties into our "make menuconfig" command later, making our mod a selectable option.
B. Adding the appropriate code for our governor to get it in our .config file. The first chunk would allow us to set our governor as the default one for our kernel, the other allows us to totally remove or add it to the build as we wish.
C-D. This step tells the linker to tie our module in with the rest of the code.
E-F. Creating the actually governor itself, don't skip this step. I would suggest reading through this and trying to understand how it works, it's some pretty awesome stuff.
G-H. Open a file and add the code needed to tie our module into the rest of the source. Without this we would not be able to compile due to the rest of the source not knowing our module exists.
Step 4. Getting a Config file
Option A. Pulling a config file from a kernel.
A. Hook up a device that is using a kernel similar to one you are using as your base.
B. Open a terminal
C. Change to your root kernel directory
D. Type "adb pull /proc/config.gz"
E. Type "gunzip config.gz"
F. Type "mv config arch/arm/configs/<your_config_name>_defconfig"
The above steps explained:
A. This will allow us to pull a base configuration file from a known working kernel. It makes it a lot easier to start out and let's us take baby steps through the whole process. As a note though not all kernel's support this, so you may have to try a few different one's to get it working. If that doesn't work, see option B.
B. Hehe, you are getting good at this step
C. Navigate to the uppermost directory of your kernel source.
D. Use adb to pull a copy of a working config file to use as your source.
E. Unzipping the config file.
F. Moving the configuration file you pulled to the config directory so we can reference it later. Option B. Using the manufacturers config.
Unfortunately as stated above, not all kernels support the "/proc/config.gz" method. You can typically find a manufacturer's configuration file in "arch/arm/configs". I believe the one for my HTC Flyer was called "flyer_hc_defconfig", so look for a layout similar to that one. Also read the README to get a better idea of how to modify it. I would personally make a copy of it called "<your_config_name>_defconfig" and use that as my base.Step 5. Building
Time to start the real "build" section of this tutorial.
Part A. Pre-build Steps
A. Open terminal and change to the root of your kernel directory
B. Type "export ARCH=arm"
C. Type "export CROSS_COMPILE=~/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-"
Part B. The First Build
A. Type "make <your_config_name>_defconfig"
B. Type "make menuconfig" and make the required changes to use any modules you added or similar changes.
C. Type "make -j<maximum number of jobs>"
Part C. Re-Builds
A. Type "make clean"
B. Type "make oldconfig"
C. Type "make -j<maximum number of jobs>"
Part D. Building Modules
You have two options:
A. Type "make modules"
B. Type "make path/to/your/module.ko"
The above steps explained:Part A.(These steps are required every time you close your terminal and re-open it to build again.)
A. Ok shouldn’t need to explain this.
B. This command sets your target architecture.
C. Defines the path to the toolchain we are going to use to compile our kernel. You can change this to point towards whatever toolchain you have downloaded or feel like using, the way it is currently configured it will use the Linaro toolchain that we downloaded above.
Part B.(These only need to be run the first time you build a kernel.)
A. Load's your configuration file from earlier.
B. Open up a menu to configure your kernel. It will use the config file you loaded in the previous step as a base.
C. Viola start the build. I typically allow 1 job per core, so on my quad core machine I put "make -j4". Just raising that number will not make your build faster, your processor needs to be able to support the number of jobs you are assigning it.
Part C. (Use the command's when you are building any-time outside of the first)
A. This command gets rid of any old/outdated binaries or modules you compiled before, and let's start fresh. I like to run it every I build unless my changes are really small and localized.
B. A very awesome command, it parses through what has changed and only prompts you about new options.
C. See the explanation for the above "Part C.".
Part D.(Use these for just building kernel modules.)
A. This will re-build all modules.
B. Will rebuild just the module you need. Very useful when you need to rebuild a WiFi module.
Step 6. Now what
Ok we have now started our build and we are waiting for it to finish, so there are two possible outcomes:
Outcome A. Build Succeds
W00t!! You have a kernel built by your self from source. There are a couple things you need in-order to use this kernel on your device any ".ko" modules and the zImage binary. If you pay attention to the output of your compiler then you will see the location of those objects. However the following commands will make your life a bit easier(Thanks Recognized Developer Hacre):
A. Open a terminal
B. Change to your root kernel directory
C. Type "mkdir ../<your_kernel>_output"
D. Type "cp arch/arm/boot/zImage ../<your_kernel>_output/zImage"
E. Type "find . -name "*.ko" -exec cp {} ../<your_kernel>_output \;"
The above steps explained:
A-C. Self-Explanatory
D. Move our kernel binary into our output folder
E. This handy bit of magic finds all ".ko" modules and also copies them into your output file.
You will also need to assemble a kernel image containing a initramfs for your device, along with the kernel binary and such. That however is beyond the scope of this tutorial. To get started though try searching the following phrases.
Code:
building android kernel image
xda build kernel image
xda unpack boot.img
Outcome B. Build Fails
Oh dear. It failed. Well guess what...this is going to happen..a LOT. Get used to it, and get used to googling and experimenting with different solutions. The following are some tips that will help you with debugging your issues.
Running a "Clean" build
A. Backup your config file(Type "cp .config ../backupConfig")
B. Re-run the build process using just your defconfig from earlier.
Limiting Output(Thanks Hacre.)
A. Another good tip is to run "make -j1" to get the error, as it will limit the amount of text you need to scroll through.Credits
Hacre-Feedback
cdesai-Feedback
Leedroid-Being willing to answer a noob's question's
Doomlord- Having such handy Git repo's
Enjoy. That's all it takes to build a kernel, it's actually rather simple. I will try to answer what questions I can in this thread, and continue to add to it.
Please Read. The GPL is VERY important.
The Rules as they apply on XDA
As XDA has no legal power to uphold the GPL (and frankly we want to stay as far away from doing so as possible), we can’t force any of our users to abide by the GPL. However it is in XDA’s interests as well as the interests of our developer-base to ensure all GPL-derived materials hosted or linked on XDA comply fully with the GPL.
GPL-derived materials that do not come with the complete sources used to compile the GPL components are considered warez, and will be treated as such under forum rule 6 and 9.
If you use GPL components, but do not make any modifications to them whatsoever, you should provide a link to the original source of your GPL code.
Sources accompanying a release should be complete, and contain all the necessary source code for any modules, scripts or definition files. Complete sources will be defined as those which compile correctly and completely against the platform for which the software is distributed, and which contain any and all modifications made to the released General Public Licenced code. The source code supplied should be the exact version for which the source code is being requested, complete with all modifications.
EXAMPLE: Here’s a bit of code that could be used as a template to post your releases
<Kernel Or Author Name> <Kernel Nr>:
<Source>|<ReadMe>|<Credits>|<Other>
The Very Quick Summary of General Public License (GPL)
The text of the GPL Licence itself will be used to reach any final conclusion regarding any disputes over GPL Licenced materials. The above is a summary of what XDA expects of members using GPL code, and the complete text can be read at the GNU website.
The GPL states that anyone who modifies GPL licenced code is required to make available the sources used to compile it. This is to further improve and encourage collaborative work, as well as to ensure that the best code possible is produced, and to encourage peer-review of all work. This benefits both developers and end users in numerous ways, including:
Allowing anyone to verify the code they are trusting with their data, and its authenticity
Encouraging community collaboration to produce faster fixes and updates, and better code
Helping bring new developments from other devices and fields to your own, letting you benefit from new code that wouldn’t have been available without this sharing.
The GPL imparts great freedom for GPL end users. It ensures innovation is never stifled and no project is dependent upon any single developer.
It is in everyone’s interest for the GPL to be adhered to, as it gives us all better ROMs, better transparency, and a better atmosphere for developers to work together to make great code.
Click to expand...
Click to collapse
Grabbing this on the off chance that this thread takes off.
Tutorial coming on how to make a patch when I have time.(Hopefully later tonight.)
Would you mind if I use this tut to automate Build Kernel in the future for use in my tool StudioAndroid?
Credits will be given!
Sent from my Galaxy Nexus using Tapatalk 2
Go for it, let me know if you have any problems with it.
Sent from my SCH-R760 using Tapatalk 2
Would there be any interest in a tutorial on common Linux CLI tools?
thewadegeek said:
Would there be any interest in a tutorial on common Linux CLI tools?
Click to expand...
Click to collapse
Like what/
Sent from my Galaxy Nexus using Tapatalk 2
Oh find, grep, and sed are all one's I use on a regular basis, we could add a quick walk through on repo/git, maybe vi. And come to think of it talking about shell scripting would probably help out as well, it's pretty commonly used for tweaking around here.
thewadegeek said:
Oh find, grep, and sed are all one's I use on a regular basis, we could add a quick walk through on repo/git, maybe vi. And come to think of it talking about shell scripting would probably help out as well, it's pretty commonly used for tweaking around here.
Click to expand...
Click to collapse
A while ago I wanted to add a BASH guide. I think that it will be greatly appreciated if you create a guide for it.
If you need any help, just PM me
Remember to post 8 "reserved" posts if you create a guide for feature expanding
Sent from my Galaxy Nexus using Tapatalk 2
Hmm I'll start rolling with that then. And as to the 8 posts, I prefer to keep them separated by topic so that I can assume the questions in each thread can pertain to the topic at hand.
definatly want to do this!
one question though how can i get source from lets say FXP's github? i keep getting stuck there
like what directory do i need? staright to the kernel file the have or what/? if thats a yes what directory is it?
this is the git hub https://github.com/freexperia
ur help would be greatly appreciated
Well what type of device do you have? He has multiple kernels there so we need to make sure we grab the right one.
sorry it was arc or "anzu"
it is cm9 kernel im looking to make
or i could use the one from cyanogen mod if thats easier since it has the RC1 kernel
Either would work, just make sure it's for your device. Do you have a ready link to the CM9 one?
thewadegeek said:
Either would work, just make sure it's for your device. Do you have a ready link to the CM9 one?
Click to expand...
Click to collapse
i cant tell which it is cause none of them have arc or anzu in them so i dont know which its for
https://github.com/freexperia/semc-kernel-msm7x30-ics.git maybe
idk cause the have all sony devices on this github..... is it just a couple of files that wil be replaced that are device specific?
Ok...I do not see a kernel in there with Qualcomm MSM8255 support. Is this http://www.gsmarena.com/sony_ericsson_xperia_arc-3619.php your phone?
thewadegeek said:
Ok...I do not see a kernel in there with Qualcomm MSM8255 support. Is this http://www.gsmarena.com/sony_ericsson_xperia_arc-3619.php your phone?
Click to expand...
Click to collapse
yes but its ok i got everything workin i just dont understand step 3 part c....
Open that file, and then add that line. However I'm guessing this kernel has all the Govenor's you'll need for this. Also pay attention to the bit about the GPL, and make sure you ask the original creator's permission.
thewadegeek said:
Open that file, and then add that line. However I'm guessing this kernel has all the Govenor's you'll need for this. Also pay attention to the bit about the GPL, and make sure you ask the original creator's permission.
Click to expand...
Click to collapse
oh sorry i meamnt the next part 3 (seems u have 2) about im talking about getting config file part C
Ah good catch, updated. Ok so you know you created a "android/kernel" folder? In your terminal type "cd ~/android/kernel" and press enter. Then type "ls" and press enter again. Tell me what it says.
I am offen confused with Dex Optimization details. Here are few details i know of.
Kindly correct me if i am wrong ? While exploring the source code, i found that package manager scanns all the external libraries, base frameworks, system packages, and vendor packages for dex optimization.
So, if i understand correct 'dex optimization' can be done both in compilation time and execution time.
Also, surfing in the internet, DISABLE_DEXPREOPT has an impact over this dex optimization when to be done?
Which one do i have to opt?
DISABLE_DEXPREOPT=true
[OR]
DISABLE_DEXOPT=false
while building with the below command
make TARGET=<> droid -j6
According to the source code, i understood if .odex is available as part of .jar or apk file, then it ignores dex optimization, while booting.
Kindly correct me if i am wong?. and suggest.
Hello,
I am trying to build cyanogenmod kernel for an unsupported device. As I learned, the options for kernel build are in the file cyanogenmod_xxx_defconfig.
In that file you have to specify what config you have to use (for example CCONFIG_ARM=y , CONFIG_HAVE_PWM=y). I am experiencing some build problems because if I enable some options there are other config requirements for that for example CONFIG_BT_HCIUART_H4=y requires CONFIG_BT_HCIUART=y. If you build without that there is no clear way of showing you that you are missing that config option and you have to enable it. Sometimes it does say that something is undefined, so I have to search for that word in the sources, find the missing .h file, figure it out what option does it need in the config file (sometimes unsuccessful).
I belive if a map of the config options is available somewhere will greatly help adapting cyanogenmod for other unsuported devices.
for example
CONFIG_BT_HCIUART=y (uses files from kernel\drivers\bt\.... )
|
|---------- CONFIG_BT_HCIUART_H4=y (uses files from kernel\drivers\bt\....)
If you happen to know some documentation on these files will be greatly appreciated, eventually develop a custom tool for setting those options and dependencies.
Thank you for your time.