【发布时间】:2016-07-09 23:51:36
【问题描述】:
我正在按照本教程为 ARM 编译 Linux 内核 3.2 并使用 QEMU 进行仿真:
https://balau82.wordpress.com/2012/03/31/compile-linux-kernel-3-2-for-arm-and-emulate-with-qemu/
我正在执行以下步骤:
wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.2.tar.bz2tar xjf linux-3.2.tar.bz2export ARCH=armexport CROSS_COMPILE=arm-linux-gnueabi-cd linux-3.2make vexpress_defconfigmake allcd ..arm-linux-gnueabi-gcc -static init.c -o initecho init|cpio -o --format=newc > initramfsqemu-system-arm -M vexpress-a9 -kernel linux-3.2/arch/arm/boot/zImage -initrd initramfs -serial stdio -append "console=tty1"
我的问题是当我尝试第 7 步(全部制作)时,会出现此问题:
include/linux/compiler-gcc.h:94:30: fatal error: linux/compiler-gcc5.h: No such file or directory
compilation terminated.
/home/ramy/QEMU_Learn/kernel/linux-3.2/./Kbuild:35: recipe for target 'kernel/bounds.s' failed
make[1]: *** [kernel/bounds.s] Error 1
Makefile:985: recipe for target 'prepare0' failed
我正在使用 Ubuntu 操作系统,我正在使用 Linaro 工具链编译内核。
我还检查了 PATH 变量,结果如下:
$ printenv | grep PATH
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/ramy/gcc-arm-none-eabi-5_3-2016q1/bin
MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path
【问题讨论】:
-
你的交叉编译器是什么?你的 linaro 版本是什么?链接balau82.wordpress.com/2012/03/31/… 的帖子来自 2012 年,因此使用 2012 年的 linaro 编译 3.2 内核,而不是更新的内核。您的 linaro 中的 gcc 版本太新,无法编译这么旧的 linux 内核。或者尝试更新的内核(但是这个旧博客中的命令可能不起作用)
-
Linux 内核版本 3.2 在 gcc 版本 5 存在之前发布。内核版本 3.2.81 有这个头文件。
-
谢谢,但是如何在 Ubuntu 中使用 gcc-4 获取 Linaro?
标签: linux gcc linux-kernel qemu