[PATCH v5 00/17] enable menu-driven boot device selection

Masahisa Kojima masahisa.kojima at linaro.org
Thu Apr 28 10:09:33 CEST 2022


This patch series adds the menu-driven boot device selection,
by extending the existing "bootmenu" to include UEFI and distro_boot
related entries, and supports menu-driven UEFI boot variable
maintenance.

This patch series also includes the removable media support
that UEFI specification requires to support.

The menu example is as follows.

  *** U-Boot Boot Menu ***

     bootmenu_00   : Boot 1. kernel
     bootmenu_01   : Boot 2. kernel
     bootmenu_02   : Reset board
     UEFI BOOT0000 : debian
     UEFI BOOT0001 : ubuntu
     UEFI BOOT0002 : mmc0:1
     UEFI BOOT0003 : mmc0:2
     UEFI BOOT0004 : nvme0:1
     UEFI BOOT0005 : nvme0:2
     UEFI BOOT0006 : usb0:2
     UEFI BOOT0007 : usb1:1
     UEFI BOOT0008 : usb1:2
     distro_boot   : usb0
     distro_boot   : scsi0
     distro_boot   : virtio0
     distro_boot   : dhcp

  Press UP/DOWN to move, ENTER to select, ESC/CTRL+C to quit

[How to run on QEMU(arm64)]
1) clone source code
 $ git clone https://git.linaro.org/people/masahisa.kojima/u-boot.git \
-b kojima/bootmenu_v5_upstream_0428 --depth 1

2) prepare U-Boot .config
 $ make qemu_arm64_menuconfig
  then, enable CONFIG_CMD_BOOTMENU and CONFIG_AUTOBOOT_MENU_SHOW

3) run on QEMU(arm64) example
 $ qemu-system-aarch64 -machine virt,gic-version=3 -cpu cortex-a57 -m 4G -nographic \
   -no-acpi -bios ./u-boot.bin -hda xxx.img

[Major Changes]
- rebased to v2022.07-rc1
- there is detailed changelog in each commit

AKASHI Takahiro (2):
  efi_loader: export efi_locate_device_handle()
  efi_loader: bootmgr: add booting from removable media

Masahisa Kojima (15):
  lib/charset: add u16_strlcat() function
  test: unit test for u16_strlcat()
  menu: always show the menu regardless of the number of entry
  menu: menu_get_choice() return -ENOENT if menu item is empty
  bootmenu: flush input buffer before waiting user key input
  bootmenu: update bootmenu_entry structure
  bootmenu: add UEFI boot entry into bootmenu
  bootmenu: add distro boot entry
  bootmenu: add Kconfig option not to enter U-Boot console
  bootmenu: factor out the user input handling
  efi_loader: menu-driven addition of UEFI boot option
  efi_loader: menu-driven deletion of UEFI boot variable
  efi_loader: menu-driven update of UEFI bootorder variable
  bootmenu: add removable media entries
  doc:bootmenu: add UEFI boot and distro boot support description

 cmd/Kconfig                               |   10 +
 cmd/bootmenu.c                            |  807 +++++++++----
 common/menu.c                             |  142 ++-
 doc/usage/cmd/bootmenu.rst                |   78 +-
 include/charset.h                         |   17 +
 include/config_distro_bootcmd.h           |   14 +-
 include/efi_default_filename.h            |   33 +
 include/efi_loader.h                      |   61 +
 include/menu.h                            |   20 +
 lib/charset.c                             |   22 +
 lib/efi_loader/Makefile                   |    1 +
 lib/efi_loader/efi_bootmenu_maintenance.c | 1245 +++++++++++++++++++++
 lib/efi_loader/efi_bootmgr.c              |   50 +-
 lib/efi_loader/efi_boottime.c             |   59 +-
 lib/efi_loader/efi_console.c              |   81 ++
 lib/efi_loader/efi_disk.c                 |   11 +
 lib/efi_loader/efi_file.c                 |   75 +-
 test/unicode_ut.c                         |   50 +
 18 files changed, 2518 insertions(+), 258 deletions(-)
 create mode 100644 include/efi_default_filename.h
 create mode 100644 lib/efi_loader/efi_bootmenu_maintenance.c

-- 
2.17.1



More information about the U-Boot mailing list