Getting Working Wifi for Kernel builds - Galaxy Note II, Galaxy S III Developer Discussion

I have been buliding some kernels recently, but have been unable to get the wifi working.
I have tried it having the modules included in initramfs/lib/modules when ramdisk is created and i do mkbootimg, and have also tried just putting all the modules in the flash zip in /system/lib/modules, and excluded it from build process. Both result in no Wifi [Edit, putting the newly built correct modules in my working folders /lib/modules fixed wifi, must not have done it correctly before)
basic overview of what I've done (after zImage compile)
I use "./unpack-bootimg.pl boot.img" to pull the "ramdisk-contents" from the stock kernel, I renamed that folder "initramfs" and threw it in a folder along with my mkbootimg binary, and my zImage I just compiled.
I put the newly created modules from zImage build in my initramfs/libs/modules with
find -name '*.ko' -exec cp -av {} [path to desired folder] \;
I navigate to the initramfs folder and
find .|cpio -o -H newc > ../ramdisk
cd ..
gzip ramdisk
./mkbootimg --kernel ./zImage --ramdisk ./ramdisk.gz --board smdk4x12 --base 0x10000000 --pagesize 2048 --ramdiskaddr 0x11000000 -o boot.img
the resultant boot.img boots fine and shows all other changes, just cant seem to get the wifi working. Anyone have idea for getting wifi working on our Note 2 kernel builds?
Edit: I re-tried and this time it worked. Not sure what was different. Copied the newly created modules into my ramdisk folder (for me was /initramfs/lib/modules) and created my ramdisk.gz etc. made the boot.img and it's all good. The difference must've been having the correct modules in place prior to creating the ramdisk.cpio(then .cpio.gz).
Mods please move if you feel this is in wrong section now etc. Found the answer, thank you

It's only in the wrong section if you don't share what you did wrong, and how you fixed it.

Facing an almost similiar issue over here with the wifi modules. For me, I found that my boot.img is itself too large for initramfs to accomodate the compiled modules (optimization was off). So I put them in system/lib/modules and tried to insmod them.
Using the sbin's insmod gives me this:
Code:
[[email protected] android]$adb shell
[email protected]:/ $ su
[email protected]:/ # insmod /system/lib/modules/dhd.ko
insmod: init_module '/system/lib/modules/dhd.ko' failed (No such file or directory)
255|[email protected]:/ # busybox insmod /system/lib/modules/dhd.ko
insmod: can't insert '/system/lib/modules/dhd.ko': unknown symbol in module, or unknown parameter
2|[email protected]:/ #
I've turned off module versioning, and am not sure why there's a symbol error.

Droidzone said:
Facing an almost similiar issue over here with the wifi modules. For me, I found that my boot.img is itself too large for initramfs to accomodate the compiled modules (optimization was off). So I put them in system/lib/modules and tried to insmod them.
Using the sbin's insmod gives me this:
Code:
[[email protected] android]$adb shell
[email protected]:/ $ su
[email protected]:/ # insmod /system/lib/modules/dhd.ko
insmod: init_module '/system/lib/modules/dhd.ko' failed (No such file or directory)
255|[email protected]:/ # busybox insmod /system/lib/modules/dhd.ko
insmod: can't insert '/system/lib/modules/dhd.ko': unknown symbol in module, or unknown parameter
2|[email protected]:/ #
I've turned off module versioning, and am not sure why there's a symbol error.
Click to expand...
Click to collapse
Add --strip-debug into the LDFLAGS_MODULE of the main makefile and make sure the modules went through second stage compilation. The OS probably forwards some parameters and you can't just insmod it.

I fixed that issue..
The real reason is something queer and interesting. It was because I'd defined GREP_OPTIONS defined as '--color -in'. This seemed to interfere with the kernel scripts. Once the var was unset, problem was solved.
However the inability to load the module persists.
My main kernel has the version name "3.0.31-g5d44d80-dirty", and the vermagic of module seems to be "3.0.31-gc299ec6 SMP preempt mod_unload modversions ARMv7 p2v8".
This obviously leads to version mismatch, and inability to load the module. Do you know why this happens? The kernel and module were used from the same compilation session. In fact I havent even changed the version name in .config.
dmesg during insmod gives this error code which narrows down the issue:
Code:
c0 dhd: version magic '3.0.31-gc299ec6 SMP preempt mod_unload modversions ARMv7 p2v8 ' should be '3.0.31-g5d44d80-dirty SMP preempt mod_unload ARMv7 '
EDIT:
Maybe I had made a script error and forgot to replace the original kernel/module..That error has disappeared to be replaced by the former issue-unable to insert module. Module was compiled with debug symbols.
Insmod reports:
insmod: init_module '/system/lib/modules/dhd.ko' failed (No such file or directory)
Modprobe reports:
modprobe: chdir(3.0.31-ge52b835-dirty): No such file or directory
Kernel reports:
Code:
c0 dhd: Unknown symbol _GLOBAL_OFFSET_TABLE_ (err 0)
Trying to narrow it down to the source file. I'm expecting that some function has 'forgotten' to export symbol.
I'm wondering whether this is just me, or is Samsung source dump supposed to have these kind of errors on defconfig. First they "forget" to include cypress drivers. Now errors related to symbol export.
EDIT2:
Still no more closer to finding the cause of the error. Did a grep and these are the only things I found:
Code:
[[email protected] kernel_IN]$grep --color -inr '_GLOBAL_OFFSET_TABLE_' * | grep -v 'Binary file'
arch/powerpc/boot/crt0.S:42: addis r11,r10,(_GLOBAL_OFFSET_TABLE_-p_base)@ha
arch/powerpc/boot/crt0.S:43: lwz r11,(_GLOBAL_OFFSET_TABLE_-p_base)@l(r11)
arch/m32r/boot/compressed/head.S:39: seth r3, #high(_GLOBAL_OFFSET_TABLE_+8)
arch/m32r/boot/compressed/head.S:40: or3 r3, r3, #low(_GLOBAL_OFFSET_TABLE_+12)
arch/s390/kernel/module.c:149: "_GLOBAL_OFFSET_TABLE_") == 0)
arch/avr32/kernel/module.c:104: "_GLOBAL_OFFSET_TABLE_") == 0)
scripts/mod/modpost.c:565: if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
System.map:49417:c0b4f468 d _GLOBAL_OFFSET_TABLE_
The relevant segment of scripts/mod/modpost.c:
Code:
static int ignore_undef_symbol(struct elf_info *info, const char *symname)
{
/* ignore __this_module, it will be resolved shortly */
if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0)
return 1;
/* ignore global offset table */
if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
return 1;
Edit3: Solved.

AndreiLux said:
Add --strip-debug into the LDFLAGS_MODULE of the main makefile and make sure the modules went through second stage compilation. The OS probably forwards some parameters and you can't just insmod it.
Click to expand...
Click to collapse
I'd like to thank you for this information - this cut my dhd.ko from 4.6 MB to around 550 kB - and my resulting kernel as a result. Fully expect this will now get my kernel working as it should.

Droidzone said:
I fixed that issue..
The real reason is something queer and interesting. It was because I'd defined GREP_OPTIONS defined as '--color -in'. This seemed to interfere with the kernel scripts. Once the var was unset, problem was solved.
However the inability to load the module persists.
My main kernel has the version name "3.0.31-g5d44d80-dirty", and the vermagic of module seems to be "3.0.31-gc299ec6 SMP preempt mod_unload modversions ARMv7 p2v8".
This obviously leads to version mismatch, and inability to load the module. Do you know why this happens? The kernel and module were used from the same compilation session. In fact I havent even changed the version name in .config.
dmesg during insmod gives this error code which narrows down the issue:
Code:
c0 dhd: version magic '3.0.31-gc299ec6 SMP preempt mod_unload modversions ARMv7 p2v8 ' should be '3.0.31-g5d44d80-dirty SMP preempt mod_unload ARMv7 '
EDIT:
Maybe I had made a script error and forgot to replace the original kernel/module..That error has disappeared to be replaced by the former issue-unable to insert module. Module was compiled with debug symbols.
Insmod reports:
insmod: init_module '/system/lib/modules/dhd.ko' failed (No such file or directory)
Modprobe reports:
modprobe: chdir(3.0.31-ge52b835-dirty): No such file or directory
Kernel reports:
Code:
c0 dhd: Unknown symbol _GLOBAL_OFFSET_TABLE_ (err 0)
Trying to narrow it down to the source file. I'm expecting that some function has 'forgotten' to export symbol.
I'm wondering whether this is just me, or is Samsung source dump supposed to have these kind of errors on defconfig. First they "forget" to include cypress drivers. Now errors related to symbol export.
EDIT2:
Still no more closer to finding the cause of the error. Did a grep and these are the only things I found:
Code:
[[email protected] kernel_IN]$grep --color -inr '_GLOBAL_OFFSET_TABLE_' * | grep -v 'Binary file'
arch/powerpc/boot/crt0.S:42: addis r11,r10,(_GLOBAL_OFFSET_TABLE_-p_base)@ha
arch/powerpc/boot/crt0.S:43: lwz r11,(_GLOBAL_OFFSET_TABLE_-p_base)@l(r11)
arch/m32r/boot/compressed/head.S:39: seth r3, #high(_GLOBAL_OFFSET_TABLE_+8)
arch/m32r/boot/compressed/head.S:40: or3 r3, r3, #low(_GLOBAL_OFFSET_TABLE_+12)
arch/s390/kernel/module.c:149: "_GLOBAL_OFFSET_TABLE_") == 0)
arch/avr32/kernel/module.c:104: "_GLOBAL_OFFSET_TABLE_") == 0)
scripts/mod/modpost.c:565: if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
System.map:49417:c0b4f468 d _GLOBAL_OFFSET_TABLE_
The relevant segment of scripts/mod/modpost.c:
Code:
static int ignore_undef_symbol(struct elf_info *info, const char *symname)
{
/* ignore __this_module, it will be resolved shortly */
if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0)
return 1;
/* ignore global offset table */
if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
return 1;
Edit3: Solved.
Click to expand...
Click to collapse
How to Solved? Too detailed can you tell us a little bit?

wctliu said:
How to Solved? Too detailed can you tell us a little bit?
Click to expand...
Click to collapse
Used another toolchain.

Droidzone said:
Used another toolchain.
Click to expand...
Click to collapse
another toolchain????
Which version?
I uesd these:
/home/wctliu/toolchains/arm-eabi-4.4.3/bin/arm-eabi-
/home/wctliu/arm-2009q3/bin/arm-none-linux-gnueabi-
Which will cause the problem to occur?

wctliu said:
another toolchain????
Which version?
I uesd these:
/home/wctliu/toolchains/arm-eabi-4.4.3/bin/arm-eabi-
/home/wctliu/arm-2009q3/bin/arm-none-linux-gnueabi-
Which will cause the problem to occur?
Click to expand...
Click to collapse
Did you see and do the changes AndreiLux mentioned above to the makefile. That can be the difference of whether you get useable wifi modules. Simple place to start if your getting a working kernel but no wifi
Sent from my SPH-L900 using xda premium

sleshepic said:
Did you see and do the changes AndreiLux mentioned above to the makefile. That can be the difference of whether you get useable wifi modules. Simple place to start if your getting a working kernel but no wifi
Sent from my SPH-L900 using xda premium
Click to expand...
Click to collapse
YES i do it .
you can see this:
http://forum.xda-developers.com/showthread.php?t=2193358
and now, it's no wifi no exfat.

AndreiLux said:
Add --strip-debug into the LDFLAGS_MODULE of the main makefile and make sure the modules went through second stage compilation. The OS probably forwards some parameters and you can't just insmod it.
Click to expand...
Click to collapse
That is correct, the OS does pass parameters to the module when loading.
An example (from CM) can be seen at: https://github.com/CyanogenMod/andr...common/blob/cm-10.1/BoardCommonConfig.mk#L122

I cannot get Wifi to work either. I have the same exact problem as Droidzone with the "_GLOBAL_OFFSET_TABLE_" error.
I have checked that:
"LDFLAGS_MODULE = --strip-debug" is set in Makefile.
I'm using the 4.7 toolchain, but just tried the 4.6 to no avail.
Any help would be much appreciated.
Update: I was able to get it working by using CFLAGS_MODULE=-fno-pic as suggested in this guide.

Solved
I was running in the same issues. I solved my problem adding these to my kernel makefile:
LDFLAGS_MODULE = --strip-debug
CFLAGS_MODULE = -fno-pic

forfivo said:
I was running in the same issues. I solved my problem adding these to my kernel makefile:
LDFLAGS_MODULE = --strip-debug
CFLAGS_MODULE = -fno-pic
Click to expand...
Click to collapse
There must be something else goin on in my setup as this does not work for me to getting working WiFi. What is your build process?
Edit: or if you wouldn't mind shoot in me your kernel I'd be interested if it something small I'm missing like updater script etc
Edit2: I feel sometimes in android doing the same thing twice results in separate results. Crazy thx

Hey sorry to bump this. Not sure if anyone still remembers I have the same problem with my GT-B5330.
Even though I set in my kernel/Makefile :
CFLAGS_MODULE = -fno-pic
LDFLAGS_MODULE = --strip-debug
After building the kernel from source I get the dhd.ko file, copy it to ramdisk/lib/modules and then repack it with the zimage generated by the build.
Then i dd the newly created boot.img to the kernel partition.
lsmod doesnt show dhd.ko
and the file exists in system/lib/modules/dhd.ko
Toolchain arm-eabi-4.6

DroidFreak32 said:
Hey sorry to bump this. Not sure if anyone still remembers I have the same problem with my GT-B5330.
Even though I set in my kernel/Makefile :
CFLAGS_MODULE = -fno-pic
LDFLAGS_MODULE = --strip-debug
After building the kernel from source I get the dhd.ko file, copy it to ramdisk/lib/modules and then repack it with the zimage generated by the build.
Then i dd the newly created boot.img to the kernel partition.
lsmod doesnt show dhd.ko
and the file exists in system/lib/modules/dhd.ko
Toolchain arm-eabi-4.6
Click to expand...
Click to collapse
Are you able to test manually starting using insmod? If so, what is the result?

garwynn said:
Are you able to test manually starting using insmod? If so, what is the result?
Click to expand...
Click to collapse
I cannot insmod the module I get : /system/lib/module/dhd.ko invalid argument

DroidFreak32 said:
I cannot insmod the module I get : /system/lib/module/dhd.ko invalid argument
Click to expand...
Click to collapse
Can't get to my Linux env at the moment, but will follow up on this. Might even see if someone is willing to test for me.

garwynn said:
Can't get to my Linux env at the moment, but will follow up on this. Might even see if someone is willing to test for me.
Click to expand...
Click to collapse
Thanks man
Also I forgot to mention I use arm eabi 4.4.3 if that matters.

Related

ncurses/htop cross compile

I'm not sure if this is the right forum but I figured I'd ask. I'm trying to get an ARM compiled version of htop working for my dream (more as a small test than anything) and I can't seem to get the ncurses libs and headers recognized for compiling htop.
I did get ncurses compiled using:
Code:
CC=/root/mydroid/arm-2009q1/bin/arm-none-linux-gnueabi-gcc CXX=/root/mydroid/arm-2009q1/bin/arm-none-linux-gnueabi-g++ \./configure arm-linux --host=arm-none-linux-gnueabi --with-shared --prefix=/root/mydroid/arm-2009q1 --disable-big-core --enable-termcap --disable-GPM--without-ada
the build seemed to go fine after the compile and the binaries are in fact reporting to be the correct arch:
Code:
# file lib/libncurses.so.5.7
lib/libncurses.so.5.7: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked, not stripped
Then on to the configure of htop:
Code:
CPPFLAGS=-I/root/mydroid/arm-2009q1/include LDFLAGS=-I/root/mydroid/arm-2009q1/lib \./configure CC=/root/mydroid/arm-2009q1/bin/arm-none-linux-gnueabi-gcc CXX=/root/mydroid/arm-2009q1/bin/arm-none-linux-gnueabi-g++ --host=arm --build=arm-linux
I ran into a couple path issues with includes from curses.h but I was able to get past this using full path.
The build however fails misserably unable to find -lcurses
Code:
configure:21591: checking for refresh in -lncurses
configure:21626: /root/mydroid/arm-2009q1/bin/arm-none-linux-gnueabi-gcc -o conftest -g -O2 -I/root/mydroid/arm-2009q1/include -I/root/mydroid/arm-2009q1/libconftest.c -lncurses -lm >&5
/root/mydroid/arm-2009q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lncurses
collect2: ld returned 1 exit status
That's all the drivel ... I was wondering if someone could kick me in the right direction for how to tell the cross compiler linker where the curses libraries are? I know on the base system I can use ldconfig etc but the ldconfig in the toolchain (all of them) appear to be an ARM binary
Code:
# find . -name ldconfig -exec file {} \;
./arm-none-linux-gnueabi/libc/usr/lib/bin/ldconfig: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.14, not stripped
./arm-none-linux-gnueabi/libc/armv4t/usr/lib/bin/ldconfig: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.14, not stripped
./arm-none-linux-gnueabi/libc/armv4t/sbin/ldconfig: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.14, not stripped
./arm-none-linux-gnueabi/libc/thumb2/usr/lib/bin/ldconfig: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.14, not stripped
./arm-none-linux-gnueabi/libc/thumb2/sbin/ldconfig: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.14, not stripped
./arm-none-linux-gnueabi/libc/sbin/ldconfig: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.14, not stripped
Anyone have any pointers or better ways to set up dev environments for cross-compiling? Or any ideas what I'm doing wrong? So far anything I've come up with is a cludge and not the right way of doing it I'm sure
I'm not sure about the right way to do this, but the path can be specified with -L, pretty much like the include path is specified with -I.
Cross-compiling packages isn't an easy task, as a lot of them depend on broken tools like libtool..
Zappletoo said:
I'm not sure about the right way to do this, but the path can be specified with -L, pretty much like the include path is specified with -I.
Cross-compiling packages isn't an easy task, as a lot of them depend on broken tools like libtool..
Click to expand...
Click to collapse
lmao ... one of my friends was a developer for libtool (Gord Matzigkeit) ... I think even he thought it needed to evolve .... I'll try more options tomorrow and see if I can pop in the -L option, might just have to get creative
Thanks!
I just built htop static vs uclibc for my latest build. I got tired of trying to make ncurses and bionic play nice together.
Try CFLAGS instead of CPPFLAGS, and use -L under LDFLAGS for the library include path instead of -I
cyanogen said:
I just built htop static vs uclibc for my latest build. I got tired of trying to make ncurses and bionic play nice together.
Click to expand...
Click to collapse
lol ... well there goes that one I was building this to use on your rom to hopefully help troubleshoot (not that there aren't enough tools already included, and not that there are a lot of issues ). Meh ... still a good learning experience for if i ever get any other ideas on trying to help/contribute/give feed back
I'll still see if I can get anything successfully built without having to mangle patches to get the compiles to play nice. Either way my assumption is even if I do get something built, yours will be a tighter binary.
Thanks again everyone, I'll post any progress if I get anywhere for posterity.
pokey9000 said:
Try CFLAGS instead of CPPFLAGS, and use -L under LDFLAGS for the library include path instead of -I
Click to expand...
Click to collapse
Well for what it's worth I did get it built with the help of this post and some more mangling.
Actual configure string:
Code:
htop-0.8.3# ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes CFLAGS=-I/root/mydroid/arm-2009q1/include LDFLAGS=-L/root/mydroid/arm-2009q1/lib \./configure CC=/root/mydroid/arm-2009q1/bin/arm-none-linux-gnueabi-gcc CXX=/root/mydroid/arm-2009q1/bin/arm-none-linux-gnueabi-g++ --host=arm --build=arm-linux --with-shared --disable-big-core --enable-termcap --disable-GPM --without-ada
After this the make ran with 0 issues ... after pushing the file to the phone however I still can't execute it. Luckily strace existed, sadly it's great for one offs but not great for real debugging .. what I get from the trace is:
Code:
# pwd && busybox ls -lh htop && strace /system/htop
/system
-rwxrwxrwx 1 0 0 164.3K Aug 13 13:04 htop
execve("/system/htop", ["/system/htop"], [/* 11 vars */]) = -1 ENOENT (No such file or directory)
write(2, "strace: exec", 12strace: exec) = 12
write(2, ": ", 2: ) = 2
write(2, "No such file or directory", 25No such file or directory) = 25
write(2, "\n", 1
) = 1
io_submit(1, -1344067161, {...} <unfinished ... exit status 1>
It would seem I have a lot more to learn than what I thought lol
SpEnTBoY said:
Well for what it's worth I did get it built with the help of this post and some more mangling.
Actual configure string:
Code:
htop-0.8.3# ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes CFLAGS=-I/root/mydroid/arm-2009q1/include LDFLAGS=-L/root/mydroid/arm-2009q1/lib \./configure CC=/root/mydroid/arm-2009q1/bin/arm-none-linux-gnueabi-gcc CXX=/root/mydroid/arm-2009q1/bin/arm-none-linux-gnueabi-g++ --host=arm --build=arm-linux --with-shared --disable-big-core --enable-termcap --disable-GPM --without-ada
After this the make ran with 0 issues ... after pushing the file to the phone however I still can't execute it. Luckily strace existed, sadly it's great for one offs but not great for real debugging .. what I get from the trace is:
Code:
# pwd && busybox ls -lh htop && strace /system/htop
/system
-rwxrwxrwx 1 0 0 164.3K Aug 13 13:04 htop
execve("/system/htop", ["/system/htop"], [/* 11 vars */]) = -1 ENOENT (No such file or directory)
write(2, "strace: exec", 12strace: exec) = 12
write(2, ": ", 2: ) = 2
write(2, "No such file or directory", 25No such file or directory) = 25
write(2, "\n", 1
) = 1
io_submit(1, -1344067161, {...} <unfinished ... exit status 1>
It would seem I have a lot more to learn than what I thought lol
Click to expand...
Click to collapse
Did you solved your "-1 ENOENT (No such file or directory)write(2, "strace: exec", 12strace: exec)" error ?
I have the same problem cross compiling zsh :/
EDIT : solved by static linking
drakaz said:
Did you solved your "-1 ENOENT (No such file or directory)write(2, "strace: exec", 12strace: exec)" error ?
I have the same problem cross compiling zsh :/
Click to expand...
Click to collapse
Don't try to compile static binaries linked with glibc as this will not work
and is not supposed to work, because gnu libc links in other dynamic libraries
(libnss* and others) so what you obtain is not a really static library that fails
because it is looking for other dynamic libraries (ENOENT). Use uClibc for static builds.
can you please upload the compiled htop file? i cant compile myself.

[Tutorial] How to compile a kernel module outside the kernel

I've decided to make a short tutorial and present the way I compile kernel modules (outside the kernel sources).
I've built few kernel modules (governors - ineractive and smartass, cifs, nls, etc) and I started receiving private messages asking how I did it.
For kernel modules that come with the kernel itself - cifs / tun for example - they just work if you compile the kernel and activate correct config parameters.
Some other modules (such as the smartass governor that doesn't come with the kernel) you compile outside the kernel source. However they require changes since kernel does not export the symbols the module needs to use - so you have to know what k_all_syms are needed, grab them from the phone and update the kernel module.
So there will be changes there. However, the main steps are:
a) follow tutorials to get the kernel / android ndk to compile. People seem able to do this.
b) then take the module you want (For example cpufreq_smartass.c from here: http://pastebin.com/rR4QUCrk ) and copy it in a new folder on the disk.
c) create a Makefile like the one below, but with your paths of course:
Code:
KERNEL_DIR=/home/viulian/android_platform/kernel-2.1.A.0.435/kernel
obj-m := cpufreq_smartass.o
PWD := $(shell pwd)
default:
$(MAKE) ARCH=arm CROSS_COMPILE=/home/viulian/android_platform/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi- -C $(KERNEL_DIR) SUBDIRS=$(PWD) modules
clean:
$(MAKE) -C $(KERNEL_DIR) SUBDIRS=$(PWD) clean
d) execute make
Of course, the module source needs to be adjusted as you need to put in the frequencies, and also update the k_all_syms pointers .. But you can retrieve them from /proc/kallsyms on the device itself - just look for the method name, and use the address you see in the log.
If you still can't get it to compile, try to compile a very basic hello_world kernel module. I used the code below when testing:
Code:
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_ALERT */
MODULE_LICENSE("GPL");
MODULE_AUTHOR("viulian, 2011");
MODULE_DESCRIPTION("Demo module for X10i");
int init_module(void)
{
printk("<1>Hello world\n");
// A non 0 return means init_module failed; module can't be loaded.
return 0;
}
void cleanup_module(void)
{
printk(KERN_ALERT "Goodbye world 1.\n");
}
It is not perfect, but if you manage to insmod-it and check dmesg, you will see "Hello world" written there.
One more thing, linux kernel is fussy about the module versions. Even if nothing is changed between two kernel versions related to what a module needs, is enough a small difference in module's modinfo value to make the kernel to refuse the module.
For this, you need to trick your local kernel and adjust EXTRAVERSION value in kernel's main Makefile to have the exact version of the one on the device:
In X10 stock kernel (GB 2.3.3 release), the kernel version is 2.6.29-00054-g5f01537 visible in phone settings.
This means that the kernel on the phone will only accept modules that are compiled for that exact version. But the kernel version is just a string in the module .ko, so is a string comparison - the module might work perfectly, but is not loaded.
There is luck though, the string value comes from a define in kernel's Makefile, which you can change before you compile!
The Makefile in the kernel you are going to use to build the module will have to include these lines at the top:
Code:
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 29
EXTRAVERSION = -00054-g5f01537
Other than that, it should work .. Expect phone reboots and difficulty to debug if stuff goes wrong. Android kernel doesn't come with syslog functionality, kernel prints are found in /proc/kmsg. Dmesg works, but you can't execute if if phone reboots.
I usually had to keep another adb shell opening with 'cat /proc/kmsg' which showed as much as possible from the module's outputs.
Happy compiling on your risk!
Good
Sent from my GT-S5570 using Tapatalk
Nice really nice.
Anyone help me.have someone who could compile the linux bluetooth modules please? Iam noob in linux
http://www.multiupload.com/58OPISAYNH
Anyone please can make a video tutorial?
That's really nice of you for sharing this.
Guide to Compiling Custom Kernel Modules in Android
I've spent the better part of today trying to figure out how to compile and load a custom kernel modules in android to aid me in my research. It has been in entirely frustrating experience, as there is almost no documentation on the topic that I can find. Below you will find my attempt at a guide. Hopefully this will help save someone else the hassle.
PREREQUISITES
Disclaimer: This list may be incomplete, since I've not tried it on a fresh install. Please let me know if I've missed anything.
Install the general android prereqs found here .
Download and un(zip|tar) the android NDK found here .
http://developer.android.com/sdk/ndk/index.html
Download and un(zip|tar) the android SDK found here .
http://developer.android.com/sdk/index.html
Download and untar the kernel source for your device. This can usually be found on the website of your device manufacturer or by a quick Google search.
Root your phone. In order to run custom kernel modules, you must have a rooted phone.
Plug your phone into your computer.
PREPARING YOUR KERNEL SOURCE
First we must retrieve and copy the kernel config from our device.
Code:
$ cd /path/to/android-sdk/tools
$ ./adk pull /proc/config.gz
$ gunzip ./config.gz
$ cp config /path/to/kernel/.config
Next we have to prepare our kernel source for our module.
Code:
$ cd /path/to/kernel
$ make ARCH=arm CROSS_COMPILE=/path/to/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- modules_prepare
PREPARING YOUR MODULE FOR COMPILATION
We need to create a Makefile to cross-compile our kernel module. The contents of your Makefile should be similar to the following:
Code:
obj-m := modulename.o
KDIR := /path/to/kernel
PWD := $(shell pwd)
CCPATH := /path/to/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin
default:
$(MAKE) ARCH=arm CROSS_COMPILE=$(CCPATH)/arm-linux-androideabi- -C $(KDIR) M=$(PWD) modules
COMPILING AND INSTALLING YOUR MODULE
Code:
$ cd /path/to/module/src
$ make
$ cd /path/to/android-sdk/tools/
$ ./adb push /path/to/module/src/modulename.ko /sdcard/modulename.ko
RUNNING YOUR MODULE
Code:
$ cd /path/to/android-sdk/
$ ./adb shell
$ su
# insmod /sdcard/modulename.ko
---------- Post added at 07:40 PM ---------- Previous post was at 07:37 PM ----------
IMPORNTANT TOO
Preparing a build environment
To build an Android kernel, you need a cross-compiling toolchain. Theoretically, any will do, provided it targets ARM. I just used the one coming in the Android NDK:
$ wget http://dl.google.com/android/ndk/android-ndk-r6b-linux-x86.tar.bz2
$ tar -jxf android-ndk-r6b-linux-x86.tar.bz2
$ export ARCH=arm
$ export CROSS_COMPILE=$(pwd)/android-ndk-r6b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-
For the latter, you need to use a directory path containing prefixed versions (such as arm-eabi-gcc orarm-linux-androideabi-gcc), and include the prefix, but not “gcc”.
You will also need the adb tool coming from the Android SDK. You can install it this way:
$ wget http://dl.google.com/android/android-sdk_r12-linux_x86.tgz
$ tar -zxf android-sdk_r12-linux_x86.tgz
$ android-sdk-linux_x86/tools/android update sdk -u -t platform-tool
$ export PATH=$PATH:$(pwd)/android-sdk-linux_x86/platform-tools
not yet ((((
Come on, please make video tuto
that's interesting.
Thanks for sharing
Any takers to do a video status? Come on people it would be good for newbies like me and many that tme around. When teaching the community grows.
hi
i'm traing to compile module for acer a500.
but i have got an error: Nothing to be done for `default'.
my makefile:
Code:
obj-m += hello.o
KDIR := /home/hamster/android
PWD := $(shell pwd)
CCPATH := /home/hamster/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin
default:
$(MAKE) ARCH=arm CROSS_COMPILE=$(CCPATH)/arm-linux-androideabi- -C $(KDIR) M=$(PWD) modules
acer kernel code is located in /home/hamster/android
could you help me?
thanks
Thanks man. The step "modules_prepare" is what did the trick for me!
Makefile including tabs
hamsterksu said:
hi
i'm traing to compile module for acer a500.
but i have got an error: Nothing to be done for `default'.
my makefile:
Code:
obj-m += hello.o
KDIR := /home/hamster/android
PWD := $(shell pwd)
CCPATH := /home/hamster/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin
default:
$(MAKE) ARCH=arm CROSS_COMPILE=$(CCPATH)/arm-linux-androideabi- -C $(KDIR) M=$(PWD) modules
acer kernel code is located in /home/hamster/android
could you help me?
thanks
Click to expand...
Click to collapse
This is probably because you need to add a tab in front of your $(MAKE). Without the tab it will not recognize the command.
Help with compiling module
I am trying to compile a module for Galaxy S. I am getting this error.
# insmod hello_world.ko
insmod: init_module 'hello_world.ko' failed (Exec format error)
These are the module related options that I have enabled in the .config
CONFIG_MODULES=y
CONFIG_MODULE_FORCE_LOAD=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
# CONFIG_MODVERSIONS is not set
# CONFIG_MODULE_SRCVERSION_ALL is not set
Further this is the cat /proc/kmsg out put
<3>[53597.457275] hello_world: version magic '2.6.35.7-I900XXJVP-CL264642 preempt mod_unload ARMv7 ' should be '2.6.35.7-I9000XXJVP-CL264642 preempt mod_unload ARMv7 '
Why am I getting this error??
These are the steps I followed,
1. Downloaded the GT-I9000_OpenSource_GB.zip from samsung open source.
2. Change the EXTRAVERSION to EXTRAVERSION = .7-I900XXJVP-CL264642 (kernel version shown on phone is [email protected] #2)
I tried with EXTRAVERSION = [email protected] as well.
3. Added this line to the main make file -
core-y := usr/ TestModule/
5. Place the TestModule/ with the module code on the root directory.
6. Created the TestModule/Makefile and added this entry
obj-m := hello_world.o
4. On the read me of the kernel source it says to install Sourcery G++ Lite 2009q3-68 toolchain for ARM EABI, which I did.
5. Execute 'make aries_eur_defconfig'.
6. Execute make (again this is how the readme in the source says)
I have compiled this module for the emulator and it works fine, What am I doing wrong here?
Thanks in advance.
hamsterksu said:
hi
but i have got an error: Nothing to be done for `default'.
Code:
default:
$(MAKE) ARCH=arm CROSS_COMPILE=$(CCPATH)/arm-linux-androideabi- -C $(KDIR) M=$(PWD) modules
Click to expand...
Click to collapse
be sure to have {tab} not space or other symbol before: $(MAKE) in:
Code:
default:
$(MAKE) ARCH=arm CROSS_COMPILE=$(CCPATH)/arm-linux-androideabi- -C $(KDIR) M=$(PWD) modules
Hello,
I'm trying to load a module in my GS3 but I encounter problems about version. Maybe it's just a mismatch between the kernel i use to compile and the one on my phone.
I have a 3.0.31-742798 kernel version on my GS3, so I put this info in the makefile like viulian said but it didn't work.
I manage to compile and put the module on the phone, but when I want to insmod it, I've got
Code:
insmod: init_module 'hello_world.ko' failed (Exec format error)
and the /proc/kmsg say
Code:
... disagrees about version of symbol module_layout
And there no config.gz on the /proc/ dir like fabricioemmerick suggest to use
EDIT: I try to modify the symbol by copying the one of module from the phone. Have another error.
btw , with modinfo I found that the compilation always add -gc33f1bc-dirty after the subversion. Maybe something in the compilation goes wrong. Still use the stock kernel and the toolchain from the ndk sourcecode
m00gle said:
Hello,
I'm trying to load a module in my GS3 but I encounter problems about version. Maybe it's just a mismatch between the kernel i use to compile and the one on my phone.
I have a 3.0.31-742798 kernel version on my GS3, so I put this info in the makefile like viulian said but it didn't work.
I manage to compile and put the module on the phone, but when I want to insmod it, I've got
Code:
insmod: init_module 'hello_world.ko' failed (Exec format error)
and the /proc/kmsg say
Code:
... disagrees about version of symbol module_layout
And there no config.gz on the /proc/ dir like fabricioemmerick suggest to use
EDIT: I try to modify the symbol by copying the one of module from the phone. Have another error.
btw , with modinfo I found that the compilation always add -gc33f1bc-dirty after the subversion. Maybe something in the compilation goes wrong. Still use the stock kernel and the toolchain from the ndk sourcecode
Click to expand...
Click to collapse
Maybe your kernel source code version and your phone kernel version is different. If both are 3.0.31 but just the subversion is different, you can
try "insmod -f" to load. The -f option will ignore the version.
How can I get a dmesg of a specific kernel module using adb shell or any other way?
ravike14 said:
How can I get a dmesg of a specific kernel module using adb shell or any other way?
Click to expand...
Click to collapse
I'm not sure I understand the question ... you can just dmesg and grep by the module name ? Or some string that the module outputs ? You have full control
viulian said:
I'm not sure I understand the question ... you can just dmesg and grep by the module name ? Or some string that the module outputs ? You have full control
Click to expand...
Click to collapse
That's the part I don't understand, the grep part.. When I enter grep with my commamd I get as it's not a recognized command.. I'm using Windows is that the reason?
I'm using 'adb shell dmesg > dmesg.txt' how do I add the grep part for it and and the module name.. I did alot research but all are Linux kernel specific debugging guides.. What would be the exact command to grep a specific module.ko logs?
Sent from my HTC_Amaze_4G using XDA Premium 4 mobile app
ravike14 said:
I'm using 'adb shell dmesg > dmesg.txt' how do I add the grep part for it and and the module name.. I did alot research but all are Linux kernel specific debugging guides.. What would be the exact command to grep a specific module.ko logs?
Click to expand...
Click to collapse
I think I understand now
The order is this:
a) DroidSSHd from here: http://code.google.com/p/droidsshd/downloads/list
b) Busybox installer from the market.
c) Putty on your windows to connect to the phone
Now you can dmesg + grep once you are connected to the phone (don't forget to su before and allow DroidSSHd root).
You need to be connected to the phone since it is much more easier. Use the phone as your remote Linux machine.

[Wanted] Kernel Open Source Code

Android has Modified Linux kernel under GNU GPL v2 which means manufacturer must share their kernels for devices when asked.
But... It is Huawei...
When other companies released their kernel sources, Huawei posted only text files.
Huawei Open Source MiniSite
MHA Open Source Text File
LON Open Source Text File
Text file:
Huawei Device Co., Ltd ("Huawei")is pleased to provide you the corresponding open source code of the device. If you want the code, please contact us with an email titled "Open Source Codes Issue" to [email_removed_against_spam_it_is_in_text_file_by_link]. Please note we may charge you the cost of physically performing source distribution like sending you a CD of the Open Source Codes, if you reqest. And the code download link will be ready soon.
I tried two times, sent emails, but nobody answered to me. It looks like Xiaomi did. They delayed posting code for 6 months and more. And there is nothing to do...
I am ready to sign a petition !
Sent from my MHA-AL00 using Tapatalk
Could you PM me the email?
Nvm, found it.
ante0 said:
Could you PM me the email?
Click to expand...
Click to collapse
It is in text file by link above
Anyway, i PM to you)
5[Strogino] said:
It is in text file by link above
Anyway, i PM to you)
Click to expand...
Click to collapse
Emailed them too now.
I guess, if they don't provide a source, we could ask GNU GPL for help
emailed to them, Hope I can get reply
I just sent them an email.
If you take time to actually read. They are "working on it"
LastStandingDroid said:
If you take time to actually read. They are "working on it"
Click to expand...
Click to collapse
So probably anytime from now to years in the future...
The Rollout of Nougat should be done end of First quarter, so i think it comes between april and may.
I have seen the new P10 and I loved it but came here to check how is Huawei behaving in terms of Kernel sources so devs can work on roms/mods. This post means that they wont give much facilities for this ?
Javi22 said:
I have seen the new P10 and I loved it but came here to check how is Huawei behaving in terms of Kernel sources so devs can work on roms/mods. This post means that they wont give much facilities for this ?
Click to expand...
Click to collapse
Chinese OEM's don't care for GPL.. If you are looking for a device with good development look elsewhere
liam_davenport said:
Chinese OEM's don't care for GPL.. If you are looking for a device with good development look elsewhere
Click to expand...
Click to collapse
Understand..sorry for little OT but although they dont release kernel, are there good mods possibilities using Xposed or this is like Xiaomi where xposed is very problematic with miui?
If not I would imagine that having a Huawei for 2 years or more is boring as you can't personalise too much
How do we help Huawei to release the 4.1.18 kernel source code ?
Code:
HWMHA:/data/data # uname -a
Linux localhost 4.1.18-g0ad0fb3 #1 SMP PREEMPT Tue Apr 11 12:25:26 CST 2017 aarch64
There is a kernel 3.10.90 source available for Honor-8 (FRD), which has similar device driver setup, but a different CPU (hi3650 vs. hi3660).
I could compile this kernel for FRD (with minor code editing), but the compilation for the hi3660 target failed because of some missing bit number
#define's and macros (for ppll2 and ppll3). If needed, these could be derived with relative ease by disassembling the respective functions in the current kernel:
Code:
HWMHA:/data/data # echo 1 > /proc/sys/kernel/kptr_restrict
HWMHA:/data/data # cat /proc/kallsyms | grep ppll
ffffffc000805e30 t xgene_pcppllclk_init
ffffffc000806668 t hi3xxx_multicore_ppll_disable
ffffffc0008067c0 t hi3xxx_multicore_ppll_enable
ffffffc0017a25b4 t hi3xxx_ppll_setup
ffffffc0017d4fb8 t __of_table_xgene_pcppll_clock
ffffffc0017d52d8 t __of_table_hi3xxx_ppll
ffffffc0018eaa70 d hi3xxx_ppll_ops
Another source of the hi3660 kernel code is hikey960 repository at https://github.com/96boards-hikey/linux , but it is missing many device
drivers necessary for the phone.
Both kernels also lack the Device Tree Spec (DTS) for Mate 9, although this one is readily available from the current kernel
Code:
HWMHA:/data/data # cat /sys/firmware/fdt > /storage/sdcard1/FDT
HWMHA:/data/data # exit
HWMHA:/ $ exit
# adb pull /storage/sdcard1/FDT
# dtc -o MHA.dts -O dts -I dtb FDT
Here is the beginning of the 500K MHA.dts file, providing all "MHA_TUGL_VN2" board configuration data:
Code:
/dts-v1/;
/ {
#address-cells = <0x2>;
#size-cells = <0x2>;
model = "hi3660";
compatible = "hisilicon,hi3660";
interrupt-parent = <0x1>;
hisi,boardid = <0x5 0x5 0x0 0x9>;
hisi,boardname = "MHA_TUGL_VN2";
hisi,modem_id = <0x3a001400>;
hisi,sub_platform_info3 = "Kirin960";
hisi,provider3 = "BALONG";
hisi,sub_platform_info2 = "Kirin960";
hisi,provider2 = "BALONG";
hisi,sub_platform_info1 = "Kirin960";
hisi,provider1 = "BALONG";
hisi,sub_platform_info0 = "Kirin960";
hisi,provider0 = "HUAWEI_K3";
hisi,platform_num = <0x4>;
hisi,gpu_arch = "mimir";
hisi,camera_arch = "platform_v110";
hisi,camera_arch_v120 = "platform_v120";
...
There is another good thing about the current 4.1.18 kernel: it includes the kexec syscall
Code:
HWMHA:/data/data # echo 1 > /proc/sys/kernel/kptr_restrict
HWMHA:/data/data # cat /proc/kallsyms | grep kexec
ffffffc0000c430c W compat_sys_kexec_load
ffffffc0000c430c W sys_kexec_file_load
ffffffc0000c430c W sys_kexec_load
ffffffc001766794 t setup_crash_kexec_post_notifiers
ffffffc0017d2092 t __setup_str_setup_crash_kexec_post_notifiers
ffffffc0017d6fa8 t __setup_setup_crash_kexec_post_notifiers
ffffffc001a75758 b crash_kexec_post_notifiers
so it should be possible to test a self-compiled kernel zImage without any flashing
https://wiki.archlinux.org/index.php/kexec
and using a bare ramdisk image (unspoiled by weird android stuff)
https://github.com/96boards-hikey/l-loader/blob/master/rootfs.tar.gz
Would it be possible to build a kernel module (like loop.ko) from the hikey960 repository?
Could such a kernel module be loaded into the kernel of the Mate 9?
st_voss said:
Would it be possible to build a kernel module (like loop.ko) from the hikey960 repository?
Click to expand...
Click to collapse
It is a pretty hardware-independent and generic module with stable ABI,
you can try a precompiled .ko from any aarch64 kernel for the same kernel version
(i don't know how strict do they check the version numbers).
Could such a kernel module be loaded into the kernel of the Mate 9?
Click to expand...
Click to collapse
We should check if there are any SELinux restrictions for loading modules, and how to work around them.
All the module infrastructure is compiled into the kernel
Code:
ffffffc000576198 T module_add_driver
ffffffc000576260 T module_remove_driver
...
Huawei currently does not use dynamic modules (probably to avoid the support nightmares)
Code:
HWMHA:/data/data # lsmod
Module Size Used by
HWMHA:/data/data # modprobe -av
modprobe: can't change directory to '/system/lib/modules': No such file or directory
I have compiled loop.ko in the hikey960 tree (modules are disabled there by default), but cannot insert it
Code:
HWMHA:/data/data # insmod /system/lib/modules/4.1.18-g0ad0fb3/loop.ko
insmod: failed to load /system/lib/modules/4.1.18-g0ad0fb3/loop.ko: Exec format error
HWMHA:/data/data # strace insmod /system/lib/modules/4.1.18-g0ad0fb3/loop.ko
...
getuid() = 0
geteuid() = 0
umask(0) = 0
umask(0) = 0
openat(AT_FDCWD, "/system/lib/modules/4.1.18-g0ad0fb3/loop.ko", O_RDONLY|O_CLOEXEC) = 3
finit_module(3, "", 0) = -1 ENOEXEC (Exec format error)
write(2, "insmod: ", 8insmod: ) = 8
write(2, "failed to load /system/lib/modul"..., 58failed to load /system/lib/modules/4.1.18-g0ad0fb3/loop.ko) = 58
write(2, ": Exec format error", 19: Exec format error) = 19
write(2, "\n", 1) = 1
...
HWMHA:/data/data # cat /proc/sys/kernel/modules_disabled
0
It was my error, because the loop driver is already in the kernel
Code:
HWMHA:/data/data # cat /proc/kallsyms | grep loop_ | grep trans
ffffffc0005804c0 T loop_register_transfer
ffffffc000580784 T loop_unregister_transfer
ffffffc00058362c t cryptoloop_transfer
ffffffc00170c620 R __ksymtab_loop_register_transfer
ffffffc00170c630 R __ksymtab_loop_unregister_transfer
ffffffc001739b20 r __kstrtab_loop_unregister_transfer
ffffffc001739b39 r __kstrtab_loop_register_transfer
PS. The problem is more complex, i can't also load other modules.
Code:
ffffffc000127b3c T sys_finit_module
...
It was my error, because the loop driver is already in the kernel
Code:
HWMHA:/data/data # cat /proc/kallsyms | grep loop_ | grep trans
ffffffc0005804c0 T loop_register_transfer
ffffffc000580784 T loop_unregister_transfer
ffffffc00058362c t cryptoloop_transfer
ffffffc00170c620 R __ksymtab_loop_register_transfer
ffffffc00170c630 R __ksymtab_loop_unregister_transfer
ffffffc001739b20 r __kstrtab_loop_unregister_transfer
ffffffc001739b39 r __kstrtab_loop_register_transfer
PS. The problem is more complex, i can't also load other modules.
Code:
ffffffc000127b3c T sys_finit_module
Click to expand...
Click to collapse
You are right. Loop support is already in the kernel.
And we can even use it if selinux is set permissive!
Code:
HWMHA:/data/data # losetup /dev/block/loop0
/dev/block/loop0: [1031e]:6429 (/data/magisk.img)
HWMHA:/data/data # mount -t ext4 -o loop /dev/block/loop0 /magisk
mount: '/dev/block/loop0'->'/magisk': Invalid argument
HWMHA:/data/data # setenforce 0
HWMHA:/data/data # mount -t ext4 -o loop /dev/block/loop0 /magisk
HWMHA:/data/data # mount | grep loop
/dev/block/loop0 on /magisk type ext4 (rw,seclabel,relatime,data=ordered)
st_voss said:
You are right. Loop support is already in the kernel.
And we can even use it if selinux is set permissive!
Code:
HWMHA:/data/data # losetup /dev/block/loop0
/dev/block/loop0: [1031e]:6429 (/data/magisk.img)
HWMHA:/data/data # mount -t ext4 -o loop /dev/block/loop0 /magisk
mount: '/dev/block/loop0'->'/magisk': Invalid argument
HWMHA:/data/data # setenforce 0
HWMHA:/data/data # mount -t ext4 -o loop /dev/block/loop0 /magisk
HWMHA:/data/data # mount | grep loop
/dev/block/loop0 on /magisk type ext4 (rw,seclabel,relatime,data=ordered)
Click to expand...
Click to collapse
What good exactly will it do us then? I'm lost in all that tech talk. Halp!

Building LineageOS 16.0

Hi,
I'd ask this in the development forum but unfortunately that has a 10 post minimum, and i currently have 1 post.
I'm trying to compile lineage-16.0 for zerofltexx.
I tried using the local_manifests file from various github repositories (for instance enesuzun2002's and TeamNexus's) but am running into errors with android_hardware_samsung_slsi-cm_exynos7420.
I was wondering if someone could shine some light on how i would go about compiling this.
The errors i am running into are:
hardware/samsung_slsi-cm/exynos7420/mobicore/daemon/Common/CWsm.h:56:33: error: implicit conversion of NULL constant to 'uint64_t' (aka 'unsigned long') [-Werror,-Wnull-conversion]
hardware/samsung_slsi-cm/exynos7420/mobicore/daemon/Daemon/MobiCoreDriverDaemon.cpp:217:56: error: unused parameter 'connection' [-Werror,-Wunused-parameter]
To name a few (more information can easily be provided).
Since this repository hasnt been updated in quite some time and there are multiple unofficial roms for the zerofltexx i imagine i am doing something utterly wrong.
Does anyone have any experience with this?
Thanks a lot
Edit:
Building on Ubuntu 18.04
:good:
Use slsi repos of @ripee
ripee-zero
I pushed my local manifests as well
All devving courtesy of enesuzun2002.
ripee said:
github.com/ripee-zero
I pushes my local manifests as well
All devving courtesy of enesuzun2002.
Click to expand...
Click to collapse
Thanks a lot!
I'll try it out
ripee said:
github.com/ripee-zero
I pushes my local manifests as well
All devving courtesy of enesuzun2002.
Click to expand...
Click to collapse
Thanks so much for the help so far, i really appreciate it.
I've tried compiling with your local_manifests and it gets past the errors that i posted before.
It gets all the way to around 96% but unfortunately still gets a build error.
Is this something i've misconfigured?
The current build error is:
Code:
[ 2% 100/3408] Hidden API: /home/subcode/android/lineage/out/target/common/obj/JAVA_LIBRARIES/android.test.base_intermediates/javalib.jar
FAILED: /home/subcode/android/lineage/out/target/common/obj/JAVA_LIBRARIES/android.test.base_intermediates/javalib.jar
/bin/bash -c "(rm -f /home/subcode/android/lineage/out/target/common/obj/JAVA_LIBRARIES/android.test.base_intermediates/javalib.jar ) && (cp \"/home/subcode/android/lineage/out/soong/.intermediates/frameworks/base/test-base/android.test.base/android_common/dex/android.test.base.jar\" \"/home/subcode/android/lineage/out/target/common/obj/JAVA_LIBRARIES/android.test.base_intermediates/javalib.jar\" ) && (rm -rf /home/subcode/android/lineage/out/target/common/obj/JAVA_LIBRARIES/android.test.base_intermediates/dex-hiddenapi ) && (mkdir -p /home/subcode/android/lineage/out/target/common/obj/JAVA_LIBRARIES/android.test.base_intermediates/dex-hiddenapi ) && (unzip -q /home/subcode/android/lineage/out/target/common/obj/JAVA_LIBRARIES/android.test.base_intermediates/javalib.jar 'classes*.dex' -d /home/subcode/android/lineage/out/target/common/obj/JAVA_LIBRARIES/android.test.base_intermediates/dex-hiddenapi ) && (find /home/subcode/android/lineage/out/target/common/obj/JAVA_LIBRARIES/android.test.base_intermediates/dex-hiddenapi -name \"classes*.dex\" | sort | sed 's/^/--dex=/' | xargs /home/subcode/android/lineage/out/host/linux-x86/bin/hiddenapi --light-greylist=/home/subcode/android/lineage/out/target/common/obj/PACKAGING/hiddenapi-light-greylist.txt --dark-greylist=/home/subcode/android/lineage/out/target/common/obj/PACKAGING/hiddenapi-dark-greylist.txt --blacklist=/home/subcode/android/lineage/out/target/common/obj/PACKAGING/hiddenapi-blacklist.txt ) && (/home/subcode/android/lineage/out/soong/host/linux-x86/bin/soong_zip -o /home/subcode/android/lineage/out/target/common/obj/JAVA_LIBRARIES/android.test.base_intermediates/dex-hiddenapi/classes.dex.jar -C /home/subcode/android/lineage/out/target/common/obj/JAVA_LIBRARIES/android.test.base_intermediates/dex-hiddenapi -D /home/subcode/android/lineage/out/target/common/obj/JAVA_LIBRARIES/android.test.base_intermediates/dex-hiddenapi ) && (/home/subcode/android/lineage/out/soong/host/linux-x86/bin/merge_zips -D -zipToNotStrip /home/subcode/android/lineage/out/target/common/obj/JAVA_LIBRARIES/android.test.base_intermediates/dex-hiddenapi/classes.dex.jar -stripFile \"classes*.dex\" /home/subcode/android/lineage/out/target/common/obj/JAVA_LIBRARIES/android.test.base_intermediates/javalib.jar /home/subcode/android/lineage/out/target/common/obj/JAVA_LIBRARIES/android.test.base_intermediates/dex-hiddenapi/classes.dex.jar /home/subcode/android/lineage/out/soong/.intermediates/frameworks/base/test-base/android.test.base/android_common/dex/android.test.base.jar )"
xargs: /home/subcode/android/lineage/out/host/linux-x86/bin/hiddenapi: terminated by signal 4
[ 3% 105/3408] Building Kernel Config
make: Entering directory '/home/subcode/android/lineage/kernel/samsung/exynos7420'
GEN /home/subcode/android/lineage/out/target/product/zerofltexx/obj/KERNEL_OBJ/Makefile
Kconfig:15:warning: environment variable ANDROID_MAJOR_VERSION undefined
arch/arm64/configs/lineageos_zerofltexx_defconfig:475:warning: override: reassigning to symbol IKCONFIG
#
# configuration written to .config
#
make: Leaving directory '/home/subcode/android/lineage/kernel/samsung/exynos7420'
make: Entering directory '/home/subcode/android/lineage/kernel/samsung/exynos7420'
GEN /home/subcode/android/lineage/out/target/product/zerofltexx/obj/KERNEL_OBJ/Makefile
scripts/kconfig/conf --savedefconfig=defconfig Kconfig
Kconfig:15:warning: environment variable ANDROID_MAJOR_VERSION undefined
make: Leaving directory '/home/subcode/android/lineage/kernel/samsung/exynos7420'
ninja: build stopped: subcommand failed.
12:28:24 ninja failed with: exit status 1
Edit: I've just found something that says its possibly a CPU problem.
Since i'm building inside a VM, i'll try building without a VM to see if this fixes the problem.
Edit2: Unfortunately compiling outside of my VM did not work.
Kyrraz said:
Edit: I've just found something that says its possibly a CPU problem.
Since i'm building inside a VM, i'll try building without a VM to see if this fixes the problem.
Click to expand...
Click to collapse
Reduce the amount of RAM and number of cores assigned to your vm.
ripee said:
Reduce the amount of RAM and number of cores assigned to your vm.
Click to expand...
Click to collapse
Any specific number i should be looking for?
edit: 1 core and 8GB of ram did not change anything, but since the other solution i found said its that i'm missing SSE4.1 support in my cpu im not sure less of anything would be better?
I'll try building on a different CPU, but this will be tomorrow at the earliest unfortunately.
Here's a late update,
Building with a more modern CPU did the trick, apparently you really do need SSE4.1 support.
Thanks a lot!
I have the same error but my CPU have SSE 4.1 support

How to specify a custom defconfig file in Android 10 Kernel compilation

I wanted to enable certain kernel features and in my Android 10 build for Pixel 3. I downloaded and built the correct msm kernel and successfully flashed it on the Pixel. To build the kernel I'm using the build/build.sh from the kernel source. I tried adding a custom defconfig file in private/msm-google/arch/arm64/configs/ and changing the DEFCONFIG variable in build.config to that file. When I compile I get following error:
Code:
++ echo ERROR: savedefconfig does not match private/msm-google/arch/arm64/configs/sdm845_defconfig
ERROR: savedefconfig does not match private/msm-google/arch/arm64/configs/sdm845_defconfig
How can I compile the kernel with a custom defconfig? It doesn't have to be through the build.sh method (although it would be preferable)
gardeimasei said:
I wanted to enable certain kernel features and in my Android 10 build for Pixel 3. I downloaded and built the correct msm kernel and successfully flashed it on the Pixel. To build the kernel I'm using the build/build.sh from the kernel source. I tried adding a custom defconfig file in private/msm-google/arch/arm64/configs/ and changing the DEFCONFIG variable in build.config to that file. When I compile I get following error:
Code:
++ echo ERROR: savedefconfig does not match private/msm-google/arch/arm64/configs/sdm845_defconfig
ERROR: savedefconfig does not match private/msm-google/arch/arm64/configs/sdm845_defconfig
How can I compile the kernel with a custom defconfig? It doesn't have to be through the build.sh method (although it would be preferable)
Click to expand...
Click to collapse
I don't know if it's solved, but I solved the problem removing the "check defconfig" in build.config (the symlink in the root which points to the kernel build.config).
Change
Code:
POST_DEFCONFIG_CMDS="check_defconfig"
to
Code:
POST_DEFCONFIG_CMDS=""
I've been working with a Google engineer who showed me the fix for my savedefconfig problem. Maybe it will fix yours, too.
The key is to set ARCH:
Code:
$ export ARCH=arm64
Here's the context and full procedure. My work is based on the b1c1_defconfig config. Your directory names may vary.
Code:
$ cd private/msm-google
$ export ARCH=arm64 # this is the magic line
$ make b1c1_defconfig # This sets up the config for my hardware. Yours is probably different.
$ make menuconfig
Now edit the kernel configuration and save it as ".config", the default.
When you're done:
Code:
$ make savedefconfig
$ cp defconfig arch/arm64/configs/b1c1_defconfig # or whatever your hardware configuration is
$ make mrproper
With luck, you won't see any savedefconfig problems.

Categories

Resources