summaryrefslogtreecommitdiff
path: root/initramfs
diff options
context:
space:
mode:
Diffstat (limited to 'initramfs')
-rw-r--r--initramfs9
-rwxr-xr-xinitramfs/hook20
-rwxr-xr-xinitramfs/script32
3 files changed, 52 insertions, 9 deletions
diff --git a/initramfs b/initramfs
deleted file mode 100644
index af191cd..0000000
--- a/initramfs
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh -e
-
-for i in `ls /sys/dev/block/`; do
- DEV=/tmp/bcache_dev
-
- mknod $DEV b `echo $i|sed -e 's/:/ /'`
- echo $DEV > /sys/fs/bcache/register_quiet
- rm $DEV
-done
diff --git a/initramfs/hook b/initramfs/hook
new file mode 100755
index 0000000..3c429d0
--- /dev/null
+++ b/initramfs/hook
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+PREREQ="udev"
+
+prereqs()
+{
+ echo "$PREREQ"
+}
+
+case $1 in
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+. /usr/share/initramfs-tools/hook-functions
+
+copy_exec /bin/mknod
+manual_add_modules bcache
diff --git a/initramfs/script b/initramfs/script
new file mode 100755
index 0000000..926d5d3
--- /dev/null
+++ b/initramfs/script
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+mountroot_fail()
+{
+ for i in `ls /dev/sd*`; do
+ echo $i > /sys/fs/bcache/register_quiet
+ done
+
+# for i in `ls /sys/dev/block/`; do
+# DEV=/bcache_dev
+#
+# mknod $DEV b `echo $i|sed -e 's/:/ /'`
+# echo $DEV > /sys/fs/bcache/register_quiet
+# rm $DEV
+# done
+}
+
+case $1 in
+prereqs)
+ exit 0
+ ;;
+mountfail)
+ mountroot_fail
+ exit 0
+ ;;
+esac
+
+. /scripts/functions
+
+add_mountroot_fail_hook "30-bcache"
+
+exit 0