From: Kever Yang <kever.yang@rock-chips.com>
To: u-boot@lists.denx.de
Subject: [PATCH v3 4/8] tools: kwbimage: use common ALIGN to do the size align
Date: Thu, 26 Mar 2020 18:09:12 +0800 [thread overview]
Message-ID: <20200326100916.22532-4-kever.yang@rock-chips.com> (raw)
In-Reply-To: <20200326100916.22532-1-kever.yang@rock-chips.com>
The ALIGN() is now available at imagetool.h, migrate to use it.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
Changes in v3: None
Changes in v2: None
tools/kwbimage.c | 8 ++++----
tools/kwbimage.h | 2 --
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index b8f8d38212..02fd0c949f 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -1015,7 +1015,7 @@ static size_t image_headersz_v1(int *hasext)
* The payload should be aligned on some reasonable
* boundary
*/
- return ALIGN_SUP(headersz, 4096);
+ return ALIGN(headersz, 4096);
}
int add_binary_header_v1(uint8_t *cur)
@@ -1058,7 +1058,7 @@ int add_binary_header_v1(uint8_t *cur)
* up to a 4-byte boundary. Plus 4 bytes for the
* next-header byte and 3-byte alignment at the end.
*/
- binhdrsz = ALIGN_SUP(binhdrsz, 4) + 4;
+ binhdrsz = ALIGN(binhdrsz, 4) + 4;
hdr->headersz_lsb = cpu_to_le16(binhdrsz & 0xFFFF);
hdr->headersz_msb = (binhdrsz & 0xFFFF0000) >> 16;
@@ -1082,7 +1082,7 @@ int add_binary_header_v1(uint8_t *cur)
fclose(bin);
- cur += ALIGN_SUP(s.st_size, 4);
+ cur += ALIGN(s.st_size, 4);
/*
* For now, we don't support more than one binary
@@ -1548,7 +1548,7 @@ static void kwbimage_set_header(void *ptr, struct stat *sbuf, int ifd,
}
/* The MVEBU BootROM does not allow non word aligned payloads */
- sbuf->st_size = ALIGN_SUP(sbuf->st_size, 4);
+ sbuf->st_size = ALIGN(sbuf->st_size, 4);
version = image_get_version();
switch (version) {
diff --git a/tools/kwbimage.h b/tools/kwbimage.h
index 25bc08c5ce..0b6d05bef1 100644
--- a/tools/kwbimage.h
+++ b/tools/kwbimage.h
@@ -29,8 +29,6 @@
#define IBR_HDR_UART_ID 0x69
#define IBR_DEF_ATTRIB 0x00
-#define ALIGN_SUP(x, a) (((x) + (a - 1)) & ~(a - 1))
-
/* Structure of the main header, version 0 (Kirkwood, Dove) */
struct main_hdr_v0 {
uint8_t blockid; /* 0x0 */
--
2.17.1
next prev parent reply other threads:[~2020-03-26 10:09 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-26 10:09 [PATCH v3 1/8] tool: Move ALIGN_MASK to header as common MACRO Kever Yang
2020-03-26 10:09 ` [PATCH v3 2/8] tool: aisimage: use ALIGN instead of self defiend macro Kever Yang
2020-03-27 18:16 ` Tom Rini
2020-03-26 10:09 ` [PATCH v3 3/8] tools: mkimage: use common ALIGN to do the size align Kever Yang
2020-03-27 18:16 ` Tom Rini
2020-03-26 10:09 ` Kever Yang [this message]
2020-03-26 10:12 ` [PATCH v3 4/8] tools: kwbimage: " Stefan Roese
2020-03-27 18:16 ` Tom Rini
2020-03-26 10:09 ` [PATCH v3 5/8] tools: imx8mimage: remove redundant code Kever Yang
2020-03-27 18:16 ` Tom Rini
2020-03-26 10:09 ` [PATCH v3 6/8] tool: use ALIGN() to align the size Kever Yang
2020-03-26 11:39 ` Heinrich Schuchardt
2020-03-27 18:16 ` Tom Rini
2020-03-26 10:09 ` [PATCH v3 7/8] libfdt: Make fdtdec_get_child_count() available for HOST Kever Yang
2020-03-28 20:04 ` Simon Glass
2020-03-26 10:09 ` [PATCH v3 8/8] mkimage: fit_image: Add option to make fit header align Kever Yang
2020-03-27 18:16 ` Tom Rini
2020-03-30 2:35 ` Kever Yang
2020-03-27 3:27 ` [PATCH v3 1/8] tool: Move ALIGN_MASK to header as common MACRO Punit Agrawal
2020-03-27 18:16 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200326100916.22532-4-kever.yang@rock-chips.com \
--to=kever.yang@rock-chips.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox