So long story short, I wanted to build the ftdi_sio.ko module for the linux kernel of android based MiBox 1S. I was able to build the module but once I run "insmod" via adb, the system crashes and reboots (I couldn't see any error message because of this). Please could anyone suggest how to find where the problem is or whether what I wanted to do is even possible?
The device is running system version 1.3.88 rooted by the Chinese 360 root app. Kernel version follows:
Code:
adb shell cat /proc/version
Linux version 3.10.33 ([email protected]) (gcc version 4.7.3 20130205 (prerelease) (crosstool-NG linaro-1.13.1-4.7-2013.02-01-20130221 - Linaro GCC 2013.02) ) #1 SMP PREEMPT Tue Jun 16 00:38:26 CST 2015
As Xiaomi doesn't have kernel source release for MiBox (afaik), I went to look for the Amlogic kernel source for AML8726-MX (M6).
The closet kernel source I could find was from Stane1983's github repo amlogic-m6_m8. I'm using the earliest commit for 3.10.33 kernel version.
For the building of the kernel module, I pretty much followed a github document named 'Android-Build-Kernel-Modules-HOWTO.txt' by marco-pratesi. I downloaded the toolchain from the archive of linaro releases 13.02 which shows the same version of the android kernel above. I copied the .config from arch/arm/configs/meson6_deconfig and use 'make menuconfig' to add OTG_support and USB FTDI Single Port Serial Driver. Make the module by "make M=drivers/usb/serial/". And then adb push the generated ftdi_sio.ko file to /mnt/sdcard.
For loading the module, I run
Code:
adb shell
su
insmod /mnt/sdcard/ftdi_sio.ko
Then the box freezes for 10 seconds and reboots...
So my questions are:
1. Is there a way to find some logs of insmod to know what's gone wrong? As the system freezes and reboots, I can't use the dmesg method normally suggested, can I?
2. As the kernel source is from Amlogic, could it be that Xiaomi created their own kernel that is very different from this one to cause this problem?
3. Even if Xiaomi used exactly the same source code, as i'm using the meason6_defconfig file from the repo, it is likely to be different from the one Xiaomi was using. Would it matter for just building a module?
4. Is it possible to recover the config file from the prebuild kernel? I counld't find /proc/config.gz. And modprobe has error "can't open 'modules.dep': No such file or directory. "
5. What else I can try?
Sorry for the long post. I'm very new to this type of work and this forum as well. So any comments would be appreciated.
Related
Hi,
If you're a developer, I need your help.
I am running the following:
Android 2.3.4
Baseband I9100XXKH3
Kernel 2.6.35.11-ninphetamine-2.0.5+ ninpo at titan #20
Version Lite'ning Rom v6.1 XXKH3
I would like to compile a module (usb serial driver ftdi_sio.ko). For that I need the kernel source code. I found github.com /Ninpo /ninphetamine and got as far as compiling the module and insmod it, but I got in dmesg
"ftdi_sio: version magic '2.6.35.11-ninphetamine-2.0.5 SMP preempt mod_unload ARMv7 ' should be '2.6.35.11-ninphetamine-2.0.5+ SMP preempt mod_unload ARMv7 '
My problem I assume is that the source for ninphetamine I use, Android-galaxys2-ninphetamine-2d1ffbc, is not the right one. I can't find on the web the right source code version (2.0.5+), not to mention 2.1.3.
Anyone can point to the source code for me? (on a server that is running, kernel.org is on maintenance)
I am also quite open to install another ROM, kernel or other... even if possible one that has by default ftdi_sio.ko module running by default.
Thanks in advance for your responses.
edit:
I have now figured out so much, I can hack a bit to be able to insmod the modules:
- had to manually edit .config (replace ninphetamine-2.0.5 by ninphetamine-2.0.5+)
- make menuconfig modules ARCH=arm CROSS_COMPILE=arm-linux-androideabi-
- make drivers/usb/serial/*.ko ARCH=arm CROSS_COMPILE=arm-linux-androideabi- EXTRA_CFLAGS=-fno-pic
(it seems this -fno-pic was required for that version of tools, but does not work for all modules either)
=> it would still be nice to have access to exact source/config used to compile a ROM/kernel as well as the tools used to build it.
Now both modules load, but when I plug my device I am back to start with dmesg:
- usb 2-1: new full speed USB device using s3c_otghcd and address 2
- usb 2-1: device v0403 p6001 is not supported
- host_notify: ndev name=s3c_otghcd: from state=0 -> to state=5
- otg_dbg: in otg_handle_interrupt()::00087
- => Port Interrupt
- otg_dbg: in process_port_intr()::00271
- => port enable/disable changed
- hub 2-0:1.0: unable to enumerate USB device on port 1
Hope anyone get a clue.
Bump Bump Bump
A nice piece of advice was found here:
http://forum.xda-developers.com/showthread.php?p=18081882#post18081882
<3>[ 154.264768] bcm4329: version magic '2.6.35.14-cyanogenmod-g1ad182f preempt mod_unload ARMv7 ' should be '2.6.35.14-cyanogenmod-g704f542 preempt mod_unload ARMv7 '
I've successfully built the samsung-kernel-crespo kernel from the cyanogenmod git. I unpacked a working ramdisk from a nightly and repacked it with my kernel, when i try to load the module i get the above error, The "extraversion" info that in the "about phone" tab in sittings is 2.6.35.14-cyanogenmod-g704f542, as well as the version of the modules. but for some reason the kernel is looking for that 'g1ad182f ' instead.
I loaded the module via fastboot boot boot.img and i didnt full on flash it to the phone. I backed up the working kernel module and put the new one in /system/lib/modules, rebooted the kernel and the wifi is still giving me an error.
If i try to manually insmod the module and it hangs, if i use modprobe then lsmod it says its "loading" but never loads.
the phone im working on is a nexus s if that matters.
Solved
It looks like cyanogenmod puts the kernel modules in /system/modules/ instead of /system/lib/modules/. I put the kernel modules in there and it appears to be working now.
Okay so heres my problem.. Im currently trying to compile modules to add to my z902. i have the 3.0.8 kernel source used for the mele which uses the same allwinner a10 proccessor. I have done some looking around and found that in order for android to load the module it needs to be compiled with the correct vermagic as well.. i managed to get info from both a module already on the device and from the module i compiled.
My module retrieves the following info when using modinfo()...
filename: hid-sony.ko
license: GPL
alias: hid:b0003v0000054Cp0000024B
alias: hid:b0005v0000054Cp00000268
alias: hid:b0003v0000054Cp0000042F
alias: hid:b0003v0000054Cp00000268
depends:
vermagic: 3.0.8+ preempt mod_unload modversions ARMv7
the original im comparing to looks as follows...
filename: sun4i-keypad.ko
alias: platform:sw-keypad
license: GPL
author: Aaron.maoye<[email protected]>
description: SW keypad driver
depends:
vermagic: 3.0.8+ preempt mod_unload modversions ARMv7
this is what it took me a while to acheive. the problem is when trying to insert the module into linux using the insmod command i get this error..
insmod: init_module 'hid-sony.ko' failed (Exec format error)
afterwords i ran dmesg and noticed a line that looks as follows:
hid-sony: dissagrees about version of symbol module_layout
after doing this i read about a way to overlook the vermagic by using modprobe..
here i ran into another problem.. when executing modprobe as follows i recive this error..
#busybox modprobe hid-sony.ko
modprobe: chdir(/lib/modules): No such file or directory
after recieving this error i tried making the directory and typed in the same command..
it returned that modules.dep was not found..i looked into this file and it seems to be where linux stores all the initiated drivers.
I searched high and low and could not find this file anywhere on the system.
my question is.. What the hell am i doing wrong..? lol
I compiled the entire kernel first.. then i compiled the modules afterwords to a set location.
does the baseband version info have anything to do with this because i couldnt find any info on it..
the z902 has 1.2.3 as a baseband..? is it possible i may not have the correct kernel source..?
anyone who helps me solve this i will personally buy them a unit and set it up for them.. lol
BUMP
Bump.. please someone help... how can i make modules.dep without depmod in my busybox applets.. anyone know if i can update busybox within android or through linux. id really like to add support for some controllers and bluetooth dongles. im pretty sure the module is setup and compiled right. but its trying to install it in the wrong place. unless it matters that android is compiled within the kernel as well.. because the tutorial i read through didnt say it was neccisary. i belive it was aimed towards the mele a2000. but its an allwinner a10 with the same kernel. 3.0.8+.. the only thing in not sure of is the build number. the z902 shows a 1.2.3 build. and i have no clue what build number the mele a2000 uses.
prob a waste of time as nobody seems interested...
I managed to update busy box and add depmod to the list of applets. After doing so I tried mod probe and the module still won't load. Don't have the info on the error in front of me but it was something to the effect that it was not compatible with the kernel. Back to square one. Going to try compiling it with android over the weekend and give it another attempt. Need to find some kind of a work around for actual controllers for this thing. USB/bt joystick center would be a phenomenal upgrade for this device.
Hi finally i can install Chrome Os in my laptop...
Now i try install my wifi driver but the only problem is the kernel... this not have headers for compiling..
when i try to compile the code:
[email protected]:~/rtl8821ce$ sudo ./dkms-install.sh
Show me this error
Error! DKMS tree already contains: rtl8821ce-v5.5.2_34066.20200325 (The driver is install previously but not are activable)
You cannot add the same module/version combo more than once.
Error! Your kernel headers for kernel 4.19.87-07826-g55ab70aff690 cannot be found.
Please install the linux-headers-4.19.87-07826-g55ab70aff690 package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.19.87-07826-g55ab70aff690 cannot be found.
Please install the linux-headers-4.19.87-07826-g55ab70aff690 package,
or use the --kernelsourcedir option to tell DKMS where it's located
Finished running dkms install steps.
i try install the headers but this kernel version not have headerrrss!!! jajaja...
Well i try upgrade the linux and i can... my distr is Debian 10.3 now... and them i proced to upgrade the kernel... ok all fine upgrade the kernel but when i check the information of kernel with the code
uname -a
Linux penguin 4.19.87-07826-g55ab70aff690 #1 SMP PREEMPT Tue Feb 4 17:29:42 PST 2020 x86_64 GNU/Linux(show me the old kernel but is the install actually)
show me the new kernel in the older kernerls with the command
dpkg --list | grep linux-image
ii linux-image-5.5.0-0.bpo.2-cloud-amd64-dbg 5.5.17-1~bpo10+1 amd64 Debug symbols for linux-image-5.5.0-0.bpo.2-cloud-amd64
Any can help me? to update the kernel and the headers?
My specs:
HP-15-db0081wm
Cpu: AMD Dual-Core E2-9000e
Gpu: AMD Radeon™ R2 Graphics
Ram: 4GB
Q. How i install chrome os?
A. with this video ( https://www.youtube.com/watch?v=4gZYV0RWJQ8 )
SRY FOR MY BAD ENGLISH
If i
(I'm cross-posting from "General Discussion", I think I picked the wrong forum. Sorry!)
I have:
Downloaded the exact kernel version running on my device from an AOSP mirror (4.9.170) (https://github.com/aosp-mirror/kernel_common.git)
Downloaded the exact compiler used to compile the kernel from my device:
Ran `cat /proc/version`, which returns "Linaro GCC 5.3-2016.05", which I downloaded from https://releases.linaro.org/components/toolchain/binaries/5.3-2016.05/aarch64-linux-gnu/
Took the kernel configuration from `/proc/config.gz`, copied it to the kernel source directory `kernel_common` as `.config`
Ran `make ARCH=arm64 CROSS_COMPILE=xxx oldconfig`
What I'm seeing:
First, the downloaded kernel source for 4.9.170 seems to think that my `config` is incomplete, since it will prompt me to answer ~15 extra configuration questions.
Second, this old Linaro compiled doesn't appear to support `-fstack-protector-strong` despite it being explicitly enabled in the `/proc/config.gz` file. So I end up disabling it with `./scripts/config --disable CONFIG_CC_STACKPROTECTOR_STRONG`
Finally, after successfully compiling, I take `net/ipv4/tcp_westwood.ko`, just as a test module, and try to load it on my Android device, and it fails:
`insmod: failed to load tcp_westwood_5.ko: Exec format error`
And in dmesg output: `tcp_westwood: disagrees about version of symbol module_layout`
My questions:
Can I assume that the `/proc/config.gz` file is not the actual file used to compile the running kernel, considering it doesn't completely configure the 4.9.170 kernel?
Am I on the right path to getting a kernel module that my kernel will load?
Background information:
I'm hoping this isn't very relevant, but just to head off some questions
This is a T95 Android TV device running what appears to be, to this newbie's eyes, a very Frankenstein'd Android 10 install (See https://www.cnx-software.com/2020/0...-comes-with-mali-g31-gpu-supports-android-10/)
I can't find any official - or unofficial - source for this device, which is why I'm going to all the trouble above.
I really appreciate any help, thank you!