diff mbox series

[v2] kernel: don't fail if Modules.symvers doesn't exist

Message ID 20230804162821.2333229-1-patrick@stwcx.xyz
State New
Headers show
Series [v2] kernel: don't fail if Modules.symvers doesn't exist | expand

Commit Message

Patrick Williams Aug. 4, 2023, 4:28 p.m. UTC
From: Joel Stanley <joel@jms.id.au>

Kernels that do not use modules do not have the Modules.symvers file,
which causes the previous one-liner to fail.  Invert the logic so that
the absence of the Modules.symvers is a passing situation but we still
get failure checking on the install operation.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
---
 meta/classes-recipe/kernel.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Patrick Williams Aug. 4, 2023, 5:06 p.m. UTC | #1
Apologies.  I sent this to the wrong ML.

On Fri, Aug 04, 2023 at 11:28:21AM -0500, Patrick Williams wrote:
> From: Joel Stanley <joel@jms.id.au>
> 
> Kernels that do not use modules do not have the Modules.symvers file,
> which causes the previous one-liner to fail.  Invert the logic so that
> the absence of the Modules.symvers is a passing situation but we still
> get failure checking on the install operation.
> 
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
> ---
>  meta/classes-recipe/kernel.bbclass | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass
> index 247ef4a48a..bb5995b495 100644
> --- a/meta/classes-recipe/kernel.bbclass
> +++ b/meta/classes-recipe/kernel.bbclass
> @@ -486,7 +486,7 @@ kernel_do_install() {
>  	install -m 0644 System.map ${D}/${KERNEL_IMAGEDEST}/System.map-${KERNEL_VERSION}
>  	install -m 0644 .config ${D}/${KERNEL_IMAGEDEST}/config-${KERNEL_VERSION}
>  	install -m 0644 vmlinux ${D}/${KERNEL_IMAGEDEST}/vmlinux-${KERNEL_VERSION}
> -	[ -e Module.symvers ] && install -m 0644 Module.symvers ${D}/${KERNEL_IMAGEDEST}/Module.symvers-${KERNEL_VERSION}
> +	! [ -e Module.symvers ] || install -m 0644 Module.symvers ${D}/${KERNEL_IMAGEDEST}/Module.symvers-${KERNEL_VERSION}
>  }
>  
>  # Must be ran no earlier than after do_kernel_checkout or else Makefile won't be in ${S}/Makefile
> @@ -555,7 +555,7 @@ do_shared_workdir () {
>  
>  	# Copy files required for module builds
>  	cp System.map $kerneldir/System.map-${KERNEL_VERSION}
> -	[ -e Module.symvers ] && cp Module.symvers $kerneldir/
> +	! [ -e Module.symvers ] || cp Module.symvers $kerneldir/
>  	cp .config $kerneldir/
>  	mkdir -p $kerneldir/include/config
>  	cp include/config/kernel.release $kerneldir/include/config/kernel.release
> -- 
> 2.41.0
>
diff mbox series

Patch

diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass
index 247ef4a48a..bb5995b495 100644
--- a/meta/classes-recipe/kernel.bbclass
+++ b/meta/classes-recipe/kernel.bbclass
@@ -486,7 +486,7 @@  kernel_do_install() {
 	install -m 0644 System.map ${D}/${KERNEL_IMAGEDEST}/System.map-${KERNEL_VERSION}
 	install -m 0644 .config ${D}/${KERNEL_IMAGEDEST}/config-${KERNEL_VERSION}
 	install -m 0644 vmlinux ${D}/${KERNEL_IMAGEDEST}/vmlinux-${KERNEL_VERSION}
-	[ -e Module.symvers ] && install -m 0644 Module.symvers ${D}/${KERNEL_IMAGEDEST}/Module.symvers-${KERNEL_VERSION}
+	! [ -e Module.symvers ] || install -m 0644 Module.symvers ${D}/${KERNEL_IMAGEDEST}/Module.symvers-${KERNEL_VERSION}
 }
 
 # Must be ran no earlier than after do_kernel_checkout or else Makefile won't be in ${S}/Makefile
@@ -555,7 +555,7 @@  do_shared_workdir () {
 
 	# Copy files required for module builds
 	cp System.map $kerneldir/System.map-${KERNEL_VERSION}
-	[ -e Module.symvers ] && cp Module.symvers $kerneldir/
+	! [ -e Module.symvers ] || cp Module.symvers $kerneldir/
 	cp .config $kerneldir/
 	mkdir -p $kerneldir/include/config
 	cp include/config/kernel.release $kerneldir/include/config/kernel.release