Hello,
My question is, is it possible to build the linux kernel for an android device without the usb gadget driver built-in? My motivation and what I have tried thus far is listed below.
I am attempting to emulate the behavior of connecting and disconnecting an android phone from a given host. I have looked through many methods to try to emulate this behavior, and the solution I am working on now is:
1. build a kernel WITHOUT support for usb gadget
2. build a kernel module that supports usb gadget
3. put together an application to insmod/rmmod the resulting kernel module
I have done all three parts, and now I am seeing kernel panics. In particular there are two actions that result in kernel panics
1. Plug android device WITHOUT usb gadget support into a host (the enumeration must be causing the panic)
2. insmod and rmmod the kernel module, then insmod it again (kernel module name is android.ko and the resulting kernel log messages that happen just before panic are below)
[ 257.163085] sysfs: cannot create duplicate filename '/devices/platform/omap/musb-omap2430/musb-hdrc/gadget/lun0'
[ 257.163177] Modules linked in: android(+) [last unloaded: android]
I am working with the Samsung Galaxy Nexus. I have verified the kernel building process and the module building process by making a stock kernel and a simple kernel module. So the issue IS particularly with the usb gadget driver module and/or the kernel without built-in android gadget usb.
I have also used a Ellysis USB analyzer to see at what point in enumeration the device is crashing. Unfortunately, enumeration does not even begin without the built-in usb gadget module.
Best,
Ryan
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
Yesterday I discovered a very interesting source release from Samsung: GT-S5830G_GB_Opensource.zip
Normally, there is a shared Samsung source release for the msm7k range of devices (Ace, Mini, Callisto, Beni, Gio; there is also partial support included for my GT-I5500/Europa, but I adapted the source to properly support my phone). All of these devices usually depend on Samsung's proprietary FSR (Flex Sector Remapper) drivers in order to access the flash memory, which are taken from the stock ROMs, but our dependence on this driver locks us into the 2.6.35 kernel since we don't have access to the driver source.
The new source that I found for the GT-S5830G model, however, appears to contain modifications for the purpose of transitioning from Samsung's proprietary FSR driver to the open source MTD (via msm_nand) driver. If this can work correctly, using this driver would be much preferred over the proprietary Samsung stuff.
Here's the source that I uploaded to github: https://github.com/psyke83/android_kernel_samsung_msm/tree/purenand
Some observations that I have made, keeping in mind that I'm testing on my GT-I5500:
There are two separate configs for the cooper rev03 (Galaxy Ace): the standard defconfig that uses fsr/rfs, and a "purenand" config that uses the mtd/yaffs2 drivers instead of fsr/rfs. In other words, it's using the open drivers for flash access. Here is the diff: https://gist.github.com/3365123
The dpram driver (Samsung's driver for communication with baseband, used by RIL) is patched to support MTD instead of BML when the proper config is set.
The drivers/mtd/devices/msm_nand.c driver is modified by Samsung, but they applied their patches to an older revision of msm_nand.c from Froyo. Here is the diff when comparing this file vs the Froyo revision, so you can see more clearly the changes: https://gist.github.com/3365161
By default, the msm_nand.c driver causes the kernel to hang on my device (this is true for both this source and the older 2.6.35 Samsung source not based on purenand). I have isolated the hang to the flash_onfi_probe function.
As you can see here, Samsung added code to bypass this function on the Cooper board, and use the secondary detection method only. If I include my board to this ifdef block, it solves the issue with the kernel hanging on my device. I also need to patch some checks in the onenand detection, because the driver explicitly looks for onenand devices with a device_id of 0x40 and num_of_buffers as 0x201, but the chip on the GT-I5500 is different (device_id is 0x50, num_of_buffers is 0x101). This patch solves these problems: https://gist.github.com/3365222
Here is a dmesg log from my device after patching the code: https://gist.github.com/3360727. For comparison purposes, look at the block mapping that the fsr driver reports for my device when using the BML mapping: https://github.com/psyke83/android_device_samsung_galaxy5/blob/gingerbread/BoardConfig.mk#L53
As you can see, the partitions names and order detection is correct for the msm_nand driver, but the address mappings are exactly half of what they are supposed to be (e.g. the first partition, mibib, should range from 0x00000000-0x00180000, but the mtd driver detects the memory range as 0x00000000-0x000C0000.
If I try to perform a "nandump -f /sdcard/cache.img /dev/mtd/mtd13", there are no obvious errors in the dmesg log, but the tool will dump the cache partition until the sd card becomes full (over 300mb in my case, but the real /cache partition is only 25MB), and will then output "nanddump: short write". The resulting dump will be filled with 0xFF when examined with a hex editor (even though I'm sure that the /cache partition is not blank in reality).
These are my findings so far. I'd appreciate any kernel hackers to help me out. If we can crack this problem and get open onenand drivers working, then our devices will no longer be locked to any specific kernel release. If you know any developers for the Samsung devices I mentioned at the beginning of the post, or anyone else who may be able to help, please direct them to this thread. Thanks!
Reserved for future use
I have also posted this topic on the MadTeam forum, and posted a lot of further details. Please see: http://madteam.co/forum/development-8/(devs-only)-mtdonenand-driver-development/
Post this on General Discussion, this section is inactive
Hello,
I've recently bought a MELE A1000 [link], which currently has ICS and Linux kernel version 3.0.8.
But I've come across a problem; my Xbox 360 wired usb joystick isn't working with the MELE.
Research tells me that the module isn't compiled/included in the kernel [link]
This gives me two options, each with it's problems:
1- Re-compile the kernel, including the Xpad module:
I'd have to get the kernel source (either this "generic" kernel, or this Allwinner-specific kernel) then include it in the boot image, which is specific for the MELEA1000 link (check the first comment with the Chinese link to the official image)
Problems with this option
a) I don't know if the generic kernel will work with my device (Are there differences other than included modules?)
b) I can't compile the specific Allwinner kernel for some reason
c) Will the specific boot image work with a custom kernel? I think so.
2- Compile and include the module with insmod
I'd have to get the source of the ffmemless module [Source] and the xpad module [Source], compile them and do insmod to get them working.
Problems with this option
a) I can't seem to compile the modules in the correct version for my kernel (kernel 3.0.8+ #24 PREEMPT, armv71)
b) the precompiled modules I found were for 2.6*
Easiest scenario: compile modules + insmod.
Ideal scenario: get custom kernel, working + mod the rom (this is not within this thread's scope)
Could you give me any links, ideas or keywords to help me continue?
PS: I'm a programmer and I have previously modded/compiled kernels (from Debian's official repositories though)
Thanks
With information I've been reading I got up to this point:
Download the ARM kernel
git clone git://github.com/amery/linux-allwinner.git
Install the necessary libraries / binaries
apt-get install gcc-4.4-arm-linux-gnueabi build-essential u-boot-tools (if u-boot-tools not found, try uboot-mkimage)
Configure
make ARCH=arm sun4i_defconfig
make ARCH=arm xconfig
Check the following modules:
Input device support -> Support for memoryless force-feedback device
Input device support -> Joystick / gamepad
Input device support -> Joystick / gamepad -> X-box gamepad
Compile the modules
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j3 INSTALL_MOD_PATH=output modules
Then move the xpad.ko module to the MELE and run insmod xpad.ko, but I'm stuck with xpad: disagrees about version of symbol module_layout
I'm guessing this is a compile issue.
I've started a blog in which I'll try to document everything I do in the most detailed way I can.
Cheers
I think easier will be to get already compiled modules for A10 3.0.8+ from some firmware. I got cp210x.ko from "Aurora CM9 Nightly By Feiyu 0803.zip", successfully insmod-ed it into my device, and later added that insmod command to autorun with script manager app. I checked xpad module - it is in this firmware.
I use a Galaxy S5 (G900H) with rooted Android 5.0.
I am connecting a serial device to it via USB using cdc-acm driver (compiled in the kernel) and trying to read it from my android application, It works fine on other devices (older and newer).
When connecting the device, the device file /dev/ttyACM0 is created but when trying to read from it I receive an error Permission denied.
When running
Code:
setenforce 0
and setting SELinux to Permissive mode - everything works fine and the app reads the device file successfully.
After connecting the USB in Enforcing mode, the dmesg says:
Code:
cdc_acm 2-1:1.0: usb_probe_interface
cdc_acm 2-1:1.0: usb_probe_interface
cdc_acm 2-1:1.0: This device cannot do calls on its own. It is not a modem.
cdc_acm 2-1:1.0: ttyACM0: USB ACM device
I tried making a new policy using audit2allow but couldn't find any "denied" message to use in order to create an "allow" rule.
Is there any way to use the device file via my app without setting SELinux to permissive? I can edit the kernel and make a new one if needed, but I really prefer not to.
Thanks!
I have been trying to compile a userdebug kernel for months now and i finally got a kernel built but it would not boot. Well it booted but just to the splash screen.
This is a build for the LM-X210ULM. Im wanting to be able to use it a rooted phone to debug my other phones and possibly root them. I would also like to be able to build kernels and roms on my device which is prohibited in the user builds.
Ok the first issues i ran across after a non working kernel were LGE_USB_HOST_LIST_INPUT warnings which were easily taken care of by removing the items it said were missing dependencies.
Next are the SND_SOC_CONFIGS which i just removed the ITEMS listed as having missing dependencies.
But im still getting warnings about drivers/soc/qcom/kconfig which has something to do with fatal errorr and the value of the function being outside its normal paramaters. So i marked the defconfig line as not set for the error being fatal.
Now all of a sudden im getting fatal errors that stop my compilation having to do with the built-in.o file not being in the EDIDX out put and i grepped EDIDX and nothing was found
Please help me
i was wrong on grepping the exdid stuff but i did earlier and the only way i found to fix both errors was to go into the .config and unset arm_unwind.
I dont know what that will do to a working kernel but it compiles. Also i switched to the linux msm-3.18 source by caf since his toolchain works and gw? His source is less buggy,
But even after adding dependencies from the lg build i still am not producing a working image zImage or zImage-dtb
Ok i spent last night compiling ovet and over again. I compiled my kernel in about 8 different ways including using the defconfigs unaltered. But still i produce a Image zImage and zimage-dtb. I have renamed each image boot.img-kernel and repacked my boot.image and flashed it via fast boot. Each time it goes past the bootloader and hangs.
well here it is my actual 2nd compiled kernel for cv1 devices. Duhjokers laughter boot image with the upset clown kernel.
I figured out the non-booting issue problem kind of in a round about way. Part of it recompressing the boot.img after placing the kernel inside. For some reason fastboot is giving me a remote fail for anything 32mb. The kernel packed and patched by magisk is 34mb.
The other thing i think is that the compiler signs the kernel image as its being compiled but the boot.img itself will need some kind of signing itself so magisk comes into play there as tops patching system resigns the boot.img as it patches it.
Othet than that its good to go.
Features are set at
Fastcharge
Full OTG usb host and slave
performace rated w cpu governor
rcu boost
Smb
pre-empt
Handle panic
cma
Swap
auto wakelocks
loop device
Tun
Rndis
Rmnet
Spi
Pin control for msm devices
Devtmpfs
Ntfs
Ext4
ext2
ext3
vfat
Smb charging
Otg charging
Media and camera support
Confugured for
msm8916
msm8917
msm8920
msm8937
msm8940
msm8953
Debug android
Debug windows
Debug mass storage
Debug most generic gpio
Debug most generic ACM
Debug most generic
Debug usb gadget
Debug mutexes and spinlocks
Full encryption support and so much more
This baby is packed full of the latest features to help you debug most items around your house and full of the latest features for calling and internet. Enjoy
Im back and better than ever with the jokerfish kernel. Its killer!! SMILE
Ok i cant get force fast charge to show up in sys/kernel and its drivung me crazy. Huhuh.
Its compiling. I see the object files. i first used phy-msm-usb that wasnt showing up so retrofitted msm-otg into the mix per standard orrder back in the day but nothing. Every thing works all features are go but no fastcharge.
Could some one help me stop my compiling madness
Oh yea heres the flashable zip....