[oe] [PATCH 14/17] initramfs-module-mdev: add

Otavio Salvador otavio at ossystems.com.br
Mon May 30 14:54:20 UTC 2011


Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
---
 recipes/initrdscripts/files/00-mdev.sh             |   19 +++++++++++++++++++
 recipes/initrdscripts/files/99-mdev.sh             |    6 ++++++
 recipes/initrdscripts/initramfs-module-mdev_1.0.bb |   13 +++++++++++++
 3 files changed, 38 insertions(+), 0 deletions(-)
 create mode 100644 recipes/initrdscripts/files/00-mdev.sh
 create mode 100644 recipes/initrdscripts/files/99-mdev.sh
 create mode 100644 recipes/initrdscripts/initramfs-module-mdev_1.0.bb

diff --git a/recipes/initrdscripts/files/00-mdev.sh b/recipes/initrdscripts/files/00-mdev.sh
new file mode 100644
index 0000000..a8e9622
--- /dev/null
+++ b/recipes/initrdscripts/files/00-mdev.sh
@@ -0,0 +1,19 @@
+load() {
+	modprobe $1 >/dev/null 2>&1 && info "Loaded module $1"
+}
+
+# setup the environment
+mkdir -p /dev
+mount -t tmpfs tmpfs /dev
+mkdir -m 0755 /dev/pts
+mkdir -m 1777 /dev/shm
+mount -t devpts devpts /dev/pts
+
+echo /sbin/mdev > /proc/sys/kernel/hotplug
+mdev -s
+
+# modules for disk nodes
+load sd-mod
+
+# load modules for devices
+find /sys -name modalias | while read m; do load $(cat $m) >/dev/null 2>&1; done
diff --git a/recipes/initrdscripts/files/99-mdev.sh b/recipes/initrdscripts/files/99-mdev.sh
new file mode 100644
index 0000000..4a78cfb
--- /dev/null
+++ b/recipes/initrdscripts/files/99-mdev.sh
@@ -0,0 +1,6 @@
+if [ -n "$BOOT_ROOT" ]; then
+	# move filesystems over to the mounted root
+	mount --move /dev $BOOT_ROOT/dev
+	mount --move /proc $BOOT_ROOT/proc
+	mount --move /sys $BOOT_ROOT/sys
+fi
diff --git a/recipes/initrdscripts/initramfs-module-mdev_1.0.bb b/recipes/initrdscripts/initramfs-module-mdev_1.0.bb
new file mode 100644
index 0000000..266262d
--- /dev/null
+++ b/recipes/initrdscripts/initramfs-module-mdev_1.0.bb
@@ -0,0 +1,13 @@
+SRC_URI = "file://00-mdev.sh file://99-mdev.sh"
+PR = "r1"
+RDEPENDS_${PN} = "initramfs-uniboot"
+DESCRIPTION = "An initramfs module to setup mdev and load modules"
+
+do_install() {
+    install -d ${D}/initrd.d
+    install -m 0755 ${WORKDIR}/00-mdev.sh ${D}/initrd.d/
+    install -m 0755 ${WORKDIR}/99-mdev.sh ${D}/initrd.d/
+}
+
+PACKAGE_ARCH = "all"
+FILES_${PN} += " /initrd.d/* "
-- 
1.7.1





More information about the Openembedded-devel mailing list