On 11/10/2013 07:00 AM, Phil Blundell wrote:
On Sat, 2013-11-09 at 13:28 +0800, qi.c...@windriver.com wrote:
+for dir in /usr/bin /usr/sbin; do
+    if [ ! -e $dir ]; then
+       if [ "$VERBOSE" != "no" ]; then
+           echo "WARN: $dir missing, setting up links to busybox"
+       fi
+       mkdir -p $dir
+       for suffix in ".nosuid" ".suid" ""; do
+           if [ ! -e /etc/busybox.links${suffix} ]; then
+               continue
+           fi
+           usr_commands=`grep "$dir" /etc/busybox.links${suffix}`
+           for command in $usr_commands; do
+               ln -sf /bin/busybox${suffix} $command
+           done

Hi Phil,

This script is an effort to try to make system boot up even if /usr is not there. It relies on busybox because in most cases, busybox is there in an OE based system.
And please see comments below.

This seems slightly bogus for a number of reasons:

1. initscript doesn't obviously rdepend on busybox so it's not obvious
that the latter will always be available;

Yes. Initscript doesn't rdepend on busybox. But note it also doesn't rdepend on sed or awk or grep.
So I think it's reasonable to assume the presence of busybox.

2. it should probably be using ${base_bindir} and ${bindir} rather than
hardcoding absolute paths.

In init scripts, we usually "hardcode" things, because these scripts are destined to run on target. In recipes we try not to hardcode things because the recipe may need to extend to "native" or "nativesdk".

3. the whole idea of creating a shadow "/usr/bin" underneath what's
meant to be a mountpoint seems rather dubious to me.

Agree.

The problem here is that the init scripts under /etc/rcS.d/ need to execute commands like awk, dirname, and readlink which are from /usr.

As it's not appropriate to move these commands into /bin, basically there are only two options I can see here. One is to modify these scripts to use only commands from /bin or /sbin; the other is to make use of busybox, as busybox is located under /bin as it provides these commands. I chose to the latter one because I thought that solution would have the less impact.

What do you think? Do we need to modify the init scripts? Or any other solution?


4. this seems like distro policy and not something that really belongs
in oe-core at all.  For systems where ${bindir} and ${base_bindir} are
on the same filesystem (or even are the same directory) this script will
just make bootup slower without achieving anything useful.

p.


If /usr and / are on the same file system, this script has no real effect because /usr will always be there. So I think it will not take much time at boot.

If ${base_bindir} and ${bindir} are the same, that means that there's no /usr. In this case, there should no /usr/xxx entries in /etc/busybox.links, so this script should also function correctly and it will not take much time at boot.

(I just configured ${bindir} and ${base_bindir} to be the same and performed a build, it failed. I'm not sure whether it's valid to make such configurations in OE.)

Best Regards,
Chen Qi




_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to