From: Henry Beberman <Henry.Beberman@microsoft.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 04/11] spl: imx: Add optional lds to keep SPL entirely in on-chip RAM
Date: Sat, 14 Jul 2018 00:11:48 +0000 [thread overview]
Message-ID: <20180714001117.14584-5-hebeberm@microsoft.com> (raw)
In-Reply-To: <20180714001117.14584-1-hebeberm@microsoft.com>
From: Henry Beberman <henry.beberman@microsoft.com>
This patch is part of the i.MX Windows 10 IoT Core boot flow.
It adds a modified linker script for SPL to keep all segments in
on-chip ram. This is to harden the device against potential leaks of
device secrets by keeping them out of DRAM.
Additionally if CONFIG_SYS_SPL_MALLOC_START is defined, it will
override the CONFIG_SPL_SYS_MALLOC_SIMPLE and allocate space in DRAM
instead of on-chip ram. This patch prevents the definition of those
values for i.MX6 and i.MX7 SPL if CONFIG_OPTEE_SPL_BOOT is selected.
Signed-off-by: Henry Beberman <henry.beberman@microsoft.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
---
arch/arm/mach-imx/u-boot-spl-sram.lds | 59 +++++++++++++++++++++++++++++++++++
include/configs/imx6_spl.h | 2 ++
include/configs/imx7_spl.h | 2 ++
3 files changed, 63 insertions(+)
create mode 100644 arch/arm/mach-imx/u-boot-spl-sram.lds
diff --git a/arch/arm/mach-imx/u-boot-spl-sram.lds b/arch/arm/mach-imx/u-boot-spl-sram.lds
new file mode 100644
index 0000000000..dfbb4aef5d
--- /dev/null
+++ b/arch/arm/mach-imx/u-boot-spl-sram.lds
@@ -0,0 +1,59 @@
+/*
+ * (C) Copyright 2002
+ * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
+ *
+ * (C) Copyright 2010
+ * Texas Instruments, <www.ti.com>
+ * Aneesh V <aneesh@ti.com>
+ *
+ * (C) Copyright 2018 Microsoft Corporation
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,\
+ LENGTH = CONFIG_SPL_MAX_SIZE }
+
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(_start)
+SECTIONS
+{
+ .text :
+ {
+ __start = .;
+ *(.vectors)
+ arch/arm/cpu/armv7/start.o (.text*)
+ *(.text*)
+ } >.sram
+
+ . = ALIGN(4);
+ .rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.sram
+
+ . = ALIGN(4);
+ .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
+
+ . = ALIGN(4);
+ .u_boot_list : {
+ KEEP(*(SORT(.u_boot_list*)));
+ } >.sram
+
+ . = ALIGN(4);
+ __image_copy_end = .;
+
+ .end :
+ {
+ *(.__end)
+ }
+
+ _image_binary_end = .;
+
+ .bss :
+ {
+ . = ALIGN(4);
+ __bss_start = .;
+ *(.bss*)
+ . = ALIGN(4);
+ __bss_end = .;
+ } >.sram
+}
diff --git a/include/configs/imx6_spl.h b/include/configs/imx6_spl.h
index 720ff045a7..4088e8a936 100644
--- a/include/configs/imx6_spl.h
+++ b/include/configs/imx6_spl.h
@@ -51,6 +51,7 @@
# endif
#endif
+#ifndef CONFIG_OPTEE_SPL_BOOT
#if defined(CONFIG_MX6SX) || defined(CONFIG_MX6SL) || \
defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL)
#define CONFIG_SPL_BSS_START_ADDR 0x88200000
@@ -63,6 +64,7 @@
#define CONFIG_SYS_SPL_MALLOC_START 0x18300000
#define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000 /* 1 MB */
#endif
+#endif /* !CONFIG_OPTEE_SPL_BOOT */
#endif
#endif
diff --git a/include/configs/imx7_spl.h b/include/configs/imx7_spl.h
index 1eb6cd894d..5dd4aed652 100644
--- a/include/configs/imx7_spl.h
+++ b/include/configs/imx7_spl.h
@@ -46,10 +46,12 @@
# endif
#endif
+#ifndef CONFIG_OPTEE_SPL_BOOT
#define CONFIG_SPL_BSS_START_ADDR 0x88200000
#define CONFIG_SPL_BSS_MAX_SIZE 0x100000 /* 1 MB */
#define CONFIG_SYS_SPL_MALLOC_START 0x88300000
#define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000 /* 1 MB */
+#endif /* !CONFIG_OPTEE_SPL_BOOT */
#endif /* CONFIG_SPL */
--
2.16.2.gvfs.1.33.gf5370f1
next prev parent reply other threads:[~2018-07-14 0:11 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-14 0:11 [U-Boot] [PATCH 00/11] Enable Windows 10 IoT Core on i.MX6 and i.MX7 Henry Beberman
2018-07-14 0:11 ` [U-Boot] [PATCH 01/11] imx: Add bootcmd to load and run UEFI from mmc Henry Beberman
2018-07-16 17:16 ` Trent Piepho
2018-07-16 22:28 ` Henry Beberman
2018-07-16 22:45 ` Trent Piepho
2018-07-16 23:56 ` Henry Beberman
2018-07-17 17:24 ` Trent Piepho
2018-07-18 0:52 ` Henry Beberman
2018-07-17 17:09 ` Fabio Estevam
2018-07-17 17:20 ` Henry Beberman
2018-08-07 11:11 ` Stefano Babic
2018-08-07 11:16 ` Tom Rini
2018-08-07 13:45 ` Alexander Graf
2018-08-08 2:24 ` Henry Beberman
2018-08-15 14:46 ` Alexander Graf
2018-07-14 0:11 ` [U-Boot] [PATCH 03/11] spl: Add FIT boot into OP-TEE then U-Boot proper Henry Beberman
2018-07-14 0:11 ` [U-Boot] [PATCH 02/11] arm: Allow U-Boot Proper to run in normal world Henry Beberman
2018-07-14 0:11 ` Henry Beberman [this message]
2018-07-16 17:32 ` [U-Boot] [PATCH 04/11] spl: imx: Add optional lds to keep SPL entirely in on-chip RAM Trent Piepho
2018-07-16 22:48 ` Henry Beberman
2018-08-07 12:17 ` Stefano Babic
2018-08-08 3:22 ` Henry Beberman
2018-07-14 0:11 ` [U-Boot] [PATCH 05/11] mx6sabresd: Add Windows boot support for iMX6 Sabre Henry Beberman
2018-07-14 0:11 ` [U-Boot] [PATCH 06/11] mx7dsabresd: Add Windows boot support for iMX7 Sabre Henry Beberman
2018-07-16 18:22 ` Trent Piepho
2018-07-17 1:41 ` Henry Beberman
2018-07-17 17:02 ` Trent Piepho
2018-07-17 21:31 ` Henry Beberman
2018-07-14 0:11 ` [U-Boot] [PATCH 07/11] mx6cuboxi: Add Windows boot support for mx6cuboxi Henry Beberman
2018-07-14 0:11 ` [U-Boot] [PATCH 08/11] udoo_neo: Add Windows boot support for UDOO Neo Henry Beberman
2018-07-14 0:11 ` [U-Boot] [PATCH 09/11] cl-som-imx7: Add Windows boot support for cl-som-imx7 Henry Beberman
2018-07-14 0:11 ` [U-Boot] [PATCH 10/11] imx: Reserve a global page in memory to pass configuration to UEFI Henry Beberman
2018-07-14 0:11 ` [U-Boot] [PATCH 11/11] imx: Add MAC addresses to global page to pass MAC into UEFI Henry Beberman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180714001117.14584-5-hebeberm@microsoft.com \
--to=henry.beberman@microsoft.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox