summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--01-memdisk.rules11
-rw-r--r--Makefile1
-rw-r--r--hooks/memdisk11
-rw-r--r--install/base3
-rw-r--r--install/memdisk20
5 files changed, 46 insertions, 0 deletions
diff --git a/01-memdisk.rules b/01-memdisk.rules
new file mode 100644
index 0000000..5015d7e
--- /dev/null
+++ b/01-memdisk.rules
@@ -0,0 +1,11 @@
+ACTION=="add|change", SUBSYSTEM=="block", KERNEL=="mtdblock*", ATTRS{name}=="memdisk", ATTRS{type}=="ram", GOTO="memdisk_start"
+GOTO="memdisk_end"
+
+LABEL="memdisk_start"
+
+SYMLINK+="memdisk"
+IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
+ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
+ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
+
+LABEL="memdisk_end"
diff --git a/Makefile b/Makefile
index 22ab866..2056160 100644
--- a/Makefile
+++ b/Makefile
@@ -23,6 +23,7 @@ install: all
install -D -m755 init_functions ${DESTDIR}/lib/initcpio/init_functions
install -D -m644 functions ${DESTDIR}/lib/initcpio/functions
install -D -m755 load-modules.sh ${DESTDIR}/lib/initcpio/udev/load-modules.sh
+ install -D -m644 01-memdisk.rules ${DESTDIR}/lib/initcpio/udev/01-memdisk.rules
install -d ${DESTDIR}/lib/initcpio/hooks
install -d ${DESTDIR}/lib/initcpio/install
diff --git a/hooks/memdisk b/hooks/memdisk
new file mode 100644
index 0000000..2c3642e
--- /dev/null
+++ b/hooks/memdisk
@@ -0,0 +1,11 @@
+# vim:set ft=sh:
+run_hook ()
+{
+ MEMDISK=$(/usr/bin/memdiskfind)
+ if [ $? -eq 0 ]; then
+ # We found a memdisk, set up phram
+ /sbin/modprobe phram phram=memdisk,${MEMDISK}
+ # Load mtdblock, the memdisk will be /dev/mtdblock0
+ /sbin/modprobe mtdblock
+ fi
+}
diff --git a/install/base b/install/base
index a117020..d1aa176 100644
--- a/install/base
+++ b/install/base
@@ -13,7 +13,10 @@ install ()
add_dir "/usr/lib"
add_dir "/usr/sbin"
+ add_device "/dev/null" c 1 3
+ add_device "/dev/zero" c 1 5
add_device "/dev/console" c 5 1
+ add_device "/dev/mem" c 1 1
add_binary /lib/initcpio/busybox /bin/busybox
add_binary /sbin/modprobe
diff --git a/install/memdisk b/install/memdisk
new file mode 100644
index 0000000..d2a844d
--- /dev/null
+++ b/install/memdisk
@@ -0,0 +1,20 @@
+# vim:set ft=sh:
+
+install ()
+{
+ MODULES="phram mtdblock"
+ BINARIES="/usr/bin/memdiskfind"
+ FILES=""
+ SCRIPT="memdisk"
+ add_file /lib/initcpio/udev/01-memdisk.rules /lib/udev/rules.d/01-memdisk.rules
+}
+
+help ()
+{
+cat <<HELPEOF
+ This hook detects a virtual disk created by the memdisk
+ tool (http://syslinux.zytor.com/wiki/index.php/MEMDISK).
+
+ It requires memdiskfind from syslinux 4.00 or newer.
+HELPEOF
+}