Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #88871

Re: Question about compiling the linux kernel

From alessandro.ratti@protonmail.ch
Newsgroups linux.debian.kernel
Subject Re: Question about compiling the linux kernel
Date 2025-08-16 19:40 +0200
Message-ID <Lkt2N-85Ux-15@gated-at.bofh.it> (permalink)
References <LkjPP-7ZVH-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Saturday, August 16th, 2025 at 9:41 AM, maria.shrivinski <maria.shrivinski@proton.me> wrote:

Hello,

> When compiling the kernel with make -j `getconf _NPROCESSORS_ONLN` deb-pkg the resulting .deb packages are generated in the parent directory.
> Is there a way to choose a specific directory where those packages will be placed?
> 
> I have researched this issue and found partial answers about modifying scripts/package/debian/rules or various makefiles, but nothing has worked so far.
> 
> Using environment variables like DESTDIR=/path/to/dir or OUTPUT_DIRECTORY=/path/to/dir with the make command also did not work.
> 
> Starting to think that this might be impossible. Anyone have an idea?

I guess you're referring to the system found in the upstream kernel — a bit out of topic in this ML, isn't it? :P 

Anyway, here is how I would do it.
First you need to patch scripts/package/debian/rules with the following:

diff --git a/scripts/package/debian/rules b/scripts/package/debian/rules
index a417a7f8bbc1..a9826a62c4f2 100755
--- a/scripts/package/debian/rules
+++ b/scripts/package/debian/rules
@@ -58,7 +58,7 @@ define binary
        $(Q)dh_fixperms $(DH_OPTIONS)
        $(Q)dh_gencontrol $(DH_OPTIONS) -- -f$(call mk-files,$@)
        $(Q)dh_md5sums $(DH_OPTIONS)
-       $(Q)dh_builddeb $(DH_OPTIONS) -- $(addprefix -Z,$(KDEB_COMPRESS))
+       $(Q)dh_builddeb $(DH_OPTIONS) --destdir=$(ARTIFACTS_DIR) -- $(addprefix -Z,$(KDEB_COMPRESS))
 endef
 
 .PHONY: $(binary-targets)

Then, you can build the package with the following command:

export ARTIFACTS_DIR=$(mktemp -d)
make DPKG_FLAGS="--buildinfo-file=${ARTIFACTS_DIR}/vanilla-image.buildinfo --buildinfo-option=-u${ARTIFACTS_DIR} --changes-option=-u${ARTIFACTS_DIR}" -j $(nproc --all) bindeb-pkg

Please note the DPKG_FLAGS.

Hope it helps

Best regards
Alessandro

Back to linux.debian.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Question about compiling the linux kernel "maria.shrivinski" <maria.shrivinski@proton.me> - 2025-08-16 09:50 +0200
  Re: Question about compiling the linux kernel alessandro.ratti@protonmail.ch - 2025-08-16 19:40 +0200
    Re: Question about compiling the linux kernel Salvatore Bonaccorso <carnil@debian.org> - 2025-08-17 16:30 +0200

csiph-web