History log of /linux-master/scripts/package/mkdebian
Revision Date Author Comments
# 5e73758b 26-Dec-2023 Masahiro Yamada <masahiroy@kernel.org>

kbuild: deb-pkg: use more debhelper commands in builddeb

Commit 36862e14e316 ("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 <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <n.schier@avm.de>


# b88365b6 19-Dec-2023 Masahiro Yamada <masahiroy@kernel.org>

kbuild: deb-pkg: hard-code Build-Depends

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 <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <n.schier@avm.de>


# 9c65810c 19-Dec-2023 Masahiro Yamada <masahiroy@kernel.org>

kbuild: deb-pkg: split debian/copyright from the mkdebian script

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 <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <n.schier@avm.de>


# 0df8e970 24-Nov-2023 Masahiro Yamada <masahiroy@kernel.org>

scripts: clean up IA-64 code

A little more janitorial work after commit cf8e8658100d ("arch: Remove
Itanium (IA-64) architecture").

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>


# d9287ea8 01-Aug-2023 Masahiro Yamada <masahiroy@kernel.org>

kbuild: deb-pkg: split debian/rules

debian/rules is generated by shell, but the escape sequence (\$) is
unreadable.

debian/rules embeds only two variables (ARCH and KERNELRELEASE).

Split them out to debian/rules.vars, and check-in the rest of Makefile
code to scripts/package/debian/rules.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>


# 4b970e43 01-Aug-2023 Masahiro Yamada <masahiroy@kernel.org>

kbuild: deb-pkg: use Debian compliant shebang for debian/rules

Debian Policy "4.9. Main building script: debian/rules" requires
"debian/rules must start with the line #!/usr/bin/make -f". [1]

Currently, Kbuild does not follow this policy.

When Kbuild generates debian/rules, "#!$(command -v $MAKE) -f" is
expanded by shell. The resuling string may not be "#!/usr/bin/make -f".

There was a reason to opt out the Debian policy.

If you run '/path/to/my/custom/make deb-pkg', debian/rules must also be
invoked by the same Make program. If #!/usr/bin/make were hard-coded in
debian/rules, the sub-make would be executed by a possibly different
Make version.

This is problematic due to the MAKEFLAGS incompatibility, especially the
job server flag. Old Make versions used --jobserver-fds to propagate job
server file descriptors, but Make >= 4.2 uses --jobserver-auth. The flag
disagreement between the parent/child Makes would result in a process
fork explosion.

However, having a non-standard path in the shebang causes another issue;
the generated source package is not portable as such a path does not
exist in other build environments.

This commit solves those conflicting demands.

Hard-code '#!/usr/bin/make -f' in debian/rules to create a portable and
Debian-compliant source package.

Pass '--rules-file=$(MAKE) -f debian/rules' when dpkg-buildpackage is
invoked from Makefile so that debian/rules is executed by the same Make
program as used to start Kbuild.

[1] https://www.debian.org/doc/debian-policy/ch-source.html#main-building-script-debian-rules

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>


# 76a48b8f 21-Jul-2023 Masahiro Yamada <masahiroy@kernel.org>

kbuild: add a phony target to run a command with Kbuild env vars

There are some cases where we want to run a command with the same
environment variables as Kbuild uses. For example, 'make coccicheck'
invokes scripts/coccicheck from the top Makefile so that the script can
reference to ${LINUXINCLUDE}, ${KBUILD_EXTMOD}, etc. The top Makefile
defines several phony targets that run a script.

We do it also for an internally used script, which results in a somewhat
complex call graph.

One example:

debian/rules binary-arch
-> make intdeb-pkg
-> scripts/package/builddeb

It is also tedious to add a dedicated target like 'intdeb-pkg' for each
use case.

Add a generic target 'run-command' to run an arbitrary command in an
environment with all Kbuild variables set.

The usage is:

$ make run-command KBUILD_RUN_COMMAND=<command>

The concept is similar to:

$ dpkg-architecture -c <command>

This executes <command> in an environment which has all DEB_* variables
defined.

Convert the existing 'make intdeb-pkg'.

Another possible usage is to interrogate a Make variable.

$ make run-command KBUILD_RUN_COMMAND='echo $(KBUILD_CFLAGS)'

might be useful to see KBUILD_CFLAGS set by the top Makefile.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 9892bd72 25-Apr-2023 Masahiro Yamada <masahiroy@kernel.org>

kbuild: deb-pkg: specify targets in debian/rules as .PHONY

If a file with the same name exists, the target is not run.

For example, the following command fails.

$ make O=build-arch bindeb-pkg
[ snip ]
sed: can't read modules.order: No such file or directory
make[6]: *** [../Makefile:1577: __modinst_pre] Error 2
make[5]: *** [../scripts/Makefile.package:150: intdeb-pkg] Error 2
make[4]: *** [../Makefile:1657: intdeb-pkg] Error 2
make[3]: *** [debian/rules:14: binary-arch] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
make[2]: *** [../scripts/Makefile.package:139: bindeb-pkg] Error 2

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>


# 8b824220 31-Mar-2023 Woody Suwalski <terraluna977@gmail.com>

kbuild: deb-pkg: Fix a spell typo in mkdebian script

Signed-off-by: Woody Suwalski <terraluna977@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# aa7d233f 10-Apr-2023 Masahiro Yamada <masahiroy@kernel.org>

kbuild: give up untracked files for source package builds

When the source tree is dirty and contains untracked files, package
builds may fail, for example, when a broken symlink exists, a file
path contains whitespaces, etc.

Since commit 05e96e96a315 ("kbuild: use git-archive for source package
creation"), the source tarball only contains committed files because
it is created by 'git archive'. scripts/package/gen-diff-patch tries
to address the diff from HEAD, but including untracked files by the
hand-crafted script introduces more complexity. I wrote a patch [1] to
make it work in most cases, but still wonder if this is what we should
aim for.

To simplify the code, this patch just gives up untracked files. Going
forward, it is your responsibility to do 'git add' for what you want in
the source package. The script shows a warning just in case you forgot
to do so. It should be checked only when building source packages.

[1]: https://lore.kernel.org/all/CAK7LNAShbZ56gSh9PrbLnBDYKnjtTkHMoCXeGrhcxMvqXGq9=g@mail.gmail.com/2-0001-kbuild-make-package-builds-more-robust.patch

Fixes: 05e96e96a315 ("kbuild: use git-archive for source package creation")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>


# 05e96e96 15-Mar-2023 Masahiro Yamada <masahiroy@kernel.org>

kbuild: use git-archive for source package creation

Commit 5c3d1d0abb12 ("kbuild: add a tool to list files ignored by git")
added a new tool, scripts/list-gitignored. My intention was to create
source packages without cleaning the source tree, without relying on git.

Linus strongly objected to it, and suggested using 'git archive' instead.
[1] [2] [3]

This commit goes in that direction - Remove scripts/list-gitignored.c
and rewrites Makefiles and scripts to use 'git archive' for building
Debian and RPM source packages. It also makes 'make perf-tar*-src-pkg'
use 'git archive' again.

Going forward, building source packages is only possible in a git-managed
tree. Building binary packages does not require git.

[1]: https://lore.kernel.org/lkml/CAHk-=wi49sMaC7vY1yMagk7eqLK=1jHeHQ=yZ_k45P=xBccnmA@mail.gmail.com/
[2]: https://lore.kernel.org/lkml/CAHk-=wh5AixGsLeT0qH2oZHKq0FLUTbyTw4qY921L=PwYgoGVw@mail.gmail.com/
[3]: https://lore.kernel.org/lkml/CAHk-=wgM-W6Fu==EoAVCabxyX8eYBz9kNC88-tm9ExRQwA79UQ@mail.gmail.com/

Fixes: 5c3d1d0abb12 ("kbuild: add a tool to list files ignored by git")
Fixes: e0ca16749ac3 ("kbuild: make perf-tar*-src-pkg work without relying on git")
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 36862e14 12-Mar-2023 Masahiro Yamada <masahiroy@kernel.org>

kbuild: deb-pkg: use dh_listpackages to know enabled packages

Use dh_listpackages to get a list of all binary packages.

With this, debian/control lists which binary packages will be produced.
Previously, ARCH=um listed linux-libc-dev in debian/control, but it
was not generated because each of mkdebian and builddeb independently
maintained the if-conditionals.

Another motivation is to allow scripts/package/builddeb to get the
package name (linux-image-*, etc.) dynamically from debian/control.

This will also allow the BuildProfile to control the generation of
the binary packages.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 7a531c21 12-Mar-2023 Masahiro Yamada <masahiroy@kernel.org>

kbuild: deb-pkg: do not take KERNELRELEASE from the source version

KERNELRELEASE does not need to match the package version in changelog.
Rather, it conventially matches what is called 'ABINAME', which is a
part of the binary package names.

Both are the same by default, but the former might be overridden by
KDEB_PKGVERSION. In this case, the resulting package would not boot
because /lib/modules/$(uname -r) does not point the module directory.

Partially revert 3ab18a625ce4 ("kbuild: deb-pkg: improve the usability
of source package").

Reported-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Fixes: 3ab18a625ce4 ("kbuild: deb-pkg: improve the usability of source package")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>


# 2fd6c455 12-Mar-2023 Masahiro Yamada <masahiroy@kernel.org>

kbuild: deb-pkg: make debian source package working again

Since commit c5bf2efb058d ("kbuild: deb-pkg: fix binary-arch and clean
in debian/rules"), the source package generated by 'make deb-pkg' fails
to build.

I terribly missed the fact that the intdeb-pkg target may regenerate
include/config/kernel.release due to the following in the top Makefile:

%pkg: include/config/kernel.release FORCE

Restore KERNELRELEASE= option to avoid the kernel.release disagreement
between build-arch and binary-arch.

Fixes: c5bf2efb058d ("kbuild: deb-pkg: fix binary-arch and clean in debian/rules")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 3ab18a62 14-Feb-2023 Masahiro Yamada <masahiroy@kernel.org>

kbuild: deb-pkg: improve the usability of source package

Improve the source package support in case the dpkg-buildpackage is
directly used to build binary packages.

For cross-compiling, you can set CROSS_COMPILE via the environment
variable, but it is better to set it automatically - set it to
${DEB_HOST_GNU_TYPE}- if we are cross-compiling but not from the top
Makefile.

The generated source package may be carried to a different build
environment, which may have a different compiler installed.
Run olddefconfig first to set new CONFIG options to their default
values without prompting.

Take KERNELRELEASE and KBUILD_BUILD_VERSION from the version field of
debian/changelog in case it is updated afterwards.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# c5bf2efb 14-Feb-2023 Masahiro Yamada <masahiroy@kernel.org>

kbuild: deb-pkg: fix binary-arch and clean in debian/rules

The clean target needs ARCH=${ARCH} to clean up the tree for the correct
architecture. 'make (bin)deb-pkg' skips cleaning, but the preclean hook
may be executed if dpkg-buildpackage is directly used.

The binary-arch target does not need KERNELRELEASE because it is not
updated during the installation. KBUILD_BUILD_VERSION is not needed
either because binary-arch does not build vmlinux.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# e7853995 14-Feb-2023 Masahiro Yamada <masahiroy@kernel.org>

kbuild: deb-pkg: switch over to source format 3.0 (quilt)

Change the source format from "1.0" to "3.0 (quilt)" because it works
more cleanly.

All files except .config and debian/ go into the orig tarball.
Add a single patch, debian/patches/config, and delete the ugly
extend-diff-ignore patterns.

The debian tarball will be compressed into *.debian.tar.xz by default.
If you like to use a different compression mode, you can pass the
command line option, DPKG_FLAGS=-Zgzip, for example.

The orig tarball only supports gzip for now. The combination of
gzip and xz is somewhat clumsy, but it is not a practical problem.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>


# 6eabebb1 14-Feb-2023 Masahiro Yamada <masahiroy@kernel.org>

kbuild: deb-pkg: hide KDEB_SOURCENAME from Makefile

scripts/Makefile.package does not need to know the value of
KDEB_SOURCENAME because the source name can be taken from
debian/changelog by using dpkg-parsechangelog.

Move the default of KDEB_SOURCENAME (i.e. linux-upstream) to
scripts/package/mkdebian.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>


# 7bf4582d 14-Feb-2023 Masahiro Yamada <masahiroy@kernel.org>

kbuild: deb-pkg: create source package without cleaning

If you run 'make deb-pkg', all objects are lost due to 'make clean',
which makes the incremental builds impossible.

Instead of cleaning, pass the exclude list to tar's --exclude-from
option.

Previously, *.diff.gz contained some check-in files such as
.clang-format, .cocciconfig.

With this commit, *.diff.gz will only contain the .config and debian/.
The other source files will go into the .orig tarball.

linux.tar.gz is rebuilt only when the source files that would go into
the tarball are changed.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>


# c9f9cf25 25-May-2021 Bastian Germann <bage@linutronix.de>

builddeb: clean generated package content

For each binary Debian package, a directory with the package name is
created in the debian directory. Correct the generated file matches in the
package's clean target, which were renamed without adjusting the target.

Fixes: 1694e94e4f46 ("builddeb: match temporary directory name to the package name")
Signed-off-by: Bastian Germann <bage@linutronix.de>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 5724ac55 16-Nov-2022 Masahiro Yamada <masahiroy@kernel.org>

kbuild: deb-pkg: get rid of |flex:native workaround from Build-Depends

"| flex:native" was a workaround (suggested by Ben, see Link) because
"MultiArch: foreign" was missing in the flex package on some old distros
when commit e3a22850664f ("deb-pkg: generate correct build dependencies")
was applied.

It seems fixing the flex package has been completed. Get rid of the
workaround.

Link: https://lore.kernel.org/linux-kbuild/ab49b0582ef12b14b1a68877263b81813e2492a2.camel@decadent.org.uk/
Link: https://wiki.debian.org/CrossBuildPackagingGuidelines
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Ben Hutchings <ben@decadent.org.uk>


# 5db8face 15-Nov-2022 Marc Zyngier <maz@kernel.org>

kbuild: Restore .version auto-increment behaviour for Debian packages

Since 2df8220cc511 ("kbuild: build init/built-in.a just once"),
generating Debian packages using 'make bindeb-pkg' results in
packages that are stuck to the same .version, leading to unexpected
behaviours (multiple packages with the same version).

That's because the mkdebian script samples the build version
before building the kernel, and forces the use of that version
number for the actual build.

Restore the previous behaviour by calling init/build-version
instead of reading the .version file. This is likely to result
in too many .version bumps, but this is what was happening before
(although the bump was affecting builds made after the current one).

Fixes: 2df8220cc511 ("kbuild: build init/built-in.a just once")
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 0fa21cf4 13-Oct-2020 Masahiro Yamada <masahiroy@kernel.org>

kbuild: deb-pkg: clean up package name variables

Hard-code the names of linux-headers and debug packages in the
control file.

The kernel package is different for ARCH=um. Change the code
for better readability.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# bac977cb 13-Oct-2020 Masahiro Yamada <masahiroy@kernel.org>

kbuild: deb-pkg: do not build linux-headers package if CONFIG_MODULES=n

Since commit 269a535ca931 ("modpost: generate vmlinux.symvers and
reuse it for the second modpost"), with CONFIG_MODULES disabled,
"make deb-pkg" (or "make bindeb-pkg") fails with:

find: ‘Module.symvers’: No such file or directory

If CONFIG_MODULES is disabled, it doesn't really make sense to build
the linux-headers package.

Fixes: 269a535ca931 ("modpost: generate vmlinux.symvers and reuse it for the second modpost")
Reported-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 76c37668 20-Sep-2020 Guillem Jover <guillem@hadrons.org>

builddeb: Add support for all required debian/rules targets

These have been required by the Debian policy for a while, even though
the tooling can detect and workaround their omission, but are a hard
requirement when using rootless builds.

[masahiro:
The following Debian policy is particularly important for rootless builds:
"Both binary-* targets should depend on the build target, or on the
appropriate build-arch or build-indep target, so that the package is
built if it has not been already."
]

Signed-off-by: Guillem Jover <guillem@hadrons.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 3e854180 20-Sep-2020 Guillem Jover <guillem@hadrons.org>

builddeb: Enable rootless builds

This makes it possible to build the Debian packages without requiring
(pseudo-)root privileges, when the build drivers support this mode
of operation.

See-Also: /usr/share/doc/dpkg/rootless-builds.txt.gz
Signed-off-by: Guillem Jover <guillem@hadrons.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 16a122c7 19-Jul-2020 Alexander A. Klimov <grandmaster@al2klimov.de>

kbuild: Replace HTTP links with HTTPS ones

Rationale:
Reduces attack surface on kernel devs opening the links for MITM
as HTTPS traffic is much harder to manipulate.

Deterministic algorithm:
For each file:
If not .svg:
For each line:
If doesn't contain `\bxmlns\b`:
For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`:
If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`:
If both the HTTP and HTTPS versions
return 200 OK and serve the same content:
Replace HTTP with HTTPS.

Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# d9dac147 24-Mar-2020 Reinhard Karcher <reinhard.karcher@gmx.net>

kbuild: deb-pkg: fix warning when CONFIG_DEBUG_INFO is unset

Creating a Debian package without CONFIG_DEBUG_INFO produces
a warning that no debug package was created.

This patch excludes the debug package from the control file,
if no debug package is created by this configuration.

Signed-off-by: Reinhard Karcher <reinhard.karcher@gmx.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 8ffdc54b 30-Dec-2019 Ard Biesheuvel <ardb@kernel.org>

kbuild/deb-pkg: annotate libelf-dev dependency as :native

Cross compiling the x86 kernel on a non-x86 build machine produces
the following error when CONFIG_UNWINDER_ORC is enabled, regardless
of whether libelf-dev is installed or not.

dpkg-checkbuilddeps: error: Unmet build dependencies: libelf-dev
dpkg-buildpackage: warning: build dependencies/conflicts unsatisfied; aborting
dpkg-buildpackage: warning: (Use -d flag to override.)

Since this is a build time dependency for a build tool, we need to
depend on the native version of libelf-dev so add the appropriate
annotation.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# a11391b6 16-Dec-2019 Enrico Weigelt, metux IT consult <info@metux.net>

scripts: package: mkdebian: add missing rsync dependency

We've missed the dependency to rsync, so build fails on
minimal containers.

Fixes: 59b2bd05f5f4 ("kbuild: add 'headers' target to build up uapi headers in usr/include")
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>


# 5a464217 09-Jul-2019 Cedric Hombourger <Cedric_Hombourger@mentor.com>

builddeb: generate multi-arch friendly linux-libc-dev package

Debian-based distributions place libc header files in a machine
specific directory (/usr/include/<libc-machine>) instead of
/usr/include/asm to support installation of the linux-libc-dev
package from multiple architectures. Move headers installed by
"make headers_install" accordingly using Debian's tuple from
dpkg-architecture (stored in debian/arch).

Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# f6d9db63 09-Mar-2019 Arseny Maslennikov <ar@cs.msu.ru>

kbuild: deb-pkg: avoid implicit effects

* The man page for dpkg-source(1) notes:

> -b, --build directory [format-specific-parameters]
> Build a source package (--build since dpkg 1.17.14).
> <...>
>
> dpkg-source will build the source package with the first
> format found in this ordered list: the format indicated
> with the --format command line option, the format
> indicated in debian/source/format, “1.0”. The fallback
> to “1.0” is deprecated and will be removed at some point
> in the future, you should always document the desired
> source format in debian/source/format. See section
> SOURCE PACKAGE FORMATS for an extensive description of
> the various source package formats.

Thus it would be more foolproof to explicitly use 1.0 (as we always
did) than to rely on dpkg-source's defaults.

* In a similar vein, debian/rules is not made executable by mkdebian,
and dpkg-source warns about that but still silently fixes the file.
Let's be explicit once again.

Signed-off-by: Arseny Maslennikov <ar@cs.msu.ru>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 6fb7ef5a 08-Mar-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

kbuild: pkg: grep include/config/auto.conf instead of $KCONFIG_CONFIG

This will be a little more efficient since unset CONFIG options are
stripped away from auto.conf, and we can hard-code the path to auto.conf
since it is never overridden.

include/config/kernel.release is generated before %pkg is run.
So, it is guaranteed auto.conf is up-to-date.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 7e548e9a 08-Mar-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

kbuild: deb-pkg: add CONFIG_ prefix to kernel config options

This might be a kind of bike-shed, but I personally prefer grep'able
code.

I often do 'git grep CONFIG_FOO' instead of 'git grep FOO' when I
want to know where that CONFIG option is used.

This makes code longer, but I hope this is acceptable level.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# e3a22850 02-Jan-2019 Riku Voipio <riku.voipio@linaro.org>

deb-pkg: generate correct build dependencies

bison/flex is now needed always for building for kconfig. Some build
dependencies depend on kernel configuration, enable them as needed:

- libelf-dev when UNWINDER_ORC is set
- libssl-dev for SYSTEM_TRUSTED_KEYRING

Since the libssl-dev is needed for extract_cert binary, denote with
:native to install the libssl-dev for the build machines architecture,
rather than for the architecture of the kernel being built.

Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Reviewed-by: Ben Hutchings <ben@decadent.org.uk>
Acked-by: maximilian attems <maks@stro.at>
[masahiro.yamada: change 'flex' to 'flex | flex:native' ]
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 175209cc 13-Feb-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

kbuild: pkg: use -f $(srctree)/Makefile to recurse to top Makefile

'$(MAKE) KBUILD_SRC=' changes the working directory back and forth
between objtree and srctree.

It is better to recurse to the top-level Makefile directly.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# bbcde0a7 05-Nov-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

kbuild: deb-pkg: fix too low build version number

Since commit b41d920acff8 ("kbuild: deb-pkg: split generating packaging
and build"), the build version of the kernel contained in a deb package
is too low by 1.

Prior to the bad commit, the kernel was built first, then the number
in .version file was read out, and written into the debian control file.

Now, the debian control file is created before the kernel is actually
compiled, which is causing the version number mismatch.

Let the mkdebian script pass KBUILD_BUILD_VERSION=${revision} to require
the build system to use the specified version number.

Fixes: b41d920acff8 ("kbuild: deb-pkg: split generating packaging and build")
Reported-by: Doug Smythies <dsmythies@telus.net>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Doug Smythies <dsmythies@telus.net>


# 79a85b55 26-Jul-2018 Ben Hutchings <ben@decadent.org.uk>

builddeb: Add automatic support for sh{3,4}{,eb} architectures

Different generations of the SH architecture are not very compatible,
so there are/were separate Debian ports for SH3 and SH4.

Move the fallback out of the "case" statement, so that it will also be
used in case we find some SH architecture version without a known
mapping.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 75ebcee7 26-Jul-2018 Ben Hutchings <ben@decadent.org.uk>

builddeb: Add automatic support for riscv* architectures

Debian currently only defines "riscv64", but it seems safe to assume
that any 32-bit port will now be called "riscv32", also matching
$UTS_MACHINE.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 60ca40a0 26-Jul-2018 Ben Hutchings <ben@decadent.org.uk>

builddeb: Add automatic support for m68k architecture

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 822f44fb 26-Jul-2018 Ben Hutchings <ben@decadent.org.uk>

builddeb: Add automatic support for or1k architecture

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# a27ae285 26-Jul-2018 Ben Hutchings <ben@decadent.org.uk>

builddeb: Add automatic support for sparc64 architecture

We currently label 64-bit kernel packages as sparc (32-bit), mostly
because it was officially supported while sparc64 was not. Now
neither is officially supported, so label these packages as sparc64.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 679caaf3 26-Jul-2018 Ben Hutchings <ben@decadent.org.uk>

builddeb: Add automatic support for mips{,64}r6{,el} architectures

MIPS R6 is not fully backward-compatible, so Debian has separate
architecture names for userland built for R6. Label kernel
packages accordingly.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 159b3794 26-Jul-2018 Ben Hutchings <ben@decadent.org.uk>

builddeb: Add automatic support for mips64el architecture

We currently label 64-bit little-endian kernel packages as
mipsel (32-bit little-endian), mostly it was officially supported
while mips64el (64-bit little-endian) was not. Now both are
officially supported, so label these packages as mips64el.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 50d511ba 26-Jul-2018 Ben Hutchings <ben@decadent.org.uk>

builddeb: Add automatic support for ppc64 and powerpcspe architectures

We currently label 64-bit big-endian kernel packages as
powerpc (32-bit), mostly because it was officially supported while
ppc64 (64-bit big-endian) was not. Now neither is officially
supported, so label these packages as ppc64.

Debian also has a powerpcspe (32-bit with SPE) architecture.
Label packages with a suitable configuration as powerpcspe.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 08d3892c 26-Jul-2018 Ben Hutchings <ben@decadent.org.uk>

builddeb: Introduce functions to simplify kconfig tests in set_debarch

We now have many repetitive greps over the kernel config. Refactor
them into functions.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 4260ecd0 26-Jul-2018 Ben Hutchings <ben@decadent.org.uk>

builddeb: Drop check for 32-bit s390

s390 now only supports 64-bit configurations.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 091d30ae 26-Jul-2018 Ben Hutchings <ben@decadent.org.uk>

builddeb: Change architecture detection fallback to use dpkg-architecture

We currently use dpkg --print-architecture, which reports the
architecture of the build machine. We can make a better guess
than this by asking dpkg-architecture what the host architecture,
i.e. the default architecture for building packages, is. This is
sensitive to environment variables such as CC and DEB_HOST_ARCH,
which should already be set in a cross-build environment.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# f2abcc13 26-Jul-2018 Ben Hutchings <ben@decadent.org.uk>

builddeb: Skip architecture detection when KBUILD_DEBARCH is set

If KBUILD_DEBARCH is set then we will not use the result of
architecture detection, and we may also warn unnecessarily.
Move the check for KBUILD_DEBARCH further up to avoid this.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# d5940c60 07-May-2018 Riku Voipio <riku.voipio@linaro.org>

kbuild: deb-pkg improve maintainer address generation

There is multiple issues with the genaration of maintainer string

It uses DEBEMAIL and EMAIL enviroment variables, which may contain angle brackets,
creating invalid maintainer strings. The documented KBUILD_BUILD_USER and
KBUILD_BUILD_HOST variables are not used. Undocumented and uncommon NAME
variable is used. Refactor the Maintainer string to:

- use EMAIL or DEBEMAIL directly if they are in form "name <user@host>"
- use KBUILD_BUILD_USER and KBUILD_BUILD_HOST if set before falling
back to autodetection
- no longer use NAME variable or the useless Anonymous string

The logic is switched from multiline if/then/fi statements to compact
shell variable substition commands.

Reported-by: Mathieu Malaterre <malat@debian.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# b41d920a 05-Apr-2018 Riku Voipio <riku.voipio@linaro.org>

kbuild: deb-pkg: split generating packaging and build

Move debian/ directory generation out of builddeb to a new script,
mkdebian. The package build commands are kept in builddeb, which
is now an internal command called from debian/rules.

With these changes in place, we can now use dpkg-buildpackage from
deb-pkg and bindeb-pkg removing need for handrolled source/changes
generation.

This patch is based on the criticism of the current state of builddeb
discussed on:

https://patchwork.kernel.org/patch/9656403/

Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>