From: Harald Hoyer <harald@redhat.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: how to create /dev/root
Date: Wed, 16 Jul 2008 15:37:17 +0000 [thread overview]
Message-ID: <487E15AD.3030708@redhat.com> (raw)
In-Reply-To: <20080712025216.GA13808@bongo.bofh.it>
[-- Attachment #1: Type: text/plain, Size: 1354 bytes --]
piterpk wrote:
>> On Sat, Jul 12, 2008 at 04:52, Marco d'Itri <md@linux.it> wrote:
>>> I added this to the Debian udev init script, run between mounting /dev
>>> and starting udevtrigger.
>>>
>>> mountpoint at least on Debian systems is part of sysvinit and happens to
>>> be in /bin, but if /usr is available then you can as well use stat(1).
>>>
>>> create_devroot_rule() {
>>> local udevroot="$1"
>>> local rootnumbers=$(mountpoint -q -d / || true)
>>> local rootmajor=${rootnumbers%:*}
>>> local rootminor=${rootnumbers#*:}
>>> [ "$rootmajor" -a "$rootminor" ] || return 0
>>>
>>> echo 'ACTION=="add", SUBSYSTEM=="block", ENV{MAJOR}=="'$rootmajor'", ENV{MINOR}=="'$rootminor'",
> SYMLINK+="root"' > /dev/.udev/rules.d/rules.d/61-dev-root-link.rules
>>> }
>
> Based in original Marco´s code, we are using this one:
>
> # Create rootdev rules
> DEVICENUMBER=$( /bin/stat -c %d / )
> MAJORNUMBER=$(($DEVICENUMBER / 256))
> MINORNUMBER=$(($DEVICENUMBER % 256))
>
> echo 'ACTION=="add", SUBSYSTEM=="block", ENV{MAJOR}=="'$MAJORNUMBER'", ENV{MINOR}=="'$MINORNUMBER'",
> SYMLINK+="root"' > /dev/.udev/rules.d/61-dev-root-link.rules
>
> But our uses stat instead mountpoint (mountpoint is in /usr/bin and stat is in /bin)
Fedora:
$ which stat
/usr/bin/stat
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/x-pkcs7-signature, Size: 3636 bytes --]
prev parent reply other threads:[~2008-07-16 15:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-12 2:52 how to create /dev/root Marco d'Itri
2008-07-15 13:50 ` Kay Sievers
2008-07-16 14:51 ` piterpk
2008-07-16 15:37 ` Harald Hoyer [this message]
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=487E15AD.3030708@redhat.com \
--to=harald@redhat.com \
--cc=linux-hotplug@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).