[yocto] how to write a shell command in local.conf

Chris Larson clarson at kergoth.com
Wed Oct 31 20:05:01 PDT 2012


On Wed, Oct 31, 2012 at 7:52 PM, Liu <treebody at embedstudy.com> wrote:
> HOST_ARCH:="${@os.popen('/usr/bin/gcc -dumpmachine | sed -e s\'/-.*//\' \
>     -e \'s/sparc.*/sparc/\' \
>     -e \'s/arm.*/arm/g\' \
>     -e \'s/m68k.*/m68k/\' \
>     -e \'s/ppc/powerpc/g\' \
>     -e \'s/v850.*/v850/g\' \
>     -e \'s/sh[234]/sh/\' \
>     -e \'s/mips-.*/mips/\' \
>     -e \'s/mipsel-.*/mipsel/\' \
>     -e \'s/cris.*/cris/\' \
>     -e \'s/i[3-9]86/i386/\'').read()}"
> Then I came up with a problem,I can see the variable HOST_ARCH changed to
> "i386" using "bitbake -e | grep HOST_ARCH",but when I bitbake busybox ,it
> says :
> ERROR: Unable to determine endianness for architecture 'i386    | ETA:
> --:--:--
> '

You forgot to strip off the trailing newline. Use read().rstrip(). You
may also want to use bb.process or oe.process rather than os.popen.
-- 
Christopher Larson



More information about the yocto mailing list