[PATCH 06/10] imx-image: main: make use of round_up instead of open coding it
Marc Kleine-Budde
mkl at pengutronix.de
Wed Apr 1 09:14:11 PDT 2015
Signed-off-by: Marc Kleine-Budde <mkl at pengutronix.de>
---
scripts/imx/imx-image.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/imx/imx-image.c b/scripts/imx/imx-image.c
index fd78a86198d6..ec2e8deb015b 100644
--- a/scripts/imx/imx-image.c
+++ b/scripts/imx/imx-image.c
@@ -30,6 +30,7 @@
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
+#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
#define MAX_DCD 1024
#define HEADER_LEN 0x1000 /* length of the blank area + IVT + DCD */
@@ -740,7 +741,7 @@ int main(int argc, char *argv[])
* - i.MX6 SPI NOR boot corrupts the last few bytes of an image loaded
* in ver funy ways when the image size is not 4 byte aligned
*/
- load_size = ((image_size + HEADER_LEN) + 0xfff) & ~0xfff;
+ load_size = roundup(image_size + HEADER_LEN, 0x1000);
if (cpu_type == 35)
load_size += HEADER_LEN;
--
2.1.4
More information about the barebox
mailing list