Patchwork [4/4] qemu: add bash and python to qemu's RDEPENDS

login
register
mail settings
Submitter Hongxu Jia
Date Nov. 22, 2013, 5:58 a.m.
Message ID <528EF295.9040704@windriver.com>
Download mbox | patch
Permalink /patch/62197/
State New
Headers show

Comments

Hongxu Jia - Nov. 22, 2013, 5:58 a.m.
On 11/22/2013 03:42 AM, Saul Wold wrote:
> On 11/21/2013 11:40 AM, Mark Hatle wrote:
>> On 11/21/13, 12:42 PM, Saul Wold wrote:
>>>
>>> Why are you adding bash to qemu?
>>
>> My understanding is that there was a bash script that was added as well,
>> once the python rdepends was resolved.
>>
> Any chance of "de-bashing" the script?
>

Hi Saul,

How about to de-bash the script by the following patch:
...

  require qemu-targets.inc
  inherit autotools
@@ -76,6 +77,12 @@ do_install_append() {
                 create_wrapper ${D}/${bindir}/qemu-mips \
                         QEMU_RESERVED_VA=0x0
         fi
+
+       # De-bashing the script
+       files=`grep "^\#\! *.*\/bash" ${D} -rl`
+       for f in $files; do
+                 sed -i "s:^#! *.*/bash:#! /bin/sh:" $f
+       done
  }
  # END of qemu-mips workaround
...

The build test is ok.

//Hongxu

> Sau!
>> --Mark
>>
>>> Sau!
>>>
>>>
>>> On 11/21/2013 05:14 AM, Hongxu Jia wrote:
>>>> | Note: adding Smart RPM DB channel
>>>> |
>>>> | Note: to be installed:  qemu@x86_64 run-postinsts@x86_64
>>>> kernel-modules@qemux86_64 packagegroup-core-boot@qemux86_64
>>>> | Loading cache...
>>>> | Updating cache...
>>>> ######################################## [100%]
>>>> |
>>>> | Computing transaction...error: Can't install
>>>> qemu-1.5.0-r0.0@x86_64: no package provides /usr/bin/python
>>>> |
>>>> | Saving cache...
>>>> |
>>>> | WARNING: exit code 1 from a shell command.
>>>> | ERROR: Function failed: do_rootfs (log file is located at
>>>> tmp/work/qemux86_64-wrs-linux/wrlinux-image-glibc-small/1.0-r1/temp/do_rootfs/log.do_rootfs.21373) 
>>>>
>>>>
>>>>
>>>> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
>>>> ---
>>>>    meta/recipes-devtools/qemu/qemu.inc | 1 +
>>>>    1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/meta/recipes-devtools/qemu/qemu.inc
>>>> b/meta/recipes-devtools/qemu/qemu.inc
>>>> index 21ce489..3f3431d 100644
>>>> --- a/meta/recipes-devtools/qemu/qemu.inc
>>>> +++ b/meta/recipes-devtools/qemu/qemu.inc
>>>> @@ -5,6 +5,7 @@ DEPENDS = "glib-2.0 zlib alsa-lib virtual/libx11
>>>> pixman dtc libsdl"
>>>>    DEPENDS_class-native = "zlib-native alsa-lib-native
>>>> glib-2.0-native pixman-native dtc-native"
>>>>    DEPENDS_class-nativesdk = "nativesdk-zlib nativesdk-libsdl
>>>> nativesdk-glib-2.0 nativesdk-pixman nativesdk-dtc"
>>>>    RDEPENDS_${PN}_class-nativesdk = "nativesdk-libsdl"
>>>> +RDEPENDS_${PN}_class-target += "bash python"
>>>>
>>>>    require qemu-targets.inc
>>>>    inherit autotools
>>>>
>>>
>>> _______________________________________________
>>> Openembedded-core mailing list
>>> Openembedded-core@lists.openembedded.org
>>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>>>
>>
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>>
>>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
Hongxu Jia - Nov. 22, 2013, 6:25 a.m.
On 11/22/2013 01:58 PM, Hongxu Jia wrote:
> On 11/22/2013 03:42 AM, Saul Wold wrote:
>> On 11/21/2013 11:40 AM, Mark Hatle wrote:
>>> On 11/21/13, 12:42 PM, Saul Wold wrote:
>>>>
>>>> Why are you adding bash to qemu?
>>>
>>> My understanding is that there was a bash script that was added as 
>>> well,
>>> once the python rdepends was resolved.
>>>
>> Any chance of "de-bashing" the script?
>>
>

Hi Saul,

The script could not be de-bashed,  it was made by create_wrapper
which is bashism:
Vim image/usr/bin/qemu-mips
...
#! /bin/bash
realpath=`readlink -fn $0`
export QEMU_RESERVED_VA=0x0
exec -a `dirname $realpath`/qemu-mips `dirname $realpath`/qemu-mips.real 
"$@"
...

The exec's -a option is bashism, so we need to add bash to RDEPENDS.

//Hongxu

> Hi Saul,
>
> How about to de-bash the script by the following patch:
> ...
> --- a/meta/recipes-devtools/qemu/qemu.inc
> +++ b/meta/recipes-devtools/qemu/qemu.inc
> @@ -5,6 +5,7 @@ DEPENDS = "glib-2.0 zlib alsa-lib virtual/libx11 
> pixman dtc libsdl"
>  DEPENDS_class-native = "zlib-native alsa-lib-native glib-2.0-native 
> pixman-native dtc-native"
>  DEPENDS_class-nativesdk = "nativesdk-zlib nativesdk-libsdl 
> nativesdk-glib-2.0 nativesdk-pixman nativesdk-dtc"
>  RDEPENDS_${PN}_class-nativesdk = "nativesdk-libsdl"
> +RDEPENDS_${PN}_class-target += "python"
>
>  require qemu-targets.inc
>  inherit autotools
> @@ -76,6 +77,12 @@ do_install_append() {
>                 create_wrapper ${D}/${bindir}/qemu-mips \
>                         QEMU_RESERVED_VA=0x0
>         fi
> +
> +       # De-bashing the script
> +       files=`grep "^\#\! *.*\/bash" ${D} -rl`
> +       for f in $files; do
> +                 sed -i "s:^#! *.*/bash:#! /bin/sh:" $f
> +       done
>  }
>  # END of qemu-mips workaround
> ...
>
> The build test is ok.
>
> //Hongxu
>
>> Sau!
>>> --Mark
>>>
>>>> Sau!
>>>>
>>>>
>>>> On 11/21/2013 05:14 AM, Hongxu Jia wrote:
>>>>> | Note: adding Smart RPM DB channel
>>>>> |
>>>>> | Note: to be installed:  qemu@x86_64 run-postinsts@x86_64
>>>>> kernel-modules@qemux86_64 packagegroup-core-boot@qemux86_64
>>>>> | Loading cache...
>>>>> | Updating cache...
>>>>> ######################################## [100%]
>>>>> |
>>>>> | Computing transaction...error: Can't install
>>>>> qemu-1.5.0-r0.0@x86_64: no package provides /usr/bin/python
>>>>> |
>>>>> | Saving cache...
>>>>> |
>>>>> | WARNING: exit code 1 from a shell command.
>>>>> | ERROR: Function failed: do_rootfs (log file is located at
>>>>> tmp/work/qemux86_64-wrs-linux/wrlinux-image-glibc-small/1.0-r1/temp/do_rootfs/log.do_rootfs.21373) 
>>>>>
>>>>>
>>>>>
>>>>> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
>>>>> ---
>>>>>    meta/recipes-devtools/qemu/qemu.inc | 1 +
>>>>>    1 file changed, 1 insertion(+)
>>>>>
>>>>> diff --git a/meta/recipes-devtools/qemu/qemu.inc
>>>>> b/meta/recipes-devtools/qemu/qemu.inc
>>>>> index 21ce489..3f3431d 100644
>>>>> --- a/meta/recipes-devtools/qemu/qemu.inc
>>>>> +++ b/meta/recipes-devtools/qemu/qemu.inc
>>>>> @@ -5,6 +5,7 @@ DEPENDS = "glib-2.0 zlib alsa-lib virtual/libx11
>>>>> pixman dtc libsdl"
>>>>>    DEPENDS_class-native = "zlib-native alsa-lib-native
>>>>> glib-2.0-native pixman-native dtc-native"
>>>>>    DEPENDS_class-nativesdk = "nativesdk-zlib nativesdk-libsdl
>>>>> nativesdk-glib-2.0 nativesdk-pixman nativesdk-dtc"
>>>>>    RDEPENDS_${PN}_class-nativesdk = "nativesdk-libsdl"
>>>>> +RDEPENDS_${PN}_class-target += "bash python"
>>>>>
>>>>>    require qemu-targets.inc
>>>>>    inherit autotools
>>>>>
>>>>
>>>> _______________________________________________
>>>> Openembedded-core mailing list
>>>> Openembedded-core@lists.openembedded.org
>>>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>>>>
>>>
>>> _______________________________________________
>>> Openembedded-core mailing list
>>> Openembedded-core@lists.openembedded.org
>>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>>>
>>>
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
Olof Johansson - Nov. 22, 2013, 8:32 a.m.
On 13-11-22 07:25 +0100, Hongxu Jia wrote:
> Hi Saul,
> 
> The script could not be de-bashed,  it was made by create_wrapper
> which is bashism:
> Vim image/usr/bin/qemu-mips
> ...
> #! /bin/bash
> realpath=`readlink -fn $0`
> export QEMU_RESERVED_VA=0x0
> exec -a `dirname $realpath`/qemu-mips `dirname $realpath`/qemu-mips.real "$@"
> ...
> 
> The exec's -a option is bashism, so we need to add bash to RDEPENDS.

1) Is the wrapper still necessary?

The comment above the do_install_append in the recipe:

# The following fragment will create a wrapper for qemu-mips user emulation
# binary in order to work around a segmentation fault issue. Basically, by
# default, the reserved virtual address space for 32-on-64 bit is set to 4GB.
# This will trigger a MMU access fault in the virtual CPU. With this change,
# the qemu-mips works fine.
# IMPORTANT: This piece needs to be removed once the root cause is fixed!

2) More generally, is -a generally necessary when exec'ing like this? Can't
   this be solved in another way?
Richard Purdie - Nov. 22, 2013, 12:13 p.m.
On Fri, 2013-11-22 at 09:32 +0100, Olof Johansson wrote:
> On 13-11-22 07:25 +0100, Hongxu Jia wrote:
> > Hi Saul,
> > 
> > The script could not be de-bashed,  it was made by create_wrapper
> > which is bashism:
> > Vim image/usr/bin/qemu-mips
> > ...
> > #! /bin/bash
> > realpath=`readlink -fn $0`
> > export QEMU_RESERVED_VA=0x0
> > exec -a `dirname $realpath`/qemu-mips `dirname $realpath`/qemu-mips.real "$@"
> > ...
> > 
> > The exec's -a option is bashism, so we need to add bash to RDEPENDS.
> 
> 1) Is the wrapper still necessary?
> 
> The comment above the do_install_append in the recipe:
> 
> # The following fragment will create a wrapper for qemu-mips user emulation
> # binary in order to work around a segmentation fault issue. Basically, by
> # default, the reserved virtual address space for 32-on-64 bit is set to 4GB.
> # This will trigger a MMU access fault in the virtual CPU. With this change,
> # the qemu-mips works fine.
> # IMPORTANT: This piece needs to be removed once the root cause is fixed!

Someone could retest it but as far as I know the issue still exists.

> 2) More generally, is -a generally necessary when exec'ing like this? Can't
>    this be solved in another way?

We've gone around in circles on this and yes, execing using -a is needed
and if we don't do that we hit other bugs. See the history of the
create_wrapper function.

Cheers,

Richard

Patch

--- a/meta/recipes-devtools/qemu/qemu.inc
+++ b/meta/recipes-devtools/qemu/qemu.inc
@@ -5,6 +5,7 @@  DEPENDS = "glib-2.0 zlib alsa-lib virtual/libx11 pixman 
dtc libsdl"
  DEPENDS_class-native = "zlib-native alsa-lib-native glib-2.0-native 
pixman-native dtc-native"
  DEPENDS_class-nativesdk = "nativesdk-zlib nativesdk-libsdl 
nativesdk-glib-2.0 nativesdk-pixman nativesdk-dtc"
  RDEPENDS_${PN}_class-nativesdk = "nativesdk-libsdl"
+RDEPENDS_${PN}_class-target += "python"