On Mon, Jul 6, 2009 at 2:27 AM, Paulo Ferreira
<paf@xxxxxxxx> wrote:
First of all many thanks for the microblaze version of linux.
You're welcome, glad you find it useful.
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!
Yes, it's true.
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?
I don't think you're wrong, but I'm not sure you're 100% right either! A quick google search suggests that opinions differ - but broadly there does seem to be agreement that if you really need bash in a shell script, you should use #!/bin/bash, instead of #!/bin/sh
So my options are:
1) make a link from /bin/sh to /bin/bash
I wouldn't recommend that, as it might have other unintended consequences in your system.
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.... )
There is a middle ground - just audit the files that have problems, and fix them on a case by case basis.
Now the question I have is this - are the bashism "errors" coming from petalinux-* scripts, or are they from scripts or Makefile fragments inside the petalinux-dist heirarchy itself? You mentioned you saw problems when making the kernel - you mean just "make" from the petalinux-dist directory?
It would be very helpful if you could provide a rough audit of the failing scripts/Makefiles, and the error messages. Options then are either
1 - tweak the scripts to use only POSIX shell features, in which case /bin/sh should be fine, or, if that's too much work
2 - just manually force /bin/bash.
I found this page very useful in thinking about the issues:
https://wiki.ubuntu.com/DashAsBinShFor standalone shell scripts it's pretty clear, but for the assumed $(SHELL) in Makefiles, there's another set of rules to consider. We'll consider that when we know where the problems are.
Regards,