Skip to content

Commit d149651

Browse files
committed
Merge remote-tracking branch 'op/main'
2 parents ce116d1 + 0a7b7ef commit d149651

File tree

72 files changed

+883
-402
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+883
-402
lines changed

include/kernel-6.6

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
LINUX_VERSION-6.6 = .58
2-
LINUX_KERNEL_HASH-6.6.58 = e7df81e588d70fab5ec3ec3bb04ac53d51f0860fc3b1ec45e0a4167a026899db
1+
LINUX_VERSION-6.6 = .59
2+
LINUX_KERNEL_HASH-6.6.59 = 23616808d8c08f12815ff898f4edb4c11397a2b2843d029ee62452d21833a76d

include/rootfs.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ define prepare_rootfs
8484
IPKG_POSTINST_PATH=./usr/lib/opkg/info/*.postinst; \
8585
fi; \
8686
for script in $$IPKG_POSTINST_PATH; do \
87-
IPKG_INSTROOT=$(1) $$(command -v bash) $$script; \
87+
PATH="$(TARGET_PATH_PKG)" IPKG_INSTROOT=$(1) $$(command -v bash) $$script; \
8888
ret=$$?; \
8989
if [ $$ret -ne 0 ]; then \
9090
echo "postinst script $$script has failed with exit code $$ret" >&2; \

package/boot/uboot-mediatek/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ define U-Boot/mt7981_rfb-nor
370370
BUILD_DEVICES:=mediatek_mt7981-rfb
371371
UBOOT_CONFIG:=mt7981_nor_rfb
372372
UBOOT_IMAGE:=u-boot.fip
373-
BL2_BOOTDEV:=spim-nand
373+
BL2_BOOTDEV:=nor
374374
BL2_SOC:=mt7981
375375
BL2_DDRTYPE:=ddr3
376376
DEPENDS:=+trusted-firmware-a-mt7981-nor-ddr3
@@ -844,7 +844,8 @@ UBOOT_TARGETS := \
844844
UBOOT_CUSTOMIZE_CONFIG := \
845845
--disable TOOLS_KWBIMAGE \
846846
--disable TOOLS_LIBCRYPTO \
847-
--disable TOOLS_MKEFICAPSULE
847+
--disable TOOLS_MKEFICAPSULE \
848+
--enable SERIAL_RX_BUFFER
848849

849850
ifdef CONFIG_TARGET_mediatek
850851
UBOOT_MAKE_FLAGS += $(UBOOT_IMAGE:.fip=.bin)
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
From 72b4ba8417d33516b8489bac3c90dbbbf781a3d2 Mon Sep 17 00:00:00 2001
2+
From: Weijie Gao <weijie.gao@mediatek.com>
3+
Date: Tue, 29 Oct 2024 17:47:10 +0800
4+
Subject: [PATCH 1/3] menu: fix the logic checking whether ESC key is pressed
5+
6+
It's observed that the bootmenu on a serial console sometimes
7+
incorrectly quitted with superfluous characters filled to command
8+
line input:
9+
10+
> *** U-Boot Boot Menu ***
11+
>
12+
> 1. Startup system (Default)
13+
> 2. Upgrade firmware
14+
> 3. Upgrade ATF BL2
15+
> 4. Upgrade ATF FIP
16+
> 5. Load image
17+
> 0. U-Boot console
18+
>
19+
>
20+
> Press UP/DOWN to move, ENTER to select, ESC to quit
21+
>MT7988> [B
22+
23+
Analysis shows it was caused by the wrong logic of bootmenu_loop:
24+
25+
At first the bootmenu_loop received the first ESC char correctly.
26+
27+
However, during the second call to bootmenu_loop, there's no data
28+
in the UART Rx FIFO. Due to the low baudrate, the second char of
29+
the down array key sequence hasn't be fully received.
30+
31+
But bootmenu_loop just did a mdelay(10), and then treated it as a
32+
single ESC key press event. It didn't even try tstc() again after
33+
the 10ms timeout.
34+
35+
This patch fixes this issue by letting bootmenu_loop check tstc()
36+
twice.
37+
38+
Tested-By: E Shattow <lucent@gmail.com>
39+
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
40+
---
41+
common/menu.c | 5 +++--
42+
1 file changed, 3 insertions(+), 2 deletions(-)
43+
44+
--- a/common/menu.c
45+
+++ b/common/menu.c
46+
@@ -525,14 +525,15 @@ enum bootmenu_key bootmenu_loop(struct b
47+
struct cli_ch_state *cch)
48+
{
49+
enum bootmenu_key key;
50+
- int c;
51+
+ int c, errchar = 0;
52+
53+
c = cli_ch_process(cch, 0);
54+
if (!c) {
55+
while (!c && !tstc()) {
56+
schedule();
57+
mdelay(10);
58+
- c = cli_ch_process(cch, -ETIMEDOUT);
59+
+ c = cli_ch_process(cch, errchar);
60+
+ errchar = -ETIMEDOUT;
61+
}
62+
if (!c) {
63+
c = getchar();
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
From f1cbdd3330f0055dfbff0ef7d86276c4cc3cff2a Mon Sep 17 00:00:00 2001
2+
From: Weijie Gao <weijie.gao@mediatek.com>
3+
Date: Tue, 29 Oct 2024 17:47:16 +0800
4+
Subject: [PATCH 2/3] menu: add support to check if menu needs to be reprinted
5+
6+
This patch adds a new callback named need_reprint for menu.
7+
The need_reprint will be called before printing the menu. If the
8+
callback exists and returns FALSE, menu printing will be canceled.
9+
10+
This is very useful if the menu was not changed. It can save time
11+
for serial-based menu to handle more input data.
12+
13+
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
14+
---
15+
boot/pxe_utils.c | 2 +-
16+
cmd/bootmenu.c | 2 +-
17+
cmd/eficonfig.c | 2 +-
18+
common/menu.c | 11 +++++++++++
19+
include/menu.h | 1 +
20+
5 files changed, 15 insertions(+), 3 deletions(-)
21+
22+
--- a/boot/pxe_utils.c
23+
+++ b/boot/pxe_utils.c
24+
@@ -1449,7 +1449,7 @@ static struct menu *pxe_menu_to_menu(str
25+
* Create a menu and add items for all the labels.
26+
*/
27+
m = menu_create(cfg->title, DIV_ROUND_UP(cfg->timeout, 10),
28+
- cfg->prompt, NULL, label_print, NULL, NULL);
29+
+ cfg->prompt, NULL, label_print, NULL, NULL, NULL);
30+
if (!m)
31+
return NULL;
32+
33+
--- a/cmd/bootmenu.c
34+
+++ b/cmd/bootmenu.c
35+
@@ -506,7 +506,7 @@ static enum bootmenu_ret bootmenu_show(i
36+
37+
menu = menu_create(NULL, bootmenu->delay, 1, menu_display_statusline,
38+
bootmenu_print_entry, bootmenu_choice_entry,
39+
- bootmenu);
40+
+ NULL, bootmenu);
41+
if (!menu) {
42+
bootmenu_destroy(bootmenu);
43+
return BOOTMENU_RET_FAIL;
44+
--- a/cmd/eficonfig.c
45+
+++ b/cmd/eficonfig.c
46+
@@ -443,7 +443,7 @@ efi_status_t eficonfig_process_common(st
47+
efi_menu->menu_desc = menu_desc;
48+
49+
menu = menu_create(NULL, 0, 1, display_statusline, item_data_print,
50+
- item_choice, efi_menu);
51+
+ item_choice, NULL, efi_menu);
52+
if (!menu)
53+
return EFI_INVALID_PARAMETER;
54+
55+
--- a/common/menu.c
56+
+++ b/common/menu.c
57+
@@ -43,6 +43,7 @@ struct menu {
58+
void (*display_statusline)(struct menu *);
59+
void (*item_data_print)(void *);
60+
char *(*item_choice)(void *);
61+
+ bool (*need_reprint)(void *);
62+
void *item_choice_data;
63+
struct list_head items;
64+
int item_cnt;
65+
@@ -117,6 +118,11 @@ static inline void *menu_item_destroy(st
66+
*/
67+
static inline void menu_display(struct menu *m)
68+
{
69+
+ if (m->need_reprint) {
70+
+ if (!m->need_reprint(m->item_choice_data))
71+
+ return;
72+
+ }
73+
+
74+
if (m->title) {
75+
puts(m->title);
76+
putc('\n');
77+
@@ -362,6 +368,9 @@ int menu_item_add(struct menu *m, char *
78+
* item. Returns a key string corresponding to the chosen item or NULL if
79+
* no item has been selected.
80+
*
81+
+ * need_reprint - If not NULL, will be called before printing the menu.
82+
+ * Returning FALSE means the menu does not need reprint.
83+
+ *
84+
* item_choice_data - Will be passed as the argument to the item_choice function
85+
*
86+
* Returns a pointer to the menu if successful, or NULL if there is
87+
@@ -371,6 +380,7 @@ struct menu *menu_create(char *title, in
88+
void (*display_statusline)(struct menu *),
89+
void (*item_data_print)(void *),
90+
char *(*item_choice)(void *),
91+
+ bool (*need_reprint)(void *),
92+
void *item_choice_data)
93+
{
94+
struct menu *m;
95+
@@ -386,6 +396,7 @@ struct menu *menu_create(char *title, in
96+
m->display_statusline = display_statusline;
97+
m->item_data_print = item_data_print;
98+
m->item_choice = item_choice;
99+
+ m->need_reprint = need_reprint;
100+
m->item_choice_data = item_choice_data;
101+
m->item_cnt = 0;
102+
103+
--- a/include/menu.h
104+
+++ b/include/menu.h
105+
@@ -13,6 +13,7 @@ struct menu *menu_create(char *title, in
106+
void (*display_statusline)(struct menu *),
107+
void (*item_data_print)(void *),
108+
char *(*item_choice)(void *),
109+
+ bool (*need_reprint)(void *),
110+
void *item_choice_data);
111+
int menu_default_set(struct menu *m, char *item_key);
112+
int menu_get_choice(struct menu *m, void **choice);
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
From 702752cfae954648d6133bdff19283343b3339ef Mon Sep 17 00:00:00 2001
2+
From: Weijie Gao <weijie.gao@mediatek.com>
3+
Date: Tue, 29 Oct 2024 17:47:22 +0800
4+
Subject: [PATCH 3/3] bootmenu: add reprint check
5+
6+
Record the last active menu item and check if it equals to the
7+
current selected item before reprint.
8+
9+
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
10+
---
11+
cmd/bootmenu.c | 16 +++++++++++++++-
12+
include/menu.h | 1 +
13+
2 files changed, 16 insertions(+), 1 deletion(-)
14+
15+
--- a/cmd/bootmenu.c
16+
+++ b/cmd/bootmenu.c
17+
@@ -103,11 +103,13 @@ static char *bootmenu_choice_entry(void
18+
19+
switch (key) {
20+
case BKEY_UP:
21+
+ menu->last_active = menu->active;
22+
if (menu->active > 0)
23+
--menu->active;
24+
/* no menu key selected, regenerate menu */
25+
return NULL;
26+
case BKEY_DOWN:
27+
+ menu->last_active = menu->active;
28+
if (menu->active < menu->count - 1)
29+
++menu->active;
30+
/* no menu key selected, regenerate menu */
31+
@@ -133,6 +135,17 @@ static char *bootmenu_choice_entry(void
32+
return NULL;
33+
}
34+
35+
+static bool bootmenu_need_reprint(void *data)
36+
+{
37+
+ struct bootmenu_data *menu = data;
38+
+ bool need_reprint;
39+
+
40+
+ need_reprint = menu->last_active != menu->active;
41+
+ menu->last_active = menu->active;
42+
+
43+
+ return need_reprint;
44+
+}
45+
+
46+
static void bootmenu_destroy(struct bootmenu_data *menu)
47+
{
48+
struct bootmenu_entry *iter = menu->first;
49+
@@ -332,6 +345,7 @@ static struct bootmenu_data *bootmenu_cr
50+
51+
menu->delay = delay;
52+
menu->active = 0;
53+
+ menu->last_active = -1;
54+
menu->first = NULL;
55+
56+
default_str = env_get("bootmenu_default");
57+
@@ -506,7 +520,7 @@ static enum bootmenu_ret bootmenu_show(i
58+
59+
menu = menu_create(NULL, bootmenu->delay, 1, menu_display_statusline,
60+
bootmenu_print_entry, bootmenu_choice_entry,
61+
- NULL, bootmenu);
62+
+ bootmenu_need_reprint, bootmenu);
63+
if (!menu) {
64+
bootmenu_destroy(bootmenu);
65+
return BOOTMENU_RET_FAIL;
66+
--- a/include/menu.h
67+
+++ b/include/menu.h
68+
@@ -40,6 +40,7 @@ int menu_show(int bootdelay);
69+
struct bootmenu_data {
70+
int delay; /* delay for autoboot */
71+
int active; /* active menu entry */
72+
+ int last_active; /* last active menu entry */
73+
int count; /* total count of menu entries */
74+
struct bootmenu_entry *first; /* first menu entry */
75+
};

0 commit comments

Comments
 (0)