[Skiboot] [PATCH 10/19] core/init.c: remove redundant calls to verify and measure BOOTKERNEL

Claudio Carvalho cclaudio at linux.vnet.ibm.com
Sun Nov 12 04:28:33 AEDT 2017


The flash driver calls libstb to verify and measure every PNOR partition
requested at boot time.

This removes redundat code from init.c used to verify and measure
BOOTKERNEL.

Signed-off-by: Claudio Carvalho <cclaudio at linux.vnet.ibm.com>
---
 core/init.c | 26 ++++----------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/core/init.c b/core/init.c
index 89a2758..8289dc9 100644
--- a/core/init.c
+++ b/core/init.c
@@ -342,10 +342,8 @@ bool start_preload_kernel(void)
 
 static bool load_kernel(void)
 {
-	void* stb_container = NULL;
 	struct elf_hdr *kh;
 	int loaded;
-	bool do_stb = false;
 
 	prlog(PR_NOTICE, "INIT: Waiting for kernel...\n");
 
@@ -368,7 +366,6 @@ static bool load_kernel(void)
 			printf("Using built-in kernel\n");
 			memmove(KERNEL_LOAD_BASE, (void*)builtin_base,
 				kernel_size);
-			do_stb = true;
 		}
 	}
 
@@ -386,21 +383,18 @@ static bool load_kernel(void)
 			memcpy(NULL, old_vectors, 0x2000);
 			sync_icache();
 		}
-		do_stb = true;
-		stb_container = kh; /* probably incorrect */
 	} else {
 		if (!kernel_size) {
 			printf("INIT: Assuming kernel at %p\n",
 			       KERNEL_LOAD_BASE);
 			/* Hack for STB in Mambo, assume at least 4kb in mem */
 			kernel_size = SECURE_BOOT_HEADERS_SIZE;
-			do_stb = true;
 		}
-		kh = (struct elf_hdr *) (KERNEL_LOAD_BASE);
-		if (stb_is_container(KERNEL_LOAD_BASE, kernel_size)) {
-			stb_container = kh;
+		if (stb_is_container(KERNEL_LOAD_BASE, kernel_size))
 			kh = (struct elf_hdr *) (KERNEL_LOAD_BASE + SECURE_BOOT_HEADERS_SIZE);
-		}
+		else
+			kh = (struct elf_hdr *) (KERNEL_LOAD_BASE);
+
 	}
 
 	prlog(PR_DEBUG,
@@ -423,18 +417,6 @@ static bool load_kernel(void)
 		return false;
 	}
 
-	if (do_stb)
-	{
-		sb_verify(RESOURCE_ID_KERNEL, stb_container,
-			  kernel_size + SECURE_BOOT_HEADERS_SIZE);
-		tb_measure(RESOURCE_ID_KERNEL, stb_container,
-			   kernel_size + SECURE_BOOT_HEADERS_SIZE);
-	}
-
-	/*
-	 * Verify and measure the retrieved PNOR partition as part of the
-	 * secure boot and trusted boot requirements
-	 */
 	stb_final();
 
 	return true;
-- 
2.7.4



More information about the Skiboot mailing list