FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CRUX > CRUX

 
 
LinkBack Thread Tools
 
Old 11-16-2010, 07:47 PM
Michal Soltys
 
Default crux's udev

Hi,

While peeking over how you do things in crux it, I've found some things that
could potentially be adjusted. Short overview:

- NAME= is ignored since v154 (excluding renaming network interfaces)
- ignore_device no longer exists since v148 (and ignore_remove since v152)
- additional 20090523 rules are in large part invalid in context of the above
points (and looking at standard udev rules, somewhat superfluous)
- trigger's default is 'change' since v152 - for coldplug, 'add' should be
specified explicitly.
- devtmpfs - if compiled in kernel, should likely be preferred over tmpfs for
/dev
- is "fixing" libudev.so placement really necessary ? It forces you to keep
track of libudev version and it sometimes get out of sync
- pkg-config also scans (under default configuration) /usr/share/pkgconfig, so
/usr/lib/pkgconfig is potentially not necessary
- udevd at one point uses /proc/kmsg, so it could be added to static nodes

Also since v155, udevd automatically copies static nodes from /lib/udev/devices
and creates symbolic links.

I think that Pkgfile could be made a bit more simple, and start_udev a bit more
universal (taking into account that some people will use kernels with devtmpfs,
boot with a custom initramfs, etc.)

Anyway, a few possible tirival changes for your consideration:


diff --git a/udev/Pkgfile b/udev/Pkgfile
index e0d8b04..e4b7014 100644
--- a/udev/Pkgfile
+++ b/udev/Pkgfile
@@ -6,7 +6,6 @@ name=udev
version=163
release=1
source=(ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/$name-$version.tar.bz2
- http://crux.nu/files/distfiles/udev-config-20090523.tar.bz2
start_udev)

build() {
@@ -21,29 +20,16 @@ build() {
pkgconfigdir=/usr/lib/pkgconfig

mkdir -p $PKG/lib/{firmware,udev/devices/{pts,shm}}
- mkdir -p $PKG/usr/lib
-
- # Fix location of devel lib
- rm $PKG/lib/libudev.so
- ln -sf ../../lib/libudev.so.0.9.1 $PKG/usr/lib/libudev.so

# Populate nodes
mknod -m 600 $PKG/lib/udev/devices/console c 5 1
+ mknod -m 600 $PKG/lib/udev/devices/kmsg c 1 11
mknod -m 666 $PKG/lib/udev/devices/null c 1 3
mknod -m 666 $PKG/lib/udev/devices/zero c 1 5
- ln -s /proc/self/fd $PKG/lib/udev/devices/fd
- ln -s /proc/self/fd/0 $PKG/lib/udev/devices/stdin
- ln -s /proc/self/fd/1 $PKG/lib/udev/devices/stdout
- ln -s /proc/self/fd/2 $PKG/lib/udev/devices/stderr
- ln -s /proc/kcore $PKG/lib/udev/devices/core

- # Add CRUX items + LFS rules
+ # Add CRUX items
install -m 0755 $SRC/start_udev $PKG/sbin

- pushd $SRC/udev-config-20090523
- make DESTDIR=$PKG RULES_DIR=/lib/udev/rules.d install
- popd
-
# Keep udevinfo for legacy support
mkdir -p $PKG/usr/bin
ln -s /sbin/udevadm $PKG/usr/bin/udevinfo
diff --git a/udev/start_udev b/udev/start_udev
index 1be7ce9..35cdb2b 100644
--- a/udev/start_udev
+++ b/udev/start_udev
@@ -1,17 +1,32 @@
#!/bin/sh

-# mount /dev as a tmpfs; note: some video drivers require exec access in /dev
-/bin/mount -n -t tmpfs udev /dev -o exec,nosuid,mode=0755
+# mount /dev as a devtmpfs or tmpfs, depending on current kernel capability
+# mount only, if it's not already mounted (e.g. after handover from initramfs)
+# note: some video drivers require exec access in /dev
+if /bin/grep -Fvq ' / /dev/ ' /proc/self/mountinfo ; then
+ if /bin/grep -Fq devtmpfs /proc/filesystems ; then
+ UDEVFS=devtmpfs
+ else
+ UDEVFS=tmpfs
+ fi
+ /bin/mount -n -t $UDEVFS udev /dev -o exec,nosuid,mode=0755,size=8M
+fi

-# unset hotplugger
+# make sure hotplugger is not set
echo > /proc/sys/kernel/hotplug

-# populate /dev with static nodes and directories
-/bin/cp -a /lib/udev/devices/* /dev/
+# since v155, udevd automatically copies /lib/udev/devices
+# and creates /proc/{kcore,self/fd/{0,1,2}} symlinks

# launch udev daemon
/sbin/udevd --daemon

# coldplug devices and wait for the queue to be processed
-/sbin/udevadm trigger
+/sbin/udevadm trigger --type=subsystems --action=add
+/sbin/udevadm settle
+/sbin/udevadm trigger --type=devices --action=add
+/sbin/udevadm settle
+
+# retry any failures
+/sbin/udevadm trigger --type=failed --action=add
/sbin/udevadm settle
_______________________________________________
CRUX mailing list
CRUX@lists.crux.nu
http://lists.crux.nu/mailman/listinfo/crux
 
Old 11-17-2010, 03:06 PM
Juergen Daubert
 
Default crux's udev

On Tue, Nov 16, 2010 at 09:47:27PM +0100, Michal Soltys wrote:
> Hi,

Hello Michal,

> While peeking over how you do things in crux it, I've found some things that
> could potentially be adjusted. Short overview:

Thanks. I'm happy to see that we have a new udev-helper, particularly
because udev is a not-so-loved port among the core-ports Needless
to say that help is alway welcome for any kind of stuff.

See some first comments below, I'll try to do some testing the next
days.

> - NAME= is ignored since v154 (excluding renaming network interfaces)
> - ignore_device no longer exists since v148 (and ignore_remove since v152)
> - additional 20090523 rules are in large part invalid in context of the above
> points (and looking at standard udev rules, somewhat superfluous)
> - trigger's default is 'change' since v152 - for coldplug, 'add' should be
> specified explicitly.
> - devtmpfs - if compiled in kernel, should likely be preferred over tmpfs for
> /dev
> - is "fixing" libudev.so placement really necessary ? It forces you to keep
> track of libudev version and it sometimes get out of sync

if we keep the *.so link in /lib we have to adjust libudev.pc, which
is the same/more effort. Having the *.so library links in /usr/lib is
reasonable furthermore.

> - pkg-config also scans (under default configuration) /usr/share/pkgconfig, so
> /usr/lib/pkgconfig is potentially not necessary

Sure, but the correct place for libudev.pc is /usr/lib/pkgconfig.

> - udevd at one point uses /proc/kmsg, so it could be added to static nodes
>
> Also since v155, udevd automatically copies static nodes from /lib/udev/devices
> and creates symbolic links.
>
> I think that Pkgfile could be made a bit more simple, and start_udev a bit more
> universal (taking into account that some people will use kernels with devtmpfs,
> boot with a custom initramfs, etc.)
>
> Anyway, a few possible tirival changes for your consideration:
>
>
> diff --git a/udev/Pkgfile b/udev/Pkgfile
> index e0d8b04..e4b7014 100644
> --- a/udev/Pkgfile
> +++ b/udev/Pkgfile
> @@ -6,7 +6,6 @@ name=udev
> version=163
> release=1
> source=(ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/$name-$version.tar.bz2
> - http://crux.nu/files/distfiles/udev-config-20090523.tar.bz2
> start_udev)
>
> build() {
> @@ -21,29 +20,16 @@ build() {
> pkgconfigdir=/usr/lib/pkgconfig
>
> mkdir -p $PKG/lib/{firmware,udev/devices/{pts,shm}}
> - mkdir -p $PKG/usr/lib
> -
> - # Fix location of devel lib
> - rm $PKG/lib/libudev.so
> - ln -sf ../../lib/libudev.so.0.9.1 $PKG/usr/lib/libudev.so
>
> # Populate nodes
> mknod -m 600 $PKG/lib/udev/devices/console c 5 1
> + mknod -m 600 $PKG/lib/udev/devices/kmsg c 1 11
> mknod -m 666 $PKG/lib/udev/devices/null c 1 3
> mknod -m 666 $PKG/lib/udev/devices/zero c 1 5
> - ln -s /proc/self/fd $PKG/lib/udev/devices/fd
> - ln -s /proc/self/fd/0 $PKG/lib/udev/devices/stdin
> - ln -s /proc/self/fd/1 $PKG/lib/udev/devices/stdout
> - ln -s /proc/self/fd/2 $PKG/lib/udev/devices/stderr
> - ln -s /proc/kcore $PKG/lib/udev/devices/core
>
> - # Add CRUX items + LFS rules
> + # Add CRUX items
> install -m 0755 $SRC/start_udev $PKG/sbin
>
> - pushd $SRC/udev-config-20090523
> - make DESTDIR=$PKG RULES_DIR=/lib/udev/rules.d install
> - popd
> -
> # Keep udevinfo for legacy support
> mkdir -p $PKG/usr/bin
> ln -s /sbin/udevadm $PKG/usr/bin/udevinfo
> diff --git a/udev/start_udev b/udev/start_udev
> index 1be7ce9..35cdb2b 100644
> --- a/udev/start_udev
> +++ b/udev/start_udev
> @@ -1,17 +1,32 @@
> #!/bin/sh
>
> -# mount /dev as a tmpfs; note: some video drivers require exec access in /dev
> -/bin/mount -n -t tmpfs udev /dev -o exec,nosuid,mode=0755
> +# mount /dev as a devtmpfs or tmpfs, depending on current kernel capability
> +# mount only, if it's not already mounted (e.g. after handover from initramfs)
> +# note: some video drivers require exec access in /dev

This dosn't work, because our grep is in /usr/bin and not in /bin.
Might be usefull to have grep in /bin, but if we move grep we have
to either move libpcre as well or build grep without pcre. It's
something we should consider for the next version of CRUX.

But I'd say we can use mountpoint/sed instead, even though the
inverted logic of the sed line is a bit messy (untested):

> +if /bin/grep -Fvq ' / /dev/ ' /proc/self/mountinfo ; then
> + if /bin/grep -Fq devtmpfs /proc/filesystems ; then
> + UDEVFS=devtmpfs
> + else
> + UDEVFS=tmpfs
> + fi
> + /bin/mount -n -t $UDEVFS udev /dev -o exec,nosuid,mode=0755,size=8M
> +fi

if ! /bin/mountpoint -q /dev ; then
if ! /bin/sed -n '/devtmpfs/q1' /proc/filesystems ; then
UDEVFS=devtmpfs
else
UDEVFS=tmpfs
fi
/bin/mount -n -t $UDEVFS udev /dev -o exec,nosuid,mode=0755,size=8M
fi

> -# unset hotplugger
> +# make sure hotplugger is not set
> echo > /proc/sys/kernel/hotplug
>
> -# populate /dev with static nodes and directories
> -/bin/cp -a /lib/udev/devices/* /dev/
> +# since v155, udevd automatically copies /lib/udev/devices
> +# and creates /proc/{kcore,self/fd/{0,1,2}} symlinks
>
> # launch udev daemon
> /sbin/udevd --daemon
>
> # coldplug devices and wait for the queue to be processed
> -/sbin/udevadm trigger
> +/sbin/udevadm trigger --type=subsystems --action=add
> +/sbin/udevadm settle
> +/sbin/udevadm trigger --type=devices --action=add
> +/sbin/udevadm settle
> +
> +# retry any failures
> +/sbin/udevadm trigger --type=failed --action=add
> /sbin/udevadm settle


thanks again and best regards
Juergen

--
Juergen Daubert | mailto:jue@jue.li
Korb, Germany | http://jue.li/crux

_______________________________________________
CRUX mailing list
CRUX@lists.crux.nu
http://lists.crux.nu/mailman/listinfo/crux
 
Old 11-17-2010, 11:32 PM
Michal Soltys
 
Default crux's udev

On 10-11-17 17:06, Juergen Daubert wrote:
> On Tue, Nov 16, 2010 at 09:47:27PM +0100, Michal Soltys wrote:
>> - is "fixing" libudev.so placement really necessary ? It forces you to keep
>> track of libudev version and it sometimes get out of sync
>
> if we keep the *.so link in /lib we have to adjust libudev.pc, which
> is the same/more effort. Having the *.so library links in /usr/lib is
> reasonable furthermore.
>

In such case, to not hunt lib version, maybe something like:

ln -sf ../../lib/$(/bin/readlink $PKG/lib/libudev.so) $PKG/usr/lib/libudev.so
rm -f $PKG/lib/libudev.so

or more roboust:

LIBUDEV=$(/bin/readlink $PKG/lib/libudev.so)

if [[ -f "$PKG/lib/$LIBUDEV" ]]; then
ln -sf ../../lib/$LIBUDEV $PKG/usr/lib/libudev.so
rm -f $PKG/lib/libudev.so
else
echo "/lib/libudev.so is no longer present, please inspect the Pkgfile"
exit 1
fi

>> - pkg-config also scans (under default configuration) /usr/share/pkgconfig, so
>> /usr/lib/pkgconfig is potentially not necessary
>
> Sure, but the correct place for libudev.pc is /usr/lib/pkgconfig.
>

Gah, I mixed 2 things. Current Pkgfile adjusts /lib/pkgconfig to /usr/lib/pkgconfig,
and I was looking at udev.pc (which ends in /usr/share/pkgconfig).

>
> if ! /bin/mountpoint -q /dev ; then
> if ! /bin/sed -n '/devtmpfs/q1' /proc/filesystems ; then
> UDEVFS=devtmpfs
> else
> UDEVFS=tmpfs
> fi
> /bin/mount -n -t $UDEVFS udev /dev -o exec,nosuid,mode=0755,size=8M
> fi
>

/bin/mountpoint seems to be fine. Alternatively sed could be used
in similar fashion, e.g.

sed -n '/ / /dev /q1' /proc/self/mountinfo
or more simply:
sed -n '/ /dev /q1' /proc/self/mounts

>> # coldplug devices and wait for the queue to be processed
>> -/sbin/udevadm trigger
>> +/sbin/udevadm trigger --type=subsystems --action=add
>> +/sbin/udevadm settle
>> +/sbin/udevadm trigger --type=devices --action=add
>> +/sbin/udevadm settle
>> +
>> +# retry any failures
>> +/sbin/udevadm trigger --type=failed --action=add
>> /sbin/udevadm settle

'settle' between 'subsystems' and 'devices' is probably unnecessary (e.g.
opensuse doesn't have one). I think I'll ask on udev list about reference way
to coldplug these days. Lots of distros still don't bother with --type, or
even --action. Looking at libudev/libudev-enumerate.c it seems both
'subsystems' and 'devices' should be done, but I'm not completely sure.
_______________________________________________
CRUX mailing list
CRUX@lists.crux.nu
http://lists.crux.nu/mailman/listinfo/crux
 
Old 11-19-2010, 10:59 AM
Juergen Daubert
 
Default crux's udev

On Thu, Nov 18, 2010 at 01:32:29AM +0100, Michal Soltys wrote:

[...]

> 'settle' between 'subsystems' and 'devices' is probably unnecessary (e.g.
> opensuse doesn't have one). I think I'll ask on udev list about reference way
> to coldplug these days. Lots of distros still don't bother with --type, or
> even --action. Looking at libudev/libudev-enumerate.c it seems both
> 'subsystems' and 'devices' should be done, but I'm not completely sure.

Well, I think it's not a big loss of time to call settle, though the
README [1] doesn't show it in the recommended setup sequence. If you
get new informations, please report back.

We've done some tests yesterday and found only a small issue.
We have to cp 3 devices manually if tmpfs is used as the filesystem
for /dev, without that udevd complains at system start about a
missing /dev/null. Not a serious problem, because everything else
seems to work fine.
That's explained in the README too and not necessary with devtmpfs.

I've collected all the changes we've discussed here into a new udev
port, which is in my privat repo for testing [2]. Please report any
issues.


Thanks in advance to all for testing and best regards
Juergen

[1] http://tinyurl.com/36o5dxa
[2] httpup sync http://jue.li/crux/ports/#udev udev

--
Juergen Daubert | mailto:jue@jue.li
Korb, Germany | http://jue.li/crux

_______________________________________________
CRUX mailing list
CRUX@lists.crux.nu
http://lists.crux.nu/mailman/listinfo/crux
 
Old 11-19-2010, 03:40 PM
Michal Soltys
 
Default crux's udev

On 10-11-19 12:59, Juergen Daubert wrote:

On Thu, Nov 18, 2010 at 01:32:29AM +0100, Michal Soltys wrote:

[...]


'settle' between 'subsystems' and 'devices' is probably unnecessary (e.g.
opensuse doesn't have one). I think I'll ask on udev list about reference way
to coldplug these days. Lots of distros still don't bother with --type, or
even --action. Looking at libudev/libudev-enumerate.c it seems both
'subsystems' and 'devices' should be done, but I'm not completely sure.


Well, I think it's not a big loss of time to call settle, though the
README [1] doesn't show it in the recommended setup sequence. If you
get new informations, please report back.

We've done some tests yesterday and found only a small issue.
We have to cp 3 devices manually if tmpfs is used as the filesystem
for /dev, without that udevd complains at system start about a
missing /dev/null. Not a serious problem, because everything else
seems to work fine.
That's explained in the README too and not necessary with devtmpfs.



After checking udevd.c it looks that the function responsible for
creating standard symlinks and static+module exported nodes is called
after /dev/null check. I suppose the order could be changed - I'll do
small patch and see what udev people think.

_______________________________________________
CRUX mailing list
CRUX@lists.crux.nu
http://lists.crux.nu/mailman/listinfo/crux
 
Old 11-22-2010, 02:14 PM
Michal Soltys
 
Default crux's udev

On 10-11-19 17:40, Michal Soltys wrote:

On 10-11-19 12:59, Juergen Daubert wrote:

On Thu, Nov 18, 2010 at 01:32:29AM +0100, Michal Soltys wrote:

We've done some tests yesterday and found only a small issue.
We have to cp 3 devices manually if tmpfs is used as the filesystem
for /dev, without that udevd complains at system start about a
missing /dev/null. Not a serious problem, because everything else
seems to work fine.
That's explained in the README too and not necessary with devtmpfs.



After checking udevd.c it looks that the function responsible for
creating standard symlinks and static+module exported nodes is called
after /dev/null check. I suppose the order could be changed - I'll do
small patch and see what udev people think.
_______________________________________________


http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff;h=1a6ab670304dc8d8cdebc1d273 076dc661dbafc5
_______________________________________________
CRUX mailing list
CRUX@lists.crux.nu
http://lists.crux.nu/mailman/listinfo/crux
 
Old 12-03-2010, 06:28 AM
Juergen Daubert
 
Default crux's udev

On Tue, Nov 16, 2010 at 09:47:27PM +0100, Michal Soltys wrote:
> Hi,
>
> While peeking over how you do things in crux it, I've found some things that
> could potentially be adjusted.

I've committed a new version of the udev port yesterday. Thanks again
for your contribution.

regards
Juergen

--
Juergen Daubert | mailto:jue@jue.li
Korb, Germany | http://jue.li/crux

_______________________________________________
CRUX mailing list
CRUX@lists.crux.nu
http://lists.crux.nu/mailman/listinfo/crux
 
Old 12-03-2010, 07:17 AM
Michal Soltys
 
Default crux's udev

On 03.12.2010 08:28, Juergen Daubert wrote:

On Tue, Nov 16, 2010 at 09:47:27PM +0100, Michal Soltys wrote:

Hi,

While peeking over how you do things in crux it, I've found some things that
could potentially be adjusted.


I've committed a new version of the udev port yesterday. Thanks again
for your contribution.

regards
Juergen



Yea, just saw in git.

Btw - once v165 get relased, you can remove extra processing for tmpfs case.

_______________________________________________
CRUX mailing list
CRUX@lists.crux.nu
http://lists.crux.nu/mailman/listinfo/crux
 

Thread Tools




All times are GMT. The time now is 08:36 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org