Browse Source

system: skeleton: init: Fix mount ROOT fail

The SD card is not ready when ramdisk init and mount root;
So add a delay to wait for SD card ready, period is 100ms, timeout is 10s

Signed-off-by: Jianlong Huang <jianlong.huang@starfivetech.com>
Jianlong Huang 1 year ago
parent
commit
8003c018db
1 changed files with 11 additions and 0 deletions
  1. 11 0
      system/skeleton/init

+ 11 - 0
system/skeleton/init

@@ -40,6 +40,17 @@ if [ $ROOT == "/dev/nfs" ] && [ "x${NFSROOT}" != "x" ];then
 	/sbin/ifup -a
 	mount -t nfs -o nolock $NFSROOT /rootfs
 else
+	cnt=0
+	while [ $cnt -lt 100 ]
+	do
+		if [ ! -e $ROOT ];then
+			sleep 0.1
+		else
+			echo "find $ROOT: $cnt"
+			break
+		fi
+		let cnt++
+	done
 	mount $ROOT /rootfs/
 	if [ ! -e /rootfs/dev/console ]; then
 		/bin/mknod /rootfs/dev/console c 5 1