uint32_t rootfs_ofs;
};
+#define FLAG_LE_KERNEL_LA_EP 0x00000001 /* Little-endian used for kernel load address & entry point */
+
struct board_info {
char *id;
uint32_t hw_id;
uint32_t hw_ver_add;
char *layout_id;
uint32_t hdr_ver;
- bool endian_swap;
+ uint32_t flags;
};
/*
.hw_rev = 58,
.layout_id = "8Mmtk",
.hdr_ver = 3,
- .endian_swap = true,
+ .flags = FLAG_LE_KERNEL_LA_EP,
}, {
.id = "ArcherVR200V",
.hw_id = 0x73b70801,
.hw_rev = 69,
.layout_id = "8Mmtk",
.hdr_ver = 3,
- .endian_swap = true,
+ .flags = FLAG_LE_KERNEL_LA_EP,
}, {
.id = "ArcherMR200",
.hw_id = 0xd7500001,
.hw_rev = 0x4a,
.layout_id = "8MLmtk",
.hdr_ver = 3,
- .endian_swap = true,
+ .flags = FLAG_LE_KERNEL_LA_EP,
}, {
.id = "TL-WR840NV4",
.hw_id = 0x08400004,
.hw_ver_add = 0x4,
.layout_id = "8Mmtk",
.hdr_ver = 3,
- .endian_swap = true,
+ .flags = FLAG_LE_KERNEL_LA_EP,
}, {
.id = "TL-WR841NV13",
.hw_id = 0x08410013,
.hw_ver_add = 0x13,
.layout_id = "8Mmtk",
.hdr_ver = 3,
- .endian_swap = true,
+ .flags = FLAG_LE_KERNEL_LA_EP,
}, {
/* terminating entry */
}
hdr->ver_mid = fw_ver_mid;
hdr->ver_lo = fw_ver_lo;
- if (board->endian_swap) {
+ if (board->flags & FLAG_LE_KERNEL_LA_EP) {
hdr->kernel_la = bswap_32(hdr->kernel_la);
hdr->kernel_ep = bswap_32(hdr->kernel_ep);
}
goto out_free_buf;
hdr = (struct fw_header *)buf;
+ board = find_board_by_hwid(ntohl(hdr->hw_id));
+
+ if (board && board->flags & FLAG_LE_KERNEL_LA_EP) {
+ hdr->kernel_la = bswap_32(hdr->kernel_la);
+ hdr->kernel_ep = bswap_32(hdr->kernel_ep);
+ }
+
inspect_fw_pstr("File name", inspect_info.file_name);
inspect_fw_phexdec("File size", inspect_info.file_size);
inspect_fw_pstr("Firmware version", hdr->fw_version);
- board = find_board_by_hwid(ntohl(hdr->hw_id));
if (board) {
layout = find_layout(board->layout_id);
inspect_fw_phexpost("Hardware ID",
hdr_ver = atoi(optarg);
break;
case 'e':
- custom_board.endian_swap = true;
+ custom_board.flags = FLAG_LE_KERNEL_LA_EP;
break;
case 'h':
usage(EXIT_SUCCESS);