From patchwork Mon Mar 30 03:56:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kever Yang X-Patchwork-Id: 1263713 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=D9lVjPWk; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48rJYn4tV1z9sPF for ; Mon, 30 Mar 2020 14:57:01 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 80BE3804CD; Mon, 30 Mar 2020 05:56:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="D9lVjPWk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 052A3818C2; Mon, 30 Mar 2020 05:56:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) (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 A885C804CD for ; Mon, 30 Mar 2020 05:56:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kever.yang@gmail.com Received: by mail-pl1-x643.google.com with SMTP id h11so6202929plk.7 for ; Sun, 29 Mar 2020 20:56:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=ayFpy4BXkT4bfWKmSPR1l7sRvDO5sSA6hjWcnMqoXzU=; b=D9lVjPWkB65o6x8BDCciUH4qw01NyY0GfNRvV2vLa6EUji67uwOUGHK4NBlZUp3Wll 9T3uIh2shqFEUFEgS/0o+xJJkJ2voNKDo15hG2K8QZoh6mNk+9Wh8syT1qwZqyxd8GaK ILgj655XhnVgpd7gPOcOwH0LP9BNnfjPDBIwnc6jgLK8mY6/GhMpydEsk5nAHTtza/Tw pTd4DvmeaO2Qwhs7LQYQH4vbGRUFbUx4j2LVLFgsS8pWJ+RyykYUAFF16jUJz8d3HOPO GHA/6G/LwtD8TAnw0STM3gNQi87YKffdnezAsECnHXhyVV48bm77Bm++4oPkN9ZV+sLK 6KFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=ayFpy4BXkT4bfWKmSPR1l7sRvDO5sSA6hjWcnMqoXzU=; b=hh3PFIN3p3dT2YQLHGd452ptZ0fEXFnPDKjyb3guGw/dfSZu13iuNBM0xc1DhYNvxC TGh9U8Mrludx06IBqWxScyc0rWsZEBNWhj6fo6vUXTKr/rpf50bd5EeI1aoXW5jgaUXR S8+vZ7eEpHlTPPrRu5RYRQHZuhoNl9bI0qeKZcP8KmStXLrnCLL0G6ZDov3ftEHiSP8W NUQm0xEMUKHKgQh84uz2caTI24XjgzogY43v69mmn1w6JZPL/J3SFg7dMjOfeBtf4Df7 yXLtT/3sCusvU1r5zhgY+Kn3opD6r2v5MXqaYkCT+bVrP8I5KJ89LTdelFeLTkH5B+Wv eTcQ== X-Gm-Message-State: ANhLgQ33nwmyiLTIBlQliKSa/eyG+sle3QycDGQPKkmFl2/bLTfziymt klvp1t+i2/i+d3FbDxAYZDTT0BgN X-Google-Smtp-Source: ADFU+vukA/jYE8i7m8iwY/63oAaryQQieB2pq+xuw4bKaygoUKHdscpk+02lDoIA6j75B1FS+LAP0Q== X-Received: by 2002:a17:90a:bb88:: with SMTP id v8mr13962252pjr.54.1585540596907; Sun, 29 Mar 2020 20:56:36 -0700 (PDT) Received: from localhost.localdomain ([103.29.142.67]) by smtp.gmail.com with ESMTPSA id n100sm8902514pjc.38.2020.03.29.20.56.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Mar 2020 20:56:36 -0700 (PDT) From: Kever Yang To: u-boot@lists.denx.de Cc: chenjh@rock-chips.com, rasmus.villemoes@prevas.dk, trini@konsulko.com, xypron.glpk@gmx.de, punit1.agrawal@toshiba.co.jp, Kever Yang , Jeffy Chen , Jordan Hand , =?utf-8?b?VmVzYSBKw6TDpHNrZWzDpGluZW4=?= Subject: [PATCH v4 3/8] tools: mkimage: use common ALIGN to do the size align Date: Mon, 30 Mar 2020 11:56:19 +0800 Message-Id: <20200330035625.25164-3-kever.yang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200330035625.25164-1-kever.yang@rock-chips.com> References: <20200330035625.25164-1-kever.yang@rock-chips.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.102.2 at phobos.denx.de X-Virus-Status: Clean The ALIGN() is now available at imagetool.h, migrate to use it. Signed-off-by: Kever Yang Reviewed-by: Punit Agrawal Reviewed-by: Tom Rini --- Changes in v4: None Changes in v3: None Changes in v2: None tools/mkimage.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/mkimage.c b/tools/mkimage.c index 5f51d2cc89..0279f6867e 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -7,6 +7,7 @@ * Wolfgang Denk, wd@denx.de */ +#include "imagetool.h" #include "mkimage.h" #include "imximage.h" #include @@ -557,8 +558,8 @@ int main(int argc, char **argv) } if (params.type == IH_TYPE_FIRMWARE_IVT) { /* Add alignment and IVT */ - uint32_t aligned_filesize = (params.file_size + 0x1000 - - 1) & ~(0x1000 - 1); + uint32_t aligned_filesize = ALIGN(params.file_size, + 0x1000); flash_header_v2_t ivt_header = { { 0xd1, 0x2000, 0x40 }, params.addr, 0, 0, 0, params.addr + aligned_filesize