Prechádzať zdrojové kódy

Added tiny init

For rescue mode, it can be asked that an update
is run automatically after a power on.
A custom init is started that checks for a USB pen
and tries to update the system.

Signed-off-by: Stefano Babic <sbabic@denx.de>
Stefano Babic 10 rokov pred
rodič
commit
3d4c926a82

+ 3 - 7
recipes-core/initscripts/initscripts-swupdate.bb → recipes-core/initscripts-swupdate/initscripts-swupdate.bb

@@ -2,7 +2,7 @@ SUMMARY = "Different startup scripts"
 SECTION = "base"
 PR = "r0"
 LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58"
+LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"
 
 SRC_URI = "file://rcS.swupdate \
 	"
@@ -10,10 +10,9 @@ SRC_URI = "file://rcS.swupdate \
 S = "${WORKDIR}"
 
 do_install () {
-	install -d ${D}/${sysconfdir}
 	install -d ${D}/${sysconfdir}/init.d
-	rm -f ${D}${sysconfdir}/init.d/rcS
-	install -m 755 ${S}/rcS.swupdate ${D}${sysconfdir}/init.d
+	install -d ${D}${base_sbindir}
+	install -m 755 ${S}/rcS.swupdate ${D}${base_sbindir}/init
 }
 
 PACKAGES = "${PN}"
@@ -22,6 +21,3 @@ FILES_${PN} = "/"
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 CONFFILES_${PN} = ""
-
-INITSCRIPT_NAME = "swupdate"
-INITSCRIPT_PARAMS = "defaults 70"

+ 15 - 37
recipes-core/initscripts/initscripts-swupdate/rcS.swupdate → recipes-core/initscripts-swupdate/initscripts-swupdate/rcS.swupdate

@@ -1,7 +1,7 @@
 #!/bin/sh
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
-USB=/mnt/card
+USB=/mnt
 
 umask 022
 mount -t proc proc /proc
@@ -9,9 +9,9 @@ mount sysfs /sys -t sysfs
 if [ -e /proc/cpu/alignment ]; then
    echo "3" > /proc/cpu/alignment
 fi
-mount tmpfs -t tmpfs $TMPDIR -o,size=40k
 
 echo 0 > /proc/sys/kernel/printk
+echo 100 > /sys/class/backlight/pwm-backlight/brightness
 
 mount_usb() {
 found=0
@@ -41,7 +41,7 @@ fi
 
 
 # wait until the device node is created
-reset
+
 echo "Checking for application software"
 echo "---------------------------------"
 echo "  "
@@ -58,42 +58,20 @@ while [ 1 ];do
 	fi
 done
 
-if [ -f ${USB}/software*.img ];then
-	found=1
-	break
-fi
-
-if [ $found == 0 ];then
-	echo "No Software Image found....exiting !"
+echo " "
+echo "Starting Software Update"
+echo "------------------------"
+swupdate -i "${USB}/*.swu" -v
+if [ $? == 0 ];then
+	echo "SUCCESS !"
+else
+	echo "FAILURE !"
 fi
 
-
-for file in ${USB}/software*.img;do
-	echo " "
-	echo "Starting Software Update"
-	echo "------------------------"
-	echo Image found : $file
-	echo " "
-	swupdate -i $file -v	
-	if [ $? == 0 ];then
-		echo "SUCCESS !"
-	else
-		echo "FAILURE !"
-	fi
-	sleep 5
-	break
+while [ 1 ]; do
+	echo "Please reboot the system !"
+	sleep 90
+	reboot
 done
 
-console=`cat /sys/class/tty/console/active`
-
-echo "console is $console"
-
-if [ x$console != "xttyO0" ];then
-	while [ 1 ]; do
-		echo "Please reboot the system !"
-		sleep 90
-		reboot
-	done
-fi
-/bin/sh
 exit 0