mdev: Add proper firmware loading support to mdev
authorMichael-Luke Jones <mlj28@cam.ac.uk>
Tue, 26 Sep 2006 19:30:49 +0000 (19:30 +0000)
committerMichael-Luke Jones <mlj28@cam.ac.uk>
Tue, 26 Sep 2006 19:30:49 +0000 (19:30 +0000)
 * Patch contributed by Christian Hohnstaedt
 * mdev.conf updated to reflect change in firmware loading

packages/mdev/mdev-1.2.1/firmware [new file with mode: 0644]
packages/mdev/mdev-1.2.1/mdevfirmware.patch [new file with mode: 0644]
packages/mdev/mdev-1.2.1/slugos/loadmicrocode.sh [deleted file]
packages/mdev/mdev-1.2.1/slugos/mdev.conf
packages/mdev/mdev_1.2.1.bb

diff --git a/packages/mdev/mdev-1.2.1/firmware b/packages/mdev/mdev-1.2.1/firmware
new file mode 100644 (file)
index 0000000..c88d3fb
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+firmwaredir=/lib/firmware
+
+if test "$SUBSYSTEM" = "firmware" -a "$ACTION" = "add"; then
+ if test -f $firmwaredir/$FIRMWARE; then
+   echo 1 > /sys/$DEVPATH/loading
+   cat $firmwaredir/$FIRMWARE > /sys/$DEVPATH/data
+   echo 0 > /sys/$DEVPATH/loading
+ else
+   echo -1 > /sys/$DEVPATH/loading
+ fi
+fi
+
diff --git a/packages/mdev/mdev-1.2.1/mdevfirmware.patch b/packages/mdev/mdev-1.2.1/mdevfirmware.patch
new file mode 100644 (file)
index 0000000..8dae2a9
--- /dev/null
@@ -0,0 +1,20 @@
+--- busybox-1.2.1/util-linux/mdev.c.orig       2006-07-01 00:42:13.000000000 +0200
++++ busybox-1.2.1/util-linux/mdev.c    2006-09-26 17:42:38.414162744 +0200
+@@ -255,7 +255,16 @@
+                       bb_show_usage();
+               sprintf(temp, "/sys%s", env_path);
+-              if (!strcmp(action, "add")) make_device(temp,0);
++              if (!strcmp(action, "add")) {
++                      struct stat st;
++                      make_device(temp,0);
++                      sprintf(temp, "/lib/mdev/%s", getenv("SUBSYSTEM"));
++                      if (stat(temp, &st) == 0) {
++                              if ((st.st_mode & S_IXUSR) && S_ISREG(st.st_mode)) {
++                                      system(temp);
++                              }
++                      }
++              }
+               else if (!strcmp(action, "remove")) make_device(temp,1);
+       }
diff --git a/packages/mdev/mdev-1.2.1/slugos/loadmicrocode.sh b/packages/mdev/mdev-1.2.1/slugos/loadmicrocode.sh
deleted file mode 100644 (file)
index ad1a9e7..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-
-# Manual firmware loading with firmware_class
-# Reason: Because I can (or because mdev doesn't support firmware loading)
-# Trigger: Creation of the /dev/ixp4xx_ucode device (this is hacky too, unfortunately)
-
-sleep 1
-
-# Cancel NPE-A microcode upload
-echo -1 > /sys/class/firmware/ixp4xx_npe.0/loading
-
-sleep 1
-
-# Test for NPE-B presence
-
-if test -f /lib/firmware/NPE-B; then
-    # Upload NPE-B microcode
-    echo 1 > /sys/class/firmware/ixp4xx_npe.1/loading
-    cat /lib/firmware/NPE-B > /sys/class/firmware/ixp4xx_npe.1/data
-    echo 0 > /sys/class/firmware/ixp4xx_npe.1/loading
-else
-    # Cancel NPE-B microcode upload
-    echo -1 > /sys/class/firmware/ixp4xx_npe.1/loading
-fi
-
-sleep 1
-
-# Cancel NPE-C microcode upload
-echo -1 > /sys/class/firmware/ixp4xx_npe.2/loading
index eaf77e6..751663e 100644 (file)
@@ -9,4 +9,4 @@ ptmx 0:5 666
 tty 0:5 0660
 ttyS* 0:20 640
 event0 0:0 660 @ln -sf /dev/event0 /dev/buzzer
-ixp4xx_ucode root:root 600 @/lib/mdev/loadmicrocode.sh
\ No newline at end of file
+ixp4xx_ucode root:root 600
index b2496f5..78f7e94 100644 (file)
@@ -4,22 +4,23 @@ busybox. This adds a very small extra overhead in rootfs size      \
 (approx 4kB) but allows greater flexibility."
 HOMEPAGE = "http://www.busybox.net"
 LICENSE = "GPL"
-PR = "r4"
+PR = "r5"
 
 S = ${WORKDIR}/busybox-${PV}
 
 SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.gz \
           file://mdevdelnodes.patch;patch=1 \
-       file://defconfig \
+          file://mdevfirmware.patch;patch=1 \
+           file://defconfig \
           file://mdev.sh \
           file://mdev.conf \
+          file://firmware \
           "
-SRC_URI_append_slugos = "file://loadmicrocode.sh"
 
 export EXTRA_CFLAGS = "${CFLAGS}"
 EXTRA_OEMAKE_append = " CROSS=${HOST_PREFIX}"
 
-FILES_${PN} = "${sysconfdir}/init.d/mdev.sh ${sysconfdir}/mdev.conf ${base_sbindir}/mdev ${base_libdir}/mdev/loadmicrocode.sh"
+FILES_${PN} = "${sysconfdir}/init.d/mdev.sh ${sysconfdir}/mdev.conf ${base_sbindir}/mdev ${base_libdir}/mdev/firmware"
 
 INITSCRIPT_PACKAGES = "${PN}"
 INITSCRIPT_NAME_${PN} = "mdev.sh"
@@ -56,5 +57,5 @@ do_install () {
        install -m 0755 ${WORKDIR}/mdev.sh ${D}${sysconfdir}/init.d/
        
        install -d ${D}${base_libdir}/mdev
-       install -m 0755 ${WORKDIR}/loadmicrocode.sh ${D}${base_libdir}/mdev/loadmicrocode.sh
+       install -m 0755 ${WORKDIR}/firmware ${D}${base_libdir}/mdev/firmware
 }