From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 61F04138334 for ; Mon, 29 Jul 2019 20:10:33 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3FA3BE0867; Mon, 29 Jul 2019 20:10:30 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0F8A3E0867 for ; Mon, 29 Jul 2019 20:10:30 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 8907E348F79 for ; Mon, 29 Jul 2019 20:10:28 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id CA490756 for ; Mon, 29 Jul 2019 20:10:24 +0000 (UTC) From: "Thomas Deutschmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Thomas Deutschmann" Message-ID: <1564430427.94d32a155ef3e5cd59f852a032e5887b74306d81.whissi@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: /, doc/ X-VCS-Repository: proj/genkernel X-VCS-Files: doc/genkernel.8.txt gen_cmdline.sh gen_determineargs.sh X-VCS-Directories: / doc/ X-VCS-Committer: whissi X-VCS-Committer-Name: Thomas Deutschmann X-VCS-Revision: 94d32a155ef3e5cd59f852a032e5887b74306d81 X-VCS-Branch: master Date: Mon, 29 Jul 2019 20:10:24 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: af9f8c68-43fe-4858-a2fc-7002e41d2427 X-Archives-Hash: 712c084399a581ace89e9b1600711dd2 commit: 94d32a155ef3e5cd59f852a032e5887b74306d81 Author: Thomas Deutschmann gentoo org> AuthorDate: Sun Jul 28 22:06:33 2019 +0000 Commit: Thomas Deutschmann gentoo 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 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= Location of the kernel sources" + echo " --kernel-append-localversion=<...>" + echo " Appends value to genkernel's KERNEL_LOCALVERSION option" echo " --kernel-config=" 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}"