aboutsummaryrefslogtreecommitdiffstats
path: root/tools/firmware-utils
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2015-06-14 17:41:16 +0000
committerFelix Fietkau <nbd@openwrt.org>2015-06-14 17:41:16 +0000
commit1e517184a24b2b9d8da28cca11959c4bc8500d92 (patch)
tree528347e2782c11fce5524dd0ebc67c7f1def45ce /tools/firmware-utils
parentd34d3e2ecf897be8b6f3ad13ccceba2d9db8de45 (diff)
downloadmaster-187ad058-1e517184a24b2b9d8da28cca11959c4bc8500d92.tar.gz
master-187ad058-1e517184a24b2b9d8da28cca11959c4bc8500d92.tar.bz2
master-187ad058-1e517184a24b2b9d8da28cca11959c4bc8500d92.zip
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> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@45956 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'tools/firmware-utils')
-rw-r--r--tools/firmware-utils/src/ptgen.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/firmware-utils/src/ptgen.c b/tools/firmware-utils/src/ptgen.c
index 6379ed7a59..68bad6fd97 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)