交叉编译内核模块ARM [英] Cross-compiling kernel module for ARM

查看:530
本文介绍了交叉编译内核模块ARM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要交叉编译的 rtl8192cu驱动程序的目标ARM埃的(的BeagleBoard)的,基于x86的Ubuntu 13.04。

交叉编译prerequisites:


  1. rtl8192cu驱动程序

  2. 交叉工具链的(codeSourcery / ARM埃Linux的gnueabi)

  3. 内核源代码

由于这个原因,我复制的内核源代码的 usr / src目录的BeagleBoard的目录,Ubuntu的机器上的(它们HEVE被编上的BeagleBoard,因为我需要重新编译内核)

运行制作的交叉编译,我得到这个错误:

 让ARCH =手臂CROSS_COMPILE=/home/demetres/$c$cSourcery/Sourcery_$c$cBench_Lite_for_ARM_GNU_Linux/bin/arm-none-linux-gnueabi- -C /家庭/ demetres /桌面/ KS1 M = /家庭/ demetres /桌面/ rtl3模块
使[1]:进入目录`/家庭/ demetres /桌面/ KS1
  CC [M] /home/demetres/Desktop/rtl3/core/rtw_cmd.o
/ bin / sh的:脚本/基本/ fixdep:不能执行二进制文件
使[2]:*** [/home/demetres/Desktop/rtl3/core/rtw_cmd.o]错误126
使[1]:*** [_module_ /家庭/ demetres /桌面/ rtl3]错误2
使[1]:离开目录`/家庭/ demetres /桌面/ KS1
使:*** [模块]错误2

如果我跑文件fixdep 我得到:

  fixdep:ELF 32位LSB的可执行文件,ARM版本1(SYSV),动态链接(使用共享库),为GNU / Linux 2.6.16,不可剥离

这是有道理的,因为fixdep,是内核的一部分来源的(编译在ARM平台)的。

我的查询是:是程序正确的,我怎么能解决这个错误

修改

运行使V = 1

 让ARCH =手臂CROSS_COMPILE=/home/demetres/$c$cSourcery/Sourcery_$c$cBench_Lite_for_ARM_GNU_Linux/bin/arm-none-linux-gnueabi- -C /家庭/ demetres /桌面/ KS M = /家庭/ demetres /桌面/ RTL模块
使[1]:进入目录`/家庭/ demetres /桌面/ KS'
测试-e在include / linux / autoconf.h -a -e包括/配置/ auto.conf || (\\
    回声; \\
    回声错误:内核的配置是无效的。 \\
    回声在include / linux / autoconf.h或包含/配置/ auto.conf丢失。 \\
    回声运行使oldconfig这个&放大器;&放大器;使prepare'内核SRC解决它。 \\
    回声; \\
    /斌/假)
MKDIR -p /home/demetres/Desktop/rtl/.tmp_versions; RM -f /home/demetres/Desktop/rtl/.tmp_versions/*
使-f脚本/ Makefile.build的obj = /家庭/ demetres /桌面/ RTL
  /家庭/ demetres / codeSourcery / Sourcery_ codeBench_Lite_for_ARM_GNU_Linux /斌/ ARM-NONE-Linux的gnueabi-GCC -Wp,-MD,/家庭/ demetres /桌面/ RTL /核心/ .rtw_cmd.od -nostdinc -isystem /home/demetres/$c$cSourcery/Sourcery_$c$cBench_Lite_for_ARM_GNU_Linux/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.3/include -Iinclude -I /家庭/ demetres /桌面/ KS /弓/ ARM /包括-include在include / linux / autoconf.h -D__KERNEL__ -mlittle端-Iarch / ARM /马赫 - 多功能/ -Wall包括-Wundef -Wstrict-原型-Wno-三字母-fno严格走样-fno常见-Werror隐函数声明-Wno格式安全-fno-删除空指针的检查-Os -marm -fno-省略,框架指针-mapcs -mno-SCHED-序言-mabi = APCS-GNU -mno-拇指互通-D__LINUX_ARM_ARCH __ = 5 -march =的ARMv5TE -mtune = ARM9TDMI -msoft浮-Uarm -Wframe-较大比= 1024 -fno-堆栈保护-Wno未使用的,但是设置变量-fno-省略帧指针-fno-优化同胞,呼吁-Wdeclaration-语句后-Wno指针符号-fno严溢-fno- DWARF2-CFI-ASM -fconserve堆栈-O1 -Wno-未使用的变量-Wno未使用的价值-Wno未使用的标签-Wno未使用的参数-Wno未使用的功能-Wno-未使用-Wno-未初始化 - 我的/ home / demetres /桌面/ RTL /包括-DCONFIG_POWER_SAVING -DCONFIG_LITTLE_ENDIAN -DMODULE -DKBUILD_STR(S)=#的-DKBUILD_BASENAME = KBUILD_STR(rtw_cmd)-DKBUILD_MODNAME = KBUILD_STR(8192cu)-C -o /home/demetres/Desktop/rtl/core/rtw_cmd.o /home/demetres/Desktop/rtl/core/rtw_cmd.c
/ bin / sh的:脚本/基本/ fixdep:不能执行二进制文件
使[2]:*** [/home/demetres/Desktop/rtl/core/rtw_cmd.o]错误126
使[1]:*** [_module_ /家庭/ demetres /桌面/ RTL]错误2
使[1]:离开目录`/家庭/ demetres /桌面/ KS'
使:*** [模块]错误2


解决方案

fixdep是ARM二进制和你想的x86机器(英特尔)上运行。您可能必须重新编译内核资源(只是让他们),并尝试再次交叉编译。

I want to cross-compile rtl8192cu driver targeting ARM Angstrom (BeagleBoard), on x86 Ubuntu 13.04.

Cross-compile prerequisites:

  1. rtl8192cu driver
  2. Cross-toolchain (CodeSourcery / arm-angstrom-linux-gnueabi)
  3. kernel sources

For this reason, I copied kernel sources usr/src directory of BeagleBoard, on Ubuntu machine (they heve been compiled on BeagleBoard, as I needed to rebuild the kernel).

Running make for cross-compile, I get this error:

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

If I run file fixdep I get:

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

This makes sense, as fixdep, is part of kernel sources (compiled on ARM platform).

My query is: Is that procedure correct and how can I fix this error?

EDIT:

Running 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

解决方案

fixdep is an ARM binary and you are trying to run it on x86 machine(intel). You probably have to recompile kernel resources (just make them) and try cross compiling again.

这篇关于交叉编译内核模块ARM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆