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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 731EDC433F5 for ; Wed, 13 Oct 2021 00:21:42 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 8E9C460724 for ; Wed, 13 Oct 2021 00:21:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8E9C460724 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 68106834C5; Wed, 13 Oct 2021 02:21:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org 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=sholland.org header.i=@sholland.org header.b="bLX2BrxE"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="gEkTwKV8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 74DD0834C5; Wed, 13 Oct 2021 02:21:36 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EEE5183230 for ; Wed, 13 Oct 2021 02:21:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=samuel@sholland.org Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id B5F365C0103; Tue, 12 Oct 2021 20:21:31 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 12 Oct 2021 20:21:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm3; bh=AXhs6ypJ5ceKZpVnyCucCjGxOz oiV+4hacHicXLlN5k=; b=bLX2BrxECRJrc/ZEmnJLGOHsuUUA/J4kRAPYN1cQ3r 2lmB+NyBl2C5ASWEuGbZieGHOzoieINI2TfnhvwyC0y1QPjA22sFfifJfQrFLy6u JyeK/0FXm8Hvtd1FxseSt2HJ6vcG/tQ0nrdEcQqKZ960j5eexnP5Sz7XPoqkDPGj nX9nUVbLywo+0jjIPAT/P987P0Y5P+bOF3OSibcz1Axewhd3u6Ch8VpaqaIlaoAR 682+dfW9+j/tpYQPx9wvkUPspXUrSGJLPmawn7HxygODTCE0ThOSXdpK3jOlviKE 6ntjzwkAnHKl7s0Y+fdW+IVGLk7mPWZHNhxthLniF1EQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=AXhs6ypJ5ceKZpVny CucCjGxOzoiV+4hacHicXLlN5k=; b=gEkTwKV8Vqa5VCMpYAgo8AP8fXgKvWSVi I/EOpZC8iyMgu/qg7/T74Bz5cuilK8YpiTvgtUpTVe32HuAW18H5zmvL6p4TenZQ jbjDTPUo6V8VeQAtAg5Z755uaH+wD9SilH5mAMebPnQi1nix1yn+fqJdHeD5pbSB +uB+Fz36HNMxaUKMqlA38KEA3IjAYeswdg0ulW7xeZkYPrx/uYKi8BelMbfUFzxJ SdSWLDtJHt964KAaE/ZrfS1wT7K20LHHdD2O8xnVXJ8ftf2fhk+HjO4H3iwVO1Hz T+nb/zbLPOb9y3ExF+AZdvhhPcH8GXBMjG3E6iMmTPmGGjwDvJEGw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddtledgfedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgvlhcu jfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtffrrg htthgvrhhnpeehteejuedttdefheetledvieeggfejudejveekueeuhedvgeehtdffgfdv keeufeenucffohhmrghinhepphgrugguihhnghdrshgunecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepshgrmhhuvghlsehshhholhhlrghnugdr ohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 12 Oct 2021 20:21:30 -0400 (EDT) From: Samuel Holland To: u-boot@lists.denx.de, Jagan Teki , Andre Przywara Cc: Samuel Holland , Jernej Skrabec , Simon Glass Subject: [PATCH] mkimage: sunxi_egon: Allow overriding the padding size Date: Tue, 12 Oct 2021 19:21:27 -0500 Message-Id: <20211013002129.29211-1-samuel@sholland.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean Due to a bug in the H3 SoC, where the CPU 0 hotplug flag cannot be written, resuming CPU 0 requires using the "Super Standby" code path in the BROM instead of the hotplug path. This path requires jumping to an eGON image in SRAM. This resume image, whose single purpose is to jump back to the secure monitor, only needs to contain a single instruction. Padding the image to 8 KiB would be wasteful of SRAM. Hook up the -B (block size) option so users can set the block/padding size. Signed-off-by: Samuel Holland --- tools/sunxi_egon.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/sunxi_egon.c b/tools/sunxi_egon.c index a5299eb6a1..d1398c07fb 100644 --- a/tools/sunxi_egon.c +++ b/tools/sunxi_egon.c @@ -10,9 +10,10 @@ /* * NAND requires 8K padding. SD/eMMC gets away with 512 bytes, - * but let's use the larger padding to cover both. + * but let's use the larger padding by default to cover both. */ #define PAD_SIZE 8192 +#define PAD_SIZE_MIN 512 static int egon_check_params(struct image_tool_params *params) { @@ -114,10 +115,12 @@ static int egon_check_image_type(uint8_t type) static int egon_vrec_header(struct image_tool_params *params, struct image_type_params *tparams) { + int pad_size = ALIGN(params->bl_len ?: PAD_SIZE, PAD_SIZE_MIN); + tparams->hdr = calloc(sizeof(struct boot_file_head), 1); - /* Return padding to 8K blocks. */ - return ALIGN(params->file_size, PAD_SIZE) - params->file_size; + /* Return padding to complete blocks. */ + return ALIGN(params->file_size, pad_size) - params->file_size; } U_BOOT_IMAGE_TYPE( -- 2.32.0