Skip to contentSkip to conversation

udev-cache related changes

PATCH In review Ben Shelton 8 participants 55 messages Aug 4, 2014 – Aug 25, 2014

lore
Share & tools
lore
#0 lore raw

cover udev-cache related changes

This patchset contains changes to the udev-cache scripts to reduce size on disk, to improve error reporting, and to fix bugs, and a few fixes and tweaks to udev overall.

The following changes since commit 5a09acef73b5cfc59bbcd3e93603c99a8c078bd8:

local.conf.sample.extended: fix example for EXTRA_USERS_PARAMS (2014-08-04 17:38:17 +0100)

are available in the git repository at:

git://github.com/ni/openembedded-core dev/bshelton/udev_cache
https://github.com/ni/openembedded-core/tree/dev/bshelton/udev_cache

Ben Shelton (2):
busybox: tar: enable CONFIG_FEATURE_TAR_LONG_OPTIONS
udev-cache: fix udev-cache changes to work with busybox tar

Richard Tollerton (18):
udev-cache: Compress the cache
udev-cache: choose a more descriptive cache filename
udev-cache: Honor VERBOSE for bootup message
udev-cache: Don't ignore errors from cache extract
udev-cache: Remove superfluous subshell on extract
udev-cache: Update cache tarball atomically
udev-cache: Create cache asynchronously udev-cache.default: documentation update
udev-cache: parametrize sysconf file paths
udev-cache: parametrize tar options
udev-cache: fix timestamp errors on systems lacking an RTC
udev-cache: Avoid caching udev.cache or non-devfs filesystems
udev-cache: refactor; improve verbosity and error handling
udev-cache: don't attempt to extract cache if it doesn't exist
udev-cache: invalidate on rules.d changes
udev: Make build MACHINE-specific
udev: Disable keymap support on machines lacking keyboard support
udev: don't halt if devtmpfs can't be mounted

 meta/recipes-core/busybox/busybox/defconfig    |  2 +-
 meta/recipes-core/udev/udev.inc                |  7 ++++++
 meta/recipes-core/udev/udev/init               | 30 +++++++++++++++-----------
 meta/recipes-core/udev/udev/udev-cache         | 21 ++++++++++++++----
 meta/recipes-core/udev/udev/udev-cache.default | 18 ++++++++++++++--
 5 files changed, 58 insertions(+), 20 deletions(-)
Signature · 1 line
2.0.4
#1 lore raw

PATCH 1/20 udev-cache: Compress the cache

From: Richard Tollerton <[email protected]>

$DEVCACHE is observed to be 100k uncompressed; compressing it reduces its size to ~5k.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---
 meta/recipes-core/udev/udev/init               | 2 +-
 meta/recipes-core/udev/udev/udev-cache         | 2 +-
 meta/recipes-core/udev/udev/udev-cache.default | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
meta/recipes-core/udev/udev/init +1 -1
index f2c84d5..1e69861 100644
@@ -69,7 +69,7 @@ case "$1" in
 		    readfiles /etc/udev/cache.data
 		    OLDDATA="$READDATA"
 		    if [ "$OLDDATA" = "$NEWDATA" ]; then
-                            (cd /; tar xf $DEVCACHE > /dev/null 2>&1)
+                            (cd /; tar xzf $DEVCACHE > /dev/null 2>&1)
                             not_first_boot=1
                             [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
                             [ -e /dev/shm/udev.cache ] && rm -f /dev/shm/udev.cache
meta/recipes-core/udev/udev/udev-cache +1 -1
index db5a513..3769062 100644
@@ -25,7 +25,7 @@ fi
 
 if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then
 	echo "Populating dev cache"
-	(cd /; tar cf "$DEVCACHE" dev)
+	(cd /; tar czf "$DEVCACHE" dev)
 	mv /dev/shm/udev.cache /etc/udev/cache.data
 fi
 
meta/recipes-core/udev/udev/udev-cache.default +1 -1
index 2093336..909ec87 100644
@@ -1,5 +1,5 @@
 # Default for /etc/init.d/udev
 
 # Comment this out to disable device cache
-DEVCACHE="/etc/dev.tar"
+DEVCACHE="/etc/dev.tar.gz"
 PROBE_PLATFORM_BUS="yes"
Signature · 1 line
2.0.4
Acked-by on v1 1/20
#2 lore raw

Re: [PATCH 01/20] udev-cache: Compress the cache

Quoted 9 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

$DEVCACHE is observed to be 100k uncompressed; compressing it reduces its size to ~5k.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#3 lore raw

Re: [PATCH 01/20] udev-cache: Compress the cache

In reply to Ben Shelton
Quoted 20 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

$DEVCACHE is observed to be 100k uncompressed; compressing it reduces its size to ~5k.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---
 meta/recipes-core/udev/udev/init               | 2 +-
 meta/recipes-core/udev/udev/udev-cache         | 2 +-
 meta/recipes-core/udev/udev/udev-cache.default | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
meta/recipes-core/udev/udev/init +0 -0
index f2c84d5..1e69861 100644

meta/recipes-core/udev/udev/init case "$1" in · line 72

Quoted 5 lines
meta/recipes-core/udev/udev/init +1 -1
@@ -69,7 +69,7 @@ case "$1" in
 		    readfiles /etc/udev/cache.data
 		    OLDDATA="$READDATA"
 		    if [ "$OLDDATA" = "$NEWDATA" ]; then
-                            (cd /; tar xf $DEVCACHE > /dev/null 2>&1)
+                            (cd /; tar xzf $DEVCACHE > /dev/null 2>&1)

wouldnt cf still handle gz and xz or any other compression ?

#4 lore raw

Re: [PATCH 01/20] udev-cache: Compress the cache

Quoted 16 lines · Khem Raj
Quoted 15 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

$DEVCACHE is observed to be 100k uncompressed; compressing it reduces its size to ~5k.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---
 meta/recipes-core/udev/udev/init               | 2 +-
 meta/recipes-core/udev/udev/udev-cache         | 2 +-
 meta/recipes-core/udev/udev/udev-cache.default | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
Quoted 12 lines

meta/recipes-core/udev/udev/init case "$1" in · line 72

Quoted 10 lines
meta/recipes-core/udev/udev/init +1 -1
index f2c84d5..1e69861 100644
@@ -69,7 +69,7 @@ case "$1" in
 		    readfiles /etc/udev/cache.data
 		    OLDDATA="$READDATA"
 		    if [ "$OLDDATA" = "$NEWDATA" ]; then
-                            (cd /; tar xf $DEVCACHE > /dev/null 2>&1)
+                            (cd /; tar xzf $DEVCACHE > /dev/null 2>&1)

wouldnt cf still handle gz and xz or any other compression ?

Do you mean xf? If so, then yes, I think it would.

What would be the advantage of doing it that way? Just one fewer change?

Thanks,
Ben

#5 lore raw

Re: [PATCH 01/20] udev-cache: Compress the cache

Quoted 18 lines · Ben Shelton
Quoted 16 lines · Khem Raj
Quoted 15 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

$DEVCACHE is observed to be 100k uncompressed; compressing it reduces its size to ~5k.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---
 meta/recipes-core/udev/udev/init               | 2 +-
 meta/recipes-core/udev/udev/udev-cache         | 2 +-
 meta/recipes-core/udev/udev/udev-cache.default | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
Quoted 1 line
Quoted 1 line

Review

Quoted 1 line
(quoted diff) +0 -0

b/meta/recipes-core/udev/udev/init

Quoted 9 lines
Quoted 9 lines

meta/recipes-core/udev/udev/init case "$1" in · line 72

Quoted 9 lines

index f2c84d5..1e69861 100644

meta/recipes-core/udev/udev/init +1 -1
@@ -69,7 +69,7 @@ case "$1" in
                readfiles /etc/udev/cache.data
                OLDDATA="$READDATA"
                if [ "$OLDDATA" = "$NEWDATA" ]; then
-                            (cd /; tar xf $DEVCACHE > /dev/null 2>&1)
+                            (cd /; tar xzf $DEVCACHE > /dev/null

2>&1)

Quoted 7 lines
Quoted 2 lines

wouldnt cf still handle gz and xz or any other compression ?

Do you mean xf? If so, then yes, I think it would.

What would be the advantage of doing it that way? Just one fewer change?

yes and tomorrow you might want to use different compression this wont change

Quoted 4 lines

Thanks,
Ben

#6 lore raw

Re: [PATCH 01/20] udev-cache: Compress the cache

In reply to Ben Shelton
Quoted 8 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

$DEVCACHE is observed to be 100k uncompressed; compressing it reduces its size to ~5k.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

This is a good series of patches; thanks for sending them.

It would be nice if you could remove your company's ID tags from the commit log. For example, you create and use could use a YP bugzilla ID ( https://bugzilla.yoctoproject.org/ ) and then match that up in your internal process.

Thanks,
../Randy

Quoted 45 lines
---
  meta/recipes-core/udev/udev/init               | 2 +-
  meta/recipes-core/udev/udev/udev-cache         | 2 +-
  meta/recipes-core/udev/udev/udev-cache.default | 2 +-
  3 files changed, 3 insertions(+), 3 deletions(-)
meta/recipes-core/udev/udev/init +1 -1
index f2c84d5..1e69861 100644
@@ -69,7 +69,7 @@ case "$1" in
  		    readfiles /etc/udev/cache.data
  		    OLDDATA="$READDATA"
  		    if [ "$OLDDATA" = "$NEWDATA" ]; then
-                            (cd /; tar xf $DEVCACHE > /dev/null 2>&1)
+                            (cd /; tar xzf $DEVCACHE > /dev/null 2>&1)
                              not_first_boot=1
                              [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
                              [ -e /dev/shm/udev.cache ] && rm -f /dev/shm/udev.cache
meta/recipes-core/udev/udev/udev-cache +1 -1
index db5a513..3769062 100644
@@ -25,7 +25,7 @@ fi
 
  if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then
  	echo "Populating dev cache"
-	(cd /; tar cf "$DEVCACHE" dev)
+	(cd /; tar czf "$DEVCACHE" dev)
  	mv /dev/shm/udev.cache /etc/udev/cache.data
  fi
 
meta/recipes-core/udev/udev/udev-cache.default +1 -1
index 2093336..909ec87 100644
@@ -1,5 +1,5 @@
  # Default for /etc/init.d/udev
 
  # Comment this out to disable device cache
-DEVCACHE="/etc/dev.tar"
+DEVCACHE="/etc/dev.tar.gz"
  PROBE_PLATFORM_BUS="yes"
Signature · 2 lines
# Randy MacLeod. SMTS, Linux, Wind River
Direct: 613.963.1350
#7 lore raw

Re: [PATCH 01/20] udev-cache: Compress the cache

Quoted 13 lines · Randy MacLeod
Quoted 9 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

$DEVCACHE is observed to be 100k uncompressed; compressing it reduces its size to ~5k.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

Quoted 6 lines

This is a good series of patches; thanks for sending them.

It would be nice if you could remove your company's ID tags from the commit log. For example, you create and use could use a YP bugzilla ID ( https://bugzilla.yoctoproject.org/ ) and then match that up in your internal process.

I don't think we should ask for this. I saw several of us to include Id tags in past commits (I also did) and I think it is fine. We shouldn't ask an extra step for people to be able to track it (open a YP bugzilla ID issue for example).

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#8 lore raw

Re: [PATCH 01/20] udev-cache: Compress the cache

Quoted 22 lines · Otavio Salvador
Quoted 13 lines · Randy MacLeod
Quoted 9 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

$DEVCACHE is observed to be 100k uncompressed; compressing it reduces its size to ~5k.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

Quoted 6 lines

This is a good series of patches; thanks for sending them.

It would be nice if you could remove your company's ID tags from the commit log. For example, you create and use could use a YP bugzilla ID ( https://bugzilla.yoctoproject.org/ ) and then match that up in your internal process.

Quoted 5 lines

I don't think we should ask for this. I saw several of us to include Id tags in past commits (I also did) and I think it is fine. We shouldn't ask an extra step for people to be able to track it (open a YP bugzilla ID issue for example).

Wind River patches used to include a "CQID" tag but we've changed our process to avoid needing such internal tags. If National Instruments can do so as well, that'd be best.

I did check my oe-core email list history and this seems like the first patch from NI that has the tags included so I thought I'd reply and see if we can get the tags dropped.

Ben, what's the story?

Signature · 2 lines
# Randy MacLeod. SMTS, Linux, Wind River
Direct: 613.963.1350
#9 lore raw

Re: [PATCH 01/20] udev-cache: Compress the cache

Quoted 33 lines · Randy MacLeod
Quoted 22 lines · Otavio Salvador
Quoted 13 lines · Randy MacLeod
Quoted 9 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

$DEVCACHE is observed to be 100k uncompressed; compressing it reduces its size to ~5k.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

Quoted 6 lines

This is a good series of patches; thanks for sending them.

It would be nice if you could remove your company's ID tags from the commit log. For example, you create and use could use a YP bugzilla ID ( https://bugzilla.yoctoproject.org/ ) and then match that up in your internal process.

Quoted 5 lines

I don't think we should ask for this. I saw several of us to include Id tags in past commits (I also did) and I think it is fine. We shouldn't ask an extra step for people to be able to track it (open a YP bugzilla ID issue for example).

Wind River patches used to include a "CQID" tag but we've changed our process to avoid needing such internal tags. If National Instruments can do so as well, that'd be best.

Quoted 5 lines

I did check my oe-core email list history and this seems like the first patch from NI that has the tags included so I thought I'd reply and see if we can get the tags dropped.

Ben, what's the story?

In the past, I've stripped the tags before posting the patches. Looks like I forgot this time -- I'll remove the tags when I submit v2 of the patch set.

Thanks,
Ben

Quoted 4 lines
Signature · 3 lines
-- 
# Randy MacLeod. SMTS, Linux, Wind River
Direct: 613.963.1350
#10 lore raw

Patch message guidelines and internal/corporate fields

In reply to Randy MacLeod
Quoted 7 lines · Randy MacLeod

Wind River patches used to include a "CQID" tag but we've changed our process to avoid needing such internal tags. If National Instruments can do so as well, that'd be best.

I did check my oe-core email list history and this seems like the first patch from NI that has the tags included so I thought I'd reply and see if we can get the tags dropped.

IIRC, we pinged Phil a few months ago on this topic, and he thought internal tags were OK. I think Wind River might have been cited as an example.

I see that
http://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines hasn't been updated with this requirement. Should it be? Will that require TSC approval?

Quoted 4 lines
Signature · 3 lines
# Randy MacLeod. SMTS, Linux, Wind River
Direct: 613.963.1350
-- 
Signature · 1 line
Richard Tollerton <[email protected]>
#11 lore raw

Re: Patch message guidelines and internal/corporate fields

Quoted 10 lines · Richard Tollerton
Quoted 7 lines · Randy MacLeod

Wind River patches used to include a "CQID" tag but we've changed our process to avoid needing such internal tags. If National Instruments can do so as well, that'd be best.

I did check my oe-core email list history and this seems like the first patch from NI that has the tags included so I thought I'd reply and see if we can get the tags dropped.

Quoted 8 lines

IIRC, we pinged Phil a few months ago on this topic, and he thought internal tags were OK. I think Wind River might have been cited as an example.

I see that
http://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines hasn't been updated with this requirement. Should it be? Will that require TSC approval?

I don't have a strong preference on this to be honest. I can imagine cases where its useful to have some kind of tracking of issues into the final commits.

Obviously it would be better if everyone can understand what the numbers mean, equally, it seems pointless to force people to strip them when they might be useful to people contributing to the project.

If they are used as a substitute for a good commit message, that wouldn't be acceptable. Also, if they were taking over the commit messages, that would able be unacceptable. So if we can keep them to a small part of the commit, I'm prepared to let them pass but it can't be at the expense of good commit messages.

I don't believe we need a TSC decision, that would only be needed if there were strong disagreements we were unable to resolve and I don't think we're quite there yet :) I'll let others comment though and see where we're at.

Cheers,

Richard

#12 lore raw

Re: Patch message guidelines and internal/corporate fields

Quoted 33 lines · On Saturday 23 August 2014 09:40:44 Richard Purdie wrote:
Quoted 9 lines · Richard Tollerton
Quoted 7 lines · Randy MacLeod

Wind River patches used to include a "CQID" tag but we've changed our process to avoid needing such internal tags. If National Instruments can do so as well, that'd be best.

I did check my oe-core email list history and this seems like the first patch from NI that has the tags included so I thought I'd reply and see if we can get the tags dropped.

Quoted 8 lines

IIRC, we pinged Phil a few months ago on this topic, and he thought internal tags were OK. I think Wind River might have been cited as an example.

I see that
http://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines hasn't been updated with this requirement. Should it be? Will that require TSC approval?

I don't have a strong preference on this to be honest. I can imagine cases where its useful to have some kind of tracking of issues into the final commits.

Obviously it would be better if everyone can understand what the numbers mean, equally, it seems pointless to force people to strip them when they might be useful to people contributing to the project.

If they are used as a substitute for a good commit message, that wouldn't be acceptable. Also, if they were taking over the commit messages, that would able be unacceptable. So if we can keep them to a small part of the commit, I'm prepared to let them pass but it can't be at the expense of good commit messages.

Quoted 4 lines

I don't believe we need a TSC decision, that would only be needed if there were strong disagreements we were unable to resolve and I don't think we're quite there yet :) I'll let others comment though and see where we're at.

FWIW I agree with all of the above - if they make contributors' lives easier then I don't see a good reason to disallow their usage given we're only talking about one line at the end of a proper commit message.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#13 lore raw

Re: Patch message guidelines and internal/corporate fields

Quoted 34 lines · Paul Eggleton
Quoted 33 lines · On Saturday 23 August 2014 09:40:44 Richard Purdie wrote:
Quoted 9 lines · Richard Tollerton
Quoted 7 lines · Randy MacLeod

Wind River patches used to include a "CQID" tag but we've changed our process to avoid needing such internal tags. If National Instruments can do so as well, that'd be best.

I did check my oe-core email list history and this seems like the first patch from NI that has the tags included so I thought I'd reply and see if we can get the tags dropped.

Quoted 8 lines

IIRC, we pinged Phil a few months ago on this topic, and he thought internal tags were OK. I think Wind River might have been cited as an example.

I see that
http://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines hasn't been updated with this requirement. Should it be? Will that require TSC approval?

I don't have a strong preference on this to be honest. I can imagine cases where its useful to have some kind of tracking of issues into the final commits.

Obviously it would be better if everyone can understand what the numbers mean, equally, it seems pointless to force people to strip them when they might be useful to people contributing to the project.

If they are used as a substitute for a good commit message, that wouldn't be acceptable. Also, if they were taking over the commit messages, that would able be unacceptable. So if we can keep them to a small part of the commit, I'm prepared to let them pass but it can't be at the expense of good commit messages.

Quoted 8 lines
Quoted 4 lines

I don't believe we need a TSC decision, that would only be needed if there were strong disagreements we were unable to resolve and I don't think we're quite there yet :) I'll let others comment though and see where we're at.

FWIW I agree with all of the above - if they make contributors' lives easier then I don't see a good reason to disallow their usage given we're only talking about one line at the end of a proper commit message.

I would rather think that if the information is not accessible to community members, its not a useful to add these numbers. Secondly it could be fixing someone else's bug in a different bug tracking system with different tracking number and if he she does a backport and adds his tracking number as well to commit. Now think of what will happen if people start to do it for Linux kernel. So IMHO its best that companies track it in their respective issue tracking systems by adding upstream commit urls or SHA ids whatever is convinient to support any automation tools they might have(if any) That way we solve the problem for everyone. On
these grounds I would not recommend adding it in commit messages. We let Yocto bugzilla entries in commits because that system is accessible to everyone using OE.

Thanks

-Khem

#14 lore raw

PATCH 2/20 udev-cache: choose a more descriptive cache filename

In reply to Ben Shelton

From: Richard Tollerton <[email protected]>

"/etc/dev.tar.gz" doesn't adequately imply that udev-cache maintains it. Instead, call it "/etc/udev-cache.tar.gz".

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---
 meta/recipes-core/udev/udev/udev-cache.default | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/udev/udev/udev-cache.default +1 -1
index 909ec87..a3b7326 100644
@@ -1,5 +1,5 @@
 # Default for /etc/init.d/udev
 
 # Comment this out to disable device cache
-DEVCACHE="/etc/dev.tar.gz"
+DEVCACHE="/etc/udev-cache.tar.gz"
 PROBE_PLATFORM_BUS="yes"
Signature · 1 line
2.0.4
Acked-by on v1 2/20
#15 lore raw

Re: [PATCH 02/20] udev-cache: choose a more descriptive cache filename

Quoted 10 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

"/etc/dev.tar.gz" doesn't adequately imply that udev-cache maintains it. Instead, call it "/etc/udev-cache.tar.gz".

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#16 lore raw

PATCH 3/20 udev-cache: Honor VERBOSE for bootup message

In reply to Ben Shelton

From: Richard Tollerton <[email protected]>

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---
 meta/recipes-core/udev/udev/udev-cache | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/udev/udev/udev-cache +1 -1
index 3769062..154d2ad 100644
@@ -24,7 +24,7 @@ if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
 fi
 
 if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then
-	echo "Populating dev cache"
+	[ "${VERBOSE}" != "no" ] && echo "Populating dev cache"
 	(cd /; tar czf "$DEVCACHE" dev)
 	mv /dev/shm/udev.cache /etc/udev/cache.data
 fi
Signature · 1 line
2.0.4
Acked-by on v1 3/20
#17 lore raw

Re: [PATCH 03/20] udev-cache: Honor VERBOSE for bootup message

Quoted 7 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#18 lore raw

PATCH 4/20 udev-cache: Don't ignore errors from cache extract

In reply to Ben Shelton

From: Richard Tollerton <[email protected]>

Currently, error messages generated during tarball extract are suppressed. This seems ham-handed, particularly since under normal operation, the only expected error ought to be the attempted extraction of pipes, which typically only means /dev/log.

So stop the redirections and add an --exclude=log to suppress the error message when attempting to extract /dev/log.

This requires CONFIG_FEATURE_TAR_LONG_OPTIONS if using busybox tar.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---
 meta/recipes-core/udev/udev/init | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/udev/udev/init +1 -1
index 1e69861..a96309d 100644
@@ -69,7 +69,7 @@ case "$1" in
 		    readfiles /etc/udev/cache.data
 		    OLDDATA="$READDATA"
 		    if [ "$OLDDATA" = "$NEWDATA" ]; then
-                            (cd /; tar xzf $DEVCACHE > /dev/null 2>&1)
+                            (cd /; tar xzf $DEVCACHE --exclude=log)
                             not_first_boot=1
                             [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
                             [ -e /dev/shm/udev.cache ] && rm -f /dev/shm/udev.cache
Signature · 1 line
2.0.4
Acked-by on v1 4/20
#19 lore raw

Re: [PATCH 04/20] udev-cache: Don't ignore errors from cache extract

Quoted 10 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

Currently, error messages generated during tarball extract are suppressed. This seems ham-handed, particularly since under normal operation, the only expected error ought to be the attempted extraction of pipes, which typically only means /dev/log.

So stop the redirections and add an --exclude=log to suppress the error message when attempting to extract /dev/log.

Quoted 7 lines

This requires CONFIG_FEATURE_TAR_LONG_OPTIONS if using busybox tar.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---

I didn't test this at runtime so my only question is did you check if we provide this option by default in busybox?

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#20 lore raw

PATCH 5/20 busybox: tar: enable CONFIG_FEATURE_TAR_LONG_OPTIONS

In reply to Ben Shelton

This config flag is needed to support the --exclude option, which is needed for the commit 'udev-cache: Don't ignore errors from cache extract'.

Enabling this option adds 352 bytes to the size of busybox on i386.

---
 meta/recipes-core/busybox/busybox/defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/busybox/busybox/defconfig +1 -1
index 0107231..d2a67c2 100644
@@ -156,7 +156,7 @@ CONFIG_FEATURE_TAR_FROM=y
 CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY=y
 # CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set
 CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
-# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set
+CONFIG_FEATURE_TAR_LONG_OPTIONS=y
 # CONFIG_FEATURE_TAR_TO_COMMAND is not set
 # CONFIG_FEATURE_TAR_UNAME_GNAME is not set
 # CONFIG_FEATURE_TAR_NOPRESERVE_TIME is not set
Signature · 1 line
2.0.4
Acked-by on v1 5/20
#21 lore raw

Re: [PATCH 05/20] busybox: tar: enable CONFIG_FEATURE_TAR_LONG_OPTIONS

Quoted 7 lines · Ben Shelton

This config flag is needed to support the --exclude option, which is needed for the commit 'udev-cache: Don't ignore errors from cache extract'.

Enabling this option adds 352 bytes to the size of busybox on i386.

You answered my question. Please invert the order of this patch to come before 04/20 or it may cause runtime error if someone builds an image on this on previous patch.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#22 lore raw

PATCH 6/20 udev-cache: Remove superfluous subshell on extract

In reply to Ben Shelton

From: Richard Tollerton <[email protected]>

tar -C exists in both GNU and busybox tar, so use that instead of (cd /; tar ...). This allows the subshell to be removed.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---
 meta/recipes-core/udev/udev/init       | 2 +-
 meta/recipes-core/udev/udev/udev-cache | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
meta/recipes-core/udev/udev/init +1 -1
index a96309d..bcb9040 100644
@@ -69,7 +69,7 @@ case "$1" in
 		    readfiles /etc/udev/cache.data
 		    OLDDATA="$READDATA"
 		    if [ "$OLDDATA" = "$NEWDATA" ]; then
-                            (cd /; tar xzf $DEVCACHE --exclude=log)
+                            tar xzf $DEVCACHE -C / --exclude=log
                             not_first_boot=1
                             [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
                             [ -e /dev/shm/udev.cache ] && rm -f /dev/shm/udev.cache
meta/recipes-core/udev/udev/udev-cache +1 -1
index 154d2ad..11c5f0e 100644
@@ -25,7 +25,7 @@ fi
 
 if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then
 	[ "${VERBOSE}" != "no" ] && echo "Populating dev cache"
-	(cd /; tar czf "$DEVCACHE" dev)
+	tar czf "$DEVCACHE" dev -C / --exclude=log
 	mv /dev/shm/udev.cache /etc/udev/cache.data
 fi
 
Signature · 1 line
2.0.4
Acked-by on v1 6/20
#23 lore raw

Re: [PATCH 06/20] udev-cache: Remove superfluous subshell on extract

Quoted 10 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

tar -C exists in both GNU and busybox tar, so use that instead of (cd /; tar ...). This allows the subshell to be removed.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#24 lore raw

PATCH 7/20 udev-cache: Update cache tarball atomically

In reply to Ben Shelton

From: Richard Tollerton <[email protected]>

Overwriting the tarball in-place could cause a partial write, if the system stops at an inopportune time. This is mitigated by first writing to a temporary file, then moving that file on top of the final location.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---
 meta/recipes-core/udev/udev/udev-cache | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-core/udev/udev/udev-cache +2 -1
index 11c5f0e..679adb4 100644
@@ -25,7 +25,8 @@ fi
 
 if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then
 	[ "${VERBOSE}" != "no" ] && echo "Populating dev cache"
-	tar czf "$DEVCACHE" dev -C / --exclude=log
+	tar czf "${DEVCACHE}.tmp" dev -C / --exclude=log
+	mv -f "${DEVCACHE}.tmp" "$DEVCACHE"
 	mv /dev/shm/udev.cache /etc/udev/cache.data
 fi
 
Signature · 1 line
2.0.4
Acked-by on v1 7/20
#25 lore raw

Re: [PATCH 07/20] udev-cache: Update cache tarball atomically

Quoted 10 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

Overwriting the tarball in-place could cause a partial write, if the system stops at an inopportune time. This is mitigated by first writing to a temporary file, then moving that file on top of the final location.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

As an improvement, this could be written in tmpfs so it avoid duplicated writting. For NAND devices without much free space this might matter.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#26 lore raw

PATCH 8/20 udev-cache: Create cache asynchronously

In reply to Ben Shelton

From: Richard Tollerton <[email protected]>

Don't hold up the boot while the cache tarball is created.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---
 meta/recipes-core/udev/udev/udev-cache | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
meta/recipes-core/udev/udev/udev-cache +5 -3
index 679adb4..e730608 100644
@@ -25,9 +25,11 @@ fi
 
 if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then
 	[ "${VERBOSE}" != "no" ] && echo "Populating dev cache"
-	tar czf "${DEVCACHE}.tmp" dev -C / --exclude=log
-	mv -f "${DEVCACHE}.tmp" "$DEVCACHE"
-	mv /dev/shm/udev.cache /etc/udev/cache.data
+	(
+		tar czf "${DEVCACHE}.tmp" dev -C / --exclude=log
+		mv -f "${DEVCACHE}.tmp" "$DEVCACHE"
+		mv /dev/shm/udev.cache /etc/udev/cache.data
+	) &
 fi
 
 exit 0
Signature · 1 line
2.0.4
#27 lore raw

Re: [PATCH 08/20] udev-cache: Create cache asynchronously

Quoted 8 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

Don't hold up the boot while the cache tarball is created.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

I am not sure about this one. I see the value you are adding here but I worry how often something can be connected during this process and change the contents along the way. Did you see something as that during your tests?

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#28 lore raw

Re: [PATCH 08/20] udev-cache: Create cache asynchronously

Quoted 4 lines · Otavio Salvador

I am not sure about this one. I see the value you are adding here but I worry how often something can be connected during this process and change the contents along the way. Did you see something as that during your tests?

No, but point taken. I didn't really test "physical" hotplug during bootup -- and in particular, for this to be a persisting issue, the added/removed device must be removed/added during this boot -- but I suppose that is totally possible.

This reflects an underlying race condition, starting at the computation of NEWDATA/OLDDATA in the udev initscript, and ending in the tarball creation in udev-cache. I suppose that we can mitigate this by spinning in udev-cache until the devcache stops changing...? Cheesy, untested, dirty RFC follows:

meta/recipes-core/udev/udev/udev-cache +16 -0
index 9ad3b4d..3b744c5 100644
@@ -28,6 +28,13 @@ fi
 [ -e "$DEVCACHE_CURRENT_SYSCONF" ] || exit 0
 [ "${VERBOSE}" == "no" ] || echo "found; building cache."
 
+# assume readfiles and CMP_FILE_LIST are copied from udev initscript
+readfiles "$DEVCACHE_SYSCONF"
+DATA2="$READDATA"
+
+while true; do
+	DATA1="$DATA2"
+
 	if [ ! `readlink -f /bin/tar` = "/bin/tar.tar" ]; then
 		(
 			find /dev \( -type b -o -type c -o -type l \) -xdev | cut -c 2- | xargs tar czf "${DEVCACHE}.tmp" -C / $BUSYBOX_DEVCACHE_CREATE_OPTS && \
@@ -42,4 +49,13 @@ else
 		) &
 	fi
 
+	readfiles $CMP_FILE_LIST
+	DATA2="$READDATA$RULELIST"
+	if [ "$DATA1" = "$DATA2" ]; then
+		break
+	else
+		echo "$DATA2" > "$DEVCACHE_CURRENT_SYSCONF"
+	fi
+done
+
 exit 0
Quoted 5 lines
Signature · 4 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
-- 
Signature · 1 line
Richard Tollerton <[email protected]>
#29 lore raw

Re: [PATCH 08/20] udev-cache: Create cache asynchronously

Quoted 12 lines · Richard Tollerton
Quoted 4 lines · Otavio Salvador

I am not sure about this one. I see the value you are adding here but I worry how often something can be connected during this process and change the contents along the way. Did you see something as that during your tests?

No, but point taken. I didn't really test "physical" hotplug during bootup -- and in particular, for this to be a persisting issue, the added/removed device must be removed/added during this boot -- but I suppose that is totally possible.

Quoted 5 lines

This reflects an underlying race condition, starting at the computation of NEWDATA/OLDDATA in the udev initscript, and ending in the tarball creation in udev-cache. I suppose that we can mitigate this by spinning in udev-cache until the devcache stops changing...? Cheesy, untested, dirty RFC follows:

You need to check the list of files taken by 'tar' and compare. This mitigates it but does not really solves the issue.

Maybe we could "copy" the nodes to a tmp area and use this as a snapshot? The copy should be fast and makes it mostly "atomic".

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#30 lore raw

Re: [PATCH 08/20] udev-cache: Create cache asynchronously

Quoted 13 lines · Otavio Salvador
Quoted 12 lines · Richard Tollerton
Quoted 4 lines · Otavio Salvador

I am not sure about this one. I see the value you are adding here but I worry how often something can be connected during this process and change the contents along the way. Did you see something as that during your tests?

No, but point taken. I didn't really test "physical" hotplug during bootup -- and in particular, for this to be a persisting issue, the added/removed device must be removed/added during this boot -- but I suppose that is totally possible.

Quoted 8 lines
Quoted 5 lines

This reflects an underlying race condition, starting at the computation of NEWDATA/OLDDATA in the udev initscript, and ending in the tarball creation in udev-cache. I suppose that we can mitigate this by spinning in udev-cache until the devcache stops changing...? Cheesy, untested, dirty RFC follows:

You need to check the list of files taken by 'tar' and compare. This mitigates it but does not really solves the issue.

Hmm, I'm confused. If we relied entirely on /dev contents, how would we detect (and correct for) if a device was removed between the execution of udev and of udev-cache?

Quoted 2 lines

Maybe we could "copy" the nodes to a tmp area and use this as a snapshot? The copy should be fast and makes it mostly "atomic".

I agree that the copy of the contents of /dev needs to be as fast as possible -- your about using tmpfs as a staging area is well taken. But beyond that, it seems to me that the root issue you articulated is about ensuring adequate synchronization of udev.cache and the tarball; rereading CMP_FILE_LIST in udev-cache thus seems unavoidable.

Quoted 4 lines
Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
Signature · 1 line
Richard Tollerton <[email protected]>
#31 lore raw

Re: [PATCH 08/20] udev-cache: Create cache asynchronously

Quoted 28 lines · Richard Tollerton
Quoted 13 lines · Otavio Salvador
Quoted 12 lines · Richard Tollerton
Quoted 4 lines · Otavio Salvador

I am not sure about this one. I see the value you are adding here but I worry how often something can be connected during this process and change the contents along the way. Did you see something as that during your tests?

No, but point taken. I didn't really test "physical" hotplug during bootup -- and in particular, for this to be a persisting issue, the added/removed device must be removed/added during this boot -- but I suppose that is totally possible.

Quoted 8 lines
Quoted 5 lines

This reflects an underlying race condition, starting at the computation of NEWDATA/OLDDATA in the udev initscript, and ending in the tarball creation in udev-cache. I suppose that we can mitigate this by spinning in udev-cache until the devcache stops changing...? Cheesy, untested, dirty RFC follows:

You need to check the list of files taken by 'tar' and compare. This mitigates it but does not really solves the issue.

Hmm, I'm confused. If we relied entirely on /dev contents, how would we detect (and correct for) if a device was removed between the execution of udev and of udev-cache?

Quoted 8 lines
Quoted 2 lines

Maybe we could "copy" the nodes to a tmp area and use this as a snapshot? The copy should be fast and makes it mostly "atomic".

I agree that the copy of the contents of /dev needs to be as fast as possible -- your about using tmpfs as a staging area is well taken. But beyond that, it seems to me that the root issue you articulated is about ensuring adequate synchronization of udev.cache and the tarball; rereading CMP_FILE_LIST in udev-cache thus seems unavoidable.

Yes, that's why I think we need:

- copy contents to a staging area
- generate the tarball

This way we avoid the following steps:

- generate the list of contents
- generate the tarball
- generate tarball's contents
- compare, loop if does not match.

Makes sense?

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#32 lore raw

Re: [PATCH 08/20] udev-cache: Create cache asynchronously

Quoted 43 lines · Otavio Salvador
Quoted 28 lines · Richard Tollerton
Quoted 13 lines · Otavio Salvador
Quoted 12 lines · Richard Tollerton
Quoted 4 lines · Otavio Salvador

I am not sure about this one. I see the value you are adding here but I worry how often something can be connected during this process and change the contents along the way. Did you see something as that during your tests?

No, but point taken. I didn't really test "physical" hotplug during bootup -- and in particular, for this to be a persisting issue, the added/removed device must be removed/added during this boot -- but I suppose that is totally possible.

Quoted 8 lines
Quoted 5 lines

This reflects an underlying race condition, starting at the computation of NEWDATA/OLDDATA in the udev initscript, and ending in the tarball creation in udev-cache. I suppose that we can mitigate this by spinning in udev-cache until the devcache stops changing...? Cheesy, untested, dirty RFC follows:

You need to check the list of files taken by 'tar' and compare. This mitigates it but does not really solves the issue.

Hmm, I'm confused. If we relied entirely on /dev contents, how would we detect (and correct for) if a device was removed between the execution of udev and of udev-cache?

Quoted 8 lines
Quoted 2 lines

Maybe we could "copy" the nodes to a tmp area and use this as a snapshot? The copy should be fast and makes it mostly "atomic".

I agree that the copy of the contents of /dev needs to be as fast as possible -- your about using tmpfs as a staging area is well taken. But beyond that, it seems to me that the root issue you articulated is about ensuring adequate synchronization of udev.cache and the tarball; rereading CMP_FILE_LIST in udev-cache thus seems unavoidable.

Yes, that's why I think we need:

- copy contents to a staging area
- generate the tarball

Quoted 8 lines

This way we avoid the following steps:

- generate the list of contents
- generate the tarball
- generate tarball's contents
- compare, loop if does not match.

Makes sense?

Yes, with one friendly amendment: "copy contents" means copying $CMP_FILE_LIST in addition to /dev. Then we rebuild cache.data from that.

Quoted 4 lines
Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
Signature · 1 line
Richard Tollerton <[email protected]>
#33 lore raw

PATCH 9/20 udev-cache.default: documentation update

In reply to Ben Shelton

From: Richard Tollerton <[email protected]>

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---
 meta/recipes-core/udev/udev/udev-cache.default | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/udev/udev/udev-cache.default +1 -1
index a3b7326..656c2a4 100644
@@ -1,4 +1,4 @@
-# Default for /etc/init.d/udev
+# Default for /etc/init.d/udev, /etc/init.d/udev-cache
 
 # Comment this out to disable device cache
 DEVCACHE="/etc/udev-cache.tar.gz"
Signature · 1 line
2.0.4
Acked-by on v1 9/20
#34 lore raw

Re: [PATCH 09/20] udev-cache.default: documentation update

Quoted 7 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#35 lore raw

PATCH 10/20 udev-cache: parametrize sysconf file paths

In reply to Ben Shelton

From: Richard Tollerton <[email protected]>

The udev-cache facility uses files that represent system states, to ensure that the cache tarball is valid to apply. These paths were hardcoded in several places; collect them into DEVCACHE_SYSCONF and DEVCACHE_CURRENT_SYSCONF in the defaults file.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---
 meta/recipes-core/udev/udev/init               | 8 ++++----
 meta/recipes-core/udev/udev/udev-cache         | 4 ++--
 meta/recipes-core/udev/udev/udev-cache.default | 4 ++++
 3 files changed, 10 insertions(+), 6 deletions(-)
meta/recipes-core/udev/udev/init +4 -4
index bcb9040..5db029a 100644
@@ -66,13 +66,13 @@ case "$1" in
             if [ -e $DEVCACHE ]; then
 		    readfiles $CMP_FILE_LIST
 		    NEWDATA="$READDATA"
-		    readfiles /etc/udev/cache.data
+		    readfiles "$DEVCACHE_SYSCONF"
 		    OLDDATA="$READDATA"
 		    if [ "$OLDDATA" = "$NEWDATA" ]; then
                             tar xzf $DEVCACHE -C / --exclude=log
                             not_first_boot=1
                             [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
-                            [ -e /dev/shm/udev.cache ] && rm -f /dev/shm/udev.cache
+                            [ -e "$DEVCACHE_CURRENT_SYSCONF" ] && rm -f "$DEVCACHE_CURRENT_SYSCONF"
                     else
 			    # Output detailed reason why the cached /dev is not used
 			    if [ "$VERBOSE" != "no" ]; then
@@ -81,14 +81,14 @@ case "$1" in
 				    echo "udev: olddata: $OLDDATA"
 				    echo "udev: newdata: $NEWDATA"
 			    fi
-			    echo "$NEWDATA" > /dev/shm/udev.cache
+			    echo "$NEWDATA" > "$DEVCACHE_CURRENT_SYSCONF"
                     fi
 	    else
 		    if [ "$ROOTFS_READ_ONLY" != "yes" ]; then
 			    # If rootfs is not read-only, it's possible that a new udev cache would be generated;
 			    # otherwise, we do not bother to read files.
 			    readfiles $CMP_FILE_LIST
-			    echo "$READDATA" > /dev/shm/udev.cache
+			    echo "$READDATA" > "$DEVCACHE_CURRENT_SYSCONF"
 		    fi
             fi
     fi
meta/recipes-core/udev/udev/udev-cache +2 -2
index e730608..7406e07 100644
@@ -23,12 +23,12 @@ if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
     exit 0
 fi
 
-if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then
+if [ "$DEVCACHE" != "" -a -e "$DEVCACHE_CURRENT_SYSCONF" ]; then
 	[ "${VERBOSE}" != "no" ] && echo "Populating dev cache"
 	(
 		tar czf "${DEVCACHE}.tmp" dev -C / --exclude=log
 		mv -f "${DEVCACHE}.tmp" "$DEVCACHE"
-		mv /dev/shm/udev.cache /etc/udev/cache.data
+		mv "$DEVCACHE_CURRENT_SYSCONF" "$DEVCACHE_SYSCONF"
 	) &
 fi
 
meta/recipes-core/udev/udev/udev-cache.default +4 -0
index 656c2a4..7f39a68 100644
@@ -2,4 +2,8 @@
 
 # Comment this out to disable device cache
 DEVCACHE="/etc/udev-cache.tar.gz"
+
+DEVCACHE_SYSCONF="/etc/udev/cache.data"
+DEVCACHE_CURRENT_SYSCONF="/dev/shm/udev.cache"
+
 PROBE_PLATFORM_BUS="yes"
Signature · 1 line
2.0.4
#36 lore raw

Re: [PATCH 10/20] udev-cache: parametrize sysconf file paths

Quoted 12 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

The udev-cache facility uses files that represent system states, to ensure that the cache tarball is valid to apply. These paths were hardcoded in several places; collect them into DEVCACHE_SYSCONF and DEVCACHE_CURRENT_SYSCONF in the defaults file.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---

...

Quoted 22 lines
meta/recipes-core/udev/udev/udev-cache +2 -2
@@ -23,12 +23,12 @@ if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
     exit 0
 fi
 
-if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then
+if [ "$DEVCACHE" != "" -a -e "$DEVCACHE_CURRENT_SYSCONF" ]; then
        [ "${VERBOSE}" != "no" ] && echo "Populating dev cache"
        (
                tar czf "${DEVCACHE}.tmp" dev -C / --exclude=log
                mv -f "${DEVCACHE}.tmp" "$DEVCACHE"
-               mv /dev/shm/udev.cache /etc/udev/cache.data
+               mv "$DEVCACHE_CURRENT_SYSCONF" "$DEVCACHE_SYSCONF"
        ) &
 fi
 
meta/recipes-core/udev/udev/udev-cache.default +0 -0
index 656c2a4..7f39a68 100644

meta/recipes-core/udev/udev/udev-cache.default

Quoted 9 lines
meta/recipes-core/udev/udev/udev-cache.default +4 -1
@@ -2,4 +2,8 @@
 
 # Comment this out to disable device cache
 DEVCACHE="/etc/udev-cache.tar.gz"
+
+DEVCACHE_SYSCONF="/etc/udev/cache.data"
+DEVCACHE_CURRENT_SYSCONF="/dev/shm/udev.cache"
+
 PROBE_PLATFORM_BUS="yes"
--

Most users won't need to change this so I think this should have a default value in the script and don't be added in the default.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#37 lore raw

Re: [PATCH 10/20] udev-cache: parametrize sysconf file paths

Quoted 37 lines · Otavio Salvador
Quoted 12 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

The udev-cache facility uses files that represent system states, to ensure that the cache tarball is valid to apply. These paths were hardcoded in several places; collect them into DEVCACHE_SYSCONF and DEVCACHE_CURRENT_SYSCONF in the defaults file.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---

...

Quoted 23 lines
meta/recipes-core/udev/udev/udev-cache +2 -2
@@ -23,12 +23,12 @@ if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
     exit 0
 fi
 
-if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then
+if [ "$DEVCACHE" != "" -a -e "$DEVCACHE_CURRENT_SYSCONF" ]; then
        [ "${VERBOSE}" != "no" ] && echo "Populating dev cache"
        (
                tar czf "${DEVCACHE}.tmp" dev -C / --exclude=log
                mv -f "${DEVCACHE}.tmp" "$DEVCACHE"
-               mv /dev/shm/udev.cache /etc/udev/cache.data
+               mv "$DEVCACHE_CURRENT_SYSCONF" "$DEVCACHE_SYSCONF"
        ) &
 fi
 
meta/recipes-core/udev/udev/udev-cache.default +0 -0
index 656c2a4..7f39a68 100644
@@ -2,4 +2,8 @@
 
Quoted 12 lines

meta/recipes-core/udev/udev/udev-cache.default

Quoted 8 lines
meta/recipes-core/udev/udev/udev-cache.default +4 -1
 # Comment this out to disable device cache
 DEVCACHE="/etc/udev-cache.tar.gz"
+
+DEVCACHE_SYSCONF="/etc/udev/cache.data"
+DEVCACHE_CURRENT_SYSCONF="/dev/shm/udev.cache"
+
 PROBE_PLATFORM_BUS="yes"
--

Most users won't need to change this so I think this should have a default value in the script and don't be added in the default.

My concern is that the uses of both DEVCACHE_SYSCONF and DEVCACHE_CURRENT_SYSCONF are split across two script files: udev/init and udev/udev-cache. I don't like replicating the same default setting in both, but if that's preferable to adding it in the default, that's OK.

Ben

Quoted 4 lines
Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#38 lore raw

Re: [PATCH 10/20] udev-cache: parametrize sysconf file paths

Quoted 51 lines · Ben Shelton
Quoted 37 lines · Otavio Salvador
Quoted 12 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

The udev-cache facility uses files that represent system states, to ensure that the cache tarball is valid to apply. These paths were hardcoded in several places; collect them into DEVCACHE_SYSCONF and DEVCACHE_CURRENT_SYSCONF in the defaults file.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---

...

Quoted 23 lines
meta/recipes-core/udev/udev/udev-cache +2 -2
@@ -23,12 +23,12 @@ if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
     exit 0
 fi
 
-if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then
+if [ "$DEVCACHE" != "" -a -e "$DEVCACHE_CURRENT_SYSCONF" ]; then
        [ "${VERBOSE}" != "no" ] && echo "Populating dev cache"
        (
                tar czf "${DEVCACHE}.tmp" dev -C / --exclude=log
                mv -f "${DEVCACHE}.tmp" "$DEVCACHE"
-               mv /dev/shm/udev.cache /etc/udev/cache.data
+               mv "$DEVCACHE_CURRENT_SYSCONF" "$DEVCACHE_SYSCONF"
        ) &
 fi
 
meta/recipes-core/udev/udev/udev-cache.default +0 -0
index 656c2a4..7f39a68 100644
@@ -2,4 +2,8 @@
 
Quoted 12 lines

meta/recipes-core/udev/udev/udev-cache.default

Quoted 8 lines
meta/recipes-core/udev/udev/udev-cache.default +4 -1
 # Comment this out to disable device cache
 DEVCACHE="/etc/udev-cache.tar.gz"
+
+DEVCACHE_SYSCONF="/etc/udev/cache.data"
+DEVCACHE_CURRENT_SYSCONF="/dev/shm/udev.cache"
+
 PROBE_PLATFORM_BUS="yes"
--

Most users won't need to change this so I think this should have a default value in the script and don't be added in the default.

Quoted 5 lines

My concern is that the uses of both DEVCACHE_SYSCONF and DEVCACHE_CURRENT_SYSCONF are split across two script files: udev/init and udev/udev-cache. I don't like replicating the same default setting in both, but if that's preferable to adding it in the default, that's OK.

I think this also provides a backward compatibility for users providing their own default file. Otherwise you'll break those.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#39 lore raw

Re: [PATCH 10/20] udev-cache: parametrize sysconf file paths

Quoted 52 lines · Otavio Salvador
Quoted 51 lines · Ben Shelton
Quoted 49 lines · Otavio Salvador
Quoted 12 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

The udev-cache facility uses files that represent system states, to ensure that the cache tarball is valid to apply. These paths were hardcoded in several places; collect them into DEVCACHE_SYSCONF and DEVCACHE_CURRENT_SYSCONF in the defaults file.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---

...

Quoted 22 lines
meta/recipes-core/udev/udev/udev-cache +2 -2
@@ -23,12 +23,12 @@ if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
     exit 0
 fi
 
-if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then
+if [ "$DEVCACHE" != "" -a -e "$DEVCACHE_CURRENT_SYSCONF" ]; then
        [ "${VERBOSE}" != "no" ] && echo "Populating dev cache"
        (
                tar czf "${DEVCACHE}.tmp" dev -C / --exclude=log
                mv -f "${DEVCACHE}.tmp" "$DEVCACHE"
-               mv /dev/shm/udev.cache /etc/udev/cache.data
+               mv "$DEVCACHE_CURRENT_SYSCONF" "$DEVCACHE_SYSCONF"
        ) &
 fi
 
meta/recipes-core/udev/udev/udev-cache.default +0 -0
index 656c2a4..7f39a68 100644

meta/recipes-core/udev/udev/udev-cache.default

Quoted 9 lines
meta/recipes-core/udev/udev/udev-cache.default +4 -1
@@ -2,4 +2,8 @@
 
 # Comment this out to disable device cache
 DEVCACHE="/etc/udev-cache.tar.gz"
+
+DEVCACHE_SYSCONF="/etc/udev/cache.data"
+DEVCACHE_CURRENT_SYSCONF="/dev/shm/udev.cache"
+
 PROBE_PLATFORM_BUS="yes"
--

Most users won't need to change this so I think this should have a default value in the script and don't be added in the default.

Quoted 8 lines
Quoted 5 lines

My concern is that the uses of both DEVCACHE_SYSCONF and DEVCACHE_CURRENT_SYSCONF are split across two script files: udev/init and udev/udev-cache. I don't like replicating the same default setting in both, but if that's preferable to adding it in the default, that's OK.

I think this also provides a backward compatibility for users providing their own default file. Otherwise you'll break those.

Fair point. I'll make the change.

Thanks,
Ben

Quoted 5 lines
Signature · 4 lines
-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#40 lore raw

PATCH 11/20 udev-cache: parametrize tar options

In reply to Ben Shelton

From: Richard Tollerton <[email protected]>

The options to pass to tar for cache create/extract are likely to change due to system configuration circumstances (e.g. using busybox tar instead of GNU tar). So move the more detailed options into the defaults file to allow for easier overrides.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---
 meta/recipes-core/udev/udev/init               | 2 +-
 meta/recipes-core/udev/udev/udev-cache         | 2 +-
 meta/recipes-core/udev/udev/udev-cache.default | 4 ++++
 3 files changed, 6 insertions(+), 2 deletions(-)
meta/recipes-core/udev/udev/init +1 -1
index 5db029a..dc39d95 100644
@@ -69,7 +69,7 @@ case "$1" in
 		    readfiles "$DEVCACHE_SYSCONF"
 		    OLDDATA="$READDATA"
 		    if [ "$OLDDATA" = "$NEWDATA" ]; then
-                            tar xzf $DEVCACHE -C / --exclude=log
+                            tar xzf $DEVCACHE -C / $DEVCACHE_EXTRACT_OPTS
                             not_first_boot=1
                             [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
                             [ -e "$DEVCACHE_CURRENT_SYSCONF" ] && rm -f "$DEVCACHE_CURRENT_SYSCONF"
meta/recipes-core/udev/udev/udev-cache +1 -1
index 7406e07..29700e0 100644
@@ -26,7 +26,7 @@ fi
 if [ "$DEVCACHE" != "" -a -e "$DEVCACHE_CURRENT_SYSCONF" ]; then
 	[ "${VERBOSE}" != "no" ] && echo "Populating dev cache"
 	(
-		tar czf "${DEVCACHE}.tmp" dev -C / --exclude=log
+		tar czf "${DEVCACHE}.tmp" dev -C / $DEVCACHE_CREATE_OPTS
 		mv -f "${DEVCACHE}.tmp" "$DEVCACHE"
 		mv "$DEVCACHE_CURRENT_SYSCONF" "$DEVCACHE_SYSCONF"
 	) &
meta/recipes-core/udev/udev/udev-cache.default +4 -0
index 7f39a68..30d7faa 100644
@@ -6,4 +6,8 @@ DEVCACHE="/etc/udev-cache.tar.gz"
 DEVCACHE_SYSCONF="/etc/udev/cache.data"
 DEVCACHE_CURRENT_SYSCONF="/dev/shm/udev.cache"
 
+# - Avoid /dev/log because it's a pipe.
+DEVCACHE_EXTRACT_OPTS="--exclude=log"
+DEVCACHE_CREATE_OPTS="--exclude=log"
+
 PROBE_PLATFORM_BUS="yes"
Signature · 1 line
2.0.4
#41 lore raw

Re: [PATCH 11/20] udev-cache: parametrize tar options

Quoted 11 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

The options to pass to tar for cache create/extract are likely to change due to system configuration circumstances (e.g. using busybox tar instead of GNU tar). So move the more detailed options into the defaults file to allow for easier overrides.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

Same comment as 10/20.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#42 lore raw

Re: [PATCH 11/20] udev-cache: parametrize tar options

Quoted 8 lines · Otavio Salvador
Quoted 7 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

The options to pass to tar for cache create/extract are likely to change due to system configuration circumstances (e.g. using busybox tar instead of GNU tar). So move the more detailed options into the defaults file to allow for easier overrides.

Quoted 7 lines
Quoted 4 lines

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

Same comment as 10/20.

In this one, I'm OK with setting the default in the scripts themselves, since each environment variable is only used in one of the scripts.

Ben

Quoted 4 lines
Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#43 lore raw

PATCH 12/20 udev-cache: fix timestamp errors on systems lacking an RTC

In reply to Ben Shelton

From: Richard Tollerton <[email protected]>

If the system lacks an RTC, the time will typically start from the epoch, and may get set to the "correct" time later (if at all). In this circumstance, the timestamps in the cache tarball will always be in the future. gnutar complains bitterly about this.

To work around this, use tar -m to strip mtimes during extract.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---
 meta/recipes-core/udev/udev/udev-cache.default | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-core/udev/udev/udev-cache.default +2 -1
index 30d7faa..554142a 100644
@@ -7,7 +7,8 @@ DEVCACHE_SYSCONF="/etc/udev/cache.data"
 DEVCACHE_CURRENT_SYSCONF="/dev/shm/udev.cache"
 
 # - Avoid /dev/log because it's a pipe.
-DEVCACHE_EXTRACT_OPTS="--exclude=log"
+# - Don't restore mtimes. Avoids errors on systems lacking an RTC.
+DEVCACHE_EXTRACT_OPTS="--exclude=log -m"
 DEVCACHE_CREATE_OPTS="--exclude=log"
 
 PROBE_PLATFORM_BUS="yes"
Signature · 1 line
2.0.4
#44 lore raw

PATCH 13/20 udev-cache: Avoid caching udev.cache or non-devfs filesystems

In reply to Ben Shelton

From: Richard Tollerton <[email protected]>

If $DEVCACHE_CURRENT_SYSCONF gets stored in the cache tarball, and extracted, then udev-cache will needlessly rebuild the cache on every future boot. The direct fix to this is to explicitly exclude it.

Investigating this also uncovered that we're also archiving everything under other filesystems, including /dev/cgroup, /dev/shm, etc. This shouldn't be happening. The fix is to use tar --one-file-system, but this is GNU-specific.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---
 meta/recipes-core/udev/udev/udev-cache.default | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
meta/recipes-core/udev/udev/udev-cache.default +3 -2
index 554142a..c71826e 100644
@@ -8,7 +8,8 @@ DEVCACHE_CURRENT_SYSCONF="/dev/shm/udev.cache"
 
 # - Avoid /dev/log because it's a pipe.
 # - Don't restore mtimes. Avoids errors on systems lacking an RTC.
-DEVCACHE_EXTRACT_OPTS="--exclude=log -m"
-DEVCACHE_CREATE_OPTS="--exclude=log"
+# - (gnutar specific) Stay on the same fs.
+DEVCACHE_EXTRACT_OPTS="--exclude=log -m --exclude=udev.cache --one-file-system"
+DEVCACHE_CREATE_OPTS="--exclude=log --exclude=udev.cache --one-file-system"
 
 PROBE_PLATFORM_BUS="yes"
Signature · 1 line
2.0.4
#45 lore raw

PATCH 14/20 udev-cache: refactor; improve verbosity and error handling

In reply to Ben Shelton

From: Richard Tollerton <[email protected]>

Most of /etc/init.d/udev-cache is in a conditional block which can be replaced by a [ ... ] || exit 0 to reduce nesting. This eliminates a rm -f which was dead code anyway.

This also provides the opportunity to emit a few more messages if VERBOSE is set, which may help with future debugging.

Finally, make installing the new $DEVCACHE_SYSCONF contingent on successfully creating the cache tarball.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---
 meta/recipes-core/udev/udev/udev-cache | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
meta/recipes-core/udev/udev/udev-cache +9 -7
index 29700e0..7eea5fb 100644
@@ -23,13 +23,15 @@ if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
     exit 0
 fi
 
-if [ "$DEVCACHE" != "" -a -e "$DEVCACHE_CURRENT_SYSCONF" ]; then
-	[ "${VERBOSE}" != "no" ] && echo "Populating dev cache"
-	(
-		tar czf "${DEVCACHE}.tmp" dev -C / $DEVCACHE_CREATE_OPTS
-		mv -f "${DEVCACHE}.tmp" "$DEVCACHE"
+[ "$DEVCACHE" != "" ] || exit 0
+[ "${VERBOSE}" == "no" ] || echo -n "$0: checking for ${DEVCACHE_CURRENT_SYSCONF}... "
+[ -e "$DEVCACHE_CURRENT_SYSCONF" ] || { echo "not found"; exit 0; }
+[ "${VERBOSE}" == "no" ] || echo "found; building cache."
+
+(
+	tar czf "${DEVCACHE}.tmp" dev -C / $DEVCACHE_CREATE_OPTS && \
+		mv -f "${DEVCACHE}.tmp" "$DEVCACHE" && \
 		mv "$DEVCACHE_CURRENT_SYSCONF" "$DEVCACHE_SYSCONF"
-	) &
-fi
+) &
 
 exit 0
Signature · 1 line
2.0.4
#46 lore raw

PATCH 15/20 udev-cache: don't attempt to extract cache if it doesn't exist

In reply to Ben Shelton

From: Richard Tollerton <[email protected]>

If you try to invalidate the udev cache solely by deleting the tarball, while forgetting to also remove the config file ($DEVCACHE_SYSCONF), then tar will fail.

Fortunately the cache will get regenerated on this boot because $DEVCACHE_CURRENT_SYSCONF still exists, but to avoid the error, we should check to see if the tarball actually exists before we try to extract it.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---
 meta/recipes-core/udev/udev/init | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/udev/udev/init +1 -1
index dc39d95..e4a196f 100644
@@ -68,7 +68,7 @@ case "$1" in
 		    NEWDATA="$READDATA"
 		    readfiles "$DEVCACHE_SYSCONF"
 		    OLDDATA="$READDATA"
-		    if [ "$OLDDATA" = "$NEWDATA" ]; then
+		    if [ "$OLDDATA" = "$NEWDATA" -a -f "$DEVCACHE" ]; then
                             tar xzf $DEVCACHE -C / $DEVCACHE_EXTRACT_OPTS
                             not_first_boot=1
                             [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
Signature · 1 line
2.0.4
#47 lore raw

PATCH 16/20 udev-cache: invalidate on rules.d changes

In reply to Ben Shelton

From: Richard Tollerton <[email protected]>

Presently, $DEVCACHE_CURRENT_SYSCONF doesn't change if rules are modified, which may cause the cache to preserve an old configuration. To fix, include ls -l output for all rules, which ought to be reasonably fast to run on boot.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58620

---
 meta/recipes-core/udev/udev/init | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
meta/recipes-core/udev/udev/init +4 -3
index e4a196f..3a52e98 100644
@@ -63,9 +63,10 @@ case "$1" in
     # A list of files which are used as a criteria to judge whether the udev cache could be reused.
     CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices /proc/atags"
     if [ "$DEVCACHE" != "" ]; then
+	    RULELIST=`ls -l /lib/udev/rules.d/* /etc/udev/rules.d/* 2>/dev/null`
             if [ -e $DEVCACHE ]; then
 		    readfiles $CMP_FILE_LIST
-		    NEWDATA="$READDATA"
+		    NEWDATA="$READDATA$RULELIST"
 		    readfiles "$DEVCACHE_SYSCONF"
 		    OLDDATA="$READDATA"
 		    if [ "$OLDDATA" = "$NEWDATA" -a -f "$DEVCACHE" ]; then
@@ -77,7 +78,7 @@ case "$1" in
 			    # Output detailed reason why the cached /dev is not used
 			    if [ "$VERBOSE" != "no" ]; then
 				    echo "udev: udev cache not used"
-				    echo "udev: we use $CMP_FILE_LIST as criteria to judge whether the cache /dev could be resued"
+				    echo "udev: we use $CMP_FILE_LIST and ls -l [/lib][etc]/udev/rules.d/* as criteria to judge whether the cached /dev could be reused"
 				    echo "udev: olddata: $OLDDATA"
 				    echo "udev: newdata: $NEWDATA"
 			    fi
@@ -88,7 +89,7 @@ case "$1" in
 			    # If rootfs is not read-only, it's possible that a new udev cache would be generated;
 			    # otherwise, we do not bother to read files.
 			    readfiles $CMP_FILE_LIST
-			    echo "$READDATA" > "$DEVCACHE_CURRENT_SYSCONF"
+			    echo "$READDATA$RULELIST" > "$DEVCACHE_CURRENT_SYSCONF"
 		    fi
             fi
     fi
Signature · 1 line
2.0.4
#48 lore raw

PATCH 17/20 udev-cache: fix udev-cache changes to work with busybox tar

In reply to Ben Shelton

busybox tar does not support the --one-file-system option that we use to keep tar from archiving unnecessary files that live under /dev but are not mounted under the devtmpfs. Instead, when GNU tar is not present, use find to pass tar a list of the files that need to be cached.

Additionally, busybox tar does not complain when timestamps are in the future, and the OE busybox defconfig does not have the TAR_NOPRESERVE_TIME option enabled, so don't use the '-m' option with busybox tar.

---
 meta/recipes-core/udev/udev/init               | 14 +++++++++-----
 meta/recipes-core/udev/udev/udev-cache         | 12 ++++++++++--
 meta/recipes-core/udev/udev/udev-cache.default |  4 ++++
 3 files changed, 23 insertions(+), 7 deletions(-)
meta/recipes-core/udev/udev/init +9 -5
index 3a52e98..6caf7d5 100644
@@ -70,11 +70,15 @@ case "$1" in
 		    readfiles "$DEVCACHE_SYSCONF"
 		    OLDDATA="$READDATA"
 		    if [ "$OLDDATA" = "$NEWDATA" -a -f "$DEVCACHE" ]; then
-                            tar xzf $DEVCACHE -C / $DEVCACHE_EXTRACT_OPTS
-                            not_first_boot=1
-                            [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
-                            [ -e "$DEVCACHE_CURRENT_SYSCONF" ] && rm -f "$DEVCACHE_CURRENT_SYSCONF"
-                    else
+			    if [ ! `readlink -f /bin/tar` = "/bin/tar.tar" ]; then
+				    tar xzf $DEVCACHE -C / $BUSYBOX_DEVCACHE_EXTRACT_OPTS
+			    else
+				    tar xzf $DEVCACHE -C / $DEVCACHE_EXTRACT_OPTS
+			    fi
+			    not_first_boot=1
+			    [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
+			    [ -e "$DEVCACHE_CURRENT_SYSCONF" ] && rm -f "$DEVCACHE_CURRENT_SYSCONF"
+		    else
 			    # Output detailed reason why the cached /dev is not used
 			    if [ "$VERBOSE" != "no" ]; then
 				    echo "udev: udev cache not used"
meta/recipes-core/udev/udev/udev-cache +10 -2
index 7eea5fb..43bc67a 100644
@@ -28,10 +28,18 @@ fi
 [ -e "$DEVCACHE_CURRENT_SYSCONF" ] || { echo "not found"; exit 0; }
 [ "${VERBOSE}" == "no" ] || echo "found; building cache."
 
-(
+if [ ! `readlink -f /bin/tar` = "/bin/tar.tar" ]; then
+	(
+	find /dev \( -type b -o -type c -o -type l \) -xdev | cut -c 2- | xargs tar czf "${DEVCACHE}.tmp" -C / $BUSYBOX_DEVCACHE_CREATE_OPTS && \
+		mv -f "${DEVCACHE}.tmp" "$DEVCACHE" && \
+		mv "$DEVCACHE_CURRENT_SYSCONF" "$DEVCACHE_SYSCONF"
+	) &
+else
+	(
 	tar czf "${DEVCACHE}.tmp" dev -C / $DEVCACHE_CREATE_OPTS && \
 		mv -f "${DEVCACHE}.tmp" "$DEVCACHE" && \
 		mv "$DEVCACHE_CURRENT_SYSCONF" "$DEVCACHE_SYSCONF"
-) &
+	) &
+fi
 
 exit 0
meta/recipes-core/udev/udev/udev-cache.default +4 -0
index c71826e..d2c1e5c 100644
@@ -12,4 +12,8 @@ DEVCACHE_CURRENT_SYSCONF="/dev/shm/udev.cache"
 DEVCACHE_EXTRACT_OPTS="--exclude=log -m --exclude=udev.cache --one-file-system"
 DEVCACHE_CREATE_OPTS="--exclude=log --exclude=udev.cache --one-file-system"
 
+# Busybox tar does not support --one-file-system option
+BUSYBOX_DEVCACHE_EXTRACT_OPTS="--exclude=log --exclude=udev.cache"
+BUSYBOX_DEVCACHE_CREATE_OPTS="--exclude=log --exclude=udev.cache"
+
 PROBE_PLATFORM_BUS="yes"
Signature · 1 line
2.0.4
#49 lore raw

PATCH 18/20 udev: Make build MACHINE-specific

In reply to Ben Shelton

From: Richard Tollerton <[email protected]>

For space reasons, udev needs to be configured differently depending on MACHINE_FEATURES. So set PACKAGE_ARCH accordingly.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58621

---
 meta/recipes-core/udev/udev.inc | 6 ++++++
 1 file changed, 6 insertions(+)
meta/recipes-core/udev/udev.inc +6 -0
index 11204aa..8394064 100644
@@ -15,6 +15,12 @@ LDFLAGS += "-lrt"
 DEPENDS = "acl glib-2.0 libusb usbutils pciutils gperf-native libxslt-native util-linux"
 RPROVIDES_${PN} = "hotplug"
 
+#
+# packages which content depend on MACHINE_FEATURES/COMBINED_FEATURES need to be MACHINE_ARCH
+#
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+
 SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \
            file://0001-Fixing-keyboard_force_release.sh-shell-script-path.patch \
            file://avoid-mouse-autosuspend.patch \
Signature · 1 line
2.0.4
#50 lore raw

Re: [PATCH 18/20] udev: Make build MACHINE-specific

Quoted 18 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

For space reasons, udev needs to be configured differently depending on MACHINE_FEATURES. So set PACKAGE_ARCH accordingly.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58621

---
 meta/recipes-core/udev/udev.inc | 6 ++++++
 1 file changed, 6 insertions(+)
meta/recipes-core/udev/udev.inc +0 -0
index 11204aa..8394064 100644

meta/recipes-core/udev/udev.inc LDFLAGS += "-lrt" · line 21

Quoted 7 lines
meta/recipes-core/udev/udev.inc +4 -0
@@ -15,6 +15,12 @@ LDFLAGS += "-lrt"
 DEPENDS = "acl glib-2.0 libusb usbutils pciutils gperf-native libxslt-native util-linux"
 RPROVIDES_${PN} = "hotplug"
 
+#
+# packages which content depend on MACHINE_FEATURES/COMBINED_FEATURES need to be MACHINE_ARCH
+#
+PACKAGE_ARCH = "${MACHINE_ARCH}"

A lot of recipes are depending on udev and aren't MACHINE_ARCH (this would make them effectively MACHINE_ARCH).

e.g. bluez4, ofono, clutter, mesa, pulseaudio, ... and everything depending on them as well.

Quoted 11 lines
meta/recipes-core/udev/udev.inc +0 -0
 SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \
            file://0001-Fixing-keyboard_force_release.sh-shell-script-path.patch \
            file://avoid-mouse-autosuspend.patch \
Signature · 7 lines
2.0.4

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#51 lore raw

PATCH 19/20 udev: Disable keymap support on machines lacking keyboard support

In reply to Ben Shelton

From: Richard Tollerton <[email protected]>

/lib/udev/keymaps/ is 244k. On headless machines, this is wasted space.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58621

---
 meta/recipes-core/udev/udev.inc | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-core/udev/udev.inc +1 -0
index 8394064..2d2150c 100644
@@ -51,6 +51,7 @@ EXTRA_OECONF = "--disable-introspection \
                 --with-rootlibdir=${base_libdir} \
                 --with-rootprefix= \
                 --without-systemdsystemunitdir \
+                ${@base_contains('MACHINE_FEATURES', 'keyboard', '', '--disable-keymap', d)} \
                "
 
 PACKAGES =+ "udev-cache"
Signature · 1 line
2.0.4
#52 lore raw

Re: [PATCH 19/20] udev: Disable keymap support on machines lacking keyboard support

Quoted 17 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

/lib/udev/keymaps/ is 244k. On headless machines, this is wasted space.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58621

---
 meta/recipes-core/udev/udev.inc | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-core/udev/udev.inc +0 -0
index 8394064..2d2150c 100644

meta/recipes-core/udev/udev.inc EXTRA_OECONF = "--disable-introspection \ · line 54

Quoted 4 lines
meta/recipes-core/udev/udev.inc +1 -0
@@ -51,6 +51,7 @@ EXTRA_OECONF = "--disable-introspection \
                 --with-rootlibdir=${base_libdir} \
                 --with-rootprefix= \
                 --without-systemdsystemunitdir \
+                ${@base_contains('MACHINE_FEATURES', 'keyboard', '', '--disable-keymap', d)} \

udev isn't MACHINE_ARCH, so you cannot use MACHINE_FEATURES there.

But you can add PACKAGECONFIG and let DISTRO decide if all supported MACHINEs are headless, it can disable it.

Quoted 11 lines
meta/recipes-core/udev/udev.inc +0 -0
                "
 
 PACKAGES =+ "udev-cache"
Signature · 7 lines
2.0.4

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#53 lore raw

PATCH 20/20 udev: don't halt if devtmpfs can't be mounted

In reply to Ben Shelton

From: Richard Tollerton <[email protected]>

Halting if udev cannot start is problematic for a couple reasons.
- Compared to a reboot loop, halting is much more difficult to recover from in remote deployments.
- If the rootfs has a prepopulated /dev (which happens somewhat often), the system may be able to boot up just fine, or at least fine enough for the administrator to log in and fix things.

Instead of halting, just exit, and let the administrator deal with the potential reboot loop.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58623

---
 meta/recipes-core/udev/udev/init | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
meta/recipes-core/udev/udev/init +1 -2
index 6caf7d5..f6a8391 100644
@@ -45,8 +45,7 @@ case "$1" in
     if ! grep -q devtmpfs /proc/filesystems
     then
         echo "Missing devtmpfs, which is required for udev to run";
-        echo "Halting..."
-        halt
+	exit 1
     fi
     # mount the devtmpfs on /dev, if not already done
     LANG=C awk '$2 == "/dev" && ($3 == "devtmpfs") { exit 1 }' /proc/mounts && {
Signature · 1 line
2.0.4
#54 lore raw

Re: [PATCH 20/20] udev: don't halt if devtmpfs can't be mounted

Quoted 26 lines · Ben Shelton

From: Richard Tollerton <[email protected]>

Halting if udev cannot start is problematic for a couple reasons.
- Compared to a reboot loop, halting is much more difficult to recover from in remote deployments.
- If the rootfs has a prepopulated /dev (which happens somewhat often), the system may be able to boot up just fine, or at least fine enough for the administrator to log in and fix things.

Instead of halting, just exit, and let the administrator deal with the potential reboot loop.

Natinst-Rally-ID: TA44427

Natinst-ReviewBoard-ID: 58623

---
 meta/recipes-core/udev/udev/init | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
meta/recipes-core/udev/udev/init +0 -0
index 6caf7d5..f6a8391 100644

meta/recipes-core/udev/udev/init case "$1" in · line 48

Quoted 6 lines
meta/recipes-core/udev/udev/init +1 -2
@@ -45,8 +45,7 @@ case "$1" in
     if ! grep -q devtmpfs /proc/filesystems
     then
         echo "Missing devtmpfs, which is required for udev to run";
-        echo "Halting..."
-        halt
+	exit 1

Please use spaces for indentation like previous lines.

Quoted 11 lines
meta/recipes-core/udev/udev/init +0 -0
     fi
     # mount the devtmpfs on /dev, if not already done
     LANG=C awk '$2 == "/dev" && ($3 == "devtmpfs") { exit 1 }' /proc/mounts && {
Signature · 7 lines
2.0.4

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]