Hello,
I'm trying to get a RAMFS for my kernel.
I load my ramfs's content as a Grub module.
But the issue is that the RAMFS data get corrupted because it's loaded in between the kernel start and the kernel end addresses.
Maybe it's a problem related with the memory manager which allocates pages.
Kernel start address: 0x201000
Kernel end address: 0x21b000
RAMFS start address: 0x20d000
RAMFS end address: 0x20d081
The code is here: http://versatile.git.sourceforge.net/gi ... -index.cgi
Can someone point out where is the problem?
Thank you.
Grub and RAMFS (initrd)
Grub and RAMFS (initrd)
OS for PowerPC Macs: https://github.com/narke/Einherjar
Operating system: colorForth computing environment for x86.: https://github.com/narke/Roentgenium
Operating system: colorForth computing environment for x86.: https://github.com/narke/Roentgenium
Re: Grub and RAMFS (initrd)
Code: Select all
/** Physical pages descriptors array's address */
#define PAGE_DESCRIPTORS_ARRAY_ADDRESS \
PAGE_ALIGN_UPPER_ADDRESS((uint32) (& __e_kernel))
Code: Select all
*out_kernel_top = PAGE_DESCRIPTORS_ARRAY_ADDRESS
+ PAGE_ALIGN_UPPER_ADDRESS( (arg_ram_size >> X86_PAGE_SHIFT)
* sizeof(struct physical_page_descriptor));
If a trainstation is where trains stop, what is a workstation ?
Re: Grub and RAMFS (initrd)
Thank for your response but the RAMFS isn't placed after the kernel but between the start address and the end address of the kernel.
That's why I am confused.
That's why I am confused.
OS for PowerPC Macs: https://github.com/narke/Einherjar
Operating system: colorForth computing environment for x86.: https://github.com/narke/Roentgenium
Operating system: colorForth computing environment for x86.: https://github.com/narke/Roentgenium
Re: Grub and RAMFS (initrd)
Look at how you are calculating the end address of the kernel. Try printing & __e_kernel, PAGE_DESCRIPTORS_ARRAY_ADDRESS and out_kernel_top and you will see the answer.narke wrote:Thank for your response but the RAMFS isn't placed after the kernel but between the start address and the end address of the kernel.
That's why I am confused.
EDIT: To be more specific, the RAMFS is being placed after the kernel, but then you are putting the PAGE_DESCRIPTORS_ARRAY_ADDRESS at the end of the kernel. This means that the PAGE_DESCRIPTORS_ARRAY_ADDRESS and the RAMFS are at the same place and one overwites the other. The code that returns the out_kernel_top is returning the end of PAGE_DESCRIPTORS_ARRAY_ADDRESS array, NOT the end of kernel.
If a trainstation is where trains stop, what is a workstation ?
Re: Grub and RAMFS (initrd)
You got it right, now I am able to read the correct number of files that are present in the RAMFS passed as a module to the kernel.
Now I place the PAGE_DESCRIPTORS_ARRAY_ADDRESS after the RAMSFS end address.
Many thanks
Now I place the PAGE_DESCRIPTORS_ARRAY_ADDRESS after the RAMSFS end address.
Many thanks
OS for PowerPC Macs: https://github.com/narke/Einherjar
Operating system: colorForth computing environment for x86.: https://github.com/narke/Roentgenium
Operating system: colorForth computing environment for x86.: https://github.com/narke/Roentgenium
Re: Grub and RAMFS (initrd)
Actually it was easy to spot the bug because your physical memory manager is very similar to mine. It took less than 5 mins of browsing the source tree. It's interesting that we have a similar implementation.narke wrote:You got it right, now I am able to read the correct number of files that are present in the RAMFS passed as a module to the kernel.
Now I place the PAGE_DESCRIPTORS_ARRAY_ADDRESS after the RAMSFS end address.
Many thanks
If a trainstation is where trains stop, what is a workstation ?