diff options
author | Felix Fietkau <nbd@openwrt.org> | 2015-06-14 17:41:16 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2015-06-14 17:41:16 +0000 |
commit | 626356744406ec597f6ec5646c11f746e16538b9 (patch) | |
tree | 2ae53d083fc39c69f4ea0397d56e63d05d869a97 /tools/firmware-utils/src/ptgen.c | |
parent | 16fa80a8f1cf487b5329d76b4f4dd5a957015203 (diff) | |
download | mtk-20170518-626356744406ec597f6ec5646c11f746e16538b9.zip mtk-20170518-626356744406ec597f6ec5646c11f746e16538b9.tar.gz mtk-20170518-626356744406ec597f6ec5646c11f746e16538b9.tar.bz2 |
firmware-tools/ptgen: fix endianness conversion for PTE .start, .length field.
They are of 32-bit little endian integers.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
SVN-Revision: 45956
Diffstat (limited to 'tools/firmware-utils/src/ptgen.c')
-rw-r--r-- | tools/firmware-utils/src/ptgen.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/firmware-utils/src/ptgen.c b/tools/firmware-utils/src/ptgen.c index 6379ed7..68bad6f 100644 --- a/tools/firmware-utils/src/ptgen.c +++ b/tools/firmware-utils/src/ptgen.c @@ -31,9 +31,9 @@ #include <stdint.h> #if __BYTE_ORDER == __BIG_ENDIAN -#define cpu_to_le16(x) bswap_16(x) +#define cpu_to_le32(x) bswap_32(x) #elif __BYTE_ORDER == __LITTLE_ENDIAN -#define cpu_to_le16(x) (x) +#define cpu_to_le32(x) (x) #else #error unknown endianness! #endif @@ -142,11 +142,11 @@ static int gen_ptable(uint32_t signature, int nr) start = sect + sectors; if (kb_align != 0) start = round_to_kb(start); - pte[i].start = cpu_to_le16(start); + pte[i].start = cpu_to_le32(start); sect = start + parts[i].size * 2; if (kb_align == 0) sect = round_to_cyl(sect); - pte[i].length = cpu_to_le16(len = sect - start); + pte[i].length = cpu_to_le32(len = sect - start); to_chs(start, pte[i].chs_start); to_chs(start + len - 1, pte[i].chs_end); if (verbose) |