Hi,

> On Jun 2, 2012, at 10:36 PM, Elvis Dowson wrote:
> 
>> How can I debug the value of ${TARGET_ARCH} in 
>> meta-xilinx/classes/xilinx-boot.class, for the following function:
>> 
>> do_export_xparam() {
>> bbnote "Replacing xparameters header to match hardware model"
>> xparam=$1
>> if [ "${TARGET_ARCH}" == "powerpc" ]; then
>>      cpu="PPC`echo ${TARGET_CPU} | tr '[:lower:]' '[:upper:]'`"
>> else
>>      cpu=`echo ${TARGET_CPU} | tr '[:lower:]' '[:upper:]'`
>> fi
>> cp ${xparam} ${S}/board/xilinx/${XILINX_BOARD}
>> echo "/*** Cannonical definitions ***/
>> #define XPAR_PLB_CLOCK_FREQ_HZ XPAR_PROC_BUS_0_FREQ_HZ
>> #define XPAR_CORE_CLOCK_FREQ_HZ XPAR_CPU_${cpu}_CORE_CLOCK_FREQ_HZ
>> #ifndef XPAR_DDR2_SDRAM_MEM_BASEADDR
>> # define XPAR_DDR2_SDRAM_MEM_BASEADDR XPAR_DDR_SDRAM_MPMC_BASEADDR
>> #endif
>> #define XPAR_PCI_0_CLOCK_FREQ_HZ    0" >> 
>> ${S}/board/xilinx/${XILINX_BOARD}/xparameters.h
>> }
> 
> In the above code ${TARGET_ARCH} always evaluates to "powerpc". I just 
> inserted ${TARGET_ARCH} in the echo statements, and saw the value in the file.
> 
> Now what I can't seem to figure out is why, for the following if condition, 
> the first branch isn't being take; the else branch is always evaluated, and 
> the value for cpu is always set to "440" instead of "PPC440"
> 
> if [ "${TARGET_ARCH}" == "powerpc" ]; then
>       cpu="PPC`echo ${TARGET_CPU} | tr '[:lower:]' '[:upper:]'`"
> else
>       cpu="`echo ${TARGET_CPU} | tr '[:lower:]' '[:upper:]'`"
> fi

Changing it to use a single = , instead of == solved it, but it would help if 
someone could explain why. From the link below 
http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html
apparently, using a "=" is for strict posix compilance.

but I fail to see why when ${TARGET_ARCH} evaluates to "powerpc", and I do a 
string comparision if [ "${TARGET_ARCH}" == "powerpc" ] it evaluates to false, 
and if [ "${TARGET_ARCH}" = "powerpc" ] evaluates to true.

Best regards,

Elvis Dowson
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Reply via email to