mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2025-03-03 04:00:30 +00:00
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
This commit is contained in:
parent
16fa80a8f1
commit
6263567444
@ -31,9 +31,9 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
#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
|
#elif __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
#define cpu_to_le16(x) (x)
|
#define cpu_to_le32(x) (x)
|
||||||
#else
|
#else
|
||||||
#error unknown endianness!
|
#error unknown endianness!
|
||||||
#endif
|
#endif
|
||||||
@ -142,11 +142,11 @@ static int gen_ptable(uint32_t signature, int nr)
|
|||||||
start = sect + sectors;
|
start = sect + sectors;
|
||||||
if (kb_align != 0)
|
if (kb_align != 0)
|
||||||
start = round_to_kb(start);
|
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;
|
sect = start + parts[i].size * 2;
|
||||||
if (kb_align == 0)
|
if (kb_align == 0)
|
||||||
sect = round_to_cyl(sect);
|
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, pte[i].chs_start);
|
||||||
to_chs(start + len - 1, pte[i].chs_end);
|
to_chs(start + len - 1, pte[i].chs_end);
|
||||||
if (verbose)
|
if (verbose)
|
||||||
|
Loading…
Reference in New Issue
Block a user