* multiboot2 vs. grub2 implementation
@ 2008-02-03 16:39 jakllsch
2008-02-03 17:11 ` walt
2008-02-06 16:48 ` Robert Millan
0 siblings, 2 replies; 8+ messages in thread
From: jakllsch @ 2008-02-03 16:39 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 1434 bytes --]
Hi,
In the course of actually trying to use the MultibootDraft, I've discovered
some places where the draft and the grub2 implementation differ.
* Multiboot Information Tags
* Start Tag
The Draft says key is 0x0000, grub2 says 0x0001.
* Boot Loader Name tag is different
The Draft says 0x0001, grub2 says 0x0002.
* Module/Kernel Tags
These tags seem to have different keys and different data formats
than the draft indicates.
* Memory Map Tag
Does not seem to be implemented.
Additionally, the word-length of the values does not seem consistent.
bit 17 of the flags does not seem to affect the word size used in the
Multiboot Information structure.
The Operating System Image header's load_addr and entry_addr fields
do not seem to be recognized, even with bit 8 in the flags set. But
I did use 64-bit values for the addresses, so this may be the same
as the issue in the preceding paragraph.
The entry physical address field is very useful to the kernel I'm
using, as the ELF64 entry address supplied by the kernel I'm working
with is the virtual address, not the physical address.
The load address information in the ELF64 kernel I have are presently
also virtual addresses though this could/should probably be
changed in the linker script. The kernel command line,
as well as the memory map are also useful tags for this x86_64 kernel.
Jonathan Kollasch
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: multiboot2 vs. grub2 implementation
2008-02-03 16:39 multiboot2 vs. grub2 implementation jakllsch
@ 2008-02-03 17:11 ` walt
2008-02-05 20:23 ` jakllsch
2008-02-06 16:48 ` Robert Millan
1 sibling, 1 reply; 8+ messages in thread
From: walt @ 2008-02-03 17:11 UTC (permalink / raw)
To: grub-devel
jakllsch@kollasch.net wrote:
> Hi,
>
> In the course of actually trying to use the MultibootDraft, I've discovered
> some places where the draft and the grub2 implementation differ...
Hi Jonathan,
Are you using grub2/cvs with or without Bean's latest multiboot patch?
It still hasn't been committed, and I was about to ask about it anyway.
Without that patch, multiboot doesn't work.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: multiboot2 vs. grub2 implementation
2008-02-03 17:11 ` walt
@ 2008-02-05 20:23 ` jakllsch
2008-02-06 1:23 ` walt
0 siblings, 1 reply; 8+ messages in thread
From: jakllsch @ 2008-02-05 20:23 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 574 bytes --]
On Sun, Feb 03, 2008 at 09:11:23AM -0800, walt wrote:
> jakllsch@kollasch.net wrote:
>> Hi,
>>
>> In the course of actually trying to use the MultibootDraft, I've
>> discovered
>> some places where the draft and the grub2 implementation differ...
>
> Hi Jonathan,
>
> Are you using grub2/cvs with or without Bean's latest multiboot patch?
I tend not to be aware of these things. I'm using stock sources.
> It still hasn't been committed, and I was about to ask about it anyway.
> Without that patch, multiboot doesn't work.
Hmm.
Jonathan Kollasch
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: multiboot2 vs. grub2 implementation
2008-02-05 20:23 ` jakllsch
@ 2008-02-06 1:23 ` walt
2008-02-06 12:14 ` Robert Millan
0 siblings, 1 reply; 8+ messages in thread
From: walt @ 2008-02-06 1:23 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 1302 bytes --]
On Tue, 2008-02-05 at 14:23 -0600, jakllsch@kollasch.net wrote:
> On Sun, Feb 03, 2008 at 09:11:23AM -0800, walt wrote:
> > jakllsch@kollasch.net wrote:
> >> Hi,
> >>
> >> In the course of actually trying to use the MultibootDraft, I've
> >> discovered
> >> some places where the draft and the grub2 implementation differ...
> >
> > Hi Jonathan,
> >
> > Are you using grub2/cvs with or without Bean's latest multiboot patch?
>
> I tend not to be aware of these things. I'm using stock sources.
>
> > It still hasn't been committed, and I was about to ask about it anyway.
> > Without that patch, multiboot doesn't work.
>
> Hmm.
Agreed :o) Bean's patch had some whitespace corruption anyway, so here
it is again, diffed against today's latest cvs grub2:
========================================================================
this is the patch, problems found:
1, the mbi structure is not initialized to all zeros, this means some
important member, like mods_count, will contain trash.
2, the entry point in the header is virtual address, we need to
translate it to physical address.
* loader/i386/pc/multiboot.c (grub_multiboot_load_elf32): Get
physical
address of entry.
(grub_multiboot_load_elf64): Likewise.
(grub_multiboot): Initialize mbi structure.
[-- Attachment #2: multiboot.patch --]
[-- Type: text/x-patch, Size: 1713 bytes --]
Index: loader/i386/pc/multiboot.c
===================================================================
RCS file: /sources/grub/grub2/loader/i386/pc/multiboot.c,v
retrieving revision 1.15
diff -u -r1.15 multiboot.c
--- loader/i386/pc/multiboot.c 2 Jan 2008 11:55:23 -0000 1.15
+++ loader/i386/pc/multiboot.c 6 Feb 2008 01:16:26 -0000
@@ -96,6 +96,7 @@
{
Elf32_Ehdr *ehdr = (Elf32_Ehdr *) buffer;
Elf32_Phdr *phdr;
+ grub_addr_t real_entry = 0;
int i;
if (ehdr->e_ident[EI_CLASS] != ELFCLASS32)
@@ -144,9 +145,16 @@
if (phdr->p_filesz < phdr->p_memsz)
grub_memset ((char *) phdr->p_paddr + phdr->p_filesz, 0,
phdr->p_memsz - phdr->p_filesz);
+
+ if ((entry >= phdr->p_vaddr) &&
+ (entry < phdr->p_vaddr + phdr->p_memsz))
+ real_entry = entry + phdr->p_paddr - phdr->p_vaddr;
}
}
-
+
+ if (real_entry)
+ entry = real_entry;
+
return grub_errno;
}
@@ -164,6 +172,7 @@
{
Elf64_Ehdr *ehdr = (Elf64_Ehdr *) buffer;
Elf64_Phdr *phdr;
+ grub_addr_t real_entry = 0;
int i;
if (ehdr->e_ident[EI_CLASS] != ELFCLASS64)
@@ -226,9 +235,16 @@
+ phdr->p_filesz),
0,
phdr->p_memsz - phdr->p_filesz);
+
+ if ((entry >= phdr->p_vaddr) &&
+ (entry < phdr->p_vaddr + phdr->p_memsz))
+ real_entry = entry + phdr->p_paddr - phdr->p_vaddr;
}
}
-
+
+ if (real_entry)
+ entry = real_entry;
+
return grub_errno;
}
@@ -306,6 +322,8 @@
if (! mbi)
goto fail;
+ grub_memset (mbi, 0, sizeof (struct grub_multiboot_info));
+
mbi->flags = MULTIBOOT_INFO_MEMORY;
/* Convert from bytes to kilobytes. */
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: multiboot2 vs. grub2 implementation
2008-02-06 1:23 ` walt
@ 2008-02-06 12:14 ` Robert Millan
2008-02-06 15:18 ` Bean
0 siblings, 1 reply; 8+ messages in thread
From: Robert Millan @ 2008-02-06 12:14 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, Feb 05, 2008 at 05:23:44PM -0800, walt wrote:
>
> On Tue, 2008-02-05 at 14:23 -0600, jakllsch@kollasch.net wrote:
> > On Sun, Feb 03, 2008 at 09:11:23AM -0800, walt wrote:
> > > jakllsch@kollasch.net wrote:
> > >> Hi,
> > >>
> > >> In the course of actually trying to use the MultibootDraft, I've
> > >> discovered
> > >> some places where the draft and the grub2 implementation differ...
> > >
> > > Hi Jonathan,
> > >
> > > Are you using grub2/cvs with or without Bean's latest multiboot patch?
> >
> > I tend not to be aware of these things. I'm using stock sources.
> >
> > > It still hasn't been committed, and I was about to ask about it anyway.
> > > Without that patch, multiboot doesn't work.
> >
> > Hmm.
>
> Agreed :o) Bean's patch had some whitespace corruption anyway, so here
> it is again, diffed against today's latest cvs grub2:
If you just fixed whitespace, it is better if we just use patch -l or Bean
fixes it. Otherwise it means more paperwork and legal stuff :-/
Bean, where you going to commit that patch?
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: multiboot2 vs. grub2 implementation
2008-02-06 12:14 ` Robert Millan
@ 2008-02-06 15:18 ` Bean
2008-02-06 15:33 ` Robert Millan
0 siblings, 1 reply; 8+ messages in thread
From: Bean @ 2008-02-06 15:18 UTC (permalink / raw)
To: The development of GRUB 2
On Feb 6, 2008 8:14 PM, Robert Millan <rmh@aybabtu.com> wrote:
> On Tue, Feb 05, 2008 at 05:23:44PM -0800, walt wrote:
> >
> > On Tue, 2008-02-05 at 14:23 -0600, jakllsch@kollasch.net wrote:
> > > On Sun, Feb 03, 2008 at 09:11:23AM -0800, walt wrote:
> > > > jakllsch@kollasch.net wrote:
> > > >> Hi,
> > > >>
> > > >> In the course of actually trying to use the MultibootDraft, I've
> > > >> discovered
> > > >> some places where the draft and the grub2 implementation differ...
> > > >
> > > > Hi Jonathan,
> > > >
> > > > Are you using grub2/cvs with or without Bean's latest multiboot patch?
> > >
> > > I tend not to be aware of these things. I'm using stock sources.
> > >
> > > > It still hasn't been committed, and I was about to ask about it anyway.
> > > > Without that patch, multiboot doesn't work.
> > >
> > > Hmm.
> >
> > Agreed :o) Bean's patch had some whitespace corruption anyway, so here
> > it is again, diffed against today's latest cvs grub2:
>
> If you just fixed whitespace, it is better if we just use patch -l or Bean
> fixes it. Otherwise it means more paperwork and legal stuff :-/
>
> Bean, where you going to commit that patch?
if the patch is ok, i can check it in.
--
Bean
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: multiboot2 vs. grub2 implementation
2008-02-06 15:18 ` Bean
@ 2008-02-06 15:33 ` Robert Millan
0 siblings, 0 replies; 8+ messages in thread
From: Robert Millan @ 2008-02-06 15:33 UTC (permalink / raw)
To: The development of GRUB 2
On Wed, Feb 06, 2008 at 11:18:10PM +0800, Bean wrote:
> On Feb 6, 2008 8:14 PM, Robert Millan <rmh@aybabtu.com> wrote:
> > On Tue, Feb 05, 2008 at 05:23:44PM -0800, walt wrote:
> > >
> > > On Tue, 2008-02-05 at 14:23 -0600, jakllsch@kollasch.net wrote:
> > > > On Sun, Feb 03, 2008 at 09:11:23AM -0800, walt wrote:
> > > > > jakllsch@kollasch.net wrote:
> > > > >> Hi,
> > > > >>
> > > > >> In the course of actually trying to use the MultibootDraft, I've
> > > > >> discovered
> > > > >> some places where the draft and the grub2 implementation differ...
> > > > >
> > > > > Hi Jonathan,
> > > > >
> > > > > Are you using grub2/cvs with or without Bean's latest multiboot patch?
> > > >
> > > > I tend not to be aware of these things. I'm using stock sources.
> > > >
> > > > > It still hasn't been committed, and I was about to ask about it anyway.
> > > > > Without that patch, multiboot doesn't work.
> > > >
> > > > Hmm.
> > >
> > > Agreed :o) Bean's patch had some whitespace corruption anyway, so here
> > > it is again, diffed against today's latest cvs grub2:
> >
> > If you just fixed whitespace, it is better if we just use patch -l or Bean
> > fixes it. Otherwise it means more paperwork and legal stuff :-/
> >
> > Bean, where you going to commit that patch?
>
> if the patch is ok, i can check it in.
Ok I just replied in the other thread.
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: multiboot2 vs. grub2 implementation
2008-02-03 16:39 multiboot2 vs. grub2 implementation jakllsch
2008-02-03 17:11 ` walt
@ 2008-02-06 16:48 ` Robert Millan
1 sibling, 0 replies; 8+ messages in thread
From: Robert Millan @ 2008-02-06 16:48 UTC (permalink / raw)
To: The development of GRUB 2
On Sun, Feb 03, 2008 at 10:39:33AM -0600, jakllsch@kollasch.net wrote:
> Hi,
>
> In the course of actually trying to use the MultibootDraft, I've discovered
> some places where the draft and the grub2 implementation differ.
>
> * Multiboot Information Tags
> * Start Tag
> The Draft says key is 0x0000, grub2 says 0x0001.
> * Boot Loader Name tag is different
> The Draft says 0x0001, grub2 says 0x0002.
> * Module/Kernel Tags
> These tags seem to have different keys and different data formats
> than the draft indicates.
> * Memory Map Tag
> Does not seem to be implemented.
Bean just committed his fix. Please, can you check if this addressed all
the discordances?
> The entry physical address field [...]
I think that was fixed as well. Could you check?
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-02-06 17:22 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-03 16:39 multiboot2 vs. grub2 implementation jakllsch
2008-02-03 17:11 ` walt
2008-02-05 20:23 ` jakllsch
2008-02-06 1:23 ` walt
2008-02-06 12:14 ` Robert Millan
2008-02-06 15:18 ` Bean
2008-02-06 15:33 ` Robert Millan
2008-02-06 16:48 ` Robert Millan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.