[openfirmware] [commit] r2010 - cpu/x86/pc/olpc/via ofw/gui
repository service
svn at openfirmware.info
Fri Nov 5 02:44:09 CET 2010
Author: quozl
Date: Fri Nov 5 02:44:07 2010
New Revision: 2010
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2010
Log:
OLPC XO-1.5 - dual boot secure operating system choice menu
Enable the operating system choice menu for machines that are booted
with security enabled. Reduce the menu where no choice is available.
* ofw/gui/iconmenu.fth: create a variant of menu which does not
establish a new return stack state.
* cpu/x86/pc/olpc/via/fw.bth: fix to restore the logo after menu and
before freezing display, show operating system choice menu before
secure startup.
* cpu/x86/pc/olpc/via/chooseos.fth: add test for whether both
alternate MBRs are present.
* cpu/x86/pc/olpc/via/bootmenu.fth: remove maintenance icon, rewrite
to choose operating system and return from menu, show an empty menu if
no choice is available.
Modified:
cpu/x86/pc/olpc/via/bootmenu.fth
cpu/x86/pc/olpc/via/chooseos.fth
cpu/x86/pc/olpc/via/fw-version.fth
cpu/x86/pc/olpc/via/fw.bth
ofw/gui/iconmenu.fth
Modified: cpu/x86/pc/olpc/via/bootmenu.fth
==============================================================================
--- cpu/x86/pc/olpc/via/bootmenu.fth Thu Nov 4 23:13:40 2010 (r2009)
+++ cpu/x86/pc/olpc/via/bootmenu.fth Fri Nov 5 02:44:07 2010 (r2010)
@@ -1,32 +1,49 @@
-icon: tux.icon rom:\tux.565
-icon: windows.icon rom:\winlogo.565
-icon: maintenance.icon rom:\settings.565
-
-: boot-linux-item restore-scroller ." Booting Linux" cr " 0 choose-os boot" eval wait-return ;
-: boot-windows-item restore-scroller ." Booting Windows" cr " 1 choose-os boot" eval wait-return ;
-: maintenance-item ['] full-menu nest-menu ;
+icon: tux.icon rom:tux.565
+icon: windows.icon rom:winlogo.565
+
+: choose-linux-item
+ restore-scroller ." Choosing Linux" cr
+ 0 " choose-os" eval
+ menu-done
+;
+
+: choose-windows-item
+ restore-scroller ." Choosing Windows" cr
+ 1 " choose-os" eval
+ menu-done
+;
: boot-menu ( -- )
d# 1 to rows
- d# 2 to cols
d# 3 to cols
-\ d# 308 to sq-size
-\ d# 256 to image-size
-\ d# 256 to icon-size
clear-menu
- " Boot Linux/Sugar"
- ['] boot-linux-item tux.icon 0 0 selected install-icon
+ " Linux/Sugar"
+ ['] choose-linux-item tux.icon 0 0 selected install-icon
+
+ " Microsoft Windows"
+ ['] choose-windows-item windows.icon 0 1 install-icon
- " Boot Microsoft Windows"
- ['] boot-windows-item windows.icon 0 1 install-icon
+ " Continue"
+ ['] quit-item play.icon 0 2 install-icon
+;
+
+: no-boot-menu ( -- )
+ d# 1 to rows
+ d# 1 to cols
+
+ clear-menu
- " Maintenance Functions"
- ['] maintenance-item maintenance.icon 0 2 install-icon
+ " No operating system choice installed"
+ ['] quit-item quit.icon 0 0 selected install-icon
;
: bootmenu
- ['] boot-menu to root-menu
- menu
+ " choice-present?" eval if
+ ['] boot-menu to root-menu
+ else
+ ['] no-boot-menu to root-menu
+ then
+ (menu)
;
Modified: cpu/x86/pc/olpc/via/chooseos.fth
==============================================================================
--- cpu/x86/pc/olpc/via/chooseos.fth Thu Nov 4 23:13:40 2010 (r2009)
+++ cpu/x86/pc/olpc/via/chooseos.fth Fri Nov 5 02:44:07 2010 (r2010)
@@ -29,22 +29,49 @@
#switched " read-blocks" mbr-ih $call-method ( nread )
#switched <> abort" Read failed"
;
+
: put-sectors ( adr sector# -- )
#switched " write-blocks" mbr-ih $call-method ( nread )
#switched <> abort" Write failed"
;
+
+: open-mbr
+ " int:0" open-dev dup 0= abort" Can't open internal storage" ( ihandle )
+ to mbr-ih
+;
+
+: get-desired-mbr ( n -- )
+ desired-mbr swap #switched * saved-mbrs-base + get-sectors
+;
+
+: is-desired-mbr? ( -- is-mbr? )
+ desired-mbr /mbr is-mbr?
+;
+
+: close-mbr
+ mbr-ih close-dev
+;
+
+: choice-present? ( -- present? )
+ open-mbr
+ 0 get-desired-mbr is-desired-mbr?
+ 1 get-desired-mbr is-desired-mbr?
+ and
+ close-mbr
+;
+
: choose-os ( n -- )
- " int:0" open-dev dup to mbr-ih 0= abort" Can't open internal storage" ( n )
+ open-mbr
current-mbr 0 get-sectors ( )
- desired-mbr swap #switched * saved-mbrs-base + get-sectors
- desired-mbr /mbr is-mbr? 0= if
- mbr-ih close-dev
+ get-desired-mbr
+ is-desired-mbr? 0= if
+ close-mbr
true abort" The chosen MBR is invalid" cr
then
current-mbr desired-mbr /mbr comp if
desired-mbr 0 put-sectors
then
- mbr-ih close-dev
+ close-mbr
;
\ LICENSE_BEGIN
Modified: cpu/x86/pc/olpc/via/fw-version.fth
==============================================================================
--- cpu/x86/pc/olpc/via/fw-version.fth Thu Nov 4 23:13:40 2010 (r2009)
+++ cpu/x86/pc/olpc/via/fw-version.fth Fri Nov 5 02:44:07 2010 (r2010)
@@ -1,3 +1,3 @@
\ The overall firmware revision
macro: FW_MAJOR A
-macro: FW_MINOR 59
+macro: FW_MINOR 59a
Modified: cpu/x86/pc/olpc/via/fw.bth
==============================================================================
--- cpu/x86/pc/olpc/via/fw.bth Thu Nov 4 23:13:40 2010 (r2009)
+++ cpu/x86/pc/olpc/via/fw.bth Fri Nov 5 02:44:07 2010 (r2010)
@@ -648,7 +648,7 @@
: ?boot-menu ( -- )
rocker-down game-key? if
- protect-fw visible bootmenu invisible show-child
+ protect-fw visible bootmenu show-child invisible
then
;
@@ -708,14 +708,13 @@
?scan-nand
[then]
?fs-update
+ ?boot-menu
factory-test? 0= if secure-startup then
unblock-exceptions
['] (interrupt-auto-boot?) to interrupt-auto-boot?
?usb-keyboard
auto-banner? if banner then
- ?boot-menu
-
auto-boot
frozen? text-on? 0= and ( no-banner? )
Modified: ofw/gui/iconmenu.fth
==============================================================================
--- ofw/gui/iconmenu.fth Thu Nov 4 23:13:40 2010 (r2009)
+++ ofw/gui/iconmenu.fth Fri Nov 5 02:44:07 2010 (r2010)
@@ -504,13 +504,7 @@
2r> to current-sq set-menu refresh
;
-\ Note that menu establishes a new return stack state. Be sure to
-\ clear any installed handler chain and establish a new base catch frame.
-
-: menu ( -- ) recursive
- rp0 @ rp!
- 0 handler !
- ['] menu to user-interface
+: (menu) ( -- )
setup-menu
['] root-menu ['] nest-menu catch drop
@@ -519,8 +513,20 @@
0 0 ( color x y )
screen-wh ( color x y w y )
fill-rectangle-noff ( )
-
+
restore-scroller
+;
+
+\ Note that menu establishes a new return stack state. Be sure to
+\ clear any installed handler chain and establish a new base catch frame.
+
+: menu ( -- ) recursive
+ rp0 @ rp!
+ 0 handler !
+ ['] menu to user-interface
+
+ (menu)
+
.menu
['] quit to user-interface
quit
More information about the openfirmware
mailing list