-
Notifications
You must be signed in to change notification settings - Fork 104
backport 6.12 deb package script to 6.6 kernel #1364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: linux-6.6.y
Are you sure you want to change the base?
Conversation
The long version --rules-file and --jobs are available since 1.18.8 while their short analogues -R and -j have been added since 1.14.7. The option --rules-file the way it works currently was introduced in the commit 5cd52673aabdf5eaa58181972119a41041fc85f2 of dpkg dated 23.07.18 with the following changelog entry: * Fix dpkg-buildpackage option --rules-file parsing. It was trying to parse it as --rules-target, which due to the ordering was a no-op. The current behavior of the long version --rules-file is guaranteed to be in use starting 1.19.1 and might cause build failures for some versions newer than 1.18.8 even in spite of being documented that way. Signed-off-by: Dmitrii Bundin <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]> (cherry picked from commit 259b8bd) Signed-off-by: Han Gao <[email protected]>
In 2017, the dpkg suite introduced the rootless builds support with the
following commits:
- 2436807c87b0 ("dpkg-deb: Add support for rootless builds")
- fca1bfe84068 ("dpkg-buildpackage: Add support for rootless builds")
This feature is available in the default dpkg on Debian 10 and Ubuntu
20.04.
Remove the old method.
Signed-off-by: Masahiro Yamada <[email protected]>
(cherry picked from commit 53243e0)
Signed-off-by: Han Gao <[email protected]>
…cript Copy debian/copyright instead of generating it by the 'cat' command. I also updated '2018' to '2023' while I was here. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> (cherry picked from commit 9c65810) Signed-off-by: Han Gao <[email protected]>
The condition to require libelf-dev:native is stale because objtool is
now enabled by CONFIG_OBJTOOL instead of CONFIG_UNWINDER_ORC. Not only
objtool but also resolve_btfids requires libelf-dev:native; therefore,
CONFIG_DEBUG_INFO_BTF should be checked as well.
Similarly, CONFIG_SYSTEM_TRUSTED_KEYRING is not the only case that
requires libssl-dev:native.
Perhaps, the following code would provide better coverage, but it is
hard to maintain (and may still be imperfect).
if is_enabled CONFIG_OBJTOOL ||
is_enabled CONFIG_DEBUG_INFO_BTF; then
build_depends="${build_depends}, libelf-dev:native"
fi
if is_enabled CONFIG_SYSTEM_TRUSTED_KEYRING ||
is_enabled CONFIG_SYSTEM_REVOCATION_LIST ||
is_enabled CONFIG_MODULE_SIG_FORMAT; then
build_depends="${build_depends}, libssl-dev:native"
fi
Let's hard-code the build dependency.
Signed-off-by: Masahiro Yamada <[email protected]>
Reviewed-by: Nicolas Schier <[email protected]>
(cherry picked from commit b88365b)
Signed-off-by: Han Gao <[email protected]>
…ules This avoids code duplication between binary-arch and built-arch. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> (cherry picked from commit 466e6fc) Signed-off-by: Han Gao <[email protected]>
… debian/rules The binary-arch target needs to use the same CROSS_COMPILE as used in build-arch; otherwise, 'make run-command' may attempt to resync the .config file. Squash scripts/package/deb-build-option into debian/rules, as it is a small amount of code. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> (cherry picked from commit 7d4f07d) Signed-off-by: Han Gao <[email protected]>
…ectly executed Since commit 491b146 ("kbuild: builddeb: Eliminate debian/arch use"), direct execution of debian/rules results in the following error: dpkg-architecture: error: unknown option 'DEB_HOST_MULTIARCH' The current code: dpkg-architecture -a$DEB_HOST_ARCH -qDEB_HOST_MULTIARCH ... does not look sensible because: - For this code to work correctly, DEB_HOST_ARCH must be pre-defined, which is true when the packages are built via dpkg-buildpackage. In this case, DEB_HOST_MULTIARCH is also likely defined, hence there is no need to query DEB_HOST_MULTIARCH in the first place. - If DEB_HOST_MULTIARCH is undefined, DEB_HOST_ARCH is likely undefined too. So, you cannot query DEB_HOST_MULTIARCH in this way. This is mostly the case where debian/rules is directly executed. When debian/rules is directly executed, querying DEB_HOST_MUCHARCH is not enough because we need to know DEB_{BUILD,HOST}_GNU_TYPE as well. All DEB_* variables are defined when the package build is initiated by dpkg-buildpackage, but otherwise, let's call dpkg-architecture to set all DEB_* environment variables. This requires dpkg 1.20.6 or newer because --print-format option was added in dpkg commit 7c54fa2b232e ("dpkg-architecture: Add a --print-format option"). Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> (cherry picked from commit 159956f) Signed-off-by: Han Gao <[email protected]>
…ctory 'make O=... deb-pkg' creates the debian directory in the output directory. However, currently it is impossible to run debian/rules created in the separate output directory. This commit delays the $(srctree) expansion by escaping '$' and by quoting the entire command, making it possible to run debian/rules in the output directory. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> (cherry picked from commit eaf80f7) Signed-off-by: Han Gao <[email protected]>
…debian/rules This is unneeded because the Makefile in the output directory wraps the top-level Makefile in the srctree. Just run $(MAKE) irrespective of the build location. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> (cherry picked from commit 68e262f) Signed-off-by: Han Gao <[email protected]>
Commit 36862e1 ("kbuild: deb-pkg: use dh_listpackages to know enabled packages") started to require the debhelper tool suite. Use more dh_* commands in create_package(): - dh_installdocs to install copyright - dh_installchangelogs to install changelog - dh_compress to compress changelog - dh_fixperms to replace the raw chmod command - dh_gencontrol to replace the raw dpkg-gencontrol command - dh_md5sums to record the md5sum of included files - dh_builddeb to replace the raw dpkg-deb command Set DEB_RULES_REQUIRES_ROOT to 'no' in case debian/rules is executed directly. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> (cherry picked from commit 5e73758) Signed-off-by: Han Gao <[email protected]>
… package
There are two ways of managing separate debug info files:
[1] The executable contains the .gnu_debuglink section, which specifies
the name and the CRC of the separate debug info file.
[2] The executable contains a build ID, and the corresponding debug info
file is placed in the .build-id directory.
We could do both, but the former, which 'make deb-pkg' currently does,
results in complicated installation steps because we need to manually
strip the debug sections, create debug links, and re-sign the modules.
Besides, it is not working with module compression.
This commit abandons the approach [1], and instead opts for [2].
Debian kernel commit de26137e2a9f ("Drop not needed extra step to add
debug links") also stopped adding debug links.
Signed-off-by: Masahiro Yamada <[email protected]>
(cherry picked from commit 16c36f8)
Signed-off-by: Han Gao <[email protected]>
…r arch/
The 'scripts' directory was searched under arch/${SRCARCH} to copy
arch/ia64/scripts, but commit cf8e865 ("arch: Remove Itanium
(IA-64) architecture") removed arch/ia64/ entirely.
There is another 'scripts' directory in arch/um/, but this script
is never executed with SRCARCH=um because UML does not support the
linux-headers package.
Signed-off-by: Masahiro Yamada <[email protected]>
(cherry picked from commit 358c3f8)
Signed-off-by: Han Gao <[email protected]>
Strictly speaking, 'make headers' should be a part of build-arch instead of binary-arch. 'make headers' constructs ready-to-copy UAPI headers in the kernel directory. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> (cherry picked from commit 1b5e946) Signed-off-by: Han Gao <[email protected]>
Use debian/<package> for tmpdir, which is the default of debhelper. This simplifies the code. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> (cherry picked from commit 6185d32) Signed-off-by: Han Gao <[email protected]>
When the Debian package build is initiated by Kbuild ('make deb-pkg'
or 'make bindeb-pkg'), the log messages are displayed in the short
form, which is the Kbuild default.
Otherwise, let's show verbose messages (unless the 'terse' tag is set
in DEB_BUILD_OPTION), as suggested by Debian Policy: "The package build
should be as verbose as reasonably possible, except where the terse tag
is included in DEB_BUILD_OPTIONS." [1]
This is what the Debian kernel also does. [2]
[1]: https://www.debian.org/doc/debian-policy/ch-source.html#main-building-script-debian-rules
[2]: https://salsa.debian.org/kernel-team/linux/-/blob/debian/6.7-1_exp1/debian/rules.real#L36
Signed-off-by: Masahiro Yamada <[email protected]>
Reviewed-by: Nicolas Schier <[email protected]>
(cherry picked from commit cc3df32)
Signed-off-by: Han Gao <[email protected]>
Add $(Q) to the commands in debian/rules to make them quiet when the package built is initiated by 'make deb-pkg' or when the 'terse' tag is set to DEB_BUILD_OPTIONS. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> (cherry picked from commit caf400c) Signed-off-by: Han Gao <[email protected]>
'make deb-pkg' builds build-arch in parallel, but binary-arch serially. Given that all binary packages are independent of one another, they can be built in parallel. I am uncertain whether debian/files is robust against a race condition. Just in case, make dh_gencontrol (dpkg-gencontrol) output to separate debian/*.files, which are then concatenated into debian/files. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> (cherry picked from commit 1d7bae8) Signed-off-by: Han Gao <[email protected]>
Use dh_prep instead of removing old build directories manually. Use dh_clean instead of removing build directories and debian/files manually. Call dh_testdir and dh_testroot for preliminary checks. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> (cherry picked from commit f96beb8) Signed-off-by: Han Gao <[email protected]>
At first, I thought this script would be needed only in init/Makefile. However, commit 5db8fac ("kbuild: Restore .version auto-increment behaviour for Debian packages") and commit 1789fc9 ("kbuild: rpm-pkg: invoke the kernel build from rpmbuild for binrpm-pkg") revealed that it was actually needed for scripts/package/mk* as well. After all, scripts/ is a better place for it. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> (cherry picked from commit ae4c4ce) [ Han Gao: port to 6.6 kernel ] [ Han Gao: adapt to UOS/deepin scripting ] Signed-off-by: Han Gao <[email protected]>
Commit edec611 ("kbuild, deb-pkg: improve maintainer identification") added the EMAIL and NAME environment variables. Commit d5940c6 ("kbuild: deb-pkg improve maintainer address generation") removed support for NAME, but kept support for EMAIL. The EMAIL and NAME environment variables are supported by some tools (see 'man debchange'), but not by all. We should support both of them, or neither of them. We should not stop halfway. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> (cherry picked from commit 6276761) Signed-off-by: Han Gao <[email protected]>
… DEBEMAIL Commit d5940c6 ("kbuild: deb-pkg improve maintainer address generation") supported the "name <email>" form for DEBEMAIL, with behavior slightly different from devscripts. In Kbuild, if DEBEMAIL is given in the form "name <email>", it is used as-is, and DEBFULLNAME is ignored. In contrast, debchange takes the name from DEBFULLNAME (or NAME) if set, as described in 'man debchange': If this variable has the form "name <email>", then the maintainer name will also be taken from here if neither DEBFULLNAME nor NAME is set. This commit removes support for the "name <email> form for DEBEMAIL, as the current behavior is already different from debchange, and the Debian manual suggests setting the email address and name separately in DEBEMAIL and DEBFULLNAME. [1] If there are any complaints about this removal, we can re-add it, with better alignment with the debchange implementation. [2] [1]: https://www.debian.org/doc/manuals/debmake-doc/ch03.en.html#email-setup [2]: https://salsa.debian.org/debian/devscripts/-/blob/v2.23.7/scripts/debchange.pl#L802 Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> (cherry picked from commit c520908) Signed-off-by: Han Gao <[email protected]>
…ell scripts Set -e to make these scripts fail on the first error. Set -u because these scripts are invoked by Makefile, and do not work properly without necessary variables defined. I tweaked mkdebian to cope with optional environment variables. Remove the explicit "test -n ..." from install-extmod-build. Both options are described in POSIX. [1] [1]: https://pubs.opengroup.org/onlinepubs/009604499/utilities/set.html Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> (cherry picked from commit c041441) [ Han Gao: remove mkspec modify ] Signed-off-by: Han Gao <[email protected]>
…or null
${DEBFULLNAME-${user}} falls back to ${user} when DEBFULLNAME is unset.
It is more reasonable to do so when DEBFULLNAME is unset or null.
Otherwise, the command:
$ DEBFULLNAME= make deb-pkg
will leave the name field blank.
The same applies to KBUILD_BUILD_USER and KBUILD_BUILD_HOST.
Signed-off-by: Masahiro Yamada <[email protected]>
Reviewed-by: Nathan Chancellor <[email protected]>
(cherry picked from commit d67015e)
Signed-off-by: Han Gao <[email protected]>
The blank line causes execve() to fail:
# strace ./postinst
execve("./postinst", ...) = -1 ENOEXEC (Exec format error)
strace: exec: Exec format error
+++ exited with 1 +++
However running the scripts via shell does work (at least with bash)
because the shell attempts to execute the file as a shell script when
execve() fails.
Fixes: b611daa ("kbuild: deb-pkg: split image and debug objects staging out into functions")
Signed-off-by: Aaron Thompson <[email protected]>
Reviewed-by: Nathan Chancellor <[email protected]>
Reviewed-by: Nicolas Schier <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
(cherry picked from commit 82cb443)
Signed-off-by: Han Gao <[email protected]>
Exclude directories and files unnecessary for building external modules:
- include/config/ (except include/config/{auto.conf,kernel.release})
- scripts/atomic/
- scripts/dtc/
- scripts/kconfig/
- scripts/mod/mk_elfconfig
- scripts/package/
- scripts/unifdef
- .config
- *.o
- .*.cmd
Avoid copying files twice for the following directories:
- include/generated/
- arch/*/include/generated/
Signed-off-by: Masahiro Yamada <[email protected]>
Reviewed-by: Nicolas Schier <[email protected]>
(cherry picked from commit aaed5c7)
Signed-off-by: Han Gao <[email protected]>
A long standing issue in the upstream kernel packaging is that the
linux-headers package is not cross-compiled.
For example, you can cross-build Debian packages for arm64 by running
the following command:
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bindeb-pkg
However, the generated linux-headers-*_arm64.deb is useless because the
host programs in it were built for your build machine architecture
(likely x86), not arm64.
The Debian kernel maintains its own Makefiles to cross-compile host
tools without relying on Kbuild. [1]
Instead of adding such full custom Makefiles, this commit adds a small
piece of code to cross-compile host programs located under the scripts/
directory.
A straightforward solution is to pass HOSTCC=${CROSS_COMPILE}gcc, but it
would also cross-compile scripts/basic/fixdep, which needs to be native
to process the if_changed_dep macro. (This approach may work under some
circumstances; you can execute foreign architecture programs with the
help of binfmt_misc because Debian systems enable CONFIG_BINFMT_MISC,
but it would require installing QEMU and libc for that architecture.)
A trick is to use the external module build (KBUILD_EXTMOD=), which
does not rebuild scripts/basic/fixdep. ${CC} needs to be able to link
userspace programs (CONFIG_CC_CAN_LINK=y).
There are known limitations:
- GCC plugins
It would possible to rebuild GCC plugins for the target architecture
by passing HOSTCXX=${CROSS_COMPILE}g++ with necessary packages
installed, but gcc on the installed system emits
"cc1: error: incompatible gcc/plugin versions".
- objtool and resolve_btfids
These are built by the tools build system. They are not covered by
the current solution. The resulting linux-headers package is broken
if CONFIG_OBJTOOL or CONFIG_DEBUG_INFO_BTF is enabled.
I only tested this with Debian, but it should work for other package
systems as well.
[1]: https://salsa.debian.org/kernel-team/linux/-/blob/debian/6.9.9-1/debian/rules.real#L586
Signed-off-by: Masahiro Yamada <[email protected]>
Reviewed-by: Nicolas Schier <[email protected]>
(cherry picked from commit f1d8766)
Signed-off-by: Han Gao <[email protected]>
…ld profile Since commit f1d8766 ("kbuild: cross-compile linux-headers package when possible"), 'make bindeb-pkg' may attempt to cross-compile the linux-headers package, but it fails under certain circumstances. For example, when CONFIG_MODULE_SIG_FORMAT is enabled on Debian, the following command fails: $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bindeb-pkg [ snip ] Rebuilding host programs with aarch64-linux-gnu-gcc... HOSTCC debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/kallsyms HOSTCC debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/sorttable HOSTCC debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/asn1_compiler HOSTCC debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/sign-file In file included from /usr/include/openssl/opensslv.h:109, from debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/sign-file.c:25: /usr/include/openssl/macros.h:14:10: fatal error: openssl/opensslconf.h: No such file or directory 14 | #include <openssl/opensslconf.h> | ^~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. This commit adds a new profile, pkg.linux-upstream.nokernelheaders, to guard the linux-headers package. There are two options to fix the above issue. Option 1: Set the pkg.linux-upstream.nokernelheaders build profile $ DEB_BUILD_PROFILES=pkg.linux-upstream.nokernelheaders \ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bindeb-pkg This skips the building of the linux-headers package. Option 2: Install the necessary build dependencies If you want to cross-compile the linux-headers package, you need to install additional packages. For example, on Debian, the packages necessary for cross-compiling it to arm64 can be installed with the following commands: # dpkg --add-architecture arm64 # apt update # apt install gcc-aarch64-linux-gnu libssl-dev:arm64 Fixes: f1d8766 ("kbuild: cross-compile linux-headers package when possible") Reported-by: Ron Economos <[email protected]> Closes: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Masahiro Yamada <[email protected]> Tested-by: Ron Economos <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> (cherry picked from commit e2c3182) Signed-off-by: Han Gao <[email protected]>
…rofile The Debian kernel supports the pkg.linux.nokerneldbg build profile. The debug package tends to become huge, and you may not want to build it even when CONFIG_DEBUG_INFO is enabled. This commit introduces a similar profile for the upstream kernel. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> (cherry picked from commit 2ad7126) Signed-off-by: Han Gao <[email protected]>
Kernels built without CONFIG_MODULES might still want to create -dbg deb packages but install_linux_image_dbg() assumes modules.order always exists. This obviously isn't true if no modules were built, so we should skip reading modules.order in that case. Fixes: 16c36f8 ("kbuild: deb-pkg: use build ID instead of debug link for dbg package") Signed-off-by: Matt Fleming <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]> (cherry picked from commit bcbbf49) Signed-off-by: Han Gao <[email protected]>
Python3 is necessary for running some scripts such as drivers/gpu/drm/msm/registers/gen_header.py Both scripts/package/kernel.spec and scripts/package/PKGBUILD already list Python as the build dependency. Do likewise for scripts/package/mkdebian. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]> (cherry picked from commit 6b1fabc) Signed-off-by: Han Gao <[email protected]>
Since commit 13b2548 ("kbuild: change working directory to external module directory with M="), the Debian package build fails if a relative path is specified with the O= option. $ make O=build bindeb-pkg [ snip ] dpkg-deb: building package 'linux-image-6.13.0-rc1' in '../linux-image-6.13.0-rc1_6.13.0-rc1-6_amd64.deb'. Rebuilding host programs with x86_64-linux-gnu-gcc... make[6]: Entering directory '/home/masahiro/linux/build' /home/masahiro/linux/Makefile:190: *** specified kernel directory "build" does not exist. Stop. This occurs because the sub_make_done flag is cleared, even though the working directory is already in the output directory. Passing KBUILD_OUTPUT=. resolves the issue. Fixes: 13b2548 ("kbuild: change working directory to external module directory with M=") Reported-by: Charlie Jenkins <[email protected]> Closes: https://lore.kernel.org/all/Z1DnP-GJcfseyrM3@ghost/ Tested-by: Charlie Jenkins <[email protected]> Reviewed-by: Charlie Jenkins <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]> (cherry picked from commit d8d326d) Signed-off-by: Han Gao <[email protected]>
…ally
In ThinPro, we use the convention <upstream_ver>+hp<patchlevel> for
the kernel package. This does not have a dash in the name or version.
This is built by editing ".version" before a build, and setting
EXTRAVERSION="+hp" and KDEB_PKGVERSION make variables:
echo 68 > .version
make -j<n> EXTRAVERSION="+hp" bindeb-pkg KDEB_PKGVERSION=6.12.2+hp69
.deb name: linux-image-6.12.2+hp_6.12.2+hp69_amd64.deb
Since commit 7d4f07d ("kbuild: deb-pkg: squash
scripts/package/deb-build-option to debian/rules"), this no longer
works. The deb build logic changed, even though, the commit message
implies that the logic should be unmodified.
Before, KBUILD_BUILD_VERSION was not set if the KDEB_PKGVERSION did
not contain a dash. After the change KBUILD_BUILD_VERSION is always
set to KDEB_PKGVERSION. Since this determines UTS_VERSION, the uname
output to look off:
(now) uname -a: version 6.12.2+hp ... deepin-community#6.12.2+hp69
(expected) uname -a: version 6.12.2+hp ... deepin-community#69
Update the debian/rules logic to restore the original behavior.
Fixes: 7d4f07d ("kbuild: deb-pkg: squash scripts/package/deb-build-option to debian/rules")
Signed-off-by: Alexandru Gagniuc <[email protected]>
Reviewed-by: Nicolas Schier <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
(cherry picked from commit 6260406)
Signed-off-by: Han Gao <[email protected]>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideBackports the Linux 6.12 Debian packaging tooling to the 6.6 kernel tree, updating the version header generation script path, refreshing packaging scripts, and adding/removing Debian-specific helper files to match the newer layout. Flow diagram for updated utsversion header generationflowchart TD
A[Kernel_build_start] --> B[Make_init_Makefile]
B --> C[Target_include_generated_utsversion_h]
C --> D[Run_scripts_build-version]
D --> E[Generate_UTS_VERSION_value]
C --> F[Run_date_for_build_timestamp_auto]
F --> G[Generate_build_timestamp]
E --> H[Create_utsversion-tmp_h]
G --> H
H --> I[Run_filechk_uts_version]
I --> J[Write_include_generated_utsversion_h]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
deepin pr auto review我来对这个 git diff 进行全面的代码审查:
总的来说,这些改动提高了代码的可维护性、安全性和性能。主要的改进集中在更好的错误处理、更清晰的代码组织以及更安全的脚本执行环境。建议在后续版本中继续保持这些改进方向,并考虑添加更多的自动化测试来验证这些改动。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR backports Debian packaging infrastructure and build-version script handling from kernel 6.12 to the 6.6 kernel tree. The changes modernize the packaging scripts with better error handling, reorganize the build-version helper script location, and update the Debian package generation workflow.
Key changes:
- Move build-version script from
init/toscripts/directory and update all references - Add strict error handling (
set -eu) to all packaging shell scripts - Refactor Debian package building workflow with improved dependency management and build profiles
- Extract copyright file into separate reusable template and simplify builddeb script
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| scripts/build-version | New build version generation script relocated from init/ directory |
| init/Makefile | Updated path reference to build-version script (contains bug) |
| scripts/package/mkspec | Updated path to build-version for RPM spec generation |
| scripts/package/mkdebian | Refactored with set -eu, improved variable checking, updated build dependencies |
| scripts/package/debian/copyright | Extracted copyright template as standalone file |
| scripts/package/debian/rules | Complete rewrite with modular binary target handling and cross-compilation support |
| scripts/package/builddeb | Simplified package installation logic, removed create_package function |
| scripts/package/install-extmod-build | Enhanced with find_in_scripts helper and host program rebuild logic |
| scripts/package/gen-diff-patch | Added set -eu for error handling |
| scripts/package/buildtar | Added set -eu for error handling |
| scripts/package/deb-build-option | Removed - functionality moved to debian/rules |
| scripts/Makefile.package | Simplified dpkg-buildpackage invocation, removed KBUILD_PKG_ROOTCMD |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # | ||
|
|
||
| include/generated/utsversion.h: build-version-auto = $(shell $(srctree)/$(src)/build-version) | ||
| include/generated/utsversion.h: build-version-auto = $(shell $(srctree)/$(src)/scripts/build-version) |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The path to build-version is incorrect. The variable $(src) evaluates to init in this Makefile, so this would try to execute init/scripts/build-version which doesn't exist. The script has been moved to scripts/build-version, so this should be $(shell $(srctree)/scripts/build-version) instead.
| include/generated/utsversion.h: build-version-auto = $(shell $(srctree)/$(src)/scripts/build-version) | |
| include/generated/utsversion.h: build-version-auto = $(shell $(srctree)/scripts/build-version) |
Summary by Sourcery
Backport Debian packaging support and version generation behavior from a newer kernel branch to the 6.6 kernel tree.
Build: