[Q] problem compiling custom kernel module on EVO - EVO 4G Q&A, Help & Troubleshooting

What I have done so far:
1) setup cross compiling
2) downloaded the HTC-provided kernel source
3) wrote my own lkm & Makefile
4) grabbed .config from /proc/config.gz off the phone
The problem though is that the distributed HTC kernel is only the source and it doesn't have the compiled files used in the kernel module building processing. It also doesn't have the autoconf files are shown here in the make error:
" ERROR: Kernel configuration is invalid.
include/linux/autoconf.h or include/config/auto.conf are missing.
Run 'make oldconfig && make prepare' on kernel src to fix it."
So I am wondering, do I have to compile my own kernel in order to be able to compile modules or is there someway to make it work with the stock HTC kernel? Loadable modules are enabled in the stock kernel, but unless I am missing something I don't see how you can actually compile modules for it.
Thanks for any help, and I am very experienced with kernel development (on Intel) so feel free to provide any technical details.

Related

Extracting kernel config from I9000XXJP3

Dear all,
Did anyone succeed extracting kernel configuration from I9000XXJP3? Kernel version is 2.6.32.9, the vermagic is "2.6.32.9 mod_unload ARMv7"
extract-ikconfig doesn't work on it.
I succeeded extracting a zImage gzipped payload, but it seems not to contain any configuration in it (see attached).
/proc/config.gz doesn't exist, Samsung open source package (downloaded from Samsung open source site) contains only Android 2.1 Eclair or previous versions.
My target is to build tun.ko and, eventually, ext3/ext4 modules to make them working in Samsung Galaxy S I9000 with rooted I9000XXJP3.
Any idea?
Without froyo source code or a good Samsung Kernel (es. for himem capable) I think is impossible to play good with theses beta roms.
Ciao
Any news? I need tun.ko for jp3 too..
I have tried to compile the 2.6.32.9 kernel editing the .config in 2.6.9, the module tun.ko is accepted by the device, but I get a kernel panic!
redsh said:
I have tried to compile the 2.6.32.9 kernel editing the .config in 2.6.9, the module tun.ko is accepted by the device, but I get a kernel panic!
Click to expand...
Click to collapse
Did you use the stock linux kernel? Or the common from android.kernel.org?
I'm trying the same thing actually. Isn't there any default config for the processor that might work? I tried with the config from .29 but when loading the module it says wrong format.
try to build 2.6.32 with the 2.6.29 config ("yes" all missing stuff)
turn on your galaxy, adb push the tun.ko
try to load it, it will say "missing symbols" blabla
find the config options that match those symbols, enable them, recompile, try again
Great to see some people who are hacking the kernel! Keep it up!
But I'm afraid it is not going to be as easy as dropping aries_rev03_defconfig as .config in a 2.6.32 kernel tree and doing 'make oldconfig'. That's because many of Samsung's changes have not been included in the newer mainline kernel versions yet.
Samsung added quite a lot of low-level board support for their dev boards (and for the SGS, of course), did some customization and added a few drivers which you will need to forward-port to the newer kernel.
Please have a look at this thread, in which I've started a breakdown of the Samsung patches against Android Eclair's 2.6.29 kernel.
The best course of action I think is to git clone Android's kernel from AOSP, checkout the android-2.6.29 branch, apply Samsung's patches to that, then attempt to rebase your tree to a newer kernel version. (Note, you may want to start with small steps, to get a feel for what you're up against )
Note that there probably will be lots of merge conflicts which you need to resolve, and after dealing with all those, you also have to make sure that everything else that's merged still works as expected, but at least that will show you the amount of work involved. You will basically be doing all the work that Samsung is doing right now for their kernel for FroYo. It will be interesting to follow their progress on the mailing lists and on IRC.
bilboa1 said:
try to build 2.6.32 with the 2.6.29 config ("yes" all missing stuff)
turn on your galaxy, adb push the tun.ko
try to load it, it will say "missing symbols" blabla
find the config options that match those symbols, enable them, recompile, try again
Click to expand...
Click to collapse
Thats exactly what I did, but I got wrong module format... which is a fatal error. I need to invest further in the used config... maybe i did not pick up the right one properly..
miki4242 said:
Great to see some people who are hacking the kernel! Keep it up!
But I'm afraid it is not going to be as easy as dropping aries_rev03_defconfig as .config in a 2.6.32 kernel tree and doing 'make oldconfig'. That's because many of Samsung's changes have not been included in the newer mainline kernel versions yet.
Samsung added quite a lot of low-level board support for their dev boards (and for the SGS, of course), did some customization and added a few drivers which you will need to forward-port to the newer kernel.
Please have a look at this thread, in which I've started a breakdown of the Samsung patches against Android Eclair's 2.6.29 kernel.
The best course of action I think is to git clone Android's kernel from AOSP, checkout the android-2.6.29 branch, apply Samsung's patches to that, then attempt to rebase your tree to a newer kernel version. (Note, you may want to start with small steps, to get a feel for what you're up against )
Note that there probably will be lots of merge conflicts which you need to resolve, and after dealing with all those, you also have to make sure that everything else that's merged still works as expected, but at least that will show you the amount of work involved. You will basically be doing all the work that Samsung is doing right now for their kernel for FroYo. It will be interesting to follow their progress on the mailing lists and on IRC.
Click to expand...
Click to collapse
Yes that would be a lot of work. Maybe its better to just wait until they release the kernel from froyo. I read that they release their opensource stuff rather fast. But just for adding a module like ext4 I don't think you need those patches, because imho they didn't touch the fs of the kernel. We just need an adaquate kernel config and adding modules should be possible.
Phlogiston said:
Thats exactly what I did, but I got wrong module format... which is a fatal error. I need to invest further in the used config... maybe i did not pick up the right one properly..
Click to expand...
Click to collapse
Make sure you're using the same kernel version number and build number, because samsung kernels do not have the option to load incorrect module versions
Yes i've set the subversion as well but without the patches from samsung its impossible it seems. We need to wait and hope that they release the froyo kernel sources soon....
bilboa1 said:
Make sure you're using the same kernel version number and build number, because samsung kernels do not have the option to load incorrect module versions
Click to expand...
Click to collapse
Are you sure they set CONFIG_MODVERSIONS? It's off in the downloadable sources.
Just compare the output of `modinfo -F vermagic <yourmodule>` to `modinfo -F vermagic <modulewhichloads>` or to /proc/version .
did this get solved yet? I google'd for the tun.ko file for my i9000 using jp3 but nothing yet... if you have a proper one for the MoDaCo version here please attach it! ~
I think I saw someone's post with tun.ko for FroYo beta somewhere in these forums, I mean i9000 Android Dev. One of the guys here has found a way to compile kernel for jp* here. I am sure.
I actually found it attached somewhere in the forum and it was 1,5447 mb big I think it was... but it still didn't work for me so I presumed the kernel or something must have been wrong.

[kernel][For CM7 only][LAZY,TUN,CIFS,ondemand tweaks]Adam's kernel[02/10/2012]

Hi guys.
I'm a newbie about compiling kernel,and this is my personal compiled kernel based on Hashcode's git source( stock branch),also with some tweaks which I think can improve the responsiveness without bringing extra power consumption( or as little as possible).
This kernel will also be my testing platform to do some MOD porting from Ezekeel's GLaDOS kernel.
Thanks to all great developers in XDA , especially:
-Hashcode & intersectRaven : for their git repo alone with a working .config. alone
-Ezekeel : for his so many great MODs on Nexus S(my phone) and Galaxy Nexus(will be my next phone)
-whistlestop : For his improvement on CM7 (I'm completely unfamiliar with the user land things about android, without him I'll be still using the stock ROM)
Features:
-LAZY cpufreq governor ported from GLaDOS(http://forum.xda-developers.com/showthread.php?t=1276092) with some tweaks.
-TUN compiled into kernel (especially important for people living in regions with strict network censorship like CHINA! F*ck the GreatFireWall)
-CIFS compiled into kernel along with NLS-utf8 for non-ASCII characters.( Now who cares the size of the internal flash?)
-Minor tweaks on ondemand governor to improve responsiveness.
ToDo:
-BLX porting from GLaDOS(http://forum.xda-developers.com/showthread.php?t=1257497)
-TouchWake porting from GLaDOS(http://forum.xda-developers.com/showthread.php?t=1239240)
Because I'm a newbie on kernel development and the MODs above both have some code in hardware drivers, so it will be a long time before accomplish.
The kernel source code seems to work on both CM9 and stock ROM.
So later I'll upload the flashable kernel zip for CM9 and stock ROM after some test.
Download:
CM7:http://www.mediafire.com/?2nsm9lb7ylm3gnl
In next post,I'll post the procedure for compiling the kernel and the wifi driver.
In this post I'll post the detailed procedure of compile the kernel.
1.Get the kernel source and wifi driver:
If you want to compile the kernel based on my tweak,
you can use my repo (fork from hashcode's source):https://github.com/adam900710/kernel_omap(branch stock)
Or you can just start from scratch without my tweak:https://github.com/KFire-Android/kernel_omap(only branch stock is tested)
If you are unfamiliar with git,you can learn it on the GitHub's help page:
http://help.github.com/
Tiwlan drivers from neither omapzoom nor CM7 works due the lack of given functions.
ONLY the wifi driver from Amazon seems work. So you need to download the whole zip from Amazon:
http://www.amazon.com/gp/help/customer/display.html?nodeId=200203720
The wifi driver locates in mydroid/hardware/ti/wlan/wl1283
2.Get the cross compile toolchain:
Yes,you can build from scratch according to CLFS(http://trac.cross-lfs.org/),but a newbie like me is glad to use the pre-compiled toolchain like sourcery G++. Omappedia recommanded 2010q1-202(https://sourcery.mentor.com/sgpp/lite/arm/portal/release1293), so I use it as the toolchain and it works well.
The self-extrated installation program will install the toolchian without any problem.
Also other toolchain is available like linaro , but according to the post by Ezekeel (http://rootzwiki.com/topic/10855-researchmythbuster-optimized-compiler-toolchains/) , there seems no obvious difference. So the out-of-box sourcery G++ is a good choice.
3.Compile the kernel.
Code:
cd kernel_omap #cd into your kernel
make mrproper #clean the source tree( normally you can skip)
make otter_android_defconfig #get the default .config (also you can copy it manually)
make ARCH=arm menuconfig #if you want,you can tweak the config of the kernel.This needs headers of ncurse
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi -j4 #you should make sure that the toolchain is in you PATH
After some CPU time, the kernel is built, in arch/arm/boot/zImage. Also the modules is built in other places.
Since I built all TUN/CIFS and so on into kernel,so there is no need to install the modules.
4.Compile the wifi driver:
Code:
cd mydroid/hardware/ti/wlan/wl1283/platforms/os/linux/ #cd into the building folder
make ARCH=arm KERNEL_DIR=/home/adam/kernel_omap CROSS_COMPILE=arm-none-linux-gnueabi- TNETW=1273 -j4 #you need to change the path of KERNEL_DIR
CAUTION: DO NOT add DEBUG=n OR DELETE TNETW=1273....
I don't know why,but if you do so,the wifi driver won't work properly.
5. Package the kernel into boot.img with ramdisk.
Thanks to DooMLord , in his git repo , you can download the tools needed.
https://github.com/DooMLoRD/Kindle-Fire-Kernel/tree/master/final_files
Only minor changes are needed for the path ,every thing elso works fine.
You can use the ramdisk extracted from any CM7 boot.img using the perl script.
Then just ./make_bootimg will do everythin for you.
Great i will test it
Sent from my GT-P1000 using xda premium
Best kernel.
I'm running on CM7 with this kernel and get super-perfomance and perfect power consump (Using Lazy governor).
It's not support OC??
Sent from my GT-P1000 using xda premium
acax456 said:
It's not support OC??
Sent from my GT-P1000 using xda premium
Click to expand...
Click to collapse
Sorry, not support yet.
Maybe I'll add OC in next release.But I don't recommend OC because the power consumption...
can you able otg usb support ???
is this possible
Please add .zip for CM9!
Can I flash this from the recovery? or do I have to use adb??
please.update your kernel.since its been two months from last.update
Sent from my GT-P1000 using xda premium

[Q] Kernel .config for defy 2.6.32.9

The Motorola kernel source releases don't seem to include the kernel config. Anyone know if the configs are available somewhere? Or perhaps someone has already gone through the work to create an approximation config that works for building modules and could share?
Hi,
There are some Motorola specific configs in the kernel\omap3\arch\arm\configs\ext_config folder. Is this what you missing?
mapphone_defconfig
Hi quasimidi,
quasimidi said:
There are some Motorola specific configs in the kernel\omap3\arch\arm\configs\ext_config folder. Is this what you missing?
Click to expand...
Click to collapse
Thanks! Not exactly as the stuff in ext_config seem to be config fragments only, but you pointed me in just the right direction for the full configuration.
There is a mapphone_defconfig target that seems to produce a suitable config. This is what I did, perhaps this is useful to someone:
- Download kernel source from sf.net/motorola, unpack
- Get ARM cross toolchain with gcc 4.4 - I got mine from emdebian
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- mapphone_defconfig
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
The build tree can now be used to build modules. I only did a quick test, but the module inserted cleanly and appears to be working so far.
https://github.com/CyanogenDefy/and...n/blob/gingerbread/modules/mapphone_defconfig
its the one i use for modules... its based on the one in kernel sources, but result of a build in a repo

Making a CM11.0 kernel for E980?

Hello fellow OGPers...
So I've been jumping from ROM to ROM for a solid few months now. Really enjoyed my time as an Android user and soaked in a lot. I've been learning (well... teaching myself) about Linux and other related things. But I've been busy with classes, a social life, and other commitments. Anyway let me cut to the chase. I really enjoyed it in 4.3 ROMs when I could use all the settings on the AOSP custom kernel for our device and among other things liked the experience of a custom kernel. It's about time we got one for 4.4.x Kitkat... right?
I am currently running Windows 7 (if specs are important I will post them) with a Linux Mint distro (both are 64-bit). I have downloaded the CM11.0 from github and a few toolchains. I haven't untared them yet or anything, but I have some. One is specialized for Cortex A-15, which I read our device's CPU is much alike to. Anyway I just wanted some help getting started with making a kernel is what it comes down to. I have basic Linux knowledge and that's about it. I just want to get a custom kernel out and then maybe in the future get a nice battery-optimized kernel out. I forgot to grab a kernel patch and I'll download it tomorrow probably. But I really don't know where to start at all. Do I need knowledge of anything or some more experience knowledge? If anybody can point me in a good direction that would be great. Everything is appreciated.
Oh and feel free to PM me answers as well if it's easier or more convenient for you.
Thanks guys!
This would be great as we need a kernel Dev ... Good luck on your journey !
2SHAYNEZ
If you only want to compile kernel,clone this repository.
git clone https://github.com/CyanogenMod/lge-kernel-gproj/tree/cm-11.0
make any change you want to do with the source.
Download android toolchain and extract it.
Compile the kernel sources with
export ARCH=arm CROSS_COMPILE=/path.to.toolchain/bin/arm-eabi- && make cyanogenmod_e980_defconfig && make -j#
(# is the number of your computer cores +1)
you will get zimage in /arch/arm/boot folder
Using boot.img(the kernel) from official CM build zip to get the ramdisk is easier
abootimg -x boot.img
you will see:
writing boot image config in bootimg.cfg
extracting kernel in zImage
extracting ramdisk in initrd.img
put the extracted initrd.img and bootimg.cfg to /arch/arm/boot(where your compiled zimage are)
run:
abootimg --create boot.img -f bootimg.cfg -k zImage -r initrd.img
You will get the boot.img!
This is the complete kernel!
Use any previous kernel zip, and replace the boot.img inside the zip with yours.
Flash it and test it.
My TWRP 2.8.0.0 or TWRP from freegee or Philz Touch will auto lokify the kernel.
Wing
Attached is the kernel.zip that i use.
Replace the your finished boot.img with it~~
Wing
BTW i am not programmer, but i am a very long time gentoo linux and archlinux user, long before android exist~
mukwing said:
If you only want to compile kernel,clone this repository.
git clone https://github.com/CyanogenMod/lge-kernel-gproj/tree/cm-11.0
make any change you want to do with the source.
Download android toolchain and extract it.
Compile the kernel sources with
export ARCH=arm CROSS_COMPILE=/path.to.toolchain/bin/arm-eabi- && make cyanogenmod_e980_defconfig && make -j#
(# is the number of your computer cores +1)
you will get zimage in /arch/arm/boot folder
Using boot.img(the kernel) from official CM build zip to get the ramdisk is easier
abootimg -x boot.img
you will see:
writing boot image config in bootimg.cfg
extracting kernel in zImage
extracting ramdisk in initrd.img
put the extracted initrd.img and bootimg.cfg to /arch/arm/boot(where your compiled zimage are)
run:
abootimg --create boot.img -f bootimg.cfg -k zImage -r initrd.img
You will get the boot.img!
This is the complete kernel!
Use any previous kernel zip, and replace the boot.img inside the zip with yours.
Flash it and test it.
My TWRP 2.8.0.0 or TWRP from freegee or Philz Touch will auto lokify the kernel.
Wing
Click to expand...
Click to collapse
Wow thank you so much... definitely going to give this a shot today! So I didn't have to download the 12 GB source... good to know.
Oh and one more thing. Is there any difference from building a CM11 kernel vs an AOSP 4.4.x kernel? I figured since most of our device's ROMs are CM based this would work fine... Thank you very much for the information at hand! Appreciated.
CM kernel is different from AOSP kernel from what i know.
CM kernel is base on CAF(which is optimized for msm chip) and AOSP kernel base on google original code.
They are a bit different so imcompatible from what i know.
Wing
When I compile there are loads of errors and eventually it stops (at different times each attempt...) anyway, the first thing I notice is this:
warning: (ARCH_MSM7X27 && ARCH_MSM8960 && ARCH_MSM8930 && ARCH_MSM8974) selects DONT_MAP_HOLE_AFTER_MEMBANK0 which has unmet direct dependencies (SPARSEMEM)
warning: (ARCH_MSM7X27 && ARCH_MSM8960 && ARCH_MSM8930 && ARCH_MSM8974) selects DONT_MAP_HOLE_AFTER_MEMBANK0 which has unmet direct dependencies (SPARSEMEM)
Is that anything I have to worry about? I can't find anything online about it. Thanks in advance.
First, is it unmodified cm kernel sources?
Make sure to use unmodified sources to test building first.
Somes errors can safely ignored.The msm8960 error can safty ignore. It has nothing to do with our device.
If it failed to build, try using option like -Xlint.
Sometimes, using older build of toolchain is easier to build, e.g.gcc4.7 or 4.8
Gcc 4.9 always failed to build e980 cm kernel.
mukwing said:
First, is it unmodified cm kernel sources?
Make sure to use unmodified sources to test building first.
Somes errors can safely ignored.The msm8960 error can safty ignore. It has nothing to do with our device.
If it failed to build, try using option like -Xlint.
Sometimes, using older build of toolchain is easier to build, e.g.gcc4.7 or 4.8
Gcc 4.9 always failed to build e980 cm kernel.
Click to expand...
Click to collapse
Ohhh okay. Yeah it's all unmodified and I've downloaded tons of "needed" packages (including most likely unnessesary ones too). I'm using a 4.9 GCC. That might be it. Okay thanks. I'll give another shot tomorrow when I have access to my VM.
Kernel has been successfully compiled. Check here for download and further discussion...
http://forum.xda-developers.com/optimus-g-pro/orig-development/kernel-e980-kernel-t2872514

Question Compiling Kernel Module

Hey everyone,
I'm trying to compile the xt_HL.ko kernel module to allow TTL spoofing. I was able to compile this previously for my Pixel 3 kernel sources, but the Pixel 6 seems to be different.
I simply cloned the sources repo and added CONFIG_NETFILTER_XT_TARGET_HL=m to my build.config file. Building results in an error about the abi symbols not matching the kernel symbols. I can bypass this warning by using update_symbol_list.sh instead to compile the module, but as expected it fails to load with insmod with an error about "xt_register_targets" and "xt_unregister_targets" being an unknown symbol (error from dmesg). Running "cat /proc/kallsyms" shows these symbols as existing, so not sure what else I would need.
I also tried adding "CONFIG_NETFILTER_XTABLES=m" with hopes to maybe add x_tables.ko, but that doesn't appear in the build output at all when adding that.
Can anyone help with this?
Thanks!
@nathanchance Maybe you can help?
Ps. Attached a dockerfile with the exact script I used for compilation. (same script worked for Pixel 3, change the manifest)
Bump

Categories

Resources