Skip to contentSkip to conversation

how to write a shell command in local.conf

DISCUSSION Liu 2 participants 2 messages Nov 1, 2012

lore
Share & tools
lore

Liu

author
#0 lore raw

Hi all,
I add the following settings in local.conf :

 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: --:--:--
'
ERROR: Please add your architecture to siteinfo.bbclass.

1)I can not understand why it became to 'i386 | ETA: --:--:--
' instead of 'i386'.Is there any mistmake in my settings in the above-mentioned ?
2)Another question: I can see HOST_ARCH="i386" using bitbake -e | grep HOST_ARCH,but see nothing using bitbake -e busybox | grep HOST_ARCH.Does it mean the the variable has no effect when building busybox?

Best whishes,
---------------------Liu

#1 lore raw
Quoted 11 lines · Liu
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()}"
Quoted 6 lines

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.

Signature · 1 line
Christopher Larson