Openembedded Core Discussions
 help / color / mirror / Atom feed
From: ChenQi <Qi.Chen@windriver.com>
To: Phil Blundell <pb@pbcl.net>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 2/8] initscripts: add setup-commands.sh
Date: Mon, 11 Nov 2013 10:52:18 +0800	[thread overview]
Message-ID: <52804662.1090605@windriver.com> (raw)
In-Reply-To: <1384038034.3798.46.camel@x121e.pbcl.net>

[-- Attachment #1: Type: text/plain, Size: 3169 bytes --]

On 11/10/2013 07:00 AM, Phil Blundell wrote:
> On Sat, 2013-11-09 at 13:28 +0800, Qi.Chen@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

>
>


[-- Attachment #2: Type: text/html, Size: 4778 bytes --]

  reply	other threads:[~2013-11-11  2:52 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-09  5:28 [PATCH 0/8] Fixes about unsafe-references QA warnings Qi.Chen
2013-11-09  5:28 ` [PATCH 1/8] udev: fix dependency and location of udevadm Qi.Chen
2013-11-09 22:54   ` Phil Blundell
2013-11-11  2:18     ` ChenQi
2013-11-11 10:53       ` Phil Blundell
2013-11-11 11:28         ` ChenQi
2013-11-09  5:28 ` [PATCH 2/8] initscripts: add setup-commands.sh Qi.Chen
2013-11-09 23:00   ` Phil Blundell
2013-11-11  2:52     ` ChenQi [this message]
2013-11-11 11:53       ` Phil Blundell
2013-11-11 12:40         ` ChenQi
2013-11-11 14:49           ` Phil Blundell
2013-11-11 16:13         ` Mark Hatle
2013-11-11 12:12       ` Burton, Ross
2013-11-11 12:53         ` ChenQi
2013-11-11 16:15         ` Mark Hatle
2013-11-09  5:28 ` [PATCH 3/8] zlib: install into base_libdir Qi.Chen
2013-11-09  5:28 ` [PATCH 4/8] kmod: install libkmod " Qi.Chen
2013-11-09  5:28 ` [PATCH 5/8] udev: fix unsafe reference by installing libgudev in libdir Qi.Chen
2013-11-09  5:28 ` [PATCH 6/8] insane.bbclass: make the checking stricter for unsafe references in scripts Qi.Chen
2013-11-09  5:28 ` [PATCH 7/8] iputils: fix program location and QA warning Qi.Chen
2013-11-09  5:28 ` [PATCH 8/8] busybox: install ping6 into bindir by default Qi.Chen
2013-11-11 11:12 ` [PATCH 0/8] Fixes about unsafe-references QA warnings Burton, Ross
2013-11-11 11:23   ` ChenQi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52804662.1090605@windriver.com \
    --to=qi.chen@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=pb@pbcl.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox