Closed aleeraser closed 1 year ago
You can use customer script to do that.
below this example:
Thanks for the quick answer. May I ask you to elaborate further on the fastboot_blk
var?
Any name, just round up bytes to MMC block numbers.
Understood, thanks.
It seems I can't make it working.
I'm using mmc partconf
to switch between boot0 and boot1 partitions, and I'm writing the boot container at address 0x0.
However, it looks like that even when I switch to boot1, (i.e. mmc partconf 0 1 2 1
) the mmc write
operation still writes to boot0, since as I reboot I can see that the imx-boot-ALTERNATE.bin is being run.
How can I switch the mmc write
target to the second boot partition ?
Here is my uuu script (EDIT: updated with working version - see comments below):
uuu_version 1.2.39
SDPS: boot -f imx-boot.bin
SDPV: delay 1000
SDPV: write -f imx-boot.bin -skipspl
SDPV: jump
FB: ucmd setenv fastboot_dev mmc
FB: ucmd setenv mmcdev $emmc_dev
FB: ucmd echo flashing first parttion
FB: ucmd setenv fastboot_buffer $loadaddr
FB: download -f imx-boot.bin
FB: ucmd setexpr fastboot_blk $fastboot_bytes
FB: ucmd setexpr fastboot_blk $fastboot_blk + 0x1FF
FB: ucmd setexpr fastboot_blk $fastboot_blk / 0x200
FB: ucmd mmc dev $emmc_dev 1
FB: ucmd echo fastboot_buffer: $fastboot_buffer
FB: ucmd echo fastboot_blk: $fastboot_blk
FB: ucmd mmc write $fastboot_buffer 0 $fastboot_blk
FB: ucmd echo flashing second parttion
FB: download -f imx-boot-ALTERNATE.bin
FB: ucmd setexpr fastboot_blk $fastboot_bytes
FB: ucmd setexpr fastboot_blk $fastboot_blk + 0x1FF
FB: ucmd setexpr fastboot_blk $fastboot_blk / 0x200
FB: ucmd mmc dev $emmc_dev 2
FB: ucmd mmc write $fastboot_buffer 0 $fastboot_blk
FB: ucmd mmc partconf $emmc_dev 1 1 0
FB: Done
Actually it is uboot's behavior. Can you try add FB: ucmd mmc partconf $emmc_dev 1 1 0 before write second's partition?
You mean replacing
FB: ucmd mmc partconf $emmc_dev 1 2 1
with
FB: ucmd mmc partconf $emmc_dev 1 1 0
or simply adding it before it?
simple adding it.
u-boot=> help mmc
...., suppose only one
mmc partconf
Unfortunately it doesn't help.
If in U-Boot I switch partitions with mmc partconf 0 1 1/2 0
and reboot, I can see that the correct U-Boot version starts... but I'm unable to flash it.
Those are the partitions as seen by fastboot:
idx 0, ptn 0 name='gpt' start=0 len=2048
idx 1, ptn 0 name='' start=0 len=0
idx 2, ptn 0 name='all' start=0 len=15384576
idx 3, ptn 0 name='bootloader' start=0 len=64512
idx 4, ptn 1 name='mmcsda1' start=8 len=1638400
idx 5, ptn 2 name='mmcsda2' start=1638408 len=1638400
idx 6, ptn 3 name='mmcsda3' start=3276808 len=9172992
What looks strange to me is that I can access and flash boot1 partition from linux. Only U-Boot is unable to see it.
I figured it out. In order to access boot0
and boot1
boot partitions of the eMMC, the right command is not mmc partconf
but mmc dev
.
mmc dev 0 1
mmc dev 0 2
I updated the previous script I posted and was able to flash both boot partitions. This can be closed.
Can you provide your work script? I can put it to FAQ wiki page.
As I mentioned, I updated the script in my previous post
Thanks, update faq: https://github.com/nxp-imx/mfgtools/wiki/FAQ
Is it possible to flash the bootloader (U-Boot) for both boot partitions on an eMMC?
Right now, the normal
-b emmc
command only flashes the first boot partition.