Skip to content

Commit

Permalink
kbuild: deb-pkg: call more misc debhelper commands
Browse files Browse the repository at this point in the history
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 <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <n.schier@avm.de>
  • Loading branch information
Masahiro Yamada committed Feb 19, 2024
1 parent 1d7bae8 commit f96beb8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
8 changes: 0 additions & 8 deletions scripts/package/builddeb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ install_linux_image () {
pname=$1
pdir=debian/$1

rm -rf ${pdir}

# Only some architectures with OF support have this target
if is_enabled CONFIG_OF_EARLY_FLATTREE && [ -d "${srctree}/arch/${SRCARCH}/boot/dts" ]; then
${MAKE} -f ${srctree}/Makefile INSTALL_DTBS_PATH="${pdir}/usr/lib/linux-image-${KERNELRELEASE}" dtbs_install
Expand Down Expand Up @@ -97,8 +95,6 @@ install_linux_image () {
install_linux_image_dbg () {
pdir=debian/$1

rm -rf ${pdir}

# Parse modules.order directly because 'make modules_install' may sign,
# compress modules, and then run unneeded depmod.
while read -r mod; do
Expand Down Expand Up @@ -128,8 +124,6 @@ install_kernel_headers () {
pdir=debian/$1
version=${1#linux-headers-}

rm -rf $pdir

"${srctree}/scripts/package/install-extmod-build" "${pdir}/usr/src/linux-headers-${version}"

mkdir -p $pdir/lib/modules/$version/
Expand All @@ -139,8 +133,6 @@ install_kernel_headers () {
install_libc_headers () {
pdir=debian/$1

rm -rf $pdir

$MAKE -f $srctree/Makefile headers_install INSTALL_HDR_PATH=$pdir/usr

# move asm headers to /usr/include/<libc-machine>/asm to match the structure
Expand Down
6 changes: 5 additions & 1 deletion scripts/package/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ package = $($(@:binary-%=%-package))
DH_OPTIONS = -p$(package)

define binary
$(Q)dh_testdir $(DH_OPTIONS)
$(Q)dh_testroot $(DH_OPTIONS)
$(Q)dh_prep $(DH_OPTIONS)
$(Q)+$(MAKE) $(make-opts) run-command KBUILD_RUN_COMMAND='+$$(srctree)/scripts/package/builddeb $(package)'
$(Q)dh_installdocs $(DH_OPTIONS)
$(Q)dh_installchangelogs $(DH_OPTIONS)
Expand Down Expand Up @@ -72,7 +75,8 @@ build-arch:

.PHONY: clean
clean:
$(Q)rm -rf debian/files debian/linux-* debian/deb-env.vars* debian/*.files
$(Q)dh_clean
$(Q)rm -rf debian/deb-env.vars* debian/*.files
$(Q)$(MAKE) ARCH=$(ARCH) clean

# If DEB_HOST_ARCH is empty, it is likely that debian/rules was executed
Expand Down

0 comments on commit f96beb8

Please sign in to comment.