From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Greg KH <greg@kroah.com>, Jan Blunck <jblunck@suse.de>
Subject: Re: [PATCH] driver-core: devtmpfs - driver core maintained /dev tmpfs
Date: Wed, 06 May 2009 14:56:38 +0200 [thread overview]
Message-ID: <1241614598.3319.28.camel@poy> (raw)
In-Reply-To: <1241097822.2516.3.camel@poy>
On Thu, 2009-04-30 at 15:23 +0200, Kay Sievers wrote:
> From: Kay Sievers <kay.sievers@vrfy.org>
> Subject: driver-core: devtmpfs - driver core maintained /dev tmpfs
Below are some numbers. Appended the used initramfs /init script, which
gets very simple with devtmpfs, compared what we need do today to handle
and fill an empty /dev after mounting its own tmpfs there.
This simple initramfs example still supports udev by-{label,uuid,id} device
name links, and other setups which need udev to find/setup/assemble
the root device.
Thanks,
Kay
kvm: initramfs mount-by-label
[ 2.018622] Freeing unused kernel memory: 2172k freed
[ 2.034799] initramfs: starting ...
[ 2.093656] initramfs: looking for /dev/disk/by-label/root
[ 2.121746] initramfs: starting udev
[ 2.141221] udev: starting version 142
[ 2.223777] initramfs: trigger block events
[ 2.465649] initramfs: mounting /dev/disk/by-label/root
[ 2.937051] kjournald starting. Commit interval 5 seconds
[ 2.941167] EXT3 FS on sda1, internal journal
[ 2.962522] EXT3-fs: mounted filesystem with writeback data mode.
[ 3.122292] initramfs: switching to root filesystem /dev/disk/by-label/root and start /bin/bash
kvm: initramfs mount-by-kernel-node
[ 1.939865] Freeing unused kernel memory: 2172k freed
[ 1.957918] initramfs: starting ...
[ 2.226510] initramfs: looking for /dev/sda1
[ 2.249192] initramfs: mounting /dev/sda1
[ 2.731584] kjournald starting. Commit interval 5 seconds
[ 2.736040] EXT3 FS on sda1, internal journal
[ 2.779422] EXT3-fs: mounted filesystem with writeback data mode.
[ 2.866554] initramfs: switching to root filesystem /dev/sda1 and start /bin/bash
kvm: direct kernel mount
[ 2.425663] kjournald starting. Commit interval 5 seconds
[ 2.434656] EXT3 FS on sda1, internal journal
[ 2.506279] EXT3-fs: mounted filesystem with writeback data mode.
[ 2.517395] VFS: Mounted root (ext3 filesystem) on device 259:524288.
[ 2.550488] devtmpfs: mounted
[ 2.555379] Freeing unused kernel memory: 2172k freed
real box: initramfs and mount-by-label
[ 1.513740] Freeing unused kernel memory: 2172k freed
[ 1.519782] initramfs: starting ...
[ 1.532795] initramfs: looking for /dev/disk/by-label/root
[ 1.533226] initramfs: starting udev
[ 1.537925] initramfs: trigger block events
[ 1.538715] udev: starting version 142
[ 1.647484] initramfs: mounting /dev/disk/by-label/root
[ 1.657646] kjournald starting. Commit interval 5 seconds
[ 1.657804] EXT3 FS on sda1, internal journal
[ 1.657864] EXT3-fs: mounted filesystem with writeback data mode.
[ 1.687084] initramfs: switching to root filesystem /dev/disk/by-label/root and start /sbin/init
real box: kernel mount
[ 1.329632] kjournald starting. Commit interval 5 seconds
[ 1.329756] EXT3 FS on sda1, internal journal
[ 1.329814] EXT3-fs: mounted filesystem with writeback data mode.
[ 1.329867] VFS: Mounted root (ext3 filesystem) on device 259:524288.
[ 1.330313] devtmpfs: mounted
[ 1.330377] async_waiting @ 1
[ 1.330381] async_continuing @ 1 after 0 usec
[ 1.330424] Freeing unused kernel memory: 2172k freed
#!/bin/sh
# minimal initramfs with persistent device name support
# requires devtmpfs support provided by the kernel
shell() {
echo "initramfs: dropping to shell"
exec >/dev/console 2>&1 </dev/console < /dev/console
sh -i
}
getarg() {
local o line
for o in $cmdline; do
test "$o" = "$1" && return 0
if test "${o%%=*}" = "${1%=}"; then
echo ${o#*=}
return 0
fi
done
return 1
}
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
export TERM=linux
# console redirect
exec >/dev/kmsg 2>&1 </dev/console
echo "initramfs: starting ..."
# mount needed filesystems
mount -t proc /proc /proc >/dev/null
mount -t sysfs /sys /sys >/dev/null
mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
# kernel commandline
read cmdline </proc/cmdline;
# root we are looking for
root=$(getarg root=)
echo "initramfs: looking for $root"
# shortcut, in case root is already there
if test -e "$root"; then
echo "initramfs: mounting $root"
mount "$root" /root
mounted=yes
fi
# we need to start udev to create the symlink we are looking for
if test -z "$mounted"; then
echo "initramfs: starting udev"
udevd --daemon --resolve-names=never
# create links for already existing block devices
echo "initramfs: trigger block events"
udevadm trigger --subsystem-match=block
udevadm settle --timeout=3
# try if the link is there now
if test -e "$root"; then
echo "initramfs: mounting $root"
mount "$root" /root
mounted=yes
fi
if test -z "$mounted"; then
# load modules to let the root device show up
echo "initramfs: trigger module events"
udevadm trigger --attr-match=modalias
echo "initramfs: waiting for $root"
# loop until root shows up
while test -z "$mounted"; do
if test -e "$root"; then
echo "initramfs: mounting $root"
mount "$root" /root && mounted=yes
fi
sleep 0.05
done
fi
# kill udev
kill $(pidof udevd) >/dev/null 2>&1
fi
# move filesystems over to the mounted root
mount --move /dev /root/dev
mount --move /proc /root/proc
mount --move /sys /root/sys
# move into root
cd /root
init=$(getarg init=)
test -z "$init" && init=/sbin/init
echo "initramfs: switching to root filesystem $root and start $init"
exec run-init -c /dev/console /root $init
next prev parent reply other threads:[~2009-05-06 12:56 UTC|newest]
Thread overview: 79+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-30 13:23 [PATCH] driver-core: devtmpfs - driver core maintained /dev tmpfs Kay Sievers
2009-05-01 5:29 ` Andrew Morton
2009-05-01 6:17 ` Greg KH
2009-05-01 6:43 ` Andrew Morton
2009-05-01 6:55 ` Greg KH
2009-05-01 7:03 ` Andrew Morton
2009-05-01 10:52 ` Kay Sievers
2009-05-01 11:38 ` Michael Tokarev
2009-05-01 11:44 ` Kay Sievers
2009-05-01 11:03 ` Alan Cox
2009-05-01 11:11 ` Kay Sievers
2009-05-01 13:18 ` Alan Cox
2009-05-01 13:24 ` Kay Sievers
2009-05-02 7:19 ` Christoph Hellwig
2009-05-02 13:46 ` Kay Sievers
2009-05-02 15:18 ` Andy Lutomirski
2009-05-02 15:35 ` Kay Sievers
2009-05-02 18:20 ` Michael Riepe
2009-05-02 19:55 ` Alan Jenkins
2009-05-02 21:47 ` Kay Sievers
2009-05-04 16:20 ` Lars Marowsky-Bree
2009-05-04 16:53 ` Kay Sievers
2009-05-04 17:54 ` Michael Riepe
2009-05-04 18:13 ` Kay Sievers
2009-05-04 18:55 ` Michael Riepe
2009-05-04 19:13 ` Kay Sievers
2009-05-04 19:30 ` Greg KH
2009-05-02 1:24 ` Brian Swetland
2009-05-02 1:48 ` Kay Sievers
2009-05-02 2:02 ` Brian Swetland
2009-05-02 2:28 ` Kay Sievers
2009-05-02 4:42 ` Brian Swetland
2009-05-02 13:30 ` Kay Sievers
2009-05-01 11:01 ` Alan Cox
2009-05-01 11:02 ` Kay Sievers
2009-05-01 11:16 ` Kay Sievers
2009-05-01 19:26 ` Andrew Morton
2009-05-01 21:59 ` Kay Sievers
2009-05-01 22:21 ` Andrew Morton
2009-05-01 6:57 ` Chris Wedgwood
2009-05-01 14:01 ` Greg KH
2009-05-01 15:43 ` Alan Jenkins
2009-05-01 16:04 ` Greg KH
2009-05-01 21:13 ` Alan Jenkins
2009-05-01 15:53 ` Chris Wedgwood
2009-05-01 16:09 ` Greg KH
2009-05-01 16:17 ` Chris Wedgwood
2009-05-01 10:19 ` Alan Jenkins
2009-05-01 11:13 ` Kay Sievers
2009-05-01 12:38 ` Alan Jenkins
2009-05-01 13:12 ` Alan Cox
2009-05-02 15:03 ` Kyle Moffett
2009-05-01 14:55 ` Kay Sievers
2009-05-01 11:41 ` Hugh Dickins
2009-05-01 11:59 ` Kay Sievers
2009-05-02 7:16 ` Christoph Hellwig
2009-05-02 11:34 ` Kay Sievers
2009-05-02 20:22 ` Alan Jenkins
2009-05-02 21:39 ` Kay Sievers
2009-05-02 22:04 ` Alan Jenkins
2009-05-03 7:29 ` Michael Tokarev
2009-05-02 21:41 ` Alan Jenkins
2009-05-02 21:54 ` Greg KH
2009-05-02 21:59 ` Kay Sievers
2009-05-02 16:59 ` Jeff Garzik
2009-05-02 17:57 ` Kay Sievers
2009-05-06 12:56 ` Kay Sievers [this message]
2009-05-07 1:41 ` Arjan van de Ven
2009-05-07 2:08 ` Kay Sievers
2009-05-07 2:25 ` Arjan van de Ven
2009-05-07 2:40 ` Kay Sievers
2009-05-14 9:28 ` Pavel Machek
2009-05-07 8:17 ` Eric W. Biederman
2009-05-07 9:28 ` Kay Sievers
2009-05-07 14:43 ` Theodore Tso
2009-05-07 15:13 ` Kay Sievers
2009-05-10 0:29 ` Eric W. Biederman
2009-05-10 0:56 ` Kay Sievers
2009-05-10 2:11 ` Eric W. Biederman
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=1241614598.3319.28.camel@poy \
--to=kay.sievers@vrfy.org \
--cc=greg@kroah.com \
--cc=jblunck@suse.de \
--cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.