我不是 Debian 用户,但我需要一个 Debian 环境来测试我编写的这个内核补丁,不用说,过去几天我一直在尝试弄清楚如何在 Debian 上构建自定义内核,而且我'我无尽的沮丧……
我成功安装了自定义内核,但需要更改一个配置选项。运行后make -j5 deb-pkg
我收到此错误:
dpkg-source: warning: executable mode 0755 of 'debian/linux-headers/usr/src/linux-headers-5.8.0+/scripts/stackdelta' will not be represented in diff
dpkg-source: warning: executable mode 0755 of 'debian/linux-headers/usr/src/linux-headers-5.8.0+/scripts/stackusage' will not be represented in diff
dpkg-source: warning: executable mode 0755 of 'debian/linux-headers/usr/src/linux-headers-5.8.0+/scripts/tags.sh' will not be represented in diff
dpkg-source: warning: executable mode 0755 of 'debian/linux-headers/usr/src/linux-headers-5.8.0+/scripts/tools-support-relr.sh' will not be represented in diff
dpkg-source: warning: executable mode 0755 of 'debian/linux-headers/usr/src/linux-headers-5.8.0+/scripts/tracing/draw_functrace.py' will not be represented in diff
dpkg-source: warning: executable mode 0755 of 'debian/linux-headers/usr/src/linux-headers-5.8.0+/scripts/tracing/ftrace-bisect.sh' will not be represented in diff
dpkg-source: warning: executable mode 0755 of 'debian/linux-headers/usr/src/linux-headers-5.8.0+/scripts/ver_linux' will not be represented in diff
dpkg-source: warning: executable mode 0755 of 'debian/linux-headers/usr/src/linux-headers-5.8.0+/scripts/xz_wrap.sh' will not be represented in diff
dpkg-source: error: cannot represent change to debian/linux-headers/usr/src/linux-headers-5.8.0+/tools/objtool/objtool: binary file contents changed
dpkg-source: warning: executable mode 0755 of 'debian/linux-headers/usr/src/linux-headers-5.8.0+/tools/objtool/objtool' will not be represented in diff
dpkg-source: error: cannot represent change to debian/linux-image-dbg/usr/lib/debug/lib/modules/5.8.0+/vmlinux: binary file contents changed
dpkg-source: warning: executable mode 0755 of 'debian/linux-image-dbg/usr/lib/debug/lib/modules/5.8.0+/vmlinux' will not be represented in diff
dpkg-source: error: cannot represent change to debian/linux-image-dbg/usr/share/doc/linux-image-5.8.0+-dbg/changelog.Debian.gz: binary file contents changed
dpkg-source: warning: executable mode 0755 of 'debian/linux-image/DEBIAN/postinst' will not be represented in diff
dpkg-source: warning: executable mode 0755 of 'debian/linux-image/DEBIAN/postrm' will not be represented in diff
dpkg-source: warning: executable mode 0755 of 'debian/linux-image/DEBIAN/preinst' will not be represented in diff
dpkg-source: warning: executable mode 0755 of 'debian/linux-image/DEBIAN/prerm' will not be represented in diff
dpkg-source: error: cannot represent change to debian/linux-image/boot/vmlinuz-5.8.0+: binary file contents changed
dpkg-source: error: cannot represent change to debian/linux-image/lib/modules/5.8.0+/modules.alias.bin: binary file contents changed
dpkg-source: error: cannot represent change to debian/linux-image/lib/modules/5.8.0+/modules.builtin.bin: binary file contents changed
dpkg-source: error: cannot represent change to debian/linux-image/lib/modules/5.8.0+/modules.builtin.modinfo: binary file contents changed
dpkg-source: error: cannot represent change to debian/linux-image/lib/modules/5.8.0+/modules.dep.bin: binary file contents changed
dpkg-source: error: cannot represent change to debian/linux-image/lib/modules/5.8.0+/modules.symbols.bin: binary file contents changed
dpkg-source: error: cannot represent change to debian/linux-image/usr/share/doc/linux-image-5.8.0+/changelog.Debian.gz: binary file contents changed
dpkg-source: error: cannot represent change to debian/linux-libc-dev/usr/share/doc/linux-libc-dev/changelog.Debian.gz: binary file contents changed
dpkg-source: warning: the diff modifies the following upstream files:
.clang-format
.cocciconfig
.config.old
.get_maintainer.ignore
.mailmap
.version
CREDITS
MAINTAINERS
Module.symvers
README
u_f.patch
dpkg-source: info: use the '3.0 (quilt)' format to have separate and documented changes to upstream files, see dpkg-source(1)
dpkg-source: error: unrepresentable changes to source
dpkg-buildpackage: error: dpkg-source -i.git -b . subprocess returned exit status 1
make[1]: *** [scripts/Makefile.package:77: deb-pkg] Error 1
make: *** [Makefile:1520: deb-pkg] Error 2
我怎样才能解决这个问题...?
答案1
确实,dpkg 源不会忽略一些早期构建的文件,您会看到类似这样的错误。
make -j `getconf _NPROCESSORS_ONLN` deb-pkg LOCALVERSION=-custom
这使我可以在干净的克隆之后构建一次。由于以下问题,后续构建总是失败德布克
因此一个制作bindb-pkg将有助于下一个构建命令是:
make -j `getconf _NPROCESSORS_ONLN` bindeb-pkg LOCALVERSION=-custom
效果很好,现在构建成功了
答案2
在研究这个答案时,我针对非本机包回答了这个问题,但发现linux-signed-amd64
源包(可能是您正在构建的)是本机包。不幸的是,这使我在非本地包部分,但我认为这对于遇到这个问题的人仍然有用。
非本地包
通常,当我们遇到此问题时,是因为我们对非本机包进行了未跟踪的更改。这适用于debian/source/format
时3.0 (quilt)
。例如:
apt source <package>
cd <package>_<version>
# make changes to sources
dpkg-buildpackage
apt source
下载原始的上游 tarball(原作者的版本,除非+dfsg
在版本中),解压它,然后添加 debian 打包内容(在debian/
目录中找到)。
当我们使用dpkg-buildpackage
(或debuild
) 时,要做的第一件事就是调用它dpkg-source
来验证包外部的任何内容debian/
是否完全符合原始上游 tarball。这确保了 debian 中没有人添加任何未记录的更改。
对上游内容的任何更改都需要作为补丁独立应用。 quilt
用于此目的。验证发生后,补丁将被存储debian/patches
并应用。dpkg-source
这可以确保任何特定于发行版的内容都得到正确记录。它还有助于跟踪哪些补丁已转发到上游(到原始开发人员),因为补丁格式中有元内容(或标头)的空间。
发生此问题的另一种方式是,如果构建发生在源代码中(意味着构建工件未隔离到构建目录,或者脚本将就地修改源文件)。希望debuild -T clean
能够将所有内容恢复到原始状态,否则需要手动完成。
原生包
本例中,apt source
下载原生linux-signed-amd64_*.tar.xz
源码包,然后解压。当我们使用debuild
or时dpkg-buildpackage
,我们通常会生成源码包和所有二进制包。由于源码包已经存在,因此debuild
跳过此步骤,但验证源码包是否与当前源码树匹配。这就是一切失败的地方。它没有选择替换您拥有的源包,而是选择抛出错误。删除源包(使用debuild -T clean
)可以解决此冲突。
答案3
看来错误是由make deb-pkg
安装到 /usr/src 的 .deb 文件和目录引起的,我通过删除它们来修复它,看起来现在编译得很好