[U-Boot] cmd/bootefi.c:285:3: error: ‘loaded_image_info’ undeclared

Hello Rob, hello Alex,
when I try to compile efi-next I get
CC cmd/bootefi.o cmd/bootefi.c: In function ‘do_bootefi’: cmd/bootefi.c:285:3: error: ‘loaded_image_info’ undeclared (first use in this function) loaded_image_info.device_handle = bootefi_device_path; ^~~~~~~~~~~~~~~~~ cmd/bootefi.c:285:3: note: each undeclared identifier is reported only once for each function it appears in scripts/Makefile.build:280: recipe for target 'cmd/bootefi.o' failed make[3]: *** [cmd/bootefi.o] Error 1 Makefile:1279: recipe for target 'cmd' failed
when compiling with CONFIG_CMD_BOOTEFI_SELFTEST=y.
I guess we should enable this option in qemu-x86_defconfig to make such errors visible in Travis CI.
This seems to be the problematic patch: ad503ffe9c6: efi_loader: refactor boot device and loaded_image handling
Best regards
Heinrich

The EFI selftest has been broken by a patch on efi-next. We should enable CONFIG_CMD_BOOTEFI_SELFTEST on qemu-x86_defconfig and qemu-x86_64_defconfig by default to catch this type of problem in the Travis CI tests.
These systems typically have abundant memory so that enabling this option should not pose a problem.
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de --- configs/qemu-x86_64_defconfig | 1 + configs/qemu-x86_defconfig | 1 + 2 files changed, 2 insertions(+)
diff --git a/configs/qemu-x86_64_defconfig b/configs/qemu-x86_64_defconfig index 67e9a45fbc..c12d530b83 100644 --- a/configs/qemu-x86_64_defconfig +++ b/configs/qemu-x86_64_defconfig @@ -64,3 +64,4 @@ CONFIG_USB_KEYBOARD=y CONFIG_FRAMEBUFFER_SET_VESA_MODE=y CONFIG_FRAMEBUFFER_VESA_MODE_111=y CONFIG_CONSOLE_SCROLL_LINES=5 +CONFIG_CMD_BOOTEFI_SELFTEST=y diff --git a/configs/qemu-x86_defconfig b/configs/qemu-x86_defconfig index 7ce97ff091..d84e1d7dc9 100644 --- a/configs/qemu-x86_defconfig +++ b/configs/qemu-x86_defconfig @@ -44,3 +44,4 @@ CONFIG_USB_KEYBOARD=y CONFIG_FRAMEBUFFER_SET_VESA_MODE=y CONFIG_FRAMEBUFFER_VESA_MODE_111=y CONFIG_CONSOLE_SCROLL_LINES=5 +CONFIG_CMD_BOOTEFI_SELFTEST=y

On 20 September 2017 at 13:14, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
The EFI selftest has been broken by a patch on efi-next. We should enable CONFIG_CMD_BOOTEFI_SELFTEST on qemu-x86_defconfig and qemu-x86_64_defconfig by default to catch this type of problem in the Travis CI tests.
These systems typically have abundant memory so that enabling this option should not pose a problem.
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de
configs/qemu-x86_64_defconfig | 1 + configs/qemu-x86_defconfig | 1 + 2 files changed, 2 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org

ad503ffe9c6 efi_loader: refactor boot device and loaded_image handling leads to an error when building with CONFIG_CMD_BOOTEFI_SELFTEST=y This patch fixes the problem.
Fixes: ad503ffe9c6 efi_loader: refactor boot device and loaded_image handling Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de --- cmd/bootefi.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 1e2dbcc4a4..9460747f96 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -273,6 +273,8 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #endif #ifdef CONFIG_CMD_BOOTEFI_SELFTEST if (!strcmp(argv[1], "selftest")) { + struct efi_loaded_image loaded_image_info = {}; + /* * gd lives in a fixed register which may get clobbered while we * execute the payload. So save it here and restore it on every

On Wed, Sep 20, 2017 at 3:46 PM, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
ad503ffe9c6 efi_loader: refactor boot device and loaded_image handling leads to an error when building with CONFIG_CMD_BOOTEFI_SELFTEST=y This patch fixes the problem.
Fixes: ad503ffe9c6 efi_loader: refactor boot device and loaded_image handling Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de
cmd/bootefi.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 1e2dbcc4a4..9460747f96 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -273,6 +273,8 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #endif #ifdef CONFIG_CMD_BOOTEFI_SELFTEST if (!strcmp(argv[1], "selftest")) {
struct efi_loaded_image loaded_image_info = {};
/* * gd lives in a fixed register which may get clobbered while we * execute the payload. So save it here and restore it on every
-- 2.14.1
I'm not sure this is complete enough (or at least will run into problems if you add more tests) since loaded_image_info won't be populated completely. You want a efi_setup_loaded_image() call:
efi_setup_loaded_image(&loaded_image_info, &loaded_image_info_obj, bootefi_device_path, bootefi_image_path);
BR, -R

ad503ffe9c6 efi_loader: refactor boot device and loaded_image handling leads to an error when building with CONFIG_CMD_BOOTEFI_SELFTEST=y This patch fixes the problem.
Fixes: ad503ffe9c6 efi_loader: refactor boot device and loaded_image handling Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de --- v2 completely initialize loaded_image_info --- cmd/bootefi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 1e2dbcc4a4..e0a657323f 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -273,6 +273,12 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #endif #ifdef CONFIG_CMD_BOOTEFI_SELFTEST if (!strcmp(argv[1], "selftest")) { + struct efi_loaded_image loaded_image_info = {}; + struct efi_object loaded_image_info_obj = {}; + + efi_setup_loaded_image(&loaded_image_info, + &loaded_image_info_obj, + bootefi_device_path, bootefi_image_path); /* * gd lives in a fixed register which may get clobbered while we * execute the payload. So save it here and restore it on every @@ -282,8 +288,6 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) /* Initialize and populate EFI object list */ if (!efi_obj_list_initalized) efi_init_obj_list(); - loaded_image_info.device_handle = bootefi_device_path; - loaded_image_info.file_path = bootefi_image_path; return efi_selftest(&loaded_image_info, &systab); } else #endif

On Wed, Sep 20, 2017 at 4:54 PM, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
ad503ffe9c6 efi_loader: refactor boot device and loaded_image handling leads to an error when building with CONFIG_CMD_BOOTEFI_SELFTEST=y This patch fixes the problem.
Fixes: ad503ffe9c6 efi_loader: refactor boot device and loaded_image handling Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de
v2 completely initialize loaded_image_info
lgtm, thanks
Reviewed-by: Rob Clark robdclark@gmail.com
cmd/bootefi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 1e2dbcc4a4..e0a657323f 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -273,6 +273,12 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #endif #ifdef CONFIG_CMD_BOOTEFI_SELFTEST if (!strcmp(argv[1], "selftest")) {
struct efi_loaded_image loaded_image_info = {};
struct efi_object loaded_image_info_obj = {};
efi_setup_loaded_image(&loaded_image_info,
&loaded_image_info_obj,
bootefi_device_path, bootefi_image_path); /* * gd lives in a fixed register which may get clobbered while we * execute the payload. So save it here and restore it on every
@@ -282,8 +288,6 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) /* Initialize and populate EFI object list */ if (!efi_obj_list_initalized) efi_init_obj_list();
loaded_image_info.device_handle = bootefi_device_path;
loaded_image_info.file_path = bootefi_image_path; return efi_selftest(&loaded_image_info, &systab); } else
#endif
2.14.1

On 20 September 2017 at 14:54, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
ad503ffe9c6 efi_loader: refactor boot device and loaded_image handling leads to an error when building with CONFIG_CMD_BOOTEFI_SELFTEST=y This patch fixes the problem.
Fixes: ad503ffe9c6 efi_loader: refactor boot device and loaded_image handling Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de
v2 completely initialize loaded_image_info
cmd/bootefi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Wed, Sep 20, 2017 at 2:42 PM, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
Hello Rob, hello Alex,
when I try to compile efi-next I get
CC cmd/bootefi.o cmd/bootefi.c: In function ‘do_bootefi’: cmd/bootefi.c:285:3: error: ‘loaded_image_info’ undeclared (first use in this function) loaded_image_info.device_handle = bootefi_device_path; ^~~~~~~~~~~~~~~~~ cmd/bootefi.c:285:3: note: each undeclared identifier is reported only once for each function it appears in scripts/Makefile.build:280: recipe for target 'cmd/bootefi.o' failed make[3]: *** [cmd/bootefi.o] Error 1 Makefile:1279: recipe for target 'cmd' failed
when compiling with CONFIG_CMD_BOOTEFI_SELFTEST=y.
I guess we should enable this option in qemu-x86_defconfig to make such errors visible in Travis CI.
This seems to be the problematic patch: ad503ffe9c6: efi_loader: refactor boot device and loaded_image handling
The rebased version of this patch fixed this. It looks like the original patch was applied. What you want is approximately:
#ifdef CONFIG_CMD_BOOTEFI_SELFTEST if (!strcmp(argv[1], "selftest")) { + struct efi_loaded_image loaded_image_info = {}; + struct efi_object loaded_image_info_obj = {}; + + efi_setup_loaded_image(&loaded_image_info, &loaded_image_info_obj, + bootefi_device_path, bootefi_image_path); + /* * gd lives in a fixed register which may get clobbered while we * execute the payload. So save it here and restore it on every
See: https://github.com/robclark/u-boot/commit/c17f3a0fbcedf1b5e38e671c277dbd2187...
BR, -R
participants (3)
-
Heinrich Schuchardt
-
Rob Clark
-
Simon Glass