X-Git-Url: http://gitweb/?a=blobdiff_plain;f=filesystem%2Frc;h=cc1bc7e01d17cd4e4c1a2a5966f01c6c64ee2bb2;hb=refs%2Fheads%2F3.1;hp=8fd3474ac63b408b25d090a60aa1497a6e9ffed1;hpb=b358420556090ad88f44a17992408f0cc4816914;p=initrd.git

diff --git a/filesystem/rc b/filesystem/rc
index 8fd3474..cc1bc7e 100755
--- a/filesystem/rc
+++ b/filesystem/rc
@@ -31,8 +31,7 @@ checkReturn() {
 find_and_mount_media() {
 	echo -e " ${BOLD}${BLUE}*${NORM} Searching for the CRUX media..."
 	mkdir -p /media
-	CRUXMEDIA=""
-	MMC_DEVICES="`grep -E 'mmcblk' /proc/partitions | awk '{ print $4 }'`"
+	MMC_DEVICES="`grep -E 'mmcblk0p' /proc/partitions | awk '{ print $4 }'`"
 	BLOCK_DEVICES="`grep -E '[sh]d' /proc/partitions | awk '{ print $4 }'`"
 	for DEV in $MMC_DEVICES $BLOCK_DEVICES
 	do
@@ -44,7 +43,6 @@ find_and_mount_media() {
 			if [ -e /media/crux-media ]
 			then
 				echo ", CRUX media."
-				CRUXMEDIA=$DEV
 				ln -s $DEV /dev/media
 				break
 			else
@@ -79,14 +77,14 @@ find_and_mount_media() {
 		echo
 	else
 		# configure modules
-		MODULES="`find /media/crux/kernel -type f -name 'modules-*.tar.*'`"
+		MODULES="`find /media/crux/kernel -type f -name 'modules-*.tar.*' 2>/dev/null`"
 		if [ ! -z "$MODULES" ]; then
 			tar -C /tmp -xf $MODULES
 			cd /lib && ln -s /tmp/lib/* .
 			depmod
 		fi
 		# configure pkgutils
-		PKGUTILS="`find /media/crux/core -type f -name 'pkgutils#*.pkg.tar.*'`"
+		PKGUTILS="`find /media/crux/core -type f -name 'pkgutils#*.pkg.tar.*' 2>/dev/null`"
 		if [ ! -z "$PKGUTILS" ]; then
 			tar -C /tmp -xf $PKGUTILS
 			cd /usr/bin && ln -s /tmp/usr/bin/* .
@@ -100,11 +98,31 @@ find_and_mount_media() {
 #
 
 echo ""
-echo -e "${BOLD}CRUX-ARM 2.7.1 - ${BLUE}http://crux-arm.nu/${NORM}"
+echo -e "${BOLD}CRUX-ARM 3.1 - ${BLUE}http://crux-arm.nu/${NORM}"
 echo ""
 
 exec >/dev/console </dev/console 2>&1
 
+# premature mount /proc since we need some rw operations
+echo -e -n " ${BOLD}${BLUE}*${NORM} Mounting "
+echo -e -n "${BOLD}${GREEN}/proc${NORM}"
+mount -t proc proc /proc
+
+if grep -q "debug" /proc/cmdline
+then
+	DEBUG=1
+fi
+
+# dont show kernel printk messages
+PRINTK="`cat /proc/sys/kernel/printk`"
+if [ -z $DEBUG ]
+then
+	echo "0" > /proc/sys/kernel/printk
+fi
+
+echo -e ", ${BOLD}${GREEN}/sys${NORM}."
+mount -t sysfs sysfs /sys
+
 echo -e -n " ${BOLD}${BLUE}*${NORM} Mounting filesystems... "
 mount -a && \
 mount -o remount,rw /
@@ -141,11 +159,28 @@ echo -e -n " ${BOLD}${BLUE}*${NORM} Saving boot messages... "
 dmesg > /var/log/boot
 checkReturn
 
+# run mdev again to fix issues with mmc devices. yeah, it is weird but worked
+mdev -s
+
 echo -e " ${BOLD}${BLUE}*${NORM} Trying to find and mount the media installer..."
 find_and_mount_media
 
+# debug could be necessary when are working with a new device and/or features
+# and for a weird reason you can't see any output message on the console.
+# You can create a debug.sh script at topdir of your install media and redirect
+# the output to a file to inspect later
+if [ ! -z $DEBUG ];
+then
+	echo -e -n " ${BOLD}${BLUE}*${NORM} Loading debug script..."
+	/media/debug.sh
+	checkReturn
+fi
+
 echo
 echo "The system is coming up. Please wait."
 echo
 
+# restore kernel printk status
+echo "$PRINTK" > /proc/sys/kernel/printk
+
 # End of file