-@@ -216,16 +264,17 @@ static char *bootmenu_choice_entry(void
- struct bootmenu_data *menu = data;
- struct bootmenu_entry *iter;
- enum bootmenu_key key = KEY_NONE;
-+ int choice = -1;
- int esc = 0;
- int i;
-
- while (1) {
- if (menu->delay >= 0) {
- /* Autoboot was not stopped */
-- bootmenu_autoboot_loop(menu, &key, &esc);
-+ bootmenu_autoboot_loop(menu, &key, &esc, &choice);
- } else {
- /* Some key was pressed, so autoboot was stopped */
-- bootmenu_loop(menu, &key, &esc);
-+ bootmenu_loop(menu, &key, &esc, &choice);
- }
-
- switch (key) {
-@@ -239,6 +288,12 @@ static char *bootmenu_choice_entry(void
- ++menu->active;
- /* no menu key selected, regenerate menu */
- return NULL;
-+ case KEY_CHOICE:
-+ menu->active = choice;
-+ if (!menu->last_choiced) {
-+ menu->last_choiced = true;
-+ return NULL;
-+ }
- case KEY_SELECT:
- iter = menu->first;
- for (i = 0; i < menu->active; ++i)
-@@ -294,6 +349,7 @@ static struct bootmenu_data *bootmenu_cr
- menu->delay = delay;
- menu->active = 0;
- menu->first = NULL;
-+ menu->last_choiced = false;
+--- a/include/menu.h
++++ b/include/menu.h
+@@ -40,6 +40,7 @@ struct bootmenu_data {
+ int active; /* active menu entry */
+ int count; /* total count of menu entries */
+ struct bootmenu_entry *first; /* first menu entry */
++ bool last_choiced;
+ };