我正在尝试在 Ubuntu 20.04 中实现自定义系统调用。
步骤之一是此命令
root@well:/usr/src/linux-5.16.15# sudo make modules_install install
但它给出了这个错误:
arch/x86/Makefile:142: CONFIG_X86_X32 enabled but no binutils support
ln: target '/source' is not a directory
make[1]: *** [Makefile:1477: __modinst_pre] Error 1
make: *** [Makefile:350: __build_one_by_one] Error 2
我该怎么解决?
我已经这样做好几天了,任何帮助将不胜感激!
根据
CONFIG_X86_X32
选项的定义:
您将需要启用 elf32_x86_x64 支持的最新 binutils(2.22 或更高版本)才能使用此选项集编译内核。
此定义可以在内核源代码中的
arch/x86/Kconfig
文件中找到(https://elixir.bootlin.com/linux/v5.16.15/source/arch/x86/Kconfig#L2836)。我在编译自己的 WSL 内核时也遇到了这个问题。编译步骤写在readme文件中
在运行下面的命令之前,我通过更改
.config
文件(将 CONFIG_X86_X32=y
更改为 CONFIG_X86_X32=n
)解决了这个问题。
$ sudo make -j$(nproc) KCONFIG_CONFIG=.config \
&& sudo make modules_install -j$(nproc) \
&& sudo make install -j$(nproc)