This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux: vision SDK 3.02 with earlyboot, how to burn the sd card file to emmc

Expert 1615 points
Other Parts Discussed in Thread: DRA722

Tool/software: Linux

In the old boot process,


My sd card boot partition will put uven.txt and uenv-emmc.txt,


When booting from sd card, spl will read the environment variable of uven.txt.


When executing ./mk-eMMC-boot.sh --device /dev/mmcblk1


Will grab environment variables from uenv-emmc.txt,

However, in earlyboot, these parameters were changed to /chosen in dra72-evm-infoadas.dts.


And there is no uven.txt and uenv-emmc.txt in the boot partition.


Then when I want to burn the sd card file to emmc,


How can I go to burn?

Error when executing ./mk-eMMC-boot.sh --device /dev/mmcblk1,


Cp: can't stat '/tmp/sdk/1347/mmc_boot/uenv-emmc.txt': No such file or directory

ERROR: executing cp /tmp/sdk/1347/mmc_boot/uenv-emmc.txt /tmp/sdk/1347/emmc_boot/uenv.txt

  • Hi,

    Please follow the below steps:

    1. Copy the file uenv-emmc.txt to your boot-partition and run the script, it should update your EMMC with the boot and rootfs partition

    2. After the script completes, mount the boot-partition of the EMMC, and the boot partition of your SD card, and run the below commands:

    #mount the boot partition of the SD card
    mount /dev/mmcblk0p1 /media/boot_sd

    #mount the boot partition of the EMMC
    mount /dev/mmcbl1kp1 /media/boot_emmc

    rm /media/boot_emmc/*
    cp /media/boot_sd/* /media/boot_emmc/

    3. Rebuild the device-tree after updating the chosen node to fetch the file-system from EMMC instead of SD (set root=/dev/mmcblk1p2). Copy this updated device-tree to the rootfs partition on the SD card (call the updated device-tree as 'boot-from-emmc.dtb').

    4. Run the below command to update the device-tree on the boot partition of the EMMC
    cp boot-from-emmc.dtb /media/boot_emmc/single-stage-boot.dtb

    5. Unmount the boot paritions and power-off the board:
    umount /media/boot*
    sync

    6. Modify the switch settings to boot from EMMC.
    SYSBOOT [0:15] 00011100 10000001

    Reboot the board, you should see the board boot from EMMC, with the file-system also in EMMC.

    Regards
    Shravan
  • Hi,

    I have already burned it successfully.

    But on our own develop board, there is no switch.

    Our previous practice was in the uboot phase.

    Interrupt it and follow some instructions to select boot by sd card or emmc

    Env default -a
    Setenv bootpart 1:2
    Setenv mmcdev 1
    Saveenv

    But now earlyboot will not go through the uboot phase.

    Is there any way to solve it?
  • Hi,

    Update the variables 'mmcdev' and add an entry for 'bootpart' under the section #define DEFAULT_MMC_TI_ARGS in the file include/configs/ti_armv7_common.h in u-boot. Rebuild u-boot, and copy the MLO to the EMMC. This should resolve your issue.


    Regards

    Shravan

  • i changed

    #define DEFAULT_MMC_TI_ARGS \

    "mmcdev=0\0" \

    "mmcrootfstype=ext4 rootwait\0" \

    "finduuid=part uuid mmc ${bootpart} uuid\0" \

    "args_mmc=run finduuid;setenv bootargs console=${console} " \

    "${optargs} " \

    "root=PARTUUID=${uuid} rw " \

    "rootfstype=${mmcrootfstype}\0" \

    "loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr\0" \

    "bootscript=echo Running bootscript from mmc${mmcdev} ...; " \

    "source ${loadaddr}\0" \

    "bootenvfile=uEnv.txt\0" \

    "importbootenv=echo Importing environment from mmc${mmcdev} ...; " \

    "env import -t ${loadaddr} ${filesize}\0" \

    "loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}\0" \

    "loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \

    "loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \

    "envboot=mmc dev ${mmcdev}; " \

    "if mmc rescan; then " \

    "echo SD/MMC found on device ${mmcdev};" \

    "if run loadbootscript; then " \

    "run bootscript;" \

    "else " \

    "if run loadbootenv; then " \

    "echo Loaded env from ${bootenvfile};" \

    "run importbootenv;" \

    "fi;" \

    "if test -n $uenvcmd; then " \

    "echo Running uenvcmd ...;" \

    "run uenvcmd;" \

    "fi;" \

    "fi;" \

    "fi;\0" \

    "mmcloados=run args_mmc; " \

    "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \

    "if run loadfdt; then " \

    "bootz ${loadaddr} - ${fdtaddr}; " \

    "else " \

    "if test ${boot_fdt} = try; then " \

    "bootz; " \

    "else " \

    "echo WARN: Cannot load the DT; " \

    "fi; " \

    "fi; " \

    "else " \

    "bootz; " \

    "fi;\0" \

    "mmcboot=mmc dev ${mmcdev}; " \

    "setenv devnum ${mmcdev}; " \

    "setenv devtype mmc; " \

    "if mmc rescan; then " \

    "echo SD/MMC found on device ${mmcdev};" \

    "if run loadimage; then " \

    "if test ${boot_fit} -eq 1; then " \

    "run loadfit; " \

    "else " \

    "run mmcloados;" \

    "fi;" \

    "fi;" \

    "fi;\0" \

    to

    #define DEFAULT_MMC_TI_ARGS \

    "mmcdev=1\0" \

    "mmcrootfstype=ext4 rootwait\0" \

    "finduuid=part uuid mmc 1:2 uuid\0" \

    "args_mmc=run finduuid;setenv bootargs console=${console} " \

    "${optargs} " \

    "root=PARTUUID=${uuid} rw " \

    "rootfstype=${mmcrootfstype}\0" \

    "loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr\0" \

    "bootscript=echo Running bootscript from mmc${mmcdev} ...; " \

    "source ${loadaddr}\0" \

    "bootenvfile=uEnv.txt\0" \

    "importbootenv=echo Importing environment from mmc${mmcdev} ...; " \

    "env import -t ${loadaddr} ${filesize}\0" \

    "loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}\0" \

    "loadimage=load ${devtype} 1:2 ${loadaddr} ${bootdir}/${bootfile}\0" \

    "loadfdt=load ${devtype} 1:2 ${fdtaddr} ${bootdir}/${fdtfile}\0" \

    "envboot=mmc dev ${mmcdev}; " \

    "if mmc rescan; then " \

    "echo SD/MMC found on device ${mmcdev};" \

    "if run loadbootscript; then " \

    "run bootscript;" \

    "else " \

    "if run loadbootenv; then " \

    "echo Loaded env from ${bootenvfile};" \

    "run importbootenv;" \

    "fi;" \

    "if test -n $uenvcmd; then " \

    "echo Running uenvcmd ...;" \

    "run uenvcmd;" \

    "fi;" \

    "fi;" \

    "fi;\0" \

    "mmcloados=run args_mmc; " \

    "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \

    "if run loadfdt; then " \

    "bootz ${loadaddr} - ${fdtaddr}; " \

    "else " \

    "if test ${boot_fdt} = try; then " \

    "bootz; " \

    "else " \

    "echo WARN: Cannot load the DT; " \

    "fi; " \

    "fi; " \

    "else " \

    "bootz; " \

    "fi;\0" \

    "mmcboot=mmc dev ${mmcdev}; " \

    "setenv devnum ${mmcdev}; " \

    "setenv devtype mmc; " \

    "if mmc rescan; then " \

    "echo SD/MMC found on device ${mmcdev};" \

    "if run loadimage; then " \

    "if test ${boot_fit} -eq 1; then " \

    "run loadfit; " \

    "else " \

    "run mmcloados;" \

    "fi;" \

    "fi;" \

    "fi;\0" \

    and make uboot,

    cp MLO to emmc,

    [    0.000000] Booting Linux on physical CPU 0x0

    [    0.000000] Initializing cgroup subsys cpuset

    [    0.000000] Initializing cgroup subsys cpu

    [    0.000000] Initializing cgroup subsys cpuacct

    [    0.000000] Linux version 4.4.84-00018-gd326d64-dirty (root@autorad-VirtualBox) (gcc version 5.3.1 20160113 (Linaro GCC 5.3-2016.02) ) #5 SMP PREEMPT Thu Jun 21 17:00:10 CST 2018

    [    0.000000] CPU: ARMv7 Processor [412fc0f2] revision 2 (ARMv7), cr=30c5387d

    [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache

    [    0.000000] Machine model: TI DRA722 Rev C EVM

    [    0.000000] bootconsole [earlycon0] enabled

    bootconsole is now enable

    but still not run kernel part, why ?

  • Hi,

    In your kernel device-tree can you set the log-level=8 (by default the log-level is 0), in the chosen node of the device-tree, this should give you more logs and indicate where the kernel fails to initialize. (Copy the updated DTB to the boot partition of EMMC).
    My guess is the kernel isn't able to locate the file-system -- did you update the 'root' entry of the kernel device-tree to be the EMMC?

    Regards
    Shravan
  • i had updated the 'root' entry of the kernel device-tree to be the EMMC.

    I will confirm from the log where the problem is
  • It was hang here,

    [ 1.643166] NET: Registered protocol family 29
    [ 1.647630] can: raw protocol (rev 20120528)
    [ 1.651915] can: broadcast manager protocol (rev 20120528 t)
    [ 1.662985] remoteproc1: Falling back to user helper
    [ 1.672998] can: netlink gateway (rev 20130117) max_hops=1
    [ 1.678635] NET: Registered protocol family 41
    [ 1.693157] omap_voltage_late_init: Voltage driver support not added
    [ 1.700224] Power Management for TI OMAP4+ devices.
    [ 1.723169] Registering SWP/SWPB emulation handler
    [ 1.730211] dmm 4e000000.dmm: initialized all PAT entries
    [ 1.742729] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
    [ 1.763001] [drm] No driver support for vblank timestamp query.
    [ 1.769396] [drm] Initialized omapdrm 1.0.0 20110917 on minor 0
    [ 1.794999] hctosys: unable to open rtc device (rtc0)
    [ 1.800484] aic_dvdd: disabling
    [ 1.803749] evm_3v3_sd: disabling
    [ 1.807132] vmmcwl_fixed: disabling
    [ 1.811698] clk: Not disabling unused clocks
    [ 1.818674] omap8250 4806a000.serial: failed to request DMA
    [ 1.824572] Waiting for root device /dev/mmcblk1p2...
    [ 1.866529] mmc1: MAN_BKOPS_EN bit is not set
    [ 1.876061] mmc1: new HS200 MMC card at address 0001
    [ 1.891504] mmcblk0: mmc1:0001 IS008G 7.28 GiB
    [ 1.906368] mmcblk0boot0: mmc1:0001 IS008G partition 1 4.00 MiB
    [ 1.922565] mmcblk0boot1: mmc1:0001 IS008G partition 2 4.00 MiB
    [ 1.929441] mmcblk0: p1 p2

    I think it seems that the part of DDR has not been amended.

    I will modify it and respond to the result.

  • Still be stuck after modification evm.c and remeake uboot : (
  • Hi,

    Your logs could indicate where the issue is:

    [ 1.824572] Waiting for root device /dev/mmcblk1p2...

    Can you set root=/dev/mmcblk0p2 in the chosen node? Also, enusure the SD card isn't connected while booting, this will ensure the uImage and DTB is picked up from EMMC.

    Regards

    Shravan

  • I think mmcblk0 is sd card,
    mmcblk1 is emmc,
    is that false?
    you let me set root=/dev/mmcblk1p2 at step.3 above,
    Why now need to set root=/dev/mmcblk0p2?
  • Hi,

    mmcblk1 on U-boot is always EMMC, however this isn't fixed in the kernel, as the devices are assigned values based on enumeration. So mmcblk1 on u-boot may not be the same device in kernel.

    Once the binaries have been copied to EMMC, please remove the SD-card. This will ensure the binaries are loaded from EMMC, and the file-system is also loaded from EMMC.

    Regards
    Shravan
  • Hi,
    i found that only need to set root=/dev/mmcblk0p2 in the chosen node,

    then the file system could be read successfully.

    In other words, the setting of ti_armv7_common.h is just the default value.

    If I can determine that the /chosen parameter can be read normally,

    Is setting root part in ti_armv7_common.h not so necessary?

  • Hi,

    The setting of root part in ti_armv7_common.h isn't necessary, however it indicates where to pick the uImage and the DTB from (updating of mmcdev in the same file). Root partition is picked using the kernel device-tree.

    Regards
    Shravan
  • Hi,

    Understand, really thank you for your answer,

    Let me clarify many ideas.