From patchwork Thu Oct 15 08:12:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1382495 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=P5M1GT43; dkim=permerror header.d=wdc.com header.i=@wdc.com header.a=rsa-sha1 header.s=dkim.wdc.com header.b=YNJc3LrW; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=P40N5F7l; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CBhqL13h6z9sTK for ; Thu, 15 Oct 2020 19:13:01 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2aQsoSZBILOBKth/CPiX6agAZZnaLrNYdSOt+1rALDg=; b=P5M1GT43jOrzdTly5ofmARcNI jd1bC1RHqr6M3GroIk8VeeNOdVJTemeUnTvB9Uj1IwkMQP6mXUHcu10A2Y+5zDwMWlJirpqUw7oQC hjzfNsWSoltIpVDHiDFIpoFw9tOuoM35dR/GclzD57canbvZTJSo/dg7M9bb2BuYd4+2k5zPUn59l mhgpYUV3//Ham0SRPDJJjMbhH+H/rK5UskhJkJcL9eYQRO9nydaSqkwAY3Eu3Me44wIKsNIbk+uwL txgNuoNYWb01wylhJ6+1tNa+ykcrOiPtm8aHZZPfZKgFYH6080/CJrgKZ3ZvMO+1zsP0BXdbOeO8M azptYBDCA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kSyNc-0005Mr-EC; Thu, 15 Oct 2020 08:12:56 +0000 Received: from esa2.hgst.iphmx.com ([68.232.143.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kSyNY-0005L7-6e for opensbi@lists.infradead.org; Thu, 15 Oct 2020 08:12:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1602750005; x=1634286005; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=lF+mxsCyCbyeAEiE7NFBiOEsOzRsM+5lQCFSvWxfhm0=; b=YNJc3LrWwvGeypuzBMYb5eC4f9KWnsnjMzLd99/bpDxx3FlikqMzghf+ 7SxLDmqy3Pz8EzBbLeAWsFBvTQZqgzWB1GuudjcrOnCEFA7DKyOaB9K5X iUIiicKzoj4SoFp/ODnpEewpn2x2MMMFdtcMucCMJy8tPLcAraqYvCAWk HUebtEleUAccJhrFTnFQohaCk1NCPUSqj59o5hFwc3vLkvZom9u0zBleP dLFOYJRtsf7M/XekSxTlk9GNdncQEEgnpBo7IM6O2f8pgFut3uEtPNbi/ 3ldm/e7S0shYEqG02nrLkYOlon3/TZy3SGKGyKDTA4rsOU1DocgF1crLj g==; IronPort-SDR: g5LIfRr+88Tjh9xtp6fTU4itbWIO+wfolrLJsLr5UHSHrJ+zLAI7A3SF5U/O3FpO59fSI4NJ/U MBmA3JPw4Uri3JdUg1rgSDMPFvJ2h2i03zV0iFOu0hBLycanxetwLgC1no/4xLjTOV9iSD6g6e ffYrqEnLg+VATZTPSTz6AaZ6glqMVIl8ISJ8BUJMff61p1n8FVW4+3fiX32X2iv78RxfKydcxx JmOc5+ysRZCQA3vkE0uoDsokEucOk5I5y/CbO+Ym7EhmMGLK+QNQ1mnZXUkcA7KbqrgQqV80Et uVY= X-IronPort-AV: E=Sophos;i="5.77,378,1596470400"; d="scan'208";a="253417270" Received: from mail-mw2nam10lp2103.outbound.protection.outlook.com (HELO NAM10-MW2-obe.outbound.protection.outlook.com) ([104.47.55.103]) by ob1.hgst.iphmx.com with ESMTP; 15 Oct 2020 16:20:04 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QlgMsBn0BDHgbHFhwda0I2zQWS8GEK/wAa5RfHYcm30zU7UXCPlTfJ9/xpys8f5OAtMxpQK78UkMYYC52PNp+yZfS1p8Rog9MZYmWAGum7iP3Uaw8QsPaCIVe1MP2Bon3RUQCvXNYV7qUETzHsmvhvR7QPf/gWpFx/YllXGs6ByJGkS2reZwyIxXQXGOqpmBoQsfag3jx5u2IXnriMnABMDsfw8Ud52Aa+nlR2mUBMO9c5uMLnmFtOBRuXZu3nsHBEny3a8FqjrdJHuzc7Re8hBXI3krcp0i8h13o6KrlVc/r+BfySIsWLwT7zQzDXsEsZoVX2+RNTbUimF2c2YIZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Hx5BfvcD0S5yooWzvCy7UZcjfhkKwE6maIfNnTf/eXA=; b=kNHnP737P3d5Kvr7cWkbHKSTjWazaZ6WwfJmnLAgfDttXkyAfzxBcdoz86WDjyqjcc/Kc8pKUkMpJhEWaZwgpKBlQ4zIOjxYDUnDXyKCEQn+G96zjmaF0mNyngw5K5yy1lgEL1zagq30DTvDAUCm8Wrhq3pgPB6xxQFX6FsCupAi6jhTah/O4XVbUkQg+vEcL0mAOYkdPMyj2b6PsMSaPmHxzwTFO5TDau/9vliXbyWyDRtuOif8/TdMC7u82gt7TCejCWvZAGq4Ta5awzEIGEflPpcSdOQ1TpmuUDN3mfcOZDAoQ9eiwSc6L1Ky/0rhLIPf3Pu4hZE5+2WwiwS/XA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Hx5BfvcD0S5yooWzvCy7UZcjfhkKwE6maIfNnTf/eXA=; b=P40N5F7lDEhuzn7lEe9haSoECJ7jwaDll2h9UKQ5NUuqt/Lq5tBsscQCl8OtTfL8kPzxnXkEZMHz61ec4aMvbMtInpeh8JQ7gnceu45OeYV8GVAK3w//huDN7dBpmWb7XdADgFEXXAJnmo3bjsffiZq6Hfe0hdOFtig+rbWbcbk= Authentication-Results: wdc.com; dkim=none (message not signed) header.d=none;wdc.com; dmarc=none action=none header.from=wdc.com; Received: from DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) by DM6PR04MB5836.namprd04.prod.outlook.com (2603:10b6:5:168::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.22; Thu, 15 Oct 2020 08:12:50 +0000 Received: from DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::d035:e2c6:c11:51dd]) by DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::d035:e2c6:c11:51dd%6]) with mapi id 15.20.3477.021; Thu, 15 Oct 2020 08:12:50 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Subject: [PATCH 4/5] Makefile: Allow padding zeros when converting DTB to C source Date: Thu, 15 Oct 2020 13:42:10 +0530 Message-Id: <20201015081211.1956554-5-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201015081211.1956554-1-anup.patel@wdc.com> References: <20201015081211.1956554-1-anup.patel@wdc.com> X-Originating-IP: [122.167.44.151] X-ClientProxiedBy: MA1PR0101CA0020.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::30) To DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wdc.com (122.167.44.151) by MA1PR0101CA0020.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Thu, 15 Oct 2020 08:12:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: fcb7bbf5-1e66-4a03-a564-08d870e21b9b X-MS-TrafficTypeDiagnostic: DM6PR04MB5836: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:275; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5BNob6Vyk6CMiHbFWYkLmbHxVLJwWjaj28OYUqRoZIQbMdxM7Nw+mzlbhLXkE/dKnS5C+PQ2iG1lEFN+PHRep9sdPE8xd3nIyWzz6vV0deMkQ3b5iVMbeh/n6riQhcMBZkZt/vJgv14A2uQBNSV8IgvdHBFsbUhJg34Wn5pBRzf+fYGXDAAhvRGKs/qBeLbIs5NoYxePdaZGVtx5k6XxMPo6ZF0aAD6sxBAFQe8vlnl0lZqrDp0k7DCTVm+Q2s2qfGNx84k6tg6tOpgJEtT6FJ9TkgNH8SwiSl+SEb1JTGsokAwgapvEI0SP2AjCxFXZSodx9yO1Hvp2oboyqZ/7CvUyPLJtTZeN75lvmr4/JIeDDaHk0AgWI4fgquFW26YN X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR04MB6201.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(396003)(39860400002)(136003)(346002)(366004)(44832011)(8936002)(66946007)(36756003)(478600001)(6636002)(8676002)(2906002)(8886007)(34490700002)(110136005)(186003)(7696005)(66476007)(6666004)(86362001)(4326008)(52116002)(55016002)(1076003)(316002)(2616005)(16526019)(956004)(26005)(5660300002)(66556008)(54906003)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: DevQZ+ddf7s5HcUy1FHkIdg0lx9VO9xHIW901f9zSEvPzJrIsOnRr4aU7X+Rm0+6H/LjfUfM1OEQENOdUFRSqIXiSM1kHb2+U6hkx0e060NL5UX249tiSAbAX5xz7CznjWStWLKvrUdf1MVVHg2tzv4+Hz/J1T9ZDbQHCojfhrwuAXmIEqELkzXwvVzoABv2Ox1qTBHMbYikh047gXfTCtgMjcBbeX/sxUrDHhwbDoCAIfOghblZuSbqCXx6tF3UqT06sCZ2vBGZUkoj+0t2CH0j22qRUABr50q0gZleSOuG41wrxUH1L8e5SU3DT4iU8YggOG8o0CP91N6ehbIN2UztaF70FO0jvCF/FyRMDJBOsywprmT8eTdc3Fb8yRUxX+ja7PodzIXaj+HwtbNlJyEF3avK67cg5l/Tu///3T8IHMiS6mCnc1Zf88PxZk4euRkeD4kEyUnshyvXwWzeFQO+zmqOzJxXvna3DMCFTHlxlHcohfeMknPRkAldeJ97QaqWdkzGGQLxwvo+MA2X7S8AGIaWa2Um/NEzyMR7RrkhoR9jTbFOZnqQPfw6/30GxM7msTHcDJy0qULFqof2JpSvdpEKLKuo09z92DjRL//6XppQywv6Wg05yw8qj8Et3ss8GICf+apxHg/k0G7zWg== X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: fcb7bbf5-1e66-4a03-a564-08d870e21b9b X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2020 08:12:50.2949 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PlJXw1BRcR6irqOYMeG8tv7f90FBAIoOE5Vq3UGOrVWZLJa5BpWD0zlb2e7xCbedUplKGlPMKYCGG3EVnrtXLQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB5836 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201015_041252_375342_3B45C5E6 X-CRM114-Status: GOOD ( 14.21 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.143.124 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Damien Le Moal , Anup Patel , opensbi@lists.infradead.org, Heinrich Schuchardt Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Heinrich Schuchardt We extend d2c.sh to allow padding zeros in output C source when converting DTB to C source. Using this feature, platforms can create extra room for in-place FDT fixups on built-in DTBs. Signed-off-by: Heinrich Schuchardt Signed-off-by: Anup Patel Reviewed-by: Atish Patra --- Makefile | 7 +++++-- scripts/d2c.sh | 9 ++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 6c36f09..a231881 100644 --- a/Makefile +++ b/Makefile @@ -291,7 +291,10 @@ compile_dts = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ $(CPP) $(DTSCPPFLAGS) $(2) | $(DTC) -O dtb -i `dirname $(2)` -o $(1) compile_d2c = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " D2C $(subst $(build_dir)/,,$(1))"; \ - $(src_dir)/scripts/d2c.sh -i $(4) -a $(3) -p $(2) > $(1) + $(if $($(2)-varalign-$(3)),$(eval D2C_ALIGN_BYTES := $($(2)-varalign-$(3))),$(eval D2C_ALIGN_BYTES := $(4))) \ + $(if $($(2)-varprefix-$(3)),$(eval D2C_NAME_PREFIX := $($(2)-varprefix-$(3))),$(eval D2C_NAME_PREFIX := $(5))) \ + $(if $($(2)-padding-$(3)),$(eval D2C_PADDING_BYTES := $($(2)-padding-$(3))),$(eval D2C_PADDING_BYTES := 0)) \ + $(src_dir)/scripts/d2c.sh -i $(6) -a $(D2C_ALIGN_BYTES) -p $(D2C_NAME_PREFIX) -t $(D2C_PADDING_BYTES) > $(1) compile_gen_dep = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " GEN-DEP $(subst $(build_dir)/,,$(1))"; \ echo "$(1:.dep=$(2)): $(3)" >> $(1) @@ -361,7 +364,7 @@ $(platform_build_dir)/%.dep: $(platform_src_dir)/%.dts $(call compile_gen_dep,$@,.o,$(@:.dep=.c)) $(platform_build_dir)/%.c: $(platform_build_dir)/%.dtb - $(call compile_d2c,$@,$(platform-varprefix-$(subst .dtb,.o,$(subst /,-,$(subst $(platform_build_dir)/,,$<)))),16,$<) + $(call compile_d2c,$@,platform,$(subst .dtb,.o,$(subst /,-,$(subst $(platform_build_dir)/,,$<))),16,dt,$<) $(platform_build_dir)/%.dtb: $(platform_src_dir)/%.dts $(call compile_dts,$@,$<) diff --git a/scripts/d2c.sh b/scripts/d2c.sh index 821a995..33a3ccf 100755 --- a/scripts/d2c.sh +++ b/scripts/d2c.sh @@ -9,6 +9,7 @@ function usage() echo " -i Input binary file path" echo " -a Output C array alignment" echo " -p Output C array name prefix" + echo " -t Output padding zero bytes" exit 1; } @@ -16,8 +17,9 @@ function usage() INPUT_PATH="" OUTPUT_C_ALIGN="" OUTPUT_C_PREFIX="" +NUM_ZERO_BYTES=0 -while getopts "hi:a:p:o:" o; do +while getopts "hi:a:p:t:" o; do case "${o}" in h) usage @@ -31,6 +33,9 @@ while getopts "hi:a:p:o:" o; do p) OUTPUT_C_PREFIX=${OPTARG} ;; + t) + NUM_ZERO_BYTES=${OPTARG} + ;; *) usage ;; @@ -62,6 +67,8 @@ printf "const char __attribute__((aligned(%s))) %s_start[] = {\n" "${OUTPUT_C_AL od -v -t x1 -An ${INPUT_PATH} | awk '{for (i=1; i<=NF; i++) printf " 0x%s,", $i; printf "\n"; }' +echo __dummy__ | awk "{for (i=1; i<=${NUM_ZERO_BYTES}; i++) { printf \" 0x00,\"; if (i % 16 == 0) printf \"\n\"; } }" + printf "};\n" printf "const unsigned long %s_size = sizeof(%s_start);\n" "${OUTPUT_C_PREFIX}" "${OUTPUT_C_PREFIX}"