GRUB not returning correct Module End Address???
Posted: Sun Aug 20, 2017 11:46 pm
I am trying load a initrd like file (currently just a string) via GRUB's 'module' tag.
I have located the header (the value of ebx directly after grub passes over to my kernel)
Checked the flags to make sure a modules section was included(true)
Located the module header with the number of modules and the physical location.
Located the first(and subsequent) module entries.
All this is well and good until I try to calculate the length of the module in memory.
The module start_points to the correct data(I can print a null terminated string from this), but . module_end always point module_start+4
Am I right in thinking that if I have a 10 character string + a null terminator that (0x04 module_end)=>0x0011000A
and if i include a 2nd modules
If i make the string(initrd) over 4K long the addresses progress along by 4K but the end address is still the same
From what i can tell this might be a problem with grub-mkrescue and the image that is included in my ISO though its probably something stupid i've done.
and this is my grub menu entry
where 'initrd' is a plain text file
Im stumped as I have found no reference to incorrect module_end anywhere
Thanks in advance and I can provide whatever is required
Grant
I have located the header (the value of ebx directly after grub passes over to my kernel)
Checked the flags to make sure a modules section was included(true)
Located the module header with the number of modules and the physical location.
Located the first(and subsequent) module entries.
All this is well and good until I try to calculate the length of the module in memory.
The module start_points to the correct data(I can print a null terminated string from this), but . module_end always point module_start+4
Code: Select all
Offset | MOD0 + 0x00
0x00 | 0x00110000 <- Yep Aligned on 4K...
0x04 | 0x00110004 <- eh???
0x08 | 0x00110008 <- and same again?
0x0B | 0x00000000 //zero's
and if i include a 2nd modules
Code: Select all
Offset | MOD1 + 0x10
0x00 | 0x00111000 <- Yep Aligned on 4K...
0x04 | 0x00111004 <- eh???
0x08 | 0x00111008 <- and same again?
0x0B | 0x00000000 //zero's
From what i can tell this might be a problem with grub-mkrescue and the image that is included in my ISO though its probably something stupid i've done.
Code: Select all
grub-mkrescue --version
grub-mkrescue (GRUB) 2.03
Code: Select all
multiboot /Kernel.bin
module /initrd
Im stumped as I have found no reference to incorrect module_end anywhere
Thanks in advance and I can provide whatever is required
Grant