Oli*_*Oli 23 compiling kernel architecture
我正在尝试为 32 位单核 Intel Atom 机器编译内核。不用说,编译花费了过多的时间。它已经进行了 2 个小时,但它仍然只完成了驱动程序模块的一半。
在我的主桌面上编译内核只需要 15 分钟,但它是一台 64 位机器。我可以交叉编译以从更好的机器生成 32 位内核包吗?
tum*_*eed 27
虽然内核可以交叉编译,但最简单的方法是创建一个 32 位 (i386) chroot 并在其中构建它。
安装ubuntu-dev-tools:
$ sudo apt-get install ubuntu-dev-tools
Run Code Online (Sandbox Code Playgroud)
创建一个 i386 chroot:
$ mk-sbuild --arch=i386 precise
Run Code Online (Sandbox Code Playgroud)
(您可能必须运行两次。第一次,它会安装schroot等并进行设置mk-sbuild)
然后进入chroot:
$ schroot -c precise-i386
Run Code Online (Sandbox Code Playgroud)
并像往常一样构建内核。
小智 5
Afaik,在 gcc 中,您可以设置-m32标志,让它将 linux 源代码编译为 32 位可执行文件。我对 Makefile 了解不多,但您可以调整它们。
编辑: 我想在这里添加一个来自 stackoverflow 的问题,其中被告知要设置 cflags:
export CFLAGS=-m32
Run Code Online (Sandbox Code Playgroud)
从Torvalds的 github 帐户中的 linux 存储库中,我发现主 makefile 的以下部分可能很有用,因为它告诉您可以通过设置环境变量来设置目标体系结构。阅读评论,目前,这些行来自这个文件,在第174-196行之间:
# Cross compiling and selecting different set of gcc/bin-utils
# ---------------------------------------------------------------------------
#
# When performing cross compilation for other architectures ARCH shall be set
# to the target architecture. (See arch/* for the possibilities).
# ARCH can be set during invocation of make:
# make ARCH=ia64
# Another way is to have ARCH set in the environment.
# The default ARCH is the host where make is executed.
# CROSS_COMPILE specify the prefix used for all executables used
# during compilation. Only gcc and related bin-utils executables
# are prefixed with $(CROSS_COMPILE).
# CROSS_COMPILE can be set on the command line
# make CROSS_COMPILE=ia64-linux-
# Alternatively CROSS_COMPILE can be set in the environment.
# A third alternative is to store a setting in .config so that plain
# "make" in the configured kernel build directory always uses that.
# Default value for CROSS_COMPILE is not to prefix executables
# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
export KBUILD_BUILDHOST := $(SUBARCH)
ARCH ?= $(SUBARCH)
CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)
# ...
# There are more architecture related stuff beyond this line
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13660 次 |
| 最近记录: |