Usb to Ethernet driver compilation on linux kernel 3.0 and above - c

I cross compiled USB to Ethernet driver in the Linux Kernel source tree at drivers/net/usb/smsc75xx.c for Android Kernel 3.0.8. Cross compilation worked fine as well as inserting the Kernel module using insmod. But the ethernet interface does not show up nor dmesg detects module's insertion (using insmod) or removal (using rmmod). Since dmesg is silent about its insertion or removal, something seems not right?
How to debug this non-working driver in a non-verbose environment?

Check the drivers/net/usb/smsc75xx.c. It seems the driver is already in the upstream.

Related

How to add my source code to Kernel source tree

I've an I2C storage CHIP attached with system, A kernel space driver program of that CHIP is functioning with insmod / rmmod from running system.
But I would like to add this program with kernel source, so that on Kernel booting (from zImage) it will read from I2C CHIP, and Print something (e.g. Serial #) from it.
My question is, is it enough to add the driver object with kernel/Makefile
as obj-y += ?
while searching for Kernel module writing and so on, you'll find a hundreds of thousands "hello_world.c" program, that will describe how you can print
hello_world at kernel log, when your kernel and system all working and up. Which are called loadable kernel module, using program like insmod to load and rmmod to unload.
But, I was searching how to load my own script (i.e. that hello_world.c) when kernel is booting, and wanna see something on console that exactly coming from kernel at booting time, then google is almost silent.
Well, its just not difficult, and quite easy. What I've done by myself to get the printk() message at kernel booting is -
Kept the hello_world.c program inside ./kernel/driver (You can keep it almost anywhere inside Kernel source folder also can make your own folder, but that will require your own Makefile).
And edit the ./kernel/driver/Makefile to add obj-y += hello_world.o
at the end of the Makefile.
Then compile the full kernel and generated zImage transferred to sd-card.
While booting, just after USB HID core driver, I am able to see my custom message from hello_world printk().
[ 3.652944] usbcore: registered new interface driver usbhid
[ 3.657253] usbhid: USB HID core driver
[ 3.660152] HELLO: HELLOING WORLD from KERNEL BINARY
NOTE:- Unlike, loadable module, function maked with __exit would never called by compile when subjected code is in-built with kernel source.
i.e. in Such case hello_world.c is "Programmed to received (read include) but can't never leave"

Testing kernel Crypto API on linux

I have a Freescale i.MX board on which I run the Linux 3.0.35 kernel.
I want to test if the Kernel Crypto API of my Linux system works. I just found out the test program is called tcrypt. I see that under /lib/modules/ there is a tcrypt.ko in the drivers directory. This being the case, is there anyway I can test run this library? How do I call it? Do I need to reconfigure my kernel to "enable" something to call it?
Please keep in mind that I am new to kernel API's.
I had to compile the kernel modules. This built the "tcrypt.ko" module too. Then I used "insmod" command to load the module. Once loaded, the module was started with :
modprobe tcrypt sec=1 mode=200
(where mode is the algorithm to test)

compiling raspbian wheezy usb driver ch341.c to ch341.ko

I am supposed to compile /usb/serial/ch341.c file to ch341.ko.
I am using rs485 module which is not working. I found on some forums that other people also facing this problem because drivers come with old device id in ch341.ko file and device comes with new device id -
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=82078234d4023c61b9d88e8be5e795423d17538e
I need to add new device id to ch341.c file which is alredy there in -
http://lxr.linux.no/linux/drivers/usb/serial/ch341.c
Now i need to compile this file to ch341.ko for raspbian wheezy to work in my raspberry pi.
Any help will be appreciated.
I had a CH341A (in SERIAL MODE) attached to my RasPI (raspbian wheezy with latest Upgrades).
To my surprise the CH341A SERIAL was recognized correctly and I communication
through "ttyUSB0" worked fine (using pySerial).
ls /dev/tty*
...look for "ttyUSB0" in the list.
You may want to follow the following blog posts:
Building modules for Raspberry Pi
More specific one on building a wireless driver
Following the steps outlined in these two posts you should be able to compile/ or cross compile your driver and get the required .ko file

Embedded Linux Porting On ARM-Cortex-A8(beagle board)

I am porting Embedded linux os on Beagle Board with ARM-Cortex A8 processor.
I wanted to add the functionality of insmod and rmmod and my driver as well in os.
Please help me in doing this, so that my driver can work over my board properly.
Thank you
Himanshi
You will Have to include Your drivers with the Image BUILD insmod and rmmod will not keep your driver there after a reboot inserting your drivers every boot sure is inappropriate

How to add new QEMU machine types without modifying the mainline source code?

Can a new machine type be added for qemu-system-arm -M <MachineType> without having to recompile qemu or write code? Are there docs to do this? I would like to be able to emulate raspberry pi and pandaboard using qemu.
I know that meego's fork of qemu supports pandaboard, but I am trying to stick with the main stream qemu that I can manage from the apt-get package manager. the main stream qemu now supports beagleboard rev C and beagleboard xm that were previously supported only in the meego fork.
without having to recompile qemu or write code?
No. There must be some code doing the device specific emulation, like for example the way the Raspberry Pi or the Pandaboard implement video output. This is not a matter of just a few config files.
I've been able to emulate the Pi with -M versatilepb: https://raspberrypi.stackexchange.com/questions/165/emulation-on-a-linux-pc/53991#53991 and -M raspi2 has was later added in QEMU 2.6.
Maybe this feature is feasible to implement, see my experience with adding a new platform device: How to add a new device in QEMU source code?
There, I only needed to add a single line to attach a new device to versatilepb:
sysbus_create_simple("lkmc_platform_device", 0x101e9000, pic[18]);
so maybe we could have a config file containing lines of type:
type name regid irq
sysbus lkmc_platform_device 0x101e9000 18
Related: out-of-tree devices: How to create out-of-tree QEMU devices?

Resources