[yocto] Sourcing a shell script within a bbclass

Elvis Dowson elvis.dowson at gmail.com
Sun Jun 24 07:24:44 PDT 2012


Hi,
      How can I source a shell script within a bbclass? For example, in meta-xilinx/classes/xilinx-boot.bbclass, I need to source a script file called settings64.sh, which setups the environment variables for the Xilinx ISE 14.1 design tools, in order to generate a system ace image file.

For the following code snippet:

	if   [ "${XILINX_VER}" \> "14" ]; then
		bbnote "XILINX_VER ${XILINX_VER}, script location ${XILINX_LOC}/${EDK_SCRIPT}"
		source ${XILINX_LOC}/${EDK_SCRIPT} ${XILINX_LOC}
	fi

I get the following error:

DEBUG: Executing python function sstate_task_prefunc
DEBUG: Python function sstate_task_prefunc finished
DEBUG: Executing shell function do_deploy
ERROR: Function failed: do_deploy (see /tool/yocto/poky/build/tmp/work/ppc440-poky-linux/u-boot-xilinx-v2012.04.01-r16/temp/log.do_deploy.15616 for further information)
NOTE: Deploying uboot elf image to /project/xilinx-ml507
NOTE: Xilinx design tools installed in /tool/xilinx/14.1/ISE_DS
NOTE: Generate system ace image
NOTE: EDK_SCRIPT settings64.sh
NOTE: XILINX_VER 14.1, script location /tool/xilinx/14.1/ISE_DS/settings64.sh
/tool/yocto/poky/build/tmp/work/ppc440-poky-linux/u-boot-xilinx-v2012.04.01-r16/temp/run.do_deploy.15616: 129: /tool/yocto/poky/build/tmp/work/ppc440-poky-linux/u-boot-xilinx-v2012.04.01-r16/temp/run.do_deploy.15616: source: not found

if I replace the source keyword with a . (dot) 

	if   [ "${XILINX_VER}" \> "14" ]; then
		bbnote "XILINX_VER ${XILINX_VER}, script location ${XILINX_LOC}/${EDK_SCRIPT}"
		. ${XILINX_LOC}/${EDK_SCRIPT} ${XILINX_LOC}
	fi

it executes the scripts but gives the following error:

NOTE: XILINX_VER 14.1, script location /tool/xilinx/14.1/ISE_DS/settings64.sh
/tool/yocto/poky/build/tmp/work/ppc440-poky-linux/u-boot-xilinx-v2012.04.01-r16/temp/run.do_deploy.7879: 12: [: /tool/yocto/poky/build/tmp/work/ppc440-poky-linux/u-boot-xilinx-v2012.04.01-r16/temp/run.do_deploy.7879: unexpected operator
. /tool/xilinx/14.1/ISE_DS/common/.settings64.sh /tool/xilinx/14.1/ISE_DS/common
. /tool/xilinx/14.1/ISE_DS/EDK/.settings64.sh /tool/xilinx/14.1/ISE_DS/EDK
. /tool/xilinx/14.1/ISE_DS/common/CodeSourcery/.settings64.sh /tool/xilinx/14.1/ISE_DS/common/CodeSourcery
. /tool/xilinx/14.1/ISE_DS/PlanAhead/.settings64.sh /tool/xilinx/14.1/ISE_DS/PlanAhead
. /tool/xilinx/14.1/ISE_DS/../../Vivado/2012.1/.settings64.sh /tool/xilinx/14.1/ISE_DS/../../Vivado/2012.1
. /tool/xilinx/14.1/ISE_DS/ISE/.settings64.sh /tool/xilinx/14.1/ISE_DS/ISE
. /tool/xilinx/14.1/ISE_DS/SysGen/.settings64.sh /tool/xilinx/14.1/ISE_DS/SysGen


What should I do to source the settings64.sh file properly within the bbclass?

Best regards,

Elvis Dowson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20120624/62d04f23/attachment.html>


More information about the yocto mailing list