From 99c138387d6e719f71486c6cf3a1451e3ff7697e Mon Sep 17 00:00:00 2001 From: Googulator Date: Mon, 13 Nov 2023 10:27:47 +0100 Subject: [PATCH] Increase RAM available to the bootstrap environment to 8G The kexec-fiwix part is a band-aid, since this hardcodes an additional 4GiB RAM right at the start of PAE address space. Proper fix would be passing on the real e820 memory map from BIOS. --- rootfs.py | 2 +- sysa/kexec-fiwix/src/kexec-fiwix.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/rootfs.py b/rootfs.py index 43382d51..946584c4 100755 --- a/rootfs.py +++ b/rootfs.py @@ -256,7 +256,7 @@ print(shutil.which('chroot')) system_a.prepare(create_initramfs=True, kernel_bootstrap=True) run(args.qemu_cmd, '-enable-kvm', - '-m', "4G", + '-m', "8G", '-smp', str(args.cores), '-no-reboot', '-drive', 'file=' + os.path.join(system_a.tmp_dir, 'sysa.img') + ',format=raw', diff --git a/sysa/kexec-fiwix/src/kexec-fiwix.c b/sysa/kexec-fiwix/src/kexec-fiwix.c index 54739004..a75d0448 100644 --- a/sysa/kexec-fiwix/src/kexec-fiwix.c +++ b/sysa/kexec-fiwix/src/kexec-fiwix.c @@ -123,7 +123,7 @@ int main() { /* Set memory map info */ pmultiboot_info->mmap_addr = next_avail_mem; - pmultiboot_info->mmap_length = 7 * sizeof(multiboot_memory_map_t); + pmultiboot_info->mmap_length = 8 * sizeof(multiboot_memory_map_t); multiboot_memory_map_t *pmultiboot_memory_map = (multiboot_memory_map_t *) next_avail_mem; pmultiboot_memory_map->size = sizeof(multiboot_memory_map_t) - sizeof(multiboot_uint32_t); @@ -168,6 +168,14 @@ int main() { pmultiboot_memory_map->type = MULTIBOOT_MEMORY_RESERVED; pmultiboot_memory_map++; + pmultiboot_memory_map->size = sizeof(multiboot_memory_map_t) - sizeof(multiboot_uint32_t); + pmultiboot_memory_map->addr = 1; + pmultiboot_memory_map->addr = pmultiboot_memory_map->addr << 32; + pmultiboot_memory_map->len = 1; + pmultiboot_memory_map->len = pmultiboot_memory_map->len << 32; + pmultiboot_memory_map->type = MULTIBOOT_MEMORY_AVAILABLE; + pmultiboot_memory_map++; + next_avail_mem += pmultiboot_info->mmap_length; /* Set boot loader name */