Changeset View
Standalone View
sys/boot/forth/menu.rc
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | |||||
set mainmenu_command[5]="cycle_kernel" | set mainmenu_command[5]="cycle_kernel" | ||||
set mainmenu_keycode[5]=107 | set mainmenu_keycode[5]=107 | ||||
set mainmenu_caption[6]="Configure Boot [O]ptions..." | set mainmenu_caption[6]="Configure Boot [O]ptions..." | ||||
set mainmenu_command[6]="2 goto_menu" | set mainmenu_command[6]="2 goto_menu" | ||||
set mainmenu_keycode[6]=111 | set mainmenu_keycode[6]=111 | ||||
set mainansi_caption[6]="Configure Boot ^[1mO^[mptions..." | set mainansi_caption[6]="Configure Boot ^[1mO^[mptions..." | ||||
set mainmenu_caption[7]="Select Boot [E]nvironment..." | |||||
set mainmenu_command[7]="3 goto_menu" | |||||
set mainmenu_keycode[7]=101 | |||||
set mainansi_caption[7]="Select Boot ^[1mE^[37mnvironment..." | |||||
\ | \ | ||||
\ BOOT OPTIONS MENU | \ BOOT OPTIONS MENU | ||||
\ | \ | ||||
set menuset_name2="options" | set menuset_name2="options" | ||||
set optionsmenu_caption[1]="Back to Main Menu [Backspace]" | set optionsmenu_caption[1]="Back to Main Menu [Backspace]" | ||||
set optionsmenu_command[1]="1 goto_menu" | set optionsmenu_command[1]="1 goto_menu" | ||||
Show All 34 Lines | |||||
set optionsmenu_init[6]="init_verbose" | set optionsmenu_init[6]="init_verbose" | ||||
set optionsmenu_caption[6]="[V]erbose..... off" | set optionsmenu_caption[6]="[V]erbose..... off" | ||||
set optionstoggled_text[6]="[V]erbose..... On" | set optionstoggled_text[6]="[V]erbose..... On" | ||||
set optionsmenu_command[6]="toggle_verbose" | set optionsmenu_command[6]="toggle_verbose" | ||||
set optionsmenu_keycode[6]=118 | set optionsmenu_keycode[6]=118 | ||||
set optionsansi_caption[6]="^[1mV^[merbose..... ^[34;1mOff^[m" | set optionsansi_caption[6]="^[1mV^[merbose..... ^[34;1mOff^[m" | ||||
set optionstoggled_ansi[6]="^[1mV^[merbose..... ^[32;7mOn^[m" | set optionstoggled_ansi[6]="^[1mV^[merbose..... ^[32;7mOn^[m" | ||||
\ | |||||
\ BOOT ENVIRONMENT MENU | |||||
\ | |||||
set menuset_name3="bootenv" | |||||
set bootenvmenu_caption[1]="Selected: " | |||||
set bootenvmenu_command[1]="1 goto_menu" | |||||
tsoome: There is actually another small issue, which has simple solution and a bit deeper implications.. | |||||
Done Inline ActionsI've been holding back a redesign that would address this. I was having issues finding sympathetic parties, such as yourself, that want to solve this issue like myself. Most commonly, say at conferences, I was getting push-back from other developers that were loath to see yet another redesign (not appreciating the technical merit behind such a redesign; specifically to address the stated issue of menu overflow leading to screen garbage). I got support from another interested party just moments ago (Shawn Webb; aka lattera) and am going to move forward with the redesign that I have envisaged over a year ago to address this issue. I'll post mock-ups in the next 48 hours. dteske: I've been holding back a redesign that would address this. I was having issues finding… | |||||
Done Inline ActionsI'm pushing the redesign out to the future (pre-11-R) where we can phab it up in an unrelated change. With respect to the menu redraw, I worked with Allan to fine-tune the be_draw_menu function. We removed menu-redraw from be_draw_menu because using be_draw_menu in conjunction with goto_menu would cause a double-redraw of the menu, wherein first it would erase the current contents, redraw the current contents, then erase the entire screen, redraw the screen, and finally draw the desired menu. By moving menu-redraw out of be_draw_menu (and subsequently adding menu-redraw to set_bootenv) we avoid the double-redraw with stale menu data. It's worth noting that at 9600 baud on a serial line, this double-redraw is "in your face" since it takes ~4.95s to draw the entire screen at said baudrate. dteske: I'm pushing the redesign out to the future (pre-11-R) where we can phab it up in an unrelated… | |||||
set bootenvmenu_keycode[1]=8 | |||||
set bootenvansi_caption[1]="^[1mSelected: ^[37m" | |||||
set bemenu_current="Selected: " | |||||
set beansi_current="^[1m${bemenu_current}^[37m" | |||||
: init_bootenv ( -- ) | |||||
s" set menu_caption[1]=${bemenu_current}${vfs.root.mountfrom}" evaluate | |||||
s" set ansi_caption[1]=${beansi_current}${vfs.root.mountfrom}" evaluate | |||||
; | |||||
set bootenvmenu_init="init_bootenv" | |||||
unset bootenvmenu_caption[1] | |||||
Done Inline ActionsCan we move this to menu-commands.4th please? dteske: Can we move this to menu-commands.4th please? | |||||
unset bootenvansi_caption[1] | |||||
: set_bootenv ( N -- N TRUE ) | |||||
dup s" set vfs.root.mountfrom=${bootenv_root[E]}" 38 +c! evaluate | |||||
s" set currdev=${vfs.root.mountfrom}:" evaluate | |||||
s" /boot/defaults/loader.conf" read-conf | |||||
s" /boot/loader.conf" read-conf | |||||
s" unload" evaluate | |||||
init_bootenv | |||||
clear \ Clear the screen (in screen.4th) | |||||
print_version \ print version string (bottom-right; see version.4th) | |||||
Done Inline ActionsCan we move this to menu-commands.4th please? dteske: Can we move this to menu-commands.4th please? | |||||
draw-beastie \ Draw FreeBSD logo at right (in beastie.4th) | |||||
draw-brand \ Draw brand.4th logo at top (in brand.4th) | |||||
menu-init \ Initialize menu and draw bounding box (in menu.4th) | |||||
menu-redraw \ Redraw menu (in menu.4th) | |||||
Done Inline Actionsyou have small issue there; reading in default and local loader.conf will also create new module list and therefore leak current list. I did solve this by creating simple "free-module-options" word, walking through the list and freeing all existing modules. tsoome: you have small issue there; reading in default and local loader.conf will also create new… | |||||
Done Inline ActionsCan you please submit to either allanjude or myself the patch to add free-module-options word? One of us will then update the review patch. dteske: Can you please submit to either allanjude or myself the patch to add free-module-options word? | |||||
Done Inline ActionsI have pulled in free-module-options from tsoome (thanks again). Minor changes to it since IllumOS extended the modules structure allanjude: I have pulled in free-module-options from tsoome (thanks again). Minor changes to it since… | |||||
TRUE | |||||
; | |||||
set bootenvmenu_caption[2]="[A]ctive: ${vfs.root.mountfrom}" | |||||
set bootenvansi_caption[2]="^[1mA^[37mctive: ${vfs.root.mountfrom}" | |||||
set bootenvmenu_keycode[2]=97 | |||||
set bootenvmenu_command[2]="set_bootenv" | |||||
set bootenv_root[2]="${zfs_be_active}" | |||||
set bootenvmenu_options=3 | |||||
set bootenvmenu_optionstext="Boot Environments:" | |||||
Done Inline ActionsCan we move this to menu-commands.4th please? dteske: Can we move this to menu-commands.4th please? | |||||
\ Enable automatic booting (add ``autoboot_delay=N'' to loader.conf(5) to | \ Enable automatic booting (add ``autoboot_delay=N'' to loader.conf(5) to | ||||
\ customize the timeout; default is 10-seconds) | \ customize the timeout; default is 10-seconds) | ||||
\ | \ | ||||
set menu_timeout_command="boot" | set menu_timeout_command="boot" | ||||
Done Inline ActionsChange "0 0 2swap" to instead "0 s>d 2swap" Reason: The stack input for >number is a double-wide number (the "d" in "ud1" stands for double, indicating that the two leading "cells", aka items, on the stack are a single double-precision number). By changing from "0 0 2swap" to instead "0 s>d 2swap" it is more clear that we are pushing a zero on the stack in the form of a double (HINT: s>d converts from single to double-precision; taking the stack from "0" to "0 0"). This is important for various architectures. dteske: Change "0 0 2swap" to instead "0 s>d 2swap"
Reason: The stack input for >number is a double… | |||||
Done Inline ActionsWhoops, stack comments here are wrong. I misspoke last night when I said >number takes 4 items on the stack as input. The initial stack element takes two cells (looks like two items) but is a double-precision value. Used as the "accumulator". I would change the stack comments from: to instead the following [accurate] description: Please note that it is standard parlance in my existing code to use var and var' (pronounced "var-prime") to indicate when the result on the stack after execution is NOT a new value, but a possibly modified form of the stack input. In other words, the return caddr is guaranteed to be within u count of the input caddr, making it more appropriate to call it "caddr-prime" as the >number process merely increments caddr in a loop until it hits the first bad character. If all characters in the string were valid, then the return caddr will be caddr+u and u' (pronounced "u-prime") will be zero. Note however, that u' may also be zero for a NULL string input. The same thing happens with the initial "u" input, it is decremented with each step of the internal >number loop until it reaches zero, and thus is a modified "u" or "u-prime" (standard mathematics terminology). dteske: Whoops, stack comments here are wrong. I misspoke last night when I said >number takes 4 items… | |||||
\ Include optional elements defined in a local file | \ Include optional elements defined in a local file | ||||
\ | \ | ||||
Done Inline ActionsWhoops, this is not the correct way to convert a double-precision integer to a single. We use um/mod for that. Replace this here "drop" with a routine to properly convert double-to-single: 1 um/mod ( ud u1 -- u2 u3 ) \ convert double ud' to single u3' and remainder `u2' dteske: Whoops, this is not the correct way to convert a double-precision integer to a single. We use… | |||||
try-include /boot/menu.rc.local | try-include /boot/menu.rc.local | ||||
\ Display the main menu (see `menu.4th') | \ Display the main menu (see `menu.4th') | ||||
set menuset_initial=1 | set menuset_initial=1 | ||||
menuset-loadinitial | menuset-loadinitial | ||||
menu-display | menu-display | ||||
Done Inline Actionsgoto_menu emits true to stack, so line 185 will result in ( -- N TRUE TRUE ) and thats bug. tsoome: goto_menu emits true to stack, so line 185 will result in ( -- N TRUE TRUE ) and thats bug. | |||||
Done Inline ActionsGood catch. I'll fix this when I update to include your free-module-options word dteske: Good catch. I'll fix this when I update to include your free-module-options word | |||||
Done Inline Actionsboth of these are fixed allanjude: both of these are fixed | |||||
Done Inline Actionshere you have ascii value for number N in stack (51 for '3'), so instead of hardwired 3, you can use instead: dup 48 - goto_menu this would remove the need for hardwired numeric constant. tsoome: here you have ascii value for number N in stack (51 for '3'), so instead of hardwired 3, you… | |||||
Done Inline ActionsThe N on the stack is ASCII decimal for selected menu item. The "3" that you see being passed to goto_menu must be the "3" in "menuset_name3=bootenv". If I changed this to use "dup 48 -" instead of "3", then it would always load the menu associated with "menuset_nameX" where X is the menu item chosen. Imagine the implications if the set_be_page word were used as the action for menu item 4. The goto_menu word would try to load the menu associated with menuset_name4. There is no such named-menuset. The existing hard-wired 3 is correct because we want to specifically (and always) load menuset_name3 which is the bootenv menu. dteske: The N on the stack is ASCII decimal for selected menu item. The "3" that you see being passed… | |||||
Done Inline Actionsoh right, I misunderstood the background there. thanks for explaining:) tsoome: oh right, I misunderstood the background there. thanks for explaining:) |
There is actually another small issue, which has simple solution and a bit deeper implications...
The problem is, zfs dataset names can be up to 256 symbols long (more or less), and with long names, the menu box itself will get corrupted; now returning to main menu, only box
contents will get redrawn and the garbage will remain.
for simple workaround, in illumos code I did create the following word:
: be_draw_screen
;
and to replace this simple "1 goto_menu" with:
: be_back_to_main
;
so at least the main screen will be cleaned up. In addition, Jeff did propose additional idea, unfortunately it would require more development and is out of scope of this change, but is something to think about: as for different menus there are menusets, the menuset concept could be extended not to involve just menu entries, but "box" itself as well - to define wider and perhaps with different offset box for submenu. for example, for content like BE names, we know we wont fit in width, so we could define also wider box for this set, overlay it on main view, and if needed, apply additional method to "cut" excessive information. overlay covering (partially) logos and such is okay, as going back to main menu would redraw the screen.