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.

How u-boot recognize which dtb file that will be loaded?

As topic, how u-boot know which dtb file that need to be loaded in the SDK7.0?? And if i change the name of dtb, can it still know which dtb file need to be loaded?

  • Moving this to the Linux forum.

  • Hi,

    Ideally it will be present in bootcmd parameter of your u-boot. If you do a printenv when your u-boot comes up check the bootcmd parameter it will try to read the .dtb from your sd card/flash.

    Thanks,

    --Prabhakar Lad

  • Hi, thank you, I saw that as you mentioned, and do you know where environment args stored ?? my board is AM335x Starter Kit, it only use SD card to run the kernel, does environment args store in the the sdcard, where i can find this file and if i have other storage, can i store them in other places?

  • Hi,

    it only use SD card to run the kernel, does environment args store in the the sdcard, where i can find this file and if i have other storage, can i store them in other places?

    Not sure If it stores environment in MMC, to check what you can do is when your u-boot comes up, do a saveenv ,it will print out 'Saving bootargs in MMC/NAND'. If you can post the output of 'pri' and 'savenv' I can tell you more details on whats happening.(Probably there will boot.scr in you sd card that your u-boot will read and execute)

    Thanks,

    --Prabhakar Lad

  • Hi,

                 please have a look on print information below. My board doesn't have nand flash, can i t change place to save environment ?

    U-Boot# pri
    arch=arm
    baudrate=115200
    board=am335x
    board_name=A335X_SK
    board_rev=1.2B
    boot_fdt=try
    boot_targets= mmc0 nand
    bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
    bootcmd_mmc0=setenv devnum 0; setenv rootpart 2; run mmc_boot;
    bootcmd_nand=run nandboot;
    bootcmd_usb=setenv devnum 0; run usb_boot;
    bootdelay=3
    bootdir=/boot
    bootenv=uEnv.txt
    bootfile=zImage
    bootpart=0:2
    console=ttyO0,115200n8
    cpu=armv7
    dfu_alt_info_emmc=rawemmc mmc 0 3751936
    dfu_alt_info_mmc=boot part 0 1;rootfs part 0 2;MLO fat 0 1;MLO.raw mmc 100 100;u
    -boot.img.raw mmc 300 400;spl-os-args.raw mmc 80 80;spl-os-image.raw mmc 900 200
    0;spl-os-args fat 0 1;spl-os-image fat 0 1;u-boot.img fat 0 1;uEnv.txt fat 0 1
    dfu_alt_info_nand=NAND.SPL part 0 1;NAND.SPL.backup1 part 0 2;NAND.SPL.backup2 p
    art 0 3;NAND.SPL.backup3 part 0 4;NAND.u-boot-spl-os part 0 5;NAND.u-boot part 0
    6;NAND.u-boot-env part 0 7;NAND.u-boot-env.backup1 part 0 8;NAND.kernel part 0
    9;NAND.rootfs part 0 10
    dfu_alt_info_ram=kernel ram 0x80200000 0xD80000;fdt ram 0x80F80000 0x80000;ramdi
    sk ram 0x81000000 0x4000000
    eth1addr=d4:94:a1:87:0f:67
    ethact=cpsw
    ethaddr=d4:94:a1:87:0f:66
    fdt_high=0xa0000000
    fdtaddr=0x80F80000
    fdtfile=undefined
    findfdt=if test $board_name = A335BONE; then setenv fdtfile am335x-bone.dtb; fi;
    if test $board_name = A335BNLT; then setenv fdtfile am335x-boneblack.dtb; fi; i
    f test $board_name = A33515BB; then setenv fdtfile am335x-evm.dtb; fi; if test $
    board_name = A335X_SK; then setenv fdtfile am335x-evmsk.dtb; fi; if test $fdtfil
    e = undefined; then echo WARNING: Could not determine device tree to use; fi;
    importbootenv=echo Importing environment from mmc ...; env import -t $loadaddr $
    filesize
    loadaddr=0x80200000
    loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}
    loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}
    loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}
    loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz
    mmc_boot=setenv devtype mmc; if mmc dev ${devnum}; then run mmcargs;run scan_boo
    t; run mmcboot;setenv mmcdev 1; setenv bootpart 1:2; run mmcboot;fi
    mmcargs=setenv bootargs console=${console} ${optargs} root=${mmcroot} rootfstype
    =${mmcrootfstype}
    mmcboot=mmc dev ${mmcdev}; if mmc rescan; then echo SD/MMC found on device ${mmc
    dev};if run loadbootenv; then echo Loaded environment from ${bootenv};run import
    bootenv;fi;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;if
    run loadimage; then run mmcloados;fi;fi;
    mmcdev=0
    mmcloados=run mmcargs; 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;
    mmcroot=/dev/mmcblk0p2 ro
    mmcrootfstype=ext4 rootwait
    mtdids=nand0=nand.0
    mtdparts=mtdparts=nand.0:128k(NAND.SPL),128k(NAND.SPL.backup1),128k(NAND.SPL.bac
    kup2),128k(NAND.SPL.backup3),256k(NAND.u-boot-spl-os),1m(NAND.u-boot),128k(NAND.
    u-boot-env),128k(NAND.u-boot-env.backup1),8m(NAND.kernel),-(NAND.rootfs)
    nandargs=setenv bootargs console=${console} ${optargs} root=${nandroot} rootfsty
    pe=${nandrootfstype}
    nandboot=echo Booting from nand ...; run nandargs; nand read ${fdtaddr} NAND.u-b
    oot-spl-os; nand read ${loadaddr} NAND.kernel; bootz ${loadaddr} - ${fdtaddr}
    nandroot=ubi0:rootfs rw ubi.mtd=NAND.file-system,2048
    nandrootfstype=ubifs rootwait=1
    netargs=setenv bootargs console=${console} ${optargs} root=/dev/nfs nfsroot=${se
    rverip}:${rootpath},${nfsopts} rw ip=dhcp
    netboot=echo Booting from network ...; setenv autoload no; dhcp; tftp ${loadaddr
    } ${bootfile}; tftp ${fdtaddr} ${fdtfile}; run netargs; bootz ${loadaddr} - ${fd
    taddr}
    nfsopts=nolock
    partitions=uuid_disk=${uuid_gpt_disk};name=rootfs,start=2MiB,size=-,uuid=${uuid_
    gpt_rootfs}
    ramargs=setenv bootargs console=${console} ${optargs} root=${ramroot} rootfstype
    =${ramrootfstype}
    ramboot=echo Booting from ramdisk ...; run ramargs; bootz ${loadaddr} ${rdaddr}
    ${fdtaddr}
    ramroot=/dev/ram0 rw ramdisk_size=65536 initrd=${rdaddr},64M
    ramrootfstype=ext2
    rdaddr=0x81000000
    rootpart=2
    rootpath=/export/rootfs
    scan_boot=echo Scanning ${devtype} ${devnum}...; for prefix in ${bootdir}; do fo
    r script in ${bootfile}; do run script_boot; done; done;
    script_boot=if load ${devtype} ${devnum}:${rootpart} ${loadaddr} ${bootdir}/${bo
    otfile}; then run findfdt; load ${devtype} ${devnum}:${rootpart} ${fdtaddr} ${bo
    otdir}/${fdtfile};fi;
    soc=am33xx
    spiargs=setenv bootargs console=${console} ${optargs} root=${spiroot} rootfstype
    =${spirootfstype}
    spiboot=echo Booting from spi ...; run spiargs; sf probe ${spibusno}:0; sf read
    ${loadaddr} ${spisrcaddr} ${spiimgsize}; bootz ${loadaddr}
    spibusno=0
    spiimgsize=0x362000
    spiroot=/dev/mtdblock4 rw
    spirootfstype=jffs2
    spisrcaddr=0xe0000
    static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off
    stderr=serial
    stdin=serial
    stdout=serial
    usb_boot=setenv devtype usb; run usb_init; if usb dev 0; then run usbargs;run sc
    an_boot; bootz ${loadaddr} - ${fdtaddr}; fi
    usb_init=usb start 0;
    usbargs=setenv bootargs console=${console} ${optargs} root=${usbroot} rootfstype
    =${usbrootfstype}
    usbnet_devaddr=d4:94:a1:87:0f:67
    usbroot=/dev/sda2 rw
    usbrootfstype=ext4 rootwait
    vendor=ti
    ver=U-Boot 2013.10-g78d8ebd (Mar 30 2014 - 20:46:34)

    Environment size: 5407/131067 bytes
    U-Boot# saveenv
    Saving Environment to NAND...
    Erasing redundant NAND...
    Attempt to erase non block-aligned data
    Erasing NAND...
    Attempt to erase non block-aligned data
    U-Boot#

  • Hi,

    Looks like the ENV is in NAND, you need to refer this link http://processors.wiki.ti.com/index.php/AM335x_U-Boot_User%27s_Guide#SD_.28Secured_Digital_card.29 to boot from SD.

    Thanks,

    --Prabhakar Lad

  • Hi, thank you. i have one more question is regardless this topic, but i am confused. we know when we build kernel we can enable lots of driver by .config, But sometimes we have other request, for example, i am using UART driver and now my application want to use 38400 Baudrate, should I write the own driver to let my application to call to change the register that control the Baudrate in UART module?? Because I want to connect the pins from MCU to externel device, i am not sure whether i should control all behavior of registers(receive data, send data,,,,).

  • Hi Ivan,

    You can change the baudrate of UART port in application through ioctl fns while you access the UART.

    Please go through the following links.

    http://www.comptechdoc.org/os/linux/programming/c/linux_pgcserial.html

    http://en.wikibooks.org/wiki/Serial_Programming/Serial_Linux

  • Hi,

                 Thank you, it seems the answer I want, i'll check those link: ).