Makefile.inc: Generate master header and pointer as C structs

The makefiles don't like cbfs file names with spaces in them so update
the file name with '_' instead of spaces. To keep the master header at
the top of cbfs, add a placeholder.

This removes the need to handle the cbfs master header in cbfstool.
This functionality will be dropped in a later CL.

On x86 reserve some space in the linker script to add the pointer.
On non-x86 generate a pointer inside a C struct file.

As a bonus this would actually fix the master header pointer mechanism
on Intel/APL as only the bootblock inside IFWI gets memory mapped.

TESTED on thinkpad X201: SeaBIOS correctly finds the cbfs master
header.

Change-Id: I3ba01be7da1f09a8cac287751497c18cda97d293
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/59132
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index f3da503..a930663 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -393,3 +393,18 @@
 ramstage-y += uuid.c
 
 romstage-$(CONFIG_SPD_CACHE_IN_FMAP) += spd_cache.c
+
+cbfs-files-y += cbfs_master_header
+cbfs_master_header-file := cbfs_master_header.c:struct
+cbfs_master_header-type := "cbfs header"
+cbfs_master_header-position := 0
+
+ifeq ($(CONFIG_ARCH_X86),y)
+$(call src-to-obj,bootblock,$(dir)/header_pointer.c): $(obj)/fmap_config.h
+bootblock-y += master_header_pointer.c
+else
+cbfs-files-y += header_pointer
+header_pointer-file := master_header_pointer.c:struct
+header_pointer-position := -4
+header_pointer-type := "cbfs header"
+endif