Shaojun Wang

i.MX53 Redundant Boot -blog archive

Discussion created by Shaojun Wang Employee on Apr 4, 2012
Latest reply on Dec 17, 2014 by Julien CARBONNIER

i.MX53 ROM supports redundant boot. Boot primary or secondary image by the setting of PERSIST_SECONDARY_BOOT.

The value of PERSIST_SECONDARY_BOOT is stored in SRTC LPGR register.

Following steps describe how to enable and verify redundant boot from NAND and SD in i.MX53 ARD board.

 

Redundant Boot from NAND flash

Verified in 1109 BSP, the NAND device is SAMSUNG K9G8G08U0B, 2048 bytes/page, 128 pages/block, 4 bits ecc.

The default kobs-ng in 1109 BSP can only program primary u-boot.bin into NAND.

0001-support-redundant-boot-from-nand.patch is patch that support to program both primary and secondary u-boot.bin into NAND. The binary is kobs-ng.

 

1. Set boot switch to boot from SD card

    1      2      3    4      5      6     7      8      9    0

    OFF OFF ON OFF OFF OFF OFF OFF ON OFF

 

    In Linux, program u-boot-mx53-ard-ddr3.bin to mtd0

    $ flash_eraseall /dev/mtd0

    $ ./kobs-ng init -v --chip_0_device_path=/dev/mtd0 u-boot-mx53-ard-ddr3.bin

    From the log, primary u-boot is programmed to 0x00200000 - 0x00237000, secondary u-boot is programmed to 0x00900000 - 0x00937000.

 

2. Configure boot switch to boot from NAND

    1      2      3    4      5      6     7      8      9    0

    OFF OFF OFF ON OFF ON OFF OFF ON ON

 

3. Boot up, from u-boot command, dump SRTC LPGR to verify i.MX53 boot from primary u-boot.

    MX53-ARD-DDR3 U-Boot > md.l 0x53FA401c 1

    The return value is 0, mean boot from primary u-boot.

 

4. From u-boot command, destroy primary u-boot so the secondary can be booted.

    MX53-ARD-DDR3 U-Boot > nand write 0x70800000 0x220000 0x800

 

5. Reboot, check register LPRG

    MX53-ARD-DDR3 U-Boot > md.l 0x53FA401c 1

    The return value is 0x40000000, mean boot from secondary u-boot.

 

Redundant Boot from SD

1. To support secondary image, the primary image must reserve space for secondary image table. The structure layout is

    0x00000000 ~ 0x000001FF    Reserve for MBR

    0x00000200 ~ 0x000003FF    Reserve for secondary image table

    0x00000400 ~ 0xxxxxxxxx    Boot image

 

2. The secondary image table start from 0x200 on boot media. The layout is

    Offset in boot media                                          value

    0x200                                                                0

    0x204                                                                0

    0x208                                                                0x00112233

    0x20c                                                                 FirstSectorNumber

    0x210                                                                0

    0x00112233 is the tag value of mx53.

    FirstSectorNumber is the first 512B sector number of secondary image.

 

3. Create primary boot image

    $ sudo dd if=u-boot_pri.bin of=/dev/sdc bs=1K seek=1 skip=1

 

4. Create secondary boot image, in this example, start from 400KB.

    $ sudo dd if=u-boot-sec.bin of=/dev/sdc bs=1K seek=400

 

5. Create secondary image table. header is the example, data inside header is

    0x0                                                     0

    0x4                                                     0

    0x8                                                     0x00112233

    0xc                                                     0x320

    0x10                                                   0

 

    Since the offset of secondary image is 400KB, the FirstSectorNumber is 400*1024/512=0x320.

    To create secondary image table, run below command

    $ sudo dd if=header of=/dev/sdc bs=1 seek=512 count=20

 

    If want to change the offset of secondary image, can modify file header by hexedit.exe.

 

5. Destroy primary u-boot by setting the entry of ivt to 0, so rom can jump to secondary image.

    $ sudo dd if=/dev/zero of=/dev/sdc bs=1 seek=1028  count=4

 

6. Set boot switch to boot from SD

    1      2      3    4      5      6     7      8      9    0

    OFF OFF ON OFF OFF OFF OFF OFF ON OFF

 

    After boot up u-boot, can verify if boot from secondary image by checking LPRG register

    MX53-ARD-DDR3 U-Boot > md.l 0x53FA401c 1

    The return value should be  0x40000000

 

7. For uboot after 2014.08, since there is not 1K offset in the image head, the program command is

    $ sudo dd if=u-boot_pri.bin of=/dev/sdc bs=1K seek=1

    To support secondary boot on such uboot, the secondary image should be downloaded to offset+1K, such as

     $ sudo dd if=u-boot-sec.bin of=/dev/sdc bs=1K seek=401

 

kobs-ng and uboot nand patch

More patch about kobs and uboot can be found in https://community.freescale.com/thread/304760

Original Attachment has been moved to: 48-ubootmx53ardddr3.bin

Original Attachment has been moved to: 50-hexedit.exe

Original Attachment has been moved to: 46-0001supportredundantbootfromnand.patch

Attachments

Outcomes