From patchwork Thu Feb 22 10:35:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Helbech Kleist X-Patchwork-Id: 39914 X-Patchwork-Delegate: steve@sakoman.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27CBCC54798 for ; Thu, 22 Feb 2024 10:35:57 +0000 (UTC) Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) by mx.groups.io with SMTP id smtpd.web11.9983.1708598149922074081 for ; Thu, 22 Feb 2024 02:35:50 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=OQR5aXBL; spf=pass (domain: gmail.com, ip: 209.85.208.46, mailfrom: andreaskleist@gmail.com) Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-564372fb762so2358080a12.0 for ; Thu, 22 Feb 2024 02:35:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708598148; x=1709202948; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NouBzXoNdrUDSoaom0oT26H3Seo1aq0zbxk2dwe3eok=; b=OQR5aXBLA8i/SOApU7i/gON2sHASX++M7yp/WHIXIph90l1TF6eDqY9+0wVRJtGZwT XLk+T68QU+QIpnHaqPcJfEPlNF3j1yr+VHuq3JMJdyA/YLQfx9IZAJhq5lwF2s5HigQY 4TDl45gzztAfJwkvgOFuPhyfUgrUIVc2YBsS87W2nabfgCYl6rGikk/8pfGbOZ4UxGzG bVPcwYF9GvmZ/Ihx1AuM68RD32fmhiZbUD/EKCgLSOS+16F29vbRXju4+BUXxanc0AKE HVZAT/IPpoSWNpDGJghQ4rdn55+3XOl1wPEWVc5Pf5utvuG4uA13IjC+YdA8vPD67pWs HVeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708598148; x=1709202948; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NouBzXoNdrUDSoaom0oT26H3Seo1aq0zbxk2dwe3eok=; b=QjhjZLNVYr0i05zh/K7Z9nn7Wa412qE3T5V4M5KzflX0WbEmJm4KFpj4AlOvDMukt3 iIPCXcofgOE8q04ThK97UZR4WH6BPHEHQXzp/GA6JMAzmNwFInj9A1KWHUQnQGBINVn+ CeiEi7WyDIUvHD9/FmQeg50uDytXOB4hiclyTeJP0cye2F8psnwMeahwKyclpVMqgRwI hqnxhL7fmd1uKYgfga6m6g45IKuagD8xyAKlQiUG/JPgtCetv2tzVpr75bEETprNt72+ CR86K1Y9wac/puu+ux+5dKAcJQPe2zlLlTPGWfUqhFcPktu472938rWSopHFme4A50WT JOrQ== X-Gm-Message-State: AOJu0YxSh8SLXvG4izCQWtZnOtO/nQSQeSm0jiwyikycdeWeD6fCZd5h hQAZbKaxn1VwyGuJXPkf+bJtJLj6U6saTR5luEV8PEjAF/uCEQElKN4kVm6q X-Google-Smtp-Source: AGHT+IF0jN4BkHadj4RHDLWuMfJToczOYWKeL9xTxpLTc3n2rBahU49OS2iKRkMdByRuGGICXwMeiA== X-Received: by 2002:a50:fc0a:0:b0:564:2655:f1b4 with SMTP id i10-20020a50fc0a000000b005642655f1b4mr9659034edr.32.1708598148109; Thu, 22 Feb 2024 02:35:48 -0800 (PST) Received: from localhost.localdomain (c-x5996889d.customers.hiper-net.dk. [89.150.136.157]) by smtp.gmail.com with ESMTPSA id ev24-20020a056402541800b0056163b46393sm5382260edb.64.2024.02.22.02.35.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 02:35:47 -0800 (PST) From: Andreas Helbech Kleist To: openembedded-core@lists.openembedded.org Cc: reatmon@ti.com Subject: [kirkstone][PATCH 1/3] kernel.bbclass: introduce KERNEL_LOCALVERSION Date: Thu, 22 Feb 2024 11:35:43 +0100 Message-ID: <20240222103545.2970387-2-andreaskleist@gmail.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240222103545.2970387-1-andreaskleist@gmail.com> References: <20240222103545.2970387-1-andreaskleist@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 22 Feb 2024 10:35:57 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/196012 From: Ming Liu Just like UBOOT_LOCALVERSION, an end user can set KERNEL_LOCALVERSION to append a string to the name of the local version of the kernel image. Signed-off-by: Ming Liu Signed-off-by: Alexandre Belloni Signed-off-by: Richard Purdie cherry-picked from master 229435a52f36ddec5f85fb6d5ccd42044b688397 Signed-off-by: Andreas Helbech Kleist --- meta/classes/kernel.bbclass | 6 +++++- meta/conf/documentation.conf | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass index 5951347361..80fb1879b0 100644 --- a/meta/classes/kernel.bbclass +++ b/meta/classes/kernel.bbclass @@ -614,6 +614,7 @@ do_shared_workdir () { # We don't need to stage anything, not the modules/firmware since those would clash with linux-firmware SYSROOT_DIRS = "" +KERNEL_LOCALVERSION ??= "" KERNEL_CONFIG_COMMAND ?= "oe_runmake_call -C ${S} O=${B} olddefconfig || oe_runmake -C ${S} O=${B} oldnoconfig" python check_oldest_kernel() { @@ -635,7 +636,10 @@ kernel_do_configure() { # $ scripts/setlocalversion . => + # $ make kernelversion => 2.6.37 # $ make kernelrelease => 2.6.37+ - touch ${B}/.scmversion ${S}/.scmversion + if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ]; then + echo ${KERNEL_LOCALVERSION} > ${B}/.scmversion + echo ${KERNEL_LOCALVERSION} > ${S}/.scmversion + fi if [ "${S}" != "${B}" ] && [ -f "${S}/.config" ] && [ ! -f "${B}/.config" ]; then mv "${S}/.config" "${B}/.config" diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf index ab2addb321..e55bfa288d 100644 --- a/meta/conf/documentation.conf +++ b/meta/conf/documentation.conf @@ -253,6 +253,7 @@ KERNEL_MODULE_PROBECONF[doc] = "Lists kernel modules for which the build system KERNEL_PACKAGE_NAME[doc] = "Name prefix for kernel packages. Defaults to 'kernel'." KERNEL_PATH[doc] = "The location of the kernel sources. This variable is set to the value of the STAGING_KERNEL_DIR within the module class (module.bbclass)." KERNEL_SRC[doc] = "The location of the kernel sources. This variable is set to the value of the STAGING_KERNEL_DIR within the module class (module.bbclass)." +KERNEL_LOCALVERSION[doc] = "Appends a string to the name of the local version of the kernel image." KFEATURE_DESCRIPTION[doc] = "Provides a short description of a configuration fragment. You use this variable in the .scc file that describes a configuration fragment file." KMACHINE[doc] = "The machine as known by the kernel." KTYPE[doc] = "Defines the kernel type to be used in assembling the configuration." From patchwork Thu Feb 22 10:35:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Helbech Kleist X-Patchwork-Id: 39913 X-Patchwork-Delegate: steve@sakoman.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id C265EC5478C for ; Thu, 22 Feb 2024 10:35:56 +0000 (UTC) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by mx.groups.io with SMTP id smtpd.web11.9984.1708598151104127821 for ; Thu, 22 Feb 2024 02:35:51 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TnbymdIv; spf=pass (domain: gmail.com, ip: 209.85.167.54, mailfrom: andreaskleist@gmail.com) Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-5101cd91017so10023301e87.2 for ; Thu, 22 Feb 2024 02:35:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708598149; x=1709202949; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=z/audotyZZ5592zKRD9yGvvhfeB2WLsG86tEoSr6d5M=; b=TnbymdIvnTrQkrlf8Y91NhWQHCOvDXXny1pqV0cEztV0MZF3twczx8yZFodSkhOKTB joj61W8HzYmbUEXHPUW7UrpgaAEL/nQHZGHCJNaxW0yEFmtNkZBcBq8/C2EEPNDqGg0z s1FDLt96eEIbLekHrJNGf6iBSpsQFIUGOIsrx4R0Vs6MmSTKTJMljg9IQQbsSAjBIkyW QkxHV2BzSljepBXkxnp3uLoh+YQWZUOG9PCy+cM+Om7XGyIzfRpmAruoBkwsX0H6hGFm UPj8LjVesHg/+XfS8vUwSJfm7fhfas7+sofmu+oavqcN/QeBTjIGvTei20Whl2769Vs2 emNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708598149; x=1709202949; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z/audotyZZ5592zKRD9yGvvhfeB2WLsG86tEoSr6d5M=; b=Q+Rbb+aT3PIOVdX4fqbbx9onX1SiBUt9FSLyTFwFAAfX+guCY/l2Qpf22ObOU6eksd slbzz/YUEuCtZBbm5w7bQvnRY4vRMZ/RioFCHZJEK5lgW6yyV/mWJtmEOqbf6VJUnB8t t9FoI3lt2ZkC8QKBN4abWhcA4TTwla8jxJzqOv99aMYSD+p5QBCIem/o87LZwSTdyD/L g1dXcHdkD86amAMFRCjzFik4PxDdZq8/GmT2aMMMvuVp5kj5IWFsjz5JUIQRSt17JWcw CZhXItNGJx1zm8ebBp8Jjfs9gBCaoqLwt9DItQvZd6OyV07mE9CjoD7wnIn8nXqGEsV7 lHIw== X-Gm-Message-State: AOJu0Yzl9yAcVhSCnGw0VFefS9JFNmmqDxFOdTLs4rE3oFUmU1xEqbJl md9Ogq5i+iMGqgdkEs3wwUwnEJzywxTVw13j9MFu2mKNQmbe4IZlU4x5rRfo X-Google-Smtp-Source: AGHT+IFriEfR7UGaY7vg223c4kxHN/bmqwTuo3SdmDa2cc0+hZMnrf2Tc9LxOvuvgES5RcpLF02nLQ== X-Received: by 2002:a05:6512:3ba8:b0:512:a743:3ce3 with SMTP id g40-20020a0565123ba800b00512a7433ce3mr11925977lfv.23.1708598149082; Thu, 22 Feb 2024 02:35:49 -0800 (PST) Received: from localhost.localdomain (c-x5996889d.customers.hiper-net.dk. [89.150.136.157]) by smtp.gmail.com with ESMTPSA id ev24-20020a056402541800b0056163b46393sm5382260edb.64.2024.02.22.02.35.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 02:35:48 -0800 (PST) From: Andreas Helbech Kleist To: openembedded-core@lists.openembedded.org Cc: reatmon@ti.com Subject: [kirkstone][PATCH 2/3] kernel: fix localversion in v6.3+ Date: Thu, 22 Feb 2024 11:35:44 +0100 Message-ID: <20240222103545.2970387-3-andreaskleist@gmail.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240222103545.2970387-1-andreaskleist@gmail.com> References: <20240222103545.2970387-1-andreaskleist@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 22 Feb 2024 10:35:56 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/196013 From: Bruce Ashfield During testing of the v6.4 reference kernel, it was noticed that on-target modules no longer matched the magic value of the running kernel. This was due to a different localversion in the cross built kernel and the scripts / resources created on target. This was due to changes in the setlocalversion script introduced in the v6.3 series. The .scmversion file is no longer used (or packaged) to inhibit the addition of a "+" (through querying of the git status of the kernel) or the setting of a local version. We recently introduced the KERNEL_LOCALVERSION variable to allow recipes to place a value in .scmversion, so we extend the use of that variable to kernel-arch.bbclass and use it to set the exported variable LOCALVERSION. We must do it at the kernel-arch level, as the variable must be exported in any kernel build to ensure that setlocalversion always correctly sets the localversion. Signed-off-by: Bruce Ashfield Signed-off-by: Richard Purdie cherry-picked from master 765b13b7305c8d2f222cfc66d77c02e6a088c691 Signed-off-by: Andreas Helbech Kleist --- meta/classes/kernel-arch.bbclass | 7 +++++++ meta/classes/kernel.bbclass | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/meta/classes/kernel-arch.bbclass b/meta/classes/kernel-arch.bbclass index 4cd08b96fb..0a79dea0af 100644 --- a/meta/classes/kernel-arch.bbclass +++ b/meta/classes/kernel-arch.bbclass @@ -66,3 +66,10 @@ KERNEL_LD = "${CCACHE}${HOST_PREFIX}ld.bfd ${HOST_LD_KERNEL_ARCH}" KERNEL_AR = "${CCACHE}${HOST_PREFIX}ar ${HOST_AR_KERNEL_ARCH}" TOOLCHAIN ?= "gcc" +# 6.3+ requires the variable LOCALVERSION to be set to not get a "+" in +# the local version. Having it empty means nothing will be added, and any +# value will be appended to the local kernel version. This replaces the +# use of .scmversion file for setting a localversion without using +# the CONFIG_LOCALVERSION option. +KERNEL_LOCALVERSION ??= "" +export LOCALVERSION ?= "${KERNEL_LOCALVERSION}" diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass index 80fb1879b0..940f1a3cf4 100644 --- a/meta/classes/kernel.bbclass +++ b/meta/classes/kernel.bbclass @@ -418,7 +418,7 @@ do_compile_kernelmodules() { if (grep -q -i -e '^CONFIG_MODULES=y$' ${B}/.config); then oe_runmake -C ${B} ${PARALLEL_MAKE} modules ${KERNEL_EXTRA_ARGS} - # Module.symvers gets updated during the + # Module.symvers gets updated during the # building of the kernel modules. We need to # update this in the shared workdir since some # external kernel modules has a dependency on @@ -614,7 +614,6 @@ do_shared_workdir () { # We don't need to stage anything, not the modules/firmware since those would clash with linux-firmware SYSROOT_DIRS = "" -KERNEL_LOCALVERSION ??= "" KERNEL_CONFIG_COMMAND ?= "oe_runmake_call -C ${S} O=${B} olddefconfig || oe_runmake -C ${S} O=${B} oldnoconfig" python check_oldest_kernel() { @@ -636,6 +635,9 @@ kernel_do_configure() { # $ scripts/setlocalversion . => + # $ make kernelversion => 2.6.37 # $ make kernelrelease => 2.6.37+ + # See kernel-arch.bbclass for post v6.3 removal of the extra + # + in localversion. .scmversion is no longer used, and the + # variable LOCALVERSION must be used if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ]; then echo ${KERNEL_LOCALVERSION} > ${B}/.scmversion echo ${KERNEL_LOCALVERSION} > ${S}/.scmversion From patchwork Thu Feb 22 10:35:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Helbech Kleist X-Patchwork-Id: 39915 X-Patchwork-Delegate: steve@sakoman.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6590C48BF8 for ; Thu, 22 Feb 2024 10:35:56 +0000 (UTC) Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) by mx.groups.io with SMTP id smtpd.web10.9965.1708598152154153907 for ; Thu, 22 Feb 2024 02:35:52 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Erk11WZz; spf=pass (domain: gmail.com, ip: 209.85.208.51, mailfrom: andreaskleist@gmail.com) Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-56454c695e6so1281903a12.0 for ; Thu, 22 Feb 2024 02:35:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708598150; x=1709202950; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xbqu6O75EvKfL/j526k3vuNdY9SAQHH1B9qvc7+XcDI=; b=Erk11WZzXp7xauDicor68bc0myYkXHUxvdgfebHoNr0IJRnSBJOC34lZw20s5Rq/kI 0tlTEk8Z6b9BENOPx5nXZyauZuy4Fx7XVc6xpMSqxQoGWWt/DMD+vBDMhJTgygoBTbYD RtKQ1u4smfHu6+B0eoDKbAeR7iOFCkBf4IPxcOJIJSR9gCeYwvg48mMXntyk2JjgcKWd 2wwGQXd7IZcNKzgrli3UOj7aBPcqTJ3Bqc/+a1Gv3/i19p/UUP2nF7XaUmxupWdz6/fn hZeQUrOLYDDluWkSLkiXUiL/BViSPNp8Pkobmx7L2TtXrDZaTdH9uicKADllGopxboJ2 162w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708598150; x=1709202950; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xbqu6O75EvKfL/j526k3vuNdY9SAQHH1B9qvc7+XcDI=; b=WQt3je6oGUeb02lgNYF9EzH33M4cx25uAdnE1TQZV5kO9oug5RUSmb/K6dnsS89ylQ afT74SGghO6+7eU12l6Avg3VNcUunfOunI2IrhA5hJWiBpaEAmA6QPmra40H356Y/iLk hAV9SpKTj11R8+7dSFyBRYg9syhUZrjrkfFKhUhdiCZEXuljZtF16DChUerUhGs18xd8 4ibctsI7NlHEI0uXYpbuUIqXbxGKsuJLAb1SWl3RNZi1vO6IMbQ7k7Gkij7cAu+8Ue+y pUiHO29ZPfahz/vvWVqCjmZ45EXzEuha3kDdY93fEBiST8g1BPBP64iAMT9Rj6u9UFE/ IMjA== X-Gm-Message-State: AOJu0YyEU0SVhJBdeLvc6I1CtIfNXQhK2EkbFYzaN1dbNCyKXDAGmpRG 2OxMAfQ7LzOfWejf4OcPloO9NDWlVzzew9/p6OrBryTMW+rv0nH8hZY4GZG3 X-Google-Smtp-Source: AGHT+IHBeHD5aM41VKO6DfahixPBz/IQVicQcC7bi5ZWnfwBszMKUezg2XHd0HHiFVUiwWHztlm9gQ== X-Received: by 2002:aa7:d7cc:0:b0:565:4b37:4578 with SMTP id e12-20020aa7d7cc000000b005654b374578mr260096eds.14.1708598150135; Thu, 22 Feb 2024 02:35:50 -0800 (PST) Received: from localhost.localdomain (c-x5996889d.customers.hiper-net.dk. [89.150.136.157]) by smtp.gmail.com with ESMTPSA id ev24-20020a056402541800b0056163b46393sm5382260edb.64.2024.02.22.02.35.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 02:35:49 -0800 (PST) From: Andreas Helbech Kleist To: openembedded-core@lists.openembedded.org Cc: reatmon@ti.com Subject: [kirkstone][PATCH 3/3] kernel: make LOCALVERSION consistent between recipes Date: Thu, 22 Feb 2024 11:35:45 +0100 Message-ID: <20240222103545.2970387-4-andreaskleist@gmail.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240222103545.2970387-1-andreaskleist@gmail.com> References: <20240222103545.2970387-1-andreaskleist@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 22 Feb 2024 10:35:56 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/196014 From: Bruce Ashfield The initial fix for localversion setting in 6.3+ broke older recipes and also broke recipes setting localversion in a kernel recipe, as make-mod-scripts (and other locations) can trigger a regeneration of files and don't have access to the variable. Moving the setting of this variable to the global namespace doesn't make sense, so we follow the example of the kernel-abiversion and save a kernel-localversion to the build artifacts. Recipes that may regenerate scripts/dynamic files, must depend on the do_shared_workedir of the kernel and use the helper function to read the file storing the localversion. Signed-off-by: Bruce Ashfield Signed-off-by: Alexandre Belloni cherry-picked from master b378eec156998eea55ba61e59103cb34fab0d07c Signed-off-by: Andreas Helbech Kleist Acked-by: Ryan Eatmon --- meta/classes/kernel-arch.bbclass | 8 -------- meta/classes/kernel.bbclass | 14 ++++++++++++++ meta/classes/kernelsrc.bbclass | 1 + meta/classes/linux-kernel-base.bbclass | 11 +++++++++++ meta/classes/module-base.bbclass | 1 + .../make-mod-scripts/make-mod-scripts_1.0.bb | 3 +++ 6 files changed, 30 insertions(+), 8 deletions(-) diff --git a/meta/classes/kernel-arch.bbclass b/meta/classes/kernel-arch.bbclass index 0a79dea0af..62c8211621 100644 --- a/meta/classes/kernel-arch.bbclass +++ b/meta/classes/kernel-arch.bbclass @@ -65,11 +65,3 @@ KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_KERNEL_ARCH} -fuse-ld=bfd ${DE KERNEL_LD = "${CCACHE}${HOST_PREFIX}ld.bfd ${HOST_LD_KERNEL_ARCH}" KERNEL_AR = "${CCACHE}${HOST_PREFIX}ar ${HOST_AR_KERNEL_ARCH}" TOOLCHAIN ?= "gcc" - -# 6.3+ requires the variable LOCALVERSION to be set to not get a "+" in -# the local version. Having it empty means nothing will be added, and any -# value will be appended to the local kernel version. This replaces the -# use of .scmversion file for setting a localversion without using -# the CONFIG_LOCALVERSION option. -KERNEL_LOCALVERSION ??= "" -export LOCALVERSION ?= "${KERNEL_LOCALVERSION}" diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass index 940f1a3cf4..96e41b5192 100644 --- a/meta/classes/kernel.bbclass +++ b/meta/classes/kernel.bbclass @@ -541,6 +541,7 @@ do_shared_workdir () { # echo "${KERNEL_VERSION}" > $kerneldir/${KERNEL_PACKAGE_NAME}-abiversion + echo "${KERNEL_LOCALVERSION}" > $kerneldir/${KERNEL_PACKAGE_NAME}-localversion # Copy files required for module builds cp System.map $kerneldir/System.map-${KERNEL_VERSION} @@ -630,6 +631,19 @@ python check_oldest_kernel() { check_oldest_kernel[vardepsexclude] += "OLDEST_KERNEL KERNEL_VERSION" do_configure[prefuncs] += "check_oldest_kernel" +KERNEL_LOCALVERSION ??= "" + +# 6.3+ requires the variable LOCALVERSION to be set to not get a "+" in +# the local version. Having it empty means nothing will be added, and any +# value will be appended to the local kernel version. This replaces the +# use of .scmversion file for setting a localversion without using +# the CONFIG_LOCALVERSION option. +# +# Note: This class saves the value of localversion to a file +# so other recipes like make-mod-scripts can restore it via the +# helper function get_kernellocalversion_file +export LOCALVERSION="${KERNEL_LOCALVERSION}" + kernel_do_configure() { # fixes extra + in /lib/modules/2.6.37+ # $ scripts/setlocalversion . => + diff --git a/meta/classes/kernelsrc.bbclass b/meta/classes/kernelsrc.bbclass index a951ba3325..a79bf18b09 100644 --- a/meta/classes/kernelsrc.bbclass +++ b/meta/classes/kernelsrc.bbclass @@ -5,6 +5,7 @@ do_patch[depends] += "virtual/kernel:do_shared_workdir" do_patch[noexec] = "1" do_package[depends] += "virtual/kernel:do_populate_sysroot" KERNEL_VERSION = "${@get_kernelversion_file("${STAGING_KERNEL_BUILDDIR}")}" +LOCAL_VERSION = "${@get_kernellocalversion_file("${STAGING_KERNEL_BUILDDIR}")}" inherit linux-kernel-base diff --git a/meta/classes/linux-kernel-base.bbclass b/meta/classes/linux-kernel-base.bbclass index 73a6fe36d9..0e2a4a4abe 100644 --- a/meta/classes/linux-kernel-base.bbclass +++ b/meta/classes/linux-kernel-base.bbclass @@ -33,6 +33,17 @@ def get_kernelversion_file(p): except IOError: return None +def get_kernellocalversion_file(p): + fn = p + '/kernel-localversion' + + try: + with open(fn, 'r') as f: + return f.readlines()[0].strip() + except IOError: + return "" + + return "" + def linux_module_packages(s, d): suffix = "" return " ".join(map(lambda s: "kernel-module-%s%s" % (s.lower().replace('_', '-').replace('@', '+'), suffix), s.split())) diff --git a/meta/classes/module-base.bbclass b/meta/classes/module-base.bbclass index 27bd69ff33..5b2fde8144 100644 --- a/meta/classes/module-base.bbclass +++ b/meta/classes/module-base.bbclass @@ -14,6 +14,7 @@ export CROSS_COMPILE = "${TARGET_PREFIX}" export KBUILD_OUTPUT = "${STAGING_KERNEL_BUILDDIR}" export KERNEL_VERSION = "${@oe.utils.read_file('${STAGING_KERNEL_BUILDDIR}/kernel-abiversion')}" +export LOCALVERSION = "${@oe.utils.read_file('${STAGING_KERNEL_BUILDDIR}/kernel-localversion')}" KERNEL_OBJECT_SUFFIX = ".ko" # kernel modules are generally machine specific diff --git a/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb b/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb index f6f47cfff5..8727d003f9 100644 --- a/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb +++ b/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb @@ -21,6 +21,9 @@ DEPENDS += "gmp-native" EXTRA_OEMAKE = " HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}"" EXTRA_OEMAKE += " HOSTCXX="${BUILD_CXX} ${BUILD_CXXFLAGS} ${BUILD_LDFLAGS}" CROSS_COMPILE=${TARGET_PREFIX}" +KERNEL_LOCALVERSION = "${@get_kernellocalversion_file("${STAGING_KERNEL_BUILDDIR}")}" +export LOCALVERSION="${KERNEL_LOCALVERSION}" + # Build some host tools under work-shared. CC, LD, and AR are probably # not used, but this is the historical way of invoking "make scripts". #