summaryrefslogtreecommitdiff
path: root/recipes/altboot/files/sd-dynamic-fix.patch
blob: f31c6b8dc7a59cd546886d904b7c0e3ad8bb56a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Index: trunk/altboot.func
===================================================================
--- trunk.orig/altboot.func	2007-10-30 15:48:16.000000000 +0000
+++ trunk/altboot.func	2007-10-30 15:48:21.000000000 +0000
@@ -499,17 +499,6 @@
 	then
 		echo "Note: $SD_MOUNTPOINT is already mounted"
 	else
-		# We can't trust that the SD device file is there when running kernel 2.6 w/ udev
-		# and starting udev at this point may not be the best idea...	
-		if `uname -r | grep -q "2.6"`
-		then
-			#Let's just assume the device file name never changes...
-			dev_no="`echo "$SD_DEVICE" | sed -n "s/\/dev\/mmcblk\(.*\)p\(.*\)/\1/p"`"
-			part_no="`echo "$SD_DEVICE" | sed -n "s/\/dev\/mmcblk\(.*\)p\(.*\)/\2/p"`"
-			! test -e /dev/mmcblk${dev_no} && mknod /dev/mmcblk${dev_no} b 254 0
-			! test -e /dev/mmcblk${dev_no}p${part_no} && mknod /dev/mmcblk${dev_no}p${part_no} b 254 $part_no				
-		fi
-
 		# Kernel 2.6 has the SD driver compiled into the kernel
 		if test -n "$SD_KERNEL_MODULE"	
 		then
@@ -544,6 +533,21 @@
 			fi
 		fi
 		
+		# We can't trust that the SD device file is there when running kernel 2.6 w/ udev
+		# and starting udev at this point may not be the best idea...
+		if `uname -r | grep -q "2.6"`
+		then
+			#Let's just assume the device file name never changes...
+			dev_no="`echo "$SD_DEVICE" | sed -n "s/\/dev\/mmcblk\(.*\)p\(.*\)/\1/p"`"
+			part_no="`echo "$SD_DEVICE" | sed -n "s/\/dev\/mmcblk\(.*\)p\(.*\)/\2/p"`"
+			if [ -f /sys/block/mmcblk${dev_no}/mmcblk${dev_no}p${part_no}/dev ]
+			then
+				rm -f /dev/mmcblk${dev_no}p${part_no} || true
+				mknod /dev/mmcblk${dev_no}p${part_no} b `cat /sys/block/mmcblk${dev_no}/mmcblk${dev_no}p${part_no}/dev|sed 's/:/ /' `
+			fi
+
+		fi
+
 		sleep 3
 		
 		check_fs "$SD_DEVICE"