Details of the Secondary Image Boot feature in iMX8M Plus

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Details of the Secondary Image Boot feature in iMX8M Plus

2,054 Views
Y_K
Contributor I

Hi,

We are trying to use eMMC of iMX8M Plus to build partitions for firmware updates.

I found out in the "IMX8MPRM.pdf" and "L-1004e.A2 i.MX 6 _ i.MX 8 Security Manual-v1-20230417_093438.pdf" documentation that there is Secondary Image Boot feature.

I have some questions about this feature.

Q1) Assuming the following partitions are built on eMMC, is it possible to change the boot image by changing BOOT_PARTITION_ENABLE?

      device                  boot     start          end            sectors             type
  A) /dev/mmcblk2p1  *           16384       186775     170392             W95FAT32 (LBA)
  B) /dev/mmcblk2p2              196608      17027413 16830806         Linux
  C) /dev/mmcblk2p3  *          17027413  17214188 170392            W95FAT32 (LBA)
  D) /dev/mmcblk2p4              17224021  34054826 16830806        Linux

  After creating partitions with the fdisk command, I copied the files in partitions A) and B) to partitions C) and D).
  Partitions A) and C) have kernel images and DTBs.
  Partitions B) and D) have rootfs.

  A),B) contains the old image and C,)D) contains the new image

Q2) Which document should I refer to for the flow of  Secondary Image Boot feature of iMX8M Plus?
        I couldn't find it from the IMX8MPRM.pdf documentation.

Q3) What kind of triggers exist to determine that the primary partition is unreadable?

0 Kudos
Reply
6 Replies

2,030 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @Y_K,

I hope you are doing well.

BOOT_PARTITION_ENABLE bits are used to select or disable boot partition for emmc.
Please refer to Working with eMMC.

Q1) Assuming the following partitions are built on eMMC, is it possible to change the boot image by changing BOOT_PARTITION_ENABLE?
[Ans]:

Secondry boot feature is not used like this.
If booting from the device selected by the boot configuration pin or eFuse (Primary Device) fails, only then ROM will try to boot from the Secondary Image, the offset is relative to the
beginning of the boot device.

Secondry image offset can be set using IMG_CNTN_SET1_OFFSET (0x490[22:19]) fuse.

Q2) Which document should I refer to for the flow of the Secondary Image Boot feature of iMX8M Plus?
[Ans]:

Please refer to 6.1.6.2 Secondary Image Boot and 6.1.6.4 Typical image placement in boot device in i.MX 8M Plus Applications Processor Reference Manual.

Q3) What kind of triggers exist to determine that the primary partition is unreadable?
[Ans]:

 It is not required to create separate partitions for the Secondary Image Boot feature.
 Please refer to Figure 6-21. Typical image placement in i.MX 8M Plus Applications Processor Reference Manual.

Thanks & Regards,
Dhruvit Vasavada

1,990 Views
Y_K
Contributor I

Hi @Dhruvit 

Thank you for your reply.

Q1) I read Working with eMMC.

This was very helpful. I was wrong about the memory composition of eMMC.  

Q2) , Q3) Thank you for teaching. I will refer to it.

Sorry, I would like to ask an additional question because I can not specifically image the scene where the secondary boot image can be used.
    Q4) What does it mean when the primary device fails to boot?
               Could it be a hardware issue that prevents the emmc or sd card from being read?
               What kind of failure cases are possible?

    Q5) For example, if emmc is specified in the boot configuration pin and emmc fails to boot, what settings should be made to the secondary image boot loader?
                Does it mean that booting on sd card (different boot device) is set?
                Does it mean that booting on partition D (different boot partition) added on emmc is set? 

0 Kudos
Reply

1,972 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @Y_K,

I hope you are doing well.

Q4) What does it mean when the primary device fails to boot?
       Could it be a hardware issue that prevents the emmc or sd card from being read?
       What kind of failure cases are possible?

[Ans]: I think you mean Primary image.
          The secondary boot feature only boots the secondary Image from the same device if the primary image fails to boot. (due to a corrupted image or corrupted sector).

           Primary & Secondry boot images are flashed on the same device.             

    Q5) For example, if emmc is specified in the boot configuration pin and emmc fails to boot, what settings should be made to the secondary image boot loader?
                Does it mean that booting on sd card (different boot device) is set?
                Does it mean that booting on partition D (different boot partition) added on emmc is set? 

[Ans]: If the Primary device(selected by eFuse or configuration GPIO) fails to boot even the secondary boot image then it will go to serial download mode.

Please refer to Figure 6-1. Boot flow in i.MX 8M Plus Applications Processor Reference Manual.'

The secondry boot image should be located at a fixed offset (not partition) defined by the IMG_CNTN_SET1_OFFSET fuse.

Thanks & Regards,
Dhruvit Vasavada

1,935 Views
Y_K
Contributor I

Hi @Dhruvit  

I understand about Q4.

About Q5, my way of asking was wrong.

Please assume the following situation.
1. DIPSW: 0010 eMMC boot mode.
2. Primary and secondary images have been downloaded.
3. Primary image fails to boot.

Q6) At this time, is it possible to specify the file system of a partition different from the setting of the primary image as the boot target with the bootloader of the secondary image?

Q7) Looking at the configuration directly under /dev/, there were /mmcblk2boot0 and /mmcblk2boot1.
    Is /dev/mmcblk2boot1 the download destination for the secondary image?
    I didn't know whether Boot Area 1 in figure 1 of Working with eMMC is the same as /dev/mmcblk2boot0 or Boot Area 2 is the same as /dev/mmcblk2boot1.
    I'm trying to write an Secondary image with the dd command and think the Primary image is stored in /mmcblk2boot0.

0 Kudos
Reply

1,914 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @Y_K,

I hope you are doing well.

Q6) At this time, is it possible to specify the file system of a partition different from the setting of the primary image as the boot target with the bootloader of the secondary image?

[Ans]: Primary and Secondary Boot images are flashed at specific offset and it does not require to specify a partition.

        Please make a note that boot area is not formatted and contains no file system. 

        If the Primary boot image fails then ROM will automatically boot the secondary boot image.
        
       Please refer to 6.1.6.3 Primary image offset and IVT offset in RM for primary image offset.

       and IMG_CNTN_SET1_OFFSET for secondary boot image offset.

Q7) Looking at the configuration directly under /dev/, there were /mmcblk2boot0 and /mmcblk2boot1.
    Is /dev/mmcblk2boot1 the download destination for the secondary image?
    I didn't know whether Boot Area 1 in figure 1 of Working with eMMC is the same as /dev/mmcblk2boot0 or Boot Area 2 is the same as /dev/mmcblk2boot1.
    I'm trying to write an Secondary image with the dd command and think the Primary image is stored in /mmcblk2boot0.

[Ans]:

Yes, Boot Area 1 in figure 1 of Working with eMMC is the same as /dev/mmcblk2boot0  and Boot Area 2 is the same as /dev/mmcblk2boot1.

Secondary images should be flashed at the offset specified using IMG_CNTN_SET1_OFFSET and it should be decided based on the boot partition size and start.

Thanks & Regards,
Dhruvit Vasavada

774 Views
moose
Contributor IV

@Dhruvit thanks for the info. Just to clarify, the secondary boot image must be located in the same partition as the primary image, correct? Ideally I would like the primary image to be located in mmcblk2boot0 and the secondary image in mmcblk2boot1. However my understanding this is not possible with this SoC and instead both primary and secondary images must be located within one portion (ex: mmcblk2boot0). Do you agree? Thanks!

0 Kudos
Reply