1

我们需要在我们的 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. 安装交叉编译器 我收集到的第一件事是找到正确的交叉编译器,所以cat /proc/version从 adb shell 继续运行 yeilded:

    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 机器上下载并设置版本 50 的 Sourcery G++。然后将目录添加到 PATH 变量中:

    EXPORT 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=output 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' failed (Exec format error)

    dmesg 返回:

    dmesg ch341:不同意符号 module_layout 的版本

    并尝试使用 -f (强制)选项:

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

    因此,我用来编译源代码的版本或编译选项似乎存在问题。

    有人对如何编译 ch341.ko 模块有任何建议吗?

4

1 回答 1

1

关闭 CONFIG_MODVERSIONS 并检查它是否有效。如果没有,“dmesg”并检查新错误。

检查页面,它可能会有所帮助。

于 2012-11-05T09:10:24.243 回答