gpt4 book ai didi

linux-kernel - 在 18.04.1-Ubuntu 下的 VirtualBox 中构建最新的 linux 内核时出错

转载 作者:行者123 更新时间:2023-12-03 19:24:48 25 4
gpt4 key购买 nike

我正在尝试使用 Oracel VM 和 18.04.1-Ubuntu 镜像构建最新的 Linux 内核 ( GitHub )。

我安装了需要的软件包,甚至可能更多。这是我安装的部分软件包:

sudo apt-get update
sudo apt-get install git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc bison flex libelf-def kernel-package

完整列表见 here .

我在 linux 中运行了以下命令从 GitHub 克隆存储库后的文件夹。
$ cp /boot/config-$(uname -r) .config

$ make menuconfig
scripts/kconfig/mconf Kconfig
.config:1118:warning: symbol value 'm' invalid for NF_CT_PROTO_GRE
.config:1923:warning: symbol value 'm' invalid for NET_DEVLINK
.config:7865:warning: symbol value 'm' invalid for ASHMEM
.config:8724:warning: symbol value 'm' invalid for ANDROID_BINDER_IPC
.config:8725:warning: symbol value 'm' invalid for ANDROID_BINDERFS


*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

我保存并退出 menuconfig .最后 make 导致以下错误。
$ make -j2
Makefile:608: include/config/auto.conf: No such file or directory
Makefile:660: include/config/auto.conf.cmd: No such file or directory
HOSTCC scripts/kconfig/conf.o
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf --syncconfig Kconfig

*** Error during sync of the configuration.

scripts/kconfig/Makefile:73: recipe for target 'syncconfig' failed
make[2]: *** [syncconfig] Error 1
Makefile:562: recipe for target 'syncconfig' failed
make[1]: *** [syncconfig] Error 2
Makefile:678: recipe for target 'include/config/auto.conf.cmd' failed
make: *** [include/config/auto.conf.cmd] Error 2
make: *** Deleting file 'include/config/auto.conf.cmd'

看起来 make 需要一些额外的配置文件 include/config/auto.conf .有没有人对我有线索。

谢谢!

最佳答案

尝试以非 root 用户身份编译内核 5.6.3,我遇到了这个确切的问题。
从 Oandiy 的评论中运行建议

git clean -xdf

透露我的源代码树中有文件归根用户所有,无法删除。回顾我的历史,我发现,
sudo make localmodconfig  # DO NOT DO THIS

以 root 身份在 include/config/* 中安装文件和 include/generated/autoconf.h .

要查看您是否有同样的问题,请运行
sudo find . -uid 0

或者只看 git clean -xdf的错误信息(不应该有)。

删除root拥有的所有文件和目录后,我从这个死锁中恢复了:
unset ARCH
cp .config ../config.backup # If you still have this.
git clean -xdf # No errors (this also deletes .config)
cp ../config.backup .config # Or generate a new one *).
make olddefconfig # Printed at the end: 'No change to .config'

请注意,我需要从环境中清除 ARCH。

之后我照常进行,
VERSION=5.6.3                # I have checked out tag v5.6.3 **)
FLAVOUR=lowlatlocxhci # Or whatever you want to call your kernel.
make -j8 deb-pkg LOCALVERSION=-$FLAVOUR
sudo dpkg -i ../linux-headers-$VERSION-${FLAVOUR}_$VERSION-$FLAVOUR-1_amd64.deb ../linux-image-$VERSION-${FLAVOUR}_$VERSION-${FLAVOUR}-1_amd64.deb

最后一条命令目前无法编译virtualbox内核模块,但我不在乎那些,这些错误可以忽略(只要你不使用virtual box)。

*) 所使用的 .config 文件是通过引导至包含所有内容的内核(即 dist.kernel)、将其配置从/boot 复制到源代码树并运行 make localmodconfig 来准备的。在确保加载了我需要的所有内核模块之后(通过运行那些导致这些模块被加载的应用程序)。最后运行 make menuconfig关闭 CONFIG_DEBUG_INFO在这个内核中,并将一些通常内置在内核中的东西也变成模块(出于某种原因我需要)。

**) 我的 git 树已准备好:
VERSION=5.6.3
FLAVOUR=lowlatlocxhci
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-$VERSION-$FLAVOUR-$VERSION-$FLAVOUR
cd linux-$VERSION-$FLAVOUR-$VERSION-$FLAVOUR
git checkout -b test_$FLAVOUR v$VERSION
# Make manual changes here, and commit as usual.

关于linux-kernel - 在 18.04.1-Ubuntu 下的 VirtualBox 中构建最新的 linux 内核时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57777429/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com