From: "Thomas Deutschmann" <whissi@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/genkernel:master commit in: /, doc/
Date: Mon, 29 Jul 2019 20:10:24 +0000 (UTC) [thread overview]
Message-ID: <1564430427.94d32a155ef3e5cd59f852a032e5887b74306d81.whissi@gentoo> (raw)
commit: 94d32a155ef3e5cd59f852a032e5887b74306d81
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 28 22:06:33 2019 +0000
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Mon Jul 29 20:00:27 2019 +0000
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=94d32a15
Add --kernel-append-localversion option
Now that we moved $ARCH value to kernel's LOCALVERSION setting,
you cannot easily change LOCALVERSION anymore without losing
$ARCH information.
This can be annoying when you just want to build a new revision
which should have its own kernel binary, initramfs and modules
directory because you would have to remember to include default
value.
The new option will allow you to just append to genkernel's
KERNEL_LOCALVERSION value. This way you can just call genkernel
with --kernel-append-localversion=-rN option to build and test
a new revision.
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
doc/genkernel.8.txt | 6 +++++
gen_cmdline.sh | 6 +++++
gen_determineargs.sh | 63 ++++++++++++++++++++++++++++++++++------------------
3 files changed, 53 insertions(+), 22 deletions(-)
diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index 35762a2..1b36729 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -124,6 +124,12 @@ KERNEL CONFIGURATION
*--*[*no-*]*virtio*::
Adds, or skip adding VirtIO support to kernel configuration.
+*--kernel-append-localversion*=<...>::
+ Appends value to genkernel's *KERNEL_LOCALVERSION* option (see below).
+ The idea is to use this option to allow to easily build a new revision
+ with own kernel binary, initramfs and modules directory without losing
+ default *KERNEL_LOCALVERSION* value.
+
*--kernel-localversion*=<...>::
Set kernel option *LOCALVERSION*. Use special value *UNSET* to
unset any already set *LOCALVERSION*. The following placeholders are
diff --git a/gen_cmdline.sh b/gen_cmdline.sh
index 6fbf309..dcf479b 100755
--- a/gen_cmdline.sh
+++ b/gen_cmdline.sh
@@ -71,6 +71,8 @@ longusage() {
echo " --no-static Do not build a static (monolithic kernel)"
echo " Kernel settings"
echo " --kerneldir=<dir> Location of the kernel sources"
+ echo " --kernel-append-localversion=<...>"
+ echo " Appends value to genkernel's KERNEL_LOCALVERSION option"
echo " --kernel-config=<file|default>"
echo " Kernel configuration file to use for compilation; Use"
echo " 'default' to explicitly start from scratch using"
@@ -648,6 +650,10 @@ parse_cmdline() {
CMD_KERNEL_DIR="${*#*=}"
print_info 3 "CMD_KERNEL_DIR: ${CMD_KERNEL_DIR}"
;;
+ --kernel-append-localversion=*)
+ CMD_KERNEL_APPEND_LOCALVERSION="${*#*=}"
+ print_info 3 "CMD_KERNEL_APPEND_LOCALVERSION: ${CMD_KERNEL_APPEND_LOCALVERSION}"
+ ;;
--kernel-config=*)
CMD_KERNEL_CONFIG="${*#*=}"
print_info 3 "CMD_KERNEL_CONFIG: ${CMD_KERNEL_CONFIG}"
diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index df0934d..f4b3cf7 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -290,6 +290,7 @@ determine_real_args() {
set_config_with_override STRING CROSS_COMPILE CMD_CROSS_COMPILE
set_config_with_override STRING BOOTDIR CMD_BOOTDIR "/boot"
set_config_with_override STRING KERNEL_OUTPUTDIR CMD_KERNEL_OUTPUTDIR "${KERNEL_DIR}"
+ set_config_with_override STRING KERNEL_APPEND_LOCALVERSION CMD_KERNEL_APPEND_LOCALVERSION
set_config_with_override STRING KERNEL_LOCALVERSION CMD_KERNEL_LOCALVERSION "-%%ARCH%%"
set_config_with_override STRING MODPROBEDIR CMD_MODPROBEDIR "/etc/modprobe.d"
@@ -630,6 +631,46 @@ determine_real_args() {
need_tar=yes
fi
+ # We always need to populate KERNEL_LOCALVERSION to be able to warn
+ # if user changed value but didn't rebuild kernel
+ local valid_localversion_pattern='^[A-Za-z0-9_.-]{1,}$'
+
+ if [ -n "${KERNEL_LOCALVERSION}" ]
+ then
+ case "${KERNEL_LOCALVERSION}" in
+ UNSET)
+ ;;
+ *)
+ KERNEL_LOCALVERSION=$(arch_replace "${KERNEL_LOCALVERSION}")
+ if [ -z "${KERNEL_LOCALVERSION}" ]
+ then
+ # We somehow lost value...
+ gen_die "Internal error: Variable 'KERNEL_LOCALVERSION' is empty!"
+ fi
+
+ if [[ ! "${KERNEL_LOCALVERSION}" =~ ${valid_localversion_pattern} ]]
+ then
+ gen_die "--kernel-localversion value '${KERNEL_LOCALVERSION}' does not match '${valid_localversion_pattern}' regex!"
+ fi
+ ;;
+ esac
+ fi
+
+ if [ -n "${KERNEL_APPEND_LOCALVERSION}" ]
+ then
+ if [[ ! "${KERNEL_APPEND_LOCALVERSION}" =~ ${valid_localversion_pattern} ]]
+ then
+ gen_die "--kernel-append-localversion value '${KERNEL_APPEND_LOCALVERSION}' does not match '${valid_localversion_pattern}' regex!"
+ fi
+
+ if [[ "${KERNEL_LOCALVERSION}" == "UNSET" ]]
+ then
+ gen_die "Cannot append '${KERNEL_APPEND_LOCALVERSION}' to KERNEL_LOCALVERSION you want to unset!"
+ else
+ KERNEL_LOCALVERSION+="${KERNEL_APPEND_LOCALVERSION}"
+ fi
+ fi
+
if isTrue "${BUILD_KERNEL}"
then
if [ "${KERNEL_DIR}" != "${KERNEL_OUTPUTDIR}" -a ! -d "${KERNEL_OUTPUTDIR}" ]
@@ -637,28 +678,6 @@ determine_real_args() {
print_warning 3 "Set --kernel-outputdir '${KERNEL_OUTPUTDIR}' does not exist; Will try to create ..."
mkdir -p "${KERNEL_OUTPUTDIR}" || gen_die "Failed to create '${KERNEL_OUTPUTDIR}'!"
fi
-
- if [ -n "${KERNEL_LOCALVERSION}" ]
- then
- case "${KERNEL_LOCALVERSION}" in
- UNSET)
- ;;
- *)
- KERNEL_LOCALVERSION=$(arch_replace "${KERNEL_LOCALVERSION}")
- if [ -z "${KERNEL_LOCALVERSION}" ]
- then
- # We somehow lost value...
- gen_die "Internal error: Variable 'KERNEL_LOCALVERSION' is empty!"
- fi
-
- local valid_localversion_pattern='^[A-Za-z0-9_.-]{1,}$'
- if [[ ! "${KERNEL_LOCALVERSION}" =~ ${valid_localversion_pattern} ]]
- then
- gen_die "--kernel-localversion value '${KERNEL_LOCALVERSION}' does not match '${valid_localversion_pattern}' regex!"
- fi
- ;;
- esac
- fi
fi
if ! isTrue "${BUILD_RAMDISK}"
next reply other threads:[~2019-07-29 20:10 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-29 20:10 Thomas Deutschmann [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-01-19 20:11 [gentoo-commits] proj/genkernel:master commit in: /, doc/ Ben Kohler
2021-09-13 5:08 Matt Turner
2021-03-15 20:02 Thomas Deutschmann
2020-05-24 22:27 Thomas Deutschmann
2019-12-05 23:52 Thomas Deutschmann
2019-07-29 20:10 Thomas Deutschmann
2019-07-23 19:47 Thomas Deutschmann
2017-11-15 3:08 Robin H. Johnson
2017-07-14 18:50 Robin H. Johnson
2016-10-12 13:52 Robin H. Johnson
2016-01-24 5:50 Robin H. Johnson
2015-02-08 21:39 Christoph Junghans
2012-10-16 0:01 Robin H. Johnson
2012-10-13 23:31 Robin H. Johnson
2012-09-30 19:28 Sebastian Pipping
2012-07-17 20:05 Richard Yao
2012-07-16 2:08 Robin H. Johnson
2012-02-06 9:42 Robin H. Johnson
2011-07-31 3:47 Sebastian Pipping
2011-06-07 19:14 Sebastian Pipping
2011-06-07 0:29 Sebastian Pipping
2011-05-31 1:48 Sebastian Pipping
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1564430427.94d32a155ef3e5cd59f852a032e5887b74306d81.whissi@gentoo \
--to=whissi@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox