diff mbox series

[v4,3/8] tools: mkimage: use common ALIGN to do the size align

Message ID 20200330035625.25164-3-kever.yang@rock-chips.com
State Accepted
Delegated to: Tom Rini
Headers show
Series [v4,1/8] tool: Move ALIGN_MASK to header as common MACRO | expand

Commit Message

Kever Yang March 30, 2020, 3:56 a.m. UTC
The ALIGN() is now available at imagetool.h, migrate to use it.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>
---

Changes in v4: None
Changes in v3: None
Changes in v2: None

 tools/mkimage.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Tom Rini April 24, 2020, 5:09 p.m. UTC | #1
On Mon, Mar 30, 2020 at 11:56:19AM +0800, Kever Yang wrote:

> The ALIGN() is now available at imagetool.h, migrate to use it.
> 
> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
> Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

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 <image.h>
@@ -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