[HOWTO] Compile modules for stock kernels - Galaxy S II Original Android Development

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.

Related

OpenVpn on samsung Galaxy S WI-FI G70 (yp-G70CB)

Hi i have samsung YP-G70
i have been into kernel modules few days but without luck, i need help with compiling TUN.KO
Linux localhost 2.6.35.7-G70XWKP2-CL580645 #2 PREEMPT
Fri Sep 16 11:44:47 KST 20
11 armv7l GNU/Linux
at least i need 2.6.35.7 SDK for yp-g70
i tryied one from opensource.samsung but its for different kernel
I downloaded the kernel source tarball from opensource.samsung.com yesterday and it is the same version as you list above (YP-G70-WW_GB_Opensource.zip).
What version are you seeing?
Also what does "uname -r" give you on the device, as that extra stuff tacked on the end of the kernel version may cause you problems when you create a new kernel + modules (otoh it may not), in which case you'll need to afair modify the kernel Makefile to tack the extra characters on so the module and kernel versions match.
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 35
EXTRAVERSION = .7
NAME =Yokohama
this is original makefile
uname -r gives me
2.6.35.7-G70XWKP2-CL580645
then this is how it will looks like ?
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 35
EXTRAVERSION = .7-G70XWKP2-CL580645
NAME =Yokohama
sorry for stupid question but i'm destroyed from compiling again and again modules 2 day in a row
Yes exactly.
Presumably you''ve also run "make menuconfig" (after either adjusting the Makefile's ARCH and CROSSCOMPILER variables in the file, or by passing them on the command line along with the make command) to enable tun and make sure that anything it requires is also enabled?
Once you've done that I'd expect you're ready to go. If you get kernel oopses then we can work out what's wrong from there.
my step-by-step
i downloaded arm-2011.09-70-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
downloaded YP-G70-WW_GB_Opensource.zip
exported paths and stuff
then vi Makefile
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 35
EXTRAVERSION = .7-G70XWKP2-CL580645
NAME = Yokohama
then make menuconfig
selected tun as module
then make modules
downloaded tun.ko, tun.o to tab
insmod tun.ko
and at this step tab show me an error
insmod: init_module 'tun.ko' failed (Exec format error)
insmod: init_module 'tun.o' failed (Exec format error)
insmod tun.ko
insmod: init_module 'tun.ko' failed (Exec format error)
# uname -r
uname -r
2.6.35.7-G70XWKP2-CL580645
Are you sure that's the right cross-compiler version, because I think you need an older version... (check the README in the kernel source tarball for the exact version.)
hmm then this is what i need
1. Visit codesourcery, download and install Sourcery G++ Lite 2009q3-68 toolchain for ARM EABI.
but on their site, they have only new release
can you help me with this ?
ok i found exatly that version mentioned in README
but now make modules give me error
/bin/sh: /opt/toolchains/arm-2009q3/bin/arm-none-linux-gnueabi-gcc: No such file or directory
make[1]: *** [kernel/bounds.s] Error 1
hmm it looks like its because in .../bin/ there is only arm-none-eabi-gcc
ok i found line in Makefile and edited it to
CROSS_COMPILE ?= /opt/toolchains/arm-2009q3/bin/arm-none-eabi-
now ist completed
i now going to test it on tab
Fluffinko said:
ok i found line in Makefile and edited it to
CROSS_COMPILE ?= /opt/toolchains/arm-2009q3/bin/arm-none-eabi-
now ist completed
i now going to test it on tab
Click to expand...
Click to collapse
same error
insmod tun.ko
insmod: init_module 'tun.ko' failed (Exec format error)
i give up 0:08 , i tried diferent crosscompiler , many setting but without luck, i hope that some of you can help me.
after i succcessfully compile tun.ko i post it here for you guys
See what dmesg says about the module not loading.
Are you sure you need to compile the module? I've just looked at menuconfig for the device and it seems to have TUN/TAP enabled (built-in rather than a module)
I'm using the YP-G70-WW_GB_Kernel source and the venturi_eur_defconfig config as specified in the kernel source README.
lardman said:
See what dmesg says about the module not loading.
Are you sure you need to compile the module? I've just looked at menuconfig for the device and it seems to have TUN/TAP enabled (built-in rather than a module)
I'm using the YP-G70-WW_GB_Kernel source and the venturi_eur_defconfig config as specified in the kernel source README.
Click to expand...
Click to collapse
in dmesg there is no error
i see in /dev/ there is tun & dun device
but how to use it with open vpn ?
maybe related to another problem, i tryed on tab
INSMOD (module that is loaded) and it gave me same problem,
i think this can be related to busybox, i tried different versions but it will show me same error message, is there any other way to load module ?
OPENVPN
yes i have right, busybox is problem with modprobe and stuff i have found workaround
after 10h testing and reading manuals....
VPN.sh
------------------------------------------------------------
su -c "PATH=/system/xbin:$PATH" - #path for ifconfig
su -c "mkdir /dev/net" - #fixing tunctl problems
su -c "ln -s /dev/tun /dev/net/tun" - #linking tunctl for new location
su -c "tunctl" - # create tap0 device
su -c "ifconfig tap0 192.168.1.222" - # set manual IP for tap0 device
su -c "openvpn /sdcard/openvpn/config/FlamcoNet.ovpn" - # openvpn config
------------------------------------------------------------
there is problem with open vpn, it have problem assigning DHCP ip address to tap0
i don't know why

Problems finding/compiling kernel images for Gen9

Hello, does anyone have a working .config file to compile a kernel that will work on the Archos Gen9 or any links to information specific to what is needed for our devices?
I have tried compiling the kernel from the ICS source on ubuntu 11.10 but I am unable to get it to boot and had to work around many errors just to get it to create the zImage.
sirduke989 said:
Hello, does anyone have a working .config file to compile a kernel that will work on the Archos Gen9 or any links to information specific to what is needed for our devices?
I have tried compiling the kernel from the ICS source on ubuntu 11.10 but I am unable to get it to boot and had to work around many errors just to get it to create the zImage.
Click to expand...
Click to collapse
I know where you can found what you want, you gonna filp out, i'm sure of it
in the root folder of the linux-ics kernel is a file called linux.config, now get things compiled and GOOD LUCK
How set environment for build kernel ICS !
sirduke989 said:
Hello, does anyone have a working .config file to compile a kernel that will work on the Archos Gen9 or any links to information specific to what is needed for our devices?
I have tried compiling the kernel from the ICS source on ubuntu 11.10 but I am unable to get it to boot and had to work around many errors just to get it to create the zImage.
Click to expand...
Click to collapse
HI!
First you need to update your environment ( Ubuntu 11.10) with all the neccessary .lib
- sudo apt-get install gnupg flex bison gperf build-essential zip curl zliblg-dev libc6-dev libncurses5-dev x11proto-dev libx11-dev libreadline-dev libgl1-mesa-dev tofrodos python-markdown libxml2-utils xsltproc gettext make info libsdl-dev libxgtk2.6-dev automake
- download your toolchain => http://forum.xda-developers.com/showthread.php?t=1328027
- copy linux.config into /arch/arm/configs/archos_defconfig
For build zImage :
cd into kernel source directory ...
- export ARCH=arm
- export CROSS_COMPILE=/your directory/arm-archos/usr/bin/arm-linux-uclibcgnueabi-
- make ARCH=arm archos_defconfig
- make -j2
**************That's all *******
.....if you not get errors - you should find zImage into /arch/arm/boot/zImage
Thanks for the info, it appears that my problems may be coming from using an outdated toolchain. Basically I am trying to compile an updated kernel that I can run Ubuntu on but so far my kernel does not even boot to the boot menu that I created or the one in the Ubuntu thread that is using fbmenu.
surdu_petru said:
...
- download your toolchain => http://forum.xda-developers.com/showthread.php?t=1328027
- copy linux.config into /arch/arm/configs/archos_defconfig
For build zImage :
cd into kernel source directory ...
- export ARCH=arm
- export CROSS_COMPILE=/your directory/arm-archos/usr/bin/arm-linux-uclibcgnueabi-
- make ARCH=arm archos_defconfig
- make -j2
**************That's all *******
.....if you not get errors - you should find zImage into /arch/arm/boot/zImage
Click to expand...
Click to collapse
I do not know why it will be a huge size of the compiled kernel modules?
Any idea?
szanalmas said:
I do not know why it will be a huge size of the compiled kernel modules?
Any idea?
Click to expand...
Click to collapse
The kernel modules contain some extra symbol information by default.
You may use the strip command to get rid of those.
Search the kernel Makefile for the command, i'm not sure of the function call right now...
Anyway it doesn't matter in the end, because the modules have the same size when they got loaded to RAM.
BTW, if you use my toolchain, you better unpack it in /opt.
There are some hard coded path's in some of the libraries.
If the toolchain is placed somewhere else you might run into trouble.
See this as well... http://forum.xda-developers.com/showpost.php?p=19134490&postcount=8
If someone needs a 64Bit toolchain built please tell me.
Best regards,
scholbert
scholbert said:
The kernel modules contain some extra symbol information by default.
You may use the strip command to get rid of those.
Best regards,
scholbert
Click to expand...
Click to collapse
Yes, thanks, strip working. strip -g -S -d -x -X *.ko and Hawaii!
Hi!
Thanks to the short information on #3 I was able to compile a kernel image of my own. I was curious to see if we can use another toolchain
like the one from Linaro which uses an 4.7 gcc (it has no specific tweaks for archos device like the toolchain from scholbert, I think).
After some modifications of the kernel (thanks google search!!) it compiles and a zImage was generated...which doesn't booted at all (black screen) :-(
Then a hint came up on planet linaro : "Kernel not booting with Linaro GCC?". I tried it yesterday and it boots
--> Don't expect huge speed improvements (if there any). I get very similar results at the quadrant benchmark compared to the kernel provided by surdu_petru.
My patches to the kernel are located at the patch.txt file.
PS: I would like to try out the android-toolchain 4.7 (ICS), which is also provided by linaro.
It compiles, but at the final linker step a
"DIV usage mismatch between arch/arm/boot/compressed/misc.o and output"
is thrown. Maybe we have to wait once the patch is merged into binutils release - any help on this issue?
UPDATE: DIV usage mismatch solution
I found out, that the linker gold produces problems on my kernel build. So I changed the build process to use the bfd linker which compiles the kernel successfully.
Load the android build toolchain:
Code:
wget --no-check-certificate https://android-build.linaro.org/jenkins/view/Toolchain/job/linaro-android_toolchain-4.7-bzr/lastSuccessfulBuild/artifact/build/out/android-toolchain-eabi-4.7-daily-linux-x86.tar.bz2
Extract it:
Code:
tar xfj android-toolchain-eabi-4.7-daily-linux-x86.tar.bz2
Go into that directory and replace ld which points to ld.gold with that binary of ld.bfd:
Code:
cd android-toolchain-eabi
find . -name "*gold"
cp ./bin/arm-linux-androideabi-ld.bfd ./bin/arm-linux-androideabi-ld
cp ./bin/arm-eabi-ld.bfd ./bin/arm-eabi-ld
cp ./arm-eabi/bin/ld.bfd ./arm-eabi/bin/ld
cp ./arm-linux-androideabi/bin/ld.bfd ./arm-linux-androideabi/bin/ld
Then perform a build as normal.

(Q) First time Compiling

Ok, I setup my 2 build boxes. One Ubuntu 11.10x64 and one Mint 11x86. Installed required packages and downloaded multiple toolchains. I have tried compiling on both machines and on both I get the same errors.
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.
make: *** Waiting for unfinished jobs....
CHK include/linux/version.h
I have tried make thunderc_perf_defconfig and get the same error. Copied .config from device dropped into source, same error.
Any ideas on what is going on? I'm new to this so any help would be great.
I don't known, maybe gcc
try checking your mount options?
Nope its not gcc; as I said I have installed all required packages including gcc + bison etc. My mount options? Is that the "export ARCH=arm" ? Where I have to set the default compiler? I'm new to the newer flavors of linux. The last distro I used was Mandrake 7.1 ;-) Now I am testing this on 2 builds; an x64 Ubuntu and a x86 Mint(Which is Ubuntu). I have to be missing something on both, but I have followed tutorials guides to the T and still get this error. I get more errors than this by the way. The compiler kicks back Kconfig saying unexpected line of code.
SgtPropain said:
Ok, I setup my 2 build boxes. One Ubuntu 11.10x64 and one Mint 11x86. Installed required packages and downloaded multiple toolchains. I have tried compiling on both machines and on both I get the same errors.
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.
make: *** Waiting for unfinished jobs....
CHK include/linux/version.h
I have tried make thunderc_perf_defconfig and get the same error. Copied .config from device dropped into source, same error.
Any ideas on what is going on? I'm new to this so any help would be great.
Click to expand...
Click to collapse
I ran a search on your error message about the missing rule to make auto.conf and found this:
https://bbs.archlinux.org/viewtopic.php?id=99089
It relates to the other poster's comment about checking your mount options. It's a short process to fix it.
And if it doesn't work maybe it will at least give you a new error message to research.
glarepate said:
I ran a search on your error message about the missing rule to make auto.conf and found this:
https://bbs.archlinux.org/viewtopic.php?id=99089
It relates to the other poster's comment about checking your mount options. It's a short process to fix it.
And if it doesn't work maybe it will at least give you a new error message to research.
Click to expand...
Click to collapse
just as i thought. that might have happened. its worth a try though.
SgtPropain said:
Nope its not gcc; as I said I have installed all required packages including gcc + bison etc. My mount options? Is that the "export ARCH=arm" ? Where I have to set the default compiler? I'm new to the newer flavors of linux. The last distro I used was Mandrake 7.1 ;-) Now I am testing this on 2 builds; an x64 Ubuntu and a x86 Mint(Which is Ubuntu). I have to be missing something on both, but I have followed tutorials guides to the T and still get this error. I get more errors than this by the way. The compiler kicks back Kconfig saying unexpected line of code.
Click to expand...
Click to collapse
Wrong...
Because you don't have .config file in the source. If you are building kernel from source, you must have the kernel config. That kernel config can be shared in the source code, it depends on that kernel developer, he can shared it in arch/arm/config, access to there then find that kernel defconfig. Or you can get the kernel config of that kernel with another method, but this method just can be applied if the kernel you want to build is for our device: flash that kernel then go to terminal then type:
Code:
su
(Accept the super user)
Code:
cp /proc/config.gz /sdcard
If it show "No such file or directory found" so you should ask that kernel developer for their .config.
If it doesn't show anything, go to sdcard and find if there is a file that named config.gz, it's the kernel config. Get back to terminal then type:
cd /sdcard
gunzip config.gz
Voila!
I actually tried that already.... I have been at this for about three days. XDA was my last resort as I like to figure things out on my own. However I'm stuck @ a brick wall. I have edited /etc/fstab and removed the bs mount options..remounted same error. Mind you I'm doing most of this from a Virtual Environment. Starting to think this is my issue, but it doesn't explain the same error on machine #2. Maybe I'm doing it right, possibly a bad git clone?
thachtunganh said:
Wrong...
Because you don't have .config file in the source. If you are building kernel from source, you must have the kernel config. That kernel config can be shared in the source code, it depends on that kernel developer, he can shared it in arch/arm/config, access to there then find that kernel defconfig. Or you can get the kernel config of that kernel with another method, but this method just can be applied if the kernel you want to build is for our device: flash that kernel then go to terminal then type:
Code:
su
(Accept the super user)
Code:
cp /proc/config.gz /sdcard
If it show "No such file or directory found" so you should ask that kernel developer for their .config.
If it doesn't show anything, go to sdcard and find if there is a file that named config.gz, it's the kernel config. Get back to terminal then type:
cd /sdcard
gunzip config.gz
Voila!
Click to expand...
Click to collapse
Yeah that would be great if I hadn't done that already. In my post I stated I had replaced the .config from my device. I have literately tried everything but doing this from base. IE not from a VM. I appreciate the help but its a "no go".
Beginning of my .config for proof
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.32.9-ck2
# Wed Apr 11 20:41:44 2012
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_GENERIC_GPIO=y
CONFIG_GENERIC_TIME=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_KTIME_SCALAR=y
CONFIG_GENERIC_HARDIRQS=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_ARCH_HAS_CPUFREQ=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
CONFIG_VECTORS_BASE=0xffff0000
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_CONSTRUCTORS=y
Setting up a third independent machine Ubuntu x86 testing..
where do you get that .config from?
pull /proc/config.gz
SgtPropain said:
pull /proc/config.gz
Click to expand...
Click to collapse
What device are you using, and what kernel are you using.
for the time being you can use prebuilt kernel...no need to build kernel from source....
williamcharles said:
for the time being you can use prebuilt kernel...no need to build kernel from source....
Click to expand...
Click to collapse
He isn't building ROM from source. He is learning how to build a kernel from source.
Sorry for the delay; had 2 deaths in the family.
I setup my third box and again I get the same results. I really don't know where I'm going wrong. This kinda makes me lean to, I have bad source code. I'm no pro C programmer; however when building I get Kconfig errors. I opened said file and the comments look all messed up. The compiler I think is reading the comments as code and kicking it back giving me this error.
by the way what are you compiling and please teach me compiling i want to learn it .
I'm compiling a modified kernel for the Optimus V. I can't teach you how to compile because I don't even know if I'm doing it right.

[Q] Kernel Module Compiling Versioning..

I need help guys, I'm really new to this kernel compiling thing (I'm not really even a software engineer..) But anyway, so I have this mini wireless keyboard + mouse I'm trying to get to work on my MK802 II (Allwinner A10). From plugging the wireless dongle into my linux machine, I did an lsmod and determined the drivers to be hid-ortek.ko. And this driver happens to be absent on the MK802 II.
I set up my ubuntu with android sdk and ndk and all the other prereqs from thousands of other sites from googling.
Then I git cloned the Allwinner A10 kernel source from : https://github.com/amery/linux-allwinner and checked out the lichee 3.0.8+ to match the kernel version on my MK802 II.
So then I started off with:
Code:
make ARCH=arm sun4i_defconfig
make ARCH=arm menuconfig
And then I selected Ortek keyboard drivers from the UI and marked it as 'm'.
Because apparently Module.symver is only generated if you do a complete kernel build.. so I did
Code:
make ARCH=arm CROSS_COMPILE=~/Downloads/android-ndk-r8b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- all
And Module.symver is created after this step.
But I looked in the ./drivers/hid folder to see if hid-ortek.ko was compiled and apparently not
so then I did:
Code:
make ARCH=arm CROSS_COMPILE=~/Downloads/android-ndk-r8b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- M=./drivers/hid modules
And my "hid-ortek.ko" was still not created. The output from this was:
Code:
Building modules, stage 2.
MODPOST 0 modules
So I googled up tutorials and created a Makefile that looked like this:
Code:
VERSION = 3
PATCHLEVEL = 0
SUBLEVEL = 8
EXTRAVERSION =
obj-m += hid-ortek.o
KDIR=~/Documents/linux-allwinner
PWD := $(pwd)
default:
make -C $(KDIR) ARCH=arm CROSS_COMPILE=~/Downloads/android-ndk-r8b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- SUBDIRS=$(PWD) modules
clean:
make -C $(KDIR) ARCH=arm CROSS_COMPILE=~/Downloads/android-ndk-r8b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- SUBDIRS=$(PWD) clean
and did a make, that did the trick and hid-ortek.ko was created
So I did the adb push into my MK802 (into /system/vendor/modules folder) and tried insmod it.. but I kept getting
Code:
insmod: init_module 'hid-ortek.ko' failed (Exec format error)
and dmesg tells me that there is "no symbol version for module_layout". Which according to googling around means that Module.symver wasn't generated so I have to do a full build, but I did and I saw Module.symver generated in my kernel source directory. I did a modinfo on the compiled hid-ortek.ko and it shows
Code:
3.0.8+ preempt mod_unload modversions ARMv7
Which should be right. I did a modinfo on the other modules already loaded on the device and shows the exact same thing.
What am I doing wrong here? Please help.
Thanks!
chen_tso said:
I need help guys, I'm really new to this kernel compiling thing (I'm not really even a software engineer..) But anyway, so I have this mini wireless keyboard + mouse I'm trying to get to work on my MK802 II (Allwinner A10). From plugging the wireless dongle into my linux machine, I did an lsmod and determined the drivers to be hid-ortek.ko. And this driver happens to be absent on the MK802 II.
I set up my ubuntu with android sdk and ndk and all the other prereqs from thousands of other sites from googling.
Then I git cloned the Allwinner A10 kernel source from : https://github.com/amery/linux-allwinner and checked out the lichee 3.0.8+ to match the kernel version on my MK802 II.
So then I started off with:
Code:
make ARCH=arm sun4i_defconfig
make ARCH=arm menuconfig
And then I selected Ortek keyboard drivers from the UI and marked it as 'm'.
Because apparently Module.symver is only generated if you do a complete kernel build.. so I did
Code:
make ARCH=arm CROSS_COMPILE=~/Downloads/android-ndk-r8b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- all
And Module.symver is created after this step.
But I looked in the ./drivers/hid folder to see if hid-ortek.ko was compiled and apparently not
so then I did:
Code:
make ARCH=arm CROSS_COMPILE=~/Downloads/android-ndk-r8b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- M=./drivers/hid modules
And my "hid-ortek.ko" was still not created. The output from this was:
Code:
Building modules, stage 2.
MODPOST 0 modules
So I googled up tutorials and created a Makefile that looked like this:
Code:
VERSION = 3
PATCHLEVEL = 0
SUBLEVEL = 8
EXTRAVERSION =
obj-m += hid-ortek.o
KDIR=~/Documents/linux-allwinner
PWD := $(pwd)
default:
make -C $(KDIR) ARCH=arm CROSS_COMPILE=~/Downloads/android-ndk-r8b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- SUBDIRS=$(PWD) modules
clean:
make -C $(KDIR) ARCH=arm CROSS_COMPILE=~/Downloads/android-ndk-r8b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- SUBDIRS=$(PWD) clean
and did a make, that did the trick and hid-ortek.ko was created
So I did the adb push into my MK802 (into /system/vendor/modules folder) and tried insmod it.. but I kept getting
Code:
insmod: init_module 'hid-ortek.ko' failed (Exec format error)
and dmesg tells me that there is "no symbol version for module_layout". Which according to googling around means that Module.symver wasn't generated so I have to do a full build, but I did and I saw Module.symver generated in my kernel source directory. I did a modinfo on the compiled hid-ortek.ko and it shows
Code:
3.0.8+ preempt mod_unload modversions ARMv7
Which should be right. I did a modinfo on the other modules already loaded on the device and shows the exact same thing.
What am I doing wrong here? Please help.
Thanks!
Click to expand...
Click to collapse
Did you change the kernel itself ?
'no symbol version for module_layout'
Hello, I have the exact same issue (but using kernel "2.6.36-android+")
did you find a solution?
Im also in the same boat guys...
mat23452345 said:
Hello, I have the exact same issue (but using kernel "2.6.36-android+")
did you find a solution?
Click to expand...
Click to collapse
Im buiding kernel for goodix touch drivers as im currently modding a LY-F1 JB ROM which uses a focaltouch touchscreen. but a full build is not enabling the modules and gives a exec error. Maybe it has something to do with ur extra version variable. change EXTRAVERSION = to "EXTRAVERSION =+" and do a build and tell me what happens. Im out so cant really test it.
cybermate123 said:
change EXTRAVERSION = to "EXTRAVERSION =+" and do a build and tell me what happens.
Click to expand...
Click to collapse
Thanks for the reply, but that tablet has crashed and gone now. I will bear that in mind for the future...

[GUIDE] How to build a kernel for the Galaxy Player

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))

Categories

Resources