From patchwork Fri Nov 9 09:16:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 995411 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="w6hsfUA/"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42rvrb6DRyz9s8r for ; Fri, 9 Nov 2018 20:25:19 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 7CC38C2251D; Fri, 9 Nov 2018 09:20:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 6411AC223CB; Fri, 9 Nov 2018 09:17:48 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 37265C223FF; Fri, 9 Nov 2018 09:16:59 +0000 (UTC) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20068.outbound.protection.outlook.com [40.107.2.68]) by lists.denx.de (Postfix) with ESMTPS id B8F50C22344 for ; Fri, 9 Nov 2018 09:16:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mPjDBC0azBWZAGRB/PYiOyRSzvYhqCdwEAyefw+oIbg=; b=w6hsfUA/IRnPxo2URLf+8kK85ratX6dPWLIMCPrHCUojZ3fjmdEgBMuvKcaeUIOSZ0H5rInK5BjPZc3FOIj2NxxSqUosw9dTG4vAuvrfwNQ0Zv2kUEPhsyj0zx6Bs7aVGECFO1768eVV0jNoMJ2kcKr/F/a2dR3fQ933AJdKmZY= Received: from AM0PR04MB4481.eurprd04.prod.outlook.com (52.135.148.143) by AM0PR04MB5604.eurprd04.prod.outlook.com (20.178.203.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.26; Fri, 9 Nov 2018 09:16:52 +0000 Received: from AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::2cc2:9269:b873:f270]) by AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::2cc2:9269:b873:f270%3]) with mapi id 15.20.1294.034; Fri, 9 Nov 2018 09:16:52 +0000 From: Peng Fan To: "sbabic@denx.de" , Fabio Estevam Thread-Topic: [PATCH 11/15] imx: imx8mq: build flash.bin Thread-Index: AQHUeAzzZ24vwt5MdUiqi970uVgNnQ== Date: Fri, 9 Nov 2018 09:16:52 +0000 Message-ID: <20181109092408.28322-11-peng.fan@nxp.com> References: <20181109092408.28322-1-peng.fan@nxp.com> In-Reply-To: <20181109092408.28322-1-peng.fan@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.14.1 x-clientproxiedby: HK0PR03CA0041.apcprd03.prod.outlook.com (2603:1096:203:2f::29) To AM0PR04MB4481.eurprd04.prod.outlook.com (2603:10a6:208:73::15) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peng.fan@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [92.121.68.129] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR04MB5604; 6:CkedruIgeSRg5xdKV13QdhW8aAT4zq9GnwEVy0qQ5016WQzifIrcCUD8EWezFvmenEIp4YOkqUWsTJwcqBOIbFC3F+t10jyOmTh7vpKRQduP+eDcS/e5RKSIOIDWE0EJdSo9/EgngUb2SGlTyS8A1ubvkaQeVbZyRI0p8MkPTtfoPupgtvdbmgTkXR0z6oCKELgYkcvXP0MxbE99UXm0/VMfMD8giYLzLQNcJsY4aALNGwy76jbzsRybA5PFKy++SVTtxT9jgAsQ44cgyCzHOrEh1HHvQbMCKcAYXAr4fK/Q5Vad6TOPXsKMKUC93oY4PbMr2JNs3qdmePYK2Js07kkQzVYSFC57oDxPh0+F7YtXFlNgnWbqJebXgxNjeOfUE2cZ/Avsb7kar/f6PEOtoRA+xKQxRpiWxpcGLBfx/n7monwnvdU2VcMYjkYHiaQoYKAASkSMvzAR3oLl+DzJYA==; 5:pyNyqV8yRbEQIVWMTppjfdtTZYBWrr7R+pusbfBBz9qHbnmgmb1kZrxzI3l0cPDiVhkidPQpSdl0Gmlq1FwLv7tzQkfocuUQfbZkQyZY0uFd3HBlJ0zM/520WrBndqw7FoXY6hdi0P1bBus7jnlM+XnsHsX/pBh7njzYLua5vyA=; 7:neoDJbvpGJA4S0/n+uYsFD9wO7PcIH0ZVfqHWDWoYN/tUJJialQwN1blr3Ws2PRhDe0bAD85vZI2a/biqzICdeNbpUat2OgQtbuSf9a5FylxfCUCPi7qnRa3jbTemYhADECHbY7g/sSLkQIjijeHjw== x-ms-office365-filtering-correlation-id: dcfefdd2-383d-41e6-d8d4-08d6462415fc x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM0PR04MB5604; x-ms-traffictypediagnostic: AM0PR04MB5604: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231382)(944501410)(52105095)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:AM0PR04MB5604; BCL:0; PCL:0; RULEID:; SRVR:AM0PR04MB5604; x-forefront-prvs: 08512C5403 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(376002)(39860400002)(136003)(366004)(396003)(199004)(189003)(6512007)(50226002)(36756003)(53936002)(26005)(186003)(478600001)(44832011)(6636002)(68736007)(6436002)(575784001)(8936002)(6486002)(86362001)(81156014)(2616005)(11346002)(5660300001)(446003)(476003)(81166006)(8676002)(486006)(2900100001)(76176011)(14454004)(316002)(3846002)(106356001)(6116002)(7736002)(14444005)(105586002)(305945005)(54906003)(66066001)(256004)(2906002)(1076002)(99286004)(71200400001)(2501003)(102836004)(71190400001)(25786009)(386003)(97736004)(4326008)(6506007)(52116002)(110136005)(32563001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB5604; H:AM0PR04MB4481.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: nUO8RdO4zjvA9fkcSyNdJTo0lQ9+MvKE8q25jyTcLhIButg6qMFayIua9jYuekd1H+QqyOe6i6hmTq8x/O1cBL0+TVmN01XudKPvZ5R59J5L6RrFAH/XGbwzoEJ1radJM4dL8fU2udBg9UIYTeUMOdr/45wvdAJGD+ZvOaLsLvqL4KNT9ZeOo+lgBCWiS3BTw7xoqJ3yoTjBOJ4U1ehT6tbfcKICmJo0V8p9U9P7YsVXVMRcYCZYgeaPOx65w/XBxTbocxyDOoS+ipUMTtusGANeEV6XSY4Aq+hUuT1qbLQWyYq7bcUPlXBh6T3uF7EqcZIa/sG1F2H9jJf4AF2asz+9FlMZDN0AfBssv2oYbrI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: dcfefdd2-383d-41e6-d8d4-08d6462415fc X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Nov 2018 09:16:52.4355 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5604 Cc: "u-boot@lists.denx.de" , dl-linux-imx Subject: [U-Boot] [PATCH 11/15] imx: imx8mq: build flash.bin X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" Build flash.bin for i.MX8MQ, it will include signed hdmi firmware, spl, ddr firmware, fit image(bl31.bin, u-boot-nodtb.bin, dtb). Burn it to 33KB offset of SD card. Signed-off-by: Peng Fan fix flash Signed-off-by: Peng Fan --- Makefile | 3 +++ arch/arm/mach-imx/Makefile | 31 +++++++++++++++++++++++++++++++ tools/imx8m_image.sh | 30 ++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100755 tools/imx8m_image.sh diff --git a/Makefile b/Makefile index a5fbedea83..f0c0880ee8 100644 --- a/Makefile +++ b/Makefile @@ -1169,6 +1169,9 @@ tpl/u-boot-with-tpl.bin: tpl/u-boot-tpl.bin u-boot.bin FORCE SPL: spl/u-boot-spl.bin FORCE $(Q)$(MAKE) $(build)=arch/arm/mach-imx $@ +flash.bin: spl/u-boot-spl.bin u-boot.itb FORCE + $(Q)$(MAKE) $(build)=arch/arm/mach-imx $@ + u-boot-with-spl.imx u-boot-with-nand-spl.imx: SPL u-boot.bin FORCE $(Q)$(MAKE) $(build)=arch/arm/mach-imx $@ diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index 0ce8b877ad..6ad8ebed7b 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -90,6 +90,10 @@ ifeq ($(CONFIG_ARCH_IMX8), y) CNTR_DEPFILES := $(srctree)/tools/imx_cntr_image.sh IMAGE_TYPE := imx8image DEPFILE_EXISTS := $(shell $(CPP) $(cpp_flags) -x c -o u-boot-dtb.cfgout $(srctree)/$(IMX_CONFIG); if [ -f u-boot-dtb.cfgout ]; then $(CNTR_DEPFILES) u-boot-dtb.cfgout; echo $$?; fi) +else ifeq ($(CONFIG_ARCH_IMX8M), y) +IMAGE_TYPE := imx8mimage +IMX8M_DEPFILES := $(srctree)/tools/imx8m_image.sh +DEPFILE_EXISTS := $(shell $(CPP) $(cpp_flags) -x c -o spl/u-boot-spl.cfgout $(srctree)/$(IMX_CONFIG);if [ -f spl/u-boot-spl.cfgout ]; then $(IMX8M_DEPFILES) spl/u-boot-spl.cfgout; echo $$?; fi) else IMAGE_TYPE := imximage DEPFILE_EXISTS := 0 @@ -113,6 +117,32 @@ ifeq ($(DEPFILE_EXISTS),0) endif endif +ifdef CONFIG_ARM64 +ifeq ($(CONFIG_ARCH_IMX8M), y) +SPL: + +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-ddr.bin: spl/u-boot-spl.bin spl/u-boot-spl.cfgout FORCE +ifeq ($(DEPFILE_EXISTS),0) + @objcopy -I binary -O binary --pad-to 0x8000 --gap-fill=0x0 $(srctree)/lpddr4_pmu_train_1d_imem.bin lpddr4_pmu_train_1d_imem_pad.bin + @objcopy -I binary -O binary --pad-to 0x4000 --gap-fill=0x0 $(srctree)/lpddr4_pmu_train_1d_dmem.bin lpddr4_pmu_train_1d_dmem_pad.bin + @objcopy -I binary -O binary --pad-to 0x8000 --gap-fill=0x0 $(srctree)/lpddr4_pmu_train_2d_imem.bin lpddr4_pmu_train_2d_imem_pad.bin + @cat lpddr4_pmu_train_1d_imem_pad.bin lpddr4_pmu_train_1d_dmem_pad.bin > lpddr4_pmu_train_1d_fw.bin + @cat lpddr4_pmu_train_2d_imem_pad.bin lpddr4_pmu_train_2d_dmem.bin > lpddr4_pmu_train_2d_fw.bin + @cat spl/u-boot-spl.bin lpddr4_pmu_train_1d_fw.bin lpddr4_pmu_train_2d_fw.bin > spl/u-boot-spl-ddr.bin + @rm -f lpddr4_pmu_train_1d_fw.bin lpddr4_pmu_train_2d_fw.bin lpddr4_pmu_train_1d_imem_pad.bin lpddr4_pmu_train_1d_dmem_pad.bin lpddr4_pmu_train_2d_imem_pad.bin +endif + +flash.bin: spl/u-boot-spl-ddr.bin u-boot.itb FORCE +ifeq ($(DEPFILE_EXISTS),0) + $(call if_changed,mkimage) +endif +endif + +else MKIMAGEFLAGS_SPL = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \ -T $(IMAGE_TYPE) -e $(CONFIG_SPL_TEXT_BASE) SPL: MKIMAGEOUTPUT = SPL.log @@ -144,6 +174,7 @@ cmd_u-boot-nand-spl_imx = (printf '\000\000\000\000\106\103\102\040\001' && \ spl/u-boot-nand-spl.imx: SPL FORCE $(call if_changed,u-boot-nand-spl_imx) +endif targets += $(addprefix ../../../,SPL spl/u-boot-spl.cfgout u-boot-dtb.cfgout u-boot.cfgout u-boot.uim spl/u-boot-nand-spl.imx) diff --git a/tools/imx8m_image.sh b/tools/imx8m_image.sh new file mode 100755 index 0000000000..27be5683d0 --- /dev/null +++ b/tools/imx8m_image.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0+ +# +# script to check whether the file exists in imximage.cfg for i.MX8 +# +# usage: $0 + +file=$1 + +blobs=`awk '/^SIGNED_HDMI/ {print $2} /^LOADER/ {print $2} /^SECOND_LOADER/ {print $2} /^DDR_FW/ {print $2}' $file` +for f in $blobs; do + tmp=$srctree/$f + + if [ $f == "spl/u-boot-spl-ddr.bin" ] || [ $f == "u-boot.itb" ]; then + continue + fi + + if [ -f $f ]; then + continue + fi + + if [ ! -f $tmp ]; then + echo "WARNING '$tmp' not found, resulting binary is not-functional" >&2 + exit 1 + fi + + sed -in "s;$f;$tmp;" $file +done + +exit 0