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 to set environment variables for TFTP boot?

Other Parts Discussed in Thread: OMAP-L138, DA8XX, PMP

Hi,

I want to make L138 LCDK board with TFTP boot. I am new to L138 LCDK.

For the factory default u-boot settings, SW1 is: SW1: 1:OFF; 2:ON; 3:ON; 4:ON

I get the following procedures description, but I do not understand some of it.

Loading and Running Linux Kernel

The U-Boot comes with a set of default environment variables. Using those variables simplify several ways to boot kernel. Use the following command to set the default environment variables:

>env default -f –a
>saveenv

U-Boot supports three ways to boot kernel and is configured through 'boot' env variable. For each of this method, the boot env variable value to be used is provided in parenthesis.

  • tftp kernel and initrd ramfs (ramfs);
  • tftp kernel and use nfs mounted filesystem (net);
  • using ubifs (ubi);

You would need to add a few more variable specific to you setup:

  • serverip - IP address of your tftp server
  • tftp_root - Relative path from tftp server root directory where the image files are stored
  • boot - one of three ways to boot kernel (ramfs, net, ubi)
  • nfs_root - root directory exported by the NFS server (where the rootfs tar file was untarred)

Other defaults may be changed as needed. By default, these are set to use the image names from the Release. However for Preempt RT Full images, change the following env variables (applicable only for tftp boot of Linux and DTB):-

>setenv name_kern
>setenv name_fdt

Below is the variables I get. I do not see any of (ramfs, net or ubi) below. How to set tftp needed parameters to get a TFTP boot (I mean SD card does not need at all).

Thanks,

////////////////////////

U-Boot > setenv name_kern
U-Boot > pri             
baudrate=115200
bootargs=console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootwait ip=off
bootcmd=if mmc rescan 0; then if fatload mmc 0 0xc0600000 boot.scr; then source 0xc0600000; else fatload mmc 0 0xc0700000 uImage; bootm c0700000; fi; else sf pro
be 0; sf read 0xc0700000 0x80000 0x220000; bootm 0xc0700000; fi
bootdelay=3
bootfile="uImage"
ethact=DaVinci-EMAC
ethaddr=00:00:a0:00:fb:c7
stderr=serial
stdin=serial
stdout=serial
ver=U-Boot 2010.12 (May 07 2012 - 16:09:45)

Environment size: 496/65532 bytes
U-Boot >

  • Excuse me. I have to add that I have run Linux host set up with

    sudo ./setup.sh

    I don't know on the target side now. Thanks,
  • Robert,

    You can boot the Linux kernel from different methods including SD/MMC, NAND, TFTP or NFS servers.

    Setup the u-boot enviroment for TFTP download.
    U-Boot > setenv serverip 172.24.156.199
    U-Boot > dhcp

    Use TFTP to transfer the u-boot image generated earlier.
    U-Boot > tftpboot 0xc0700000 u-boot

    You can try to restart all the services:
    # /etc/init.d/rpcbind restart
    # /etc/init.d/nfs restart
    # /etc/init.d/nfslock restart

    In general,this wiki page will help you for how use the linux SDK on OMAP-L138
    http://processors.wiki.ti.com/index.php/OMAP-L138_LCDK_Linux_SDK_Getting_Started_Guide

    And aslo the below wiki pages are helpful to create the work setup for OMAP-L138 
    http://processors.wiki.ti.com/index.php/OMAP-L138_LCDK_Linux_Software_Developer%27s_Guide#Steps_to_install_TFTP_server
    http://processors.wiki.ti.com/index.php/Creating_a_Root_File_System_for_Linux_on_OMAP35x#Mounting_the_Root_File_System_over_NFS
    http://processors.wiki.ti.com/index.php/GSG:_OMAP-L138_DVEVM_Additional_Procedures#Booting_the_Linux_kernel_using_U-Boot
    http://processors.wiki.ti.com/index.php/Booting_Linux_kernel_using_U-Boot#Setting_up
    http://processors.wiki.ti.com/index.php/Setting_Up_a_TFTP_Server

  • Thanks for your reply.

    The target ip address is 192.168.0.123. The host Linux ip address is: 192.168.0.106.

    At the target uboot, when I run the first two commands of your post, it gives this error:

    U-Boot > setenv serverip 192.168.0.106
    U-Boot > dhcp
    BOOTP broadcast 1
    DHCP client bound to address 192.168.0.122
    Using DaVinci-EMAC device
    TFTP from server 192.168.0.106; our IP address is 192.168.0.122
    Filename 'uImage'.
    Load address: 0xc0700000
    Loading: *
    TFTP error: 'File not found' (1)
    Not retrying...
    U-Boot >

    The NFS path (I think it is) is: /home/robert/ti/mcsdk_1_01_00_02/targetNFS/home

    Whether it needs to set the path? How to do that?

  • HI Robert W,

    Have you followed up the link that Pubesh provided http://processors.wiki.ti.com/index.php/OMAP-L138_LCDK_Linux_Software_Developer%27s_Guide#Steps_to_install_TFTP_server  for tftp booting?

    Regards,

    Shankari

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

    Please click the Verify Answer button on this post if it answers your question.
    --------------------------------------------------------------------------------------------------------

  • Thanks for your link. I am new to Linux. From "Ubuntu Software Centre", I know that the Ubuntu PC has been installed tftpd, not tftpd-hpa. I have to switch to tftpd-hpa or not?

    On this PC, when I run "service tftpd status", it shows:

    robert@MS-7696:~/linux_lkm$ service tftpd status
    tftpd: unrecognized service
    robert@MS-7696:~/linux_lkm$

  • Hi,

    When I enter 'dhcp', it had the following message. I remember some posts said that it should get host IP address.

    U-Boot > pri
    baudrate=115200
    bootargs=console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootwait ip=off
    bootcmd=if mmc rescan 0; then if fatload mmc 0 0xc0600000 boot.scr; then source 0xc0600000; else fatload mmc 0 0xc0700000 uI
    mage; bootm c0700000; fi; else sf probe 0; sf read 0xc0700000 0x80000 0x220000; bootm 0xc0700000; fi
    bootdelay=3
    bootfile=uImage
    ethact=DaVinci-EMAC
    ethaddr=00:00:a0:00:fb:c7
    serverip=192.168.0.106
    stderr=serial
    stdin=serial
    stdout=serial
    ver=U-Boot 2010.12 (May 07 2012 - 16:09:45)

    Environment size: 519/65532 bytes
    U-Boot > dhcp
    BOOTP broadcast 1
    DHCP client bound to address 192.168.0.122
    Using DaVinci-EMAC device
    TFTP from server 192.168.0.106; our IP address is 192.168.0.122
    Filename 'uImage'.
    Load address: 0xc0700000
    Loading: T T
    Abort
    U-Boot >

    What is wrong? BTW, it looks like the network address etc. is correct because: When target run dhcp, the host can  'ping 192.168.0.122'.

    When target stays U-Boot>, host ping get:

    From 192.168.0.106 icmp_seq=281 Destination Host Unreachable
    From 192.168.0.106 icmp_seq=282 Destination Host Unreachable
    From 192.168.0.106 icmp_seq=284 Destination Host Unreachable

    Is this correct?

  • Hi,

    In the end, I find that the server needs reinstall tftp. Now the kernel can be boot from tftp. The problem is that the root is not correctly set, see the end please.

    I want both the kernel and  NFS on Linux host PC. What root should be set?

    Thanks,

    U-Boot > pri
    baudrate=115200
    bootargs=console=ttyO0,115200n8
    bootcmd=if mmc rescan 0; then if fatload mmc 0 0xc0600000 boot.scr; then source 0xc0600000; else fatload mmc 0 0xc0700000 uI
    mage; bootm c0700000; fi; else sf probe 0; sf read 0xc0700000 0x80000 0x220000; bootm 0xc0700000; fi
    bootdelay=3
    bootfile="uImage"
    ethact=DaVinci-EMAC
    ethaddr=00:00:a0:00:fb:c7
    ip_method=dhcp
    netargs=run bootargs
    rootpath=/home/robert/ti/mcsdk_1_01_00_02/targetNFS
    serverip=192.168.0.106
    stderr=serial
    stdin=serial
    stdout=serial
    ver=U-Boot 2010.12 (May 07 2012 - 16:09:45)

    Environment size: 576/65532 bytes
    U-Boot > dhcp
    BOOTP broadcast 1
    DHCP client bound to address 192.168.0.122
    Using DaVinci-EMAC device
    TFTP from server 192.168.0.106; our IP address is 192.168.0.122
    Filename 'uImage'.
    Load address: 0xc0700000
    Loading: #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #########
    done
    Bytes transferred = 2040348 (1f221c hex)
    U-Boot > bootm ${fileaddr}
    ## Booting kernel from Legacy Image at c0700000 ...
       Image Name:   Linux-3.1.10
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    2040284 Bytes = 1.9 MiB
       Load Address: c0008000
       Entry Point:  c0008000
       Verifying Checksum ... OK
       Loading Kernel Image ... OK
    OK

    Starting kernel ...

    Uncompressing Linux... done, booting the kernel.
    Linux version 3.1.10 (root@VPC-U1104) (gcc version 4.5.3 20110311 (prerelease) (GCC) ) #7 PREEMPT Fri May 11 11:15:57 CDT 20
    12
    CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
    CPU: VIVT data cache, VIVT instruction cache
    Machine: AM18x/OMAP-L138 LCDK
    Memory policy: ECC disabled, Data cache writeback
    DaVinci da850/omap-l138/am18x variant 0x1
    Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
    Kernel command line: console=ttyO0,115200n8
    PID hash table entries: 512 (order: -1, 2048 bytes)
    Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
    Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
    Memory: 128MB = 128MB total
    Memory: 125856k/125856k available, 5216k reserved, 0K highmem
    Virtual kernel memory layout:
        vector  : 0xffff0000 - 0xffff1000   (   4 kB)
        fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
        DMA     : 0xff000000 - 0xffe00000   (  14 MB)
        vmalloc : 0xc8800000 - 0xfea00000   ( 866 MB)
        lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
        modules : 0xbf000000 - 0xc0000000   (  16 MB)
          .text : 0xc0008000 - 0xc0396218   (3641 kB)
          .init : 0xc0397000 - 0xc03ba000   ( 140 kB)
          .data : 0xc03ba000 - 0xc03db160   ( 133 kB)
           .bss : 0xc03db184 - 0xc03f4c1c   ( 103 kB)
    SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    Preemptible hierarchical RCU implementation.
    NR_IRQS:245
    Console: colour dummy device 80x30
    Calibrating delay loop... 227.32 BogoMIPS (lpj=1136640)
    pid_max: default: 32768 minimum: 301
    Mount-cache hash table entries: 512
    CPU: Testing write buffer coherency: ok
    DaVinci: 144 gpio irqs
    NET: Registered protocol family 16
    EMAC: MII PHY configured
    bio: create slab <bio-0> at 0
    SCSI subsystem initialized
    usbcore: registered new interface driver usbfs
    usbcore: registered new interface driver hub
    usbcore: registered new device driver usb
    Advanced Linux Sound Architecture Driver Version 1.0.24.
    Switching to clocksource timer0_1
    Switched to NOHz mode on CPU #0
    NET: Registered protocol family 2
    IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
    TCP established hash table entries: 4096 (order: 3, 32768 bytes)
    TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
    TCP: Hash tables configured (established 4096 bind 4096)
    TCP reno registered
    UDP hash table entries: 256 (order: 0, 4096 bytes)
    UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    NET: Registered protocol family 1
    RPC: Registered named UNIX socket transport module.
    RPC: Registered udp transport module.
    RPC: Registered tcp transport module.
    RPC: Registered tcp NFSv4.1 backchannel transport module.
    msgmni has been set to 245
    io scheduler noop registered (default)
    da8xx_lcdc da8xx_lcdc.0: GLCD: Found VGA_Monitor panel
    Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
    serial8250.0: ttyS0 at MMIO 0x1c42000 (irq = 25) is a 16550A
    serial8250.0: ttyS1 at MMIO 0x1d0c000 (irq = 53) is a 16550A
    serial8250.0: ttyS2 at MMIO 0x1d0d000 (irq = 61) is a 16550A
    console [ttyS2] enabled
    brd: module loaded
    ahci ahci: forcing PORTS_IMPL to 0x1
    ahci ahci: AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl platform mode
    ahci ahci: flags: ncq sntf pm led clo only pmp pio slum part ccc
    scsi0 : ahci_platform
    ata1: SATA max UDMA/133 mmio [mem 0x01e18000-0x01e19fff] port 0x100 irq 67
    davinci_mdio davinci_mdio.0: davinci mdio revision 1.5
    davinci_mdio davinci_mdio.0: detected phy mask ffffff7f
    davinci_mdio.0: probed
    davinci_mdio davinci_mdio.0: phy[7]: device 0:07, driver unknown
    ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
    ohci ohci.0: DA8xx OHCI
    ohci ohci.0: new USB bus registered, assigned bus number 1
    Waiting for USB PHY clock good...
    ohci ohci.0: irq 59, io mem 0x01e25000
    usb usb1: New USB device found, idVendor=1d6b, idProduct=0001
    usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    usb usb1: Product: DA8xx OHCI
    usb usb1: Manufacturer: Linux 3.1.10 ohci_hcd
    usb usb1: SerialNumber: ohci.0
    hub 1-0:1.0: USB hub found
    hub 1-0:1.0: 1 port detected
    omap_rtc omap_rtc: rtc core: registered omap_rtc as rtc0
    omap_rtc: RTC power up reset detected
    i2c /dev entries driver
    davinci_mmc davinci_mmc.0: Using DMA, 4-bit mode
    asoc: tlv320aic3x-hifi <-> davinci-mcasp.0 mapping ok
    ALSA device list:
      #0: DA850/OMAP-L138 EVM
    TCP cubic registered
    NET: Registered protocol family 17
    davinci_emac davinci_emac.1: using random MAC addr: 6a:85:42:53:cd:44
    console [netcon0] enabled
    netconsole: network logging started
    omap_rtc omap_rtc: setting system clock to 2000-01-01 00:00:00 UTC (946684800)
    ata1: SATA link down (SStatus 0 SControl 300)
    Root-NFS: no NFS server address
    VFS: Unable to mount root fs via NFS, trying floppy.
    VFS: Cannot open root device "(null)" or unknown-block(2,0)
    Please append a correct "root=" boot option; here are the available partitions:
    Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)


  • u-boot appears to be reading additional information off of a file called boot.scr on the SD card.  I would suggest taking a look at the contents of that file to see how the u-boot environment variables are set or modified.  I suspect the bootargs for the kernel are finalized there.  Based on your investigation of that file, it would be helpful to relay what the bootargs end up being which are passed to the kernel.

    Secondly, on the host Linux machine, please indicate what path is being exported by the NFS server.  Whatever this path is, it will then "look" like the root or "/" to the target when it attempts to mount via NFS.  Therefore, the "root=" boot option should be a path relative to what the host exports.

  • After I search on line for similar problems, I add nfsroot to bootargs. Now, it halts after dhcp, bootm 0xc0700000.

    U-Boot > pri
    baudrate=115200
    bootargs=console=ttyO0,115200n8 nfsroot=192.168.0.106:/home/robert/ti/mcsdk_1_01_00_02/targetNFS
    bootcmd=if mmc rescan 0; then if fatload mmc 0 0xc0600000 boot.scr; then source 0xc0600000; else fatload mmc 0 0xc0700000 uI
    mage; bootm c0700000; fi; else sf probe 0; sf read 0xc0700000 0x80000 0x220000; bootm 0xc0700000; fi
    bootdelay=3
    bootfile=uImage
    dnsip=192.168.0.1
    ethact=DaVinci-EMAC
    ethaddr=00:00:a0:00:fb:c7
    fileaddr=C0700000
    filesize=1F221C
    gatewayip=192.168.0.1
    ip_method=dhcp
    ipaddr=192.168.0.122
    netargs=run bootargs
    netmask=255.255.255.0
    rootpath=/home/robert/ti/mcsdk_1_01_00_02/targetNFS
    serverip=192.168.0.106
    stderr=serial
    stdin=serial
    stdout=serial
    ver=U-Boot 2010.12 (May 07 2012 - 16:09:45)

    Environment size: 768/65532 bytes

    The last halt message is:

    ...

    omap_rtc: already running
    i2c /dev entries driver
    davinci_mmc davinci_mmc.0: Using DMA, 4-bit mode
    asoc: tlv320aic3x-hifi <-> davinci-mcasp.0 mapping ok
    ALSA device list:
      #0: DA850/OMAP-L138 EVM
    TCP cubic registered
    NET: Registered protocol family 17
    davinci_emac davinci_emac.1: using random MAC addr: 56:25:3e:86:94:57
    console [netcon0] enabled
    netconsole: network logging started
    omap_rtc omap_rtc: setting system clock to 2000-01-01 00:22:30 UTC (946686150)
    ata1: SATA link down (SStatus 0 SControl 300)

    What is wrong now?

  • Thank you Brandon.

    From below script (default), it looks like boot.scr is in partition 0 of SD card, but I do not see it on the SD card. I don't know whether it was accidentally removed. I don't know how to get it. Could someone upload one for L138LCDK?

    bootcmd=if mmc rescan 0; then if fatload mmc 0 0xc0600000 boot.scr; then source 0xc0600000; else fatload mmc 0 0xc0700000 uI
    mage; bootm c0700000; fi; else sf probe 0; sf read 0xc0700000 0x80000 0x220000; bootm 0xc0700000; fi

  • After some time(I supposed it halted previously), the target outputs these message:

    ...

    omap_rtc omap_rtc: setting system clock to 2000-01-01 00:32:38 UTC (946686758)
    ata1: SATA link down (SStatus 0 SControl 300)

    (After some time lapses)...
    VFS: Unable to mount root fs via NFS, trying floppy.
    VFS: Cannot open root device "(null)" or unknown-block(2,0)
    Please append a correct "root=" boot option; here are the available partitions:
    Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)

  • There is no boot.scr file on the SD card. I add root=/dev/nfs after find a similar post, but it still has the same problem as the previous post.

    The host has the typical /tftpboot and nfs folder: /home/robert/ti/mcsdk_1_01_00_02/targetNFS

    I have no clear idea on how to set the root variable. Could you help me?

    U-Boot > pri
    baudrate=115200
    bootargs=console=ttyO0,115200n8 root=/dev/nfs nfsroot=192.168.0.106:/home/robert/ti/mcsdk_1_01_00_02/targetNFS rw rootdelay=
    3
    bootcmd=if mmc rescan 0; then if fatload mmc 0 0xc0600000 boot.scr; then source 0xc0600000; else fatload mmc 0 0xc0700000 uI
    mage; bootm c0700000; fi; else sf probe 0; sf read 0xc0700000 0x80000 0x220000; bootm 0xc0700000; fi
    bootdelay=3
    bootfile=uImage
    dnsip=192.168.0.1
    ethact=DaVinci-EMAC
    ethaddr=00:00:a0:00:fb:c7
    fileaddr=C0700000
    filesize=1F221C
    gatewayip=192.168.0.1
    ip_method=dhcp
    ipaddr=192.168.0.122
    netargs=run bootargs
    netmask=255.255.255.0
    rootpath=/home/robert/ti/mcsdk_1_01_00_02/targetNFS
    serverip=192.168.0.106
    stderr=serial
    stdin=serial
    stdout=serial
    ver=U-Boot 2010.12 (May 07 2012 - 16:09:45)

    Environment size: 797/65532 bytes

    message at host minicom:

    ata1: SATA link down (SStatus 0 SControl 300)
    VFS: Unable to mount root fs via NFS, trying floppy.
    VFS: Cannot open root device "nfs" or unknown-block(2,0)
    Please append a correct "root=" boot option; here are the available partitions:
    Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)