[FS#542] ipq806x: unable to boot linux-4.9.10 uboot seeing Bad Magic Number

LEDE Bugs lede-bugs at lists.infradead.org
Tue Feb 21 02:54:28 PST 2017


A new Flyspray task has been opened.  Details are below. 

User who did this - Thomas Reifferscheid (reiffert) 

Attached to Project - LEDE Project
Summary - ipq806x: unable to boot linux-4.9.10 uboot seeing Bad Magic Number
Task Type - Bug Report
Category - Kernel
Status - Unconfirmed
Assigned To - 
Operating System - All
Severity - Low
Priority - Very Low
Reported Version - Trunk
Due in Version - Undecided
Due Date - Undecided
Details - ipq806x on Netgear Nighthawk X4 / R7500 is unable to start Lede-trunk with Linux-4.9.10.



U-Boot 2012.07 [local,local] (Jun 20 2014 - 17:36:49)

U-boot 2012.07 dni1 V2.2 for DNI HW ID: 29764841 NOR flash 0MB NAND flash 128MB RAM 256MB 1st Radio 3x3 2nd Radio 4x4
smem ram ptable found: ver: 0 len: 5
DRAM:  235 MiB
NAND:  128 MiB
In:    serial
Out:   serial
Err:   serial
 131072 bytes read: OK
cdp: get part failed for 0:HLOS
Net:   MAC1 addr:6c:b0:ce:24:7d:5
athrs17_reg_init: complete
athrs17_vlan_config ...done
S17 inits done
MAC2 addr:6c:b0:ce:24:7d:4
eth0, eth1
Hit any key to stop autoboot:  0

 Client starts...[Listening] for ADVERTISE...TTT
Retry count exceeded; boot the image as usual

 nmrp server is stopped or failed !

Loading from device 0: nand0 (offset 0x1340000)

** check kernel image **
   Verifying Checksum ... OK

** check rootfs image **

** Bad Magic Number 0x0 **




The sources of this particular u-boot loader can be found [[http://www.downloads.netgear.com/files/GPL/R7500-and_qtn_gpl_src_V1.0.0.94.zip|here]].


u-boot.git/common/cmd_dni.c:1068 is indicating that it's unable to verify the ih_magic from the rootfs header which should be 0x27051956.


u-boot.git/common/cmd_dni.c:1068 

        if (ntohl(hdr->ih_magic) != IH_MAGIC) {
                printf("\n** Bad Magic Number 0x%x **\n", hdr->ih_magic);
                return 1;
        }



Comparing the headers for a working lede-trunk with Linux-4.4.49 and with Linux-4.9.10:

Lede-trunk/Linux-4.4.49:

00000080  27 05 19 56 32 6e b2 0a  58 aa fe 1a 00 1f 50 22  |'..V2n..X.....P"|
00000090  42 20 80 00 42 20 80 00  aa b1 af 1b 05 02 02 00  |B ..B ..........|
000000a0  41 52 4d 20 4c 45 44 45  20 4c 69 6e 75 78 2d 34  |ARM LEDE Linux-4|
000000b0  2e 34 2e 34 39 00 00 00  00 00 00 00 00 00 00 00  |.4.49...........|
...
00200040  27 05 19 56 2f 33 ed 8c  58 aa fe 1a 00 00 00 00  |'..V/3..X.......|
00200050  00 00 00 00 00 00 00 00  00 00 00 00 05 02 07 00  |................|
00200060  41 52 4d 20 4c 45 44 45  20 66 61 6b 65 72 6f 6f  |ARM LEDE fakeroo|
00200070  74 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |t...............|



Lede-trunk/Linux-4.9.10:

00000080  27 05 19 56 e1 9e 33 1c  58 aa fe 1a 00 1d 22 22  |'..V..3.X.....""|
00000090  42 20 80 00 42 20 80 00  29 b3 4f cd 05 02 02 00  |B ..B ..).O.....|
000000a0  41 52 4d 20 4c 45 44 45  20 4c 69 6e 75 78 2d 34  |ARM LEDE Linux-4|
000000b0  2e 39 2e 31 30 00 00 00  00 00 00 00 00 00 00 00  |.9.10...........|
...
00200040  27 05 19 56 2f 33 ed 8c  58 aa fe 1a 00 00 00 00  |'..V/3..X.......|
00200050  00 00 00 00 00 00 00 00  00 00 00 00 05 02 07 00  |................|
00200060  41 52 4d 20 4c 45 44 45  20 66 61 6b 65 72 6f 6f  |ARM LEDE fakeroo|
00200070  74 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |t...............|



The header according to u-boot.git/include/image.h:189

typedef struct image_header {
        uint32_t        ih_magic;       /* Image Header Magic Number    */
        uint32_t        ih_hcrc;        /* Image Header CRC Checksum    */
        uint32_t        ih_time;        /* Image Creation Timestamp     */
        uint32_t        ih_size;        /* Image Data Size              */
        uint32_t        ih_load;        /* Data  Load  Address          */
        uint32_t        ih_ep;          /* Entry Point Address          */
        uint32_t        ih_dcrc;        /* Image Data CRC Checksum      */
        uint8_t         ih_os;          /* Operating System             */
        uint8_t         ih_arch;        /* CPU architecture             */
        uint8_t         ih_type;        /* Image Type                   */
        uint8_t         ih_comp;        /* Compression Type             */
        uint8_t         ih_name[IH_NMLEN];      /* Image Name           */
} image_header_t;



Anything that can be concluded from here?

- The kernel header is existing and uboot verifys it ok
- The rootfs header is at the right spot but uboot is unable to find the ih_magic





More information can be found at the following URL:
https://bugs.lede-project.org/index.php?do=details&task_id=542



More information about the lede-bugs mailing list