From b53a729df88a38765aac877c6656c563fc318392 Mon Sep 17 00:00:00 2001 From: Chris Olstrom Date: Fri, 12 Jun 2020 10:34:04 -0700 Subject: [PATCH 1/2] Fix undeclared constants on modern Linuxes On 2012-12-14, `E820_*` constants were moved to `asm/e820.h`. References: - https://github.com/torvalds/linux/commit/af170c5061dd78512c469e6e2d211980cdb2c193 This resolves the following build failures: ``` src/novmm/loader/linux_setup.go:25:21: error: 'E820_RAM' undeclared here (not in a function) const int E820Ram = E820_RAM; ^ src/novmm/loader/linux_setup.go:26:26: error: 'E820_RESERVED' undeclared here (not in a function) const int E820Reserved = E820_RESERVED; ^ src/novmm/loader/linux_setup.go:27:22: error: 'E820_ACPI' undeclared here (not in a function) const int E820Acpi = E820_ACPI; ^ ``` --- src/novmm/loader/linux_setup.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/novmm/loader/linux_setup.go b/src/novmm/loader/linux_setup.go index 3f2a8af..947767b 100644 --- a/src/novmm/loader/linux_setup.go +++ b/src/novmm/loader/linux_setup.go @@ -20,6 +20,7 @@ package loader #include #include #include +#include // E820 codes. const int E820Ram = E820_RAM; From b6502d6852457427624b5dd884eb4e1716750bfc Mon Sep 17 00:00:00 2001 From: Chris Olstrom Date: Fri, 12 Jun 2020 10:41:35 -0700 Subject: [PATCH 2/2] Fix struct member names on modern Linuxes On 2017-01-27, in `struct boot_params`, member `e820_map` was renamed twice, initially to `e820_array` and subsequently to `e820_table`. References: - https://github.com/torvalds/linux/commit/acd4c048728814505fae8e224cf9074bd1ad291e - https://github.com/torvalds/linux/commit/61a50101638254d38e3f4281265b44de0f2cba4e This resolves the following build failures: ``` src/novmm/loader/linux_setup.go: In function 'e820_set_region': src/novmm/loader/linux_setup.go:44:9: error: 'struct boot_params' has no member named 'e820_map' boot->e820_map[index].addr = start; ^ src/novmm/loader/linux_setup.go:45:9: error: 'struct boot_params' has no member named 'e820_map' boot->e820_map[index].size = size; ^ src/novmm/loader/linux_setup.go:46:9: error: 'struct boot_params' has no member named 'e820_map' boot->e820_map[index].type = type; ^ ``` --- src/novmm/loader/linux_setup.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/novmm/loader/linux_setup.go b/src/novmm/loader/linux_setup.go index 947767b..1083191 100644 --- a/src/novmm/loader/linux_setup.go +++ b/src/novmm/loader/linux_setup.go @@ -41,9 +41,9 @@ static inline void e820_set_region( __u64 size, __u8 type) { - boot->e820_map[index].addr = start; - boot->e820_map[index].size = size; - boot->e820_map[index].type = type; + boot->e820_table[index].addr = start; + boot->e820_table[index].size = size; + boot->e820_table[index].type = type; } static inline void set_header( struct boot_params* boot,