I found instruction to flash the flash.bin (boot-image) to emmc. It uses this command:
dd if=flash.bin of=/dev/mmcblk2 bs=1k seek=32 (seek depends on type of imx8).
But where it is actually written to? I know there are 2 boot sections (mmcblk2boot0, mmcblk2boot1), one rpmg and the big "standard" section.
But as far as I know the mmcblk2 is partitioned and filled with formatted parts usually (mmcblk2p1, p2...)
If I do the above command ... will I destroy this partitions? Or is there some space left from mmcblk2 until mmcblk2p1 starts? If so, how many?
Best is probably to flash this to boot. It did that:
dd if=flash.bin of=/dev/mmcblk2boot0 bs=1k seek=32
But device isn't booting. What is the problem? Do I have to mark it bootable? How to do that out of uboot?
Solved! Go to Solution.
i.MX 8QuadMax Applications Processor Reference Manual, Rev. F, 10/2019
root@imx8qmmek:~# uname -a
Linux imx8qmmek 5.4.70-2.3.0+g4f2631b022d8 #1 SMP PREEMPT Wed Dec 16 09:53:54 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux
root@imx8qmmek:~#
use 5.4.70 boot from sd card then flash the flash.bin here is /run/media/mmcblk1p1/imx-boot-imx8qmmek-sd.bin-flash, which copied at sdcard fat partition, to the emmc boot0
all these commands are in the Linux.
imx-boot-imx8qmmek-sd.bin-flash is from 5.4.47 release different from 5.4.70, that we can easily check.
Clean up before test
mmc bootpart enable 0 1 /dev/mmcblk0
mmc extcsd read /dev/mmcblk0
Erased memory content [ERASED_MEM_CONT: 0x00]
Boot configuration bytes [PARTITION_CONFIG: 0x40]
Not boot enable
No access to boot partition
Boot config protection [BOOT_CONFIG_PROT: 0x00]
Boot bus Conditions [BOOT_BUS_CONDITIONS: 0x00]
echo 0 > /sys/block/mmcblk0boot0/force_ro
dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M count=1
echo 1 > /sys/block/mmcblk0boot0/force_ro
test start
echo 0 > /sys/block/mmcblk0boot0/force_ro
dd if=/run/media/mmcblk1p1/imx-boot-imx8qmmek-sd.bin-flash of=/dev/mmcblk0boot0
echo 1 > /sys/block/mmcblk0boot0/force_ro
mmc bootpart enable 1 1 /dev/mmcblk0
mmc extcsd read /dev/mmcblk0
Boot configuration bytes [PARTITION_CONFIG: 0x48]
Boot Partition 1 enabled
No access to boot partition
Boot config protection [BOOT_CONFIG_PROT: 0x00]
Boot bus Conditions [BOOT_BUS_CONDITIONS: 0x00]
High-density erase group definition [ERASE_GROUP_
not you can see the u-boot is 5.4.47 in mmc0 boot0
U-Boot 2020.04-5.4.47-2.2.0+gffc3fbe7e5 (Sep 12 2020 - 03:33:55 +0000)
CPU: NXP i.MX8QM RevB A53 at 1200 MHz at 27C
Model: NXP i.MX8QM MEK
Board: iMX8QM MEK
Boot: MMC0
DRAM: 6 GiB
TCPC: Vendor ID [0x1fc9], Product ID [0x5110], Addr [I2C0 0x51]
MMC: FSL_SDHC: 0, FSL_SDHC: 1
Loading Environment from MMC... *** Warning - bad CRC, using default environment
[*]-Video Link 0it6263_i2c_reg_read, read err 3
faill to read from it6263 revision, ret 3
(1280 x 720)
[0] dpu@56180000, video
[1] lvds-channel@0, display
[2] lvds-to-hdmi-bridge@4c,
i.MX 8QuadMax Applications Processor Reference Manual, Rev. F, 10/2019
root@imx8qmmek:~# uname -a
Linux imx8qmmek 5.4.70-2.3.0+g4f2631b022d8 #1 SMP PREEMPT Wed Dec 16 09:53:54 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux
root@imx8qmmek:~#
use 5.4.70 boot from sd card then flash the flash.bin here is /run/media/mmcblk1p1/imx-boot-imx8qmmek-sd.bin-flash, which copied at sdcard fat partition, to the emmc boot0
all these commands are in the Linux.
imx-boot-imx8qmmek-sd.bin-flash is from 5.4.47 release different from 5.4.70, that we can easily check.
Clean up before test
mmc bootpart enable 0 1 /dev/mmcblk0
mmc extcsd read /dev/mmcblk0
Erased memory content [ERASED_MEM_CONT: 0x00]
Boot configuration bytes [PARTITION_CONFIG: 0x40]
Not boot enable
No access to boot partition
Boot config protection [BOOT_CONFIG_PROT: 0x00]
Boot bus Conditions [BOOT_BUS_CONDITIONS: 0x00]
echo 0 > /sys/block/mmcblk0boot0/force_ro
dd if=/dev/zero of=/dev/mmcblk0boot0 bs=1M count=1
echo 1 > /sys/block/mmcblk0boot0/force_ro
test start
echo 0 > /sys/block/mmcblk0boot0/force_ro
dd if=/run/media/mmcblk1p1/imx-boot-imx8qmmek-sd.bin-flash of=/dev/mmcblk0boot0
echo 1 > /sys/block/mmcblk0boot0/force_ro
mmc bootpart enable 1 1 /dev/mmcblk0
mmc extcsd read /dev/mmcblk0
Boot configuration bytes [PARTITION_CONFIG: 0x48]
Boot Partition 1 enabled
No access to boot partition
Boot config protection [BOOT_CONFIG_PROT: 0x00]
Boot bus Conditions [BOOT_BUS_CONDITIONS: 0x00]
High-density erase group definition [ERASE_GROUP_
not you can see the u-boot is 5.4.47 in mmc0 boot0
U-Boot 2020.04-5.4.47-2.2.0+gffc3fbe7e5 (Sep 12 2020 - 03:33:55 +0000)
CPU: NXP i.MX8QM RevB A53 at 1200 MHz at 27C
Model: NXP i.MX8QM MEK
Board: iMX8QM MEK
Boot: MMC0
DRAM: 6 GiB
TCPC: Vendor ID [0x1fc9], Product ID [0x5110], Addr [I2C0 0x51]
MMC: FSL_SDHC: 0, FSL_SDHC: 1
Loading Environment from MMC... *** Warning - bad CRC, using default environment
[*]-Video Link 0it6263_i2c_reg_read, read err 3
faill to read from it6263 revision, ret 3
(1280 x 720)
[0] dpu@56180000, video
[1] lvds-channel@0, display
[2] lvds-to-hdmi-bridge@4c,
All this documents do not refer to boot0 section of emmc. Imx8mp is not preproduction anymore. UUU is not what I want to use for flash.
I think you need to read the jedec spec for emmc.
And you have no idea of the emmc hardware partitions. in spec, boot1, boot1 and user.
And for the emmc, even you can crate 4 general purpose partitions.
All those are hardware.
You mentioned the mmcblk1p1, mmcblk1p2 ... are are file system concept.
Suggest you can read the following document and then you try to read the JEDEC spec.
eMMC RPMB Enhance and GP
https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/eMMC-RPMB-Enhance-and-GP/ta-p/1099818
unfortunately nxp does not support other options, except uuu for flash programming, sorry.
Best regards
igor
The examples doesn't handle the boot0/1 partitions. Seems that nobody tested this. I datasheet it is mentioned:
"The boot partition can be selected for an MMC4.x card after
the card initialization is complete. The ROM code reads the
BOOT_PARTITION_ENABLE field in the Ext_CSD[179] to get
the boot partition to be set. If there is no boot partition
mentioned in the BOOT_PARTITION_ENABLE field or the
user partition was mentioned, the ROM boots from the user
partition."
This is set properly as stated above.
I think I did everything right:
bootmode is set properly (2=emmc/usdhc3) for imx8mp, I could catch in u-boot Reg 30390070: 02000009
I set boot0 as boot partition by
"mmc partconf 2 1 1 0" or "mmc partconf 2 0 1 0" (one with, one without ACK)
And I could see this is proper set by "mmc partconf 2"
u-boot=> mmc partconf 2
EXT_CSD[179], PARTITION_CONFIG:
BOOT_ACK: 0x1
BOOT_PARTITION_ENABLE: 0x1
PARTITION_ACCESS: 0x0
I flashed with "dd if=flash.bin of=/dev/mmcblk2boot0 bs=1k seek=32" and veryfied by hexdump code starts at 0x8000
So why it is not booting? What did I forget? It boots from /dev/mmcblk2 without problems after switching back by "mmc partconf 2 0 0 0"
try flash to offset 0
I verify on imx8mpevk(lpddr4) is okay
when use the follow command
dd if=imx-boot of=/dev/mmcblk2boot0 bs=4K conv=fsync
and you can to check bootloader_mmc_offset() in uboot-imx/drivers/fastboot/fb_fsl/fb_fsl_partitions.c
Thanks and sorry for the late answer.
I think that I missed just mmc bootpart enable 1 1 /dev/mmcblk0
But one more question: What to set save the environment? I get this error:
Loading Environment from MMC... MMC: block number 0x1 exceeds max(0x0)
MMC: block number 0x2010 exceeds max(0x0)
MMC: block number 0x2210 exceeds max(0x0)
*** Error - No Valid Environment Area found
*** Warning - bad env area, using default environment
An my setting in kernel config is:
[*] Environment in an MMC device
[*] Enable redundant environment support
(0x400000) Environment offset
(0x440000) Redundant environment offset
(0x2000) Environment Size
[*] Relocate gd->env_addr
(2) mmc device number
(0) mmc partition number
I this mmc partition number is wrong, as it should refer to mmcblk2boot0. But what number is used for boot0?
The i.MX8MP binary release contains the uuu script.
The default is to write to the emmc boot0 not the user partition.
BTW, all the i.MX. It is all. the uuu script default is to write to the emmc boot0 not user partition.
and boot0 is the index for the Linux. In the emmc spec, it call boot1, boot2 and user partition.
Please download the i.MX8MP, binary release to check.
Embedded Linux for i.MX Applications Processors | NXP Semiconductors
uuu_version 1.2.39
# This command will be run when i.MX6/7 i.MX8MM, i.MX8MQ
SDP: boot -f imx-boot-imx8mpevk-sd.bin-flash_evk
# This command will be run when ROM support stream mode
# i.MX8QXP, i.MX8QM
SDPS: boot -f imx-boot-imx8mpevk-sd.bin-flash_evk
# These commands will be run when use SPL and will be skipped if no spl
# SDPU will be deprecated. please use SDPV instead of SDPU
# {
SDPU: delay 1000
SDPU: write -f imx-boot-imx8mpevk-sd.bin-flash_evk -offset 0x57c00
SDPU: jump
# }
# These commands will be run when use SPL and will be skipped if no spl
# if (SPL support SDPV)
# {
SDPV: delay 1000
SDPV: write -f imx-boot-imx8mpevk-sd.bin-flash_evk -skipspl
SDPV: jump
# }
FB: ucmd setenv fastboot_dev mmc
FB: ucmd setenv mmcdev ${emmc_dev}
FB: ucmd mmc dev ${emmc_dev}
FB: flash -raw2sparse all imx-image-multimedia-imx8mpevk.wic
FB: flash bootloader imx-boot-imx8mpevk-sd.bin-flash_evk
FB: ucmd if env exists emmc_ack; then ; else setenv emmc_ack 0; fi;
FB: ucmd mmc partconf ${emmc_dev} ${emmc_ack} 1 0
FB: done
>bootmode is set properly (2=emmc/usdhc3) for imx8mp
sorry i.MX8M Plus is not officially released and not supported yet. It is described as
"PREPRODUCTION" on below link
Support can be provided through NXP Professional Services:
https://contact.nxp.com/new-prof-svcs-sw-tech
Best regards
igor
Hi s_arendt
for understanding emmc programming one can refer to sect.4.3.5 Copying the kernel image and DTB file, sect.4.4.1.3 Using eMMC, sect.4.3.4 Copying a bootloader image
sect.5.8.2.2.1 High Level eMMC Boot Flow
i.MX 8DualXPlus/8QuadXPlus Applications Processor Reference Manual
>But device isn't booting. What is the problem?
one can try to program with UUU tool, example_kernel_emmc.uuu included in Demo Image
i.MX 8QuadXPlus(B0, C0) MEK, i.MX 8DualX MEK
https://imxdev.gitlab.io/tutorial/How_to_use_UUU_to_flash_the_iMX_boards/
https://github.com/NXPmicro/mfgtools/wiki/Sample-script
https://github.com/NXPmicro/mfgtools
Best regards
igor