首页 > 解决方案 > 在 linux compile 中错过 asm/types.h

问题描述

lenge@lenge-pc:/lenge/linux/kernel_online$ git branch 
  master  
* tag_v4.15 
CONFIG is defconfig. 

编译kernel(v4.15)时出现错误,如下:

在包含的文件中

/lenge/linux/kernel_online/include/linux/types.h:6,
      from /lenge/linux/kernel_online/include/linux/page-flags.h:9,
      from /lenge/linux/kernel_online/kernel/bounds.c:10: 
/lenge/linux/kernel_online/include/uapi/linux/types.h:5:10: fatal
      error: asm/types.h: No such file or directory  #include <asm/types.h>
                  ^~~~~~~~~~~~~ compilation terminated.

那是我的编译方法:
make ARCH=arm64 -C /lenge/linux/kernel_online O=/lenge/linux/kernel_out_aarch64 CROSS_COMPILE=/lenge/gnu/aarch64/bin/aarch64-lenge-linux-gnu- -j4

我创建符号链接作为休闲:

ln -s /lenge/linux/kernel_out_aarch64/source/arch/arm64/include/generated/uapi/asm arch/arm64/include/generated/uapi/asm

没关系。

标签: linuxlinux-kernel

解决方案


我只是在交叉编译到 arm64 时遇到了同样的问题。

我注意到我的源代码树中有一些生成的文件,即使我使用输出目录进行构建 (O=)。我不确定我是否不小心遗漏了 O= 一次或发生了什么,但这把事情搞砸了。

为了解决这个问题,我在源目录中运行了 make clean (或者如果你是偏执狂,则使用 make mrproper)来删除所有生成的文件。使用 O= 重新运行我的正常 make 命令成功,并且没有导致在我的源目录中生成文件(如预期的那样)。


推荐阅读