* [PATCH 1/3] nativesdk: Handle chown/chgrp calls in nativesdk do_install tasks
@ 2021-11-25 15:22 Richard Purdie
2021-11-25 15:22 ` [PATCH 2/3] gcc: Drop no longer needed patch Richard Purdie
2021-11-25 15:22 ` [PATCH 3/3] gcc: Drop mips default ABI patch Richard Purdie
0 siblings, 2 replies; 5+ messages in thread
From: Richard Purdie @ 2021-11-25 15:22 UTC (permalink / raw)
To: openembedded-core
We disable the useradd code for nativesdk targets since we don't support
postinstalls or multiple users in those cases. This means any usage
of chown/chgrp inside do_install tasks won't work and would have to be
conditional. Rather than require all recipes to do that, add intercepts
of the calls and map those to root/root user/groups. We can't just ignore
them as some calls are used to remove host contamination from the host
user ID so they need to be made, just as root.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
meta/classes/nativesdk.bbclass | 2 ++
scripts/nativesdk-intercept/chgrp | 27 +++++++++++++++++++++++++++
scripts/nativesdk-intercept/chown | 27 +++++++++++++++++++++++++++
3 files changed, 56 insertions(+)
create mode 100755 scripts/nativesdk-intercept/chgrp
create mode 100755 scripts/nativesdk-intercept/chown
diff --git a/meta/classes/nativesdk.bbclass b/meta/classes/nativesdk.bbclass
index 14e210562f1..f8e96075134 100644
--- a/meta/classes/nativesdk.bbclass
+++ b/meta/classes/nativesdk.bbclass
@@ -113,3 +113,5 @@ do_packagedata[stamp-extra-info] = ""
USE_NLS = "${SDKUSE_NLS}"
OLDEST_KERNEL = "${SDK_OLDEST_KERNEL}"
+
+PATH:prepend = "${COREBASE}/scripts/nativesdk-intercept:"
diff --git a/scripts/nativesdk-intercept/chgrp b/scripts/nativesdk-intercept/chgrp
new file mode 100755
index 00000000000..30cc417d3ac
--- /dev/null
+++ b/scripts/nativesdk-intercept/chgrp
@@ -0,0 +1,27 @@
+#!/usr/bin/env python3
+#
+# Wrapper around 'chgrp' that redirects to root in all cases
+
+import os
+import shutil
+import sys
+
+# calculate path to the real 'chgrp'
+path = os.environ['PATH']
+path = path.replace(os.path.dirname(sys.argv[0]), '')
+real_chgrp = shutil.which('chgrp', path=path)
+
+args = list()
+
+found = False
+for i in sys.argv:
+ if i.startswith("-"):
+ args.append(i)
+ continue
+ if not found:
+ args.append("root")
+ found = True
+ else:
+ args.append(i)
+
+os.execv(real_chgrp, args)
diff --git a/scripts/nativesdk-intercept/chown b/scripts/nativesdk-intercept/chown
new file mode 100755
index 00000000000..3914b3e3841
--- /dev/null
+++ b/scripts/nativesdk-intercept/chown
@@ -0,0 +1,27 @@
+#!/usr/bin/env python3
+#
+# Wrapper around 'chown' that redirects to root in all cases
+
+import os
+import shutil
+import sys
+
+# calculate path to the real 'chown'
+path = os.environ['PATH']
+path = path.replace(os.path.dirname(sys.argv[0]), '')
+real_chown = shutil.which('chown', path=path)
+
+args = list()
+
+found = False
+for i in sys.argv:
+ if i.startswith("-"):
+ args.append(i)
+ continue
+ if not found:
+ args.append("root:root")
+ found = True
+ else:
+ args.append(i)
+
+os.execv(real_chown, args)
--
2.32.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] gcc: Drop no longer needed patch
2021-11-25 15:22 [PATCH 1/3] nativesdk: Handle chown/chgrp calls in nativesdk do_install tasks Richard Purdie
@ 2021-11-25 15:22 ` Richard Purdie
2021-11-25 17:47 ` [OE-core] " Khem Raj
2021-11-25 15:22 ` [PATCH 3/3] gcc: Drop mips default ABI patch Richard Purdie
1 sibling, 1 reply; 5+ messages in thread
From: Richard Purdie @ 2021-11-25 15:22 UTC (permalink / raw)
To: openembedded-core
This patch was mentioned upstream a long time ago:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47256
Changes from gcc 10 onward mean it is no longer needed as mentioned in the
above bug report. Drop the patch.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
meta/recipes-devtools/gcc/gcc-11.2.inc | 1 -
.../gcc/gcc/0006-COLLECT_GCC_OPTIONS.patch | 35 -------------------
2 files changed, 36 deletions(-)
delete mode 100644 meta/recipes-devtools/gcc/gcc/0006-COLLECT_GCC_OPTIONS.patch
diff --git a/meta/recipes-devtools/gcc/gcc-11.2.inc b/meta/recipes-devtools/gcc/gcc-11.2.inc
index baced2a4007..b4e4300c66b 100644
--- a/meta/recipes-devtools/gcc/gcc-11.2.inc
+++ b/meta/recipes-devtools/gcc/gcc-11.2.inc
@@ -34,7 +34,6 @@ SRC_URI = "\
file://0002-gcc-poison-system-directories.patch \
file://0004-64-bit-multilib-hack.patch \
file://0005-optional-libstdc.patch \
- file://0006-COLLECT_GCC_OPTIONS.patch \
file://0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \
file://0009-cpp-honor-sysroot.patch \
file://0010-MIPS64-Default-to-N64-ABI.patch \
diff --git a/meta/recipes-devtools/gcc/gcc/0006-COLLECT_GCC_OPTIONS.patch b/meta/recipes-devtools/gcc/gcc/0006-COLLECT_GCC_OPTIONS.patch
deleted file mode 100644
index 265ca0e2187..00000000000
--- a/meta/recipes-devtools/gcc/gcc/0006-COLLECT_GCC_OPTIONS.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 127716a32a11ca2a6b3aac068054bfc69c4dcfd8 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 29 Mar 2013 09:16:28 +0400
-Subject: [PATCH] COLLECT_GCC_OPTIONS
-
-This patch adds --sysroot into COLLECT_GCC_OPTIONS which is used to
-invoke collect2.
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Upstream-Status: Pending
----
- gcc/gcc.c | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
-diff --git a/gcc/gcc.c b/gcc/gcc.c
-index be7630ffd8c..1bc45285384 100644
---- a/gcc/gcc.c
-+++ b/gcc/gcc.c
-@@ -5383,6 +5383,15 @@ set_collect_gcc_options (void)
- sizeof ("COLLECT_GCC_OPTIONS=") - 1);
-
- first_time = TRUE;
-+#ifdef HAVE_LD_SYSROOT
-+ if (target_system_root_changed && target_system_root)
-+ {
-+ obstack_grow (&collect_obstack, "'--sysroot=", sizeof("'--sysroot=")-1);
-+ obstack_grow (&collect_obstack, target_system_root,strlen(target_system_root));
-+ obstack_grow (&collect_obstack, "'", 1);
-+ first_time = FALSE;
-+ }
-+#endif
- for (i = 0; (int) i < n_switches; i++)
- {
- const char *const *args;
--
2.32.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] gcc: Drop mips default ABI patch
2021-11-25 15:22 [PATCH 1/3] nativesdk: Handle chown/chgrp calls in nativesdk do_install tasks Richard Purdie
2021-11-25 15:22 ` [PATCH 2/3] gcc: Drop no longer needed patch Richard Purdie
@ 2021-11-25 15:22 ` Richard Purdie
2021-11-25 17:51 ` [OE-core] " Khem Raj
1 sibling, 1 reply; 5+ messages in thread
From: Richard Purdie @ 2021-11-25 15:22 UTC (permalink / raw)
To: openembedded-core
gcc-configure-common.inc already sets --with-abi=64 for our mips64
targets so this patch is no longer needed.
[YOCTO #14639]
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
meta/recipes-devtools/gcc/gcc-11.2.inc | 1 -
.../gcc/0010-MIPS64-Default-to-N64-ABI.patch | 54 -------------------
2 files changed, 55 deletions(-)
delete mode 100644 meta/recipes-devtools/gcc/gcc/0010-MIPS64-Default-to-N64-ABI.patch
diff --git a/meta/recipes-devtools/gcc/gcc-11.2.inc b/meta/recipes-devtools/gcc/gcc-11.2.inc
index b4e4300c66b..afb8f2df5c2 100644
--- a/meta/recipes-devtools/gcc/gcc-11.2.inc
+++ b/meta/recipes-devtools/gcc/gcc-11.2.inc
@@ -36,7 +36,6 @@ SRC_URI = "\
file://0005-optional-libstdc.patch \
file://0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \
file://0009-cpp-honor-sysroot.patch \
- file://0010-MIPS64-Default-to-N64-ABI.patch \
file://0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \
file://0012-gcc-Fix-argument-list-too-long-error.patch \
file://0014-libtool.patch \
diff --git a/meta/recipes-devtools/gcc/gcc/0010-MIPS64-Default-to-N64-ABI.patch b/meta/recipes-devtools/gcc/gcc/0010-MIPS64-Default-to-N64-ABI.patch
deleted file mode 100644
index f385f8c5a20..00000000000
--- a/meta/recipes-devtools/gcc/gcc/0010-MIPS64-Default-to-N64-ABI.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From a2dc2fa4cc7e5d54544d4a7b6601eef79bc26cad Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 29 Mar 2013 09:23:08 +0400
-Subject: [PATCH] MIPS64: Default to N64 ABI
-
-MIPS64 defaults to n32 ABI, this patch makes it
-so that it defaults to N64 ABI
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Upstream-Status: Inappropriate [OE config specific]
----
- gcc/config.gcc | 10 +++++-----
- 1 file changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/gcc/config.gcc b/gcc/config.gcc
-index 3ec7582f5dd..a046fa6945c 100644
---- a/gcc/config.gcc
-+++ b/gcc/config.gcc
-@@ -2543,29 +2543,29 @@ mips*-*-linux*) # Linux MIPS, either endian.
- default_mips_arch=mips32
- ;;
- mips64el-st-linux-gnu)
-- default_mips_abi=n32
-+ default_mips_abi=64
- tm_file="${tm_file} mips/st.h"
- tmake_file="${tmake_file} mips/t-st"
- enable_mips_multilibs="yes"
- ;;
- mips64octeon*-*-linux*)
-- default_mips_abi=n32
-+ default_mips_abi=64
- tm_defines="${tm_defines} MIPS_CPU_STRING_DEFAULT=\\\"octeon\\\""
- target_cpu_default=MASK_SOFT_FLOAT_ABI
- enable_mips_multilibs="yes"
- ;;
- mipsisa64r6*-*-linux*)
-- default_mips_abi=n32
-+ default_mips_abi=64
- default_mips_arch=mips64r6
- enable_mips_multilibs="yes"
- ;;
- mipsisa64r2*-*-linux*)
-- default_mips_abi=n32
-+ default_mips_abi=64
- default_mips_arch=mips64r2
- enable_mips_multilibs="yes"
- ;;
- mips64*-*-linux* | mipsisa64*-*-linux*)
-- default_mips_abi=n32
-+ default_mips_abi=64
- enable_mips_multilibs="yes"
- ;;
- esac
--
2.32.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [OE-core] [PATCH 2/3] gcc: Drop no longer needed patch
2021-11-25 15:22 ` [PATCH 2/3] gcc: Drop no longer needed patch Richard Purdie
@ 2021-11-25 17:47 ` Khem Raj
0 siblings, 0 replies; 5+ messages in thread
From: Khem Raj @ 2021-11-25 17:47 UTC (permalink / raw)
To: Richard Purdie, openembedded-core
On 11/25/21 7:22 AM, Richard Purdie wrote:
> This patch was mentioned upstream a long time ago:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47256
>
> Changes from gcc 10 onward mean it is no longer needed as mentioned in the
> above bug report. Drop the patch.
>
this looks ok.
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
> meta/recipes-devtools/gcc/gcc-11.2.inc | 1 -
> .../gcc/gcc/0006-COLLECT_GCC_OPTIONS.patch | 35 -------------------
> 2 files changed, 36 deletions(-)
> delete mode 100644 meta/recipes-devtools/gcc/gcc/0006-COLLECT_GCC_OPTIONS.patch
>
> diff --git a/meta/recipes-devtools/gcc/gcc-11.2.inc b/meta/recipes-devtools/gcc/gcc-11.2.inc
> index baced2a4007..b4e4300c66b 100644
> --- a/meta/recipes-devtools/gcc/gcc-11.2.inc
> +++ b/meta/recipes-devtools/gcc/gcc-11.2.inc
> @@ -34,7 +34,6 @@ SRC_URI = "\
> file://0002-gcc-poison-system-directories.patch \
> file://0004-64-bit-multilib-hack.patch \
> file://0005-optional-libstdc.patch \
> - file://0006-COLLECT_GCC_OPTIONS.patch \
> file://0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \
> file://0009-cpp-honor-sysroot.patch \
> file://0010-MIPS64-Default-to-N64-ABI.patch \
> diff --git a/meta/recipes-devtools/gcc/gcc/0006-COLLECT_GCC_OPTIONS.patch b/meta/recipes-devtools/gcc/gcc/0006-COLLECT_GCC_OPTIONS.patch
> deleted file mode 100644
> index 265ca0e2187..00000000000
> --- a/meta/recipes-devtools/gcc/gcc/0006-COLLECT_GCC_OPTIONS.patch
> +++ /dev/null
> @@ -1,35 +0,0 @@
> -From 127716a32a11ca2a6b3aac068054bfc69c4dcfd8 Mon Sep 17 00:00:00 2001
> -From: Khem Raj <raj.khem@gmail.com>
> -Date: Fri, 29 Mar 2013 09:16:28 +0400
> -Subject: [PATCH] COLLECT_GCC_OPTIONS
> -
> -This patch adds --sysroot into COLLECT_GCC_OPTIONS which is used to
> -invoke collect2.
> -
> -Signed-off-by: Khem Raj <raj.khem@gmail.com>
> -
> -Upstream-Status: Pending
> ----
> - gcc/gcc.c | 9 +++++++++
> - 1 file changed, 9 insertions(+)
> -
> -diff --git a/gcc/gcc.c b/gcc/gcc.c
> -index be7630ffd8c..1bc45285384 100644
> ---- a/gcc/gcc.c
> -+++ b/gcc/gcc.c
> -@@ -5383,6 +5383,15 @@ set_collect_gcc_options (void)
> - sizeof ("COLLECT_GCC_OPTIONS=") - 1);
> -
> - first_time = TRUE;
> -+#ifdef HAVE_LD_SYSROOT
> -+ if (target_system_root_changed && target_system_root)
> -+ {
> -+ obstack_grow (&collect_obstack, "'--sysroot=", sizeof("'--sysroot=")-1);
> -+ obstack_grow (&collect_obstack, target_system_root,strlen(target_system_root));
> -+ obstack_grow (&collect_obstack, "'", 1);
> -+ first_time = FALSE;
> -+ }
> -+#endif
> - for (i = 0; (int) i < n_switches; i++)
> - {
> - const char *const *args;
>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#158781): https://lists.openembedded.org/g/openembedded-core/message/158781
> Mute This Topic: https://lists.openembedded.org/mt/87304168/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-core] [PATCH 3/3] gcc: Drop mips default ABI patch
2021-11-25 15:22 ` [PATCH 3/3] gcc: Drop mips default ABI patch Richard Purdie
@ 2021-11-25 17:51 ` Khem Raj
0 siblings, 0 replies; 5+ messages in thread
From: Khem Raj @ 2021-11-25 17:51 UTC (permalink / raw)
To: Richard Purdie, openembedded-core
On 11/25/21 7:22 AM, Richard Purdie wrote:
> gcc-configure-common.inc already sets --with-abi=64 for our mips64
> targets so this patch is no longer needed.
sounds good. Long time ago, IIRC it did not work for compiling the
target gcc so it has to be enforced but I agree one less patch is better
now.
>
> [YOCTO #14639]
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
> meta/recipes-devtools/gcc/gcc-11.2.inc | 1 -
> .../gcc/0010-MIPS64-Default-to-N64-ABI.patch | 54 -------------------
> 2 files changed, 55 deletions(-)
> delete mode 100644 meta/recipes-devtools/gcc/gcc/0010-MIPS64-Default-to-N64-ABI.patch
>
> diff --git a/meta/recipes-devtools/gcc/gcc-11.2.inc b/meta/recipes-devtools/gcc/gcc-11.2.inc
> index b4e4300c66b..afb8f2df5c2 100644
> --- a/meta/recipes-devtools/gcc/gcc-11.2.inc
> +++ b/meta/recipes-devtools/gcc/gcc-11.2.inc
> @@ -36,7 +36,6 @@ SRC_URI = "\
> file://0005-optional-libstdc.patch \
> file://0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \
> file://0009-cpp-honor-sysroot.patch \
> - file://0010-MIPS64-Default-to-N64-ABI.patch \
> file://0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \
> file://0012-gcc-Fix-argument-list-too-long-error.patch \
> file://0014-libtool.patch \
> diff --git a/meta/recipes-devtools/gcc/gcc/0010-MIPS64-Default-to-N64-ABI.patch b/meta/recipes-devtools/gcc/gcc/0010-MIPS64-Default-to-N64-ABI.patch
> deleted file mode 100644
> index f385f8c5a20..00000000000
> --- a/meta/recipes-devtools/gcc/gcc/0010-MIPS64-Default-to-N64-ABI.patch
> +++ /dev/null
> @@ -1,54 +0,0 @@
> -From a2dc2fa4cc7e5d54544d4a7b6601eef79bc26cad Mon Sep 17 00:00:00 2001
> -From: Khem Raj <raj.khem@gmail.com>
> -Date: Fri, 29 Mar 2013 09:23:08 +0400
> -Subject: [PATCH] MIPS64: Default to N64 ABI
> -
> -MIPS64 defaults to n32 ABI, this patch makes it
> -so that it defaults to N64 ABI
> -
> -Signed-off-by: Khem Raj <raj.khem@gmail.com>
> -
> -Upstream-Status: Inappropriate [OE config specific]
> ----
> - gcc/config.gcc | 10 +++++-----
> - 1 file changed, 5 insertions(+), 5 deletions(-)
> -
> -diff --git a/gcc/config.gcc b/gcc/config.gcc
> -index 3ec7582f5dd..a046fa6945c 100644
> ---- a/gcc/config.gcc
> -+++ b/gcc/config.gcc
> -@@ -2543,29 +2543,29 @@ mips*-*-linux*) # Linux MIPS, either endian.
> - default_mips_arch=mips32
> - ;;
> - mips64el-st-linux-gnu)
> -- default_mips_abi=n32
> -+ default_mips_abi=64
> - tm_file="${tm_file} mips/st.h"
> - tmake_file="${tmake_file} mips/t-st"
> - enable_mips_multilibs="yes"
> - ;;
> - mips64octeon*-*-linux*)
> -- default_mips_abi=n32
> -+ default_mips_abi=64
> - tm_defines="${tm_defines} MIPS_CPU_STRING_DEFAULT=\\\"octeon\\\""
> - target_cpu_default=MASK_SOFT_FLOAT_ABI
> - enable_mips_multilibs="yes"
> - ;;
> - mipsisa64r6*-*-linux*)
> -- default_mips_abi=n32
> -+ default_mips_abi=64
> - default_mips_arch=mips64r6
> - enable_mips_multilibs="yes"
> - ;;
> - mipsisa64r2*-*-linux*)
> -- default_mips_abi=n32
> -+ default_mips_abi=64
> - default_mips_arch=mips64r2
> - enable_mips_multilibs="yes"
> - ;;
> - mips64*-*-linux* | mipsisa64*-*-linux*)
> -- default_mips_abi=n32
> -+ default_mips_abi=64
> - enable_mips_multilibs="yes"
> - ;;
> - esac
>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#158783): https://lists.openembedded.org/g/openembedded-core/message/158783
> Mute This Topic: https://lists.openembedded.org/mt/87304170/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-11-25 17:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-25 15:22 [PATCH 1/3] nativesdk: Handle chown/chgrp calls in nativesdk do_install tasks Richard Purdie
2021-11-25 15:22 ` [PATCH 2/3] gcc: Drop no longer needed patch Richard Purdie
2021-11-25 17:47 ` [OE-core] " Khem Raj
2021-11-25 15:22 ` [PATCH 3/3] gcc: Drop mips default ABI patch Richard Purdie
2021-11-25 17:51 ` [OE-core] " Khem Raj
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.