Linux-6.10.5 API 头文件
Linux 内核需要导出一个应用程序编程接口 (API) 供系统的 C 运行库 (例如 LFS 中的 Glibc) 使用。这通过净化内核源码包中提供的若干 C 头文件完成。
安装Linux API头文件
cd $LFS/sources
VERSION=6.10.5
tar xf linux-${VERSION}.tar.xz
cd linux-${VERSION}
make mrproper
make headers
find usr/include -type f ! -name '*.h' -delete
cp -rv usr/include $LFS/usr
我在LFS构建时遇到虚拟机oom杀死,重启以后,因为 LFS 交叉编译临时工具 的M4编译错误,反过来重新从GCC步骤中补齐limits.h,此时我想重新走一遍,却发现在执行 make mrproper
时候报错:
执行
make mrproper
报错/mnt/lfs/sources/linux-6.7.4/Makefile:756: arch//Makefile: No such file or directory
make[1]: *** No rule to make target 'arch//Makefile'. Stop.
make: *** [Makefile:234: __sub-make] Error 2
检查 Makefile
可以看到是 include $(srctree)/arch/$(SRCARCH)/Makefile
中 $(SRCARCH)
变量为空导致错误
是什么导致了 $(SRCARCH)
无法获得呢?
参考 linux kernel make tag variable 和 Vim configuration for Linux kernel development ,原来内核源代码中 scripts/tags.sh
提供了定义
但是我发现当前 scripts/
目录下的 .sh
文件包括 scripts/tags.sh
都是空的。我后来重复解压缩(移除目录后重新解压缩)才正常,看来之前可能是其他用户(root?)解压缩文件后,再次用 lfs
用户解压缩无法覆盖文件?