[PATCH] Fallback to /ofw on missing DMI in olpc-configure
    Bernie Innocenti 
    bernie at codewiz.org
       
    Sun Mar  7 08:49:23 EST 2010
    
    
  
This fallback is necessary even if we ship an updated
OpenFirmware which enables SMBIOS within the signed OS
image, laptops will continue running with the previous
firmware until plugged to AC during boot.
If we run olpc-configure with no SMBIOS on first boot,
wrong keyboard settings will be stored permanently.
---
 etc/rc.d/init.d/olpc-configure |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/etc/rc.d/init.d/olpc-configure b/etc/rc.d/init.d/olpc-configure
index 2ef93fc..175da3a 100755
--- a/etc/rc.d/init.d/olpc-configure
+++ b/etc/rc.d/init.d/olpc-configure
@@ -16,16 +16,20 @@ XO_VERSION=0
 
 get_xo_version() {
 	# This requires an OFW that runs setup-smbios at boot.
-	[ -e "/sys/class/dmi/id/product_name" ] || return
-
-	name=$(</sys/class/dmi/id/product_name)
-	version=$(</sys/class/dmi/id/product_version)
-	if [ "${name}" == "XO" ]; then
-		if [ "${version}" == "1" ]; then
-			XO_VERSION="1"
-		elif [ "${version}" == "1.5" ]; then
-			XO_VERSION="1.5"
+	if [ -e "/sys/class/dmi/id/product_name" ]; then
+		local name=$(</sys/class/dmi/id/product_name)
+		local version=$(</sys/class/dmi/id/product_version)
+		if [ "${name}" == "XO" ]; then
+			if [ "${version}" == "1" ]; then
+				XO_VERSION="1"
+			elif [ "${version}" == "1.5" ]; then
+				XO_VERSION="1.5"
+			fi
 		fi
+	elif [ -e "/ofw/banner-name" ]; then
+		case "$(</ofw/banner-name)" in
+			OLPC\ B*|OLPC\ C*) XO_VERSION="1" ;;
+		esac
 	fi
 }
 
-- 
1.6.6.1
    
    
More information about the Devel
mailing list