mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-30 16:35:37 +00:00
tools: kwbimage: use common ALIGN to do the size align
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> Reviewed-by: Stefan Roese <sr@denx.de>
This commit is contained in:
parent
29e7ab0186
commit
e002ee7efc
2 changed files with 4 additions and 6 deletions
|
@ -1015,7 +1015,7 @@ static size_t image_headersz_v1(int *hasext)
|
||||||
* The payload should be aligned on some reasonable
|
* The payload should be aligned on some reasonable
|
||||||
* boundary
|
* boundary
|
||||||
*/
|
*/
|
||||||
return ALIGN_SUP(headersz, 4096);
|
return ALIGN(headersz, 4096);
|
||||||
}
|
}
|
||||||
|
|
||||||
int add_binary_header_v1(uint8_t *cur)
|
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
|
* up to a 4-byte boundary. Plus 4 bytes for the
|
||||||
* next-header byte and 3-byte alignment at the end.
|
* 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_lsb = cpu_to_le16(binhdrsz & 0xFFFF);
|
||||||
hdr->headersz_msb = (binhdrsz & 0xFFFF0000) >> 16;
|
hdr->headersz_msb = (binhdrsz & 0xFFFF0000) >> 16;
|
||||||
|
|
||||||
|
@ -1082,7 +1082,7 @@ int add_binary_header_v1(uint8_t *cur)
|
||||||
|
|
||||||
fclose(bin);
|
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
|
* 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 */
|
/* 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();
|
version = image_get_version();
|
||||||
switch (version) {
|
switch (version) {
|
||||||
|
|
|
@ -29,8 +29,6 @@
|
||||||
#define IBR_HDR_UART_ID 0x69
|
#define IBR_HDR_UART_ID 0x69
|
||||||
#define IBR_DEF_ATTRIB 0x00
|
#define IBR_DEF_ATTRIB 0x00
|
||||||
|
|
||||||
#define ALIGN_SUP(x, a) (((x) + (a - 1)) & ~(a - 1))
|
|
||||||
|
|
||||||
/* Structure of the main header, version 0 (Kirkwood, Dove) */
|
/* Structure of the main header, version 0 (Kirkwood, Dove) */
|
||||||
struct main_hdr_v0 {
|
struct main_hdr_v0 {
|
||||||
uint8_t blockid; /* 0x0 */
|
uint8_t blockid; /* 0x0 */
|
||||||
|
|
Loading…
Add table
Reference in a new issue