diff mbox series

[nanbield,11/33] kernel.bbclass: Use strip utility used for kernel build in do_package

Message ID e0bd7ce93a75c7ddb6b1c572453c37407e7e32da.1700496737.git.steve@sakoman.com
State New, archived
Headers show
Series [nanbield,01/33] libsndfile1: fix CVE-2022-33065 | expand

Commit Message

Steve Sakoman Nov. 20, 2023, 4:38 p.m. UTC
From: Khem Raj <raj.khem@gmail.com>

os.environ does not pass this down to runstrip() function and in
strip_execs() its using STRIP bitbake variable to find the strip utility
to use. Since there might be a trailing whitespace in KERNEL_STRIP
remove that otherwise python is not able to launch it.
e.g.

FileNotFoundError: [Errno 2] No such file or directory: 'riscv64-yoe-linux-strip '

This is more evident when STRIP and KERNEL_STRIP are different utilities
e.g. when using clang as default toolchain but using gcc+binutils only for
kernel build.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Bruce Ashfield <bruce.ashfield@gmail.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 77497dbdca92ab4d6386a071bc281c42a7e8a14b)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 meta/classes-recipe/kernel.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin Jansa Nov. 20, 2023, 4:45 p.m. UTC | #1
This requires additional fix from:
https://git.openembedded.org/openembedded-core/commit/?id=41f019afc41f800b622c46a6d7cf1beffc97716a

Cheers,

On Mon, Nov 20, 2023 at 5:39 PM Steve Sakoman <steve@sakoman.com> wrote:

> From: Khem Raj <raj.khem@gmail.com>
>
> os.environ does not pass this down to runstrip() function and in
> strip_execs() its using STRIP bitbake variable to find the strip utility
> to use. Since there might be a trailing whitespace in KERNEL_STRIP
> remove that otherwise python is not able to launch it.
> e.g.
>
> FileNotFoundError: [Errno 2] No such file or directory:
> 'riscv64-yoe-linux-strip '
>
> This is more evident when STRIP and KERNEL_STRIP are different utilities
> e.g. when using clang as default toolchain but using gcc+binutils only for
> kernel build.
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> Cc: Bruce Ashfield <bruce.ashfield@gmail.com>
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> (cherry picked from commit 77497dbdca92ab4d6386a071bc281c42a7e8a14b)
> Signed-off-by: Steve Sakoman <steve@sakoman.com>
> ---
>  meta/classes-recipe/kernel.bbclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes-recipe/kernel.bbclass
> b/meta/classes-recipe/kernel.bbclass
> index 2ec9ea2091..16b85dbca4 100644
> --- a/meta/classes-recipe/kernel.bbclass
> +++ b/meta/classes-recipe/kernel.bbclass
> @@ -336,7 +336,7 @@ kernel_do_transform_bundled_initramfs() {
>  do_transform_bundled_initramfs[dirs] = "${B}"
>
>  python do_package:prepend () {
> -    os.environ['STRIP'] = d.getVar('KERNEL_STRIP')
> +    d.setVar('STRIP',  d.getVar('KERNEL_STRIP').strip())
>  }
>
>  python do_devshell:prepend () {
> --
> 2.34.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#190900):
> https://lists.openembedded.org/g/openembedded-core/message/190900
> Mute This Topic: https://lists.openembedded.org/mt/102710661/3617156
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> martin.jansa@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Steve Sakoman Nov. 20, 2023, 5:23 p.m. UTC | #2
Got it!  Thanks for reviewing.

Steve

On Mon, Nov 20, 2023 at 6:45 AM Martin Jansa <martin.jansa@gmail.com> wrote:
>
> This requires additional fix from:
> https://git.openembedded.org/openembedded-core/commit/?id=41f019afc41f800b622c46a6d7cf1beffc97716a
>
> Cheers,
>
> On Mon, Nov 20, 2023 at 5:39 PM Steve Sakoman <steve@sakoman.com> wrote:
>>
>> From: Khem Raj <raj.khem@gmail.com>
>>
>> os.environ does not pass this down to runstrip() function and in
>> strip_execs() its using STRIP bitbake variable to find the strip utility
>> to use. Since there might be a trailing whitespace in KERNEL_STRIP
>> remove that otherwise python is not able to launch it.
>> e.g.
>>
>> FileNotFoundError: [Errno 2] No such file or directory: 'riscv64-yoe-linux-strip '
>>
>> This is more evident when STRIP and KERNEL_STRIP are different utilities
>> e.g. when using clang as default toolchain but using gcc+binutils only for
>> kernel build.
>>
>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> Cc: Bruce Ashfield <bruce.ashfield@gmail.com>
>> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
>> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
>> (cherry picked from commit 77497dbdca92ab4d6386a071bc281c42a7e8a14b)
>> Signed-off-by: Steve Sakoman <steve@sakoman.com>
>> ---
>>  meta/classes-recipe/kernel.bbclass | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass
>> index 2ec9ea2091..16b85dbca4 100644
>> --- a/meta/classes-recipe/kernel.bbclass
>> +++ b/meta/classes-recipe/kernel.bbclass
>> @@ -336,7 +336,7 @@ kernel_do_transform_bundled_initramfs() {
>>  do_transform_bundled_initramfs[dirs] = "${B}"
>>
>>  python do_package:prepend () {
>> -    os.environ['STRIP'] = d.getVar('KERNEL_STRIP')
>> +    d.setVar('STRIP',  d.getVar('KERNEL_STRIP').strip())
>>  }
>>
>>  python do_devshell:prepend () {
>> --
>> 2.34.1
>>
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#190900): https://lists.openembedded.org/g/openembedded-core/message/190900
>> Mute This Topic: https://lists.openembedded.org/mt/102710661/3617156
>> Group Owner: openembedded-core+owner@lists.openembedded.org
>> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [martin.jansa@gmail.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
diff mbox series

Patch

diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass
index 2ec9ea2091..16b85dbca4 100644
--- a/meta/classes-recipe/kernel.bbclass
+++ b/meta/classes-recipe/kernel.bbclass
@@ -336,7 +336,7 @@  kernel_do_transform_bundled_initramfs() {
 do_transform_bundled_initramfs[dirs] = "${B}"
 
 python do_package:prepend () {
-    os.environ['STRIP'] = d.getVar('KERNEL_STRIP')
+    d.setVar('STRIP',  d.getVar('KERNEL_STRIP').strip())
 }
 
 python do_devshell:prepend () {