grub-mod-setup_var
grub-mod-setup_var copied to clipboard
make: *** [all] Error 2
https://pastebin.com/MHva2UsM
Trying to build for ia32 efi and getting this issue:
commands/efi/setup_var.c: In function ‘grub_cmd_setup_var’: commands/efi/setup_var.c:269:110: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘grub_efi_status_t {aka unsigned int}’ [-Werror=format=] _ERR_INVALID_COMMAND, "can't get variable using efi (error: 0x%016lx)", status); ~~~~~^ %016x commands/efi/setup_var.c:296:58: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘grub_uint64_t {aka long long unsigned int}’ [-Werror=format=] grub_printf("offset 0x%02x is: 0x%02lx\n", offset, pack_data(tmp_data, offset, var_size)); ~~~~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %02llx commands/efi/setup_var.c:305:58: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘grub_uint64_t {aka long long unsigned int}’ [-Werror=format=] grub_printf("offset 0x%02x is: 0x%02lx\n", offset, pack_data(tmp_data, offset, var_size)); ~~~~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %02llx commands/efi/setup_var.c:328:110: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘grub_efi_status_t {aka unsigned int}’ [-Werror=format=] _ERR_INVALID_COMMAND, "can't set variable using efi (error: 0x%016lx)", status); ~~~~~^ %016x commands/efi/setup_var.c:341:65: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘grub_uint64_t {aka long long unsigned int}’ [-Werror=format=] grub_printf("setting offset 0x%02x to 0x%02lx\n", offset, larger_set_value); ~~~~^ %02llx commands/efi/setup_var.c:351:114: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘grub_efi_status_t {aka unsigned int}’ [-Werror=format=] _ERR_INVALID_COMMAND, "can't set variable using efi (error: 0x%016lx)", status); ~~~~~^ %016x commands/efi/setup_var.c:365:65: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘grub_uint64_t {aka long long unsigned int}’ [-Werror=format=] grub_printf("setting offset 0x%02x to 0x%02lx\n", offset, larger_set_value); ~~~~^ %02llx commands/efi/setup_var.c:375:114: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘grub_efi_status_t {aka unsigned int}’ [-Werror=format=] _ERR_INVALID_COMMAND, "can't set variable using efi (error: 0x%016lx)", status); ~~~~~^ %016x cc1: all warnings being treated as errors Makefile:41199: recipe for target 'commands/efi/setup_var_module-setup_var.o' failed make[3]: *** [commands/efi/setup_var_module-setup_var.o] Error 1 make[3]: Leaving directory '/home/ubuntu/grub/grub-core' Makefile:27083: recipe for target 'all' failed make[2]: *** [all] Error 2 make[2]: Leaving directory '/home/ubuntu/grub/grub-core' Makefile:11667: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/home/ubuntu/grub' Makefile:3525: recipe for target 'all' failed make: *** [all] Error 2
This is due to the change of architecture, you tried to directly use formatters for x86_64 on i386. C does not has formatter for data with fixed length (and it should not be anyways), the length of int
, long
or long long
depends on compiler.
So as you've shown in the description, you need %llx
to format a 64-bit value (grub_uint64_t
), and the grub_efi_status_t
is 32-bit now, which does not need long
.
If you really need to compile it targeting efi-ia32, just change it as what you have said, this should be ok as long as the grub's API of efi-ia32 is the same as efi-amd64. But I don't think the code should be changed for efi-ia32 systems, as they are so rare that I can't speak of many (one example I could think of is the old Macs before UEFI standard).
BTW, I'm not quite sure your intention for building efi-ia32 binaries but don't use it on x64 EFI systems, the disagreement between data layouts will cause many unexpected results.