Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(863)

Unified Diff: init

Issue 6724018: use crossystem for developer mode and nonchrome detection (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/initramfs.git@master
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: init
diff --git a/init b/init
index 52cd73b17528842b66637d47fec4b3a8f5a882c4..80d74ad4f87be06c9c04e59513341604599201cf 100644
--- a/init
+++ b/init
@@ -572,15 +572,15 @@ use_new_root() {
return 1
}
+is_nonchrome() {
+ crossystem mainfw_type?nonchrome
gauravsh 2011/03/23 02:25:18 it wasn't clear to me what exactly this does. Does
Randall Spangler 2011/03/23 15:54:17 Yes. (New feature of crossystem)
+}
+
is_developer_mode() {
- # See Firmware High-Level Spec for details on CHSW values
- CHSW=$(cat /sys/devices/platform/chromeos_acpi/CHSW)
- # If the switch is unsupported, treat as developer mode.
- [ -z "$CHSW" ] && return 0
- if [ $CHSW -gt 0 -a $((CHSW & 32)) -eq 32 ]; then
- return 0
- fi
- return 1
+ # Legacy/unsupported systems are mapped to developer mode.
+ is_nonchrome && return 0
+ # Otherwise the exit status will be accurate.
+ crossystem devsw_boot?1
}
lock_tpm() {
@@ -590,11 +590,17 @@ lock_tpm() {
tpmc startup
tpmc ctest
if ! tpmc block; then
- log "An unrecoverable error occurred with your security device"
- log "Please power down and try again."
- dlog "Failed to lock bGlobalLock."
- on_error
- return 1 # Never reached.
+ if is_nonchrome; then
+ log "No security chip appears to exist in this non-Chrome device."
+ log "The security of your experience will suffer."
+ # Forge onward.
+ else
+ log "An unrecoverable error occurred with your security device"
+ log "Please power down and try again."
+ dlog "Failed to lock bGlobalLock."
+ on_error
+ return 1 # Never reached.
+ fi
fi
TPM_B_LOCKED=y
fi
@@ -690,6 +696,13 @@ main() {
# If not, we must be a recovery kernel.
NEWROOT_MNT="$USB_MNT"
+ if is_nonchrome; then
+ log "Your computer does not appear to a Chrome computer!"
+ log " "
+ log "Your experience with Chromium OS will be suboptimal."
+ log " "
+ fi
+
# Always lock the TPM. If a NVRAM reset is ever needed, we can change it.
lock_tpm || on_error
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698