diff options
author | Avik Sil <aviksil@linux.vnet.ibm.com> | 2014-03-05 16:51:31 +0530 |
---|---|---|
committer | Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> | 2014-06-13 12:33:54 +0530 |
commit | 6180178869e65de2d666609d1b9a050e20d09edc (patch) | |
tree | 9ad66d083142bf4d138405a0dd6e53173a93e0ed /slof | |
parent | f1c40e50b5f58c28eae6949a8ee0525ed7da959a (diff) | |
download | SLOF-6180178869e65de2d666609d1b9a050e20d09edc.zip SLOF-6180178869e65de2d666609d1b9a050e20d09edc.tar.gz SLOF-6180178869e65de2d666609d1b9a050e20d09edc.tar.bz2 |
Add boot menu support
This patch adds boot menu support to SLOF. When boot menu is enabled from qemu
commandline with '-boot menu=on', on pressing F12 key it displays the list of
devices to boot from and waits for user's input. This is in line with x86 qemu
bios feature.
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Diffstat (limited to 'slof')
-rw-r--r-- | slof/fs/start-up.fs | 93 |
1 files changed, 86 insertions, 7 deletions
diff --git a/slof/fs/start-up.fs b/slof/fs/start-up.fs index 0ce0f3c..f1488fa 100644 --- a/slof/fs/start-up.fs +++ b/slof/fs/start-up.fs @@ -44,7 +44,7 @@ key CASE 4f OF (function-key) ENDOF 5b OF - key key drop (function-key) ENDOF + key key (function-key) ENDOF dup OF 0 ENDOF ENDCASE THEN @@ -68,18 +68,97 @@ \ Watchdog will be rearmed during load if use-load-watchdog variable is TRUE TRUE VALUE use-load-watchdog? +1 value my-boot-dev +1 value digit-val +0 value boot-dev-no + +: boot-selected + 1 to my-boot-dev + BEGIN parse-word dup WHILE + boot-dev-no my-boot-dev = IF + s" boot " 2swap $cat + ['] evaluate catch ?dup IF \ and execute it + ." boot attempt returned: " + abort"-str @ count type cr + throw + THEN + 0 0 load-list 2! + UNLOOP EXIT + ELSE + 2drop + THEN + my-boot-dev 1 + to my-boot-dev + REPEAT 2drop 0 0 load-list 2! + + (boot) +; + +: boot-start + \ Remove multiple F12 key presses if any + BEGIN key? WHILE + key drop + REPEAT + + decimal + BEGIN parse-word dup WHILE + my-boot-dev (u.) s" . " $cat type 2dup type ." : " de-alias type cr + my-boot-dev 1 + to my-boot-dev + REPEAT 2drop 0 0 load-list 2! + + cr BEGIN KEY dup emit + dup isdigit IF + dup 30 - to digit-val + boot-dev-no a * digit-val + to boot-dev-no + THEN + d = UNTIL + + boot-dev-no my-boot-dev < IF + s" boot-selected " s" $bootdev" evaluate $cat strdup evaluate + ELSE + ." Invalid choice!" cr + THEN + hex +; + +: boot-menu-start + ." Select boot device:" cr cr + s" boot-start " s" $bootdev" evaluate $cat strdup evaluate +; + +: boot-menu-enabled? ( -- true|false ) + s" qemu,boot-menu" get-chosen IF + decode-int 1 = IF + 2drop TRUE EXIT + THEN + 2drop + THEN + FALSE +; + +: f12-pressed? + 34 = >r 32 = r> and IF + TRUE + ELSE + FALSE + THEN +; : start-it ( -- ) key? IF key CASE [char] s OF (s-pressed) ENDOF 1b OF - - (esc-sequence) CASE - 1 OF console-clean-fifo sms-start (boot) ENDOF - dup OF (boot?) ENDOF - ENDCASE - + (esc-sequence) CASE + 1 OF + console-clean-fifo + f12-pressed? boot-menu-enabled? and IF + boot-menu-start + ELSE + (boot?) + THEN + ENDOF + dup OF (boot?) ENDOF + ENDCASE ENDOF dup OF (boot?) ENDOF ENDCASE |