diff options
author | Felix Fietkau <nbd@nbd.name> | 2016-07-19 12:48:21 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2016-07-19 12:48:28 +0200 |
commit | 6b654ab741297d6b871e1b3d6a6203c774831e4c (patch) | |
tree | ebf1428b79f8ff3122360609ec1a903fd2bcebaf /package/boot | |
parent | 022698c6c9c77ee7e9dd15679d85cdcf1a5dc75d (diff) | |
download | mtk-20170518-6b654ab741297d6b871e1b3d6a6203c774831e4c.zip mtk-20170518-6b654ab741297d6b871e1b3d6a6203c774831e4c.tar.gz mtk-20170518-6b654ab741297d6b871e1b3d6a6203c774831e4c.tar.bz2 |
uboot-oxnas: fix build error on non-linux systems
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'package/boot')
-rw-r--r-- | package/boot/uboot-oxnas/patches/020-socfpgaimage_portability.patch | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/package/boot/uboot-oxnas/patches/020-socfpgaimage_portability.patch b/package/boot/uboot-oxnas/patches/020-socfpgaimage_portability.patch new file mode 100644 index 0000000..e273c27 --- /dev/null +++ b/package/boot/uboot-oxnas/patches/020-socfpgaimage_portability.patch @@ -0,0 +1,52 @@ +--- a/tools/socfpgaimage.c ++++ b/tools/socfpgaimage.c +@@ -74,12 +74,12 @@ static uint16_t hdr_checksum(struct socf + static void build_header(uint8_t *buf, uint8_t version, uint8_t flags, + uint16_t length_bytes) + { +- header.validation = htole32(VALIDATION_WORD); ++ header.validation = cpu_to_le32(VALIDATION_WORD); + header.version = version; + header.flags = flags; +- header.length_u32 = htole16(length_bytes/4); ++ header.length_u32 = cpu_to_le16(length_bytes/4); + header.zero = 0; +- header.checksum = htole16(hdr_checksum(&header)); ++ header.checksum = cpu_to_le16(hdr_checksum(&header)); + + memcpy(buf, &header, sizeof(header)); + } +@@ -92,12 +92,12 @@ static int verify_header(const uint8_t * + { + memcpy(&header, buf, sizeof(header)); + +- if (le32toh(header.validation) != VALIDATION_WORD) ++ if (le32_to_cpu(header.validation) != VALIDATION_WORD) + return -1; +- if (le16toh(header.checksum) != hdr_checksum(&header)) ++ if (le16_to_cpu(header.checksum) != hdr_checksum(&header)) + return -1; + +- return le16toh(header.length_u32) * 4; ++ return le16_to_cpu(header.length_u32) * 4; + } + + /* Sign the buffer and return the signed buffer size */ +@@ -116,7 +116,7 @@ static int sign_buffer(uint8_t *buf, + /* Calculate and apply the CRC */ + calc_crc = ~pbl_crc32(0, (char *)buf, len); + +- *((uint32_t *)(buf + len)) = htole32(calc_crc); ++ *((uint32_t *)(buf + len)) = cpu_to_le32(calc_crc); + + if (!pad_64k) + return len + 4; +@@ -150,7 +150,7 @@ static int verify_buffer(const uint8_t * + + calc_crc = ~pbl_crc32(0, (const char *)buf, len); + +- buf_crc = le32toh(*((uint32_t *)(buf + len))); ++ buf_crc = le32_to_cpu(*((uint32_t *)(buf + len))); + + if (buf_crc != calc_crc) { + fprintf(stderr, "CRC32 does not match (%08x != %08x)\n", |