kernel: Backport v6.3+ localversion fixes
cover kernel: Backport v6.3+ localversion fixes
Without this, kernels v6.3 and later have wrong localversion '+' appended.
Bruce Ashfield (2):
kernel: fix localversion in v6.3+
kernel: make LOCALVERSION consistent between recipes
Ming Liu (1):
kernel.bbclass: introduce KERNEL_LOCALVERSION
meta/classes/kernel-arch.bbclass | 1 - meta/classes/kernel.bbclass | 24 +++++++++++++++++-- meta/classes/kernelsrc.bbclass | 1 + meta/classes/linux-kernel-base.bbclass | 11 +++++++++ meta/classes/module-base.bbclass | 1 + meta/conf/documentation.conf | 1 + .../make-mod-scripts/make-mod-scripts_1.0.bb | 3 +++ 7 files changed, 39 insertions(+), 3 deletions(-)
Signature · 1 line
2.43.2
PATCH 2/3 kernel: fix localversion in v6.3+
From: Bruce Ashfield <[email protected]>
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.
cherry-picked from master 765b13b7305c8d2f222cfc66d77c02e6a088c691
--- meta/classes/kernel-arch.bbclass | 7 +++++++ meta/classes/kernel.bbclass | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-)
meta/classes/kernel-arch.bbclass +7 -0
@@ -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}"
meta/classes/kernel.bbclass +4 -2
@@ -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
Signature · 1 line
2.43.2
PATCH 3/3 kernel: make LOCALVERSION consistent between recipes
In reply to Andreas Helbech KleistFrom: Bruce Ashfield <[email protected]>
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.
cherry-picked from master b378eec156998eea55ba61e59103cb34fab0d07c
--- 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(-)
meta/classes/kernel-arch.bbclass +0 -8
@@ -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}"
meta/classes/kernel.bbclass +14 -0
@@ -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 . => +
meta/classes/kernelsrc.bbclass +1 -0
@@ -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
meta/classes/linux-kernel-base.bbclass +11 -0
@@ -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()))
meta/classes/module-base.bbclass +1 -0
@@ -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
meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb +3 -0
@@ -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". #
Signature · 1 line
2.43.2
PATCH 1/3 kernel.bbclass: introduce KERNEL_LOCALVERSION
In reply to Andreas Helbech KleistFrom: Ming Liu <[email protected]>
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.
cherry-picked from master 229435a52f36ddec5f85fb6d5ccd42044b688397
--- meta/classes/kernel.bbclass | 6 +++++- meta/conf/documentation.conf | 1 + 2 files changed, 6 insertions(+), 1 deletion(-)
meta/classes/kernel.bbclass +5 -1
@@ -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"
meta/conf/documentation.conf +1 -0
@@ -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."
Signature · 1 line
2.43.2
Re: [kirkstone][PATCH 3/3] kernel: make LOCALVERSION consistent between recipes
In reply to Andreas Helbech KleistQuoted 15 lines · Andreas Helbech Kleist
From: Bruce Ashfield <[email protected]>
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/dynamicfiles, must depend on thedo_shared_workedirof the kernel and use the helper function to read the file storing the localversion.
Quoted 6 lines
Signed-off-by Bruce Ashfield <[email protected]>Signed-off-by Alexandre Belloni <[email protected]>cherry-picked from master
b378eec156998eea55ba61e59103cb34fab0d07cSigned-off-by Andreas Helbech Kleist <[email protected]>
I'm not sure what is going on with our meta-ti testing. This set of changes causes the same issue we were seeing before. Plus, now that I'm looking into it deeper, I'm seeing a breakage in master related to these same patches on there. Not sure why the changes were not caught in our testing on master back when the patches were accepted there... Clearly I need some better checks on the images as part of our QC process...
I need to figure out how to fix the issue on master and see if the same change can be applied to these patches on kirkstone. I'll try and get all this done as quickly as I can.
Quoted 117 lines
--- 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(-)meta/classes/kernel-arch.bbclass +0
-8@@ -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}"meta/classes/kernel.bbclass +14
-0@@ -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 . => +meta/classes/kernelsrc.bbclass +1
-0@@ -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-basemeta/classes/linux-kernel-base.bbclass +11
-0@@ -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()))meta/classes/module-base.bbclass +1
-0@@ -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 specificmeta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb +3
-0@@ -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". #
Signature · 3 lines
Ryan Eatmon [email protected] ----------------------------------------- Texas Instruments, Inc. - LCPD - MGTS
Re: [OE-core] [kirkstone][PATCH 3/3] kernel: make LOCALVERSION consistent between recipes
Quoted 33 lines · Ryan Eatmon via lists.openembedded.org
Quoted 15 lines · Andreas Helbech Kleist
From: Bruce Ashfield <[email protected]>
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/dynamicfiles, must depend on thedo_shared_workedirof the kernel and use the helper function to read the file storing the localversion.Quoted 6 lines
Signed-off-by Bruce Ashfield <[email protected]>Signed-off-by Alexandre Belloni <[email protected]>cherry-picked from master
b378eec156998eea55ba61e59103cb34fab0d07cSigned-off-by Andreas Helbech Kleist <[email protected]>I'm not sure what is going on with our meta-ti testing. This set of changes causes the same issue we were seeing before. Plus, now that I'm looking into it deeper, I'm seeing a breakage in master related to these same patches on there. Not sure why the changes were not caught in our testing on master back when the patches were accepted there... Clearly I need some better checks on the images as part of our QC process...
Quoted 3 lines
I need to figure out how to fix the issue on master and see if the same change can be applied to these patches on kirkstone. I'll try and get all this done as quickly as I can.
Please make sure to copy me directly, both as the maintainer of the parts of core in question and the author of the patches.
We've had no reports of issues since any of these went in, and they aren't exactly a recent change. Which obviously means there's potentially something different in the environment or the kernel recipes.
If you get a set of reproducing steps with linux-yocto and core, I can lend a hand with any fixes.
Bruce
Quoted 134 lines
Quoted 111 lines
--- 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(-)meta/classes/kernel-arch.bbclass +0
-8@@ -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}"meta/classes/kernel.bbclass +14
-0@@ -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 . => +meta/classes/kernelsrc.bbclass +1
-0@@ -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-basemeta/classes/linux-kernel-base.bbclass +11
-0@@ -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()))meta/classes/module-base.bbclass +1
-0@@ -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 specificmeta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb +0
-0meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb DEPENDS += "gmp-native" · line 29
Quoted 9 lines
meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb +3
-0@@ -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". #--
Ryan Eatmon [email protected]
-----------------------------------------
Texas Instruments, Inc. - LCPD - MGTS-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#196043): https://lists.openembedded.org/g/openembedded-core/message/196043
Mute This Topic: https://lists.openembedded.org/mt/104505983/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end - "Use the force Harry" - Gandalf, Star Trek II
Re: [OE-core] [kirkstone][PATCH 3/3] kernel: make LOCALVERSION consistent between recipes
Quoted 47 lines · Bruce Ashfield
Quoted 33 lines · Ryan Eatmon via lists.openembedded.org
Quoted 15 lines · Andreas Helbech Kleist
From: Bruce Ashfield <[email protected]>
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/dynamicfiles, must depend on thedo_shared_workedirof the kernel and use the helper function to read the file storing the localversion.Quoted 6 lines
Signed-off-by Bruce Ashfield <[email protected]>Signed-off-by Alexandre Belloni <[email protected]>cherry-picked from master
b378eec156998eea55ba61e59103cb34fab0d07cSigned-off-by Andreas Helbech Kleist <[email protected]>I'm not sure what is going on with our meta-ti testing. This set of changes causes the same issue we were seeing before. Plus, now that I'm looking into it deeper, I'm seeing a breakage in master related to these same patches on there. Not sure why the changes were not caught in our testing on master back when the patches were accepted there... Clearly I need some better checks on the images as part of our QC process...
Quoted 3 lines
I need to figure out how to fix the issue on master and see if the same change can be applied to these patches on kirkstone. I'll try and get all this done as quickly as I can.
Please make sure to copy me directly, both as the maintainer of the parts of core in question and the author of the patches.
We've had no reports of issues since any of these went in, and they aren't exactly a recent change. Which obviously means there's potentially something different in the environment or the kernel recipes.
Quoted 4 lines
If you get a set of reproducing steps with linux-yocto and core, I can lend a hand with any fixes.
Bruce
This may not be an issue with these patches per se. It may be an issue with our kernel recipes in meta-ti. But since kirkstone is our primary release vector right now, it is breaking us to accept these patches onto kirkstone. I fully acknowledge that this might solely a TI issue. And now that we are aware of the issue we are going to work very very hard to find a solution as quickly as we can.
As soon as we have an understanding of how to recreate the issue outside of our recipe we will definitely share with this thread.
Quoted 136 lines
Quoted 134 lines
Quoted 111 lines
--- 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(-)meta/classes/kernel-arch.bbclass +0
-8@@ -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}"meta/classes/kernel.bbclass +14
-0@@ -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 . => +meta/classes/kernelsrc.bbclass +1
-0@@ -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-basemeta/classes/linux-kernel-base.bbclass +11
-0@@ -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()))meta/classes/module-base.bbclass +1
-0@@ -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 specificmeta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb +0
-0meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb DEPENDS += "gmp-native" · line 29
Quoted 9 lines
meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb +3
-0@@ -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". #--
Ryan Eatmon [email protected]
-----------------------------------------
Texas Instruments, Inc. - LCPD - MGTS-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#196043): https://lists.openembedded.org/g/openembedded-core/message/196043
Mute This Topic: https://lists.openembedded.org/mt/104505983/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Ryan Eatmon [email protected] ----------------------------------------- Texas Instruments, Inc. - LCPD - MGTS
Ryan Eatmon
Acked-byRe: [OE-core] [kirkstone][PATCH 3/3] kernel: make LOCALVERSION consistent between recipes
In reply to a message not in the archiveQuoted 50 lines · Ryan Eatmon via lists.openembedded.org
Quoted 47 lines · Bruce Ashfield
Quoted 33 lines · Ryan Eatmon via lists.openembedded.org
Quoted 15 lines · Andreas Helbech Kleist
From: Bruce Ashfield <[email protected]>
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/dynamicfiles, must depend on thedo_shared_workedirof the kernel and use the helper function to read the file storing the localversion.Quoted 6 lines
Signed-off-by Bruce Ashfield <[email protected]>Signed-off-by Alexandre Belloni <[email protected]>cherry-picked from master
b378eec156998eea55ba61e59103cb34fab0d07cSigned-off-by Andreas Helbech Kleist <[email protected]>I'm not sure what is going on with our meta-ti testing. This set of changes causes the same issue we were seeing before. Plus, now that I'm looking into it deeper, I'm seeing a breakage in master related to these same patches on there. Not sure why the changes were not caught in our testing on master back when the patches were accepted there... Clearly I need some better checks on the images as part of our QC process...
Quoted 3 lines
I need to figure out how to fix the issue on master and see if the same change can be applied to these patches on kirkstone. I'll try and get all this done as quickly as I can.
Please make sure to copy me directly, both as the maintainer of the parts of core in question and the author of the patches.
We've had no reports of issues since any of these went in, and they aren't exactly a recent change. Which obviously means there's potentially something different in the environment or the kernel recipes.
Quoted 9 lines
Quoted 4 lines
If you get a set of reproducing steps with linux-yocto and core, I can lend a hand with any fixes.
Bruce
This may not be an issue with these patches per se. It may be an issue with our kernel recipes in meta-ti. But since kirkstone is our primary release vector right now, it is breaking us to accept these patches onto kirkstone. I fully acknowledge that this might solely a TI issue. And now that we are aware of the issue we are going to work very very hard to find a solution as quickly as we can.
As soon as we have an understanding of how to recreate the issue outside of our recipe we will definitely share with this thread.
Ok. My initial thinking that there was a problem was incorrect. I looked at the file system and found our value for KERNEL_LOCALVERSION was included in the modules directory name twice.
/lib/modules/6.1.69-gcb84067eaf83-gcb84067eaf83
That was the symptom that caused the issue with our request for the revert last week. However, with this full patch series the problem caused by the double entry from the last series is not a problem because the double entry is everywhere in the kernel, so it all works together. It's just goofy.
So with that. This bigger series can be accepted into Kirkstone.
Now for the second issue, and maybe this was known that it would occur, if we set KERNEL_LOCALVERSION it is placed into both the .scmversion file AND the LOCALVERSION variable. The setlocalversion script in the 6.1 kernel we are currently pointing at for our production includes both in the version string, which causes the entire kernel to be named named with a redundant string.
/lib/modules/6.1.69-gcb84067eaf83-gcb84067eaf83
I guess we can live with this. It is unnecessary, but not incorrect. It is cleaned up with the next LTS kernel 6.6. This is just the hazard of only having a single class to handle kernel issues that needs to span multiple kernel versions that are changing things up in big ways.
The only way I can see to fix it would be to create some new control variables that recipes can set to control the above behavior and then set defaults for them.
But we can look into patches to add that if needed.
Apologies for taking so much time in testing this series. We are just about to make a release and things that break the kernel cause us a lot anxiety.
Quoted 153 lines
Quoted 125 lines
Quoted 125 lines
Quoted 125 lines
---
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(-)meta/classes/kernel-arch.bbclass +0
-0@@ -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"meta/classes/kernel-arch.bbclass +0
-2- -# 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 themeta/classes/kernel-arch.bbclass +0
-4-# use of .scmversion file for setting a localversion without using -# the CONFIG_LOCALVERSION option. -KERNEL_LOCALVERSION ??= "" -export LOCALVERSION ?= "${KERNEL_LOCALVERSION}"meta/classes/kernel.bbclass +0
-0@@ -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}meta/classes/kernel.bbclass +0
-0@@ -630,6 +631,19 @@ python check_oldest_kernel() {check_oldest_kernel[vardepsexclude] += "
OLDEST_KERNELKERNEL_VERSION" do_configure[prefuncs] += "check_oldest_kernel"meta/classes/kernel.bbclass +3
-0+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 themeta/classes/kernel.bbclass +8
-0+# 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 . => +meta/classes/kernelsrc.bbclass +0
-0@@ -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
meta/classes/linux-kernel-base.bbclass +0
-0@@ -33,6 +33,17 @@ def get_kernelversion_file(p):except IOError:
return Nonemeta/classes/linux-kernel-base.bbclass +11
-0+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()))meta/classes/module-base.bbclass +0
-0@@ -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 specificmeta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb +0
-0@@ -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}"Quoted 17 lines
Quoted 15 lines
Quoted 7 lines
+KERNEL_LOCALVERSION = "${@get_kernellocalversion_file("${STAGING_KERNEL_BUILDDIR}")}"
meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb +2
-0+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". #Signature · 3 lines
Ryan Eatmon [email protected] ----------------------------------------- Texas Instruments, Inc. - LCPD - MGTS-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#196045): https://lists.openembedded.org/g/openembedded-core/message/196045
Mute This Topic: https://lists.openembedded.org/mt/104505983/6551054
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Ryan Eatmon [email protected] ----------------------------------------- Texas Instruments, Inc. - LCPD - MGTS