* RFC: refactoring the deb build
@ 2019-02-07 16:40 ` Enrico Weigelt, metux IT consult
0 siblings, 0 replies; 10+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-02-07 16:40 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-kbuild, kernel-janitors, yamada.masahiro, michal.lkml
Hello folks,
here are some patches for build process that allow building debian packages
right the usual canonical way (eg. via dpkg-buildpackage or dck-buildpackage),
instead 'manually' setting up the build environment and calling make.
So, from a debian native perspective, turning it from head onto feet ;-)
dpkg-buildpackage + friends expect the debian/rules file being present in
the unpacked source tree and driving the actual build (the 'deb-pkg' make
target does that quite the opposite way). Obviously, 'make deb-pkg' can't
be used directly, as it would destroy our debian/rules file ...
To archieve this, I've done several things:
* place .config file to the source tree (not in this patch queue)
* add some helper targets to the toplevel makefile, so we can just ask
for certain things, eg. version, arch, etc, that we need later
* fix some missing dependencies in the generated debian/control file
* change scripts/package/mkdebian so that the name of the generated rules
file name can be changed via environment
* a generic debian/rules file for driving the build
The last patch isn't really meant to be merged yet (need to change the
deb-pkg rule to not overwrite debian/rules anymore) - just including it
for illustration.
What do you think about this ?
--mtx
^ permalink raw reply [flat|nested] 10+ messages in thread
* RFC: refactoring the deb build
@ 2019-02-07 16:40 ` Enrico Weigelt, metux IT consult
0 siblings, 0 replies; 10+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-02-07 16:40 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-kbuild, kernel-janitors, yamada.masahiro, michal.lkml
Hello folks,
here are some patches for build process that allow building debian packages
right the usual canonical way (eg. via dpkg-buildpackage or dck-buildpackage),
instead 'manually' setting up the build environment and calling make.
So, from a debian native perspective, turning it from head onto feet ;-)
dpkg-buildpackage + friends expect the debian/rules file being present in
the unpacked source tree and driving the actual build (the 'deb-pkg' make
target does that quite the opposite way). Obviously, 'make deb-pkg' can't
be used directly, as it would destroy our debian/rules file ...
To archieve this, I've done several things:
* place .config file to the source tree (not in this patch queue)
* add some helper targets to the toplevel makefile, so we can just ask
for certain things, eg. version, arch, etc, that we need later
* fix some missing dependencies in the generated debian/control file
* change scripts/package/mkdebian so that the name of the generated rules
file name can be changed via environment
* a generic debian/rules file for driving the build
The last patch isn't really meant to be merged yet (need to change the
deb-pkg rule to not overwrite debian/rules anymore) - just including it
for illustration.
What do you think about this ?
--mtx
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/4] Makefile: add kernelarch rule that prints the kernel architecture and localversion
2019-02-07 16:40 ` Enrico Weigelt, metux IT consult
@ 2019-02-07 16:40 ` Enrico Weigelt, metux IT consult
-1 siblings, 0 replies; 10+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-02-07 16:40 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-kbuild, kernel-janitors, yamada.masahiro, michal.lkml
trivial rule to print out the kernel arch and localversion, so external tools,
like distro packagers, can easily get it.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
Makefile | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Makefile b/Makefile
index 3142e67..2719907 100644
--- a/Makefile
+++ b/Makefile
@@ -1664,6 +1664,12 @@ kernelrelease:
kernelversion:
@echo $(KERNELVERSION)
+kernellocalversion:
+ @$(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree) | sed -e 's~^\-~~'
+
+kernelarch:
+ @echo $(ARCH)
+
image_name:
@echo $(KBUILD_IMAGE)
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 1/4] Makefile: add kernelarch rule that prints the kernel architecture and localversion
@ 2019-02-07 16:40 ` Enrico Weigelt, metux IT consult
0 siblings, 0 replies; 10+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-02-07 16:40 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-kbuild, kernel-janitors, yamada.masahiro, michal.lkml
trivial rule to print out the kernel arch and localversion, so external tools,
like distro packagers, can easily get it.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
Makefile | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Makefile b/Makefile
index 3142e67..2719907 100644
--- a/Makefile
+++ b/Makefile
@@ -1664,6 +1664,12 @@ kernelrelease:
kernelversion:
@echo $(KERNELVERSION)
+kernellocalversion:
+ @$(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree) | sed -e 's~^\-~~'
+
+kernelarch:
+ @echo $(ARCH)
+
image_name:
@echo $(KBUILD_IMAGE)
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/4] scripts: mkdebian: allow renaming generated debian/rules
2019-02-07 16:40 ` Enrico Weigelt, metux IT consult
@ 2019-02-07 16:40 ` Enrico Weigelt, metux IT consult
-1 siblings, 0 replies; 10+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-02-07 16:40 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-kbuild, kernel-janitors, yamada.masahiro, michal.lkml
Add new environment variable KDEB_RULES for controlling where the
generated debian rules are written to. By defaults, it's debian/rules,
but packagers might override it for providing their own rules file.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
scripts/package/mkdebian | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index edcad61..ff226be 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -99,6 +99,9 @@ kernel_headers_packagename=linux-headers-$version
dbg_packagename=$packagename-dbg
debarch=
set_debarch
+if [ -z "$KDEB_RULES" ]; then
+ KDEB_RULES=debian/rules
+fi
if [ "$ARCH" = "um" ] ; then
packagename=user-mode-linux-$version
@@ -202,7 +205,7 @@ Description: Linux kernel debugging symbols for $version
all the necessary debug symbols for the kernel and its modules.
EOF
-cat <<EOF > debian/rules
+cat <<EOF > $KDEB_RULES
#!$(command -v $MAKE) -f
build:
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/4] scripts: mkdebian: allow renaming generated debian/rules
@ 2019-02-07 16:40 ` Enrico Weigelt, metux IT consult
0 siblings, 0 replies; 10+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-02-07 16:40 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-kbuild, kernel-janitors, yamada.masahiro, michal.lkml
Add new environment variable KDEB_RULES for controlling where the
generated debian rules are written to. By defaults, it's debian/rules,
but packagers might override it for providing their own rules file.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
scripts/package/mkdebian | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index edcad61..ff226be 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -99,6 +99,9 @@ kernel_headers_packagename=linux-headers-$version
dbg_packagename=$packagename-dbg
debarch set_debarch
+if [ -z "$KDEB_RULES" ]; then
+ KDEB_RULESÞbian/rules
+fi
if [ "$ARCH" = "um" ] ; then
packagename=user-mode-linux-$version
@@ -202,7 +205,7 @@ Description: Linux kernel debugging symbols for $version
all the necessary debug symbols for the kernel and its modules.
EOF
-cat <<EOF > debian/rules
+cat <<EOF > $KDEB_RULES
#!$(command -v $MAKE) -f
build:
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/4] scripts: mkdebian: fix dependencies
2019-02-07 16:40 ` Enrico Weigelt, metux IT consult
@ 2019-02-07 16:40 ` Enrico Weigelt, metux IT consult
-1 siblings, 0 replies; 10+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-02-07 16:40 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-kbuild, kernel-janitors, yamada.masahiro, michal.lkml
We missed some build dependencies in the generated debian/control file.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
scripts/package/mkdebian | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index ff226be..1caaf0b 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -173,7 +173,7 @@ Source: $sourcename
Section: kernel
Priority: optional
Maintainer: $maintainer
-Build-Depends: bc, kmod, cpio
+Build-Depends: bc, kmod, cpio, bison, libelf-dev, libssl-dev, flex
Homepage: http://www.kernel.org/
Package: $packagename
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/4] scripts: mkdebian: fix dependencies
@ 2019-02-07 16:40 ` Enrico Weigelt, metux IT consult
0 siblings, 0 replies; 10+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-02-07 16:40 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-kbuild, kernel-janitors, yamada.masahiro, michal.lkml
We missed some build dependencies in the generated debian/control file.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
scripts/package/mkdebian | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index ff226be..1caaf0b 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -173,7 +173,7 @@ Source: $sourcename
Section: kernel
Priority: optional
Maintainer: $maintainer
-Build-Depends: bc, kmod, cpio
+Build-Depends: bc, kmod, cpio, bison, libelf-dev, libssl-dev, flex
Homepage: http://www.kernel.org/
Package: $packagename
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/4] debian: add generic rule file
2019-02-07 16:40 ` Enrico Weigelt, metux IT consult
@ 2019-02-07 16:40 ` Enrico Weigelt, metux IT consult
-1 siblings, 0 replies; 10+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-02-07 16:40 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-kbuild, kernel-janitors, yamada.masahiro, michal.lkml
Adding a generic debian rule file, so we can build the directly
via usual Debian package build tools (eg. git-buildpackage,
dck-buildpackage, etc). It expects the .config file already
placed in the source tree.
The rule file contains a rule for creating debian/control and
other metadata - this is done similar to the 'deb-pkg' make rule,
scripts/packaging/mkdebian.
---
.gitignore | 1 +
debian/rules | 26 ++++++++++++++++++++++++++
2 files changed, 27 insertions(+)
create mode 100755 debian/rules
diff --git a/.gitignore b/.gitignore
index a20ac26..2d8081f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -68,6 +68,7 @@ modules.builtin
# Debian directory (make deb-pkg)
#
/debian/
+!/debian/rules
#
# Snap directory (make snap-pkg)
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..eeb58f7
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,26 @@
+#!/usr/bin/make -f
+
+export MAKE
+export KERNELARCH = $(shell $(MAKE) kernelarch)
+export KERNELRELEASE = $(shell $(MAKE) kernelrelease)
+export KBUILD_DEBARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH)
+export KBUILD_BUILD_VERSION = $(shell $(MAKE) kernellocalversion)
+export KDEB_RULES = debian/rules.auto
+export KDEB_SOURCENAME = linux-source
+export ARCH = $(KERNELARCH)
+
+debian/control debian/changelong debian/arch debian/copyright:
+debian/control:
+ ./scripts/package/mkdebian
+
+build: debian/control
+ $(MAKE) KERNELRELEASE=$(KERNELRELEASE) ARCH=$(KERNELARCH) KBUILD_BUILD_VERSION=$(KBUILD_BUILD_VERSION) KBUILD_SRC=
+
+binary-arch: debian/control
+ $(MAKE) KERNELRELEASE=$(KERNELRELEASE) ARCH=$(KERNELARCH) KBUILD_BUILD_VERSION=$(KBUILD_BUILD_VERSION) KBUILD_SRC= intdeb-pkg
+
+clean:
+ rm -rf debian/*tmp debian/files debian/changelog debian/control debian/copyright debian/rules.auto debian/arch
+ $(MAKE) clean
+
+binary: binary-arch
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/4] debian: add generic rule file
@ 2019-02-07 16:40 ` Enrico Weigelt, metux IT consult
0 siblings, 0 replies; 10+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-02-07 16:40 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-kbuild, kernel-janitors, yamada.masahiro, michal.lkml
Adding a generic debian rule file, so we can build the directly
via usual Debian package build tools (eg. git-buildpackage,
dck-buildpackage, etc). It expects the .config file already
placed in the source tree.
The rule file contains a rule for creating debian/control and
other metadata - this is done similar to the 'deb-pkg' make rule,
scripts/packaging/mkdebian.
---
.gitignore | 1 +
debian/rules | 26 ++++++++++++++++++++++++++
2 files changed, 27 insertions(+)
create mode 100755 debian/rules
diff --git a/.gitignore b/.gitignore
index a20ac26..2d8081f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -68,6 +68,7 @@ modules.builtin
# Debian directory (make deb-pkg)
#
/debian/
+!/debian/rules
#
# Snap directory (make snap-pkg)
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..eeb58f7
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,26 @@
+#!/usr/bin/make -f
+
+export MAKE
+export KERNELARCH = $(shell $(MAKE) kernelarch)
+export KERNELRELEASE = $(shell $(MAKE) kernelrelease)
+export KBUILD_DEBARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH)
+export KBUILD_BUILD_VERSION = $(shell $(MAKE) kernellocalversion)
+export KDEB_RULES = debian/rules.auto
+export KDEB_SOURCENAME = linux-source
+export ARCH = $(KERNELARCH)
+
+debian/control debian/changelong debian/arch debian/copyright:
+debian/control:
+ ./scripts/package/mkdebian
+
+build: debian/control
+ $(MAKE) KERNELRELEASE=$(KERNELRELEASE) ARCH=$(KERNELARCH) KBUILD_BUILD_VERSION=$(KBUILD_BUILD_VERSION) KBUILD_SRC+
+binary-arch: debian/control
+ $(MAKE) KERNELRELEASE=$(KERNELRELEASE) ARCH=$(KERNELARCH) KBUILD_BUILD_VERSION=$(KBUILD_BUILD_VERSION) KBUILD_SRC= intdeb-pkg
+
+clean:
+ rm -rf debian/*tmp debian/files debian/changelog debian/control debian/copyright debian/rules.auto debian/arch
+ $(MAKE) clean
+
+binary: binary-arch
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2019-02-07 16:41 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-07 16:40 RFC: refactoring the deb build Enrico Weigelt, metux IT consult
2019-02-07 16:40 ` Enrico Weigelt, metux IT consult
2019-02-07 16:40 ` [PATCH 1/4] Makefile: add kernelarch rule that prints the kernel architecture and localversion Enrico Weigelt, metux IT consult
2019-02-07 16:40 ` Enrico Weigelt, metux IT consult
2019-02-07 16:40 ` [PATCH 2/4] scripts: mkdebian: allow renaming generated debian/rules Enrico Weigelt, metux IT consult
2019-02-07 16:40 ` Enrico Weigelt, metux IT consult
2019-02-07 16:40 ` [PATCH 3/4] scripts: mkdebian: fix dependencies Enrico Weigelt, metux IT consult
2019-02-07 16:40 ` Enrico Weigelt, metux IT consult
2019-02-07 16:40 ` [PATCH 4/4] debian: add generic rule file Enrico Weigelt, metux IT consult
2019-02-07 16:40 ` Enrico Weigelt, metux IT consult
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.