imx8mm如何使用SD卡升级,如何做卡

cancel
Showing results for 
Search instead for 
Did you mean: 

imx8mm如何使用SD卡升级,如何做卡

64 Views
Contributor I

你好!

       我想用SD卡对emmc进行升级,请问如何做卡.

0 Kudos
6 Replies

53 Views
Contributor I

Hi Weidong,

       现在我就是参考example_kernel_emmc.uuu来做的,我想先用uuu下载试试, 但烧写时出现了错误.

[ 3.772388] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[ 3.779885] Please append a correct "root=" boot option; here are the available partitions:
[ 3.788249] 1f00 32768 mtdblock0
[ 3.788250] (driver?)
[ 3.794812] b300 15388672 mmcblk2
[ 3.794813] driver: mmcblk
[ 3.801620] b301 85196 mmcblk2p1 5d239f25-01
[ 3.801621]
[ 3.808423] b302 1983682 mmcblk2p2 5d239f25-02
[ 3.808423]
[ 3.815232] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

 

我将example_kernel_emmc.uuu修改为如下内容:

其中不明白的是_initramfs.cpio.gz.uboot文件是怎么来的, 我是用rootfs.ext4去制作的rootfs.ext4.gz.uboot

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 imx-boot-imx8mmevk-sd.bin-flash_evk

# This command will be run when ROM support stream mode
# i.MX8QXP, i.MX8QM
SDPS: boot -f imx-boot-imx8mmevk-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-imx8mmevk-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-imx8mmevk-sd.bin-flash_evk -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}
FB: flash bootloader imx-boot-imx8mmevk-sd.bin-flash_evk

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 imx8mm-evk.dtb
FB: ucmd setenv fastboot_buffer ${initrd_addr}
FB: download -f rootfs.ext4.gz.uboot

#FB: ucmd setenv bootargs console=${console},${baudrate} earlycon=${earlycon},${baudrate}
#FB: acmd ${kboot} ${loadaddr} ${initrd_addr} ${fdt_addr}
FB: acmd ${kboot} ${loadaddr} - ${fdt_addr}

# get mmc dev number from kernel command line
# Wait for emmc
FBK: ucmd while [ ! -e /dev/mmcblk*boot0 ]; do sleep 1; echo "wait for /dev/mmcblk*boot* appear"; done;

# serach emmc device number, if your platform have more than two emmc chip, please echo dev number >/tmp/mmcdev
FBK: ucmd dev=`ls /dev/mmcblk*boot*`; dev=($dev); dev=${dev[0]}; dev=${dev#/dev/mmcblk}; dev=${dev%boot*}; echo $dev > /tmp/mmcdev;

# dd to clear the possible MBR
FBK: ucmd mmc=`cat /tmp/mmcdev`; dd if=/dev/zero of=/dev/mmcblk${mmc} bs=512 count=1
# create partition
FBK: ucmd mmc=`cat /tmp/mmcdev`; PARTSTR=$'10M,500M,0c\n600M,,83\n'; echo "$PARTSTR" | sfdisk --force /dev/mmcblk${mmc}

FBK: ucmd mmc=`cat /tmp/mmcdev`; dd if=/dev/zero of=/dev/mmcblk${mmc} bs=1k seek=4096 count=1
FBK: ucmd sync
# you can enable below command to write boot partition. but offset is difference at difference platform
#FBK: ucmd mmc=`cat /tmp/mmcdev`; echo 0 > /sys/block/mmcblk${mmc}boot0/force_ro
#FBK: ucp imx-boot-imx8mmevk-sd.bin-flash_evk t:/tmp
#FBK: ucmd mmc=`cat /tmp/mmcdev`; dd if=/tmp/imx-boot-imx8mmevk-sd.bin-flash_evk of=/dev/mmc${mmc}boot0 bs=1K seek=32
#FBK: ucmd mmc=`cat /tmp/mmcdev`; echo 1 > /sys/block/mmcblk${mmc}boot0/force_ro
FBK: ucmd mmc=`cat /tmp/mmcdev`; while [ ! -e /dev/mmcblk${mmc}p1 ]; do sleep 1; done
FBK: ucmd mmc=`cat /tmp/mmcdev`; mkfs.vfat /dev/mmcblk${mmc}p1
FBK: ucmd mmc=`cat /tmp/mmcdev`; mkdir -p /mnt/fat
FBK: ucmd mmc=`cat /tmp/mmcdev`; mount -t vfat /dev/mmcblk${mmc}p1 /mnt/fat
FBK: ucp Image t:/mnt/fat
FBK: ucp imx8mm-evk.dtb t:/mnt/fat
FBK: ucp tee.bin t:/mnt/fat
FBK: ucmd umount /mnt/fat
FBK: ucmd mmc=`cat /tmp/mmcdev`; mkfs.ext4 -F -E nodiscard /dev/mmcblk${mmc}p2
FBK: ucmd mkdir -p /mnt/ext4
FBK: ucmd mmc=`cat /tmp/mmcdev`; mount /dev/mmcblk${mmc}p2 /mnt/ext4
FBK: acmd export EXTRACT_UNSAFE_SYMLINKS=1; tar -jx -C /mnt/ext4
FBK: ucp core-image-minimal-imx8mmevk-20200917091805.rootfs.tar.bz2 t:-
FBK: Sync
FBK: ucmd umount /mnt/ext4
FBK: DONE

0 Kudos

59 Views
NXP TechSupport
NXP TechSupport

Hi zuzh,

在这里给你提供一个思路,您按照这个思路去尝试一下:

1. 把linux image写入到SD卡里,使得该SD卡可以启动板子。

2. 把 你要update的image复制到这张SD卡里(bootload, dtb, kernel, rootfs),弄一个目录保存这些image。

3. 手工方法对eMMC的image进行更新

---用这张SD卡启动板子,并可以看到eMMC具体地被驱动为mmc0,mmc1.....

---此时,你可以参考i.MX_Linux_User's_Guide.pdf中描述的对sd的操作方法,update eMMC的内容。

同时,你也可以根据uuu烧写工具执行的脚本中的命令顺序,给你提供参考,即可以知道对eMMC做了哪些操作。从我们的网站下载一个demo image,解压缩后而已看到samples目录中的uuu脚本样本参考,比如:example_kernel_emmc.uuu

 

这样就可以通过SD对eMMC更新image了。有些客户已经实现了这个目的。

 

B.R,

Weidong

 

0 Kudos

50 Views
Contributor I

Hi Weidong,

       现在我就是参考example_kernel_emmc.uuu来做的,我想先用uuu下载试试, 但烧写时出现了错误.

[ 3.772388] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[ 3.779885] Please append a correct "root=" boot option; here are the available partitions:
[ 3.788249] 1f00 32768 mtdblock0
[ 3.788250] (driver?)
[ 3.794812] b300 15388672 mmcblk2
[ 3.794813] driver: mmcblk
[ 3.801620] b301 85196 mmcblk2p1 5d239f25-01
[ 3.801621]
[ 3.808423] b302 1983682 mmcblk2p2 5d239f25-02
[ 3.808423]
[ 3.815232] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

 

我将example_kernel_emmc.uuu修改为如下内容:

其中不明白的是_initramfs.cpio.gz.uboot文件是怎么来的, 我是用rootfs.ext4去制作的rootfs.ext4.gz.uboot

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 imx-boot-imx8mmevk-sd.bin-flash_evk

# This command will be run when ROM support stream mode
# i.MX8QXP, i.MX8QM
SDPS: boot -f imx-boot-imx8mmevk-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-imx8mmevk-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-imx8mmevk-sd.bin-flash_evk -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}
FB: flash bootloader imx-boot-imx8mmevk-sd.bin-flash_evk

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 imx8mm-evk.dtb
FB: ucmd setenv fastboot_buffer ${initrd_addr}
FB: download -f rootfs.ext4.gz.uboot

#FB: ucmd setenv bootargs console=${console},${baudrate} earlycon=${earlycon},${baudrate}
#FB: acmd ${kboot} ${loadaddr} ${initrd_addr} ${fdt_addr}
FB: acmd ${kboot} ${loadaddr} - ${fdt_addr}

# get mmc dev number from kernel command line
# Wait for emmc
FBK: ucmd while [ ! -e /dev/mmcblk*boot0 ]; do sleep 1; echo "wait for /dev/mmcblk*boot* appear"; done;

# serach emmc device number, if your platform have more than two emmc chip, please echo dev number >/tmp/mmcdev
FBK: ucmd dev=`ls /dev/mmcblk*boot*`; dev=($dev); dev=${dev[0]}; dev=${dev#/dev/mmcblk}; dev=${dev%boot*}; echo $dev > /tmp/mmcdev;

# dd to clear the possible MBR
FBK: ucmd mmc=`cat /tmp/mmcdev`; dd if=/dev/zero of=/dev/mmcblk${mmc} bs=512 count=1
# create partition
FBK: ucmd mmc=`cat /tmp/mmcdev`; PARTSTR=$'10M,500M,0c\n600M,,83\n'; echo "$PARTSTR" | sfdisk --force /dev/mmcblk${mmc}

FBK: ucmd mmc=`cat /tmp/mmcdev`; dd if=/dev/zero of=/dev/mmcblk${mmc} bs=1k seek=4096 count=1
FBK: ucmd sync
# you can enable below command to write boot partition. but offset is difference at difference platform
#FBK: ucmd mmc=`cat /tmp/mmcdev`; echo 0 > /sys/block/mmcblk${mmc}boot0/force_ro
#FBK: ucp imx-boot-imx8mmevk-sd.bin-flash_evk t:/tmp
#FBK: ucmd mmc=`cat /tmp/mmcdev`; dd if=/tmp/imx-boot-imx8mmevk-sd.bin-flash_evk of=/dev/mmc${mmc}boot0 bs=1K seek=32
#FBK: ucmd mmc=`cat /tmp/mmcdev`; echo 1 > /sys/block/mmcblk${mmc}boot0/force_ro
FBK: ucmd mmc=`cat /tmp/mmcdev`; while [ ! -e /dev/mmcblk${mmc}p1 ]; do sleep 1; done
FBK: ucmd mmc=`cat /tmp/mmcdev`; mkfs.vfat /dev/mmcblk${mmc}p1
FBK: ucmd mmc=`cat /tmp/mmcdev`; mkdir -p /mnt/fat
FBK: ucmd mmc=`cat /tmp/mmcdev`; mount -t vfat /dev/mmcblk${mmc}p1 /mnt/fat
FBK: ucp Image t:/mnt/fat
FBK: ucp imx8mm-evk.dtb t:/mnt/fat
FBK: ucp tee.bin t:/mnt/fat
FBK: ucmd umount /mnt/fat
FBK: ucmd mmc=`cat /tmp/mmcdev`; mkfs.ext4 -F -E nodiscard /dev/mmcblk${mmc}p2
FBK: ucmd mkdir -p /mnt/ext4
FBK: ucmd mmc=`cat /tmp/mmcdev`; mount /dev/mmcblk${mmc}p2 /mnt/ext4
FBK: acmd export EXTRACT_UNSAFE_SYMLINKS=1; tar -jx -C /mnt/ext4
FBK: ucp core-image-minimal-imx8mmevk-20200917091805.rootfs.tar.bz2 t:-
FBK: Sync
FBK: ucmd umount /mnt/ext4
FBK: DONE

0 Kudos

47 Views
NXP TechSupport
NXP TechSupport

_initramfs.cpio.gz.uboot,当使用uuu的时候,这个地方要换成和实际的名字,在demo image里有这个文件。这是initramfs。当USB OTG启动的时候,u-boot、kernel ,initramfs会先在DDR里跑起来,然后才会有分区、格式化、dd命令可以运行。才能开始烧写image到目标flash里。

 

而你的情况,是SD卡启动系统,已经起来了,不需要使用这个initramfs了,既然SD卡已经启动了,那么往eMMC里写东西,和往sd开写东西是一样的。example_kernel_emmc.uuu的内容只是让你理解执行的顺序,也就是都干了哪些事情。但是,对sd卡的手工操作,你还是要仔细地按照i.MX_User's_Guide.pdf文档里做,也就是说你的SD卡启动系统后,对eMMC的操作也是这么做的。

 

weidong

 

0 Kudos

43 Views
Contributor I

Hi Weidong!

     我在将initramfs文件选上了, 但是运行时卡在了UTP上,请问这是什么原因,报错如下:

write string
Start handle command
uuc /dev/utp
uuc 0.6 [built May 30 2020 16:42:14]
UTP: Waiting for /dev/utp to appear

0 Kudos

51 Views
Contributor I
Hi Weidong, 现在我就是参考example_kernel_emmc.uuu来做的,我想先用uuu下载试试, 但烧写时出现了错误. [ 3.772388] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6 [ 3.779885] Please append a correct "root=" boot option; here are the available partitions: [ 3.788249] 1f00 32768 mtdblock0 [ 3.788250] (driver?) [ 3.794812] b300 15388672 mmcblk2 [ 3.794813] driver: mmcblk [ 3.801620] b301 85196 mmcblk2p1 5d239f25-01 [ 3.801621] [ 3.808423] b302 1983682 mmcblk2p2 5d239f25-02 [ 3.808423] [ 3.815232] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) 我将example_kernel_emmc.uuu修改为如下内容: 其中不明白的是_initramfs.cpio.gz.uboot文件是怎么来的, 我是用rootfs.ext4去制作的rootfs.ext4.gz.uboot 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 imx-boot-imx8mmevk-sd.bin-flash_evk # This command will be run when ROM support stream mode # i.MX8QXP, i.MX8QM SDPS: boot -f imx-boot-imx8mmevk-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-imx8mmevk-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-imx8mmevk-sd.bin-flash_evk -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} FB: flash bootloader imx-boot-imx8mmevk-sd.bin-flash_evk 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 imx8mm-evk.dtb FB: ucmd setenv fastboot_buffer ${initrd_addr} FB: download -f rootfs.ext4.gz.uboot #FB: ucmd setenv bootargs console=${console},${baudrate} earlycon=${earlycon},${baudrate} #FB: acmd ${kboot} ${loadaddr} ${initrd_addr} ${fdt_addr} FB: acmd ${kboot} ${loadaddr} - ${fdt_addr} # get mmc dev number from kernel command line # Wait for emmc FBK: ucmd while [ ! -e /dev/mmcblk*boot0 ]; do sleep 1; echo "wait for /dev/mmcblk*boot* appear"; done; # serach emmc device number, if your platform have more than two emmc chip, please echo dev number >/tmp/mmcdev FBK: ucmd dev=`ls /dev/mmcblk*boot*`; dev=($dev); dev=${dev[0]}; dev=${dev#/dev/mmcblk}; dev=${dev%boot*}; echo $dev > /tmp/mmcdev; # dd to clear the possible MBR FBK: ucmd mmc=`cat /tmp/mmcdev`; dd if=/dev/zero of=/dev/mmcblk${mmc} bs=512 count=1 # create partition FBK: ucmd mmc=`cat /tmp/mmcdev`; PARTSTR=$'10M,500M,0c\n600M,,83\n'; echo "$PARTSTR" | sfdisk --force /dev/mmcblk${mmc} FBK: ucmd mmc=`cat /tmp/mmcdev`; dd if=/dev/zero of=/dev/mmcblk${mmc} bs=1k seek=4096 count=1 FBK: ucmd sync # you can enable below command to write boot partition. but offset is difference at difference platform #FBK: ucmd mmc=`cat /tmp/mmcdev`; echo 0 > /sys/block/mmcblk${mmc}boot0/force_ro #FBK: ucp imx-boot-imx8mmevk-sd.bin-flash_evk t:/tmp #FBK: ucmd mmc=`cat /tmp/mmcdev`; dd if=/tmp/imx-boot-imx8mmevk-sd.bin-flash_evk of=/dev/mmc${mmc}boot0 bs=1K seek=32 #FBK: ucmd mmc=`cat /tmp/mmcdev`; echo 1 > /sys/block/mmcblk${mmc}boot0/force_ro FBK: ucmd mmc=`cat /tmp/mmcdev`; while [ ! -e /dev/mmcblk${mmc}p1 ]; do sleep 1; done FBK: ucmd mmc=`cat /tmp/mmcdev`; mkfs.vfat /dev/mmcblk${mmc}p1 FBK: ucmd mmc=`cat /tmp/mmcdev`; mkdir -p /mnt/fat FBK: ucmd mmc=`cat /tmp/mmcdev`; mount -t vfat /dev/mmcblk${mmc}p1 /mnt/fat FBK: ucp Image t:/mnt/fat FBK: ucp imx8mm-evk.dtb t:/mnt/fat FBK: ucp tee.bin t:/mnt/fat FBK: ucmd umount /mnt/fat FBK: ucmd mmc=`cat /tmp/mmcdev`; mkfs.ext4 -F -E nodiscard /dev/mmcblk${mmc}p2 FBK: ucmd mkdir -p /mnt/ext4 FBK: ucmd mmc=`cat /tmp/mmcdev`; mount /dev/mmcblk${mmc}p2 /mnt/ext4 FBK: acmd export EXTRACT_UNSAFE_SYMLINKS=1; tar -jx -C /mnt/ext4 FBK: ucp core-image-minimal-imx8mmevk-20200917091805.rootfs.tar.bz2 t:- FBK: Sync FBK: ucmd umount /mnt/ext4 FBK: DONE
0 Kudos