All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Holland <samuel@sholland.org>
To: u-boot@lists.denx.de, Jagan Teki <jagan@amarulasolutions.com>,
	Andre Przywara <andre.przywara@arm.com>
Cc: "Samuel Holland" <samuel@sholland.org>,
	"AKASHI Takahiro" <takahiro.akashi@linaro.org>,
	"Alexandru Gagniuc" <mr.nuke.me@gmail.com>,
	"Baruch Siach" <baruch@tkos.co.il>,
	"Bharat Gooty" <bharat.gooty@broadcom.com>,
	"Chris Packham" <judge.packham@gmail.com>,
	"Fabio Estevam" <festevam@gmail.com>,
	"Frieder Schrempf" <frieder.schrempf@kontron.de>,
	"Jernej Skrabec" <jernej.skrabec@siol.net>,
	"Marek Behún" <marek.behun@nic.cz>,
	"NXP i.MX U-Boot Team" <uboot-imx@nxp.com>,
	"Naoki Hayama" <naoki.hayama@lineo.co.jp>,
	"Pali Rohár" <pali@kernel.org>,
	"Patrick Delaunay" <patrick.delaunay@foss.st.com>,
	"Priyanka Jain" <priyanka.jain@nxp.com>,
	"Rayagonda Kokatanur" <rayagonda.kokatanur@broadcom.com>,
	"Simon Glass" <sjg@chromium.org>, "Stefan Roese" <sr@denx.de>,
	"Stefano Babic" <sbabic@denx.de>,
	"Sughosh Ganu" <sughosh.ganu@linaro.org>,
	"Trevor Woerner" <twoerner@gmail.com>,
	lauri.hintsala@silabs.com
Subject: [PATCH v2 4/4] sunxi: Support building a SPL as a TOC0 image
Date: Sat, 21 Aug 2021 23:46:48 -0500	[thread overview]
Message-ID: <20210822044649.13585-5-samuel@sholland.org> (raw)
In-Reply-To: <20210822044649.13585-1-samuel@sholland.org>

Now that mkimage can generate TOC0 images, and the SPL can interpret
them, hook up the build infrastructure so the user can choose which
image type to build.

Signed-off-by: Samuel Holland <samuel@sholland.org>
---

Changes in v2:
 - Rebase on top of Icenowy's RISC-V support series
 - Rename Kconfig symbols to include the full image type name

 arch/arm/mach-sunxi/Kconfig |  2 ++
 board/sunxi/Kconfig         | 24 ++++++++++++++++++++++++
 scripts/Makefile.spl        |  5 ++++-
 3 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 board/sunxi/Kconfig

diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 49f94f095c1..b0191d00808 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -1091,6 +1091,8 @@ config BLUETOOTH_DT_DEVICE_FIXUP
 	  The used address is "bdaddr" if set, and "ethaddr" with the LSB
 	  flipped elsewise.
 
+source "board/sunxi/Kconfig"
+
 endif
 
 config CHIP_DIP_SCAN
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
new file mode 100644
index 00000000000..084a8b0c6ca
--- /dev/null
+++ b/board/sunxi/Kconfig
@@ -0,0 +1,24 @@
+choice
+	prompt "SPL Image Type"
+	default SPL_IMAGE_TYPE_SUNXI_EGON
+
+config SPL_IMAGE_TYPE_SUNXI_EGON
+	bool "eGON (normal)"
+	help
+	  Select this option to embed the SPL binary in an eGON.BT0 image,
+	  which is compatible with the normal boot ROM (NBROM).
+
+	  This is usually the correct option to choose.
+
+config SPL_IMAGE_TYPE_SUNXI_TOC0
+	bool "TOC0 (secure)"
+	help
+	  Select this option to embed the SPL binary in a TOC0 image,
+	  which is compatible with the secure boot ROM (SBROM).
+
+endchoice
+
+config SPL_IMAGE_TYPE
+	string
+	default "sunxi_egon" if SPL_IMAGE_TYPE_SUNXI_EGON
+	default "sunxi_toc0" if SPL_IMAGE_TYPE_SUNXI_TOC0
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index c90d692c500..53e3ef164c6 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -414,7 +414,10 @@ endif
 $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE
 	$(call if_changed,mkimage)
 
-MKIMAGEFLAGS_sunxi-spl.bin = -A $(ARCH) -T sunxi_egon \
+MKIMAGEFLAGS_sunxi-spl.bin = \
+	-A $(ARCH) \
+	-T $(CONFIG_SPL_IMAGE_TYPE) \
+	-a $(CONFIG_SPL_TEXT_BASE) \
 	-n $(CONFIG_DEFAULT_DEVICE_TREE)
 
 OBJCOPYFLAGS_u-boot-spl-dtb.hex := -I binary -O ihex --change-address=$(CONFIG_SPL_TEXT_BASE)
-- 
2.31.1


      parent reply	other threads:[~2021-08-22  4:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-22  4:46 [PATCH v2 0/4] sunxi: TOC0 image type support Samuel Holland
2021-08-22  4:46 ` [PATCH v2 1/4] tools: Separate image types which depend on OpenSSL Samuel Holland
2021-08-22  9:58   ` Pali Rohár
2021-08-22 17:32     ` Samuel Holland
2021-08-24  0:51       ` Andre Przywara
2021-08-22  4:46 ` [PATCH v2 2/4] tools: mkimage: Add Allwinner TOC0 support Samuel Holland
2021-08-22 10:07   ` Pali Rohár
2021-08-22 17:44     ` Samuel Holland
2021-08-22 17:51       ` Pali Rohár
2021-09-06  0:29   ` Andre Przywara
2021-08-22  4:46 ` [PATCH v2 3/4] sunxi: Support SPL in both eGON and TOC0 images Samuel Holland
2021-09-06  0:30   ` Andre Przywara
2021-08-22  4:46 ` Samuel Holland [this message]

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=20210822044649.13585-5-samuel@sholland.org \
    --to=samuel@sholland.org \
    --cc=andre.przywara@arm.com \
    --cc=baruch@tkos.co.il \
    --cc=bharat.gooty@broadcom.com \
    --cc=festevam@gmail.com \
    --cc=frieder.schrempf@kontron.de \
    --cc=jagan@amarulasolutions.com \
    --cc=jernej.skrabec@siol.net \
    --cc=judge.packham@gmail.com \
    --cc=lauri.hintsala@silabs.com \
    --cc=marek.behun@nic.cz \
    --cc=mr.nuke.me@gmail.com \
    --cc=naoki.hayama@lineo.co.jp \
    --cc=pali@kernel.org \
    --cc=patrick.delaunay@foss.st.com \
    --cc=priyanka.jain@nxp.com \
    --cc=rayagonda.kokatanur@broadcom.com \
    --cc=sbabic@denx.de \
    --cc=sjg@chromium.org \
    --cc=sr@denx.de \
    --cc=sughosh.ganu@linaro.org \
    --cc=takahiro.akashi@linaro.org \
    --cc=twoerner@gmail.com \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-imx@nxp.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.