SVN: geninitrd/trunk/geninitrd

glen glen at pld-linux.org
Fri Mar 30 16:41:13 CEST 2012


Author: glen
Date: Fri Mar 30 16:41:13 2012
New Revision: 12530

Modified:
   geninitrd/trunk/geninitrd
Log:
no need to mess with magic values, let the "magic" be value

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Fri Mar 30 16:41:13 2012
@@ -784,13 +784,13 @@
 	# parse 'root=xxx' kernel commandline
 	# We support passing root as hda3 /dev/hda3 0303 0x0303 and 303
 	add_linuxrc <<-'EOF'
-		device=/dev/no_partition_found
+		device=
 		eval "$(busybox awk -v c="$ROOT" '
 			BEGIN {
 				num_pattern_short = "[0-9a-f][0-9a-f][0-9a-f]";
 				num_pattern = "[0-9a-f]" num_pattern_short;
 				dev_pattern = "[hms][a-z][a-z]([0-9])+";
-				partition = "no_partition_found";
+				partition = "";
 				min = -1; maj = -1;
 
 				sub("^0x", "", c);
@@ -803,23 +803,27 @@
 				if (c ~ "^" dev_pattern "$") partition = c;
 			}
 
-			$4 == partition { maj = $1; min = $2; }
+			partition && $4 == partition { maj = $1; min = $2; }
 			$1 == maj && $2 == min { partition = $4; }
 
 			END {
 				if (maj >= 0 && min >= 0) {
-					printf("device=/dev/%s; maj=%s; min=%s;\n", partition, maj, min);
+					printf("maj=%s; min=%s;\n", maj, min);
+				}
+				if (partition) {
+					printf("device=/dev/%s;\n", partition);
 				}
 			}
 			' /proc/partitions)"
-		if [ "$device" != '/dev/no_partition_found' -a ! -b $device ]; then
-			mknod $device b $maj $min
-		fi
 
-		if [ "$device" = '/dev/no_partition_found' ]; then
+		if [ -z "$device" ]; then
 			device=$ROOT
 		fi
 
+		if [ "$device" -a ! -b $device ]; then
+			mknod $device b $maj $min
+		fi
+
 		[ -n "$ROOTFSFLAGS" ] && ROOTFSFLAGS="-o $ROOTFSFLAGS"
 
 		mount -t $ROOTFS -r $device $ROOTFSFLAGS /newroot || echo "Mount of rootfs failed."


More information about the pld-cvs-commit mailing list