# SPDX-FileCopyrightText: 2017 Stefano Babic <stefano.babic@swupdate.org>
#
# SPDX-License-Identifier: GPL-2.0-only

menu "Bootloader Interfaces"

config BOOTLOADER_NONE
	bool "Environment in RAM"
	default y
	help
	  This simulates the interface to a bootloader.
	  Bootloader environment is just maintained in RAM
	  and lost when SWUpdate exits.

config BOOTLOADER_EBG
	bool "EFI Boot Guard"
	depends on HAVE_LIBEBGENV
	help
	  Support for EFI Boot Guard
	  https://github.com/siemens/efibootguard

comment "EFI Boot Guard needs libebgenv and libz"
	depends on !HAVE_ZLIB || !HAVE_LIBEBGENV

config UBOOT
	bool "U-Boot"
	depends on HAVE_LIBUBOOTENV
	help
	  Support for U-Boot
	  https://www.denx.de/wiki/U-Boot

comment "U-Boot needs libubootenv"
	depends on !HAVE_LIBUBOOTENV

config UBOOT_FWENV
	string "U-Boot Environment Configuration file"
	depends on UBOOT
	default "/etc/fw_env.config"
	help
	  This is the file described in U-Boot documentation
	  in the tools directory. It tells where the U-Boot
	  environment is saved.

config UBOOT_DEFAULTENV
	string "U-Boot Initial Environment file"
	depends on UBOOT
	default "/etc/u-boot-initial-env"
	help
	  This is the file with the initial environment delivered
	  with the bootloader. It is used by SWUpdate if no environment
	  is found on the storage.

config BOOTLOADER_GRUB
	bool "GRUB"
	help
	  Support for GRUB
	  https://www.gnu.org/software/grub/

config GRUBENV_PATH
	string "GRUB Environment block file path"
	depends on BOOTLOADER_GRUB
	default "/boot/efi/EFI/BOOT/grub/grubenv"
	help
	  Provide path to GRUB environment block file

config BOOTLOADER_CBOOT
	bool "NVIDIA Tegra Cboot"
	depends on HAVE_LIBTEGRABOOT_TOOLS
	help
	  Support for NVIDIA's cboot used on some Tegra platform. Tegra
	  uses different bootloader, depending on the SOC and on the release
	  provided by vendor. Some SOCs (associated with some releases) are still
	  using U-Boot (Jetson Nano, TX, TX2), some of them are using Cboot (Xavier),
	  and some of them rely on UEFI. This adds support for cboot.

comment "Cboot needs libtegra-boot-tools"
	depends on !HAVE_LIBTEGRABOOT_TOOLS

endmenu

choice
	prompt "Default Bootloader Interface"
	help
	  Default bootloader interface to use if not explicitly
	  overridden via configuration or command-line option
	  at run-time.

config BOOTLOADER_DEFAULT_EBG
	bool "EBG"
	depends on BOOTLOADER_EBG
	help
	  Use EFI Boot Guard as default bootloader interface.
	  
	  Note: Make sure the environment modification shared
	  library https://github.com/siemens/efibootguard (including
	  dependencies) is installed on the target system.

config BOOTLOADER_DEFAULT_UBOOT
	bool "U-Boot"
	depends on UBOOT
	help
	  Use U-Boot as default bootloader interface.
	  
	  Note: Make sure the environment modification shared
	  library https://github.com/sbabic/libubootenv (including
	  dependencies) is installed on the target system.

config BOOTLOADER_DEFAULT_GRUB
	bool "GRUB"
	depends on BOOTLOADER_GRUB
	help
	  Use GRUB as default bootloader interface.

config BOOTLOADER_DEFAULT_CBOOT
	bool "Cboot"
	depends on BOOTLOADER_CBOOT
	help
	  Use NVIDIA Cboot as default bootloader interface.

config BOOTLOADER_DEFAULT_NONE
	bool "Environment in RAM"
	depends on BOOTLOADER_NONE
	help
	  Use Environment in RAM as default bootloader interface.

endchoice

config BOOTLOADER_STATIC_LINKED
	bool "Bootloader interface static linked"
	help
	  Link statically the interface to the bootloader. In case of distros,
	  more interfaces are available at the same time and SWUpdate checks
	  at runtime and loads the interface via dlopen(). This is available
	  with glibc and dlopen support. For other system, the interface can be linked
	  statically.


choice
	prompt "Update Status Storage"
	help
	  Place to persistently store the update
	  status for, e.g., communicating it to SWUpdate after
	  a reboot.

config UPDATE_STATE_CHOICE_BOOTLOADER
	bool "Bootloader"
	depends on BOOTLOADER_EBG || UBOOT || BOOTLOADER_NONE || BOOTLOADER_GRUB
	help
	  Store update status in Bootloader's environment.
	  Specify Bootloader environment variable name to store update status in.

endchoice

config UPDATE_STATE_BOOTLOADER
	string "Store Update Status in Bootloader Environment variable"
	default "ustate"
	depends on UPDATE_STATE_CHOICE_BOOTLOADER
	help
	  Store update information in Bootloader's environment.

