Building Kernel Modules for AllWinner A10 Android Devices (e.g. Joystick Support)

Reader JP has enabled Joystick support in Android 4.0.4 on its Mele A1000, this now works with a Playstation2 joystick via USB adapter, a Huskee PC joystick, and 2 other unbranded joysticks. In order to enable Joystick support he had to build a kernel module, and encountered a few issues, so he wrote an how-to which shows what challenges he went through and what solutions he found to those issues.I’m sharing today a slightly edited version of this how-to.

This How-to assumes that you have a valid Linux environment where you can build allwinner A10 kernel. The toolchain used was “Sourcery CodeBench for ARM GNU/Linux Lite“ which can be downloaded here: http://www.codesourcery.com/sgpp/lite/arm/portal/package7853/public/arm-none-linux-gnueabi/arm-2010.09-50-arm-none-linux-gnueabi.bin

To install it, simply run:


You’ll also need the latest Allwinner A10 kernel source:


Then follow the usual procedure:


I then selected the modules needed for different kind of joysticks namely:


I saved the settings and continued the build:


Then I copied my modules to my sdcard, went to a terminal that I downloaded from the android market and did (as root):


And received the following error:


So I thought: “It cannot be, I compiled the right kernel the right way, with the correct compiler that the guys at Mele used…” After some cups of coffee I found the mystical mistake by checking an existing kernel module from the Mele:


And compared it to the output generated with my module:


Do you see the small difference?

Original Mod:


My Module compiled from amery sources:


So that was the problem, the kernel refused to load the module because the “vermagic” is not the same.

So the logical thought would be to get the sources of 3.0.8+ kernel, and amery github repo has that too in a specific branch (lichee-3.0.8-sun4i)

So I compiled it, made the modules and the new vermagic looked as follows:


The missing “+” is the problem, as it should show 3.0.8+ instead..

So I said, If I change the vermagic of the module the problem will be resolved, but.. if I change the vermagic and use the 3.0.39 source the kernel will explode and the world will collapse!

According to tldp.org and haifu.org, you can build a kernel module using version 3.0.xx (e.g. kernel 3.0.39), and load it in a system running kernel 3.0.yy (e.g. kernel 3.0.8.

So here are 2 methods I’ve followed to change the vermagic:

  • The hard and dirty way: With objcopy you can remove the .modinfo from the original Mele Module and insert that part on your compiled module, so the vermagic will be the same.
  • The easy and “not so dirty way”: Well, I know that this is dirty, but if you’re in a hurry…
    Go to amery source folder, edit the .config file and change:

    to

    Then edit the Makefile file and change:

    to

    and then complete the full build:

You MUST compile the entire kernel, so the proper vermagic is inserted into the modules, if you are lazy and just compile the modules, the vermagic will be not inserted and you’ll see the same error again.

Then I checked the vermagic again:

Original Mele Module


My NEW Module


So to be sure, I copied the module to the sdcard, went to the terminal as root and did:


and no message was displayed, so I typed:


And at the end of the message, the module was correctly inserted!!

So that’s all what I needed.

Share this:
FacebookTwitterHacker NewsSlashdotRedditLinkedInPinterestFlipboardMeWeLineEmailShare

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK Pi 4C Plus

29 Replies to “Building Kernel Modules for AllWinner A10 Android Devices (e.g. Joystick Support)”

  1. Where it says “According to tldp.org and haifu.org, you can’t build a kernel module using version 3.0.xx (e.g. kernel 3.0.39), and load it in a system running kernel 3.0.yy (e.g. kernel 3.0.8).”

    It should be “According to tldp.org and haifu.org, you CAN build a kernel module using version 3.0.xx (e.g. kernel 3.0.39), and load it in a system running kernel 3.0.yy (e.g. kernel 3.0.8).

  2. Hi All, this information you’re providing is great if you are into building the Allwinner A-10 tablets themselves, but I am a new owner of one of them and am just trying to find a manual where I can find out how to make it work. The one that was included in the box is basically useless and I know there has got to be something out there that will make my experience a whole lot happier one then it has been thus far. Can anyone point me in a direction to find an “ENGLISH” version instruction manual of how to make an Allwinner A-10 tablet work…even the basics would be great, like how to make a bookmark, make a widget, etc. I’m just lost. Thanks so much for reading this and any help you are willing to provide. Have a great day and keep up the good work!!

    Lori

  3. It’s also possible, and simpler IMO, to use the options ‘–force-vermagic’ and/or ‘–force-modversion’ to skip the (protection) check done for kernel module loading.

    However these options are only available for ‘modprobe’ tool, and apparently not for the simpler ‘insmod’. (but if ‘modprobe’ is present on the Android image you’re using, it seems easier to use it than forcing a different LOCALVERSION /SUBLEVEL in your kernel config).

  4. after the clone command, is sufficient enter in the folder linux-allwinner

    cd linux-allwinner
    git checkout lichee-3.0.8-sun4i

    and when you compile, compile for 3.0.8+

  5. Hey don’t install this update, is completely focused to Chinese market. Most common components has been removed (at first sight), so don’t say that you weren’t informed (even the launcher has changed).

  6. I recently learnt the “+” is added to EXTRAVERSION if you have local git changes. (so related to git). So you don’t have to edit the local file per se.

  7. As for HTPC V1.2, I have a dd image too, which isn’t “encrypted”. But, I would not recommend International users install this. Stay with the previous ICS image.

  8. I am totally confused as to beg for help from you! those who are in what I will describe below understands and can help me.
    It’s about the MELE A2000 rev 1.3 with firmware version Android 4.0.4 v 1.1 (kernel version 3.0.8 +)
    About the desired result:
    1-Connect USB GPS to SirfIII via the existing bridge on the PL2303.
    2 USB Bluetooth connection to use OBDII ELM327 scanner.
    3-Connect USB DAC PCM2704
    On firmware downloaded and installed to the office site, all konechnozhe not work.
    Searching on the Internet responses,
    I realized that the simple solution to make it work not
    Who can do zip that all modules install and make their work
    I do not understand how to install the module and driver 🙁
    good for me if there is a zip
    I load CWM select install zip from SD card
    Disconnect the power, turned on and the desired module and the driver is installed
    I chalk can work with USB GPS USB Bluetooth and USB Audio (USB DAC PCM2704)
    I beg your help, I spent more than two weeks
    and can not seem to deal with all these the problem remains

  9. @Lundman
    Hi Lundman,
    Thank you for your tip, there’s people that download the source using the “zip” method of github and don’t want to mess with git :).

    (I want to say thank you for your hard work in the linux/opensolaris community and I respect and admire your constantly commitment to the community. Keep up the good work!!.)

  10. @Adi
    I added support for USB bluethoot dongles, but I just have one to test (an unbranded chinese one), and it failed. I guess that it was incompatible with the internal USB uhb, I’ve seen this kind of problem with other development boards (mini6410, mini2440, Vortex86) with devices that have multiple descriptors.

  11. For all the people reading this article:
    There are some essential tools needed (can be downloaded from the market)
    An updated “su” binary (switch user, no “superuser”)
    https://play.google.com/store/apps/details?id=com.noshufou.android.su&hl=en

    a complete busybox:
    https://play.google.com/store/apps/details?id=stericson.busybox&feature=search_result#?t=W251bGwsMSwxLDEsInN0ZXJpY3Nvbi5idXN5Ym94Il0.

    a SSH/SFTP server:
    https://play.google.com/store/apps/details?id=berserker.android.apps.sshdroid&feature=search_result#?t=W251bGwsMSwxLDEsImJlcnNlcmtlci5hbmRyb2lkLmFwcHMuc3NoZHJvaWQiXQ..

    Script Manager:
    https://play.google.com/store/apps/details?id=os.tools.scriptmanager&feature=search_result

    This applications (for me) are a MUST have if you want to mess with the OS.

  12. Hello, may you can halp me?
    I want connect a touchscreen to mk802, I have compiled module (usbtouchscreen.ko), which loaded, but /dev/input/event* don`t appear.
    In dmesg I see that module was loaded. In /sys touchscreen is present. Vendor id and product id in /sys and in module source are correct. Why touchscreen may not work?
    ps sorry for my english 🙂

  13. @Sergey
    Sergey, could you please make this loadable usbtouchscreen.ko available somehow for me? I am also trying to get my usb touchscreen working and will work on it. i’m struggling for a long time and it’s very high on my priority list 🙂 or have you in the meantime got it working ?
    Thanks a lot ! 🙂

  14. Hello!
    I am asking for help.

    I want to add bluetooth support to my Mele A2000. I want to be able to add bluetooth mouse, keyboard and headphones. I want to use D-Link DBT-122 USB Dongle.

    I created a virtual sever on Virtualmaster.com to do the development. (I also created a template for everybodys use, it is called “Mele A2000 android kernel development”, direct link is https://www.virtualmaster.com/virtualmaster/cs/images/3087. Feel free to use it. The server that can be created using this template is paid, but costs only some 3,- EUR / month. I choose this way for the poor internet connection I have. If You are asked for invitation, drop me an email, I do not know if they still ask for them at virtualmaster.com)

    My question is:
    Which modules (and in which order) do I need to load to enable this USB Dongle?
    (I already looked a lot around, and tried many combinationas, but no success yet)
    Does the bluetooth support appear in the settings after loading required modules? Do I neeed to add something else?
    (what is it I need to add if I need to add something?)

    Thanks a lot for any help!!

  15. @JP
    you have to follow the instructions and select the components you want to include. This is a good thing. Many of us don’t want the entire world.

Leave a Reply

Your email address will not be published. Required fields are marked *

Khadas VIM4 SBC
Khadas VIM4 SBC