簡體   English   中英

如何為Android構建ch341.ko USB串行驅動程序?

[英]How to build ch341.ko usb-serial driver for android?

我們需要我們的android設備上的ch341.ko模塊。

這是自2.4.x(也許是2.3.x)以來已包含在內核源代碼中的可選模塊。

The source is located under (kernel)/drivers/usb/serial/ch341.c

    I endevoured to learn how to build modules, then found it was already in the source so no need for makefiles and the like, then endevoured to find how to crosscompile the linux source with the ch341 option to add it to the device.
  1. 安裝我收集的交叉編譯器,第一件事是找到正確的交叉編譯器,因此從yeilded的adb shell上運行cat /proc/version

    root @ android:/#cat / proc / version
    Linux版本3.0.8+(android2 @ Linux)(gcc版本4.5.1(Sourcery G ++ Lite 2010.09-50))#47 PREEMPT Mon Jul 9 16:32:14 CST 2012

    在我的Fedora 16盒子上下載並設置了Sourcery G ++的版本50。 然后將的目錄添加到PATH變量中:

    導出路徑= $ PATH :(已安裝CodeSourcery的路徑)/ CodeSourcery / Sourcery_G ++ _ Lite / bin

    或手動將其添加到〜/ .bash_profile中:

    須藤gedit〜/ .bash_profile

    然后更新PATH變量:

    來源〜/ .bash_profile

  2. 下載內核源-

    試圖找到正確的來源可能很困難,但是,從Allwinner知道該設備很可能是A10時,我發現了以下git信息庫和便捷的教程:

    https://github.com/amery/linux-allwinner

    http://rhombus-tech.net/allwinner_a10/kernel_compile/

    安裝git后,克隆了我嘗試針對2個分支進行編譯的樹:

    “ allwinner-v3.0-android-v2”(主要的一個)

    “ lichee-3.0.8-sun4i”(與我的設備更內聯)

    我交叉編譯了以下命令:

    make ARCH = arm sun4i_defconfig make ARCH = arm menuconfig make ARCH = arm CROSS_COMPILE = arm-none-linux-gnueabi- -j16 uImage模塊make ARCH = arm CROSS_COMPILE = arm-none-linux-gnueabi- INSTALL_MOD_PATH =輸出modules_install

    每次編譯后,我將ch341.ko文件推送到設備:

    adb push output / lib / modules / 3.0.8 + / kernel / drivers / usb / serial / ch341.ko /mnt/sdcard/LKMz/ch341.ko

    然后嘗試了insmod”

    adb shell root @ android:/#insmod /mnt/sdcard/LKMz/ch341.ko insmod:init_module'/mnt/sdcard/LKMz/ch341.ko'失敗(執行格式錯誤)

    dmesg返回:

    dmesg ch341:關於符號module_layout的版本存在異議

    並嘗試使用-f(強制)選項:

    ./system/xbin/busybox insmod -f /mnt/sdcard/LKMz/ch341.ko insmod:無法插入'/mnt/sdcard/LKMz/ch341.ko':無效的模塊格式

    因此看來,我用來編譯源代碼的版本或編譯選項存在問題。

    有人對如何編譯ch341.ko模塊有任何建議嗎?

關閉CONFIG_MODVERSIONS並檢查其是否有效。 如果不是,請“ dmesg”並檢查新錯誤。

檢查頁面,可能會有所幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM