Yes,I want to an initrd as big as possible on the service where ram size is large.
It seems good for initrd size between 0x37feffff-0x7fffffff(2GB).But the grub
seems it is against that.
1、BIOS in legacy mode :
I can load a 1.75G image-initrd in the x86_64 system and the linux boot normal. In my experiment, the image-initrd of size is n 0x37feffff-0x7fffffff(2GB)
boot normal.
The limit value 0x7fffffff is that grub_read_file uses the len is singed int when I use the BIOS in legacy mode to boot linux.
I see that 0x37ffffff(896M) is a line between the normal zone and highmem zone in the 32-bit system. The grub is 32-bit mode and the linux change the 32-bit to 64-bit. So is the reason the grub set GRUB_LINUX_INITRD_MAX_ADDRESS =0x37FFFFFF because grub and kernel need 32-bit mode?
I know I have enough ram size and 64-bit kernel , so can I set GRUB_LINUX_INITRD_MAX_ADDRESS =0x7FFFFFFF ?
if (grub_le_to_cpu16 (linux_params.version) >= 0x0203)
{
addr_max = grub_cpu_to_le32 (linux_params.initrd_addr_max);
/* XXX in reality, Linux specifies a bogus value, so
it is necessary to make sure that ADDR_MAX does not exceed
0x3fffffff. */
if (addr_max > GRUB_LINUX_INITRD_MAX_ADDRESS)
addr_max = GRUB_LINUX_INITRD_MAX_ADDRESS;
else
addr_max = GRUB_LINUX_INITRD_MAX_ADDRESS;
if (linux_mem_size != 0 && linux_mem_size < addr_max)
addr_max = linux_mem_size;
/* Linux 2.3.xx has a bug in the memory range check, so avoid
the last page.
Linux 2.2.xx has a bug in the memory range check, which is
worse than that of Linux 2.3.xx, so avoid the last 64kb. */
addr_max -= 0x10000;
32-bit system:
DMA zone 0-16M
Normal zone:16M-896M
highmenm zone :896M-1G
2、Does EFI support the 64-bit boot protocol?
UEFI boot:
It seems that the grub2.02 is 64-bit because the grub support 64-bit data. The function of grub_read_file can read the file above 2GB.
when I use a 2G image-initrd ,it boots normal. But when I use a 3G image-initrd, it shows "error: out of memory".
So is it a limit in malloc_in_rang function?