From 701ca30cc69bb03c0e24b67a99cdb8930dc0114f Mon Sep 17 00:00:00 2001 From: Sedat Dilek Date: Fri, 2 Jan 2015 15:57:52 +0100 Subject: [PATCH 1/4] builddeb: Update year and git repository URL in debian/copyright Happy new 2015! I have combined two patches which I had already sent to linux-kbuild ML. Today, I prefer "builddeb" as a label for such patches. [1] http://marc.info/?l=linux-kbuild&m=133521955904706 [2] http://marc.info/?l=linux-kbuild&m=133521955004705 CC: Ben Hutchings CC: maximilian attems Signed-off-by: Sedat Dilek Signed-off-by: Michal Marek --- scripts/package/builddeb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 59726243c2eb..2c68c8bf6c76 100755 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -233,10 +233,10 @@ This is a packacked upstream version of the Linux kernel. The sources may be found at most Linux ftp sites, including: ftp://ftp.kernel.org/pub/linux/kernel -Copyright: 1991 - 2009 Linus Torvalds and others. +Copyright: 1991 - 2015 Linus Torvalds and others. The git repository for mainline kernel development is at: -git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git +git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by From d9f711db8348233a2958cf91a19ca78677f677e0 Mon Sep 17 00:00:00 2001 From: Sedat Dilek Date: Sat, 3 Jan 2015 10:50:19 +0100 Subject: [PATCH 2/4] builddeb: Try to determine distribution lsb_release command is a good choice to determine the distribution name for the changelog file in the generated Debian packages [1]. Its installation is no precondition. In Debian it is still not essential or build-essential. Ben gave some helpful informations and detailed explanations in [2]. There he also suggested to have an option to explicitly set the distribution name (see $KDEB_CHANGELOG_DIST variable). Embedded the improvement as suggested by Thorsten (see [3]): "This is suboptimal: if KDEB_CHANGELOG_DIST is defined, lsb_release is not necessary. The following snippet also omits using its output if it fails but still produces any:" Dealing with this issue I learned about "The Colon in the Shell." and possible pitfalls in this area (see [4,5]). Furthermore, refreshed my knowledge about redirecting outputs with the echo command (see [5]). Special thanks to Thorsten, I enjoyed the IRC session with you. Cooked together the snippets of Ben and Thorsten (see [2,3]). Tested against Linux v3.19-rc2. Thanks goes to Alexander, Ben, maximilian and Thorsten for the very vital help. [1] https://lkml.org/lkml/2012/4/23/516 [2] http://marc.info/?l=linux-kbuild&m=142022188322321&w=2 [3] http://marc.info/?l=linux-kbuild&m=142023476825460&w=2 [4] http://blog.brlink.eu/index.html#i70 [5] https://www.mirbsd.org/permalinks/wlog-10_e20141209-tg.htm [6] http://stackoverflow.com/questions/23489934/echo-2-some-text-what-does-it-mean-in-shell-scripting CC: Alexander Wirt Suggested-by: Ben Hutchings Suggested-by: Thorsten Glaser Reviewed-by: Ben Hutchings Acked-by: maximilian attems [ dileks: Reviewed his suggested diff in RFC v4 ] Reviewed-by: Thorsten Glaser Signed-off-by: Sedat Dilek Signed-off-by: Michal Marek --- scripts/package/builddeb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 2c68c8bf6c76..88dbf23b6970 100755 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -217,9 +217,20 @@ else fi maintainer="$name <$email>" +# Try to determine distribution +if [ -n "$KDEB_CHANGELOG_DIST" ]; then + distribution=$KDEB_CHANGELOG_DIST +elif distribution=$(lsb_release -cs 2>/dev/null) && [ -n "$distribution" ]; then + : # nothing to do in this case +else + distribution="unstable" + echo >&2 "Using default distribution of 'unstable' in the changelog" + echo >&2 "Install lsb-release or set \$KDEB_CHANGELOG_DIST explicitly" +fi + # Generate a simple changelog template cat < debian/changelog -linux-upstream ($packageversion) unstable; urgency=low +linux-upstream ($packageversion) $distribution; urgency=low * Custom built Linux kernel. From 976591810f8aa2f57c647c6485112b7c62f832ae Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Thu, 8 Jan 2015 14:45:50 +0100 Subject: [PATCH 3/4] kbuild: Update documentation of clean-files and clean-dirs Commit a16c5f99 (kbuild: Fix removal of the debian/ directory) slightly changed the processing of the clean-files and clean-dirs variables. Also, use a current real-world example of clean-files usage. Signed-off-by: Michal Marek --- Documentation/kbuild/makefiles.txt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index a311db829e9b..873db4777771 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt @@ -751,12 +751,12 @@ generated by kbuild are deleted all over the kernel src tree when Additional files can be specified in kbuild makefiles by use of $(clean-files). Example: - #drivers/pci/Makefile - clean-files := devlist.h classlist.h + #lib/Makefile + clean-files := crc32table.h When executing "make clean", the two files "devlist.h classlist.h" will be deleted. Kbuild will assume files to be in the same relative directory as the -Makefile except if an absolute path is specified (path starting with '/'). +Makefile, except if prefixed with $(objtree). To delete a directory hierarchy use: @@ -764,9 +764,8 @@ To delete a directory hierarchy use: #scripts/package/Makefile clean-dirs := $(objtree)/debian/ -This will delete the directory debian, including all subdirectories. -Kbuild will assume the directories to be in the same relative path as the -Makefile if no absolute path is specified (path does not start with '/'). +This will delete the directory debian in the toplevel directory, including all +subdirectories. To exclude certain files from make clean, use the $(no-clean-files) variable. This is only a special case used in the top level Kbuild file: From 31a4af7f7d3cd3090c1c9201d62d4ede54dc5969 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Tue, 5 Aug 2014 14:43:07 +0900 Subject: [PATCH 4/4] kbuild: trivial - fix the help doc of CONFIG_CC_OPTIMIZE_FOR_SIZE Other than GCC, we have another choice, Clang for building the kernel these days. It seems better to say "compiler" rather than "gcc". Signed-off-by: Masahiro Yamada Signed-off-by: Michal Marek --- init/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init/Kconfig b/init/Kconfig index 9afb971497f4..513586facb2b 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1299,8 +1299,8 @@ config INIT_FALLBACK config CC_OPTIMIZE_FOR_SIZE bool "Optimize for size" help - Enabling this option will pass "-Os" instead of "-O2" to gcc - resulting in a smaller kernel. + Enabling this option will pass "-Os" instead of "-O2" to + your compiler resulting in a smaller kernel. If unsure, say N.