how to flash u-boot/zImage/dtb/rootfs separately to eMMC with UUU tools

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

how to flash u-boot/zImage/dtb/rootfs separately to eMMC with UUU tools

Jump to solution
11,238 Views
yibhan
Contributor III

I have a question about using UUU tools.

I am trying to flash u-boot / zImage / dtb / rootfs separately with UUU tools. My reference board is imx6qp.

 

How to flash those images separately to eMMC device with UUU tools?

Labels (3)
0 Kudos
1 Solution
10,849 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi Yibeom,

   i.MX6/7 are the same as that of i.MX8MM & I.MX8MQ. but i.MX6/7 should be u-boot.imx. so you should modify the script for yours.

(1) _flash.bin ---> u-boot.imx

# This command will be run when i.MX6/7 i.MX8MM, i.MX8MQ
SDP: boot -f _flash.bin     (Here _flash.bin should be replaced with u-boot.imx)

That is : SDP: boot -f u-boot.imx

Other lines including _flash.bin should be changed by u-boot.imx

(2) _Image ---- > zImage

change it please!

(3) _board.dtb --- >  your dtb's name in linux kernel

change it , please!

(4) _initramfs.cpio.gz.uboot --- >Using the one provided in Demo Image.

In our demo image, the ramfs has been provided, you don't need to recompile it. Name should be changed to be

fsl-image-mfgtool-initramfs-imx_mfgtools.cpio.gz.u-boot

(5) optee

comment these 2 lines if there is no optee.

#FBK: ucp  _uTee.tar t:/tmp/op.tar
#FBK: ucmd tar -xf /tmp/op.tar -C /mnt/fat

(6)_rootfs.tar.bz2 --- > your roofs's name

change it , please!

the working flow of uuu script is :

(1) Loading u-boot-imx / kernel dtb / zImage / ramfs to DDR , then run it.

(2) writing u-boot-imx / kernel dtb / zImage & rootfs to eMMC or other flash on board.

[comment]

In the script, u-boot can write itself to eMMC. the command is to do it.

FB: flash bootloader _flash.bin

If you don't want u-boot to do it, you can commment the line.

So if you understand how the script is working, you can seperate 3 script: flashing u-boot, flashing dtb & zImage, flashing rootfs.  for example, u-boot-script.uuu, zImage-dtb.uuu & rootfs-script.uuu.

then using these commands to flash them to eMMC:

# uuu u-boot-script.uuu

# uuu  zImage-dtb.uuu

# uuu rootfs-script.uuu

Pay attention to this: each script should have these commands at begining:

------------------------------------------

uuu_version 1.2.39

# Please Replace below items with actually file names
# @_flash.bin            | boot loader
# @_Image            | kernel image, arm64 is Image, arm32 it is zImage
# @_board.dtb            | board dtb file
# @_initramfs.cpio.gz.uboot    | mfgtool init ramfs
# @_rootfs.tar.bz2        | rootfs
# @_uTee.tar            | optee image, put dummy _uTee.tar file here if platform is not MX6/MX7*

# This command will be run when i.MX6/7 i.MX8MM, i.MX8MQ
SDP: boot -f u-boot.imx

# This command will be run when ROM support stream mode
# i.MX8QXP, i.MX8QM
#SDPS: boot -f _flash.bin

# 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 u-boot.imx -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 u-boot.imx -skipspl
SDPV: jump
# }

# use uboot burn bootloader to eMMC
# becaue difference chip, offset is difference
# you can use kernel to do that for specific boards
FB: ucmd setenv fastboot_dev mmc
FB: ucmd setenv mmcdev ${emmc_dev}

# if you don't want to write u-boot.imx to eMMC here, comment below line, please!
FB: flash bootloader u-boot.imx

FB: ucmd if env exists emmc_ack; then ; else setenv emmc_ack 0; fi;

FB: ucmd setenv emmc_cmd mmc partconf ${emmc_dev} ${emmc_ack} 1 0
FB: ucmd if test "${emmc_skip_fb}" != "yes"; then run emmc_cmd; fi
FB: ucmd setenv emmc_cmd mmc bootbus ${emmc_dev} 2 2 1;
FB: ucmd if test "${emmc_skip_fb}" != "yes"; then run emmc_cmd; fi

FB: ucmd setenv fastboot_buffer ${loadaddr}
FB: download -f _Image
FB: ucmd setenv fastboot_buffer ${fdt_addr}
FB: download -f _board.dtb
FB: ucmd setenv fastboot_buffer ${initrd_addr}
FB: download -f _initramfs.cpio.gz.uboot
#FB: ucmd setenv bootargs console=${console},${baudrate} earlycon=${earlycon},${baudrate}
FB: acmd ${kboot} ${loadaddr} ${initrd_addr} ${fdt_addr}

-----------------------------------------------------

Above commands can ensure OS Firmware to run in DDR, then begin to write kernel dtb / zImage and rootfs to eMMC.

if you like, you can seperate it to 3 scripts for your purpose.

In addition, it is very simple to flash u-boot, only one command you need:

# uuu -b emmc u-boot.imx

Hope above description is helpful to you.

Have  a nice day!

B.R,

Weidong

View solution in original post

0 Kudos
8 Replies
10,849 Views
scooter1986
Contributor I

hello, have you manage to work it out ?  i doing the same now with NAND, please let me know if you could provide your config

0 Kudos
10,849 Views
yibhan
Contributor III

Hi guy,

Thank you for your support.

I am ok now for booting the device, but if i add comment two lines, the device should ask not adding uTee file. because of tee_file=yes, so I have added uTee-6qpsdb file to uuu script file.

I have added same name files in u-boot environment as the real file name in image folder which I just renamed those files(dtb, uTee files). 

Your comment would be helpful for me. Thanks ~

0 Kudos
10,849 Views
yibhan
Contributor III

Hi guy,

When I was using uuu.auto, It was booted in the reference board. but when using modified in example_kernel_uuu with my built name, it was not booted.

I have compared printenv infos with booting ok and nok, but main difference, i guess, is tee_file.

ok one is "undefined", but nok one is "uTee-6qpsdb", I was using same u-boot image with uuu.auto and example_kernel_uuu.

Is it possible to make difference to be able to ok to boot or not? if so, Should I change u-boot code for fixing that?

0 Kudos
10,850 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi Yibeom,

   i.MX6/7 are the same as that of i.MX8MM & I.MX8MQ. but i.MX6/7 should be u-boot.imx. so you should modify the script for yours.

(1) _flash.bin ---> u-boot.imx

# This command will be run when i.MX6/7 i.MX8MM, i.MX8MQ
SDP: boot -f _flash.bin     (Here _flash.bin should be replaced with u-boot.imx)

That is : SDP: boot -f u-boot.imx

Other lines including _flash.bin should be changed by u-boot.imx

(2) _Image ---- > zImage

change it please!

(3) _board.dtb --- >  your dtb's name in linux kernel

change it , please!

(4) _initramfs.cpio.gz.uboot --- >Using the one provided in Demo Image.

In our demo image, the ramfs has been provided, you don't need to recompile it. Name should be changed to be

fsl-image-mfgtool-initramfs-imx_mfgtools.cpio.gz.u-boot

(5) optee

comment these 2 lines if there is no optee.

#FBK: ucp  _uTee.tar t:/tmp/op.tar
#FBK: ucmd tar -xf /tmp/op.tar -C /mnt/fat

(6)_rootfs.tar.bz2 --- > your roofs's name

change it , please!

the working flow of uuu script is :

(1) Loading u-boot-imx / kernel dtb / zImage / ramfs to DDR , then run it.

(2) writing u-boot-imx / kernel dtb / zImage & rootfs to eMMC or other flash on board.

[comment]

In the script, u-boot can write itself to eMMC. the command is to do it.

FB: flash bootloader _flash.bin

If you don't want u-boot to do it, you can commment the line.

So if you understand how the script is working, you can seperate 3 script: flashing u-boot, flashing dtb & zImage, flashing rootfs.  for example, u-boot-script.uuu, zImage-dtb.uuu & rootfs-script.uuu.

then using these commands to flash them to eMMC:

# uuu u-boot-script.uuu

# uuu  zImage-dtb.uuu

# uuu rootfs-script.uuu

Pay attention to this: each script should have these commands at begining:

------------------------------------------

uuu_version 1.2.39

# Please Replace below items with actually file names
# @_flash.bin            | boot loader
# @_Image            | kernel image, arm64 is Image, arm32 it is zImage
# @_board.dtb            | board dtb file
# @_initramfs.cpio.gz.uboot    | mfgtool init ramfs
# @_rootfs.tar.bz2        | rootfs
# @_uTee.tar            | optee image, put dummy _uTee.tar file here if platform is not MX6/MX7*

# This command will be run when i.MX6/7 i.MX8MM, i.MX8MQ
SDP: boot -f u-boot.imx

# This command will be run when ROM support stream mode
# i.MX8QXP, i.MX8QM
#SDPS: boot -f _flash.bin

# 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 u-boot.imx -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 u-boot.imx -skipspl
SDPV: jump
# }

# use uboot burn bootloader to eMMC
# becaue difference chip, offset is difference
# you can use kernel to do that for specific boards
FB: ucmd setenv fastboot_dev mmc
FB: ucmd setenv mmcdev ${emmc_dev}

# if you don't want to write u-boot.imx to eMMC here, comment below line, please!
FB: flash bootloader u-boot.imx

FB: ucmd if env exists emmc_ack; then ; else setenv emmc_ack 0; fi;

FB: ucmd setenv emmc_cmd mmc partconf ${emmc_dev} ${emmc_ack} 1 0
FB: ucmd if test "${emmc_skip_fb}" != "yes"; then run emmc_cmd; fi
FB: ucmd setenv emmc_cmd mmc bootbus ${emmc_dev} 2 2 1;
FB: ucmd if test "${emmc_skip_fb}" != "yes"; then run emmc_cmd; fi

FB: ucmd setenv fastboot_buffer ${loadaddr}
FB: download -f _Image
FB: ucmd setenv fastboot_buffer ${fdt_addr}
FB: download -f _board.dtb
FB: ucmd setenv fastboot_buffer ${initrd_addr}
FB: download -f _initramfs.cpio.gz.uboot
#FB: ucmd setenv bootargs console=${console},${baudrate} earlycon=${earlycon},${baudrate}
FB: acmd ${kboot} ${loadaddr} ${initrd_addr} ${fdt_addr}

-----------------------------------------------------

Above commands can ensure OS Firmware to run in DDR, then begin to write kernel dtb / zImage and rootfs to eMMC.

if you like, you can seperate it to 3 scripts for your purpose.

In addition, it is very simple to flash u-boot, only one command you need:

# uuu -b emmc u-boot.imx

Hope above description is helpful to you.

Have  a nice day!

B.R,

Weidong

0 Kudos
10,192 Views
zhengbing
Contributor I

你好, weidong_sun

参考给出的修改方式,修改“example_kernel_emmc.uuu”之后仍未烧写成功,烦请帮忙看一下是否哪里有误呢?谢谢!

如下图所示 uuu停在了该位置

Snipaste_2020-11-10_09-31-06.png终端有重复打印No udc AvailableSnipaste_2020-11-10_09-37-03.png再次感谢!

 

0 Kudos
10,849 Views
yibhan
Contributor III

Hi guy,

Thank you for answering. As you mentioned before, I have referenced example_kernel_emmc.uuu in LF_v5.4.y-1.0.0_images_MX6QPDLSOLOX, but examples is based in i.MX8MQ, i guess.

After I modified example script, flash images(uboot, kernel, rootfs) with the script, but device don't boot up.

Below is error logs:

"Wrong Image Format for bootm command"

"ERROR: can't get kernel image!"

Below are u-boot environment for loading kernel image:

loadaddr : 0x12000000

fdt_addr: 0x18000000

initrd_addr: 0x12C00000

I renamed in that example uu file to my image names.

Could you guild me what I missed to modify the example script file?

0 Kudos
10,849 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi Yibeom,

For operating method with uuu tool, i.MX6 and I.MX7 are the same.

2 documents for you are enough to operate it.

uuu.pdf and example of script.

See attachment, please!

Have a nice day!

B.R,

Weidong

0 Kudos
10,849 Views
scooter1986
Contributor I

hi, i looking for a similar workaround but with NAND memory.

can you please help me out ?  https://community.nxp.com/thread/535955 

thank you so much for your time

0 Kudos