multiboot2: Enable EFI boot services usage in loaded images
cover multiboot2: Enable EFI boot services usage in loaded images
Hi,
This patch series enable EFI boot services usage
in loaded images by multiboot2 protocol.
Daniel
grub-core/Makefile.core.def | 1 + grub-core/lib/i386/relocator.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++---- grub-core/lib/i386/relocator64_efi.S | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ grub-core/loader/i386/bsd.c | 6 +++--- grub-core/loader/i386/coreboot/chainloader.c | 2 +- grub-core/loader/i386/linux.c | 2 +- grub-core/loader/i386/pc/plan9.c | 2 +- grub-core/loader/i386/xnu.c | 4 ++-- grub-core/loader/multiboot.c | 29 ++++++++++++++++++++++----- grub-core/loader/multiboot_mbi2.c | 57 ++++++++++++++++++++++++++++++++++++++++++---------- include/grub/i386/multiboot.h | 11 +++++++++++ include/grub/i386/relocator.h | 24 ++++++++++++++++++++-- include/multiboot2.h | 25 +++++++++++++++++++++++ 13 files changed, 270 insertions(+), 29 deletions(-)
Daniel Kiper (5):
multiboot2: Fix information request tag size calculation i386/relocator: Remove unused extern grub_relocator64_rip_addr i386/relocator: Remove unused avoid_efi_bootservices argument i386/relocator: Add grub_relocator64_efi relocator
multiboot2: Add tags used to pass ImageHandle to loaded image
PATCH 1/5 multiboot2: Fix information request tag size calculation
--- grub-core/loader/multiboot_mbi2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/loader/multiboot_mbi2.c +1 -1
@@ -150,7 +150,7 @@ grub_multiboot_load (grub_file_t file, const char *filename) = (struct multiboot_header_tag_information_request *) tag;if (request_tag->flags &MULTIBOOT_HEADER_TAG_OPTIONAL )break ; -for (i =0 ; i < (request_tag->size -sizeof (request_tag)) +for (i =0 ; i < (request_tag->size -sizeof (*request_tag)) /sizeof (request_tag->requests[0 ]); i++)switch (request_tag->requests[i]) {
Signature · 1 line
1.7.10.4
PATCH 1/5 multiboot2: Fix information request tag size calculation
In reply to Daniel Kiper--- grub-core/loader/multiboot_mbi2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/loader/multiboot_mbi2.c +1 -1
@@ -150,7 +150,7 @@ grub_multiboot_load (grub_file_t file, const char *filename) = (struct multiboot_header_tag_information_request *) tag;if (request_tag->flags &MULTIBOOT_HEADER_TAG_OPTIONAL )break ; -for (i =0 ; i < (request_tag->size -sizeof (request_tag)) +for (i =0 ; i < (request_tag->size -sizeof (*request_tag)) /sizeof (request_tag->requests[0 ]); i++)switch (request_tag->requests[i]) {
Signature · 1 line
1.7.10.4
Re: [PATCH 1/5] multiboot2: Fix information request tag size calculation
Why do you want the size of a pointer instead of the size of the structure?
Quoted 29 lines · Daniel Kiper
Signed-off-by Daniel Kiper <[email protected]>--- grub-core/loader/multiboot_mbi2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grub-core/loader/multiboot_mbi2.c +1
-1@@ -150,7 +150,7 @@ grub_multiboot_load (grub_file_t file, const char *filename) = (struct multiboot_header_tag_information_request *) tag;if (request_tag->flags &MULTIBOOT_HEADER_TAG_OPTIONAL )break ; -for (i =0 ; i < (request_tag->size -sizeof (request_tag)) +for (i =0 ; i < (request_tag->size -sizeof (*request_tag)) /sizeof (request_tag->requests[0 ]); i++) switch (request_tag->requests[i]){--
1.7.10.4_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
-- Ben Hildred Automation Support Services 303 815 6721
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 1/5] multiboot2: Fix information request tag size calculation
In reply to Daniel KiperWhy do you want the size of a pointer instead of the size of the structure?
Quoted 29 lines · Daniel Kiper
Signed-off-by Daniel Kiper <[email protected]>--- grub-core/loader/multiboot_mbi2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grub-core/loader/multiboot_mbi2.c +1
-1@@ -150,7 +150,7 @@ grub_multiboot_load (grub_file_t file, const char *filename) = (struct multiboot_header_tag_information_request *) tag;if (request_tag->flags &MULTIBOOT_HEADER_TAG_OPTIONAL )break ; -for (i =0 ; i < (request_tag->size -sizeof (request_tag)) +for (i =0 ; i < (request_tag->size -sizeof (*request_tag)) /sizeof (request_tag->requests[0 ]); i++) switch (request_tag->requests[i]){--
1.7.10.4_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
-- Ben Hildred Automation Support Services 303 815 6721
Re: [PATCH 1/5] multiboot2: Fix information request tag size calculation
Quoted 1 line · Ben Hildred
Why do you want the size of a pointer instead of the size of the structure?
Isn't *request_tag the dereferenced pointer, and hence is the size of the structure, where as before it was the size of a pointer?
Signature · 1 line
Len Sorensen
Quoted 45 lines
Quoted 29 lines · Daniel Kiper
Signed-off-by Daniel Kiper <[email protected]>--- grub-core/loader/multiboot_mbi2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grub-core/loader/multiboot_mbi2.c +1
-1@@ -150,7 +150,7 @@ grub_multiboot_load (grub_file_t file, const char *filename) = (struct multiboot_header_tag_information_request *) tag;if (request_tag->flags &MULTIBOOT_HEADER_TAG_OPTIONAL )break ; -for (i =0 ; i < (request_tag->size -sizeof (request_tag)) +for (i =0 ; i < (request_tag->size -sizeof (*request_tag)) /sizeof (request_tag->requests[0 ]); i++) switch (request_tag->requests[i]){--
1.7.10.4_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-develSignature · 9 lines
-- Ben Hildred Automation Support Services 303 815 6721 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH 1/5] multiboot2: Fix information request tag size calculation
In reply to Ben HildredQuoted 1 line · Ben Hildred
Why do you want the size of a pointer instead of the size of the structure?
Isn't *request_tag the dereferenced pointer, and hence is the size of the structure, where as before it was the size of a pointer?
Signature · 1 line
Len Sorensen
Quoted 45 lines
Quoted 29 lines · Daniel Kiper
Signed-off-by Daniel Kiper <[email protected]>--- grub-core/loader/multiboot_mbi2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grub-core/loader/multiboot_mbi2.c +1
-1@@ -150,7 +150,7 @@ grub_multiboot_load (grub_file_t file, const char *filename) = (struct multiboot_header_tag_information_request *) tag;if (request_tag->flags &MULTIBOOT_HEADER_TAG_OPTIONAL )break ; -for (i =0 ; i < (request_tag->size -sizeof (request_tag)) +for (i =0 ; i < (request_tag->size -sizeof (*request_tag)) /sizeof (request_tag->requests[0 ]); i++) switch (request_tag->requests[i]){--
1.7.10.4_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-develSignature · 9 lines
-- Ben Hildred Automation Support Services 303 815 6721 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH 1/5] multiboot2: Fix information request tag size calculation
ok, the fix is correct. This is why I always do size of typedefs. the syntax is better.
Quoted 62 lines · Lennart Sorensen
Quoted 1 line · Ben Hildred
Why do you want the size of a pointer instead of the size of the
structure?
Isn't
*request_tagthe dereferenced pointer, and hence is the size of the structure, where as before it was the size of a pointer?--
Len SorensenQuoted 41 lines
Quoted 20 lines · Daniel Kiper
Signed-off-by Daniel Kiper <[email protected]>--- grub-core/loader/multiboot_mbi2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grub-core/loader/multiboot_mbi2.c +1
-1@@ -150,7 +150,7 @@ grub_multiboot_load (grub_file_t file, const char *filename) = (struct multiboot_header_tag_information_request *) tag;if (request_tag->flags &MULTIBOOT_HEADER_TAG_OPTIONAL )break ; -for (i =0 ; i < (request_tag->size -sizeof (request_tag)) +for (i =0 ; i < (request_tag->size -sizeof (*request_tag)) /sizeof (request_tag->requests[0 ]); i++) switch (request_tag->requests[i]){Quoted 9 lines
--
1.7.10.4_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel--
--
Ben Hildred
Automation Support Services
303 815 6721Quoted 4 lines
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
-- Ben Hildred Automation Support Services 303 815 6721
Andrei Borzenkov
AppliedRe: [PATCH 1/5] multiboot2: Fix information request tag size calculation
In reply to Daniel KiperВ Fri, 30 Jan 2015 18:59:24 +0100
Daniel Kiper <[email protected]> пишет:
Quoted 10 lines
Signed-off-by Daniel Kiper <[email protected]>--- grub-core/loader/multiboot_mbi2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grub-core/loader/multiboot_mbi2.c +0
-0
grub-core/loader/multiboot_mbi2.c grub_multiboot_load (grub_file_t file, const char *filename) · line 156
Quoted 8 lines
grub-core/loader/multiboot_mbi2.c +1
-1@@ -150,7 +150,7 @@ grub_multiboot_load (grub_file_t file, const char *filename) = (struct multiboot_header_tag_information_request *) tag;if (request_tag->flags &MULTIBOOT_HEADER_TAG_OPTIONAL )break ; -for (i =0 ; i < (request_tag->size -sizeof (request_tag)) +for (i =0 ; i < (request_tag->size -sizeof (*request_tag)) /sizeof (request_tag->requests[0 ]); i++)switch (request_tag->requests[i]) {
Applied. Thanks!
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Andrei Borzenkov
AppliedRe: [PATCH 1/5] multiboot2: Fix information request tag size calculation
In reply to Daniel KiperВ Fri, 30 Jan 2015 18:59:24 +0100
Daniel Kiper <[email protected]> пишет:
Quoted 10 lines
Signed-off-by Daniel Kiper <[email protected]>--- grub-core/loader/multiboot_mbi2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grub-core/loader/multiboot_mbi2.c +0
-0
grub-core/loader/multiboot_mbi2.c grub_multiboot_load (grub_file_t file, const char *filename) · line 156
Quoted 8 lines
grub-core/loader/multiboot_mbi2.c +1
-1@@ -150,7 +150,7 @@ grub_multiboot_load (grub_file_t file, const char *filename) = (struct multiboot_header_tag_information_request *) tag;if (request_tag->flags &MULTIBOOT_HEADER_TAG_OPTIONAL )break ; -for (i =0 ; i < (request_tag->size -sizeof (request_tag)) +for (i =0 ; i < (request_tag->size -sizeof (*request_tag)) /sizeof (request_tag->requests[0 ]); i++)switch (request_tag->requests[i]) {
Applied. Thanks!
PATCH 2/5 i386/relocator: Remove unused extern grub_relocator64_rip_addr
In reply to Daniel Kiper--- grub-core/lib/i386/relocator.c | 1 - 1 file changed, 1 deletion(-)
grub-core/lib/i386/relocator.c +0 -1
@@ -64,7 +64,6 @@ extern grub_uint64_t grub_relocator64_rbx;extern grub_uint64_t grub_relocator64_rcx;extern grub_uint64_t grub_relocator64_rdx;extern grub_uint64_t grub_relocator64_rip; -extern grub_uint64_t grub_relocator64_rip_addr;extern grub_uint64_t grub_relocator64_rsp;extern grub_uint64_t grub_relocator64_rsi;extern grub_addr_t grub_relocator64_cr3;
Signature · 1 line
1.7.10.4
PATCH 2/5 i386/relocator: Remove unused extern grub_relocator64_rip_addr
In reply to Daniel Kiper--- grub-core/lib/i386/relocator.c | 1 - 1 file changed, 1 deletion(-)
grub-core/lib/i386/relocator.c +0 -1
@@ -64,7 +64,6 @@ extern grub_uint64_t grub_relocator64_rbx;extern grub_uint64_t grub_relocator64_rcx;extern grub_uint64_t grub_relocator64_rdx;extern grub_uint64_t grub_relocator64_rip; -extern grub_uint64_t grub_relocator64_rip_addr;extern grub_uint64_t grub_relocator64_rsp;extern grub_uint64_t grub_relocator64_rsi;extern grub_addr_t grub_relocator64_cr3;
Signature · 1 line
1.7.10.4
Re: [PATCH 2/5] i386/relocator: Remove unused extern grub_relocator64_rip_addr
Committed, thanks.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 2/5] i386/relocator: Remove unused extern grub_relocator64_rip_addr
In reply to Daniel KiperCommitted, thanks.
PATCH 3/5 i386/relocator: Remove unused avoid_efi_bootservices argument
In reply to Daniel Kiper--- grub-core/lib/i386/relocator.c | 5 ++--- grub-core/loader/i386/bsd.c | 6 +++--- grub-core/loader/i386/coreboot/chainloader.c | 2 +- grub-core/loader/i386/linux.c | 2 +- grub-core/loader/i386/pc/plan9.c | 2 +- grub-core/loader/i386/xnu.c | 4 ++-- grub-core/loader/multiboot.c | 4 ---- include/grub/i386/relocator.h | 3 +-- 8 files changed, 11 insertions(+), 17 deletions(-)
grub-core/lib/i386/relocator.c +2 -3
@@ -73,8 +73,7 @@ extern struct grub_i386_idt grub_relocator16_idt;grub_err_t grub_relocator32_boot (struct grub_relocator *rel, -struct grub_relocator32_state state, -int avoid_efi_bootservices) +struct grub_relocator32_state state) {grub_err_t err;void *relst;
@@ -87,7 +86,7 @@ grub_relocator32_boot (struct grub_relocator *rel,0x9a000 -RELOCATOR_SIZEOF (32 ),RELOCATOR_SIZEOF (32 ),16 ,GRUB_RELOCATOR_PREFERENCE_LOW , - avoid_efi_bootservices); + 0);if (err)return err;
grub-core/loader/i386/bsd.c +3 -3
@@ -797,7 +797,7 @@ grub_freebsd_boot (void) stack[6 ] = stack_target +9 *sizeof (grub_uint32_t); stack[7 ] = bi.tags; stack[8 ] = kern_end; -return grub_relocator32_boot (relocator, state,0 ); +return grub_relocator32_boot (relocator, state); }/* Not reached. */
@@ -913,7 +913,7 @@ grub_openbsd_boot (void) stack[7 ] = (grub_uint8_t *) curarg - (grub_uint8_t *) arg0; stack[8 ] = ((grub_uint8_t *) arg0 - (grub_uint8_t *) buf0) + buf_target; -return grub_relocator32_boot (relocator, state,0 ); +return grub_relocator32_boot (relocator, state); } static grub_err_t
@@ -1228,7 +1228,7 @@ grub_netbsd_boot (void) stack[5 ] =grub_mmap_get_upper () >>10 ; stack[6 ] =grub_mmap_get_lower () >>10 ; -return grub_relocator32_boot (relocator, state,0 ); +return grub_relocator32_boot (relocator, state); } static grub_err_t
grub-core/loader/i386/coreboot/chainloader.c +1 -1
@@ -47,7 +47,7 @@ grub_chain_boot (void)grub_video_set_mode ("text" ,0 ,0 ); state.eip = entry; -return grub_relocator32_boot (relocator, state,0 ); +return grub_relocator32_boot (relocator, state); } static grub_err_t
grub-core/loader/i386/linux.c +1 -1
@@ -661,7 +661,7 @@ grub_linux_boot (void) state.esi = ctx.real_mode_target; state.esp = ctx.real_mode_target; state.eip = ctx.params->code32_start; -return grub_relocator32_boot (relocator, state,0 ); +return grub_relocator32_boot (relocator, state); } static grub_err_t
grub-core/loader/i386/pc/plan9.c +1 -1
@@ -90,7 +90,7 @@ grub_plan9_boot (void) };grub_video_set_mode ("text" ,0 ,0 ); -return grub_relocator32_boot (rel, state,0 ); +return grub_relocator32_boot (rel, state); } static grub_err_t
grub-core/loader/i386/xnu.c +2 -2
@@ -791,7 +791,7 @@ grub_xnu_boot_resume (void) state.eip = grub_xnu_entry_point; state.eax = grub_xnu_arg1; -return grub_relocator32_boot (grub_xnu_relocator, state,0 ); +return grub_relocator32_boot (grub_xnu_relocator, state); }/* Setup video for xnu. */
@@ -1099,7 +1099,7 @@ grub_xnu_boot (void)grub_outb (0xff ,0x21 );grub_outb (0xff ,0xa1 ); -return grub_relocator32_boot (grub_xnu_relocator, state,0 ); +return grub_relocator32_boot (grub_xnu_relocator, state); }static grub_command_t cmd_devprop_load;
grub-core/loader/multiboot.c +0 -4
@@ -131,11 +131,7 @@ grub_multiboot_boot (void)if (err)return err; -#if defined (__i386__) || defined (__x86_64__) -grub_relocator32_boot (grub_multiboot_relocator, state,0 ); -#else grub_relocator32_boot (grub_multiboot_relocator, state); -#endif /* Not reached. */ return GRUB_ERR_NONE ;
include/grub/i386/relocator.h +1 -2
@@ -69,8 +69,7 @@ grub_err_t grub_relocator16_boot (struct grub_relocator *rel, struct grub_relocator16_state state);grub_err_t grub_relocator32_boot (struct grub_relocator *rel, -struct grub_relocator32_state state, -int avoid_efi_bootservices); +struct grub_relocator32_state state); grub_err_t grub_relocator64_boot (struct grub_relocator *rel, struct grub_relocator64_state state,
Signature · 1 line
1.7.10.4
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 3/5] i386/relocator: Remove unused avoid_efi_bootservices argument
Hey,
Sorry for late reply but I was busy with our internal EFI stuff. We did more tests and some fixes and it seems that everything is going in right direction. Well, I hope... :-))) Right now I am going to continue my work on upstream EFI + GRUB2 + Xen stuff. I think that I will be able to release new patch series for GRUB2 and Xen in second or third week of June (next week we have 2 days holiday in Poland). Stay tuned...
Quoted 3 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Not unused:
grub_efi_mmap_iterate(grub_relocator_alloc_chunk_align_iter, &ctx,
avoid_efi_boot_services);
In general I have a problem with avoid_efi_boot_services stuff in GRUB2. By default it is disabled and GRUB2 assumes that boot services (BS) memory regions (code and data) are free. This means that it may put there loaded image and/or fills memory maps (MULTIBOOT_TAG_TYPE_BASIC_MEMINFO, MULTIBOOT_TAG_TYPE_MMAP) with above mentioned regions marked as free. This is OK when BS are disabled before loaded image exaction. However, we introduced new feature like MULTIBOOT_TAG_TYPE_EFI_BS (I am going to improve/extend it) and this makes this behavior more problematic. It means that now GRUB2 with MULTIBOOT_TAG_TYPE_EFI_BS enabled may overwrite BS regions and/or memory maps are bogus. In turn, this means that BS are potentially unusable by loaded image which asked for BS with above mentioned tag. So, I think that we should find a solution for that issues.
The simplest fix for that problem seems total removal of avoid_efi_boot_services and assumption that BS memory regions are not free. I did some tests with that but not so many and not so deep. I discovered that at least linux loader (IIRC) has some issues with this solution. Maybe it could be fixed easily but I did not investigated this issue so long. Additionally, I realized that boot services regions are quite big (dozens or even about 100 MiB) and maybe this is not very nice idea to assume them used in all cases.
So, maybe we should just focus on multiboot2 loader only. In that case GRUB2 should at first assume that BS regions are used. Then it should check image header. If it does not contain MULTIBOOT_TAG_TYPE_EFI_BS tag then starting from that point it should assume that BS regions are free and behave as it behaves right now. However, if multiboot2 loader encounters MULTIBOOT_TAG_TYPE_EFI_BS tag then it should still assume that BS regions are not free. Additionally, GRUB2 should not pass any memory map info (i.e, MULTIBOOT_TAG_TYPE_BASIC_MEMINFO, MULTIBOOT_TAG_TYPE_MMAP, MULTIBOOT_TAG_TYPE_EFI_MMAP, etc.) because they are bogus. In that case loaded image should take memory map itself using relevant BS calls. Does it make sense?
Another questions is why grub_relocator_alloc_chunk_addr() does not consult EFI memory map if grub_relocator_alloc_chunk_align() does. Should not we fix it?
Daniel
Re: [PATCH 3/5] i386/relocator: Remove unused avoid_efi_bootservices argument
В Fri, 29 May 2015 22:58:43 +0200
Daniel Kiper <[email protected]> пишет:
Quoted 2 lines
Another questions is why
grub_relocator_alloc_chunk_addr()does not consult EFI memory map ifgrub_relocator_alloc_chunk_align()does. Should not we fix it?
My best guess is that grub_relocator_alloc_chunk_addr() gets target from elsewhere so there is nothing to consult (it is caller responsibility); while grub_relocator_alloc_chunk_align() needs to actually search for suitable memory region.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 3/5] i386/relocator: Remove unused avoid_efi_bootservices argument
In reply to Daniel KiperВ Fri, 29 May 2015 22:58:43 +0200
Daniel Kiper <[email protected]> пишет:
Quoted 2 lines
Another questions is why
grub_relocator_alloc_chunk_addr()does not consult EFI memory map ifgrub_relocator_alloc_chunk_align()does. Should not we fix it?
My best guess is that grub_relocator_alloc_chunk_addr() gets target from elsewhere so there is nothing to consult (it is caller responsibility); while grub_relocator_alloc_chunk_align() needs to actually search for suitable memory region.
Re: [PATCH 3/5] i386/relocator: Remove unused avoid_efi_bootservices argument
Quoted 11 lines · Andrei Borzenkov
В Fri, 29 May 2015 22:58:43 +0200
Daniel Kiper <[email protected]> пишет:Quoted 2 lines
Another questions is why
grub_relocator_alloc_chunk_addr()does not consult EFI memory map ifgrub_relocator_alloc_chunk_align()does. Should not we fix it?My best guess is that
grub_relocator_alloc_chunk_addr()gets target from elsewhere so there is nothing to consult (it is caller responsibility); whilegrub_relocator_alloc_chunk_align()needs to actually search for suitable memory region.
My suggestion would be to pass avoid_boot_services = 1 in multiboot2 iff we don't terminate the services. Any problems with this approach?
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 3/5] i386/relocator: Remove unused avoid_efi_bootservices argument
In reply to Andrei BorzenkovQuoted 11 lines · Andrei Borzenkov
В Fri, 29 May 2015 22:58:43 +0200
Daniel Kiper <[email protected]> пишет:Quoted 2 lines
Another questions is why
grub_relocator_alloc_chunk_addr()does not consult EFI memory map ifgrub_relocator_alloc_chunk_align()does. Should not we fix it?My best guess is that
grub_relocator_alloc_chunk_addr()gets target from elsewhere so there is nothing to consult (it is caller responsibility); whilegrub_relocator_alloc_chunk_align()needs to actually search for suitable memory region.
My suggestion would be to pass avoid_boot_services = 1 in multiboot2 iff we don't terminate the services. Any problems with this approach?
Re: [PATCH 3/5] i386/relocator: Remove unused avoid_efi_bootservices argument
Quoted 7 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 6 lines · Andrei Borzenkov
В Fri, 29 May 2015 22:58:43 +0200
Daniel Kiper <[email protected]> пишет:Quoted 2 lines
Another questions is why
grub_relocator_alloc_chunk_addr()does not consult EFI memory map ifgrub_relocator_alloc_chunk_align()does. Should not we fix it?
Quoted 7 lines
Quoted 5 lines
My best guess is that
grub_relocator_alloc_chunk_addr()gets target from elsewhere so there is nothing to consult (it is caller responsibility); whilegrub_relocator_alloc_chunk_align()needs to actually search for suitable memory region.My suggestion would be to pass
avoid_boot_services= 1 in multiboot2 iff we don't terminate the services. Any problems with this approach?
I am just working on new GRUB2 patches. I thought to go that way. I hope this is good idea. Probably I will post new version of patches next week.
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 3/5] i386/relocator: Remove unused avoid_efi_bootservices argument
In reply to Vladimir 'φ-coder/phcoder' SerbinenkoQuoted 7 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 6 lines · Andrei Borzenkov
В Fri, 29 May 2015 22:58:43 +0200
Daniel Kiper <[email protected]> пишет:Quoted 2 lines
Another questions is why
grub_relocator_alloc_chunk_addr()does not consult EFI memory map ifgrub_relocator_alloc_chunk_align()does. Should not we fix it?
Quoted 7 lines
Quoted 5 lines
My best guess is that
grub_relocator_alloc_chunk_addr()gets target from elsewhere so there is nothing to consult (it is caller responsibility); whilegrub_relocator_alloc_chunk_align()needs to actually search for suitable memory region.My suggestion would be to pass
avoid_boot_services= 1 in multiboot2 iff we don't terminate the services. Any problems with this approach?
I am just working on new GRUB2 patches. I thought to go that way. I hope this is good idea. Probably I will post new version of patches next week.
Daniel
Re: [PATCH 3/5] i386/relocator: Remove unused avoid_efi_bootservices argument
In reply to a message not in the archiveHey,
Sorry for late reply but I was busy with our internal EFI stuff. We did more tests and some fixes and it seems that everything is going in right direction. Well, I hope... :-))) Right now I am going to continue my work on upstream EFI + GRUB2 + Xen stuff. I think that I will be able to release new patch series for GRUB2 and Xen in second or third week of June (next week we have 2 days holiday in Poland). Stay tuned...
Quoted 3 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Not unused:
grub_efi_mmap_iterate(grub_relocator_alloc_chunk_align_iter, &ctx,
avoid_efi_boot_services);
In general I have a problem with avoid_efi_boot_services stuff in GRUB2. By default it is disabled and GRUB2 assumes that boot services (BS) memory regions (code and data) are free. This means that it may put there loaded image and/or fills memory maps (MULTIBOOT_TAG_TYPE_BASIC_MEMINFO, MULTIBOOT_TAG_TYPE_MMAP) with above mentioned regions marked as free. This is OK when BS are disabled before loaded image exaction. However, we introduced new feature like MULTIBOOT_TAG_TYPE_EFI_BS (I am going to improve/extend it) and this makes this behavior more problematic. It means that now GRUB2 with MULTIBOOT_TAG_TYPE_EFI_BS enabled may overwrite BS regions and/or memory maps are bogus. In turn, this means that BS are potentially unusable by loaded image which asked for BS with above mentioned tag. So, I think that we should find a solution for that issues.
The simplest fix for that problem seems total removal of avoid_efi_boot_services and assumption that BS memory regions are not free. I did some tests with that but not so many and not so deep. I discovered that at least linux loader (IIRC) has some issues with this solution. Maybe it could be fixed easily but I did not investigated this issue so long. Additionally, I realized that boot services regions are quite big (dozens or even about 100 MiB) and maybe this is not very nice idea to assume them used in all cases.
So, maybe we should just focus on multiboot2 loader only. In that case GRUB2 should at first assume that BS regions are used. Then it should check image header. If it does not contain MULTIBOOT_TAG_TYPE_EFI_BS tag then starting from that point it should assume that BS regions are free and behave as it behaves right now. However, if multiboot2 loader encounters MULTIBOOT_TAG_TYPE_EFI_BS tag then it should still assume that BS regions are not free. Additionally, GRUB2 should not pass any memory map info (i.e, MULTIBOOT_TAG_TYPE_BASIC_MEMINFO, MULTIBOOT_TAG_TYPE_MMAP, MULTIBOOT_TAG_TYPE_EFI_MMAP, etc.) because they are bogus. In that case loaded image should take memory map itself using relevant BS calls. Does it make sense?
Another questions is why grub_relocator_alloc_chunk_addr() does not consult EFI memory map if grub_relocator_alloc_chunk_align() does. Should not we fix it?
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH 3/5 i386/relocator: Remove unused avoid_efi_bootservices argument
In reply to Daniel Kiper--- grub-core/lib/i386/relocator.c | 5 ++--- grub-core/loader/i386/bsd.c | 6 +++--- grub-core/loader/i386/coreboot/chainloader.c | 2 +- grub-core/loader/i386/linux.c | 2 +- grub-core/loader/i386/pc/plan9.c | 2 +- grub-core/loader/i386/xnu.c | 4 ++-- grub-core/loader/multiboot.c | 4 ---- include/grub/i386/relocator.h | 3 +-- 8 files changed, 11 insertions(+), 17 deletions(-)
grub-core/lib/i386/relocator.c +2 -3
@@ -73,8 +73,7 @@ extern struct grub_i386_idt grub_relocator16_idt;grub_err_t grub_relocator32_boot (struct grub_relocator *rel, -struct grub_relocator32_state state, -int avoid_efi_bootservices) +struct grub_relocator32_state state) {grub_err_t err;void *relst;
@@ -87,7 +86,7 @@ grub_relocator32_boot (struct grub_relocator *rel,0x9a000 -RELOCATOR_SIZEOF (32 ),RELOCATOR_SIZEOF (32 ),16 ,GRUB_RELOCATOR_PREFERENCE_LOW , - avoid_efi_bootservices); + 0);if (err)return err;
grub-core/loader/i386/bsd.c +3 -3
@@ -797,7 +797,7 @@ grub_freebsd_boot (void) stack[6 ] = stack_target +9 *sizeof (grub_uint32_t); stack[7 ] = bi.tags; stack[8 ] = kern_end; -return grub_relocator32_boot (relocator, state,0 ); +return grub_relocator32_boot (relocator, state); }/* Not reached. */
@@ -913,7 +913,7 @@ grub_openbsd_boot (void) stack[7 ] = (grub_uint8_t *) curarg - (grub_uint8_t *) arg0; stack[8 ] = ((grub_uint8_t *) arg0 - (grub_uint8_t *) buf0) + buf_target; -return grub_relocator32_boot (relocator, state,0 ); +return grub_relocator32_boot (relocator, state); } static grub_err_t
@@ -1228,7 +1228,7 @@ grub_netbsd_boot (void) stack[5 ] =grub_mmap_get_upper () >>10 ; stack[6 ] =grub_mmap_get_lower () >>10 ; -return grub_relocator32_boot (relocator, state,0 ); +return grub_relocator32_boot (relocator, state); } static grub_err_t
grub-core/loader/i386/coreboot/chainloader.c +1 -1
@@ -47,7 +47,7 @@ grub_chain_boot (void)grub_video_set_mode ("text" ,0 ,0 ); state.eip = entry; -return grub_relocator32_boot (relocator, state,0 ); +return grub_relocator32_boot (relocator, state); } static grub_err_t
grub-core/loader/i386/linux.c +1 -1
@@ -661,7 +661,7 @@ grub_linux_boot (void) state.esi = ctx.real_mode_target; state.esp = ctx.real_mode_target; state.eip = ctx.params->code32_start; -return grub_relocator32_boot (relocator, state,0 ); +return grub_relocator32_boot (relocator, state); } static grub_err_t
grub-core/loader/i386/pc/plan9.c +1 -1
@@ -90,7 +90,7 @@ grub_plan9_boot (void) };grub_video_set_mode ("text" ,0 ,0 ); -return grub_relocator32_boot (rel, state,0 ); +return grub_relocator32_boot (rel, state); } static grub_err_t
grub-core/loader/i386/xnu.c +2 -2
@@ -791,7 +791,7 @@ grub_xnu_boot_resume (void) state.eip = grub_xnu_entry_point; state.eax = grub_xnu_arg1; -return grub_relocator32_boot (grub_xnu_relocator, state,0 ); +return grub_relocator32_boot (grub_xnu_relocator, state); }/* Setup video for xnu. */
@@ -1099,7 +1099,7 @@ grub_xnu_boot (void)grub_outb (0xff ,0x21 );grub_outb (0xff ,0xa1 ); -return grub_relocator32_boot (grub_xnu_relocator, state,0 ); +return grub_relocator32_boot (grub_xnu_relocator, state); }static grub_command_t cmd_devprop_load;
grub-core/loader/multiboot.c +0 -4
@@ -131,11 +131,7 @@ grub_multiboot_boot (void)if (err)return err; -#if defined (__i386__) || defined (__x86_64__) -grub_relocator32_boot (grub_multiboot_relocator, state,0 ); -#else grub_relocator32_boot (grub_multiboot_relocator, state); -#endif /* Not reached. */ return GRUB_ERR_NONE ;
include/grub/i386/relocator.h +1 -2
@@ -69,8 +69,7 @@ grub_err_t grub_relocator16_boot (struct grub_relocator *rel, struct grub_relocator16_state state);grub_err_t grub_relocator32_boot (struct grub_relocator *rel, -struct grub_relocator32_state state, -int avoid_efi_bootservices); +struct grub_relocator32_state state); grub_err_t grub_relocator64_boot (struct grub_relocator *rel, struct grub_relocator64_state state,
Signature · 1 line
1.7.10.4
PATCH 4/5 i386/relocator: Add grub_relocator64_efi relocator
In reply to Daniel KiperAdd grub_relocator64_efi relocator. It will be used on EFI 64-bit platforms when multiboot2 compatible image requests MULTIBOOT_TAG_TYPE_EFI_BS. Relocator will set lower parts of %rax and %rbx accordingly to multiboot2 specification. On the other hand processor mode, just before jumping into loaded image, will be set accordingly to Unified Extensible Firmware Interface Specification, Version 2.4 Errata B, section 2.3.4, x64 Platforms, boot services. This way loaded image will be able to use EFI boot services without any issues.
If idea is accepted I will prepare grub_relocator32_efi relocator too.
--- grub-core/Makefile.core.def | 1 + grub-core/lib/i386/relocator.c | 53 +++++++++++++++++++++++ grub-core/lib/i386/relocator64_efi.S | 77 ++++++++++++++++++++++++++++++++++ grub-core/loader/multiboot.c | 29 +++++++++++-- grub-core/loader/multiboot_mbi2.c | 19 +++++++-- include/grub/i386/multiboot.h | 11 +++++ include/grub/i386/relocator.h | 21 ++++++++++ include/multiboot2.h | 9 ++++ 8 files changed, 213 insertions(+), 7 deletions(-) create mode 100644 grub-core/lib/i386/relocator64_efi.S
grub-core/Makefile.core.def +1 -0
@@ -1533,6 +1533,7 @@ module = { x86 = lib/i386/relocator_common_c.c; ieee1275 = lib/ieee1275/relocator.c; efi = lib/efi/relocator.c; + x86_64_efi = lib/i386/relocator64_efi.S; mips = lib/mips/relocator_asm.S; mips = lib/mips/relocator.c; powerpc = lib/powerpc/relocator_asm.S;
grub-core/lib/i386/relocator.c +53 -0
62 lines not on this page · raw message
grub-core/lib/i386/relocator64_efi.S new file +77 -0
77 lines not on this page · raw message
grub-core/loader/multiboot.c +26 -3
@@ -118,20 +118,43 @@ grub_multiboot_set_video_mode (void)return err; } +#ifdef GRUB_MACHINE_EFI +#ifdef __x86_64__ +#define grub_relocator_efi_boot grub_relocator64_efi_boot +#endif +#endif +static grub_err_t grub_multiboot_boot (void ) {grub_err_t err; +grub_uint32_t target;struct grub_relocator32_state state =MULTIBOOT_INITIAL_STATE ; +#ifdef GRUB_MACHINE_EFI +#ifdef __x86_64__ +struct grub_relocator64_efi_state state_efi =MULTIBOOT_EFI_INITIAL_STATE ; +#endif +#endif - state.MULTIBOOT_ENTRY_REGISTER = grub_multiboot_payload_eip; - - err =grub_multiboot_make_mbi (&state.MULTIBOOT_MBI_REGISTER); + err =grub_multiboot_make_mbi (&target);if (err)return err; + state.MULTIBOOT_ENTRY_REGISTER = grub_multiboot_payload_eip; + state.MULTIBOOT_MBI_REGISTER = target; + +#if defined (GRUB_MACHINE_EFI ) && defined (__x86_64__) + state_efi.MULTIBOOT_EFI_ENTRY_REGISTER = grub_multiboot_payload_eip; + state_efi.MULTIBOOT_EFI_MBI_REGISTER = target; + +if (grub_efi_is_finished) +grub_relocator32_boot (grub_multiboot_relocator, state); +else +grub_relocator_efi_boot (grub_multiboot_relocator, state_efi); +#else grub_relocator32_boot (grub_multiboot_relocator, state); +#endif /* Not reached. */ return GRUB_ERR_NONE ;
grub-core/loader/multiboot_mbi2.c +15 -4
@@ -107,8 +107,8 @@ grub_multiboot_load (grub_file_t file, const char *filename)grub_err_t err;struct multiboot_header_tag *tag;struct multiboot_header_tag_address *addr_tag =NULL ; -int entry_specified =0 ; -grub_addr_t entry =0 ; +int entry_specified =0 , efi_entry_specified =0 ; +grub_addr_t entry =0 , efi_entry =0 ;grub_uint32_t console_required =0 ;struct multiboot_header_tag_framebuffer *fbtag =NULL ;int accepted_consoles =GRUB_MULTIBOOT_CONSOLE_EGA_TEXT ;
@@ -192,6 +192,13 @@ grub_multiboot_load (grub_file_t file, const char *filename) entry = ((struct multiboot_header_tag_entry_address *) tag)->entry_addr;break ; +case MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64 : +#if defined (GRUB_MACHINE_EFI ) && defined (__x86_64__) + efi_entry_specified =1 ; + efi_entry = ((struct multiboot_header_tag_entry_address_efi64 *) tag)->entry_addr; +#endif +break ; +case MULTIBOOT_HEADER_TAG_CONSOLE_FLAGS :if (!(((struct multiboot_header_tag_console_flags *) tag)->console_flags &MULTIBOOT_CONSOLE_FLAGS_EGA_TEXT_SUPPORTED ))
@@ -211,7 +218,9 @@ grub_multiboot_load (grub_file_t file, const char *filename)break ;case MULTIBOOT_HEADER_TAG_EFI_BS : +#ifdef GRUB_MACHINE_EFI keep_bs =1 ; +#endif break ;default :
@@ -224,7 +233,7 @@ grub_multiboot_load (grub_file_t file, const char *filename)break ; } -if (addr_tag && !entry_specified) +if (addr_tag && !entry_specified && !(keep_bs && efi_entry_specified)) {grub_free (buffer); return grub_error (GRUB_ERR_UNKNOWN_OS,
@@ -287,7 +296,9 @@ grub_multiboot_load (grub_file_t file, const char *filename) } } -if (entry_specified) +if (keep_bs && efi_entry_specified) + grub_multiboot_payload_eip = efi_entry; +else if (entry_specified) grub_multiboot_payload_eip = entry;if (fbtag)
include/grub/i386/multiboot.h +11 -0
@@ -30,6 +30,17 @@#define MULTIBOOT_MBI_REGISTER ebx#define MULTIBOOT_ARCHITECTURE_CURRENT MULTIBOOT_ARCHITECTURE_I386 +#ifdef GRUB_MACHINE_EFI +#ifdef __x86_64__ +#define MULTIBOOT_EFI_INITIAL_STATE { .rax = MULTIBOOT_BOOTLOADER_MAGIC, \ + .rcx = 0, \ + .rdx = 0, \ + } +#define MULTIBOOT_EFI_ENTRY_REGISTER rip +#define MULTIBOOT_EFI_MBI_REGISTER rbx +#endif +#endif +#define MULTIBOOT_ELF32_MACHINE EM_386#define MULTIBOOT_ELF64_MACHINE EM_X86_64
include/grub/i386/relocator.h +21 -0
@@ -65,6 +65,20 @@ struct grub_relocator64_stategrub_addr_t cr3; }; +#ifdef GRUB_MACHINE_EFI +#ifdef __x86_64__ +struct grub_relocator64_efi_state +{ +grub_uint64_t rax; +grub_uint64_t rbx; +grub_uint64_t rcx; +grub_uint64_t rdx; +grub_uint64_t rip; +grub_uint64_t rsi; +}; +#endif +#endif +grub_err_t grub_relocator16_boot (struct grub_relocator *rel,struct grub_relocator16_state state);
@@ -75,4 +89,11 @@ grub_err_t grub_relocator64_boot (struct grub_relocator *rel,struct grub_relocator64_state state, grub_addr_t min_addr, grub_addr_t max_addr); +#ifdef GRUB_MACHINE_EFI +#ifdef __x86_64__ +grub_err_t grub_relocator64_efi_boot (struct grub_relocator *rel, +struct grub_relocator64_efi_state state); +#endif +#endif +#endif /* ! GRUB_RELOCATOR_CPU_HEADER */
include/multiboot2.h +9 -0
@@ -69,6 +69,7 @@#define MULTIBOOT_HEADER_TAG_FRAMEBUFFER 5#define MULTIBOOT_HEADER_TAG_MODULE_ALIGN 6#define MULTIBOOT_HEADER_TAG_EFI_BS 7 +#define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64 9#define MULTIBOOT_ARCHITECTURE_I386 0#define MULTIBOOT_ARCHITECTURE_MIPS32 4
@@ -133,6 +134,14 @@ struct multiboot_header_tag_entry_addressmultiboot_uint32_t entry_addr; }; +struct multiboot_header_tag_entry_address_efi64 +{ +multiboot_uint16_t type; +multiboot_uint16_t flags; +multiboot_uint32_t size; +multiboot_uint32_t entry_addr; +}; +struct multiboot_header_tag_console_flags {multiboot_uint16_t type;
Signature · 1 line
1.7.10.4
PATCH 5/5 multiboot2: Add tags used to pass ImageHandle to loaded image
In reply to Daniel KiperAdd tags used to pass ImageHandle to loaded image. It is used by at least ExitBootServices() function.
--- grub-core/loader/multiboot_mbi2.c | 36 +++++++++++++++++++++++++++++++----- include/multiboot2.h | 16 ++++++++++++++++ 2 files changed, 47 insertions(+), 5 deletions(-)
grub-core/loader/multiboot_mbi2.c +31 -5
@@ -172,6 +172,8 @@ grub_multiboot_load (grub_file_t file, const char *filename)case MULTIBOOT_TAG_TYPE_NETWORK :case MULTIBOOT_TAG_TYPE_EFI_MMAP :case MULTIBOOT_TAG_TYPE_EFI_BS : +case MULTIBOOT_TAG_TYPE_EFI32_IH : +case MULTIBOOT_TAG_TYPE_EFI64_IH :break ;default :
@@ -906,11 +908,35 @@ grub_multiboot_make_mbi (grub_uint32_t *target)if (keep_bs) { -struct multiboot_tag *tag = (struct multiboot_tag *) ptrorig; - tag->type =MULTIBOOT_TAG_TYPE_EFI_BS ; - tag->size =sizeof (struct multiboot_tag ); - ptrorig +=ALIGN_UP (tag->size,MULTIBOOT_TAG_ALIGN ) - /sizeof (grub_properly_aligned_t); + { +struct multiboot_tag *tag = (struct multiboot_tag *) ptrorig; + tag->type =MULTIBOOT_TAG_TYPE_EFI_BS ; + tag->size =sizeof (struct multiboot_tag ); + ptrorig +=ALIGN_UP (tag->size,MULTIBOOT_TAG_ALIGN ) + /sizeof (grub_properly_aligned_t); + } + +#ifdef __x86_64__ + { +struct multiboot_tag_efi64_ih *tag = (struct multiboot_tag_efi64_ih *) ptrorig; + tag->type =MULTIBOOT_TAG_TYPE_EFI64_IH ; + tag->size =sizeof (*tag); + tag->pointer = (grub_addr_t ) grub_efi_image_handle; + ptrorig +=ALIGN_UP (tag->size,MULTIBOOT_TAG_ALIGN ) + /sizeof (grub_properly_aligned_t); + } +#endif + +#ifdef __i386__ + { +struct multiboot_tag_efi32_ih *tag = (struct multiboot_tag_efi32_ih *) ptrorig; + tag->type =MULTIBOOT_TAG_TYPE_EFI32_IH ; + tag->size =sizeof (*tag); + tag->pointer = (grub_addr_t ) grub_efi_image_handle; + ptrorig +=ALIGN_UP (tag->size,MULTIBOOT_TAG_ALIGN ) + /sizeof (grub_properly_aligned_t); + } +#endif }#endif
include/multiboot2.h +16 -0
@@ -60,6 +60,8 @@#define MULTIBOOT_TAG_TYPE_NETWORK 16#define MULTIBOOT_TAG_TYPE_EFI_MMAP 17#define MULTIBOOT_TAG_TYPE_EFI_BS 18 +#define MULTIBOOT_TAG_TYPE_EFI32_IH 19 +#define MULTIBOOT_TAG_TYPE_EFI64_IH 20#define MULTIBOOT_HEADER_TAG_END 0#define MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST 1
@@ -382,6 +384,20 @@ struct multiboot_tag_efi_mmapmultiboot_uint8_t efi_mmap[0 ]; }; +struct multiboot_tag_efi32_ih +{ +multiboot_uint32_t type; +multiboot_uint32_t size; +multiboot_uint32_t pointer; +}; + +struct multiboot_tag_efi64_ih +{ +multiboot_uint32_t type; +multiboot_uint32_t size; +multiboot_uint64_t pointer; +}; +#endif /* ! ASM_FILE */ #endif /* ! MULTIBOOT_HEADER */
Signature · 1 line
1.7.10.4
Hi all,
Quoted 4 lines · Daniel Kiper
Hi,
This patch series enable EFI boot services usage
in loaded images by multiboot2 protocol.
Guys, do you have any comments on this patch series? Should I fix something? Could you apply them to GRUB2 tree?
Daniel
PS Please CC all interested parties. I suppose that there are
some people here who are not subscribed to grub-devel list.
Hi all,
Quoted 4 lines · Daniel Kiper
Hi,
This patch series enable EFI boot services usage
in loaded images by multiboot2 protocol.
Guys, do you have any comments on this patch series? Should I fix something? Could you apply them to GRUB2 tree?
Daniel
PS Please CC all interested parties. I suppose that there are
some people here who are not subscribed to grub-devel list.
Is: grub2-mkconfig detecting ELF files the multiboot2 header and using proper module. Was:Re: [PATCH 0/5] multiboot2: Enable EFI boot services usage in loaded images
Quoted 10 lines · Daniel Kiper
Hi all,
Quoted 4 lines · Daniel Kiper
Hi,
This patch series enable EFI boot services usage
in loaded images by multiboot2 protocol.Guys, do you have any comments on this patch series? Should I fix something? Could you apply them to GRUB2 tree?
Hey,
Follow up part of this is to make 20_linux_xen.in be able to detect whether Xen.gz can be loaded using multiboot2.
I was thinking to piggy-back on the patches which dropped the check on CONFIG_XEN_DOM0 in the Linux kernel config file as (I think so) it was inspecting the ELF of the Linux kernel and determining if it has ".note.Xen" (see
http://xenbits.xen.org/docs/4.3-testing/misc/dump-core-format.txt or
http://wiki.xen.org/wiki/X86_Paravirtualised_Memory_Management#Start_Of_Day)
and using some of that logic to inspect the Xen to find the MB2 header?
But I am having a hard time finding them? Vladimir do you remember where they might be?
Thank you!
Re: Is: grub2-mkconfig detecting ELF files the multiboot2 header and using proper module. Was:Re: [PATCH 0/5] multiboot2: Enable EFI boot services usage in loaded images
Quoted 15 lines · Konrad Rzeszutek Wilk
Quoted 10 lines · Daniel Kiper
Hi all,
Quoted 4 lines · Daniel Kiper
Hi,
This patch series enable EFI boot services usage
in loaded images by multiboot2 protocol.Guys, do you have any comments on this patch series? Should I fix something? Could you apply them to GRUB2 tree?
Hey,
Quoted 9 lines
Follow up part of this is to make 20_linux_xen.in be able to detect whether Xen.gz can be loaded using multiboot2.
I was thinking to piggy-back on the patches which dropped the check on
CONFIG_XEN_DOM0in the Linux kernel config file as (I think so) it was inspecting the ELF of the Linux kernel and determining if it has ".note.Xen" (see
http://xenbits.xen.org/docs/4.3-testing/misc/dump-core-format.txt or
http://wiki.xen.org/wiki/X86_Paravirtualised_Memory_Management#Start_Of_Day)
Quoted 3 lines
and using some of that logic to inspect the Xen to find the MB2 header?
See grub-file tool. Possibly it's still only in next branch
Quoted 4 lines
But I am having a hard time finding them? Vladimir do you remember where they might be?
Thank you!
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: Is: grub2-mkconfig detecting ELF files the multiboot2 header and using proper module. Was:Re: [PATCH 0/5] multiboot2: Enable EFI boot services usage in loaded images
In reply to Konrad Rzeszutek WilkQuoted 15 lines · Konrad Rzeszutek Wilk
Quoted 10 lines · Daniel Kiper
Hi all,
Quoted 4 lines · Daniel Kiper
Hi,
This patch series enable EFI boot services usage
in loaded images by multiboot2 protocol.Guys, do you have any comments on this patch series? Should I fix something? Could you apply them to GRUB2 tree?
Hey,
Quoted 9 lines
Follow up part of this is to make 20_linux_xen.in be able to detect whether Xen.gz can be loaded using multiboot2.
I was thinking to piggy-back on the patches which dropped the check on
CONFIG_XEN_DOM0in the Linux kernel config file as (I think so) it was inspecting the ELF of the Linux kernel and determining if it has ".note.Xen" (see
http://xenbits.xen.org/docs/4.3-testing/misc/dump-core-format.txt or
http://wiki.xen.org/wiki/X86_Paravirtualised_Memory_Management#Start_Of_Day)
Quoted 3 lines
and using some of that logic to inspect the Xen to find the MB2 header?
See grub-file tool. Possibly it's still only in next branch
Quoted 4 lines
But I am having a hard time finding them? Vladimir do you remember where they might be?
Thank you!
Re: Is: grub2-mkconfig detecting ELF files the multiboot2 header and using proper module. Was:Re: [PATCH 0/5] multiboot2: Enable EFI boot services usage in loaded images
Quoted 4 lines
Quoted 3 lines
and using some of that logic to inspect the Xen to find the MB2 header?
See grub-file tool. Possibly it's still only in next branch
I see it. Thank you.
I also see 'faf4a65e1e1ce1d822d251c1e4b53d96ec7faec5'
Revert grub-file usage in grub-mkconfig.
but not much of an explanation? What didn't work?
Thanks!
Quoted 4 lines
Quoted 4 lines
But I am having a hard time finding them? Vladimir do you remember where they might be?
Thank you!
Re: Is: grub2-mkconfig detecting ELF files the multiboot2 header and using proper module. Was:Re: [PATCH 0/5] multiboot2: Enable EFI boot services usage in loaded images
In reply to Vladimir 'phcoder' SerbinenkoQuoted 4 lines
Quoted 3 lines
and using some of that logic to inspect the Xen to find the MB2 header?
See grub-file tool. Possibly it's still only in next branch
I see it. Thank you.
I also see 'faf4a65e1e1ce1d822d251c1e4b53d96ec7faec5'
Revert grub-file usage in grub-mkconfig.
but not much of an explanation? What didn't work?
Thanks!
Quoted 4 lines
Quoted 4 lines
But I am having a hard time finding them? Vladimir do you remember where they might be?
Thank you!
PATCH 1/1 Is: grub2-mkconfig detecting ELF files the multiboot2 header and using proper module. Was:..
In reply to Vladimir 'phcoder' SerbinenkoQuoted 4 lines
Quoted 3 lines
and using some of that logic to inspect the Xen to find the MB2 header?
See grub-file tool. Possibly it's still only in next branch
Sending a patch to utilize the 'grub-file' to figure this out. It is right now only for Linux as platforms as I don't have yet the other platforms installed to test the patch properly.
Vladimir, thank you for having the 'grub-file' already in the tree! (it shows up in the master branch).
util/grub.d/20_linux_xen.in | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
Konrad Rzeszutek Wilk (1):
grub-mkconfig: Detect if Xen is multiboot2 and use appropiate module.
PATCH 1/1 grub-mkconfig: Detect if Xen is multiboot2 and use appropiate module.
--- util/grub.d/20_linux_xen.in | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
util/grub.d/20_linux_xen.in +7 -3
@@ -83,6 +83,10 @@ linux_entry () type="$4" args="$5" xen_args="$6" + ver="" + if $($grub_file --is-x86-multiboot2 ${xen_dirname}/${xen_basename}); then + ver="2" + fi if [ -z "$boot_device_id" ]; then boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" fi
@@ -120,16 +124,16 @@ linux_entry () else xen_rm_opts="no-real-mode edd=off" fi - multiboot ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts} + multiboot${ver} ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts} echo '$(echo "$lmessage" | grub_quote)' - module ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args} + module${ver} ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args} EOF if test -n "${initrd}" ; then # TRANSLATORS: ramdisk isn't identifier. Should be translated. message="$(gettext_printf "Loading initial ramdisk ...")" sed "s/^/$submenu_indentation/" << EOF echo '$(echo "$message" | grub_quote)' - module --nounzip ${rel_dirname}/${initrd} + module${ver} --nounzip ${rel_dirname}/${initrd} EOF fi sed "s/^/$submenu_indentation/" << EOF
Signature · 1 line
2.1.0
Is: grub2-mkconfig detecting ELF files the multiboot2 header and using proper module. Was:Re: [PATCH 0/5] multiboot2: Enable EFI boot services usage in loaded images
In reply to Daniel KiperQuoted 10 lines · Daniel Kiper
Hi all,
Quoted 4 lines · Daniel Kiper
Hi,
This patch series enable EFI boot services usage
in loaded images by multiboot2 protocol.Guys, do you have any comments on this patch series? Should I fix something? Could you apply them to GRUB2 tree?
Hey,
Follow up part of this is to make 20_linux_xen.in be able to detect whether Xen.gz can be loaded using multiboot2.
I was thinking to piggy-back on the patches which dropped the check on CONFIG_XEN_DOM0 in the Linux kernel config file as (I think so) it was inspecting the ELF of the Linux kernel and determining if it has ".note.Xen" (see
http://xenbits.xen.org/docs/4.3-testing/misc/dump-core-format.txt or
http://wiki.xen.org/wiki/X86_Paravirtualised_Memory_Management#Start_Of_Day)
and using some of that logic to inspect the Xen to find the MB2 header?
But I am having a hard time finding them? Vladimir do you remember where they might be?
Thank you!