mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [ptxdist] [PATCH 7/7] u-boot: allow generation of boot script
Date: Wed, 10 Oct 2018 14:03:38 +0200	[thread overview]
Message-ID: <20181010120338.2717-7-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20181010120338.2717-1-a.fatoum@pengutronix.de>

U-Boot can be configured via the environment to look for a boot script
in the rootfs. The boot script can then be used to customize the booting
process further.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 platforms/u-boot.in | 18 ++++++++++++++++++
 rules/u-boot.make   | 21 +++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/platforms/u-boot.in b/platforms/u-boot.in
index 4e19d09c74f5..12ab139e2391 100644
--- a/platforms/u-boot.in
+++ b/platforms/u-boot.in
@@ -62,6 +62,24 @@ config U_BOOT_ENV_FLASH_REDUNDANT
 
 endif
 
+config U_BOOT_BOOT_SCRIPT
+	prompt "Compile U-Boot boot script"
+	bool
+	help
+	  Use U-Boot's mkimage to compile a U-Boot boot script and install it
+	  into the rootfs
+
+if U_BOOT_BOOT_SCRIPT
+
+config U_BOOT_BOOT_SCRIPT_ROOTFS_PATH
+	string
+	default "/boot/uboot.scr"
+	prompt "Installation path"
+	help
+	  Target rootfs path where the U-Boot script should be located
+
+endif
+
 comment "target install"
 
 config U_BOOT_INSTALL_SREC
diff --git a/rules/u-boot.make b/rules/u-boot.make
index 39228dbcaf9c..2f8c60e1809e 100644
--- a/rules/u-boot.make
+++ b/rules/u-boot.make
@@ -2,6 +2,7 @@
 #
 # Copyright (C) 2007 by Sascha Hauer
 #               2009, 2010 by Marc Kleine-Budde <mkl@pengutronix.de>
+#               2018 by Ahmad Fatoum <a.fatoum@pengutronix.de>
 #
 # See CREDITS for details about who has contributed to this project.
 #
@@ -35,6 +36,9 @@ U_BOOT_CONFIG	:= $(call ptx/in-platformconfigdir, \
 
 U_BOOT_ENV_TXT	:= $(call ptx/in-platformconfigdir, uboot-env.txt)
 U_BOOT_ENV_BIN	:= $(IMAGEDIR)/uboot-env.bin
+U_BOOT_BOOT_SCRIPT_TXT := $(call ptx/in-platformconfigdir, uboot.scr)
+U_BOOT_BOOT_SCRIPT_BIN := $(call remove_quotes, \
+	$(PTXCONF_U_BOOT_BOOT_SCRIPT_ROOTFS_PATH))
 
 ifdef PTXCONF_ENDIAN_BIG
 	U_BOOT_ENV_FLAGS += -b
@@ -87,6 +91,11 @@ ifdef PTXCONF_U_BOOT_ENV
 		$(U_BOOT_ENV_FLAGS) -s $(PTXCONF_U_BOOT_ENV_IMAGE_SIZE) \
 		-o $(U_BOOT_DIR)/uboot-env.bin \
 		$(U_BOOT_ENV_TXT)
+endif
+ifdef PTXCONF_U_BOOT_BOOT_SCRIPT
+	@$(U_BOOT_DIR)/tools/mkimage -T script -C none \
+		-d $(U_BOOT_BOOT_SCRIPT_TXT) \
+		$(U_BOOT_DIR)/uboot.scr
 endif
 	@$(call touch)
 
@@ -132,6 +141,18 @@ endif
 
 ifdef PTXCONF_U_BOOT_ENV
 	@install -v -D -m644 $(U_BOOT_DIR)/uboot-env.bin $(U_BOOT_ENV_BIN)
+endif
+ifdef PTXCONF_U_BOOT_BOOT_SCRIPT
+	@$(call install_init, u-boot)
+	@$(call install_fixup, u-boot, PRIORITY, optional)
+	@$(call install_fixup, u-boot, SECTION, base)
+	@$(call install_fixup, u-boot, AUTHOR, "Ahmad Fatoum <afa@pengutronix.de>")
+	@$(call install_fixup, u-boot, DESCRIPTION, "U-Boot boot script")
+
+	@$(call install_copy, u-boot, 0, 0, 0644, \
+		$(U_BOOT_DIR)/uboot.scr, $(U_BOOT_BOOT_SCRIPT_BIN))
+
+	@$(call install_finish, u-boot)
 endif
 	@$(call touch)
 
-- 
2.19.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

  parent reply	other threads:[~2018-10-10 12:03 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-10 12:03 [ptxdist] [PATCH 1/7] u-boot: specify GPL-2.0-only as LICENSE Ahmad Fatoum
2018-10-10 12:03 ` [ptxdist] [PATCH 2/7] u-boot: add support for oldconfig/menuconfig Ahmad Fatoum
2018-10-16  7:52   ` Michael Olbrich
2018-10-16  8:02     ` Alexander Dahl
2018-10-16  8:25   ` Michael Olbrich
2018-10-10 12:03 ` [ptxdist] [PATCH 3/7] u-boot: add V=$(PTXDIST_VERBOSE) to make options Ahmad Fatoum
2018-10-11  6:52   ` Alexander Dahl
2018-10-10 12:03 ` [ptxdist] [PATCH 4/7] u-boot: run install(1)/rm(1) with -v Ahmad Fatoum
2018-10-10 12:03 ` [ptxdist] [PATCH 5/7] u-boot: add u-boot{-dtb, -with-spl-pbl}.bin image installation options Ahmad Fatoum
2019-02-05  7:30   ` Alexander Dahl
2019-02-05  9:29     ` Ahmad Fatoum
2018-10-10 12:03 ` [ptxdist] [PATCH 6/7] u-boot: allow generation of custom environment binary Ahmad Fatoum
2018-10-16  8:13   ` Michael Olbrich
2018-10-16 10:58   ` Denis OSTERLAND
2018-10-16 11:27     ` Alexander Dahl
2018-10-16 12:26       ` Michael Olbrich
2018-10-16 13:13         ` Alexander Dahl
2019-04-04 14:17         ` Alexander Dahl
2018-10-16 11:20   ` Alexander Dahl
2018-10-10 12:03 ` Ahmad Fatoum [this message]
2018-10-11  6:44 ` [ptxdist] [PATCH 1/7] u-boot: specify GPL-2.0-only as LICENSE Alexander Dahl
2018-10-11  9:05   ` Ahmad Fatoum

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=20181010120338.2717-7-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=ptxdist@pengutronix.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