[openwrt/openwrt] uboot-mediatek: update to 2022.07 release

LEDE Commits lede-commits at lists.infradead.org
Mon Jul 11 09:13:41 PDT 2022


dangole pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/fa75a3a935b26378630498ba7d3f6a0b5b11f86e

commit fa75a3a935b26378630498ba7d3f6a0b5b11f86e
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Mon Jul 11 11:02:49 2022 +0100

    uboot-mediatek: update to 2022.07 release
    
    Add patch to fix host-build of the mkimage tool without
    CONFIG_TOOLS_LIBCRYPTO.
    Update and refresh all patches.
    
    Tested on BananaPi R64 (MT7622) successfully booting from SD card,
    eMMC and SPI-NAND.
    
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 package/boot/uboot-mediatek/Makefile               |   4 +-
 ...evert-clk-Add-debugging-for-return-values.patch |   4 +-
 ...-add-support-for-MediaTek-SPI-NAND-flash-.patch |   6 +-
 ...16-env-add-support-for-generic-MTD-device.patch |  10 +-
 ...-mt7622-enable-environment-for-mt7622_rfb.patch |   2 +-
 .../uboot-mediatek/patches/110-no-kwbimage.patch   |   2 +-
 .../patches/120-use-xz-instead-of-lzma.patch       |   2 +-
 .../patches/130-fix-mkimage-host-build.patch       |  24 +++
 .../patches/200-cmd-add-imsz-and-imszb.patch       |   6 +-
 ...nu-add-ability-to-select-item-by-shortkey.patch | 228 ++++++++++++---------
 .../patches/211-cmd-bootmenu-custom-title.patch    |  31 +--
 .../patches/220-cmd-env-readmem.patch              |   8 +-
 .../patches/230-cmd-add-pstore-check.patch         |   6 +-
 ...-name-of-FIT-configuration-in-chosen-node.patch |  11 +-
 .../350-add-support-for-Winbond-W25Q512JV.patch    |   2 +-
 .../patches/400-update-bpir2-defconfig.patch       |   7 +-
 .../patches/401-update-u7623-defconfig.patch       |   2 +-
 .../patches/410-add-linksys-e8450.patch            |   2 +-
 .../patches/412-add-ubnt-unifi-6-lr.patch          |  12 +-
 19 files changed, 207 insertions(+), 162 deletions(-)

diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile
index defae03028..aeaf8bc14b 100644
--- a/package/boot/uboot-mediatek/Makefile
+++ b/package/boot/uboot-mediatek/Makefile
@@ -1,8 +1,8 @@
 include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 
-PKG_VERSION:=2022.01
-PKG_HASH:=81b4543227db228c03f8a1bf5ddbc813b0bb8f6555ce46064ef721a6fc680413
+PKG_VERSION:=2022.07
+PKG_HASH:=92b08eb49c24da14c1adbf70a71ae8f37cc53eeb4230e859ad8b6733d13dcf5e
 PKG_BUILD_DEPENDS:=arm-trusted-firmware-tools/host
 
 include $(INCLUDE_DIR)/u-boot.mk
diff --git a/package/boot/uboot-mediatek/patches/000-mtk-01-Revert-clk-Add-debugging-for-return-values.patch b/package/boot/uboot-mediatek/patches/000-mtk-01-Revert-clk-Add-debugging-for-return-values.patch
index 1a0c1ce5b4..3b68c52713 100644
--- a/package/boot/uboot-mediatek/patches/000-mtk-01-Revert-clk-Add-debugging-for-return-values.patch
+++ b/package/boot/uboot-mediatek/patches/000-mtk-01-Revert-clk-Add-debugging-for-return-values.patch
@@ -46,7 +46,7 @@ This reverts commit 5c5992cb90cf9ca4d51e38d9a95a13c293904df5.
  	}
  
  
-@@ -501,7 +500,6 @@ int clk_free(struct clk *clk)
+@@ -469,7 +468,6 @@ void clk_free(struct clk *clk)
  ulong clk_get_rate(struct clk *clk)
  {
  	const struct clk_ops *ops;
@@ -54,7 +54,7 @@ This reverts commit 5c5992cb90cf9ca4d51e38d9a95a13c293904df5.
  
  	debug("%s(clk=%p)\n", __func__, clk);
  	if (!clk_valid(clk))
-@@ -511,11 +509,7 @@ ulong clk_get_rate(struct clk *clk)
+@@ -479,11 +477,7 @@ ulong clk_get_rate(struct clk *clk)
  	if (!ops->get_rate)
  		return -ENOSYS;
  
diff --git a/package/boot/uboot-mediatek/patches/000-mtk-14-drivers-mtd-add-support-for-MediaTek-SPI-NAND-flash-.patch b/package/boot/uboot-mediatek/patches/000-mtk-14-drivers-mtd-add-support-for-MediaTek-SPI-NAND-flash-.patch
index dead0db174..1caa7ffd24 100644
--- a/package/boot/uboot-mediatek/patches/000-mtk-14-drivers-mtd-add-support-for-MediaTek-SPI-NAND-flash-.patch
+++ b/package/boot/uboot-mediatek/patches/000-mtk-14-drivers-mtd-add-support-for-MediaTek-SPI-NAND-flash-.patch
@@ -38,9 +38,9 @@ Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
 
 --- a/drivers/mtd/Kconfig
 +++ b/drivers/mtd/Kconfig
-@@ -116,6 +116,8 @@ config STM32_FLASH
- 	 This is the driver of embedded flash for some STMicroelectronics
- 	 STM32 MCU.
+@@ -158,6 +158,8 @@ config SYS_MAX_FLASH_BANKS_DETECT
+ 	 to reduce the effective number of flash bank, between 0 and
+ 	 CONFIG_SYS_MAX_FLASH_BANKS
  
 +source "drivers/mtd/mtk-snand/Kconfig"
 +
diff --git a/package/boot/uboot-mediatek/patches/000-mtk-16-env-add-support-for-generic-MTD-device.patch b/package/boot/uboot-mediatek/patches/000-mtk-16-env-add-support-for-generic-MTD-device.patch
index d4f3460614..f2e91671fb 100644
--- a/package/boot/uboot-mediatek/patches/000-mtk-16-env-add-support-for-generic-MTD-device.patch
+++ b/package/boot/uboot-mediatek/patches/000-mtk-16-env-add-support-for-generic-MTD-device.patch
@@ -38,7 +38,7 @@ Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
  
 --- a/env/Kconfig
 +++ b/env/Kconfig
-@@ -19,7 +19,7 @@ config ENV_IS_NOWHERE
+@@ -37,7 +37,7 @@ config ENV_IS_NOWHERE
  		     !ENV_IS_IN_MMC && !ENV_IS_IN_NAND && \
  		     !ENV_IS_IN_NVRAM && !ENV_IS_IN_ONENAND && \
  		     !ENV_IS_IN_REMOTE && !ENV_IS_IN_SPI_FLASH && \
@@ -47,7 +47,7 @@ Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
  	help
  	  Define this if you don't want to or can't have an environment stored
  	  on a storage medium. In this case the environment will still exist
-@@ -208,6 +208,27 @@ config ENV_IS_IN_MMC
+@@ -226,6 +226,27 @@ config ENV_IS_IN_MMC
  	  This value is also in units of bytes, but must also be aligned to
  	  an MMC sector boundary.
  
@@ -75,7 +75,7 @@ Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
  config ENV_IS_IN_NAND
  	bool "Environment in a NAND device"
  	depends on !CHAIN_OF_TRUST
-@@ -535,10 +556,16 @@ config ENV_ADDR_REDUND
+@@ -531,10 +552,16 @@ config ENV_ADDR_REDUND
  	  Offset from the start of the device (or partition) of the redundant
  	  environment location.
  
@@ -92,8 +92,8 @@ Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
 +		    ENV_IS_IN_SPI_FLASH || ENV_IS_IN_MTD
  	default 0x3f8000 if ARCH_ROCKCHIP && ENV_IS_IN_MMC
  	default 0x140000 if ARCH_ROCKCHIP && ENV_IS_IN_SPI_FLASH
- 	default 0x88000 if ARCH_SUNXI
-@@ -583,6 +610,12 @@ config ENV_SECT_SIZE
+ 	default 0xF0000 if ARCH_SUNXI
+@@ -581,6 +608,12 @@ config ENV_SECT_SIZE
  	help
  	  Size of the sector containing the environment.
  
diff --git a/package/boot/uboot-mediatek/patches/000-mtk-20-configs-mt7622-enable-environment-for-mt7622_rfb.patch b/package/boot/uboot-mediatek/patches/000-mtk-20-configs-mt7622-enable-environment-for-mt7622_rfb.patch
index c66451dce9..cc5fb57324 100644
--- a/package/boot/uboot-mediatek/patches/000-mtk-20-configs-mt7622-enable-environment-for-mt7622_rfb.patch
+++ b/package/boot/uboot-mediatek/patches/000-mtk-20-configs-mt7622-enable-environment-for-mt7622_rfb.patch
@@ -20,7 +20,7 @@ Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
 +CONFIG_ENV_OFFSET=0x280000
  CONFIG_DEBUG_UART_BASE=0x11002000
  CONFIG_DEBUG_UART_CLOCK=25000000
- CONFIG_DEBUG_UART=y
+ CONFIG_SYS_LOAD_ADDR=0x4007ff28
 @@ -22,6 +24,9 @@ CONFIG_CMD_SF_TEST=y
  CONFIG_CMD_PING=y
  CONFIG_CMD_SMC=y
diff --git a/package/boot/uboot-mediatek/patches/110-no-kwbimage.patch b/package/boot/uboot-mediatek/patches/110-no-kwbimage.patch
index 65d14f5bec..6d4af1f174 100644
--- a/package/boot/uboot-mediatek/patches/110-no-kwbimage.patch
+++ b/package/boot/uboot-mediatek/patches/110-no-kwbimage.patch
@@ -1,6 +1,6 @@
 --- a/tools/Makefile
 +++ b/tools/Makefile
-@@ -119,7 +119,6 @@ dumpimage-mkimage-objs := aisimage.o \
+@@ -120,7 +120,6 @@ dumpimage-mkimage-objs := aisimage.o \
  			imximage.o \
  			imx8image.o \
  			imx8mimage.o \
diff --git a/package/boot/uboot-mediatek/patches/120-use-xz-instead-of-lzma.patch b/package/boot/uboot-mediatek/patches/120-use-xz-instead-of-lzma.patch
index c13871b71a..7204c404c0 100644
--- a/package/boot/uboot-mediatek/patches/120-use-xz-instead-of-lzma.patch
+++ b/package/boot/uboot-mediatek/patches/120-use-xz-instead-of-lzma.patch
@@ -1,6 +1,6 @@
 --- a/Makefile
 +++ b/Makefile
-@@ -1045,7 +1045,7 @@ quiet_cmd_pad_cat = CAT     $@
+@@ -1061,7 +1061,7 @@ quiet_cmd_pad_cat = CAT     $@
  cmd_pad_cat = $(cmd_objcopy) && $(append) || { rm -f $@; false; }
  
  quiet_cmd_lzma = LZMA    $@
diff --git a/package/boot/uboot-mediatek/patches/130-fix-mkimage-host-build.patch b/package/boot/uboot-mediatek/patches/130-fix-mkimage-host-build.patch
new file mode 100644
index 0000000000..8b110a880f
--- /dev/null
+++ b/package/boot/uboot-mediatek/patches/130-fix-mkimage-host-build.patch
@@ -0,0 +1,24 @@
+--- a/tools/image-host.c
++++ b/tools/image-host.c
+@@ -1122,6 +1122,7 @@ static int fit_config_add_verification_d
+  * 2) get public key (X509_get_pubkey)
+  * 3) provide der format (d2i_RSAPublicKey)
+  */
++#ifdef CONFIG_TOOLS_LIBCRYPTO
+ static int read_pub_key(const char *keydir, const void *name,
+ 			unsigned char **pubkey, int *pubkey_len)
+ {
+@@ -1175,6 +1176,13 @@ err_cert:
+ 	fclose(f);
+ 	return ret;
+ }
++#else
++static int read_pub_key(const char *keydir, const void *name,
++			unsigned char **pubkey, int *pubkey_len)
++{
++	return -ENOSYS;
++}
++#endif
+ 
+ int fit_pre_load_data(const char *keydir, void *keydest, void *fit)
+ {
diff --git a/package/boot/uboot-mediatek/patches/200-cmd-add-imsz-and-imszb.patch b/package/boot/uboot-mediatek/patches/200-cmd-add-imsz-and-imszb.patch
index 5dce177cfa..1759b04899 100644
--- a/package/boot/uboot-mediatek/patches/200-cmd-add-imsz-and-imszb.patch
+++ b/package/boot/uboot-mediatek/patches/200-cmd-add-imsz-and-imszb.patch
@@ -1,6 +1,6 @@
 --- a/cmd/bootm.c
 +++ b/cmd/bootm.c
-@@ -228,6 +228,65 @@ U_BOOT_CMD(
+@@ -257,6 +257,65 @@ U_BOOT_CMD(
  /* iminfo - print header info for a requested image */
  /*******************************************************************/
  #if defined(CONFIG_CMD_IMI)
@@ -68,7 +68,7 @@
  {
 --- a/boot/image-fit.c
 +++ b/boot/image-fit.c
-@@ -1993,6 +1993,51 @@ static const char *fit_get_image_type_pr
+@@ -1995,6 +1995,51 @@ static const char *fit_get_image_type_pr
  	return "unknown";
  }
  
@@ -122,7 +122,7 @@
  		   int arch, int image_type, int bootstage_id,
 --- a/include/image.h
 +++ b/include/image.h
-@@ -952,6 +952,7 @@ int fit_parse_subimage(const char *spec,
+@@ -955,6 +955,7 @@ int fit_parse_subimage(const char *spec,
  		ulong *addr, const char **image_name);
  
  int fit_get_subimage_count(const void *fit, int images_noffset);
diff --git a/package/boot/uboot-mediatek/patches/210-cmd-bootmenu-add-ability-to-select-item-by-shortkey.patch b/package/boot/uboot-mediatek/patches/210-cmd-bootmenu-add-ability-to-select-item-by-shortkey.patch
index c43b542dcb..b7d064062c 100644
--- a/package/boot/uboot-mediatek/patches/210-cmd-bootmenu-add-ability-to-select-item-by-shortkey.patch
+++ b/package/boot/uboot-mediatek/patches/210-cmd-bootmenu-add-ability-to-select-item-by-shortkey.patch
@@ -12,7 +12,7 @@ Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
 
 --- a/cmd/bootmenu.c
 +++ b/cmd/bootmenu.c
-@@ -11,6 +11,7 @@
+@@ -14,6 +14,7 @@
  #include <menu.h>
  #include <watchdog.h>
  #include <malloc.h>
@@ -20,28 +20,94 @@ Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
  #include <linux/delay.h>
  #include <linux/string.h>
  
-@@ -38,6 +39,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;
- };
+@@ -87,16 +88,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;
  
- enum bootmenu_key {
-@@ -46,8 +48,27 @@ enum bootmenu_key {
- 	KEY_DOWN,
- 	KEY_SELECT,
- 	KEY_QUIT,
-+	KEY_CHOICE,
- };
+ 	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);
+ 		}
  
-+static const char choice_chars[] = {
-+	'1', '2', '3', '4', '5', '6', '7', '8', '9',
-+	'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
-+	'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
-+	'u', 'v', 'w', 'x', 'y', 'z'
-+};
+ 		switch (key) {
+@@ -110,6 +112,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)
+@@ -181,12 +189,19 @@ static int prepare_bootmenu_entry(struct
+ 		if (!entry)
+ 			return -ENOMEM;
+ 
+-		entry->title = strndup(option, sep - option);
++		entry->title = malloc((sep - option) + 4);
+ 		if (!entry->title) {
+ 			free(entry);
+ 			return -ENOMEM;
+ 		}
+ 
++		if (i < ARRAY_SIZE(choice_chars)) {
++			sprintf(entry->title, "%c. %.*s", choice_chars[i],
++				(int)(sep - option), option);
++		} else {
++			sprintf(entry->title, "   %.*s", (int)(sep - option), option);
++		}
 +
+ 		entry->command = strdup(sep + 1);
+ 		if (!entry->command) {
+ 			free(entry->title);
+@@ -331,6 +346,7 @@ static struct bootmenu_data *bootmenu_cr
+ 	menu->delay = delay;
+ 	menu->active = 0;
+ 	menu->first = NULL;
++	menu->last_choiced = false;
+ 
+ 	default_str = env_get("bootmenu_default");
+ 	if (default_str)
+@@ -356,9 +372,9 @@ static struct bootmenu_data *bootmenu_cr
+ 
+ 		/* Add Quit entry if entering U-Boot console is disabled */
+ 		if (!IS_ENABLED(CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE))
+-			entry->title = strdup("U-Boot console");
++			entry->title = strdup("0. U-Boot console");
+ 		else
+-			entry->title = strdup("Quit");
++			entry->title = strdup("0. Quit");
+ 
+ 		if (!entry->title) {
+ 			free(entry);
+--- a/common/menu.c
++++ b/common/menu.c
+@@ -9,6 +9,7 @@
+ #include <cli.h>
+ #include <malloc.h>
+ #include <errno.h>
++#include <linux/ctype.h>
+ #include <linux/delay.h>
+ #include <linux/list.h>
+ #include <watchdog.h>
+@@ -47,6 +48,17 @@ struct menu {
+ 	int item_cnt;
+ };
+ 
 +static int find_choice(char choice)
 +{
 +	int i;
@@ -53,19 +119,19 @@ Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
 +	return -1;
 +}
 +
- static char *bootmenu_getoption(unsigned short int n)
- {
- 	char name[MAX_ENV_SIZE];
-@@ -82,7 +103,7 @@ static void bootmenu_print_entry(void *d
+ /*
+  * An iterator function for menu items. callback will be called for each item
+  * in m, with m, a pointer to the item, and extra being passed to callback. If
+@@ -426,7 +445,7 @@ int menu_destroy(struct menu *m)
  }
  
- static void bootmenu_autoboot_loop(struct bootmenu_data *menu,
--				enum bootmenu_key *key, int *esc)
-+				enum bootmenu_key *key, int *esc, int *choice)
+ void bootmenu_autoboot_loop(struct bootmenu_data *menu,
+-			    enum bootmenu_key *key, int *esc)
++			    enum bootmenu_key *key, int *esc, int *choice)
  {
  	int i, c;
  
-@@ -115,6 +136,19 @@ static void bootmenu_autoboot_loop(struc
+@@ -456,6 +475,19 @@ void bootmenu_autoboot_loop(struct bootm
  				break;
  			default:
  				*key = KEY_NONE;
@@ -85,12 +151,12 @@ Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
  				break;
  			}
  
-@@ -136,10 +170,16 @@ static void bootmenu_autoboot_loop(struc
+@@ -475,10 +507,16 @@ void bootmenu_autoboot_loop(struct bootm
  }
  
- static void bootmenu_loop(struct bootmenu_data *menu,
--		enum bootmenu_key *key, int *esc)
-+		enum bootmenu_key *key, int *esc, int *choice)
+ void bootmenu_loop(struct bootmenu_data *menu,
+-		   enum bootmenu_key *key, int *esc)
++		   enum bootmenu_key *key, int *esc, int *choice)
  {
  	int c;
  
@@ -103,7 +169,7 @@ Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
  	if (*esc == 1) {
  		if (tstc()) {
  			c = getchar();
-@@ -165,6 +205,14 @@ static void bootmenu_loop(struct bootmen
+@@ -504,6 +542,14 @@ void bootmenu_loop(struct bootmenu_data
  		if (c == '\e') {
  			*esc = 1;
  			*key = KEY_NONE;
@@ -118,75 +184,35 @@ Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
  		}
  		break;
  	case 1:
-@@ -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;
+ };
  
- 	default_str = env_get("bootmenu_default");
- 	if (default_str)
-@@ -311,12 +367,19 @@ static struct bootmenu_data *bootmenu_cr
- 			goto cleanup;
+ enum bootmenu_key {
+@@ -48,11 +49,19 @@ enum bootmenu_key {
+ 	KEY_DOWN,
+ 	KEY_SELECT,
+ 	KEY_QUIT,
++	KEY_CHOICE,
+ };
  
- 		len = sep-option;
--		entry->title = malloc(len + 1);
-+		entry->title = malloc(len + 4);
- 		if (!entry->title) {
- 			free(entry);
- 			goto cleanup;
- 		}
--		memcpy(entry->title, option, len);
+ void bootmenu_autoboot_loop(struct bootmenu_data *menu,
+-			    enum bootmenu_key *key, int *esc);
++			    enum bootmenu_key *key, int *esc, int *choice);
+ void bootmenu_loop(struct bootmenu_data *menu,
+-		   enum bootmenu_key *key, int *esc);
++		   enum bootmenu_key *key, int *esc, int *choice);
 +
-+		if (i < ARRAY_SIZE(choice_chars)) {
-+			len = sprintf(entry->title, "%c. %.*s", choice_chars[i],
-+				      len, option);
-+		} else {
-+			len = sprintf(entry->title, "   %.*s", len, option);
-+		}
-+
- 		entry->title[len] = 0;
- 
- 		len = strlen(sep + 1);
-@@ -353,7 +416,7 @@ static struct bootmenu_data *bootmenu_cr
- 		if (!entry)
- 			goto cleanup;
++static const char choice_chars[] = {
++	'1', '2', '3', '4', '5', '6', '7', '8', '9',
++	'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
++	'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
++	'u', 'v', 'w', 'x', 'y', 'z'
++};
  
--		entry->title = strdup("U-Boot console");
-+		entry->title = strdup("0. U-Boot console");
- 		if (!entry->title) {
- 			free(entry);
- 			goto cleanup;
+ #endif /* __MENU_H__ */
diff --git a/package/boot/uboot-mediatek/patches/211-cmd-bootmenu-custom-title.patch b/package/boot/uboot-mediatek/patches/211-cmd-bootmenu-custom-title.patch
index 3f98f13c6e..4f6464d8cb 100644
--- a/package/boot/uboot-mediatek/patches/211-cmd-bootmenu-custom-title.patch
+++ b/package/boot/uboot-mediatek/patches/211-cmd-bootmenu-custom-title.patch
@@ -1,19 +1,10 @@
 --- a/cmd/bootmenu.c
 +++ b/cmd/bootmenu.c
-@@ -39,6 +39,7 @@ struct bootmenu_data {
- 	int active;			/* active menu entry */
- 	int count;			/* total count of menu entries */
- 	struct bootmenu_entry *first;	/* first menu entry */
-+	char *mtitle;			/* custom menu title */
- 	bool last_choiced;
- };
- 
-@@ -471,7 +472,12 @@ static void menu_display_statusline(stru
+@@ -432,7 +432,11 @@ static void menu_display_statusline(stru
  	printf(ANSI_CURSOR_POSITION, 1, 1);
  	puts(ANSI_CLEAR_LINE);
- 	printf(ANSI_CURSOR_POSITION, 2, 1);
--	puts("  *** U-Boot Boot Menu ***");
-+
+ 	printf(ANSI_CURSOR_POSITION, 2, 3);
+-	puts("*** U-Boot Boot Menu ***");
 +	if (menu->mtitle)
 +		puts(menu->mtitle);
 +	else
@@ -22,11 +13,21 @@
  	puts(ANSI_CLEAR_LINE_TO_END);
  	printf(ANSI_CURSOR_POSITION, 3, 1);
  	puts(ANSI_CLEAR_LINE);
-@@ -525,6 +531,7 @@ static void bootmenu_show(int delay)
- 		return;
+@@ -517,6 +521,7 @@ static enum bootmenu_ret bootmenu_show(i
+ 		return BOOTMENU_RET_FAIL;
  	}
  
 +	bootmenu->mtitle = env_get("bootmenu_title");
  	for (iter = bootmenu->first; iter; iter = iter->next) {
- 		if (!menu_item_add(menu, iter->key, iter))
+ 		if (menu_item_add(menu, iter->key, iter) != 1)
  			goto cleanup;
+--- 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 */
++	char *mtitle;			/* custom menu title */
+ 	bool last_choiced;
+ };
+ 
diff --git a/package/boot/uboot-mediatek/patches/220-cmd-env-readmem.patch b/package/boot/uboot-mediatek/patches/220-cmd-env-readmem.patch
index f7f2021652..544767e2fa 100644
--- a/package/boot/uboot-mediatek/patches/220-cmd-env-readmem.patch
+++ b/package/boot/uboot-mediatek/patches/220-cmd-env-readmem.patch
@@ -1,6 +1,6 @@
 --- a/cmd/Kconfig
 +++ b/cmd/Kconfig
-@@ -483,6 +483,12 @@ config CMD_ENV_EXISTS
+@@ -540,6 +540,12 @@ config CMD_ENV_EXISTS
  	  Check if a variable is defined in the environment for use in
  	  shell scripting.
  
@@ -76,7 +76,7 @@
  #if defined(CONFIG_CMD_ENV_CALLBACK)
  static int print_static_binding(const char *var_name, const char *callback_name,
  				void *priv)
-@@ -1189,6 +1243,9 @@ static struct cmd_tbl cmd_env_sub[] = {
+@@ -1231,6 +1285,9 @@ static struct cmd_tbl cmd_env_sub[] = {
  	U_BOOT_CMD_MKENT(load, 1, 0, do_env_load, "", ""),
  #endif
  	U_BOOT_CMD_MKENT(print, CONFIG_SYS_MAXARGS, 1, do_env_print, "", ""),
@@ -86,7 +86,7 @@
  #if defined(CONFIG_CMD_RUN)
  	U_BOOT_CMD_MKENT(run, CONFIG_SYS_MAXARGS, 1, do_run, "", ""),
  #endif
-@@ -1277,6 +1334,9 @@ static char env_help_text[] =
+@@ -1322,6 +1379,9 @@ static char env_help_text[] =
  #if defined(CONFIG_CMD_NVEDIT_EFI)
  	"env print -e [-guid guid] [-n] [name ...] - print UEFI environment\n"
  #endif
@@ -96,7 +96,7 @@
  #if defined(CONFIG_CMD_RUN)
  	"env run var [...] - run commands in an environment variable\n"
  #endif
-@@ -1386,6 +1446,17 @@ U_BOOT_CMD(
+@@ -1431,6 +1491,17 @@ U_BOOT_CMD(
  );
  #endif
  
diff --git a/package/boot/uboot-mediatek/patches/230-cmd-add-pstore-check.patch b/package/boot/uboot-mediatek/patches/230-cmd-add-pstore-check.patch
index 587245d2ab..d0abcb1acc 100644
--- a/package/boot/uboot-mediatek/patches/230-cmd-add-pstore-check.patch
+++ b/package/boot/uboot-mediatek/patches/230-cmd-add-pstore-check.patch
@@ -1,6 +1,6 @@
 --- a/cmd/pstore.c
 +++ b/cmd/pstore.c
-@@ -207,6 +207,58 @@ static int pstore_set(struct cmd_tbl *cm
+@@ -208,6 +208,58 @@ static int pstore_set(struct cmd_tbl *cm
  }
  
  /**
@@ -59,7 +59,7 @@
   * pstore_print_buffer() - Print buffer
   * @type: buffer type
   * @buffer: buffer to print
-@@ -458,6 +510,7 @@ static int pstore_save(struct cmd_tbl *c
+@@ -459,6 +511,7 @@ static int pstore_save(struct cmd_tbl *c
  
  static struct cmd_tbl cmd_pstore_sub[] = {
  	U_BOOT_CMD_MKENT(set, 8, 0, pstore_set, "", ""),
@@ -67,7 +67,7 @@
  	U_BOOT_CMD_MKENT(display, 3, 0, pstore_display, "", ""),
  	U_BOOT_CMD_MKENT(save, 4, 0, pstore_save, "", ""),
  };
-@@ -531,6 +584,8 @@ U_BOOT_CMD(pstore, 10, 0, do_pstore,
+@@ -560,6 +613,8 @@ U_BOOT_CMD(pstore, 10, 0, do_pstore,
  	   "  'pmsg-size' is the size of the user space logs record.\n"
  	   "  'ecc-size' enables/disables ECC support and specifies ECC buffer size in\n"
  	   "  bytes (0 disables it, 1 is a special value, means 16 bytes ECC).\n"
diff --git a/package/boot/uboot-mediatek/patches/280-image-fdt-save-name-of-FIT-configuration-in-chosen-node.patch b/package/boot/uboot-mediatek/patches/280-image-fdt-save-name-of-FIT-configuration-in-chosen-node.patch
index 8517ffb97c..ff41c52422 100644
--- a/package/boot/uboot-mediatek/patches/280-image-fdt-save-name-of-FIT-configuration-in-chosen-node.patch
+++ b/package/boot/uboot-mediatek/patches/280-image-fdt-save-name-of-FIT-configuration-in-chosen-node.patch
@@ -14,13 +14,11 @@ Reviewed-by: Tom Rini <trini at konsulko.com>
  boot/image-fdt.c | 6 ++++++
  1 file changed, 6 insertions(+)
 
-diff --git a/boot/image-fdt.c b/boot/image-fdt.c
-index 692a9ad3e4..fdb69926a2 100644
 --- a/boot/image-fdt.c
 +++ b/boot/image-fdt.c
-@@ -601,6 +601,12 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
- 		goto err;
- 	}
+@@ -639,6 +639,12 @@ int image_setup_libfdt(bootm_headers_t *
+ 					images->fit_uname_cfg,
+ 					strlen(images->fit_uname_cfg) + 1, 1);
  
 +	/* Store name of configuration node as u-boot,bootconf in /chosen node */
 +	if (images->fit_uname_cfg)
@@ -31,6 +29,3 @@ index 692a9ad3e4..fdb69926a2 100644
  	/* Update ethernet nodes */
  	fdt_fixup_ethernet(blob);
  #if CONFIG_IS_ENABLED(CMD_PSTORE)
--- 
-2.35.3
-
diff --git a/package/boot/uboot-mediatek/patches/350-add-support-for-Winbond-W25Q512JV.patch b/package/boot/uboot-mediatek/patches/350-add-support-for-Winbond-W25Q512JV.patch
index 50df49d823..da746bb124 100644
--- a/package/boot/uboot-mediatek/patches/350-add-support-for-Winbond-W25Q512JV.patch
+++ b/package/boot/uboot-mediatek/patches/350-add-support-for-Winbond-W25Q512JV.patch
@@ -1,6 +1,6 @@
 --- a/drivers/mtd/spi/spi-nor-ids.c
 +++ b/drivers/mtd/spi/spi-nor-ids.c
-@@ -369,6 +369,8 @@ const struct flash_info spi_nor_ids[] =
+@@ -376,6 +376,8 @@ const struct flash_info spi_nor_ids[] =
  			SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
  	},
  	{ INFO("w25q256", 0xef4019, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
diff --git a/package/boot/uboot-mediatek/patches/400-update-bpir2-defconfig.patch b/package/boot/uboot-mediatek/patches/400-update-bpir2-defconfig.patch
index 01a550b301..3e13427de4 100644
--- a/package/boot/uboot-mediatek/patches/400-update-bpir2-defconfig.patch
+++ b/package/boot/uboot-mediatek/patches/400-update-bpir2-defconfig.patch
@@ -7,12 +7,11 @@
 -CONFIG_ENV_SIZE=0x1000
 +CONFIG_ENV_SIZE=0x10000
  CONFIG_ENV_OFFSET=0x100000
--CONFIG_DEFAULT_DEVICE_TREE="mt7623n-bananapi-bpi-r2"
- CONFIG_TARGET_MT7623=y
-+CONFIG_DEFAULT_DEVICE_TREE="mt7623n-bananapi-bpi-r2"
+ CONFIG_DEFAULT_DEVICE_TREE="mt7623n-bananapi-bpi-r2"
 +CONFIG_USE_DEFAULT_ENV_FILE=y
- CONFIG_DISTRO_DEFAULTS=y
+ CONFIG_TARGET_MT7623=y
  CONFIG_SYS_LOAD_ADDR=0x84000000
+ CONFIG_DISTRO_DEFAULTS=y
  CONFIG_FIT=y
 -CONFIG_FIT_VERBOSE=y
 +CONFIG_FIT_ENABLE_SHA256_SUPPORT=y
diff --git a/package/boot/uboot-mediatek/patches/401-update-u7623-defconfig.patch b/package/boot/uboot-mediatek/patches/401-update-u7623-defconfig.patch
index ac870b8614..f79c86714d 100644
--- a/package/boot/uboot-mediatek/patches/401-update-u7623-defconfig.patch
+++ b/package/boot/uboot-mediatek/patches/401-update-u7623-defconfig.patch
@@ -10,8 +10,8 @@
  CONFIG_DEFAULT_DEVICE_TREE="mt7623a-unielec-u7623-02-emmc"
 +CONFIG_USE_DEFAULT_ENV_FILE=y
  CONFIG_TARGET_MT7623=y
- CONFIG_DISTRO_DEFAULTS=y
  CONFIG_SYS_LOAD_ADDR=0x84000000
+ CONFIG_DISTRO_DEFAULTS=y
  CONFIG_FIT=y
 -CONFIG_FIT_VERBOSE=y
 +CONFIG_FIT_ENABLE_SHA256_SUPPORT=y
diff --git a/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch b/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch
index fde679f386..c4a51aa442 100644
--- a/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch
+++ b/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch
@@ -337,7 +337,7 @@
 +};
 --- a/arch/arm/dts/Makefile
 +++ b/arch/arm/dts/Makefile
-@@ -1133,6 +1133,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
+@@ -1203,6 +1203,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
  	mt7622-rfb.dtb \
  	mt7623a-unielec-u7623-02-emmc.dtb \
  	mt7622-bananapi-bpi-r64.dtb \
diff --git a/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch b/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch
index 09a727422a..bb7045916f 100644
--- a/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch
+++ b/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch
@@ -349,7 +349,7 @@
 +};
 --- a/arch/arm/dts/Makefile
 +++ b/arch/arm/dts/Makefile
-@@ -1134,6 +1134,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
+@@ -1204,6 +1204,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
  	mt7623a-unielec-u7623-02-emmc.dtb \
  	mt7622-bananapi-bpi-r64.dtb \
  	mt7622-linksys-e8450-ubi.dtb \
@@ -412,15 +412,15 @@
 +_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title       $ver"
 --- a/common/board_r.c
 +++ b/common/board_r.c
-@@ -78,6 +78,7 @@
- #ifdef CONFIG_EFI_SETUP_EARLY
+@@ -62,6 +62,7 @@
+ #include <asm-generic/gpio.h>
  #include <efi_loader.h>
- #endif
+ #include <relocate.h>
 +#include <spi_flash.h>
  
  DECLARE_GLOBAL_DATA_PTR;
  
-@@ -417,6 +418,21 @@ static int initr_onenand(void)
+@@ -392,6 +393,21 @@ static int initr_onenand(void)
  }
  #endif
  
@@ -442,7 +442,7 @@
  #ifdef CONFIG_MMC
  static int initr_mmc(void)
  {
-@@ -705,6 +721,9 @@ static init_fnc_t init_sequence_r[] = {
+@@ -703,6 +719,9 @@ static init_fnc_t init_sequence_r[] = {
  #ifdef CONFIG_CMD_ONENAND
  	initr_onenand,
  #endif




More information about the lede-commits mailing list