* [PATCH 1/4] qemuwrapper: use fallback in case the ELF binary is wrong
2013-04-25 12:23 [PATCH 0/4] Multilib related postinstall fixes Laurentiu Palcu
@ 2013-04-25 12:23 ` Laurentiu Palcu
2013-04-25 12:23 ` [PATCH 2/4] pango: fix postinstall when using multilib Laurentiu Palcu
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Laurentiu Palcu @ 2013-04-25 12:23 UTC (permalink / raw)
To: openembedded-core
This wrapper script is called mainly from intercept hooks and allarch
packages postinstalls. When multilib is used, the qemuwrapper script
points to the binary that matches the MACHINE architecture.
For example: if MACHINE=qemux86_64 and we activate multilib, then the
postinstalls for lib32 packages would call qemu-x86_64 with 32 bit
binaries and they would certainly fail.
This patch adds just a fallback method if the exit code of the previous
qemu call corresponds to "Invalid ELF image for this architecture"
error. This will allow us to have all postinstalls run on host.
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
.../recipes-devtools/qemu/qemuwrapper-cross_1.0.bb | 28 +++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb b/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb
index 41617a6..18f1892 100644
--- a/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb
+++ b/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb
@@ -9,7 +9,33 @@ do_install () {
install -d ${D}${bindir_crossscripts}/
echo "#!/bin/sh" > ${D}${bindir_crossscripts}/qemuwrapper
- echo exec env ${@qemu_target_binary(d)} \"\$@\" >> ${D}${bindir_crossscripts}/qemuwrapper
+ qemu_binary=${@qemu_target_binary(d)}
+ echo "$qemu_binary \"\$@\"" >> ${D}${bindir_crossscripts}/qemuwrapper
+ fallback_qemu_bin=
+ case $qemu_binary in
+ "qemu-i386")
+ fallback_qemu_bin=qemu-x86_64
+ ;;
+ "qemu-x86_64")
+ fallback_qemu_bin=qemu-i386
+ ;;
+ *)
+ ;;
+ esac
+
+ if [ -n "$fallback_qemu_bin" ]; then
+
+ cat >> ${D}${bindir_crossscripts}/qemuwrapper << EOF
+rc=\$?
+if [ \$rc = 255 ]; then
+ $fallback_qemu_bin "\$@"
+ rc=\$?
+fi
+exit \$rc
+EOF
+
+ fi
+
chmod +x ${D}${bindir_crossscripts}/qemuwrapper
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/4] pango: fix postinstall when using multilib
2013-04-25 12:23 [PATCH 0/4] Multilib related postinstall fixes Laurentiu Palcu
2013-04-25 12:23 ` [PATCH 1/4] qemuwrapper: use fallback in case the ELF binary is wrong Laurentiu Palcu
@ 2013-04-25 12:23 ` Laurentiu Palcu
2013-04-25 12:23 ` [PATCH 3/4] Revert "qemu.bbclass: Use the correct qemu binary in multilib cases" Laurentiu Palcu
2013-04-25 12:24 ` [PATCH 4/4] scripts/postinst-intercepts: create separete hooks for multilib Laurentiu Palcu
3 siblings, 0 replies; 7+ messages in thread
From: Laurentiu Palcu @ 2013-04-25 12:23 UTC (permalink / raw)
To: openembedded-core
The pango-query-modules binary gets a multilib prefix and the
postinstall has to call the appropriate binary.
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
meta/recipes-graphics/pango/pango.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/recipes-graphics/pango/pango.inc b/meta/recipes-graphics/pango/pango.inc
index f622903..52dd064 100644
--- a/meta/recipes-graphics/pango/pango.inc
+++ b/meta/recipes-graphics/pango/pango.inc
@@ -49,7 +49,7 @@ if ! [ -e $D${sysconfdir}/pango ] ; then
fi
if [ "x$D" != "x" ]; then
- ${@qemu_run_binary(d, '$D','/usr/bin/pango-querymodules')} \
+ ${@qemu_run_binary(d, '$D','${bindir}/${MLPREFIX}pango-querymodules')} \
$D${libdir}/pango/${LIBV}/modules/*.so \
> $D${sysconfdir}/pango/${MLPREFIX}pango.modules 2>/dev/null
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/4] Revert "qemu.bbclass: Use the correct qemu binary in multilib cases"
2013-04-25 12:23 [PATCH 0/4] Multilib related postinstall fixes Laurentiu Palcu
2013-04-25 12:23 ` [PATCH 1/4] qemuwrapper: use fallback in case the ELF binary is wrong Laurentiu Palcu
2013-04-25 12:23 ` [PATCH 2/4] pango: fix postinstall when using multilib Laurentiu Palcu
@ 2013-04-25 12:23 ` Laurentiu Palcu
2013-04-25 12:24 ` [PATCH 4/4] scripts/postinst-intercepts: create separete hooks for multilib Laurentiu Palcu
3 siblings, 0 replies; 7+ messages in thread
From: Laurentiu Palcu @ 2013-04-25 12:23 UTC (permalink / raw)
To: openembedded-core
This reverts commit 9f5a6f89d9f4a6c7bed3b163e6eaa764d762f523.
The reason for reverting this is:
* qemuwrapper has now a fallback method;
* when using multilib, calling qemu_target_binary from recipes would
always point to the qemu binary corresponding to the machine
architecture. Hence, postinstalls needing to use qemu would call the
wrong qemu user emulation binary;
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
meta/classes/qemu.bbclass | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/meta/classes/qemu.bbclass b/meta/classes/qemu.bbclass
index 930c6b0..3d437b0 100644
--- a/meta/classes/qemu.bbclass
+++ b/meta/classes/qemu.bbclass
@@ -4,9 +4,7 @@
#
def qemu_target_binary(data):
- target_arch = data.getVar("TARGET_ARCH_MULTILIB_ORIGINAL", True)
- if not target_arch:
- target_arch = data.getVar("TARGET_ARCH", True)
+ target_arch = data.getVar("TARGET_ARCH", True)
if target_arch in ("i486", "i586", "i686"):
target_arch = "i386"
elif target_arch == "powerpc":
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 4/4] scripts/postinst-intercepts: create separete hooks for multilib
2013-04-25 12:23 [PATCH 0/4] Multilib related postinstall fixes Laurentiu Palcu
` (2 preceding siblings ...)
2013-04-25 12:23 ` [PATCH 3/4] Revert "qemu.bbclass: Use the correct qemu binary in multilib cases" Laurentiu Palcu
@ 2013-04-25 12:24 ` Laurentiu Palcu
2013-04-25 13:51 ` Mark Hatle
3 siblings, 1 reply; 7+ messages in thread
From: Laurentiu Palcu @ 2013-04-25 12:24 UTC (permalink / raw)
To: openembedded-core
When using multilib, the hooks for lib32/lib64 must be different because
the libdir/base_libdir point to different locations. Nothing has to be
done in the postinstalls for this. When a hook is installed, it will be
detected automatically if this is a ML package (from the libXX- package
prefix) and a separate hook will be created.
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
scripts/postinst-intercepts/postinst_intercept | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/scripts/postinst-intercepts/postinst_intercept b/scripts/postinst-intercepts/postinst_intercept
index ed32f27..5969eba 100755
--- a/scripts/postinst-intercepts/postinst_intercept
+++ b/scripts/postinst-intercepts/postinst_intercept
@@ -17,9 +17,27 @@
intercept_script=$INTERCEPT_DIR/$1 && shift
package_name=$1 && shift
+mlprefix=$(echo $package_name|sed -rn 's/^(lib32|lib64|libx32)-.*/\1/p')
+# if the hook we want to install does not exist, then there's nothing we can do
[ -f "$intercept_script" ] || exit 1
+# if the postinstall wanting to install the hook belongs to a multilib package,
+# then we'd better have a separate hook for this because the default ${libdir} and
+# ${base_libdir} will point to the wrong locations
+if [ -n "$mlprefix" ]; then
+ ml_intercept_script=$intercept_script-$mlprefix
+ # if the multilib hook does not exist, create it from the default one
+ if [ ! -f "$ml_intercept_script" ]; then
+ cp $intercept_script $ml_intercept_script
+
+ # clear the ##PKGS: line and the already set variables
+ [ -x "$ml_intercept_script" ] && sed -i -e "2,$(($#+1)) {/.*/d}" -e "/^##PKGS: .*/d" $ml_intercept_script
+ fi
+
+ intercept_script=$ml_intercept_script
+fi
+
chmod +x "$intercept_script"
pkgs_line="$(cat $intercept_script|grep "##PKGS:")"
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 4/4] scripts/postinst-intercepts: create separete hooks for multilib
2013-04-25 12:24 ` [PATCH 4/4] scripts/postinst-intercepts: create separete hooks for multilib Laurentiu Palcu
@ 2013-04-25 13:51 ` Mark Hatle
2013-04-25 14:32 ` Laurentiu Palcu
0 siblings, 1 reply; 7+ messages in thread
From: Mark Hatle @ 2013-04-25 13:51 UTC (permalink / raw)
To: openembedded-core
On 4/25/13 7:24 AM, Laurentiu Palcu wrote:
> When using multilib, the hooks for lib32/lib64 must be different because
> the libdir/base_libdir point to different locations. Nothing has to be
> done in the postinstalls for this. When a hook is installed, it will be
> detected automatically if this is a ML package (from the libXX- package
> prefix) and a separate hook will be created.
>
> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
> ---
> scripts/postinst-intercepts/postinst_intercept | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/scripts/postinst-intercepts/postinst_intercept b/scripts/postinst-intercepts/postinst_intercept
> index ed32f27..5969eba 100755
> --- a/scripts/postinst-intercepts/postinst_intercept
> +++ b/scripts/postinst-intercepts/postinst_intercept
> @@ -17,9 +17,27 @@
>
> intercept_script=$INTERCEPT_DIR/$1 && shift
> package_name=$1 && shift
> +mlprefix=$(echo $package_name|sed -rn 's/^(lib32|lib64|libx32)-.*/\1/p')
The mlprefix is theoretically arbitrary. It would be better to base the parse
list off of a given machines available multilibs. If you can dump the multilib
list from bitbake, that would be best.
> +# if the hook we want to install does not exist, then there's nothing we can do
> [ -f "$intercept_script" ] || exit 1
>
> +# if the postinstall wanting to install the hook belongs to a multilib package,
> +# then we'd better have a separate hook for this because the default ${libdir} and
> +# ${base_libdir} will point to the wrong locations
> +if [ -n "$mlprefix" ]; then
> + ml_intercept_script=$intercept_script-$mlprefix
> + # if the multilib hook does not exist, create it from the default one
> + if [ ! -f "$ml_intercept_script" ]; then
> + cp $intercept_script $ml_intercept_script
> +
> + # clear the ##PKGS: line and the already set variables
> + [ -x "$ml_intercept_script" ] && sed -i -e "2,$(($#+1)) {/.*/d}" -e "/^##PKGS: .*/d" $ml_intercept_script
> + fi
> +
> + intercept_script=$ml_intercept_script
> +fi
> +
> chmod +x "$intercept_script"
>
> pkgs_line="$(cat $intercept_script|grep "##PKGS:")"
>
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 4/4] scripts/postinst-intercepts: create separete hooks for multilib
2013-04-25 13:51 ` Mark Hatle
@ 2013-04-25 14:32 ` Laurentiu Palcu
0 siblings, 0 replies; 7+ messages in thread
From: Laurentiu Palcu @ 2013-04-25 14:32 UTC (permalink / raw)
To: Mark Hatle; +Cc: openembedded-core
On 04/25/2013 04:51 PM, Mark Hatle wrote:
> On 4/25/13 7:24 AM, Laurentiu Palcu wrote:
>> When using multilib, the hooks for lib32/lib64 must be different because
>> the libdir/base_libdir point to different locations. Nothing has to be
>> done in the postinstalls for this. When a hook is installed, it will be
>> detected automatically if this is a ML package (from the libXX- package
>> prefix) and a separate hook will be created.
>>
>> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
>> ---
>> scripts/postinst-intercepts/postinst_intercept | 18 ++++++++++++++++++
>> 1 file changed, 18 insertions(+)
>>
>> diff --git a/scripts/postinst-intercepts/postinst_intercept b/scripts/postinst-intercepts/postinst_intercept
>> index ed32f27..5969eba 100755
>> --- a/scripts/postinst-intercepts/postinst_intercept
>> +++ b/scripts/postinst-intercepts/postinst_intercept
>> @@ -17,9 +17,27 @@
>>
>> intercept_script=$INTERCEPT_DIR/$1 && shift
>> package_name=$1 && shift
>> +mlprefix=$(echo $package_name|sed -rn 's/^(lib32|lib64|libx32)-.*/\1/p')
>
> The mlprefix is theoretically arbitrary. It would be better to base the parse
> list off of a given machines available multilibs. If you can dump the multilib
> list from bitbake, that would be best.
OK, I understand your concern... I could probably pass
mlprefix=${MLPREFIX} as a third argument to all calls to
postinst_intercept script instead. I'll rework it and send a v2.
Thanks,
Laurentiu
^ permalink raw reply [flat|nested] 7+ messages in thread