[PATCH 4/6] rootfs-block: Support lilo style device numbers.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Lilo supplies root=900 rather than root=/dev/md0. Similarly it would say root=801 rather
than root=/dev/sda1.

This patch simply interprets that number and creates appropriate udev rules
to create the /dev/root symlink as needed.
---
 modules.d/95rootfs-block/block-genrules.sh | 11 ++++++++++-
 modules.d/95rootfs-block/parse-block.sh    |  4 ++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/modules.d/95rootfs-block/block-genrules.sh b/modules.d/95rootfs-block/block-genrules.sh
index 7f894ee..161183e 100755
--- a/modules.d/95rootfs-block/block-genrules.sh
+++ b/modules.d/95rootfs-block/block-genrules.sh
@@ -2,7 +2,16 @@
 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 
-if [ "${root%%:*}" = "block" ]; then
+if [ -n "$rootdevnum" ]; then
+    major=$(( 0x$rootdevnum / 256 ))
+    minor=$(( 0x$rootdevnum - ( $major * 256 ) ))
+    {
+        printf 'ACTION=="add|change", ENV{MAJOR}=="%d", ENV{MINOR}=="%d", SYMLINK+="root"\n' \
+            $major $minor
+    } >> /etc/udev/rules.d/99-root.rules
+
+    wait_for_dev /dev/root
+elif [ "${root%%:*}" = "block" ]; then
     {
         printf 'KERNEL=="%s", SYMLINK+="root"\n' \
             ${root#block:/dev/}
diff --git a/modules.d/95rootfs-block/parse-block.sh b/modules.d/95rootfs-block/parse-block.sh
index 3745352..9efc51f 100755
--- a/modules.d/95rootfs-block/parse-block.sh
+++ b/modules.d/95rootfs-block/parse-block.sh
@@ -19,4 +19,8 @@ case "$root" in
     /dev/*)
         root="block:${root}"
         rootok=1 ;;
+    [1-9][0-9][0-9])
+        rootdevnum=$root
+        root=block:/dev/root
+        rootok=1 ;;
 esac
-- 
1.8.1

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux