firmware-utils: mktplinkfw2: fix info for images with LE kernel LA/EP
authorRafał Miłecki <rafal@milecki.pl>
Sun, 23 Jul 2017 20:19:20 +0000 (22:19 +0200)
committerRafał Miłecki <rafal@milecki.pl>
Mon, 31 Jul 2017 09:43:42 +0000 (11:43 +0200)
With this change endianness is also respected when reading firmware
info.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
src/mktplinkfw2.c

index 905220538b11c0cce1ec646b517f60b86b6e6747..f7bfed875f6cdad57b58af16b50f3f939d64cf9a 100644 (file)
@@ -793,6 +793,13 @@ static int inspect_fw(void)
                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);
 
@@ -838,7 +845,6 @@ static int inspect_fw(void)
 
        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",