mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Maik Otto <m.otto@phytec.de>
To: Roland Hieber <rhi@pengutronix.de>,
	Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v3 4/4] Makefile: add creation of signed/encrypted images for imx6, imx7, imx8
Date: Thu, 15 Aug 2019 16:14:10 +0200	[thread overview]
Message-ID: <85285ed4-d784-d86a-ce1f-28130dbc5674@phytec.de> (raw)
In-Reply-To: <20190805150753.wwg4ddliy6w43udw@pengutronix.de>

Hi Sascha and Roland,

thank you for your response.
I have create an example for the patch on basic of Rolands prototype
If the code  is ok for you, then i will rework the patch and send the
patch to the mailinglist.

diff --git a/images/Makefile.imx
b/images/Makefile.imx                          
index 42c194b..6ca4db9
100644                                                   
---
a/images/Makefile.imx                                                       

+++
b/images/Makefile.imx                                                       

@@ -2,6 +2,24
@@                                                                
 # barebox image generation Makefile for i.MX
images                            
 #
+# params: CONFIG symbol, entry point, flash header path string, board
identifier string
+define build_imx_habv4img
=                                                    
+$(eval                                                                         

+ifeq ($($(strip $(1))),
y)                                                     
+       pblb-y += $(strip
$(2))                                                 
+       CFG_$(strip $(2)).pblb.imximg = $(board)/$(strip
$(3)).imxcfg           
+       FILE_barebox-$(strip $(4)).img    = $(strip
$(2)).pblb.imximg           
+       FILE_barebox-$(strip $(4))-s.img  = $(strip
$(2)).pblb.simximg          
+       FILE_barebox-$(strip $(4))-us.img = $(strip
$(2)).pblb.usimximg         
+       FILE_barebox-$(strip $(4))-es.img = $(strip
$(2)).pblb.esimximg         
+       image-y += barebox-$(strip
$(4)).img                                    
+       image-$(CONFIG_HABV4_IMAGE_SIGNED) += barebox-$(strip
$(4))-s.img       
+       image-$(CONFIG_HABV4_IMAGE_SIGNED_USB) += barebox-$(strip
$(4))-us.img  
+       image-$(CONFIG_HABV4_IMAGE_SIGNED_ENCRYPTED) += barebox-$(strip
$(4))-es.img
+endif                                                                          

+)                                                                              

+endef                                                                          

+                                                                               

 # %.imximg - convert into i.MX
image                                           
 #
----------------------------------------------------------------             


@@ -143,10 +161,7 @@ FILE_barebox-tx53-1011.img =
start_imx53_tx53_1011.pblb.imximg
 image-$(CONFIG_MACH_TX53) +=
barebox-tx53-1011.img                             

 # ----------------------- i.MX6 based boards
---------------------------       
-pblb-$(CONFIG_MACH_REALQ7) +=
start_imx6_realq7                                
-CFG_start_imx6_realq7.pblb.imximg =
$(board)/datamodul-edm-qmx6/flash-header.imxcfg
-FILE_barebox-datamodul-edm-qmx6.img =
start_imx6_realq7.pblb.imximg            
-image-$(CONFIG_MACH_REALQ7) +=
barebox-datamodul-edm-qmx6.img                  
+$(call build_imx_habv4img, CONFIG_MACH_REALQ7, start_imx6_realq,
datamodul-edm-qmx6/flash-header.imxcfg, datamodul-edm-qmx6)

pblb-$(CONFIG_MACH_GUF_SANTARO) +=
start_imx6q_guf_santaro                     
CFG_start_imx6q_guf_santaro.pblb.imximg =
$(board)/guf-santaro/flash-header.imxcfg
@@ -423,10 +438,7 @@
CFG_start_phytec_phycore_imx6qp_som_nand_1gib.pblb.imximg =
$(board)/phytec-    som-
FILE_barebox-phytec-phycore-imx6qp-som-nand-1gib.img =
start_phytec_phycore_imx6qp_som_nand_1gib.pblb.imximg
 image-$(CONFIG_MACH_PHYTEC_SOM_IMX6) +=
barebox-phytec-phycore-imx6qp-som-nand-1gib.img
                                                                                

-pblb-$(CONFIG_MACH_PHYTEC_SOM_IMX6) +=
start_phytec_phycore_imx6q_som_emmc_1gib
-CFG_start_phytec_phycore_imx6q_som_emmc_1gib.pblb.imximg =
$(board)/phytec-som-imx6/flash-header-phytec-pcm058-1gib.imxcfg
-FILE_barebox-phytec-phycore-imx6q-som-emmc-1gib.img =
start_phytec_phycore_imx6q_som_emmc_1gib.pblb.imximg
-image-$(CONFIG_MACH_PHYTEC_SOM_IMX6) +=
barebox-phytec-phycore-imx6q-som-emmc-1gib.img
+$(call build_imx_habv4img, CONFIG_MACH_PHYTEC_SOM_IMX6,
start_phytec_phycore_imx6q_som_emmc_1gib,
phytec-som-imx6/flash-header-phytec-pcm058-1gib,
phytec-phycore-imx6q-som-emmc-1gib)

pblb-$(CONFIG_MACH_PHYTEC_SOM_IMX6) +=
start_phytec_phycore_imx6q_som_emmc_2gib
CFG_start_phytec_phycore_imx6q_som_emmc_2gib.pblb.imximg =
$(board)/phytec-som-imx6/flash-header-phytec-pcm058-2gib.imxcfg

Best regards

Maik

Am 05.08.2019 um 17:07 schrieb Roland Hieber:
> On Mon, Aug 05, 2019 at 02:35:40PM +0200, Roland Hieber wrote:
>> On Mon, Aug 05, 2019 at 01:02:13PM +0200, Sascha Hauer wrote:
>>> Hi Maik,
>>>
>>> On Thu, Jul 18, 2019 at 10:02:01AM +0200, Maik Otto wrote:
>>>> add in the images/Makefile.imx the support of building for signed, usb
>>>> signed and encrypted/signed images for NXP i.MX HABV4
>>>> support for NXP i.mx6, i.mx7 and i.mx8
>>>>
>>>> Signed-off-by: Maik Otto <m.otto@phytec.de>
>>>> ---
>>>> Changes in v3:
>>>>     - nothing
>>>> Changes in v2:
>>>>     - was Patch 2/4 in v1
>>>>     - no dynamic variable, parallel building of different image types now
>>>> ---
>>>>  images/Makefile.imx | 322 +++++++++++++++++++++++++++++++++++++++++++++++++++-
>>>>  1 file changed, 321 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/images/Makefile.imx b/images/Makefile.imx
>>>> index 9a7187a..9c70703 100644
>>>> --- a/images/Makefile.imx
>>>> +++ b/images/Makefile.imx
>>>> @@ -147,216 +147,388 @@ pblb-$(CONFIG_MACH_REALQ7) += start_imx6_realq7
>>>>  CFG_start_imx6_realq7.pblb.imximg = $(board)/datamodul-edm-qmx6/flash-header.imxcfg
>>>>  FILE_barebox-datamodul-edm-qmx6.img = start_imx6_realq7.pblb.imximg
>>>>  image-$(CONFIG_MACH_REALQ7) += barebox-datamodul-edm-qmx6.img
>>>> +FILE_barebox-datamodul-edm-qmx6-s.img = start_imx6_realq7.pblb.simximg
>>>> +FILE_barebox-datamodul-edm-qmx6-us.img = start_imx6_realq7.pblb.usimximg
>>>> +FILE_barebox-datamodul-edm-qmx6-es.img = start_imx6_realq7.pblb.esimximg
>>>> +habv4image-$(CONFIG_MACH_REALQ7) += barebox-datamodul-edm-qmx6
>>> This file contains way to much boilerplate already for my taste. Adding four
>>> more lines for every board is not something I like to do.
>>>
>>> Can we add even more magic to get rid of these additional lines?
>> You mean like... (untested)
> [...]
>
> Here's a tested prototype (needed some more eval and strip):
>
> ----------------- 8< -----------------
> diff --git a/images/Makefile.imx b/images/Makefile.imx
> index 9a7187ac7807..f58c0411871d 100644
> --- a/images/Makefile.imx
> +++ b/images/Makefile.imx
> @@ -2,6 +2,19 @@
>  # barebox image generation Makefile for i.MX images
>  #
>  
> +# params: CONFIG symbol, entry point, board identifier string
> +define build_imx_img =
> +$(eval
> +pblb-$($(strip $(1))) += $(strip $(2))
> +CFG_$(strip $(2)).pblb.imximg = $(board)/$(strip $(3))/flash-header.imxcfg
> +FILE_barebox-$(strip $(3)).img    = $(strip $(2)).pblb.imximg
> +FILE_barebox-$(strip $(3))-s.img  = $(strip $(2)).pblb.simximg
> +FILE_barebox-$(strip $(3))-us.img = $(strip $(2)).pblb.usimximg
> +FILE_barebox-$(strip $(3))-es.img = $(strip $(2)).pblb.esimximg
> +image-$($(strip $(1))) += barebox-$(strip $(3)).img
> +)
> +endef
> +
>  # %.imximg - convert into i.MX image
>  # ----------------------------------------------------------------
>  
> @@ -143,15 +156,8 @@ FILE_barebox-tx53-1011.img = start_imx53_tx53_1011.pblb.imximg
>  image-$(CONFIG_MACH_TX53) += barebox-tx53-1011.img
>  
>  # ----------------------- i.MX6 based boards ---------------------------
> -pblb-$(CONFIG_MACH_REALQ7) += start_imx6_realq7
> -CFG_start_imx6_realq7.pblb.imximg = $(board)/datamodul-edm-qmx6/flash-header.imxcfg
> -FILE_barebox-datamodul-edm-qmx6.img = start_imx6_realq7.pblb.imximg
> -image-$(CONFIG_MACH_REALQ7) += barebox-datamodul-edm-qmx6.img
> -
> -pblb-$(CONFIG_MACH_GUF_SANTARO) += start_imx6q_guf_santaro
> -CFG_start_imx6q_guf_santaro.pblb.imximg = $(board)/guf-santaro/flash-header.imxcfg
> -FILE_barebox-guf-santaro.img = start_imx6q_guf_santaro.pblb.imximg
> -image-$(CONFIG_MACH_GUF_SANTARO) += barebox-guf-santaro.img
> +$(call build_imx_img, CONFIG_MACH_REALQ7, start_imx6_realq, datamodul-edm-qmx6)
> +$(call build_imx_img, CONFIG_MACH_GUF_SANTARO, start_imx6q_guf_santaro, guf-santaro)
>  
>  pblb-$(CONFIG_MACH_GK802) += start_imx6_gk802
>  CFG_start_imx6_gk802.pblb.imximg = $(board)/gk802/flash-header.imxcfg
> ----------------- 8< -----------------
>
> Depending on your thoughts regarding the other questions in my previous
> mail, I can make this into a proper patch.
>
>  - Roland
>
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2019-08-15 14:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-18  8:01 [PATCH v3 1/4] i.mx6: signed boot: add habv4-imx6-gencsf.h to the flash header of the PHYTEC boards Maik Otto
2019-07-18  8:01 ` [PATCH v3 2/4] imx6: added fit image signature to the devicetree for " Maik Otto
2019-07-18  8:02 ` [PATCH v3 3/4] Kconfig: add selection for creation of signed/encrypted HABV4 images Maik Otto
2019-07-18  8:02 ` [PATCH v3 4/4] Makefile: add creation of signed/encrypted images for imx6, imx7, imx8 Maik Otto
2019-08-05 11:02   ` Sascha Hauer
2019-08-05 12:35     ` Roland Hieber
2019-08-05 15:07       ` Roland Hieber
2019-08-15 14:14         ` Maik Otto [this message]
2019-08-19  8:28           ` Roland Hieber

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=85285ed4-d784-d86a-ce1f-28130dbc5674@phytec.de \
    --to=m.otto@phytec.de \
    --cc=barebox@lists.infradead.org \
    --cc=rhi@pengutronix.de \
    --cc=s.hauer@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