<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 11/10/2013 07:00 AM, Phil Blundell
wrote:<br>
</div>
<blockquote cite="mid:1384038034.3798.46.camel@x121e.pbcl.net"
type="cite">
<pre wrap="">On Sat, 2013-11-09 at 13:28 +0800, <a class="moz-txt-link-abbreviated" href="mailto:Qi.Chen@windriver.com">Qi.Chen@windriver.com</a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">+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
</pre>
</blockquote>
</blockquote>
<br>
Hi Phil,<br>
<br>
This script is an effort to try to make system boot up even if /usr
is not there.<br>
It relies on busybox because in most cases, busybox is there in an
OE based system.<br>
And please see comments below.<br>
<br>
<blockquote cite="mid:1384038034.3798.46.camel@x121e.pbcl.net"
type="cite">
<pre wrap="">
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;
</pre>
</blockquote>
<br>
Yes. Initscript doesn't rdepend on busybox. But note it also doesn't
rdepend on sed or awk or grep.<br>
So I think it's reasonable to assume the presence of busybox.<br>
<br>
<blockquote cite="mid:1384038034.3798.46.camel@x121e.pbcl.net"
type="cite">
<pre wrap="">
2. it should probably be using ${base_bindir} and ${bindir} rather than
hardcoding absolute paths.
</pre>
</blockquote>
<br>
In init scripts, we usually "hardcode" things, because these scripts
are destined to run on target.<br>
In recipes we try not to hardcode things because the recipe may need
to extend to "native" or "nativesdk".<br>
<br>
<blockquote cite="mid:1384038034.3798.46.camel@x121e.pbcl.net"
type="cite">
<pre wrap="">
3. the whole idea of creating a shadow "/usr/bin" underneath what's
meant to be a mountpoint seems rather dubious to me.
</pre>
</blockquote>
<br>
Agree.<br>
<br>
The problem here is that the init scripts under <i
class="moz-txt-slash"><span class="moz-txt-tag">/</span>etc/rcS.d<span
class="moz-txt-tag">/</span></i> need to execute commands like
awk, dirname, and readlink which are from /usr.
<br>
<br>
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.
<br>
I chose to the latter one because I thought that solution would have
the less impact.
<br>
<br>
What do you think? Do we need to modify the init scripts? Or any
other solution?
<br>
<br>
<br>
<blockquote cite="mid:1384038034.3798.46.camel@x121e.pbcl.net"
type="cite">
<pre wrap="">
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.
</pre>
</blockquote>
<br>
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.<br>
<br>
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.<br>
<br>
(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.)<br>
<br>
Best Regards,<br>
Chen Qi<br>
<br>
<blockquote cite="mid:1384038034.3798.46.camel@x121e.pbcl.net"
type="cite">
<pre wrap="">
</pre>
</blockquote>
<br>
</body>
</html>