OpenWrt Forum Archive

Topic: bcm63xx - Its any way to replace CFE in CFE?

The content of this topic has been archived on 22 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I knowingly uploaded wrong cfe from different model, router wakes up and working in some way (tftp is working).

CFE> w

     eg. w [hostip:]whole_image_file_name

*** command status = -2
CFE> w 192.168.1.111:mtdblock7
Loading 192.168.1.111:mtdblock7 ...
Finished loading 4194304 bytes
Illegal whole flash image
Finished flashing image.
*** command status = -1

This is whole flash image for my model but tftp refuses bigger files than 4 194 304 b. (got it from backup dev/mtdblock7) and ofcourse real size is (16 777 216 b)

CFE> w 192.168.1.111:cfe-evg2000.bin
Loading 192.168.1.111:cfe-evg2000.bin ...
Finished loading 131072 bytes
Illegal whole flash image
Finished flashing image.
*** command status = -1

1. Its possible to prepare "whole image"  (which will contain only cfe) will accepted by cfe (and it overwrite itself)?


2.

CFE> sm
sm address_in_hex value_in_hex size_4_2_or_1*** command status = 0
CFE>

2. Maybe by this way ? but how ? i have backup copy orginal cfe from my router but how to load it. I can type that manually line by line in worst case (only 131 056 lines)

3. JTAG not real possible (pogopins)

4.

CFE> f -noheader 192.168.1.111:cfe-evg2000.bin flash1.boot
Invalid switch: -noheader
*** command status = -8

bcm63xx cfes made totally user friendly

5.

CFE> f 192.168.1.111:cfe-evg2000.bin
Loading 192.168.1.111:cfe-evg2000.bin ...
Finished loading 131072 bytes
Firmware tag version [0] is not compatible with the current Tag version [6].
*** command status = -1

6. or i need create openwrt image which cfe will acept and use mtd tool - but its hardest way for me

7.

CFE> sm 0xb8000688 39 50 56 47 4
sm address_in_hex value_in_hex size_4_2_or_1b8000688: 38 4d 56 57                                        8MVW

*** command status = 0
CFE>

whats doing wrong ? how to change that values?

(Last edited by broadcom on 14 Oct 2013, 11:06)

broadcom wrote:

Its possible to prepare "whole image"  (which will contain only cfe) will accepted by cfe (and it overwrite itself)?

Also interesting for me. How prepare whole image format with only CFE?

'Illegal whole flash image' message is from source code file:
/cfe_bcm63xx/cfe/cfe/arch/mips/board/bcm63xx_ram/src/bcm63xx_util.c:

int writeWholeImage(uint8_t *imagePtr, int wholeImageSize)
{
    UINT32 crc;
    int status = 0;
    int imageSize = wholeImageSize - TOKEN_LEN;
    unsigned char crcBuf[CRC_LEN];
    NVRAM_DATA saveNvramData;   

    // if whole image size (plus TOKEN_LEN of crc) is greater than total flash size, return error
    if (wholeImageSize > (flash_get_total_size() + TOKEN_LEN))
    {
        printf("Image size too big\n");
        return -1;
    }

    // check tag validate token first
    crc = CRC32_INIT_VALUE;
    crc = getCrc32(imagePtr, (UINT32)imageSize, crc);      
    memcpy(crcBuf, imagePtr+imageSize, CRC_LEN);
    if (memcmp(&crc, crcBuf, CRC_LEN) != 0)
    {
        printf("Illegal whole flash image\n");
        return -1;
    }

(Last edited by Gelip on 25 Aug 2016, 05:47)

To use 'w' command need add TOKEN to CFE like this:

hostTools/addvtoken CUSTOM.BIN cfe_token.bin
addvtoken: Output file size = 64544 with image crc = 0x15e9da7f

Now possible flash cfe_token.bin from CFE over TFTP (from 192.168.1.100):

=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2016.08.26 07:29:15 =~=~=~=~=~=~=~=~=~=~=~=
w cfe_token.bin
Loading 192.168.1.100:cfe_token.bin ...
Finished loading 64544 bytes
.

Finished flashing image.
Resetting board...

or over web interface 192.168.1.1

(Last edited by Gelip on 24 Sep 2016, 10:05)

The discussion might have continued from here.