@ -1,5 +1,7 @@
From 5956108606151925c6a0709e7dac08981c0d8990 Mon Sep 17 00:00:00 2001
Subject: [PATCH 17/22] use_fallback(): platform-independent part
From db4da17916cbeed002e4fa8422ed2cdd82b3b26f Mon Sep 17 00:00:00 2001
From: Your Name <you@example.com>
Date: Thu, 2 Dec 2021 23:39:00 -0800
Subject: [PATCH] use_fallback(): platform-independent part
This commit implements the platform-independent part of a two-image
fallback system.
@ -22,7 +24,7 @@ since the romcc version of the CBFS-walking routine does not
understand FMAP partitions. This means that the `cmos.layout` from
the FALLBACK region is used for the majority of the boot process.
---
Makefile.inc | 2 + -
Makefile.inc | 5 +++- -
src/drivers/pc80/rtc/mc146818rtc.c | 9 +++++++--
src/include/bootblock_common.h | 4 ++++
src/lib/bootblock.c | 1 +
@ -30,10 +32,10 @@ the FALLBACK region is used for the majority of the boot process.
src/lib/prog_loaders.c | 6 +++++-
util/cbfstool/cbfs_sections.h | 2 +-
util/scripts/dts-to-fmd.sh | 6 +++---
8 files changed, 29 insertions(+), 10 deletions(-)
8 files changed, 31 insertions(+), 11 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 44c58be5b7 ..29b348d158 100644
index 44c58be5b7 8..fde7511ee82 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -727,7 +727,7 @@ extract_nth=$(subst *,$(spc),$(patsubst -%-,%,$(word $(1), $(subst |,- -,-$(2)-)
@ -45,8 +47,18 @@ index 44c58be5b7..29b348d158 100644
ifeq ($(CONFIG_CBFS_AUTOGEN_ATTRIBUTES),y)
cbfs-autogen-attributes=-g
@@ -999,7 +999,8 @@ else # ifeq ($(CONFIG_ARCH_X86),y)
-b -4
rm -f $@.tmp.2
endif # ifeq ($(CONFIG_ARCH_X86),y)
- $(CBFSTOOL) $@.tmp add-master-header $(TS_OPTIONS)
+ $(CBFSTOOL) $@.tmp add-master-header -rNORMAL $(TS_OPTIONS)
+ $(CBFSTOOL) $@.tmp add-master-header -rFALLBACK $(TS_OPTIONS)
$(prebuild-files) true
mv $@.tmp $@
else # ifneq ($(CONFIG_UPDATE_IMAGE),y)
diff --git a/src/drivers/pc80/rtc/mc146818rtc.c b/src/drivers/pc80/rtc/mc146818rtc.c
index 3b22a46298..ef1ef7a275 100644
index 3b22a46298 b ..ef1ef7a275b 100644
--- a/src/drivers/pc80/rtc/mc146818rtc.c
+++ b/src/drivers/pc80/rtc/mc146818rtc.c
@@ -250,9 +250,14 @@ static enum cb_err locate_cmos_layout(struct region_device *rdev)
@ -67,7 +79,7 @@ index 3b22a46298..ef1ef7a275 100644
printk(BIOS_ERR, "RTC: cmos_layout.bin could not be found. "
"Options are disabled\n");
diff --git a/src/include/bootblock_common.h b/src/include/bootblock_common.h
index 7af0cebe63 ..21a5efee90 100644
index 7af0cebe63 3 ..21a5efee901 100644
--- a/src/include/bootblock_common.h
+++ b/src/include/bootblock_common.h
@@ -21,6 +21,9 @@
@ -89,7 +101,7 @@ index 7af0cebe63..21a5efee90 100644
/*
* C code entry point for the boot block.
diff --git a/src/lib/bootblock.c b/src/lib/bootblock.c
index f2ada522eb ..890c19f316 100644
index f2ada522eb 5 ..890c19f3160 100644
--- a/src/lib/bootblock.c
+++ b/src/lib/bootblock.c
@@ -28,6 +28,7 @@ __weak void bootblock_mainboard_early_init(void) { /* no-op */ }
@ -101,7 +113,7 @@ index f2ada522eb..890c19f316 100644
asmlinkage void bootblock_main_with_timestamp(uint64_t base_timestamp,
struct timestamp_entry *timestamps, size_t num_timestamps)
diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c
index a5c9f85238 ..076ff1a8a9 100644
index a5c9f85238 6 ..076ff1a8a97 100644
--- a/src/lib/cbfs.c
+++ b/src/lib/cbfs.c
@@ -26,6 +26,7 @@
@ -135,7 +147,7 @@ index a5c9f85238..076ff1a8a9 100644
/* Find location of header using signed 32-bit offset from
* end of CBFS region. */
diff --git a/src/lib/prog_loaders.c b/src/lib/prog_loaders.c
index a9c9addbc6 ..10b5746e38 100644
index a9c9addbc6 0 ..10b5746e384 100644
--- a/src/lib/prog_loaders.c
+++ b/src/lib/prog_loaders.c
@@ -30,6 +30,7 @@
@ -159,7 +171,7 @@ index a9c9addbc6..10b5746e38 100644
cbfsf_file_type(&file, &prog->cbfs_type);
diff --git a/util/cbfstool/cbfs_sections.h b/util/cbfstool/cbfs_sections.h
index 3526f8d94c ..fe2011cbb3 100644
index 3526f8d94c 3 ..fe2011cbb34 100644
--- a/util/cbfstool/cbfs_sections.h
+++ b/util/cbfstool/cbfs_sections.h
@@ -21,7 +21,7 @@
@ -172,7 +184,7 @@ index 3526f8d94c..fe2011cbb3 100644
#define SECTION_ANNOTATION_CBFS "CBFS"
diff --git a/util/scripts/dts-to-fmd.sh b/util/scripts/dts-to-fmd.sh
index b468b35bcd ..6a02293302 100755
index b468b35bcd 7 ..6a02293302 2 100755
--- a/util/scripts/dts-to-fmd.sh
+++ b/util/scripts/dts-to-fmd.sh
@@ -91,9 +91,9 @@ for region in $FMAP_REGIONS; do
@ -197,5 +209,5 @@ index b468b35bcd..6a02293302 100755
printf "\n${PREFIX}BOOTBLOCK@0 128K"
LOCAL_REGION_START=$(( ${LOCAL_REGION_START} + 128*1024 ))
--
2.36 .1
2.39 .1