ARM的交叉编译内核模块

时间:2014-03-24 00:02:56

标签: build linux-kernel kernel arm cross-compiling

我想在x86 Ubuntu 13.04上交叉编译针对ARM Angstrom (BeagleBoard) rtl8192cu驱动程序

交叉编译先决条件:

  1. rtl8192cu driver
  2. 跨工具链(CodeSourcery / arm-angstrom-linux-gnueabi)
  3. 内核来源
  4. 出于这个原因,我在Ubuntu机器上复制了BeagleBoard的内核源代码 usr / src 目录(他们已经在BeagleBoard上编译了,因为我需要重建内核)

    运行make进行交叉编译,我收到此错误:

    make ARCH=arm CROSS_COMPILE=/home/demetres/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/arm-none-linux-gnueabi- -C /home/demetres/Desktop/ks1 M=/home/demetres/Desktop/rtl3  modules
    make[1]: Entering directory `/home/demetres/Desktop/ks1'
      CC [M]  /home/demetres/Desktop/rtl3/core/rtw_cmd.o
    /bin/sh: scripts/basic/fixdep: cannot execute binary file
    make[2]: *** [/home/demetres/Desktop/rtl3/core/rtw_cmd.o] Error 126
    make[1]: *** [_module_/home/demetres/Desktop/rtl3] Error 2
    make[1]: Leaving directory `/home/demetres/Desktop/ks1'
    make: *** [modules] Error 2
    

    如果我运行file fixdep,我会:

    fixdep: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped
    

    这有意义,因为fixdep是内核源代码(在ARM平台上编译)的一部分。

    我的查询是: 该程序是否正确,如何解决此错误?

    修改

    正在运行make V=1

    make ARCH=arm CROSS_COMPILE=/home/demetres/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/arm-none-linux-gnueabi- -C /home/demetres/Desktop/ks M=/home/demetres/Desktop/rtl  modules
    make[1]: Entering directory `/home/demetres/Desktop/ks'
    test -e include/linux/autoconf.h -a -e include/config/auto.conf || (        \
        echo;                               \
        echo "  ERROR: Kernel configuration is invalid.";       \
        echo "         include/linux/autoconf.h or include/config/auto.conf are missing.";  \
        echo "         Run 'make oldconfig && make prepare' on kernel src to fix it.";  \
        echo;                               \
        /bin/false)
    mkdir -p /home/demetres/Desktop/rtl/.tmp_versions ; rm -f /home/demetres/Desktop/rtl/.tmp_versions/*
    make -f scripts/Makefile.build obj=/home/demetres/Desktop/rtl
      /home/demetres/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/arm-none-linux-gnueabi-gcc -Wp,-MD,/home/demetres/Desktop/rtl/core/.rtw_cmd.o.d  -nostdinc -isystem /home/demetres/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.3/include -Iinclude  -I/home/demetres/Desktop/ks/arch/arm/include -include include/linux/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-versatile/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -marm -fno-omit-frame-pointer -mapcs -mno-sched-prolog -mabi=apcs-gnu -mno-thumb-interwork -D__LINUX_ARM_ARCH__=5 -march=armv5te -mtune=arm9tdmi -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -O1 -Wno-unused-variable -Wno-unused-value -Wno-unused-label -Wno-unused-parameter -Wno-unused-function -Wno-unused -Wno-uninitialized -I/home/demetres/Desktop/rtl/include -DCONFIG_POWER_SAVING -DCONFIG_LITTLE_ENDIAN  -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(rtw_cmd)"  -D"KBUILD_MODNAME=KBUILD_STR(8192cu)"  -c -o /home/demetres/Desktop/rtl/core/rtw_cmd.o /home/demetres/Desktop/rtl/core/rtw_cmd.c
    /bin/sh: scripts/basic/fixdep: cannot execute binary file
    make[2]: *** [/home/demetres/Desktop/rtl/core/rtw_cmd.o] Error 126
    make[1]: *** [_module_/home/demetres/Desktop/rtl] Error 2
    make[1]: Leaving directory `/home/demetres/Desktop/ks'
    make: *** [modules] Error 2
    

1 个答案:

答案 0 :(得分:0)

fixdep是一个ARM二进制文件,你试图在x86机器(intel)上运行它。您可能必须重新编译内核资源(只需创建它们)并尝试再次交叉编译。