mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH 0/2] u-boot: boot script and series option
@ 2019-04-11 11:09 Alexander Dahl
  2019-04-11 11:09 ` [ptxdist] [PATCH 1/2] Revert "readd _SERIES option for u-boot and add it for at91bootstrap (partially reverts dac31c4)" Alexander Dahl
  2019-04-11 11:09 ` [ptxdist] [PATCH 2/2] u-boot: Allow generation of boot script Alexander Dahl
  0 siblings, 2 replies; 8+ messages in thread
From: Alexander Dahl @ 2019-04-11 11:09 UTC (permalink / raw)
  To: ptxdist; +Cc: Denis OSTERLAND, Ahmad Fatoum

Hello everyone,

for personal need I ressurected one patch by Ahmad from last year,
which did not make it to mainline, did a little polishing and resend
it again. See the notes on that patch for details what I changed.

The other patch is a long overdue revert of an option which was only
left in for me I guess. ;-)

Greets
Alex

Ahmad Fatoum (1):
  u-boot: Allow generation of boot script

Alexander Dahl (1):
  Revert "readd _SERIES option for u-boot and add it for at91bootstrap
    (partially reverts dac31c4)"

 platforms/u-boot.in | 27 ++++++++++++++++++---------
 rules/u-boot.make   | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 9 deletions(-)

-- 
2.11.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [ptxdist] [PATCH 1/2] Revert "readd _SERIES option for u-boot and add it for at91bootstrap (partially reverts dac31c4)"
  2019-04-11 11:09 [ptxdist] [PATCH 0/2] u-boot: boot script and series option Alexander Dahl
@ 2019-04-11 11:09 ` Alexander Dahl
  2019-04-11 11:09 ` [ptxdist] [PATCH 2/2] u-boot: Allow generation of boot script Alexander Dahl
  1 sibling, 0 replies; 8+ messages in thread
From: Alexander Dahl @ 2019-04-11 11:09 UTC (permalink / raw)
  To: ptxdist; +Cc: Denis OSTERLAND, Ahmad Fatoum

That broke our usecase back in 2013, but we don't need that anymore now.

This reverts commit 4b09a0c4ff4365159d7bfec6bb086743bdb39110.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
---
 platforms/u-boot.in | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/platforms/u-boot.in b/platforms/u-boot.in
index e63830171..5d04a3cbd 100644
--- a/platforms/u-boot.in
+++ b/platforms/u-boot.in
@@ -19,15 +19,6 @@ config U_BOOT_MD5
 	string
 	prompt "U-Boot source md5"
 
-config U_BOOT_SERIES
-	prompt "patch series file"
-	string
-	default "series"
-	help
-	  This entry specifies a patch series file which has to live in
-	  the u-boot patches directory. This way you can set a different
-	  series file than the default.
-
 choice
 	prompt "config system"
 	default U_BOOT_CONFIGSYSTEM_LEGACY
-- 
2.11.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [ptxdist] [PATCH 2/2] u-boot: Allow generation of boot script
  2019-04-11 11:09 [ptxdist] [PATCH 0/2] u-boot: boot script and series option Alexander Dahl
  2019-04-11 11:09 ` [ptxdist] [PATCH 1/2] Revert "readd _SERIES option for u-boot and add it for at91bootstrap (partially reverts dac31c4)" Alexander Dahl
@ 2019-04-11 11:09 ` Alexander Dahl
  2019-04-11 13:05   ` Denis OSTERLAND
  2019-04-12  7:49   ` Michael Olbrich
  1 sibling, 2 replies; 8+ messages in thread
From: Alexander Dahl @ 2019-04-11 11:09 UTC (permalink / raw)
  To: ptxdist; +Cc: Denis OSTERLAND, Ahmad Fatoum

From: Ahmad Fatoum <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.

Cc: Denis OSTERLAND <denis.osterland@diehl.com>
Co-authored-by: Alexander Dahl <ada@thorsis.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Alexander Dahl <ada@thorsis.com>
---

Notes:
    Changes from the original patch by Ahmad:
    
    * Added compile stage from patch adding precompiled U-Boot env, but
      changed compile command to '@$(call world/compile, <PKG>)' as
      suggested by Denis OSTERLAND. (That patch was not merged upstream.)
    * Changed default script filename to 'boot.scr.uimg', because this is
      one of the defaults in 'config_distro_bootcmd.h' in U-Boot. (Took me
      only half a day to find why the script was not found here.)

 platforms/u-boot.in | 18 ++++++++++++++++++
 rules/u-boot.make   | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+)

diff --git a/platforms/u-boot.in b/platforms/u-boot.in
index 5d04a3cbd..8af0c8271 100644
--- a/platforms/u-boot.in
+++ b/platforms/u-boot.in
@@ -71,6 +71,24 @@ config U_BOOT_CONFIG
 
 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/boot.scr.uimg"
+	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 55d18b97d..277216af9 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.
 #
@@ -34,6 +35,10 @@ endif
 # Prepare
 # ----------------------------------------------------------------------------
 
+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))
+
 U_BOOT_WRAPPER_BLACKLIST := \
 	TARGET_HARDEN_STACKCLASH \
 	TARGET_HARDEN_RELRO \
@@ -82,6 +87,20 @@ $(STATEDIR)/u-boot.prepare:
 endif
 
 # ----------------------------------------------------------------------------
+# Compile
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/u-boot.compile:
+	@$(call targetinfo)
+	@$(call world/compile, U_BOOT)
+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)
+
+# ----------------------------------------------------------------------------
 # Install
 # ----------------------------------------------------------------------------
 
@@ -122,6 +141,19 @@ ifdef PTXCONF_U_BOOT_INSTALL_U_BOOT_WITH_SPL_PBL
 	@install -v -D -m644 $(U_BOOT_DIR)/u-boot-with-spl-pbl.bin \
 		$(IMAGEDIR)/u-boot-with-spl-pbl.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.11.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ptxdist] [PATCH 2/2] u-boot: Allow generation of boot script
  2019-04-11 11:09 ` [ptxdist] [PATCH 2/2] u-boot: Allow generation of boot script Alexander Dahl
@ 2019-04-11 13:05   ` Denis OSTERLAND
  2019-04-12  7:49   ` Michael Olbrich
  1 sibling, 0 replies; 8+ messages in thread
From: Denis OSTERLAND @ 2019-04-11 13:05 UTC (permalink / raw)
  To: ptxdist, ada

Hi Alexander,

we have one use-case were we generate the environment binary from
compiled in environment.
We have never polished it for pxtdist upstream.
https://www.mail-archive.com/ptxdist@pengutronix.de/msg13604.html
We have polished it for buildroot, but that never got merged.
http://lists.busybox.net/pipermail/buildroot/2019-January/240632.html

Am Donnerstag, den 11.04.2019, 13:09 +0200 schrieb Alexander Dahl:
> From: Ahmad Fatoum <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.
> 
> Cc: Denis OSTERLAND <denis.osterland@diehl.com>
> Co-authored-by: Alexander Dahl <ada@thorsis.com>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> Signed-off-by: Alexander Dahl <ada@thorsis.com>
> ---
> 
> Notes:
>     Changes from the original patch by Ahmad:
>     
>     * Added compile stage from patch adding precompiled U-Boot env, but
>       changed compile command to '@$(call world/compile, <PKG>)' as
>       suggested by Denis OSTERLAND. (That patch was not merged upstream.)
>     * Changed default script filename to 'boot.scr.uimg', because this is
>       one of the defaults in 'config_distro_bootcmd.h' in U-Boot. (Took me
>       only half a day to find why the script was not found here.)
> 
>  platforms/u-boot.in | 18 ++++++++++++++++++
>  rules/u-boot.make   | 32 ++++++++++++++++++++++++++++++++
>  2 files changed, 50 insertions(+)
> 
> diff --git a/platforms/u-boot.in b/platforms/u-boot.in
> index 5d04a3cbd..8af0c8271 100644
> --- a/platforms/u-boot.in
> +++ b/platforms/u-boot.in
> @@ -71,6 +71,24 @@ config U_BOOT_CONFIG
>  
>  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/boot.scr.uimg"
> +	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 55d18b97d..277216af9 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.
>  #
> @@ -34,6 +35,10 @@ endif
>  # Prepare
>  # ----------------------------------------------------------------------------
>  
> +U_BOOT_BOOT_SCRIPT_TXT := $(call ptx/in-platformconfigdir, uboot.scr)
I think it is a little bit confusing, that text file has scr file ending,
as well as resulting binary file.

Regards Denis
> +U_BOOT_BOOT_SCRIPT_BIN := $(call remove_quotes, \
> +	$(PTXCONF_U_BOOT_BOOT_SCRIPT_ROOTFS_PATH))
> +
>  U_BOOT_WRAPPER_BLACKLIST := \
>  	TARGET_HARDEN_STACKCLASH \
>  	TARGET_HARDEN_RELRO \
> @@ -82,6 +87,20 @@ $(STATEDIR)/u-boot.prepare:
>  endif
>  
>  # ----------------------------------------------------------------------------
> +# Compile
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/u-boot.compile:
> +	@$(call targetinfo)
> +	@$(call world/compile, U_BOOT)
> +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)
> +
> +# ----------------------------------------------------------------------------
>  # Install
>  # ----------------------------------------------------------------------------
>  
> @@ -122,6 +141,19 @@ ifdef PTXCONF_U_BOOT_INSTALL_U_BOOT_WITH_SPL_PBL
>  	@install -v -D -m644 $(U_BOOT_DIR)/u-boot-with-spl-pbl.bin \
>  		$(IMAGEDIR)/u-boot-with-spl-pbl.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)
>  
>  # ----------------------------------------------------------------------------

Diehl Connectivity Solutions GmbH
Geschäftsführung: Horst Leonberger
Sitz der Gesellschaft: Nürnberg - Registergericht: Amtsgericht
Nürnberg: HRB 32315
___________________________________________________________________________________________________

Der Inhalt der vorstehenden E-Mail ist nicht rechtlich bindend. Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Informieren Sie uns bitte, wenn Sie diese E-Mail faelschlicherweise erhalten haben. Bitte loeschen Sie in diesem Fall die Nachricht.
Jede unerlaubte Form der Reproduktion, Bekanntgabe, Aenderung, Verteilung und/oder Publikation dieser E-Mail ist strengstens untersagt.
- Informationen zum Datenschutz, insbesondere zu Ihren Rechten, erhalten Sie unter https://www.diehl.com/group/de/transparenz-und-informationspflichten/

The contents of the above mentioned e-mail is not legally binding. This e-mail contains confidential and/or legally protected information. Please inform us if you have received this e-mail by
mistake and delete it in such a case. Each unauthorized reproduction, disclosure, alteration, distribution and/or publication of this e-mail is strictly prohibited. 
- For general information on data protection and your respective rights please visit https://www.diehl.com/group/en/transparency-and-information-obligations/
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ptxdist] [PATCH 2/2] u-boot: Allow generation of boot script
  2019-04-11 11:09 ` [ptxdist] [PATCH 2/2] u-boot: Allow generation of boot script Alexander Dahl
  2019-04-11 13:05   ` Denis OSTERLAND
@ 2019-04-12  7:49   ` Michael Olbrich
  2019-04-12 13:17     ` Alexander Dahl
  1 sibling, 1 reply; 8+ messages in thread
From: Michael Olbrich @ 2019-04-12  7:49 UTC (permalink / raw)
  To: ptxdist; +Cc: Denis OSTERLAND, Ahmad Fatoum

On Thu, Apr 11, 2019 at 01:09:37PM +0200, Alexander Dahl wrote:
> From: Ahmad Fatoum <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.
> 
> Cc: Denis OSTERLAND <denis.osterland@diehl.com>
> Co-authored-by: Alexander Dahl <ada@thorsis.com>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> Signed-off-by: Alexander Dahl <ada@thorsis.com>
> ---
> 
> Notes:
>     Changes from the original patch by Ahmad:
>     
>     * Added compile stage from patch adding precompiled U-Boot env, but
>       changed compile command to '@$(call world/compile, <PKG>)' as
>       suggested by Denis OSTERLAND. (That patch was not merged upstream.)
>     * Changed default script filename to 'boot.scr.uimg', because this is
>       one of the defaults in 'config_distro_bootcmd.h' in U-Boot. (Took me
>       only half a day to find why the script was not found here.)
> 
>  platforms/u-boot.in | 18 ++++++++++++++++++
>  rules/u-boot.make   | 32 ++++++++++++++++++++++++++++++++
>  2 files changed, 50 insertions(+)
> 
> diff --git a/platforms/u-boot.in b/platforms/u-boot.in
> index 5d04a3cbd..8af0c8271 100644
> --- a/platforms/u-boot.in
> +++ b/platforms/u-boot.in
> @@ -71,6 +71,24 @@ config U_BOOT_CONFIG
>  
>  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/boot.scr.uimg"
> +	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 55d18b97d..277216af9 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.
>  #
> @@ -34,6 +35,10 @@ endif
>  # Prepare
>  # ----------------------------------------------------------------------------
>  

ifdef PTXCONF_U_BOOT_BOOT_SCRIPT
> +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))

$(STATEDIR)/u-boot.compile: $(U_BOOT_BOOT_SCRIPT_TXT)
endif

While ptx/in-platformconfigdir is not as slow as ptx/get-alternative, it
should still be avoided when not needed.

Add the dependency to ensure changes are propagated.

>  U_BOOT_WRAPPER_BLACKLIST := \
>  	TARGET_HARDEN_STACKCLASH \
>  	TARGET_HARDEN_RELRO \
> @@ -82,6 +87,20 @@ $(STATEDIR)/u-boot.prepare:
>  endif
>  
>  # ----------------------------------------------------------------------------
> +# Compile
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/u-boot.compile:
> +	@$(call targetinfo)
> +	@$(call world/compile, U_BOOT)
> +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

I don't mind the name, but you could use
'$(notdir $(U_BOOT_BOOT_SCRIPT_TXT))' here and below.

Michael

> +endif
> +	@$(call touch)
> +
> +# ----------------------------------------------------------------------------
>  # Install
>  # ----------------------------------------------------------------------------
>  
> @@ -122,6 +141,19 @@ ifdef PTXCONF_U_BOOT_INSTALL_U_BOOT_WITH_SPL_PBL
>  	@install -v -D -m644 $(U_BOOT_DIR)/u-boot-with-spl-pbl.bin \
>  		$(IMAGEDIR)/u-boot-with-spl-pbl.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.11.0
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ptxdist] [PATCH 2/2] u-boot: Allow generation of boot script
  2019-04-12  7:49   ` Michael Olbrich
@ 2019-04-12 13:17     ` Alexander Dahl
  2019-04-12 14:09       ` Michael Olbrich
  0 siblings, 1 reply; 8+ messages in thread
From: Alexander Dahl @ 2019-04-12 13:17 UTC (permalink / raw)
  To: ptxdist; +Cc: Denis OSTERLAND, Michael Olbrich, Ahmad Fatoum

Hello Michael,

see my questions inline below.

Am Freitag, 12. April 2019, 09:49:18 CEST schrieb Michael Olbrich:
> On Thu, Apr 11, 2019 at 01:09:37PM +0200, Alexander Dahl wrote:
> > From: Ahmad Fatoum <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.
> > 
> > Cc: Denis OSTERLAND <denis.osterland@diehl.com>
> > Co-authored-by: Alexander Dahl <ada@thorsis.com>
> > Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> > Signed-off-by: Alexander Dahl <ada@thorsis.com>
> > ---
> > 
> > Notes:
> >     Changes from the original patch by Ahmad:
> >     
> >     * Added compile stage from patch adding precompiled U-Boot env, but
> >     
> >       changed compile command to '@$(call world/compile, <PKG>)' as
> >       suggested by Denis OSTERLAND. (That patch was not merged upstream.)
> >     
> >     * Changed default script filename to 'boot.scr.uimg', because this is
> >     
> >       one of the defaults in 'config_distro_bootcmd.h' in U-Boot. (Took me
> >       only half a day to find why the script was not found here.)
> >  
> >  platforms/u-boot.in | 18 ++++++++++++++++++
> >  rules/u-boot.make   | 32 ++++++++++++++++++++++++++++++++
> >  2 files changed, 50 insertions(+)
> > 
> > diff --git a/platforms/u-boot.in b/platforms/u-boot.in
> > index 5d04a3cbd..8af0c8271 100644
> > --- a/platforms/u-boot.in
> > +++ b/platforms/u-boot.in
> > @@ -71,6 +71,24 @@ config U_BOOT_CONFIG
> > 
> >  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/boot.scr.uimg"
> > +	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 55d18b97d..277216af9 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.
> >  #
> > 
> > @@ -34,6 +35,10 @@ endif
> > 
> >  # Prepare
> >  #
> >  ------------------------------------------------------------------------
> >  ----
> ifdef PTXCONF_U_BOOT_BOOT_SCRIPT
> 
> > +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))
> 
> $(STATEDIR)/u-boot.compile: $(U_BOOT_BOOT_SCRIPT_TXT)
> endif
> 
> While ptx/in-platformconfigdir is not as slow as ptx/get-alternative, it
> should still be avoided when not needed.
> 
> Add the dependency to ensure changes are propagated.

Makes sense.

> >  U_BOOT_WRAPPER_BLACKLIST := \
> >  
> >  	TARGET_HARDEN_STACKCLASH \
> >  	TARGET_HARDEN_RELRO \
> > 
> > @@ -82,6 +87,20 @@ $(STATEDIR)/u-boot.prepare:
> >  endif
> >  
> >  #
> >  ------------------------------------------------------------------------
> >  ----> 
> > +# Compile
> > +#
> > -------------------------------------------------------------------------
> > --- +
> > +$(STATEDIR)/u-boot.compile:
> > +	@$(call targetinfo)
> > +	@$(call world/compile, U_BOOT)
> > +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
> 
> I don't mind the name, but you could use
> '$(notdir $(U_BOOT_BOOT_SCRIPT_TXT))' here and below.

Not sure what you mean here. 'mkimage' expects the [image data file] after 
option '-d', which is the input file not just a name. And what is 'below' 
supposed to mean here?

Alex

> 
> Michael
> 
> > +endif
> > +	@$(call touch)
> > +
> > +#
> > -------------------------------------------------------------------------
> > ---> 
> >  # Install
> >  #
> >  ------------------------------------------------------------------------
> >  ----> 
> > @@ -122,6 +141,19 @@ ifdef PTXCONF_U_BOOT_INSTALL_U_BOOT_WITH_SPL_PBL
> > 
> >  	@install -v -D -m644 $(U_BOOT_DIR)/u-boot-with-spl-pbl.bin \
> >  	
> >  		$(IMAGEDIR)/u-boot-with-spl-pbl.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)
> >  
> >  #
> >  ------------------------------------------------------------------------
> >  ----



_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ptxdist] [PATCH 2/2] u-boot: Allow generation of boot script
  2019-04-12 13:17     ` Alexander Dahl
@ 2019-04-12 14:09       ` Michael Olbrich
  2019-04-12 14:17         ` Alexander Dahl
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Olbrich @ 2019-04-12 14:09 UTC (permalink / raw)
  To: ptxdist

On Fri, Apr 12, 2019 at 03:17:33PM +0200, Alexander Dahl wrote:
> Am Freitag, 12. April 2019, 09:49:18 CEST schrieb Michael Olbrich:
> > On Thu, Apr 11, 2019 at 01:09:37PM +0200, Alexander Dahl wrote:
> > >  #
> > >  ------------------------------------------------------------------------
> > >  ----> 
> > > +# Compile
> > > +#
> > > -------------------------------------------------------------------------
> > > --- +
> > > +$(STATEDIR)/u-boot.compile:
> > > +	@$(call targetinfo)
> > > +	@$(call world/compile, U_BOOT)
> > > +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
> > 
> > I don't mind the name, but you could use
> > '$(notdir $(U_BOOT_BOOT_SCRIPT_TXT))' here and below.
> 
> Not sure what you mean here. 'mkimage' expects the [image data file] after 
> option '-d', which is the input file not just a name. And what is 'below' 
> supposed to mean here?

Sorry, I mixed up the variable names. I meant:

	@$(U_BOOT_DIR)/tools/mkimage -T script -C none \
		-d $(U_BOOT_BOOT_SCRIPT_TXT) \
		$(U_BOOT_DIR)/$(notdir $(U_BOOT_BOOT_SCRIPT_BIN))

As a way to handle Denis' complaint about the same suffix for both files.
I don't really care either way. I don't know what the naming conventions
are for this.

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ptxdist] [PATCH 2/2] u-boot: Allow generation of boot script
  2019-04-12 14:09       ` Michael Olbrich
@ 2019-04-12 14:17         ` Alexander Dahl
  0 siblings, 0 replies; 8+ messages in thread
From: Alexander Dahl @ 2019-04-12 14:17 UTC (permalink / raw)
  To: ptxdist; +Cc: Denis OSTERLAND, Michael Olbrich

Hello,

Am Freitag, 12. April 2019, 16:09:56 CEST schrieb Michael Olbrich:
> On Fri, Apr 12, 2019 at 03:17:33PM +0200, Alexander Dahl wrote:
> > Am Freitag, 12. April 2019, 09:49:18 CEST schrieb Michael Olbrich:
> > > On Thu, Apr 11, 2019 at 01:09:37PM +0200, Alexander Dahl wrote:
> > > >  #
> > > >  ---------------------------------------------------------------------
> > > >  ---
> > > >  ---->
> > > > 
> > > > +# Compile
> > > > +#
> > > > ----------------------------------------------------------------------
> > > > ---
> > > > --- +
> > > > +$(STATEDIR)/u-boot.compile:
> > > > +	@$(call targetinfo)
> > > > +	@$(call world/compile, U_BOOT)
> > > > +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
> > > 
> > > I don't mind the name, but you could use
> > > '$(notdir $(U_BOOT_BOOT_SCRIPT_TXT))' here and below.
> > 
> > Not sure what you mean here. 'mkimage' expects the [image data file] after
> > option '-d', which is the input file not just a name. And what is 'below'
> > supposed to mean here?
> 
> Sorry, I mixed up the variable names. I meant:
> 
> 	@$(U_BOOT_DIR)/tools/mkimage -T script -C none \
> 		-d $(U_BOOT_BOOT_SCRIPT_TXT) \
> 		$(U_BOOT_DIR)/$(notdir $(U_BOOT_BOOT_SCRIPT_BIN))
> 
> As a way to handle Denis' complaint about the same suffix for both files.
> I don't really care either way. I don't know what the naming conventions
> are for this.

Ah I had overlooked that comment. It's not that bad, this image goes to build-
target and is copied over in targetinstall as a final step. But if being 
pedantic, it should be called e.g. 'boot.scr.uimg' in build-target, too.

Okay, I will cover that in v2 next week. Thanks for your feedback.

Have a nice weekend
Alex


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-04-12 14:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-11 11:09 [ptxdist] [PATCH 0/2] u-boot: boot script and series option Alexander Dahl
2019-04-11 11:09 ` [ptxdist] [PATCH 1/2] Revert "readd _SERIES option for u-boot and add it for at91bootstrap (partially reverts dac31c4)" Alexander Dahl
2019-04-11 11:09 ` [ptxdist] [PATCH 2/2] u-boot: Allow generation of boot script Alexander Dahl
2019-04-11 13:05   ` Denis OSTERLAND
2019-04-12  7:49   ` Michael Olbrich
2019-04-12 13:17     ` Alexander Dahl
2019-04-12 14:09       ` Michael Olbrich
2019-04-12 14:17         ` Alexander Dahl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox