Skip to contentSkip to conversation

About having a static /dev

PATCH In review Antonio Ospite 4 participants 11 messages Apr 22, 2010 – Apr 28, 2010

lore
Share & tools
lore
#0 lore raw

Hi,

For my machine (a780) I'd like to have a static /dev whatever image I build, I tried setting:
IMAGE_DEV_MANAGER = ""
IMAGE_DEVICE_TABLES = "files/device_table-minimal.txt \
files/device_table-ezx.txt"

But this is still not enough:
1. the 'devices' script from initscripts keeps rewriting /dev at each boot, and with a layout different than one would expect by having IMAGE_DEVICE_TABLES set, see also
http://bugs.openembedded.org/show_bug.cgi?id=3593

2. If I install any package which depends on udev then udev is brought in and the static layout is gone at the next boot.

Any suggestion about how to get to a clean solution which can be reused by others? I can fix 1. somehow, but for 2. I still don't have any idea.

Thanks,
Antonio

Signature · 10 lines
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
#1 lore raw
Quoted 2 lines · Antonio Ospite

2. If I install any package which depends on udev then udev is brought in and the static layout is gone at the next boot.

I think your best option is probably to make udev be a DISTRO_FEATURE and not set it for your own distribution.

If you genuinely want udev to be selected (for your particular DISTRO) on a per-MACHINE basis then you'll have to invent some way to nobble its startup script so that it just doesn't do anything on machines where it isn't wanted.

p.

#2 lore raw
Quoted 4 lines · On Thu, 22 Apr 2010 12:55:43 +0100 Phil Blundell <[email protected]> wrote:
Quoted 2 lines · Antonio Ospite

2. If I install any package which depends on udev then udev is brought in and the static layout is gone at the next boot.

Quoted 8 lines

I think your best option is probably to make udev be a DISTRO_FEATURE and not set it for your own distribution.

If you genuinely want udev to be selected (for your particular DISTRO) on a per-MACHINE basis then you'll have to invent some way to nobble its startup script so that it just doesn't do anything on machines where it isn't wanted.

A per-MACHINE way would be better IMHO, I am thinking about adding a check on something like /dev/.staticdev (suggested in [1]) to both udev init script and to the 'device' script from initscripts, and make the image class add the /dev/.staticdev file when IMAGE_DEV_MANAGER == "" (or maybe == "static" or "none"?)

Does this sound reasonable?

Thanks,
Antonio

[1] http://bugs.openembedded.org/show_bug.cgi?id=3593

Signature · 10 lines
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
#3 lore raw

Am 22.04.2010 um 14:46 schrieb Antonio Ospite:

Quoted 16 lines
Quoted 4 lines · On Thu, 22 Apr 2010 12:55:43 +0100 Phil Blundell <[email protected]> wrote:
Quoted 2 lines · Antonio Ospite

2. If I install any package which depends on udev then udev is brought in and the static layout is gone at the next boot.

Quoted 8 lines

I think your best option is probably to make udev be a DISTRO_FEATURE and not set it for your own distribution.

If you genuinely want udev to be selected (for your particular DISTRO) on a per-MACHINE basis then you'll have to invent some way to nobble its startup script so that it just doesn't do anything on machines where it isn't wanted.

Quoted 7 lines

A per-MACHINE way would be better IMHO, I am thinking about adding a check on something like /dev/.staticdev (suggested in [1]) to both udev init script and to the 'device' script from initscripts, and make the image class add the /dev/.staticdev file when IMAGE_DEV_MANAGER == "" (or maybe == "static" or "none"?)

Does this sound reasonable?

Please also handle the case where we neither want an IMAGE_DEV_MANAGER nor static device population, since we use devtmpfs.

:M:

#4 lore raw
In reply to Antonio Ospite
Quoted 7 lines · Antonio Ospite

A per-MACHINE way would be better IMHO, I am thinking about adding a check on something like /dev/.staticdev (suggested in [1]) to both udev init script and to the 'device' script from initscripts, and make the image class add the /dev/.staticdev file when IMAGE_DEV_MANAGER == "" (or maybe == "static" or "none"?)

Does this sound reasonable?

Yes, that sounds reasonable enough. Or you could check for /dev being mounted on tmpfs rather than persistent storage; you'd probably need some check along those lines anyway to catch the devtmpfs case.

It would still be nice to have udev be a DISTRO_FEATURE as well, since it'd suck a bit to have all that stuff installed in flash if it's never going to be used. But your proposal sounds basically fine to me.

p.

#5 lore raw
In reply to Antonio Ospite

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 10 lines · Antonio Ospite
Quoted 7 lines · On Thu, 22 Apr 2010 12:55:43 +0100 Phil Blundell <[email protected]> wrote:
Quoted 2 lines · Antonio Ospite

2. If I install any package which depends on udev then udev is brought in and the static layout is gone at the next boot.

I think your best option is probably to make udev be a DISTRO_FEATURE and not set it for your own distribution.

Quoted 7 lines
Quoted 5 lines

If you genuinely want udev to be selected (for your particular DISTRO) on a per-MACHINE basis then you'll have to invent some way to nobble its startup script so that it just doesn't do anything on machines where it isn't wanted.

A per-MACHINE way would be better IMHO

That would break the case where you want static devs for one image (e.g. initramfs, rescue fs), but other options (e.g. udev, devtempfs, mdev, something else) for other images on the same machine.

regards,

Koen
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFL0FuNMkyGM64RGpERAs2oAJ9bxwZhqGcesRA3EpEoMJ6vR9rwCACgjEcq as1zs5zE8iuE806tNVdekBU=
=85tD
-----END PGP SIGNATURE-----

#6 lore raw
In reply to Antonio Ospite

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 11 lines · Antonio Ospite

For my machine (a780) I'd like to have a static /dev whatever image I build, I tried setting:
IMAGE_DEV_MANAGER = ""
IMAGE_DEVICE_TABLES = "files/device_table-minimal.txt \
files/device_table-ezx.txt"

But this is still not enough:
1. the 'devices' script from initscripts keeps rewriting /dev at each boot, and with a layout different than one would expect by having IMAGE_DEVICE_TABLES set, see also
http://bugs.openembedded.org/show_bug.cgi?id=3593

The right answer would be to have image.bbclass create /etc/device_table from the IMAGE_DEVICE_TABLES vars during do_rootfs.

And of course mark /etc/device_table as CONFFILES in the initscripts recipe to keep the changes on package upgrades.

regards,

Koen
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFL0EJeMkyGM64RGpERAmH7AJ9bEXPhkuaX0Rvo9n8nUE4ds5niNQCfXnVx cWUbHwV6xcBe5hSoQpGkMIA=
=vw6J
-----END PGP SIGNATURE-----

#7 lore raw

PATCH 1/1 image.bbclass: create /etc/device_table from IMAGE_DEVICE_TABLES

Right now when the 'devices' script from initscripts is called the layout specified in IMAGE_DEVICES_TABLES is lost.

With this change the default behaviour when no IMAGE_DEVICE_TABLES is specified is to always use files/device_table-minimal.txt

---
Hi Koen et al.,

This looks to be enough in my preliminary tests.
As for the default behaviour change, I guess it is acceptable and files/device_table-minimal.txt can always be changed in a later commit, maybe to resemble more the very /etc/device_table from initscripts.

This patch fixes http://bugs.openembedded.org/show_bug.cgi?id=3593 and I consider it an orthogonal problem to having static /dev, so this can be reviewed alone.

Note that I used /etc instead of ${sysconfdir} on purpose as /etc is already hardcoded in several places in image.bbclass.

Thanks,
Antonio Ospite
http://ao2.it

 classes/image.bbclass                  |    4 ++++
 recipes/initscripts/initscripts_1.0.bb |    4 +++-
 2 files changed, 7 insertions(+), 1 deletions(-)
classes/image.bbclass +4 -0
index 8e202f0..0fcbc44 100644
@@ -119,8 +119,12 @@ fakeroot do_rootfs () {
 	mkdir -p ${IMAGE_ROOTFS}
 	mkdir -p ${DEPLOY_DIR_IMAGE}
 
+	mkdir -p ${IMAGE_ROOTFS}/etc
+
 	if [ "${USE_DEVFS}" != "1" ]; then
+		rm -rf ${IMAGE_ROOTFS}/etc/device_table
 		for devtable in ${@get_devtable_list(d)}; do
+			cat $devtable >> ${IMAGE_ROOTFS}/etc/device_table
 			makedevs -r ${IMAGE_ROOTFS} -D $devtable
 		done
 	fi
recipes/initscripts/initscripts_1.0.bb +3 -1
index 2c0689f..43cf347 100644
@@ -4,7 +4,7 @@ PRIORITY = "required"
 DEPENDS = "makedevs"
 RDEPENDS = "makedevs"
 LICENSE = "GPL"
-PR = "r117"
+PR = "r118"
 
 SRC_URI = "file://functions \
            file://halt \
@@ -35,6 +35,8 @@ SRC_URI = "file://functions \
 
 SRC_URI_append_arm = " file://alignment.sh"
 
+CONFFILES_${PN} += "${sysconfdir}/device_table" 
+
 KERNEL_VERSION = ""
 
 do_install () {
Signature · 1 line
1.7.0.5
Acked-by on v1 1/1
#8 lore raw

Re: [PATCH] image.bbclass: create /etc/device_table from IMAGE_DEVICE_TABLES

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 7 lines · Antonio Ospite

Right now when the 'devices' script from initscripts is called the layout specified in IMAGE_DEVICES_TABLES is lost.

With this change the default behaviour when no IMAGE_DEVICE_TABLES is specified is to always use files/device_table-minimal.txt

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFL1cB+MkyGM64RGpERAnquAKCFb89g5PV6wYgSd1GFMTbjd97xFwCgu2+6 RETaJGE/0J02PikPZeyBF7o=
=F9aX
-----END PGP SIGNATURE-----

#9 lore raw

Re: [PATCH] image.bbclass: create /etc/device_table from IMAGE_DEVICE_TABLES

Quoted 7 lines · On Mon, 26 Apr 2010 18:34:06 +0200 Koen Kooi <[email protected]> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 3 lines · Antonio Ospite

Right now when the 'devices' script from initscripts is called the layout specified in IMAGE_DEVICES_TABLES is lost.

Quoted 6 lines
Quoted 4 lines

With this change the default behaviour when no IMAGE_DEVICE_TABLES is specified is to always use files/device_table-minimal.txt

Koen, would you push this if there are no objections?

Thanks,
Antonio

Signature · 10 lines
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
#10 lore raw

Re: [PATCH] image.bbclass: create /etc/device_table from IMAGE_DEVICE_TABLES

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Done, thanks for the patch!

Quoted 25 lines · Antonio Ospite
Quoted 7 lines · On Mon, 26 Apr 2010 18:34:06 +0200 Koen Kooi <[email protected]> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 3 lines · Antonio Ospite

Right now when the 'devices' script from initscripts is called the layout specified in IMAGE_DEVICES_TABLES is lost.

Quoted 6 lines
Quoted 4 lines

With this change the default behaviour when no IMAGE_DEVICE_TABLES is specified is to always use files/device_table-minimal.txt

Koen, would you push this if there are no objections?

Thanks,
Antonio

Quoted 4 lines

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFL2GFjMkyGM64RGpERAjdBAJ9Y24F2iqPUNBTL96xErdnX8Y1T/QCdEE+8 EZ1fuzMzbZVU/OrMFvhvGRE=
=uXiV
-----END PGP SIGNATURE-----