From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4EED1C433EF for ; Tue, 21 Jun 2022 20:57:18 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9468183A0A; Tue, 21 Jun 2022 22:57:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="YK6kDtiz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9869682104; Tue, 21 Jun 2022 22:57:15 +0200 (CEST) Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 91BEB83A0A for ; Tue, 21 Jun 2022 22:57:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=alpernebiyasak@gmail.com Received: by mail-wr1-x42c.google.com with SMTP id g27so13945339wrb.10 for ; Tue, 21 Jun 2022 13:57:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=KMfuvl23svFDmo5wo+YYHy8gyisFQ45Rxwh8PkQv/ko=; b=YK6kDtizLYF5nyUBZhJft4JgaCpVODh7nwdiDCrkp+2oKeUpwm5GkO0DjX2aSlJgi4 Mvtc2Z0n++/B/tEOGCXHAH1IMSAr6r2/hN1waQrSu3JT/y8zdLgkGyE7HQg2tInCPQBu +SFU5eYCvedXCfF5rQj7iZkeU7moLiCTcNCZ7lOSZifXB9ez56JnO2MDxNoZugeovVNj nQFjCS8W9Qdq3kZ3GMblQXCB39E3aA/suo5ICXPHktajqpjgwSYJggsofonC2H0a+kRH n0/pFUkfC2g+kYBdHQtzytMjbnojNO7PgoBF2E46NNioYp9u/RcIJRl5E8JCphZFKYCN 0bfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=KMfuvl23svFDmo5wo+YYHy8gyisFQ45Rxwh8PkQv/ko=; b=wenbD8UtG4fcrGjGJFdazkuWdNXJG+/ukHQv2ngGSujKypFBVjECsd5s0lKdBf2gGw dqRlEzOLt+WP7kUO2iqfXPBQ4MzWj1TNl6k8Nyp5bjt7aMEc8GOyZTK1Nv+XO7BYJu+a GDS4eyhkT8f4HZaB9rD3OnZKjGi+vDqCr0gOv88gefWNScdbPzi0vn3WDEZDOtE5EIHR DxFwPBmjC6DXIk7HXSzr49ymTLC3SxPWm+Ll2jw2OA23cvwNrOF+HqnBMsiuf8zTeqTF Q3V3WUBkUKjTi/ZxTdQ1evsBKzIgHmoJE71QHmsD3ppmJDZcL+4Fc7XJNUaCqzoWBWa7 IUYA== X-Gm-Message-State: AJIora9BWKtPWj2S2gvgDaDbaRoJOZlqAQWKuefxxmK9+R4EVjWkxECj kFyLJCsOUOTZ5M8Vgp9qVrc= X-Google-Smtp-Source: AGRyM1ssw3VZTaWMUV1vG6VVTSrxEbn89Sin/LiB4GYmq+SaR3v0IgK8sZZIbt5bC/IiUCDh4rpwHA== X-Received: by 2002:a5d:6209:0:b0:21b:9c52:9cf1 with SMTP id y9-20020a5d6209000000b0021b9c529cf1mr2513479wru.47.1655845030908; Tue, 21 Jun 2022 13:57:10 -0700 (PDT) Received: from [192.168.0.74] ([178.233.178.185]) by smtp.gmail.com with ESMTPSA id n3-20020a5d67c3000000b0021b8cd8a068sm8214482wrw.49.2022.06.21.13.57.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Jun 2022 13:57:10 -0700 (PDT) Message-ID: Date: Tue, 21 Jun 2022 23:57:06 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH V2] imx: imx93_11x11_evk: using binman to pack images Content-Language: en-US To: "Peng Fan (OSS)" Cc: u-boot@lists.denx.de, sbabic@denx.de, festevam@gmail.com, "NXP i.MX U-Boot Team" , Peng Fan References: <20220613061309.23519-1-peng.fan@oss.nxp.com> From: Alper Nebi Yasak In-Reply-To: <20220613061309.23519-1-peng.fan@oss.nxp.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean On 13/06/2022 09:13, Peng Fan (OSS) wrote: > From: Peng Fan > > Use BINMAN to generate flash.bin > > Signed-off-by: Peng Fan > --- > > Based on > https://patchwork.ozlabs.org/project/uboot/cover/20220611132035.32698-1-peng.fan@oss.nxp.com/ > > V2: > Typo correct > > arch/arm/dts/imx93-11x11-evk-u-boot.dtsi | 2 + > arch/arm/dts/imx93-u-boot.dtsi | 84 ++++++++++++++++++++++++ > arch/arm/mach-imx/Makefile | 24 +++++++ > arch/arm/mach-imx/imx9/Kconfig | 1 + > arch/arm/mach-imx/imx9/container.cfg | 11 ++++ > arch/arm/mach-imx/imx9/imximage.cfg | 15 +++++ > board/freescale/imx93_evk/Kconfig | 6 ++ > 7 files changed, 143 insertions(+) > create mode 100644 arch/arm/dts/imx93-u-boot.dtsi > create mode 100644 arch/arm/mach-imx/imx9/container.cfg > create mode 100644 arch/arm/mach-imx/imx9/imximage.cfg > > diff --git a/arch/arm/dts/imx93-11x11-evk-u-boot.dtsi b/arch/arm/dts/imx93-11x11-evk-u-boot.dtsi > index 6f02b389893..e5912a85ca2 100644 > --- a/arch/arm/dts/imx93-11x11-evk-u-boot.dtsi > +++ b/arch/arm/dts/imx93-11x11-evk-u-boot.dtsi > @@ -3,6 +3,8 @@ > * Copyright 2022 NXP > */ > > +#include "imx93-u-boot.dtsi" > + > / { > wdt-reboot { > compatible = "wdt-reboot"; > diff --git a/arch/arm/dts/imx93-u-boot.dtsi b/arch/arm/dts/imx93-u-boot.dtsi > new file mode 100644 > index 00000000000..2b6bfd0cb44 > --- /dev/null > +++ b/arch/arm/dts/imx93-u-boot.dtsi > @@ -0,0 +1,84 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > +/* > + * Copyright 2022 NXP > + * Peng Fan > + */ > + > +/ { > + binman: binman { > + multiple-images; > + }; > +}; > + > +&binman { > + u-boot-spl-ddr { > + filename = "u-boot-spl-ddr.bin"; > + pad-byte = <0xff>; > + align-size = <4>; > + align = <4>; > + > + u-boot-spl { > + align-end = <4>; > + }; > + > + blob_1: blob-ext@1 { > + filename = "lpddr4_imem_1d_v202201.bin"; > + size = <0x8000>; > + }; > + > + blob_2: blob-ext@2 { > + filename = "lpddr4_dmem_1d_v202201.bin"; > + size = <0x4000>; > + }; > + > + blob_3: blob-ext@3 { > + filename = "lpddr4_imem_2d_v202201.bin"; > + size = <0x8000>; > + }; > + > + blob_4: blob-ext@4 { > + filename = "lpddr4_dmem_2d_v202201.bin"; > + size = <0x4000>; > + }; These look like the same kind of files as those in your i.MX8M binman symbols series. So I suggest these can be named like 'ddr-1d-imem-fw' as well. > + }; > + > + spl { > + filename = "spl.bin"; > + > + mkimage { > + args = "-n spl/u-boot-spl.cfgout -T imx8image -e 0x2049a000"; > + > + blob { > + filename = "u-boot-spl-ddr.bin"; > + }; > + }; > + }; > + > + u-boot-container { > + filename = "u-boot-container.bin"; > + > + mkimage { > + args = "-n u-boot-container.cfgout -T imx8image -e 0x0"; > + > + blob { > + filename = "u-boot.bin"; > + }; > + }; > + }; The entire thing looks similar to i.MX8M, except for this custom container. Why not a FIT image here? > + > + imx-boot { > + filename = "flash.bin"; > + pad-byte = <0x00>; > + > + spl: blob-ext@1 { > + filename = "spl.bin"; > + offset = <0x0>; > + align-size = <0x400>; > + align = <0x400>; > + }; > + > + uboot: blob-ext@2 { > + filename = "u-boot-container.bin"; > + }; > + }; > +}; > diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile > index 71ac8e6ffde..2f51226e0d9 100644 > --- a/arch/arm/mach-imx/Makefile > +++ b/arch/arm/mach-imx/Makefile > @@ -120,6 +120,9 @@ DEPFILE_EXISTS := $(shell $(CPP) $(cpp_flags) -x c -o u-boot-dtb.cfgout $(srctre > else ifeq ($(CONFIG_ARCH_IMX8M), y) > IMAGE_TYPE := imx8mimage > DEPFILE_EXISTS := 0 > +else ifeq ($(CONFIG_ARCH_IMX9), y) > +IMAGE_TYPE := imx8image > +DEPFILE_EXISTS := 0 > else > IMAGE_TYPE := imximage > DEPFILE_EXISTS := 0 > @@ -171,6 +174,27 @@ flash.bin: spl/u-boot-spl-ddr.bin u-boot.itb FORCE > $(call if_changed,mkimage) > endif > > +ifeq ($(CONFIG_ARCH_IMX9), y) > + > +SPL: spl/u-boot-spl.bin spl/u-boot-spl.cfgout u-boot-container.cfgout FORCE > + > +MKIMAGEFLAGS_flash.bin = -n spl/u-boot-spl.cfgout -T $(IMAGE_TYPE) -e $(CONFIG_SPL_TEXT_BASE) > +flash.bin: MKIMAGEOUTPUT = flash.log > + > +spl/u-boot-spl.cfgout: $(IMX_CONFIG) FORCE > + $(Q)mkdir -p $(dir $@) > + $(call if_changed_dep,cpp_cfg) > + > +spl/u-boot-spl-ddr.bin: spl/u-boot-spl.bin spl/u-boot-spl.cfgout FORCE > + > +u-boot-container.cfgout: $(IMX_CONTAINER_CFG) FORCE > + $(Q)mkdir -p $(dir $@) > + $(call if_changed_dep,cpp_cfg) > + > +flash.bin: spl/u-boot-spl-ddr.bin container.cfgout FORCE > + $(call if_changed,mkimage) > +endif > + I have a feeling these rules shouldn't be here when using binman, at least those for the files binman builds. I see similar rules for IMX8 and IMX8M too. Maybe all should check for CONFIG_BINMAN? > ifeq ($(CONFIG_ARCH_IMX8), y) > SPL: > > diff --git a/arch/arm/mach-imx/imx9/Kconfig b/arch/arm/mach-imx/imx9/Kconfig > index c06102bae07..0b965376987 100644 > --- a/arch/arm/mach-imx/imx9/Kconfig > +++ b/arch/arm/mach-imx/imx9/Kconfig > @@ -25,6 +25,7 @@ choice > config TARGET_IMX93_11X11_EVK > bool "imx93_11x11_evk" > select IMX93 > + select BINMAN > > endchoice > > diff --git a/arch/arm/mach-imx/imx9/container.cfg b/arch/arm/mach-imx/imx9/container.cfg > new file mode 100644 > index 00000000000..baaa17748ff > --- /dev/null > +++ b/arch/arm/mach-imx/imx9/container.cfg > @@ -0,0 +1,11 @@ > +/* SPDX-License-Identifier: GPL-2.0+ */ > +/* > + * Copyright 2022 NXP > + */ > + > +/* This file is to create a container image could be loaded by SPL */ > +BOOT_FROM SD 0x400 > +SOC_TYPE IMX9 > +CONTAINER > +IMAGE A55 bl31.bin 0x204E0000 > +IMAGE A55 u-boot.bin CONFIG_SYS_TEXT_BASE > diff --git a/arch/arm/mach-imx/imx9/imximage.cfg b/arch/arm/mach-imx/imx9/imximage.cfg > new file mode 100644 > index 00000000000..fae0c64245f > --- /dev/null > +++ b/arch/arm/mach-imx/imx9/imximage.cfg > @@ -0,0 +1,15 @@ > +/* SPDX-License-Identifier: GPL-2.0+ */ > +/* > + * Copyright 2022 NXP > + */ > + > +/* Boot from SD, sector size 0x400 */ > +BOOT_FROM SD 0x400 > +/* SoC type IMX9 */ > +SOC_TYPE IMX9 > +/* Append sentinel container image */ > +APPEND mx93a0-ahab-container.img I tried building for imx93_11x11_evk, but it fails because I don't have this file: ValueError: Error 1 running 'mkimage -d ./mkimage.spl.mkimage \ -n spl/u-boot-spl.cfgout -T imx8image -e 0x2049a000 \ ./mkimage-out.spl.mkimage': \ Fail open first container file mx93a0-ahab-container.img This is hard to handle because binman doesn't know that you use this file (it's only mentioned in the cfg), and can't create a 'fake' file when it's missing. Even if it did, it looks like mkimage parses this file for a header, so a fake file doesn't work... I don't know how best to solve this, I have to think more. Is the file optional? Because I see similar ahab-container.img used for some i.MX8 (only Q?) but not for i.MX8M. An imx-image binman entry type would make it easier. For example you could put the file as a blob-ext inside the imx-image entry, then imx-image could know when the blob is missing and do something else. > +/* Create the 2nd container */ > +CONTAINER > +/* Add spl with exec attribute */ > +IMAGE A55 u-boot-spl-ddr.bin 0x2049A000 > diff --git a/board/freescale/imx93_evk/Kconfig b/board/freescale/imx93_evk/Kconfig > index 032e523198d..17209d939d2 100644 > --- a/board/freescale/imx93_evk/Kconfig > +++ b/board/freescale/imx93_evk/Kconfig > @@ -16,6 +16,12 @@ config IMX93_EVK_LPDDR4X > help > Select the LPDDR4X timing and 0.6V VDDQ > > +config IMX_CONFIG > + default "arch/arm/mach-imx/imx9/imximage.cfg" > + > +config IMX_CONTAINER_CFG > + default "arch/arm/mach-imx/imx9/container.cfg" > + > source "board/freescale/common/Kconfig" > > endif