Related
I couldn't figure out how to compile a module for stock kernel - I kept getting the following in dmesg:
Code:
<module>: disagrees about version of symbol module_layout
I sent a message to Samsung Open Source Release Center on Friday and received a very helpful response yesterday. Basically, c1_rev02_defconfig contains some debug options that are not set in the actual kernel. These are the options that should not be set in the config:
Code:
CONFIG_DEBUG_PREEMPT
CONFIG_DEBUG_RT_MUTEXES
CONFIG_DEBUG_SPINLOCK
CONFIG_DEBUG_MUTEXES
CONFIG_PROFILING
CONFIG_PERF_EVENTS
CONFIG_PERF_COUNTERS
CONFIG_LATENCYTOP
CONFIG_FTRACE
You can use the attached script to modify all these values (the script was also supplied by Samsung, although it was syntactically incorrect and a couple of modifications were necessary to make it work). I have included a copy of the c1_rev02_defconfig with these modifications.
Using this config, I was finally able to compile modules that can actually be loaded on the device
Kudos to Samsung for sending me this information.
Nice info I guess that will help out the people who had issues with kernel modules on stock ROMs...
jps1974 said:
Kudos to Samsung for sending me this information.
Click to expand...
Click to collapse
No, that is the stuff they should put on their server. Makes you wonder what else they haven't released. Every time they make modifications to the GPL open source code (eg. kernel) and release a new version, they must release the code, and the exact same files they used to build it.
Thanks
That was the info I missed. I have successfully compiled cifs for kf1.
Sent from my GT-I9100 using XDA App
You know guys if there is a basic tutorial available online?.
Thank you!
Hi, I am new to compile modules for android (new to compile kernel anyway)
thanks for your info and config, I am now able to compile modules.
I had a problem on the compiled modules tho, wonder can anyone please point me some direction?
when I insmod the ko, dmesg gives me:
xyz.ko : no symbol version for module_layout
Any hint?
more info, I am compiling like:
I am aiming on compiling to for stock ROM, uname -r > 2.6.35.7-I9100XWKDD-CL161513
- I read, and follow base on http://forum.xda-developers.com/showthread.php?t=1113191
- kernel source from: SHW-M250L kernel source from OSRC, https://opensource.samsung.com/
- .config file of this post, select my wanted modules using make menuconfig
- then make ARCH=arm CROSS_COMPILE=__MYPATH__/bin/arm-none-eabi- modules
Thanks!
Hi,
I'm using insecure kernel :
Code:
#uname -r
2.6.35.7-I9100XWKE2-CL187606
I cross compiled modules using your config file but each time I'm trying to insmod it, I have: failed (Exec format error)
and busybox insmod gives me a invalid module format error
I use the commands :
Code:
make ARCH=arm CROSS_COMPILE=/opt/toolchains/arm-2009q3/bin/arm-none-linux-gnueabi- menuconfig
make ARCH=arm CROSS_COMPILE=/opt/toolchains/arm-2009q3/bin/arm-none-linux-gnueabi- modules
So I don't really know where I'm wrong here
alx5962 said:
Hi,
I'm using insecure kernel :
Code:
#uname -r
2.6.35.7-I9100XWKE2-CL187606
I cross compiled modules using your config file but each time I'm trying to insmod it, I have: failed (Exec format error)
and busybox insmod gives me a invalid module format error
I use the commands :
Code:
make ARCH=arm CROSS_COMPILE=/opt/toolchains/arm-2009q3/bin/arm-none-linux-gnueabi- menuconfig
make ARCH=arm CROSS_COMPILE=/opt/toolchains/arm-2009q3/bin/arm-none-linux-gnueabi- modules
So I don't really know where I'm wrong here
Click to expand...
Click to collapse
can you do a dmesg here?
I "think" I am on a same boat as you are on the error tho.....
I didn't checked dmesg, shame on me !
so the error is :
joydev: no symbol version for module_layout
I used your config file, do I need to fix config each time I update with menuconfig ?
alx5962 said:
I didn't checked dmesg, shame on me !
so the error is :
joydev: no symbol version for module_layout
I used your config file, do I need to fix config each time I update with menuconfig ?
Click to expand...
Click to collapse
dmesg is good to read, we are both compiling the same module (joydev)
the config file is not from me, is from jps1974.
no I don't think you need to fix unless you uses the build_kernel.sh unmod, since it cp the defconfig everytime, still I face the same problem...
Instead of SHW-M250L kernel source from OSRC, I just did a quick change to GT-I9100_HK_Opensource.zip
A little bit different on the package, but still the same work flow and results...
.config file:
cp ~/sgs2/9100i_hk/arch/arm/configs/c1_rev02_defconfig ~/sgs2/9100i_hk/kernel/.config
./fix_config.sh
make ARCH=arm CROSS_COMPILE=[PATH_TO_G++LITE_BIN] modules
compile without problem, but no luck, insmod still report:
insmod: init_module '/lib/modules/joydev.ko' failed (Exec format error)
dmesg | grep joy report:
joydev: no symbol version for module_layout
Any help, any directions?
Thanks in advance!!!
I used the european I9100 source from the samsung site and the config file from the opening post when I successfully compiled my modules.
Sent from my GT-I9100 using XDA App
richyy74 said:
I used the european I9100 source from the samsung site and the config file from the opening post when I successfully compiled my modules.
Sent from my GT-I9100 using XDA App
Click to expand...
Click to collapse
YES SIR, will do try this src next!!!!!
richyy74 would u mind share with us which kernel are you at on your phone?
and which version of toolchain u are using on the compile?
Thanks.
A bit of update, just try with GT-I9100_Opensource.zip, nope, still no luck........
I start to think would that be problem of toolchain (which in the readme of the zip from Samsung, they are using 2009q3 while I am using the current 2011 build), or it is possible problem because my/our unsecure kernel (2.6.35.7-I9100XWKDD-CL161513)...
update: Roll back on 2009q3, nope, no luck.............
I can only thinks that it is due to the kernel I am using.............
I compiled for ke7 and kf1 cifs, slow-work and cpu governor modules.
I used the 2009 gnu/linux toolchain from codesourcery /it ends with 67 something/
I never succeded with the version mentioned in the readme.
Sent from my GT-I9100 using XDA App
richyy74 said:
I compiled for ke7 and kf1 cifs, slow-work and cpu governor modules.
I used the 2009 gnu/linux toolchain from codesourcery /it ends with 67 something/
I never succeded with the version mentioned in the readme.
Sent from my GT-I9100 using XDA App
Click to expand...
Click to collapse
Thanks for your direction, will do more test after my "should have slept" 5 hours session.... which end up in data center instead of bed...
utp said:
Thanks for your direction, will do more test after my "should have slept" 5 hours session.... which end up in data center instead of bed...
Click to expand...
Click to collapse
The "exec format error" means that you compiled it for the wrong architecture.
To see which arch the kernel module was compiled for, use the "file" command (found on any Linux computer but not present on the phone itself).
The file command is an extremely useful function for identifying files.
So, at a terminal, type:
Code:
file -k /user/home/output/example.ko
It should output information on the file, which will clarify whether it was statically built, which architecture, etc. Examples:
Dynamically linked executable:
Code:
"ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), not stripped"
Statically linked executable:
Code:
"ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, stripped"
Object file:
Code:
"ELF 32-bit LSB relocatable, ARM, version 1 (SYSV), not stripped"
Most importantly, if it doesn't say 32bit ARM, it will not work.
So the module I cross-compiled gives me :
joydev.ko: ELF 32-bit LSB relocatable, ARM, version 1 (SYSV), not stripped.
So it was correctly compiled, I may need to try another toolchain.
Using Sourcery G++ Lite 2009q3-68 for ARM EABI toolchain, still have the issue.
So as I use an insecure kernel, I may need to ask the author what compiler he used for it.
Made the CM wiki a little easier to understand. Most is taken from here:
http://teamhacksung.org/wiki/index.php/CyanogenMod9:GT-I9100:How_to_build
First off you will need Ubuntu 64-bit for this to work (or one of the many ubuntu editions) I recommend the 11.10 version (will work on 10.x also), as it's the newest stable to date. 32-bit won't work. I'm using Xubuntu 64 bit, and it uses the same terminal codes of course.
Install ADB
Install the Android SDK.
NOTE: You do not need to setup the SDK with an ADV etc., just download and install to get the tools (e.g. adb).
Install the Build Packages
Open the terminal in ubuntu and paste the following code snippets:
To add sun-java to repo (works on various ubuntu versions):
Code:
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
To get the needed build packages:
Code:
sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk pngcrush schedtool g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline5-dev gcc-4.3-multilib g++-4.3-multilib
NOTE: gcc-4.3-multilib g++-4.3-multilib is no longer available for Ubuntu 11.04/11.10 64-bit, but should still build without issue. On 11.10 lib32readline5-dev is no longer available, but lib32readline-gplv2-dev is there instead. Just install it with "apt-get install lib32readline-gplv2-dev"
Create the Directories
You will need to set up some directories in your build environment.
To create them paste these in terminal:
Code:
mkdir -p ~/bin
mkdir -p ~/android/system
Install the Repository
Enter the following in terminal to download make executable the "repo" binary:
Code:
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
NOTE: You may need to reboot for these changes to take effect.
Now enter the following to initialize the repository:
Code:
cd ~/android/system/
repo init -u git://github.com/CyanogenMod/android.git -b ics
repo sync -j16
Retrieve the galaxys2 repo
Code:
. build/envsetup.sh
brunch cm_galaxys2-userdebug
Copy proprietary files
NOTE: This only needs to be done the first time you build, but it's recommended to redo it when TeamHacksung makes some changes to these in their nightlies (which may occur quite often as of now)..
You will need to have a galaxys2 with the latest nightly of CM9 installed, and ADB working on the computer. This script will copy the proprietary files from the device.
Connect the device to the computer and ensure that ADB is working properly.
Paste this into terminal:
Code:
cd ~/android/system/device/samsung/galaxys2/
./extract-files.sh
NOTE: If some hardware isn't working, like camcorder or FM radio, you will need to find the updated prop blobs.
Get prebuilts
Code:
~/android/system/vendor/cm/get-prebuilts
Building CyanogenMod
First, check for updates in the source:
Paste into terminal:
Code:
cd ~/android/system/
repo sync
Configure Build & Compile
Now, the environment must be configured to build and the ROM compiled, from code, for the galaxys2.
Paste into terminal:
Code:
. build/envsetup.sh && brunch cm_galaxys2-userdebug
--------------------
End of tutorial
--------------------
Nice guide, just installed ubuntu on my VAIO to do this kind of stuff.
Thnx
On to setting stuff up...
You should consider getting the build script (build.sh) from teamhacksung's github (https://github.com/teamhacksung/buildscripts) and placing it in your android/system folder.
It allows you to use commands like ./build.sh [devicename] [kernel] to build the version of CM7 you want and optionally will compile your own kernel (if you also have the c1 and aries kernel source)
Other commands it supports:
./build.sh clean - to clear the output folders for a clean build
./build.sh prepare - to pull the latest version of Rom Manager
When I build for the SGS2 my sequence of events are always:
repo sync -j16
./build.sh clean
then either:
./build.sh galaxys2 kernel
if kernel code has changed, or
./build.sh galaxys2
if kernel code has not changed.
Click to expand...
Click to collapse
And after the mentioned build sequence posted above to finalize everything you run the command "build/envsetup.sh && brunch galaxys2" or is that obsolete now ?
HarryRag said:
And after the mentioned build sequence posted above to finalize everything you run the command "build/envsetup.sh && brunch galaxys2" or is that obsolete now ?
Click to expand...
Click to collapse
run all those in terminal... Remember the .
Sent from my GT-I9100 using XDA Premium App
HarryRag said:
And after the mentioned build sequence posted above to finalize everything you run the command "build/envsetup.sh && brunch galaxys2" or is that obsolete now ?
Click to expand...
Click to collapse
If you use the teamhacksung build.sh script then, yes, it is obsolete.
Novek said:
Remember the .
Click to expand...
Click to collapse
Yes, don't forget the period (.) at the start of the ./build.sh command or it won't run.
I was indeed revering to the build.sh from teamhacksung, thnx.
Got another question, is about: repo sync -j16
What does the -j16 stand for?
I'm aware of the . from ./ , just using linux for the first time to do this kind of stuff, using it a few years now for game/web server and playing some around with it.
Novek said:
First of, this is a re-written guide from the cyanogenmod wiki found here. All credit goes to them!
Click to expand...
Click to collapse
the link you gave is for sgs1.
change it with this: http://wiki.cyanogenmod.com/wiki/Samsung_Galaxy_S_II:_Compile_CyanogenMod_(Linux)
HarryRag said:
Got another question, is about: repo sync -j16
What does the -j16 stand for?
Click to expand...
Click to collapse
To be honest, I don't know. I tried searching the man pages etc but could never find the answer. I use it because it is what is listed on the CM wiki. I have also seen people use -j40 or no setting. They all work.
NISIM2337 said:
the link you gave is for sgs1.
change it with this: http://wiki.cyanogenmod.com/wiki/Samsung_Galaxy_S_II:_Compile_CyanogenMod_(Linux)
Click to expand...
Click to collapse
Yes, the SGS2 wiki page was published today. It does not contain the teamhacksung buildscript details though as that is specific to teamhacksung.
Well just made to build my first Kang using ./build.sh galaxys2 kernel
Just for now i'm testing to see what the difference is with the other building options.
For doing the ADB install part i started with a Howtoforge page about setting up android app builds since it has a good and very detailed part on how to exactly do all the adb installing stuff etc. (which would stand for this part of the turorial *Install ADB*), very newby friendly
HarryRag said:
What does the -j16 stand for?
Click to expand...
Click to collapse
I think it's the number of the simultaneous connections that will be opened to the server.
Code:
echo "Example: ./build.sh galaxys2 (prebuilt kernel + android)"
echo "Example: ./build.sh galaxys2 kernel (kernel + android)"
As i understand the following from build.sh good. It means that with just the "./build.sh galaxys2" is for stock CM7 kernel as from the source/github after running the sync.
but is "./build.sh galaxys2 kernel (kernel + android)" then for an custom made kernel with tweaks or is this one just for when there is a (bigger) update for the CM7 kernel?
I think you should realse a rom based on cm.
Sent from my GT-I9100 using Tapatalk
Removed...
DvTonder said:
Yes, the SGS2 wiki page was published today. It does not contain the teamhacksung buildscript details though as that is specific to teamhacksung.
Click to expand...
Click to collapse
ok, sorry.
Don't remove anything, don't except defeat, everyone is equal here!
Sent from my Samsung Galactic iPhone Killing Machine S II
Novek said:
Removed due to public harrasment from the "pros"...
Click to expand...
Click to collapse
Wow, that is unexpected! And unfortunate! I was going to follow your extensive guide this evening, such a shame you took it away. I did not notice any harassment here, but i'm sorry you felt it. Hope maybe you and the "pros" can sort this out, because i think such a topic would be really valuable here!!!
mbroeders said:
Wow, that is unexpected! And unfortunate! I was going to follow your extensive guide this evening, such a shame you took it away. I did not notice any harassment here, but i'm sorry you felt it. Hope maybe you and the "pros" can sort this out, because i think such a topic would be really valuable here!!!
Click to expand...
Click to collapse
Agreed : this has great value
Sent from my GT-I9100 using XDA Premium App
Novek said:
Removed due to public harrasment from the "pros"...
Click to expand...
Click to collapse
Please, give us some names, we will know "pros" who don't like to share with others.
Some advanced devs just want to keep there secrets in order to make believe it's too hard for others ...
They would like us to re-invent everything when it exists already. Thats not my vision of linux freedom ...
Or please say us why they insult you ?
Sent from my GT-I9100 using XDA Premium App
After numerous requests I've received from users concerning how-to build kernels, this guide will mostly answer your need to do so.
This guide will be separated in 3 distinct parts: Downloading sources, Building the actual kernel and making a working boot image and or zImage. So let's begin!!
Requirements: A linux computer
Part 1: Downloading sources
Before bulding any kernels, you must have it's source code. Every Android device manufacturers have the OBLIGATION to post them in order to comply with the GPL (GNU General Public License). You can mostly find them in their developpers specified site. You have two ways of download the required source in order to build a kernel: The manufacturer website or git.
1.1: Downloading using the manufacturer's website
You can download your Galaxy Player kernel source using mostly this website: opensource.samsung.com
When you're in it, you can go to the MP3 players section and take the source according to your device. To get the kernel source, unzip the xxxopensource.zip and you should see 2 separate files. Unzip the one with the mention KERNEL in it, it is your kernel.
1.2: Using git
Some of you may know it, some others not. For those who don't know what git is, here's a little explication from it's website
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Click to expand...
Click to collapse
A lot of developpers from around the world do use git because of it ease of use. There are several websites that uses the git protocol. The two most known are github and gitbucket. In order to download your kernel source, you must have found someone who uploaded it into these websites. For this example we will use the Cyanogenmod github's profile. You can download the source with 2 ways:
First way
1. Go into a existing kernel source repository (for example this one: https://github.com/CyanogenMod/android_kernel_samsung_aries)
2. Click the Download zip button situated at the mid-right
3. Unzip the zip and you should find your kernel source.
Note: When using this method, you must be sure of the branch choosen. Problems can happen if the wrong branch is used.
Second way
Note: You must have the git dependencies for linux. To download them for Debian, Ubuntu, please run this command: sudo apt-get install 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
1. Go into a existing kernel source repository (https://github.com/CyanogenMod/android_kernel_samsung_aries)
2. We're going to "clone" the repository, to do so you will so this particular command:
Code:
git clone https://github.com/CyanogenMod/android_kernel_samsung_aries.git aries
(the second aries word will be the name of the actual folder)
If you want to download another branch (because the one downloaded is the one shown in the website)
Code:
git clone https://github.com/CyanogenMod/android_kernel_samsung_aries.git -b jellybean aries
(where's the -b means branch)
You should have your kernel source named aries output in the folder you specified.
Second part will cover mostly how to build a kernel.
Part 2 Building an actual kernel
In order to build a kernel, you must use an arm toolchain.
The GNU toolchain is a blanket term for a collection of programming tools produced by the GNU Project.
Click to expand...
Click to collapse
Here's a zip containing the arm-eabi-4.4.3 and arm-androideabi-4.6 toolchains
Toolchains Download
2.1 Exporting the toolchain path
Once you've downloaded a toolchain and are ready to build the kernel source into a kernel binary, enter to the directory of that said kernel, (cd aries in this case). You must export the location of your toolchain so the kernel source can know from where it has to build. To do so:
For arm-eabi-4.4.3
Code:
"export CROSS_COMPILE=~/home/yourusername/toolchains/arm-eabi-4.4.3/bin/arm-eabi-"
"export ARCH=arm"
For arm-linux-androideabi-4.6
Code:
"export CROSS_COMPILE=~/home/yourusername/toolchains/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-"
"export ARCH=arm"
2.2 Using a config file
In order to build a kernel, you MUST use a config file which defines the device's components. The easiest way of doing so is to take the manufacturer's stock configuration file (generaly it's a defconfig file found in arch/arm/configs). To create one, you use the make menuconfig command while in your kernel root directory. If you use a different source than your manufacturer one, You have to either ask the developper or to search for this file. (I can't say really much about it ).
2.3 Building the kernel
Once you've your config file and toolchain set up, you can begin the build. To do so you execute these command:
Code:
make cyanogenmod_galaxys_defconfig (This is just as a example, replace it by whatever your defconfig is)
make -jx (x is the number of jobs your computer can do a the same time. The recommended way to know how many to use is to take the number of cores in your CPU +1
Depending on the number of threads (jobs) used, it will be either long or not to compile your kernel. (Generally it takes between 5-15 minutes to compile a single kernel).
Once your kernel have been built, you will have it into the form of a file named zImage situated in arch/arm/boot. This kernel is usable for some devices, however it is not usable for ours. DO NOT EVER EVER FLASH THIS BINARY. I'M NOT RESPONSIBLE FOR ANY BRICKS!!
The third part will help you getting a bootable kernel for your device.
Part 3: Making a bootable kernel
Note: This is a in-progress part so it may be unclear to some people. I will try to do it as much as understandable for everybody.
The kernel binary obtained at the second post is mostly not bootable due to the the fact that the initramfs isn't inclued. The initramfs is the actual ramdisk of your device. To find one... well you must find it (I can't really do anything for you). If you do have one initramfs in a folder, you must specify it in the config file with this current line:
Code:
CONFIG_INITRAMFS_SOURCE=""
Once this has been applied, you can make build this kernel and it should boot
Note that this applies mostly to the model of the 4.0 and 5.0 (and for GB as well). 3.6 and 4.2 uses a different method of using a boot image
One last time...
thanks!! really gonna try this sometimes!!! (once you get part two and three out of the tutorial XD )
If someone is interested in the config file for the Galaxy Player 3.6, he can find it on my GitHub: http://www.github.com/team-hurricane-xda.
How to set it up:
0. Download the config file
1. Rename the config file to aalto-deconfig
2. Copy the file to <kernelsource>/arch/arm/config
3. cd ~/path/to/kernel
4. make aalto-deconfig
5. make
MrBrubble
Sent from my YP-GS1 using xda app-developers app
Build_Error
I've searched and haven't found a straight answer, i get the same build error on every kernel i try to build. Even on this one. Any help is appreciated.
Code:
make: /home/alex/home/alexandroid_toolchains/arm-eabi-linaro-4.6.2gcc: Command not found
scripts/kconfig/conf --silentoldconfig Kconfig
make: /home/alex/home/alexandroid_toolchains/arm-eabi-linaro-4.6.2gcc: Command not found
CHK include/linux/version.h
UPD include/linux/version.h
CC scripts/mod/empty.o
/bin/sh: 1: /home/alex/home/alexandroid_toolchains/arm-eabi-linaro-4.6.2gcc: not found
make[2]: *** [scripts/mod/empty.o] Error 127
make[1]: *** [scripts/mod] Error 2
make[1]: *** Waiting for unfinished jobs....
HOSTCC scripts/selinux/genheaders/genheaders
HOSTCC scripts/selinux/mdp/mdp
make: *** [scripts] Error 2
make: *** Waiting for unfinished jobs..
This is in: file system/usr/include/linux>version.h
#define LINUX_VERSION_CODE 197895
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
Anything in particular that should be here?
Also I have tried to use the linaro toolchains and the one included in the ndk.
2.1 Exporting the toolchain path
Once you've downloaded a toolchain and are ready to build the kernel source into a kernel binary, enter to the directory of that said kernel, (cd aries in this case). You must export the location of your toolchain so the kernel source can know from where it has to build. To do so:
For arm-eabi-4.4.3
Code:
"export CROSS_COMPILE=~/home/yourusername/toolchains/arm-eabi-4.4.3/bin/arm-eabi-"
"export ARCH=arm"
For arm-linux-androideabi-4.6
Code:
"export CROSS_COMPILE=~/home/yourusername/toolchains/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-"
"export ARCH=arm"
2.2 Using a config file
Can you please explain where I need to put the folders/files to make this cmd work. I am using windows7 if that helps. I currently have them in the C:\ thanks. I am hung up here and would greatly appreciate some extra guidance.
po8pimp said:
2.1 Exporting the toolchain path
Once you've downloaded a toolchain and are ready to build the kernel source into a kernel binary, enter to the directory of that said kernel, (cd aries in this case). You must export the location of your toolchain so the kernel source can know from where it has to build. To do so:
For arm-eabi-4.4.3
Code:
"export CROSS_COMPILE=~/home/yourusername/toolchains/arm-eabi-4.4.3/bin/arm-eabi-"
"export ARCH=arm"
For arm-linux-androideabi-4.6
Code:
"export CROSS_COMPILE=~/home/yourusername/toolchains/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-"
"export ARCH=arm"
2.2 Using a config file
Can you please explain where I need to put the folders/files to make this cmd work. I am using windows7 if that helps. I currently have them in the C:\ thanks. I am hung up here and would greatly appreciate some extra guidance.
Click to expand...
Click to collapse
zaclimon said:
...
Requirements: A linux computer
...
Click to expand...
Click to collapse
It's in the OP
seriously I must have totally missed that, I read it over again just to make sure. I will try it again in Ubuntu. Thanks for such a quick reply and apologize for my ignorance. Most things are compiled using Linux, however some I have been doing with windows lately so my assumptions got the best of me it seems. Thanx again
Ok so I am at the point where I need to make the Kernel. I am at this point:
make cyanogenmod_galaxys_defconfig (This is just as a example, replace it by whatever your defconfig is)
My question is which .defconfig do I use and how can I find the current one running on my device? I am assuming the best to fit all different platforms would be to chose the "android_hugo_r03_eng_defcongfig". Is this correct. I currently own the USA model if that helps. However I want to be able to help out all models without building 3 different kernels. Thank you in advance.
Here are the options available:
android_hugop2p_r01_eng_defcongfig
android_hugop2p_r01_user_defcongfig
android_hugop2p_r02_eng_defcongfig
android_hugop2p_r02_user_defcongfig
android_hugop2p_r03_eng_defcongfig
android_hugop2p_r03_user_defcongfig
android_hugo_r01_eng_defcongfig
android_hugo_r01_user_defcongfig
android_hugo_r02_eng_defcongfig
android_hugo_r02_user_defcongfig
android_hugo_r03_eng_defcongfig
android_hugo_r03_user_defcongfig
android_hugo_r03_eng_EUR_defcongfig
android_hugo_r03_user_EUR_defcongfig
android_hugo_r03_eng_KOR_defcongfig
android_hugo_r03_user_KOR_defcongfig
android_hugo_r03_eng_USA_defcongfig
android_hugo_r03_user_USA_defcongfig
po8pimp said:
Ok so I am at the point where I need to make the Kernel. I am at this point:
make cyanogenmod_galaxys_defconfig (This is just as a example, replace it by whatever your defconfig is)
My question is which .defconfig do I use and how can I find the current one running on my device? I am assuming the best to fit all different platforms would be to chose the "android_hugo_r03_eng_defcongfig". Is this correct. I currently own the USA model if that helps. However I want to be able to help out all models without building 3 different kernels. Thank you in advance.
Here are the options available:
android_hugop2p_r01_eng_defcongfig
android_hugop2p_r01_user_defcongfig
android_hugop2p_r02_eng_defcongfig
android_hugop2p_r02_user_defcongfig
android_hugop2p_r03_eng_defcongfig
android_hugop2p_r03_user_defcongfig
android_hugo_r01_eng_defcongfig
android_hugo_r01_user_defcongfig
android_hugo_r02_eng_defcongfig
android_hugo_r02_user_defcongfig
android_hugo_r03_eng_defcongfig
android_hugo_r03_user_defcongfig
android_hugo_r03_eng_EUR_defcongfig
android_hugo_r03_user_EUR_defcongfig
android_hugo_r03_eng_KOR_defcongfig
android_hugo_r03_user_KOR_defcongfig
android_hugo_r03_eng_USA_defcongfig
android_hugo_r03_user_USA_defcongfig
Click to expand...
Click to collapse
In your case, it is more than just using different configs, sometimes there are more than one config because the different variants of the device uses drivers for other components. If you want to make 1 kernel for all the device, you need to modify it's source so that you can include all the variants drivers. Things like this requires a bit of comparing and programming skills.
I have the zImage created, now I need to make it bootable, can someone please fill me in on what is the next step. I have a bootable kernel to use as a shell if need be. Thank you in advance. This is for the 4.2 by the way.
EDIT: Figured it out I think. I am now running off a new kernel. How do I tell what the actual Kernel Version is? I used the toolchain provided here arm-eabi-4.4.3 to build it. Is there a way to know what the kernel version is from the toolchain?
---------- Post added at 11:04 AM ---------- Previous post was at 10:22 AM ----------
Looking at the readme in the folder for the toolchain, it says this is for ICS. If that is correct, then it is a step in the right direction. Here is the download link to the recovery/kernel
EDIT: removed link to kernel as it does not have wifi working.
po8pimp said:
I have the zImage created, now I need to make it bootable, can someone please fill me in on what is the next step. I have a bootable kernel to use as a shell if need be. Thank you in advance. This is for the 4.2 by the way.
EDIT: Figured it out I think. I am now running off a new kernel. How do I tell what the actual Kernel Version is? I used the toolchain provided here arm-eabi-4.4.3 to build it. Is there a way to know what the kernel version is from the toolchain?
---------- Post added at 11:04 AM ---------- Previous post was at 10:22 AM ----------
Looking at the readme in the folder for the toolchain, it says this is for ICS. If that is correct, then it is a step in the right direction.
Click to expand...
Click to collapse
Code:
cat /proc/version
Meticulus said:
Code:
cat /proc/version
Click to expand...
Click to collapse
thanks I will try that
EDIT: Linux version 2.6.35.7 (gcc version 4.4.3 (GCC))
There's an easy way to do whatever's discussed below, except for a) getting the SDK, b) syncing the repos, and c) building the ROM; and that way is using this script. But it's still better to do the steps below manually as it gets you acquainted with the terminal - you'll be using it a lot.
Thanks to @klvnhng for the original tutorial for mako
Credits to him.
You will need:
A computer running Ubuntu with at least 2GB memory and around 40-65 GB of free space
If you don't want to install Ubuntu, run it instead in VMWare Player or VirtualBox.
make sure you provide the virtual machine with the amount of recommended disk space or more
give it no less than 3-4GB of RAM
A (preferably fast) internet connection (trust me, you don't want to do this with a 256 or 512 kbps connection)
Familiarity with Android and Linux. Read up at source.android.com.
Setting up the build environment
1. Install JDK
DO NOT USE OPENJDK. Remove it by entering
Code:
sudo apt-get purge openjdk* icedtea* icedtea-6*
Install Oracle Java 6 by typing this into a terminal:
Code:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java6-installer
Android SDK requires the x86 compatibility packages, ia32-libs. Install it by entering this:
Code:
sudo apt-get -y install ia32-libs
As an alternative, you can also do this (thanks to @jjchico):
Code:
sudo apt-get install lsb-release lib32gcc1 libc6-i386 lib32z1 lib32stdc++6 lib32bz2-1.0 lib32ncurses5
2. Android SDK
Download it here.
Extract it to a folder of your choice (in this guide, I will refer to it as ~/android/sdk).
Enter these commands into the terminal:
Code:
cd ~/android/sdk/adt-bundle/sdk/tools
./android sdk
Click Install packages. cd to ~/android/sdk/adt-bundle/sdk/platform-tools and type:
Code:
./adb
./fastboot
If you've done everything correctly, you should get a big block of text for both (which list all of the adb/fastboot commands).
3. Install required packages
Copy and paste this command into the terminal:
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5-dev \
ia32-libs x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 \
lib32z-dev libgl1-mesa-dev g++-multilib mingw32 \
tofrodos python-markdown libxml2-utils xsltproc readline-common \
libreadline6-dev libreadline6 lib32readline-gplv2-dev libncurses5-dev \
lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 \
libreadline6:i386 bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev \
libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.8-dev
4. Install the repo command
Make directories called bin and android in your home folder, respectively.
Code:
mkdir -p ~/bin
mkdir -p ~/android
Download and setup the repo binary:
Code:
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Now add it to your path:
Code:
export PATH="$PATH:~/bin"
And make sure it belongs in your path between subsequent reboots:
Code:
echo "export PATH="$PATH:~/android/sdk:~/bin"" >> ~/.bashrc
source ~/.bashrc
5. Configuring USB
You must configure USB to detect your Android device(s) properly.
Do this in a terminal:
Code:
curl https://raw.githubusercontent.com/aureljared/build-env-init/master/51-android.rules > ~/bin/51-android.rules
chmod a+r ~/bin/51-android.rules
sudo cp -vfp ~/bin/51-android.rules /etc/udev/rules.d/51-android.rules
6. Syncing up
The next step is to initialize the repository and download the source code to your computer.
Type the following lines into the terminal:
Code:
mkdir -p ~/android/cm-11.0
cd ~/android/cm-11.0
repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0
To download all the necessary device-specific files for our device, do this:
Code:
curl https://raw.githubusercontent.com/aureljared/android-manifests/expresslte-cm-11.0/local_manifest.xml >> .repo/local_manifests/local_manifest.xml
Now run
Code:
repo sync
You have now begun downloading all of the CM source code to your build directory. Depending on your internet speed, this can take from a couple of hours to a few days. If the sync interrupts, don't worry. Simply continue the sync (you don't have to restart completely, only the project you were downloading when the interrupt occured, lol) by entering:
Code:
repo sync
Some tips:
You can interrupt the process by pressing Ctrl + C, it will continue where it left off the next time anyway.
Remember, you need to cd into your build directory (~/android/cm-11.0, if you've been following this guide) for the command to work.
If you want only one project to be synced at a time, run repo sync -j1 instead.
This step takes a long time depending on your internet connection speed (FYI you're downloading ~20 GB of code!)
7. Building CM (yay!)
You must download the necessary pre-built apps:
Code:
~/android/cm-11.0/vendor/cm/get-prebuilts
Now let's build! cd to your build directory and run the following commands in the terminal:
Code:
. build/envsetup.sh
brunch expressltexx
Now, just let your computer do the rest. This step is very demanding for your computer, so you better leave it alone while it builds. Usually this takes an hour or more. Go get some sleep or eat something.
Done? If everything went correctly, cd to ~/android/cm-11.0/out/target/product/expresslte and you should see your newly built ROM entitled:
cm-11.0-20xxxxxx-UNOFFICIAL-expressltexx.zip
Congratulations! You've successfully built CM 11.0!
For re-builds (i.e. when the source code has been updated and you would like to make a new nightly), just do this:
Code:
cd ~/android/cm-11.0
make clobber
repo sync
. build/envsetup.sh
brunch expressltexx
Have fun building!
I suggest you to modify step 5 inserting before repo sync
Code:
mkdir .repo/local_manifests
cd .repo/local_manifests
wget https://raw.github.com/KINGbabasula/android_device_samsung_expresslte/cm-10.2/local_manifest.xml
cd ..
cd ..
This will download the specific necessary repos with repo sync
Then remove this in step 6
Code:
mkdir files
cd files
git clone https://github.com/KINGbabasula/proprietary_vendor_samsung.git
as it isn't needed
And change make clean with make clobber because with clobber it will rebuild faster
EDIT: And before step 6 you need to replace these 2 files with the 2 in the attachment
Code:
system/core/mkbootimg/bootimg.h
system/core/mkbootimg/mkbootimg.c
KINGbabasula said:
I suggest you to modify step 5 inserting before repo sync
Code:
mkdir .repo/local_manifests
cd .repo/local_manifests
wget https://raw.github.com/KINGbabasula/android_device_samsung_expresslte/cm-10.2/local_manifest.xml
cd ..
cd ..
This will download the specific necessary repos with repo sync
Then remove this in step 6
Code:
mkdir files
cd files
git clone https://github.com/KINGbabasula/proprietary_vendor_samsung.git
as it isn't needed
And change make clean with make clobber because with clobber it will rebuild faster
EDIT: And before step 6 you need to replace these 2 files with the 2 in the attachment
Code:
system/core/mkbootimg/bootimg.h
system/core/mkbootimg/mkbootimg.c
Click to expand...
Click to collapse
Original post updated.
Can you help me with ia32-libs?
It says that it's referred to by a handful of other packages but it has no installation candidates or something. The bottom line is that I can't install it.
I'm using 13.10 x64 on an ASUS K43SJ.
- Intel i5-2410M Quadcore (2.3GHz normal, 2.9GHz Turbo Boost)
- 2GB RAM available to Ubuntu VM
Sent from my International Galaxy Express using Tapatalk 4
aureljared said:
Original post updated.
Can you help me with ia32-libs?
It says that it's referred to by a handful of other packages but it has no installation candidates or something. The bottom line is that I can't install it.
I'm using 13.10 x64 on an ASUS K43SJ.
- Intel i5-2410M Quadcore (2.3GHz normal, 2.9GHz Turbo Boost)
- 2GB RAM available to Ubuntu VM
Sent from my International Galaxy Express using Tapatalk 4
Click to expand...
Click to collapse
You have to apt-get install every missing library one by one
Inviato dal mio GT-I9070 utilizzando Tapatalk
aureljared said:
2. Android SDK
Download it here.
Extract it to a folder of your choice (in this guide, I will refer to it as ~/android/sdk).
Enter these commands into the terminal:
Code:
cd ~/android/sdk/adt-bundle/sdk/tools
./android sdk
Click Install packages. cd to ~/android/sdk/adt-bundle/sdk/platform-tools and type:
Code:
adb
fastboot
Click to expand...
Click to collapse
Shouldn't it be
Code:
./adb
./fastboot
Or have you added the sdk to your path?
I guess the compilation process will need the sdk. How does it find the sdk? Do you need to provide the path anywhere?
Thanks for the great tuto.
These are the libs that ia32-libs pulls in that are present in Ubuntu 13.10. This should be equivalent to install ia32-libs in Ubuntu 12.04:
$ sudo apt-get install lsb-release lib32gcc1 libc6-i386 lib32z1 lib32stdc++6 lib32bz2-1.0 lib32ncurses5
---------- Post added at 12:08 PM ---------- Previous post was at 11:29 AM ----------
These are the libs that ia32-libs pulls in that are present in Ubuntu 13.10. This should be equivalent to install ia32-libs in Ubuntu 12.04:
$ sudo apt-get install lsb-release lib32gcc1 libc6-i386 lib32z1 lib32stdc++6 lib32bz2-1.0 lib32ncurses5
jjchico said:
These are the libs that ia32-libs pulls in that are present in Ubuntu 13.10. This should be equivalent to install ia32-libs in Ubuntu 12.04:
$ sudo apt-get install lsb-release lib32gcc1 libc6-i386 lib32z1 lib32stdc++6 lib32bz2-1.0 lib32ncurses5
---------- Post added at 12:08 PM ---------- Previous post was at 11:29 AM ----------
These are the libs that ia32-libs pulls in that are present in Ubuntu 13.10. This should be equivalent to install ia32-libs in Ubuntu 12.04:
$ sudo apt-get install lsb-release lib32gcc1 libc6-i386 lib32z1 lib32stdc++6 lib32bz2-1.0 lib32ncurses5
Click to expand...
Click to collapse
jjchico said:
Shouldn't it be
Code:
./adb
./fastboot
Or have you added the sdk to your path?
I guess the compilation process will need the sdk. How does it find the sdk? Do you need to provide the path anywhere?
Thanks for the great tuto.
Click to expand...
Click to collapse
Updated original post.
Sent from my GT-I8730 using Tapatalk
Thanks. Just note the missing double quotes in the export PATH.
Enviado desde mi GT-I9000 mediante Tapatalk
jjchico said:
Thanks. Just note the missing double quotes in the export PATH.
Enviado desde mi GT-I9000 mediante Tapatalk
Click to expand...
Click to collapse
Haha lol sorry. I was very sleepy when I updated last night.
Updated post.
My repo sync is finished with 65 out of 401 projects. ia32-libs now okay thanks to you @jjchico.
Sent from my GT-I8730 using Tapatalk
I get this
[email protected]:~/android/cm-10.2$ repo init -u git://github.com/CyanogenMod/android.git -b cm-10.2
No command 'repo' found, did you mean:
Command 'repro' from package 'repro' (universe)
Command 'repl' from package 'nmh' (universe)
Command 'repl' from package 'mailutils-mh' (universe)
Command 'rep' from package 'rep' (universe)
repo: command not found
[email protected]:~/android/cm-10.2$
Any ideas? All seemed good before that
Bazzan
Check that repo is in the bin folder in your user main folder.
Check that repo is executable
chmod a+x ~/bin/repo
Enviado desde mi GT-I9000 mediante Tapatalk
"6. Building CM (yay!)"
"In order to make a working build, you have to get the proprietary files (mainly device build files and drivers) for the device."
so how do I get the propriety files and where do I put them? ADB from your phone?
After this you direct us to prebuilt apps so it appears there is a step missing unless I am pulling proprietary files down from KINGbabasula's Github
Bazzan
bazzan said:
"6. Building CM (yay!)"
"In order to make a working build, you have to get the proprietary files (mainly device build files and drivers) for the device."
so how do I get the propriety files and where do I put them? ADB from your phone?
After this you direct us to prebuilt apps so it appears there is a step missing unless I am pulling proprietary files down from KINGbabasula's Github
Bazzan
Click to expand...
Click to collapse
Yeah, the files are located somewhere in KINGbabasula's github. If you want to use ADB then refer to the text file located in android_device_samsung_expresslte.
Or if you want to download the files themselves, do this in a terminal:
Code:
mkdir proprietary
cd proprietary
git clone https://github.com/KINGbabasula/proprietary_vendor_samsung.git
The files will be located in proprietary/proprietary_vendor_samsung/expresslte.
Sent from my GT-I8730 using Tapatalk
Finally got build going. Thanks for the tutorial @aureljared. You were not kidding when you said takes a while. Not too sure where to from here. Welcome suggestions if anyone wants me to try anything
Bazzan
URGENT
Before proceeding to build any more ROMs, let me ask some questions.
What toolchain for building the kernel are you using? Toolchains that might work are arm-eabi-4.4.3 upwards or linaro 4.4.3 upwards.
What is your configuration for the kernel? It is written to a file called ".config" insinde the kernel source.
Have you applied any kind of patch to the code before compiling? If so, what?
Click to expand...
Click to collapse
Thank you for your time. Your answers to the above questions will be highly appreciated and will be of utmost importance. There is also a good chance that we might build a proper kernel with your reports!
:good: :victory:
Sent from my GT-I8730 using Tapatalk
aureljared said:
URGENT
Before proceeding to build any more ROMs, let me ask some questions.
What toolchain for building the kernel are you using? Toolchains that might work are arm-eabi-4.4.3 upwards or linaro 4.4.3 upwards.
What is your configuration for the kernel? It is written to a file called ".config" insinde the kernel source.
Have you applied any kind of patch to the code before compiling? If so, what?
Thank you for your time. Your answers to the above questions will be highly appreciated and will be of utmost importance. There is also a good chance that we might build a proper kernel with your reports!
:good: :victory:
Sent from my GT-I8730 using Tapatalk
Click to expand...
Click to collapse
No toolchain experience at all. Just substituted kernels from elsewhere. Maybe if you are leaning toward Linaro, I should find myself a tutorial for arm-eabi-4.4.3 upwards and give that a go. then we can cover more ground.
Bazzan
bazzan said:
No toolchain experience at all. Just substituted kernels from elsewhere. Maybe if you are leaning toward Linaro, I should find myself a tutorial for arm-eabi-4.4.3 upwards and give that a go. then we can cover more ground.
Bazzan
Click to expand...
Click to collapse
Sure.
I'm not saying that I'm relying on Linaro now, it's just that Linaro is a toolchain developed by a consortium of technology companies including Samsung that aims to build Linux kernels that perform extremely well on mobile devices.
CM 10.2 uses Linaro 12.09, I think.
I tried building with Linaro a couple of days ago but make threw me some errors, the most confusing being something like this
Code:
make [cypress_touchkeys.o] *** Error 2
I don't even know what Cypress is.
Sent from my GT-I8730 using Tapatalk
aureljared said:
Sure.
I'm not saying that I'm relying on Linaro now, it's just that Linaro is a toolchain developed by a consortium of technology companies including Samsung that aims to build Linux kernels that perform extremely well on mobile devices.
CM 10.2 uses Linaro 12.09, I think.
I tried building with Linaro a couple of days ago but make threw me some errors, the most confusing being something like this
Code:
make [cypress_touchkeys.o] *** Error 2
I don't even know what Cypress is.
Sent from my GT-I8730 using Tapatalk
Click to expand...
Click to collapse
Cannot help with Cypress. Some time ago I downloaded a file called GT-I8730_JB_Opensource.zip - not sure where I found it.
It appears to be what is says it is. Within it is a text file called README_Kernel.txt
It has the following
################################################################################
1. How to Build
- get Toolchain
From android git server , codesourcery and etc ..
- arm-eabi-4.4.3
- edit Makefile
edit "CROSS_COMPILE" to right toolchain path(You downloaded).
EX) export CROSS_COMPILE= $(android platform directory you download)/android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
Ex) export CROSS_COMPILE=/usr/local/toolchain/arm-eabi-4.4.3/bin/arm-eabi- // check the location of toolchain
$ export ARCH=arm
$ make msm8930_express_defconfig
$ make
2. Output files
- Kernel : arch/arm/boot/zImage
- module : drivers/*/*.ko
3. How to Clean
$ make clean
################################################################################
Way out of my depth but will try sometime next week to give it a go with arm-eabi-4.4.3. Major interview Monday so nothing before then.
Bazzan
bazzan said:
Cannot help with Cypress. Some time ago I downloaded a file called GT-I8730_JB_Opensource.zip - not sure where I found it.
It appears to be what is says it is. Within it is a text file called README_Kernel.txt
It has the following
################################################################################
1. How to Build
- get Toolchain
From android git server , codesourcery and etc ..
- arm-eabi-4.4.3
- edit Makefile
edit "CROSS_COMPILE" to right toolchain path(You downloaded).
EX) export CROSS_COMPILE= $(android platform directory you download)/android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
Ex) export CROSS_COMPILE=/usr/local/toolchain/arm-eabi-4.4.3/bin/arm-eabi- // check the location of toolchain
$ export ARCH=arm
$ make msm8930_express_defconfig
$ make
2. Output files
- Kernel : arch/arm/boot/zImage
- module : drivers/*/*.ko
3. How to Clean
$ make clean
################################################################################
Way out of my depth but will try sometime next week to give it a go with arm-eabi-4.4.3. Major interview Monday so nothing before then.
Bazzan
Click to expand...
Click to collapse
That's from Samsung. It contains the kernel source as you already have seen
It's stock 3.4.0 so I don't know if it will work with CM :good:
Sent from my GT-I8730 using Tapatalk
Quote from jt1134:
jt1134 said:
I use the d2 family kernel source.
For stock ROMs and CM10, you can use the source and ramdisk provided by samsung.
For CM10.1 or higher, you'll have to get your hands very dirty. IMO the easiest route would be to port the missing drivers from stock samsung source to the msm8930-common kernel, and modifying it to work with them. This is how I did it for the I437 : http://review.cyanogenmod.org/#/c/47947/ . You may then use the serrano device trees as a template once the kernel is ready.
Click to expand...
Click to collapse
Updated first post with this info.
Sent from my GT-I8730 using Tapatalk
There is still no "how to" specific to the LG G2, so I'll try to share the maximum of my experience (or almost) with ["kernel", "build", "LG G2"] here. I'll show two methods different using CM12 kernel, The method for LG ROMs is very similar, I show some tips for LG ROMs also. The first method is the "manual" and second is the "automatic" using my "tool" called DCC. So come on! For this you will need a computer running Linux (x64) and have knowledge about basic Linux commands. I'm using a laptop (i3-2328M and 4GB of RAM) running Ubuntu 14.10 :good:
Setting Up the Environment
First install the essential tools (common environment for those already working with C/C++):
Code:
sudo apt-get install bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop openjdk-7-jdk openjdk-7-jre pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev
Check Java and Java Compiler version:
Code:
java -version && javac -version
If the default Java is 1.6.x, Use this command and select java-7-openjdk as default:
Code:
sudo update-alternatives --config java
Click to expand...
Click to collapse
Setting Up the kernel Environment
Code:
mkdir -p ~/android/mykernel && cd ~/android/mykernel && mkdir out
This will create a folder and two subfolder in your home, Within mykernel folder will get all the tools that we will set up. Now we set the toolchain, Particularly I use Linaro 4.9.3, the version optimized for Cortex-A15 by @Christopher83, so I will use it here.
Clone Linaro GCC 4.9.3:
Code:
git clone https://github.com/Christopher83/arm-cortex_a15-linux-gnueabihf-linaro_4.9
Now the required binaries (Common essential binaries to work with msm8974):
Code:
git clone https://github.com/ferreirawax/mkboot_exec ~/android/mykernel/executables
Clone the RAM disk compiled from CM12:
Code:
git clone -b aosp https://github.com/ferreirawax/ramdisk_g2 ~/android/mykernel/ramdisk
For stock Kitkat:
This RAM disk was extracted from my d805 (d805 is a d802 which was released in latin america), then so will work on the d802, d805 and d806 (d806 is a d802 as the d805) If the variant is another you will have to draw your own device using a tool such AIK or search repositories of other developers.
Click to expand...
Click to collapse
Code:
git clone -b lge https://github.com/ferreirawax/ramdisk_g2 ~/android/mykernel/ramdisk
Now finally the source code of the kernel, Here I will use a configured kernel to compile the code without CM12 source, you can use the source code that is in the official repositories of CM12, but you will face some errors and warnings during the build that can be solved using the commits that are in my source and supply of other developers.
Clone kernel source:
Code:
git clone -b cm-12.0 https://github.com/ferreirawax/kernel_lge_msm8974-patched ~/android/mykernel/msm8974
For stock KitKat:
Code:
git clone -b lge-kitkat https://github.com/ferreirawax/kernel_lge_msm8974-patched ~/android/mykernel/msm8974
Apparently not but we already have a complete environment, see the folders in mykernel to have a shadow on it. Now let's the good part of the story. :fingers-crossed:
Click to expand...
Click to collapse
Compiling
Enter in kernel folder:
Code:
cd msm8974
Export Architecture and Toolchain:
Code:
export ARCH=arm
export CROSS_COMPILE=~/android/mykernel/arm-cortex_a15-linux-gnueabihf-linaro_4.9/bin/arm-eabi-
For stock KitKat you need export LZ4 path:
Code:
export PATH=$PATH:tools/lz4demo
Select the model of the device you want to compile your pointing due defconfig, If you are using source code directly from the repositories of the CM12, defconfig each supported model is called "cyanogenmod_MODEL_defconfig".
Select model to build (In my case I will compile for d802):
Code:
make d802_defconfig
Now let's clear the specific waste of d802:
Code:
make clean && make mrproper
Select model again to generate new .config:
Code:
make d802_defconfig
Now we start to build:
Code:
make -j4
-j4 is suitable for dual-core processors and -j5 for quad-core.
Depending on the configuration of your PC can take up to 20 minutes. In my laptop the build time is about 10 minutes. If you are using VirtualBox, can take much longer. Upon completion, will generate a zImage and some dtb (Device tree binary) files, The dtb files will be used to create a specific image (dt.img) file containing board informations. Now let's create a RAM disk and then dt.img to later put it all together and result in a final boot.img.
Enter in executables folder:
Code:
cd ~/android/mykernel/executables
Create GNUZip compressed RAM disk:
Code:
./mkbootfs ~/android/mykernel/ramdisk | gzip > ~/android/mykernel/out/ramdisk.gz
Create dt.img:
First copy the dtc file that is in executables folder to /usr/bin
Code:
gksu nautilus
This will open the file manager with root privileges, After click the left mouse button and select the dtc as executable.
You may need to restart, After that create the dt.img with the following command.
Code:
./dtbTool -s 2048 -o ~/android/mykernel/out/dt.img ~/android/mykernel/msm8974/arch/arm/boot/
Finally assemble boot.img file:
Code:
./mkbootimg --kernel ~/android/mykernel/msm8974/arch/arm/boot/zImage --ramdisk ~/android/mykernel/out/ramdisk.gz --cmdline "XXXX" --base 0x00000000 --pagesize 2048 --offset 0x05000000 --tags-addr 0x04800000 --dt ~/android/mykernel/out/dt.img -o ~/android/mykernel/out/boot.img
Replace the XXXX for the following:
console=ttyHSL0,115200,n8 androidboot.hardware=g2 user_debug=31 msm_rtb.filter=0x0 mdss_mdp.panel=1:dsi:0:qcom,mdss_dsi_g2_lgd_cmd androidboot.selinux=permissive
Do not remove the quotes. Replace the panel model (red) for your model. if you are compiling for stock KitKat, remove everything that is green.
Click to expand...
Click to collapse
Now let's add a "signature" in your kernel for the damn locked LG G2 bootloader so you can not be invalidated. If you do not do this procedure, the bootloader of your LG G2 will verify that this kernel has a particular signature, as it does not have your device will be unable to boot. We have two tools for this, Loki is able to fool the bootloader and open_bump (This tool is controversy) is able to add a "valid" signature using illegal means. I'll show how to use both. To this is very simple..
open_bump method:
You need Python to run any Python code, open_bump requires Python 2.x
Code:
git clone https://github.com/CyboLabs/Open_Bump
cd Open_Bump && python open_bump.py ~/android/mykernel/out/boot.img
You will now have an output "boot_bumped.img".
loki_tool method:
First get a copy of the bootloader of your G2, For this you need the adb installed and your G2 properly connected to your PC.
Get bootloader:
Code:
sudo apt-get install android-tools-adb
adb devices && adb shell "su -c dd if=/dev/block/platform/msm_sdcc.1/by-name/aboot of=/sdcard/aboot.img"
adb pull /sdcard/aboot.img
Do not forget the USB debugging enabled
Patch kernel:
Code:
./loki_patch boot aboot.img ~/android/mykernel/out/boot.img ~/android/mykernel/out/loki_boot.img
Will generate an output "loki_boot.img" on mykernel/out folder.
You can install using "my easy installer" (Attached at the end of post):
Download the attachment and extracted, Place your boot.img in the delta folder and
copy all the modules that are in your kernel source for the modules folder:
Code:
find ~/android/mykernel/msm8974/. -name "*.ko" -type f -exec cp {} ~/android/mykernel/installer/system/lib/modules \;
Now zip folder and install on your device. This installer already have panel detection script by @dr87
{
"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"
}
Finally now you have your own kernel! Now I will show the second method of how to automatic compile your kernel using my tool.
To rebuild you have to use the following:
Code:
make clean && make mrproper
make MODEL_defconfig
make -j4
Click to expand...
Click to collapse
Some tips
To not export the toolchain path every time you restart the system, Create a Shell executable in /etc/profile.d as follows:
Code:
sudo nano /etc/profile.d/export_gcc.sh
Copy and paste:
export PATH=~/android/mykernel/arm-cortex_a15-linux-gnueabihf-linaro_4.9/bin:$PATH
Click to expand...
Click to collapse
CTRL + X, Y, ENTER
Now you just use:
Code:
export ARCH=arm
export CROSS_COMPILE=arm-eabi-
Useful guides:
If you are new, you can start learning about git, One of the main tools for working with modifications to your kernel. Below I leave some links with some guides that can help you.
How to use Github
How to cherry-pick a github commit
Click to expand...
Click to collapse
DCC is a tool I developed to simplify my day, DCC is just a simple Python code that can help you save your time! See the features:
Command-line arguments like M$'s DiskPart
Real-time Shell executer
Manage builds for AOSP and LG ROMs
Build for single or ALL variants in same time
Manage the parameters of your kernel
DCC works with embedded open_bump
Manage your favorite toolchain
Easy to configure and use
I'll show how to use DCC is easy
Setup kernel environment:
Code:
reset && cd $HOME
mkdir dev && cd dev
git clone https://github.com/ferreirawax/dcc
cd dcc && find . -name '.gitignore' -delete
git clone https://github.com/ferreirawax/ramdisk_g2_aosp ramdisk/aosp
git clone https://github.com/ferreirawax/kernel_lge_msm8974-patched msm8974/aosp
Build kernel:
Code:
python dcc.py
do boot d802
exit
You know what happens to these magical commands? An immediate flashable zip of your kernel ready to flash. But for that you need to "setup" to your taste, see the page on github.
@ferreirawax this is great i was waiting for something like this so much, tommorow i will try your guide and post the results
EDIT
I followed everything and got stuck here:
[email protected]:~/android/mykernel/msm8974$ make clean && make mrproper
make: /home/simex/android/mykenel/arm-cortex_a15-linux-gnueabihf-linaro_4.9/bin/arm-eabi-gcc: Command not found
THANKS for help
EDIT 2
I tried method with DCC and im stuck here:
[email protected]:~/dev/dcc$ python dcc.py
Traceback (most recent call last):
File "dcc.py", line 19, in <module>
from colorama import *
ImportError: No module named colorama
[email protected]:~/dev/dcc$
Sorry if im annoying but i hope someone can help me
Boris31 said:
@ferreirawax this is great i was waiting for something like this so much, tommorow i will try your guide and post the results
EDIT
I followed everything and got stuck here:
[email protected]:~/android/mykernel/msm8974$ make clean && make mrproper
make: /home/simex/android/mykenel/arm-cortex_a15-linux-gnueabihf-linaro_4.9/bin/arm-eabi-gcc: Command not found
THANKS for help
EDIT 2
I tried method with DCC and im stuck here:
[email protected]:~/dev/dcc$ python dcc.py
Traceback (most recent call last):
File "dcc.py", line 19, in <module>
from colorama import *
ImportError: No module named colorama
[email protected]:~/dev/dcc$
Sorry if im annoying but i hope someone can help me
Click to expand...
Click to collapse
This error happens when the toolchain path is wrong.
Colorama module need to use DCC (I forgot to mention that)
Code:
sudo pip install colorama
Really exited to see sutch a complete guide for how to make a kernel for our G2
Will try and see if I can manager to compile my first kernel with this guide today..
ferreirawax said:
This error happens when the toolchain path is wrong.
Colorama module need to use DCC (I forgot to mention that)
Code:
sudo pip install colorama
Click to expand...
Click to collapse
ok thanks i got i working
---------- Post added at 10:43 AM ---------- Previous post was at 10:21 AM --------- @ferreirawax you got a typing mistake here thats why method 1 didnt work i finaly figured it out:
Export Architecture and Toolchain:
Code:
export ARCH=arm
export CROSS_COMPILE=~/android/mykenel/arm-cortex_a15-linux-gnueabihf-linaro_4.9/bin/arm-eabi-
It should be myKERNEL and that it works
Now i succesfully build my kernel but im having problems with bump, i cant get past this:
[email protected]:~$ python open_bump.py ~/android/mykernel/out/boot.img
python: can't open file 'open_bump.py': [Errno 2] No such file or directory
but im sure its there i tryed nearly everything but cant get bumped boot.img
Thank you!!!! I have wanted something like this to compile different kernels .
It would have been totally awesome if @dorimanx did a tutorial once where he shared how he makes his (stock) kernels..anyways will this work on a 11 year old PC with 1gb RAM and 1,7 GHz processor?
any help for bumping boot.img ?
Boris31 said:
any help for bumping boot.img ?
Click to expand...
Click to collapse
http://forum.xda-developers.com/showthread.php?p=56987541
(OP gave cmd lines too)
6ril1 said:
http://forum.xda-developers.com/showthread.php?p=56987541
(OP gave cmd lines too)
Click to expand...
Click to collapse
Yeah thanks i finally got it
Norside said:
It would have been totally awesome if @dorimanx did a tutorial once where he shared how he makes his (stock) kernels..anyways will this work on a 11 year old PC with 1gb RAM and 1,7 GHz processor?
Click to expand...
Click to collapse
This is willpower
Boris31 said:
Yeah thanks i finally got it
Click to expand...
Click to collapse
Now you have what start modifying your kernel!
ferreirawax said:
Now you have what start modifying your kernel!
Click to expand...
Click to collapse
Yeah finally i'v built a kernel now i need to learn to modify it. Any good guide for that maybe
Boris31 said:
Yeah finally i'v built a kernel now i need to learn to modify it. Any good guide for that maybe
Click to expand...
Click to collapse
For that you need to read a little about git, then see the changes made by other developers and place them in your own kernel.
ferreirawax said:
For that you need to read a little about git, then see the changes made by other developers and place them in your own kernel.
Click to expand...
Click to collapse
Thanks, I'm finally beginning to understand Linux terminal commands.
@ferreirawax
I am aware that the rules prohibit posting simple thanks but I feel duty do it here because it is really nice to find shared topics showing how to fish rather than giving fish.
Big thank you to you so, great initiative !
@ferreirawax
Thanks for taking the time to post this. I would love for more people to try their hand at Custom Kernels! Otherwise you end up with the same kernel, different name.
DTB combiner:
Input directory: '/home/bolt890/dev/dcc/msm8974/aosp/arch/arm/boot/'
Output file: '/home/bolt890/dev/dcc/outputs/dt.img'
Found file: msm8974-v2-2-g2-open_com.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag
Found file: msm8974-v2-g2-open_com.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag
Found file: msm8974-g2-open_com.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag
=> Found 0 unique DTB(s)
error: dt.img not found, failed to make target
Keep getting this error
bolt890 said:
DTB combiner:
Input directory: '/home/bolt890/dev/dcc/msm8974/aosp/arch/arm/boot/'
Output file: '/home/bolt890/dev/dcc/outputs/dt.img'
Found file: msm8974-v2-2-g2-open_com.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag
Found file: msm8974-v2-g2-open_com.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag
Found file: msm8974-g2-open_com.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag
=> Found 0 unique DTB(s)
error: dt.img not found, failed to make target
Keep getting this error
Click to expand...
Click to collapse
Seem to lack the DTC binary on your system. Download the attachment and follow:
Code:
sudo cp ~/dtc.zip /usr/bin/dtc
Or you can simply remove the extension and copy the file to /usr/bin any other way, may be necessary to a log-in/out for effect. Then compile again.