Skip to contentSkip to conversation

Pending patches in O.S. Systems tree

PATCH In review Otavio Salvador 4 participants 15 messages Feb 1, 2012 – Feb 2, 2012

lore
Share & tools
lore
#0 lore raw

cover Pending patches in O.S. Systems tree

We changed the udev patch taking in account the suggestions done by Richard and also made a cuple of more fixes in meanwhile. The gitpkgv.bbclass patch has been dropped for now as it is in discussion on mailing list.

The following changes since commit d7b13cd42ab8d5f44f97e119b73ec2e363677d26:

useradd.bbclass: Fix missing quote (2012-01-27 23:57:33 +0000)

are available in the git repository at:
git://github.com/OSSystems/oe-core master
https://github.com/OSSystems/oe-core/tree/HEAD

Otavio Salvador (3):
udev: improve udev-cache robustness
dhcp: move dhcp leases files handling to postinst/postrm rootfs_ipk.bbclass: fix detection of script runtime requirement

 meta/classes/rootfs_ipk.bbclass                |   10 ++++++-
 meta/recipes-connectivity/dhcp/dhcp.inc        |   19 +++++++++++++-
 meta/recipes-connectivity/dhcp/dhcp_4.2.0.bb   |    2 +-
 meta/recipes-core/udev/udev.inc                |    8 +++++-
 meta/recipes-core/udev/udev/init               |   33 +++++++++++++++++++++--
 meta/recipes-core/udev/udev/udev-cache         |   14 ++++++++--
 meta/recipes-core/udev/udev/udev-cache.default |    4 +++
 7 files changed, 79 insertions(+), 11 deletions(-)
 create mode 100644 meta/recipes-core/udev/udev/udev-cache.default
Signature · 1 line
1.7.2.5
#1 lore raw

PATCH 1/3 udev: improve udev-cache robustness

* allow udev-cache to be disabled at runtime (using /etc/default/udev-cache);

* make cache invalidated if kernel, bootparams or device list changes;

---
 meta/recipes-core/udev/udev.inc                |    8 +++++-
 meta/recipes-core/udev/udev/init               |   33 +++++++++++++++++++++--
 meta/recipes-core/udev/udev/udev-cache         |   14 ++++++++--
 meta/recipes-core/udev/udev/udev-cache.default |    4 +++
 4 files changed, 52 insertions(+), 7 deletions(-)
 create mode 100644 meta/recipes-core/udev/udev/udev-cache.default
meta/recipes-core/udev/udev.inc +7 -1
index 0e571d6..e5fbe40 100644
@@ -25,6 +25,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \
            file://network.sh \
            file://local.rules \
            file://udev-cache \
+           file://udev-cache.default \
            file://init"
 
 inherit autotools pkgconfig update-rc.d
@@ -58,7 +59,7 @@ FILES_libgudev = "${base_libdir}/libgudev*.so.* ${libdir}/libgudev*.so.*"
 FILES_libgudev-dbg = "${base_libdir}/.debug/libgudev*.so.* ${libdir}/.debug/libgudev*.so.*"
 FILES_libgudev-dev = "${includedir}/gudev* ${libdir}/libgudev*.so ${libdir}/libgudev*.la \
                      ${libdir}/libgudev*.a ${libdir}/pkgconfig/gudev*.pc"
-FILES_udev-cache = "${sysconfdir}/init.d/udev-cache"
+FILES_udev-cache = "${sysconfdir}/init.d/udev-cache ${sysconfdir}/default/udev-cache"
 
 FILES_udev-acl = "${base_libdir}/udev/udev-acl ${base_libdir}/udev/rules.d/70-acl.rules"
 
@@ -72,6 +73,11 @@ do_install_append () {
 	install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev
 	install -m 0755 ${WORKDIR}/udev-cache ${D}${sysconfdir}/init.d/udev-cache
 
+	install -d ${D}${sysconfdir}/default
+	install -m 0755 ${WORKDIR}/udev-cache.default ${D}${sysconfdir}/default/udev-cache
+
+	touch ${D}${sysconfdir}/udev/cache.data
+
 	install -d ${D}${sysconfdir}/udev/rules.d/
 
 	install -m 0644 ${WORKDIR}/local.rules         ${D}${sysconfdir}/udev/rules.d/local.rules
meta/recipes-core/udev/udev/init +30 -3
index 6a4464c..78b5b1c 100644
@@ -14,8 +14,19 @@ export TZ=/etc/localtime
 [ -d /sys/class ] || exit 1
 [ -r /proc/mounts ] || exit 1
 [ -x /sbin/udevd ] || exit 1
+[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
 [ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf
 
+readfile () {
+   filename=$1
+   READDATA=""
+   if [ -r $filename ]; then
+       while read line; do
+           READDATA="$READDATA$line"
+       done < $filename
+   fi
+}
+
 kill_udevd() {
 	if [ -x /sbin/pidof ]; then
 		pid=`/sbin/pidof -x udevd`
@@ -34,10 +45,26 @@ LANG=C awk '$2 == "/dev" && ($3 == "tmpfs" || $3 == "devtmpfs") { exit 1 }' /pro
 [ -e /dev/pts ] || mkdir -m 0755 /dev/pts
 [ -e /dev/shm ] || mkdir -m 1777 /dev/shm
 
+# cache handling
+if [ "$DEVCACHE" != "" ]; then
+	readfile /proc/version
+	VERSION="$READDATA"
+	readfile /proc/cmdline
+	CMDLINE="$READDATA"
+	readfile /proc/devices
+	DEVICES="$READDATA"
+	readfile /proc/atags
+	ATAGS="$READDATA"
 
-if [ -e /etc/dev.tar ]; then
-	(cd /; tar xf /etc/dev.tar 2>&1 | grep -v 'time stamp' || true)
-	not_first_boot=1
+	if [ -e $DEVCACHE ]; then
+		readfile /etc/udev/cache.data
+		if [ "$READDATA" = "$VERSION$CMDLINE$DEVICES$ATAGS" ]; then
+			(cd /; tar xf $DEVCACHE > /dev/null 2>&1)
+			not_first_boot=1
+		fi
+
+		echo "$VERSION$CMDLINE$DEVICES$ATAGS" > /dev/shm/udev.cache
+	fi
 fi
 
 # make_extra_nodes
meta/recipes-core/udev/udev/udev-cache +11 -3
index 77bbda6..9c24e76 100644
@@ -9,12 +9,20 @@
 # Short-Description: cache /dev to speedup the udev next boot
 ### END INIT INFO
 
-[ -d /sys/class ] || exit 1
+export TZ=/etc/localtime
+
 [ -r /proc/mounts ] || exit 1
 [ -x /sbin/udevd ] || exit 1
+[ -d /sys/class ] || exit 1
+
+[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
 
-if [ ! -e /etc/dev.tar ]; then
-	(cd /; tar cf /etc/dev.tar dev)
+if [ "$DEVCACHE" != "" ]; then
+	echo "Populating dev cache"
+	(cd /; tar cf "$DEVCACHE" dev)
+	mv /dev/shm/udev.cache /etc/udev/cache.data
+else
+	rm -f /dev/shm/udev.cache
 fi
 
 exit 0
meta/recipes-core/udev/udev/udev-cache.default new file +4 -0
new file mode 100644
index 0000000..5c4937a
@@ -0,0 +1,4 @@
+# Default for /etc/init.d/udev
+
+# Comment this out to disable device cache
+DEVCACHE="/etc/dev.tar"
Signature · 1 line
1.7.2.5
#2 lore raw

Re: [PATCH 1/3] udev: improve udev-cache robustness

Quoted 8 lines · Otavio Salvador

* allow udev-cache to be disabled at runtime (using /etc/default/udev-cache);

* make cache invalidated if kernel, bootparams or device list changes;

I forgot a PR bump in udev_164.bb. I did it in the branch.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
E-mail: [email protected]  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
#3 lore raw

PATCH 2/3 dhcp: move dhcp leases files handling to postinst/postrm

In reply to Otavio Salvador

Both server and client needs access to leases files so its creation and removal are now handled by postinst/postrm scripts.

---
 meta/recipes-connectivity/dhcp/dhcp.inc      |   19 ++++++++++++++++++-
 meta/recipes-connectivity/dhcp/dhcp_4.2.0.bb |    2 +-
 2 files changed, 19 insertions(+), 2 deletions(-)
meta/recipes-connectivity/dhcp/dhcp.inc +18 -1
index be256ce..9f0c5ea 100644
@@ -66,12 +66,29 @@ FILES_dhcp-server-config = "${sysconfdir}/default/dhcp-server ${sysconfdir}/dhcp
 
 FILES_dhcp-relay = "${sbindir}/dhcrelay ${sysconfdir}/init.d/dhcp-relay ${sysconfdir}/default/dhcp-relay"
 
-FILES_dhcp-client = "${base_sbindir}/dhclient ${base_sbindir}/dhclient-script ${sysconfdir}/dhcp/dhclient.conf ${localstatedir}/lib/dhcp/"
+FILES_dhcp-client = "${base_sbindir}/dhclient ${base_sbindir}/dhclient-script ${sysconfdir}/dhcp/dhclient.conf"
 RDEPENDS_dhcp-client = "bash"
 
 FILES_dhcp-omshell = "${bindir}/omshell"
 
 pkg_postinst_dhcp-server() {
+    install -d $D/${localstatedir}/lib/dhcp
     touch $D/${localstatedir}/lib/dhcp/dhcpd.leases
     touch $D/${localstatedir}/lib/dhcp/dhcpd6.leases
 }
+
+pkg_postinst_dhcp-client() {
+    install -d $D/${localstatedir}/lib/dhcp
+}
+
+pkg_postrm_dhcp-server() {
+    rm -f $D/${localstatedir}/lib/dhcp/dhcpd.leases
+    rm -f $D/${localstatedir}/lib/dhcp/dhcpd6.leases
+    rmdir $D/${localstatedir}/lib/dhcp
+}
+
+pkg_postrm_dhcp-client() {
+    rm -f $D/${localstatedir}/lib/dhcp/dhclient.leases
+    rm -f $D/${localstatedir}/lib/dhcp/dhclient6.leases
+    rmdir $D/${localstatedir}/lib/dhcp
+}
meta/recipes-connectivity/dhcp/dhcp_4.2.0.bb +1 -1
index a3a560b..478fd06 100644
@@ -1,6 +1,6 @@
 require dhcp.inc
 
-PR = "r5"
+PR = "r6"
 
 SRC_URI += "file://fixincludes.patch \
             file://dhcp-3.0.3-dhclient-dbus.patch;striplevel=0 \
Signature · 1 line
1.7.2.5
#4 lore raw

Re: [PATCH 2/3] dhcp: move dhcp leases files handling to postinst/postrm

Quoted 2 lines · Otavio Salvador

pkg_postinst_dhcp-server() {
+ install -d $D/${localstatedir}/lib/dhcp

Is "install" guaranteed to be available on the target? I would have thought "mkdir -p" would be better.

p.

#5 lore raw

Re: [PATCH 2/3] dhcp: move dhcp leases files handling to postinst/postrm

Quoted 7 lines · Phil Blundell
Quoted 2 lines · Otavio Salvador

pkg_postinst_dhcp-server() {
+ install -d $D/${localstatedir}/lib/dhcp

Is "install" guaranteed to be available on the target? I would have thought "mkdir -p" would be better.

It worked on all images I tested. I have no strong opinions about it.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
E-mail: [email protected]  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
#6 lore raw

Re: [PATCH 2/3] dhcp: move dhcp leases files handling to postinst/postrm

Quoted 11 lines · Otavio Salvador

On Wed, Feb 1, 2012 at 18:57, Phil Blundell <[email protected]> wrote:

        On Wed, 2012-02-01 at 20:27 +0000, Otavio Salvador wrote:
        >  pkg_postinst_dhcp-server() {
        > +    install -d $D/${localstatedir}/lib/dhcp
        
        
        Is "install" guaranteed to be available on the target?  I
        would have
        thought "mkdir -p" would be better.
Quoted 1 line

It worked on all images I tested. I have no strong opinions about it.

I just checked a rootfs that I happened to have lying around and there was indeed no "install" binary in there. Admittedly I always build with O_P_M=none so it isn't going to cause me any real problem, but presumably there might be other folks who have O_P_M on and still lack "install". So I think it would be best to change this.

p.

#7 lore raw

Re: [PATCH 2/3] dhcp: move dhcp leases files handling to postinst/postrm

Quoted 12 lines · Phil Blundell
Quoted 11 lines · Otavio Salvador

On Wed, Feb 1, 2012 at 18:57, Phil Blundell <[email protected]> wrote:

        On Wed, 2012-02-01 at 20:27 +0000, Otavio Salvador wrote:
        >  pkg_postinst_dhcp-server() {
        > +    install -d $D/${localstatedir}/lib/dhcp
        
        
        Is "install" guaranteed to be available on the target?  I
        would have
        thought "mkdir -p" would be better.
Quoted 7 lines
Quoted 1 line

It worked on all images I tested. I have no strong opinions about it.

I just checked a rootfs that I happened to have lying around and there was indeed no "install" binary in there. Admittedly I always build with O_P_M=none so it isn't going to cause me any real problem, but presumably there might be other folks who have O_P_M on and still lack "install". So I think it would be best to change this.

Agreed, mkdir is much more likely to be available than install on most target machines.

Cheers,

Richard

#8 lore raw

Re: [PATCH 2/3] dhcp: move dhcp leases files handling to postinst/postrm

Quoted 3 lines · Richard Purdie

Agreed, mkdir is much more likely to be available than install on most target machines.

I did it and pushed to my tree.

When changing it, I bumped PR again as I had it merged in our local tree to fix this problem for yestarday build and so I'd like to keep those in sync.

Want me to send it again or you pick it from there?

Signature · 3 lines
Otavio Salvador                             O.S. Systems
E-mail: [email protected]  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
#9 lore raw

PATCH 3/3 rootfs_ipk.bbclass: fix detection of script runtime requirement

In reply to Otavio Salvador

The code has been broken by 2feba313c991170747381c7cf821a45c2cd04632 that changed the way this detection has being done.

---
 meta/classes/rootfs_ipk.bbclass |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
meta/classes/rootfs_ipk.bbclass +8 -2
index 48fb2fb..0881089 100644
@@ -74,9 +74,15 @@ fakeroot rootfs_ipk_do_rootfs () {
 
 	${OPKG_POSTPROCESS_COMMANDS}
 	${ROOTFS_POSTINSTALL_COMMAND}
-	
+
+	if grep -q Status:.install.ok.unpacked ${IMAGE_ROOTFS}${opkglibdir}status; then
+		runtime_script_required=1
+	else
+		runtime_script_required=0
+	fi
+
 	if ${@base_contains("IMAGE_FEATURES", "read-only-rootfs", "true", "false" ,d)}; then
-		if grep Status:.install.ok.unpacked ${IMAGE_ROOTFS}${opkglibdir}status; then
+		if [ $runtime_script_required -eq 1 ]; then
 			echo "Some packages could not be configured offline and rootfs is read-only."
 			exit 1
 		fi
Signature · 1 line
1.7.2.5
#10 lore raw

Re: [PATCH 3/3] rootfs_ipk.bbclass: fix detection of script runtime requirement

Quoted 2 lines · Otavio Salvador

The code has been broken by 2feba313c991170747381c7cf821a45c2cd04632 that changed the way this detection has being done.

What was the failure? It isn't immediately obvious to me that this patch will make any functional difference (except for adding the -q argument to grep which was indeed missing).

p.

#11 lore raw

Re: [PATCH 3/3] rootfs_ipk.bbclass: fix detection of script runtime requirement

Quoted 8 lines · Phil Blundell
Quoted 2 lines · Otavio Salvador

The code has been broken by 2feba313c991170747381c7cf821a45c2cd04632 that changed the way this detection has being done.

What was the failure? It isn't immediately obvious to me that this patch will make any functional difference (except for adding the -q argument to grep which was indeed missing).

Nothing where setting runtime_script_required as 0 in case it worked. So it would never in fact remove the info files, even if read-only-fs where being in use and functional.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
E-mail: [email protected]  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
#12 lore raw

Re: [PATCH 3/3] rootfs_ipk.bbclass: fix detection of script runtime requirement

Quoted 14 lines · Otavio Salvador

On Wed, Feb 1, 2012 at 18:59, Phil Blundell <[email protected]> wrote:
On Wed, 2012-02-01 at 20:27 +0000, Otavio Salvador wrote:
> The code has been broken by 2feba313c991170747381c7cf821a45c2cd04632
> that changed the way this detection has being done.

What was the failure? It isn't immediately obvious to me that this
patch will make any functional difference (except for adding the -q
argument to grep which was indeed missing).

Quoted 3 lines

Nothing where setting runtime_script_required as 0 in case it worked. So it would never in fact remove the info files, even if read-only-fs where being in use and functional.

What else was using runtime_script_required? I thought the last references to that were removed by the patch in:

http://lists.linuxtogo.org/pipermail/openembedded-core/2012-January/016773.html

Did that one not get merged?

p.

#13 lore raw

Re: [PATCH 3/3] rootfs_ipk.bbclass: fix detection of script runtime requirement

In reply to Otavio Salvador
Quoted 2 lines · Otavio Salvador

The code has been broken by 2feba313c991170747381c7cf821a45c2cd04632 that changed the way this detection has being done.

Wasn't this fixed by
http://git.openembedded.org/openembedded-core/commit/?id=6d3eac57bdba8e2582c210a2f82a3a4546f68581
?

Quoted 36 lines
---
 meta/classes/rootfs_ipk.bbclass |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
meta/classes/rootfs_ipk.bbclass +8 -2
index 48fb2fb..0881089 100644
@@ -74,9 +74,15 @@ fakeroot rootfs_ipk_do_rootfs () {
 
 	${OPKG_POSTPROCESS_COMMANDS}
 	${ROOTFS_POSTINSTALL_COMMAND}
-	
+
+	if grep -q Status:.install.ok.unpacked ${IMAGE_ROOTFS}${opkglibdir}status; then
+		runtime_script_required=1
+	else
+		runtime_script_required=0
+	fi
+
 	if ${@base_contains("IMAGE_FEATURES", "read-only-rootfs", "true", "false" ,d)}; then
-		if grep Status:.install.ok.unpacked ${IMAGE_ROOTFS}${opkglibdir}status; then
+		if [ $runtime_script_required -eq 1 ]; then
 			echo "Some packages could not be configured offline and rootfs is read-only."
 			exit 1
 		fi
Signature · 7 lines
1.7.2.5


_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#14 lore raw
In reply to Otavio Salvador
Quoted 7 lines · Otavio Salvador

We changed the udev patch taking in account the suggestions done by Richard and also made a cuple of more fixes in meanwhile. The gitpkgv.bbclass patch has been dropped for now as it is in discussion on mailing list.

The following changes since commit d7b13cd42ab8d5f44f97e119b73ec2e363677d26:

Quoted 8 lines

useradd.bbclass: Fix missing quote (2012-01-27 23:57:33 +0000)

are available in the git repository at:
git://github.com/OSSystems/oe-core master
https://github.com/OSSystems/oe-core/tree/HEAD

Otavio Salvador (3):
udev: improve udev-cache robustness

I've taken this. Thanks for working through the details, I think the end result is worth it!

Quoted 1 line

dhcp: move dhcp leases files handling to postinst/postrm

This needs a install vs. mkdir tweak.

Quoted 1 line

rootfs_ipk.bbclass: fix detection of script runtime requirement

I don't think this one is required with master now?

Cheers,

Richard