Author: undefine
Date: Sun Jan 27 14:37:07 2008
New Revision: 9202

Modified:
   geninitrd/trunk/geninitrd
Log:
- --with-blkid support to allow use root=LABEL=somewhere
- disabled by default


Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd   (original)
+++ geninitrd/trunk/geninitrd   Sun Jan 27 14:37:07 2008
@@ -91,6 +91,7 @@
        echo "       [--with-suspend] [--without-suspend]"
        echo "       [--with-tuxonice] [--without-tuxonice]"
        echo "       [--without-dmraid] [--without-multipath]"
+       echo "       [--with-blkid]"
        echo "       <initrd-image> <kernel-version>"
        echo ""
        echo "example:"
@@ -1511,10 +1512,23 @@
        fi
 }
 
+initrd_gen_blkid()
+{
+       debug "Adding BLKID support to initrd"
+       inst /sbin/initrd-blkid /bin/blkid
+       initrd_gen_devices
+       add_linuxrc <<-'EOF'
+               device=/dev/no_partition_found
+               label="$(echo "$CMDLINE" | busybox awk '/root=LABEL=/ { 
gsub(/.*root=/,NIL,$0); gsub(/ .*/,NIL,$0); print $0; } ')"
+               root="$(/bin/blkid -t $label -o device -l |busybox awk '/dev/ { 
gsub(/\/dev\//,NIL,$0); print $0; } ' )"
+               [ -n "$root" ] && device=/dev/$root
+       EOF
+}
+
 initrd_gen_procdata() {
        debug "Adding rootfs finding based on kernel cmdline root= option 
support."
        add_linuxrc <<-'EOF'
-               root="$(echo "$CMDLINE" | busybox awk ' /root=\/dev\// { 
gsub(/.*root=\/dev\//,NIL,$0); gsub(/ .*/,NIL,$0); print $0; } ')"
+               [ -z "$root" ] && root="$(echo "$CMDLINE" | busybox awk ' 
/root=\/dev\// { gsub(/.*root=\/dev\//,NIL,$0); gsub(/ .*/,NIL,$0); print $0; } 
')"
                if [ -n "$root" ]; then
                        rootnr="$(busybox awk -v root="$root" ' { if ($4 == 
root) { print 256*$1+$2; } } ' /proc/partitions)"
                        if [ -n "$rootnr" ]; then
@@ -1627,6 +1641,9 @@
        --without-multipath)
                USE_MULTPATH=no
                ;;
+       --with-blkid)
+               USE_BLKID=yes
+               ;;
        --with=*)
                BASICMODULES="$BASICMODULES ${1#--with=}"
                ;;
@@ -1939,6 +1956,10 @@
        initrd_gen_multipath
 fi
 
+if is_yes "$USE_BLKID" ]; then
+       initrd_gen_blkid
+fi
+
 if is_yes "$have_nfs"; then
        initrd_gen_nfs
 elif is_yes "$USERAIDSTART" && is_yes "$have_md"; then
@@ -1967,6 +1988,8 @@
        # Parsing root parameter
        # We support passing root as hda3 /dev/hda3 0303 0x0303 and 303
        add_linuxrc <<-'EOF'
+               [ -z "$device" ] && device=/dev/no_partition_found 
+               if [ "$device" = '/dev/no_partition_found' ]; then
                eval "$(busybox awk -v c="$CMDLINE" '
                BEGIN {
                        num_pattern_short = "[0-9a-f][0-9a-f][0-9a-f]";
@@ -1996,6 +2019,7 @@
                                partition, maj, min);
                }
                ' /proc/partitions)"
+               fi
                if [ "$device" != '/dev/no_partition_found' -a ! -b $device ]; 
then
                        mknod $device b $maj $min
                fi
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to