Re: Only display ACPI bootmenu key if ACPI is present

Previous thread: [head tinderbox] failure on sparc64/sun4v by FreeBSD Tinderbox on Monday, November 8, 2010 - 6:06 am. (1 message)

Next thread: kgdb and .ko files by Julian Elischer on Monday, November 8, 2010 - 5:34 pm. (2 messages)
From: John Baldwin
Date: Monday, November 8, 2010 - 3:14 pm

This patch changes the Forth code for the Beastie menu to only display the
menu option to enable or disable ACPI if the loader detects ACPI.  This avoids
displaying a menu item prompting to enable ACPI if the BIOS doesn't actually
include ACPI.  Any objections?

--- //depot/projects/smpng/sys/boot/forth/beastie.4th	2010-11-08 21:53:18.000000000 0000
+++ //depot/user/jhb/ktrace/boot/forth/beastie.4th	2010-11-08 22:14:04.000000000 0000
@@ -140,12 +140,16 @@
 	fbsdbw-logo
 ;
 
-: acpienabled? ( -- flag )
+: acpipresent? ( -- flag )
 	s" hint.acpi.0.rsdp" getenv
 	dup -1 = if
 		drop false exit
 	then
 	2drop
+	true
+;
+
+: acpienabled? ( -- flag )
 	s" hint.acpi.0.disabled" getenv
 	dup -1 <> if
 		s" 0" compare 0<> if
@@ -178,8 +182,7 @@
 	42 20 2 2 box
 	13 6 at-xy ." Welcome to FreeBSD!"
 	printmenuitem ."  Boot FreeBSD [default]" bootkey !
-	s" arch-i386" environment? if
-		drop
+	acpipresent? if
 		printmenuitem ."  Boot FreeBSD with ACPI " bootacpikey !
 		acpienabled? if
 			." disabled"

-- 
John Baldwin
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
From: Kevin Lo
Date: Monday, November 8, 2010 - 7:00 pm

I have no objection. This patch makes sense to me.

	Kevin

_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
From: Lars Engels
Date: Monday, November 8, 2010 - 10:26 pm

Good idea!

Maybe we should also import PCBSD's patches to the beastie menu?
In PCBSD's beastie menu you can toggle some settings like "safe mode",
and "ACPI", so the kernel is not loaded as soon as select an option.

See
http://trac.pcbsd.org/browser/pcbsd/current/system-overlay/boot/beastie.4th

Lars
From: Andriy Gapon
Date: Tuesday, November 9, 2010 - 6:45 am

Lars,

not sure if I got your suggestion correctly, this is what I have in my local tree:
diff --git a/sys/boot/i386/loader/loader.rc b/sys/boot/i386/loader/loader.rc
index 6443f3f..cb2f723 100644
--- a/sys/boot/i386/loader/loader.rc
+++ b/sys/boot/i386/loader/loader.rc
@@ -5,7 +5,7 @@
 include /boot/loader.4th

 \ Reads and processes loader.conf variables
-start
+initialize

 \ Tests for password -- executes autoboot first if a password was defined
 check-password

With this kernel and modules are _not_ loaded before presenting the menu.

-- 
Andriy Gapon
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
From: Lars Engels
Date: Tuesday, November 9, 2010 - 7:08 am

That's also an appreciated improvement, but what PCBSD does is that you
can toggle several options, so when you select an option, the kernel is
not loaded immediately after but you are still in the menu and can
select / toggle another option. That way you have a multi-selection,
e.g. select safe mode but enable acpi.
Maybe we could also add a menu entry to boot without any modules, so
loaders.conf gets overridden?
From: Andriy Gapon
Date: Tuesday, November 9, 2010 - 7:32 am

That sounds cool.  Like e.g. selecting verbose single-user boot completely from
the menu.
Good idea.

-- 
Andriy Gapon
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
From: C. P. Ghost
Date: Tuesday, November 9, 2010 - 3:58 pm

Wouldn't that be a POLA violation? Some admins may be used to the
current menu, and would be scratching head as what went wrong.
Maybe it would be better to keep the menu option, but make it
non-selectable and print next to it something like "(not available)"?

-cpghost.

-- 
Cordula's Web. http://www.cordula.ws/
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
From: Garrett Cooper
Date: Tuesday, November 9, 2010 - 4:45 pm

Yeah... seems like it would be; besides, I'm kind of used to
pressing numbers 4 and 6 when I have a boot menu :).
Thanks!
-Garrett
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
From: John Baldwin
Date: Wednesday, November 10, 2010 - 6:57 am

Hmmm, I'll see if I can leave the numbering unchanged but not list
the item perhaps.  Note that we already have the "alternate" numbering on
other platforms so the menu is already inconsistent across FreeBSD platforms.

-- 
John Baldwin
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
From: John Baldwin
Date: Wednesday, November 10, 2010 - 9:58 am

It turned out to be easier to leave a blank line to do this, but this patch
does that.  It leaves the numbers unchanged but simply omits the '2' option
if the system does not support ACPI.

--- //depot/projects/smpng/sys/boot/forth/beastie.4th	2010-11-08 21:53:18.000000000 0000
+++ //depot/user/jhb/ktrace/boot/forth/beastie.4th	2010-11-10 14:50:44.000000000 0000
@@ -140,12 +140,16 @@
 	fbsdbw-logo
 ;
 
-: acpienabled? ( -- flag )
+: acpipresent? ( -- flag )
 	s" hint.acpi.0.rsdp" getenv
 	dup -1 = if
 		drop false exit
 	then
 	2drop
+	true
+;
+
+: acpienabled? ( -- flag )
 	s" hint.acpi.0.disabled" getenv
 	dup -1 <> if
 		s" 0" compare 0<> if
@@ -180,11 +184,18 @@
 	printmenuitem ."  Boot FreeBSD [default]" bootkey !
 	s" arch-i386" environment? if
 		drop
-		printmenuitem ."  Boot FreeBSD with ACPI " bootacpikey !
-		acpienabled? if
-			." disabled"
+		acpipresent? if
+			printmenuitem ."  Boot FreeBSD with ACPI " bootacpikey !
+			acpienabled? if
+				." disabled"
+			else
+				." enabled"
+			then
 		else
-			." enabled"
+			menuidx @
+			1+ dup
+			menuidx !
+			-2 bootacpikey !
 		then
 	else
 		-2 bootacpikey !

-- 
John Baldwin
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
From: David Rhodus
Date: Wednesday, November 10, 2010 - 9:01 am

What are the chances the detection fails and one still needs to disable ACPI and can't because it's not showing as a option ?

Thanks,
David Rhodus

_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
From: Scott Long
Date: Wednesday, November 10, 2010 - 9:07 am

If the loader can't detect acpi, the kernel can't either.

Scott


_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
Previous thread: [head tinderbox] failure on sparc64/sun4v by FreeBSD Tinderbox on Monday, November 8, 2010 - 6:06 am. (1 message)

Next thread: kgdb and .ko files by Julian Elischer on Monday, November 8, 2010 - 5:34 pm. (2 messages)