Skip to content

Commit 20cd584

Browse files
committed
Merge tag 'efi-2022-07-rc3-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request for efi-2022-07-rc3-2 UEFI: * Fix build errors due to - using sed with non-standard extension for regular expression - target architecture not recognized for CROSS_COMPILE=armv7a-* - CONFIG_EVENT not selected * add sha384/512 on certificate revocation Others: * factor out the user input handling in bootmenu command
2 parents 258a579 + 4b49477 commit 20cd584

File tree

14 files changed

+388
-171
lines changed

14 files changed

+388
-171
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ include include/host_arch.h
2121
ifeq ("", "$(CROSS_COMPILE)")
2222
MK_ARCH="${shell uname -m}"
2323
else
24-
MK_ARCH="${shell echo $(CROSS_COMPILE) | sed -n 's/^\s*\([^\/]*\/\)*\([^-]*\)-\S*/\2/p'}"
24+
MK_ARCH="${shell echo $(CROSS_COMPILE) | sed -n 's/^[[:space:]]*\([^\/]*\/\)*\([^-]*\)-[^[:space:]]*/\2/p'}"
2525
endif
2626
unexport HOST_ARCH
2727
ifeq ("x86_64", $(MK_ARCH))
@@ -30,7 +30,7 @@ else ifneq (,$(findstring $(MK_ARCH), "i386" "i486" "i586" "i686"))
3030
export HOST_ARCH=$(HOST_ARCH_X86)
3131
else ifneq (,$(findstring $(MK_ARCH), "aarch64" "armv8l"))
3232
export HOST_ARCH=$(HOST_ARCH_AARCH64)
33-
else ifneq (,$(findstring $(MK_ARCH), "arm" "armv7" "armv7l"))
33+
else ifneq (,$(findstring $(MK_ARCH), "arm" "armv7" "armv7a" "armv7l"))
3434
export HOST_ARCH=$(HOST_ARCH_ARM)
3535
else ifeq ("riscv32", $(MK_ARCH))
3636
export HOST_ARCH=$(HOST_ARCH_RISCV32)

cmd/bootmenu.c

Lines changed: 0 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,6 @@ struct bootmenu_entry {
5151
struct bootmenu_entry *next; /* next menu entry (num+1) */
5252
};
5353

54-
struct bootmenu_data {
55-
int delay; /* delay for autoboot */
56-
int active; /* active menu entry */
57-
int count; /* total count of menu entries */
58-
struct bootmenu_entry *first; /* first menu entry */
59-
};
60-
61-
enum bootmenu_key {
62-
KEY_NONE = 0,
63-
KEY_UP,
64-
KEY_DOWN,
65-
KEY_SELECT,
66-
KEY_QUIT,
67-
};
68-
6954
static char *bootmenu_getoption(unsigned short int n)
7055
{
7156
char name[MAX_ENV_SIZE];
@@ -97,132 +82,6 @@ static void bootmenu_print_entry(void *data)
9782
puts(ANSI_COLOR_RESET);
9883
}
9984

100-
static void bootmenu_autoboot_loop(struct bootmenu_data *menu,
101-
enum bootmenu_key *key, int *esc)
102-
{
103-
int i, c;
104-
105-
while (menu->delay > 0) {
106-
printf(ANSI_CURSOR_POSITION, menu->count + 5, 3);
107-
printf("Hit any key to stop autoboot: %d ", menu->delay);
108-
for (i = 0; i < 100; ++i) {
109-
if (!tstc()) {
110-
WATCHDOG_RESET();
111-
mdelay(10);
112-
continue;
113-
}
114-
115-
menu->delay = -1;
116-
c = getchar();
117-
118-
switch (c) {
119-
case '\e':
120-
*esc = 1;
121-
*key = KEY_NONE;
122-
break;
123-
case '\r':
124-
*key = KEY_SELECT;
125-
break;
126-
case 0x3: /* ^C */
127-
*key = KEY_QUIT;
128-
break;
129-
default:
130-
*key = KEY_NONE;
131-
break;
132-
}
133-
134-
break;
135-
}
136-
137-
if (menu->delay < 0)
138-
break;
139-
140-
--menu->delay;
141-
}
142-
143-
printf(ANSI_CURSOR_POSITION, menu->count + 5, 1);
144-
puts(ANSI_CLEAR_LINE);
145-
146-
if (menu->delay == 0)
147-
*key = KEY_SELECT;
148-
}
149-
150-
static void bootmenu_loop(struct bootmenu_data *menu,
151-
enum bootmenu_key *key, int *esc)
152-
{
153-
int c;
154-
155-
if (*esc == 1) {
156-
if (tstc()) {
157-
c = getchar();
158-
} else {
159-
WATCHDOG_RESET();
160-
mdelay(10);
161-
if (tstc())
162-
c = getchar();
163-
else
164-
c = '\e';
165-
}
166-
} else {
167-
while (!tstc()) {
168-
WATCHDOG_RESET();
169-
mdelay(10);
170-
}
171-
c = getchar();
172-
}
173-
174-
switch (*esc) {
175-
case 0:
176-
/* First char of ANSI escape sequence '\e' */
177-
if (c == '\e') {
178-
*esc = 1;
179-
*key = KEY_NONE;
180-
}
181-
break;
182-
case 1:
183-
/* Second char of ANSI '[' */
184-
if (c == '[') {
185-
*esc = 2;
186-
*key = KEY_NONE;
187-
} else {
188-
/* Alone ESC key was pressed */
189-
*key = KEY_QUIT;
190-
*esc = (c == '\e') ? 1 : 0;
191-
}
192-
break;
193-
case 2:
194-
case 3:
195-
/* Third char of ANSI (number '1') - optional */
196-
if (*esc == 2 && c == '1') {
197-
*esc = 3;
198-
*key = KEY_NONE;
199-
break;
200-
}
201-
202-
*esc = 0;
203-
204-
/* ANSI 'A' - key up was pressed */
205-
if (c == 'A')
206-
*key = KEY_UP;
207-
/* ANSI 'B' - key down was pressed */
208-
else if (c == 'B')
209-
*key = KEY_DOWN;
210-
/* other key was pressed */
211-
else
212-
*key = KEY_NONE;
213-
214-
break;
215-
}
216-
217-
/* enter key was pressed */
218-
if (c == '\r')
219-
*key = KEY_SELECT;
220-
221-
/* ^C was pressed */
222-
if (c == 0x3)
223-
*key = KEY_QUIT;
224-
}
225-
22685
static char *bootmenu_choice_entry(void *data)
22786
{
22887
struct bootmenu_data *menu = data;

common/menu.c

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
55
*/
66

7+
#include <ansi.h>
78
#include <common.h>
89
#include <cli.h>
910
#include <malloc.h>
1011
#include <errno.h>
12+
#include <linux/delay.h>
1113
#include <linux/list.h>
14+
#include <watchdog.h>
1215

1316
#include "menu.h"
1417

@@ -421,3 +424,128 @@ int menu_destroy(struct menu *m)
421424

422425
return 1;
423426
}
427+
428+
void bootmenu_autoboot_loop(struct bootmenu_data *menu,
429+
enum bootmenu_key *key, int *esc)
430+
{
431+
int i, c;
432+
433+
while (menu->delay > 0) {
434+
printf(ANSI_CURSOR_POSITION, menu->count + 5, 3);
435+
printf("Hit any key to stop autoboot: %d ", menu->delay);
436+
for (i = 0; i < 100; ++i) {
437+
if (!tstc()) {
438+
WATCHDOG_RESET();
439+
mdelay(10);
440+
continue;
441+
}
442+
443+
menu->delay = -1;
444+
c = getchar();
445+
446+
switch (c) {
447+
case '\e':
448+
*esc = 1;
449+
*key = KEY_NONE;
450+
break;
451+
case '\r':
452+
*key = KEY_SELECT;
453+
break;
454+
case 0x3: /* ^C */
455+
*key = KEY_QUIT;
456+
break;
457+
default:
458+
*key = KEY_NONE;
459+
break;
460+
}
461+
462+
break;
463+
}
464+
465+
if (menu->delay < 0)
466+
break;
467+
468+
--menu->delay;
469+
}
470+
471+
printf(ANSI_CURSOR_POSITION ANSI_CLEAR_LINE, menu->count + 5, 1);
472+
473+
if (menu->delay == 0)
474+
*key = KEY_SELECT;
475+
}
476+
477+
void bootmenu_loop(struct bootmenu_data *menu,
478+
enum bootmenu_key *key, int *esc)
479+
{
480+
int c;
481+
482+
if (*esc == 1) {
483+
if (tstc()) {
484+
c = getchar();
485+
} else {
486+
WATCHDOG_RESET();
487+
mdelay(10);
488+
if (tstc())
489+
c = getchar();
490+
else
491+
c = '\e';
492+
}
493+
} else {
494+
while (!tstc()) {
495+
WATCHDOG_RESET();
496+
mdelay(10);
497+
}
498+
c = getchar();
499+
}
500+
501+
switch (*esc) {
502+
case 0:
503+
/* First char of ANSI escape sequence '\e' */
504+
if (c == '\e') {
505+
*esc = 1;
506+
*key = KEY_NONE;
507+
}
508+
break;
509+
case 1:
510+
/* Second char of ANSI '[' */
511+
if (c == '[') {
512+
*esc = 2;
513+
*key = KEY_NONE;
514+
} else {
515+
/* Alone ESC key was pressed */
516+
*key = KEY_QUIT;
517+
*esc = (c == '\e') ? 1 : 0;
518+
}
519+
break;
520+
case 2:
521+
case 3:
522+
/* Third char of ANSI (number '1') - optional */
523+
if (*esc == 2 && c == '1') {
524+
*esc = 3;
525+
*key = KEY_NONE;
526+
break;
527+
}
528+
529+
*esc = 0;
530+
531+
/* ANSI 'A' - key up was pressed */
532+
if (c == 'A')
533+
*key = KEY_UP;
534+
/* ANSI 'B' - key down was pressed */
535+
else if (c == 'B')
536+
*key = KEY_DOWN;
537+
/* other key was pressed */
538+
else
539+
*key = KEY_NONE;
540+
541+
break;
542+
}
543+
544+
/* enter key was pressed */
545+
if (c == '\r')
546+
*key = KEY_SELECT;
547+
548+
/* ^C was pressed */
549+
if (c == 0x3)
550+
*key = KEY_QUIT;
551+
}

doc/mkimage.1

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ Parse image file as type.
5353
Pass \-h as the image to see the list of supported image type.
5454
Without this option image type is autodetected.
5555

56+
.TP
57+
.BI "\-q"
58+
Quiet. Don't print the image header on successful verification.
59+
5660
.P
5761
.B Create old legacy image:
5862

@@ -91,6 +95,11 @@ List the contents of an image.
9195
.BI "\-n [" "image name" "]"
9296
Set image name to 'image name'.
9397

98+
.TP
99+
.BI "\-R [" "secondary image name" "]"
100+
Some image types support a second image for additional data. For these types,
101+
use \-R to specify this second image.
102+
94103
.TP
95104
.BI "\-d [" "image data file" "]"
96105
Use image data from 'image data file'.
@@ -99,6 +108,15 @@ Use image data from 'image data file'.
99108
.BI "\-x"
100109
Set XIP (execute in place) flag.
101110

111+
.TP
112+
.BI "\-s"
113+
Create an image with no data. The header will be created, but the image itself
114+
will not contain data (such as U-Boot or any specified kernel).
115+
116+
.TP
117+
.BI "\-v"
118+
Verbose. Print file names as they are added to the image.
119+
102120
.P
103121
.B Create FIT image:
104122

@@ -126,6 +144,11 @@ in each image will be replaced with 'data-offset' and 'data-size' properties.
126144
A 'data-offset' of 0 indicates that it starts in the first (4-byte aligned)
127145
byte after the FIT.
128146

147+
.TP
148+
.BI "\-B [" "alignment" "]"
149+
The alignment, in hexadecimal, that external data will be aligned to. This
150+
option only has an effect when \-E is specified.
151+
129152
.TP
130153
.BI "\-f [" "image tree source file" " | " "auto" "]"
131154
Image tree source file that describes the structure and contents of the
@@ -161,6 +184,11 @@ the corresponding public key is written into this file for for run-time
161184
verification. Typically the file here is the device tree binary used by
162185
CONFIG_OF_CONTROL in U-Boot.
163186

187+
.TP
188+
.BI "\-G [" "key_file" "]"
189+
Specifies the private key file to use when signing. This option may be used
190+
instead of \-k.
191+
164192
.TP
165193
.BI "\-o [" "signing algorithm" "]"
166194
Specifies the algorithm to be used for signing a FIT image. The default is
@@ -173,11 +201,17 @@ a 'data-offset' property defining the offset from the end of the FIT, \-p will
173201
use 'data-position' as the absolute position from the base of the FIT.
174202

175203
.TP
176-
.BI "\-r
204+
.BI "\-r"
177205
Specifies that keys used to sign the FIT are required. This means that they
178206
must be verified for the image to boot. Without this option, the verification
179207
will be optional (useful for testing but not for release).
180208

209+
.TP
210+
.BI "\-N [" "engine" "]"
211+
The openssl engine to use when signing and verifying the image. For a complete list of
212+
available engines, refer to
213+
.BR engine (1).
214+
181215
.TP
182216
.BI "\-t
183217
Update the timestamp in the FIT.

0 commit comments

Comments
 (0)