[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[microblaze-uclinux] bash versus sh ?




First of all many thanks  for  the microblaze version of linux.


I am  trying to learn how to customize linux  and the microblaze.


I am using a Spartan 3E starter kit and ISE/EDK version 9.2 on Ubuntu 9.04.

I know I should be using Centos, but the differences are small, and I managed to run all the stuff until now.


The xilinx software is working, the prebuilt files are also working, the making of the "hardware" part is done ( I managed to make a correct download.bit file ).


Now, on the software side, making the linux kernel, I was surprised by some messages like:

"declare: not found"

or

"/bin/sh:  let: not found"


It seems to me that many scripts on the petalinux distro suppose that / bin/sh is bash!

But in a well configured machine /bin/sh should be the Bourne shell and /bin/bash should be bash. In Ubuntu 9.04 sh ( in reality dash ) has 87924 bytes and bash has 729040 bytes so sizes are very different, and one should be clear when bash is needed. In a normal desktop machine it makes no difference, but in embedded systems, the two numbers are very different.
Am I wrong?


So my options are:
	1) make a link  from /bin/sh to /bin/bash

2) Make a script called change_sh_bash.sh and run it like this on the Petalinux distro:

        find $PETALINUX -type f -exec  ./change_sh_bash  {} \;

    ( But this way I will change too many files.... )
========================================================
#!/bin/bash
#
#   change_sh_bash.sh
#
  if [ "$#" != "1" ]
  then
    echo "Usage: change_sh_bash.sh  filename"
    echo "  changes scripts from sh to bash shell"
    exit 1
  fi

  if [ ! -f "${1}" ]
  then
     echo "File ${1} does not exist"
     exit 1
  fi

  HEADER=`head -c 9 ${1}`  # see the first 9 chars of the file

  TMPFILE=/tmp/chgbash$$    #  create a temp file


  if [ "${HEADER}"  == "#!/bin/sh" ]
   then
    echo "File: ${1} will be changed from sh to bash"
    cp "$1"  $TMPFILE    # for preserving permissions
    sed -e '1s/#!\/bin\/sh/#!\/bin\/bash/' "${1}" > $TMPFILE
    mv $TMPFILE  "$1"
  fi
==========================================================

Sorry, if my mail seems grumpy, that's not my intention, and I will be glad if the trouble is really on my side "between the chair and the keyboard".... ;-)


My best regards

Paulo Ferreira

___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/