NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

EVMK2H Booting from USB Flash Drive

From Texas Instruments Wiki
Jump to: navigation, search

This wiki page describes how to use a USB flash drive to boot the Linux kernel on a K2H EVM and host the root file system. This is an alternate to using a tftpserver for the kernel and an NFS server for the file system outlined in the MCSDK HPC Getting Started Guide.

Benefits

  • Quicker to get up and running - all tools required to build & run the OpenCL and OpenMP Accelerator model examples are available on the root file system (gcc, make, TI OpenCL, TI OpenMP Accelerator Model tooling etc.)
  • "Self contained" - no need for an additional server to host the kernel/file system
  • With the tftpserver/NFS Server approach, the Ubuntu PC hosting the servers must have a static IP address

Downsides

  • The Linux distribution is an embedded distribution and is not meant to be used as a development host.
    • For example, the only editor available is vi and there are no version control systems such as git


Prerequisites[edit]

  • EVMK2H, Revision v3.0 or newer
  • USB 3.0 Flash Drive 16GB or larger (USB 3.0 is noticeably faster)
  • PC running Ubuntu 12.04 LTS to prepare the EVM & USB flash drive
  • MCSDK 3.0.4.18 (for Linux kernel, root files system images, Linux DevKit)
  • MCSDK HPC 3.0.1.8 (for OpenCL/OpenMP/OpenMPI packages)


Preparing the USB flash drive[edit]

Install MCSDK, MCSDK HPC and the Linux Development Kit

Create 2 partitions on the USB flash drive[edit]

Install gparted on the host <source lang="bash"> sudo apt-get install gparted </source>

Create Partitions Insert the USB flash drive into a USB slot.

Warning Warning: The USB flash drive will be reformatted and all existing content will be erased!

<source lang="bash"> sudo gparted </source> Choose correct device (/dev/sdX) at the top right corner.

NoteNote: You can use size of the USB drive to ensure you are picking the correct. partition. This example and the commands illustrated use /dev/sdb1 for partition 1 and /dev/sdb2 for partition 2. Replace with the device that corresponds to your USB flash drive.

Warning Warning: Before you proceed, make sure you selected the correct device, otherwise it may format the active hard disk partition of your PC.

Got to top level "Partition" pulldown menu and select Unmount to unmount the device. If there is existing partition, delete the same (Partition -> delete) Now Partition and filesystem status shows as unallocated1.

Create partition 1 (fat32) for boot images

Partition -> new
New size = 32MiB
File system = fat32
label = boot
click add to add partition
select the created partition #1 and format it (Partition -> format to).
select fat32 format2.

Create partition 2 (ext4) for file system

select the unallocated partition
Partition -> new
File system = ext4
label = rootfs
Keep rest of the fields default
click add to add partition
select the created partition #2 and format it (Partition -> format to).
select ext4 format

Apply the changes and Quit

Edit -> Apply All Operations
GParted -> Quit


Copy files to the partitions[edit]

Unmount if the devices are automounted <source lang="bash" strict enclose="div" header="" footer=""> sudo umount /dev/sdb1 sudo umount /dev/sdb2 </source>


1. Create the mount points if they don't exist: <source lang="bash" strict enclose="div" header="" footer=""> sudo mkdir -p /mnt/usb/fat32 sudo mkdir -p /mnt/usb/ext4 </source>


2. Copy boot monitor, device tree file and kernel to partition #1 (boot).

<source lang="bash" strict enclose="div" header="" footer=""> cd [mcsdk_install_dir]/mcsdk_linux_3_00_0x_xx/images

sudo mount -t vfat /dev/sdb1 /mnt/usb/fat32 sudo cp skern-keystone-evm.bin /mnt/usb/fat32 sudo cp uImage-k2hk-evm.dtb /mnt/usb/fat32 sudo cp uImage-keystone-evm.bin /mnt/usb/fat32

ls /mnt/usb/fat32 skern-keystone-evm.bin uImage-k2hk-evm.dtb uImage-keystone-evm.bin

sudo umount /dev/sdb1 </source>


3. Copy root file system to partition #2 (rootfs)

  • Create a directory to hold the root file system and unpack the root file system

<source lang="bash" strict enclose="div" header="" footer=""> mkdir rootfs cd rootfs tar xvf tisdk-rootfs.tar.gz </source>


  • Copy the Linux DevKit files into the rootfs. The DevKit provides files required by native compilation on the EVM.

<source lang="bash" strict enclose="div" header="" footer=""> cp -r [mcsdk_install_dir]/mcsdk_linux_3_00_0x_xx/linux-devkit/arago-2013.12/sysroots/cortexa15hf-vfp-neon-3.8-oe-linux-gnueabi/* . </source>


  • Copy the HPC image directory into the root user's home directory. The images will be installed later.

<source lang="bash" strict enclose="div" header="" footer=""> cp - r [mcsdk_hpc_install_dir]/mcsdk-hpc_03_00_01_xx/images ./home/root </source>


  • Copy the rootfs onto the USB flash drive

<source lang="bash" strict enclose="div" header="" footer=""> sudo mount -t ext4 /dev/sdb2 /mnt/usb/ext4 sudo cp -r * /mnt/usb/ext4 ls /mnt/usb/ext4 bin boot dev etc home init lib lost+found media mnt proc sbin srv sys tmp usr var $sudo umount /dev/sdb2 </source>



Preparing the EVM[edit]

Connecting to the EVM[edit]

Follow the instructions outlined in the MCSDK HPC Getting Started Guide to connect to the serial port on the EVM.

NoteNote: There are 2 serial ports, one for the SoC and one for the Board Management Controller (BMC) on the EVM. Follow the steps to connect to the SoC.

Once you connect to the SoC, the following prompt is displayed:

<source lang="bash" strict enclose="div" header="" footer=""> U-Boot 2013.01 (Apr 24 2014 - 02:06:05)

I2C: ready Detected SO-DIMM [18KSF1G72HZ-1G6E2 ] DRAM: Capacity 8 GiB (includes reported below) DRAM: 2 GiB NAND: 512 MiB Net: TCI6638_EMAC, TCI6638_EMAC1, K2HK_EMAC2, K2HK_EMAC3 Hit any key to stop autoboot: 0 TCI6638 EVM # </source>

If the U-Boot version displayed is older than shown below, update U-Boot following the steps in section #Updating U-Boot. <source lang="bash" strict enclose="div" header="" footer=""> U-Boot 2013.01 (Apr 24 2014 - 02:06:05) </source>

Warning Warning: Older versions of U-Boot sometimes fail to detect the USB flash drive after it has been plugged into the USB 3.0 port on the EVM.

Updating U-Boot[edit]

Update U-Boot if required by performing the following steps:

  • Set up a tftp server following the instructions outlined here
  • Copy the U-Boot image "u-boot-spi-keystone-evm.gph" located in [mcsdk_install_dir]/mcsdk_linux_3_00_0x_xx/images to the tftp server root directory

<source lang="bash" strict enclose="div" header="" footer=""> setenv serverip <ip address of tftp server> setenv tftp_root <tftp root directory> setenv name_uboot u-boot-spi-keystone-evm.gph run get_uboot_net run burn_uboot </source>

NoteNote: Power cycle the EVM after the U-Boot update

.


Update U-Boot Environment variables[edit]

For USB boot/file system[edit]

Set and save the following U-Boot environment variables to enable boot from USB: <source lang="bash" strict enclose="div" header="" footer=""> setenv boot usb setenv args_all 'setenv bootargs console=ttyS0,115200n8 rootwait" setenv args_usb 'setenv bootargs ${bootargs} rootfstype=ext4 root=/dev/sda2 rw ip=dhcp' setenv init_usb 'usb start; run set_fs_none args_all args_usb' setenv get_fdt_usb 'fatload usb 0:1 ${addr_fdt} ${name_fdt}' setenv get_kern_usb 'fatload usb 0:1 ${addr_kern} ${name_kern}' setenv get_mon_usb 'fatload usb 0:1 ${addr_mon} ${name_mon}' saveenv </source>

Additional variables[edit]

<source lang="bash" strict enclose="div" header="" footer=""> setenv mem_reserve 1536M [A larger size can be used when using more than 2GB DIMM] saveenv </source>

Typing boot at the U-Boot prompt will boot the EVM from the USB flash drive.



Boot Log[edit]

Reading kernel image, device tree and boot monitor from FAT32 partition[edit]

<source lang="bash" enclose="div" header="" footer=""> (Re)start USB... USB0: No power optimization available Register 2001040 NbrPorts 2 Starting the controller USB XHCI 1.00 scanning bus 0 for devices... 2 USB Device(s) found

      scanning usb for storage devices... 1 Storage Device(s) found

reading uImage-k2hk-evm.dtb 48300 bytes read in 49 ms (961.9 KiB/s) reading skern-keystone-evm.bin 45056 bytes read in 44 ms (1000 KiB/s) reading uImage-keystone-evm.bin 3818936 bytes read in 1983 ms (1.8 MiB/s)

    1. installed monitor, freq [204800000], status 0

</source>


USB related snippets from kernel boot log[edit]

<source lang="bash" enclose="div" header="" footer=""> [ 17.195664] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller [ 17.200165] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1 [ 17.206877] xhci-hcd xhci-hcd.0.auto: irq 608, io mem 0x02690000 [ 17.211847] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002 [ 17.217402] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 17.223305] usb usb1: Product: xHCI Host Controller [ 17.227294] usb usb1: Manufacturer: Linux 3.10.10 xhci-hcd [ 17.231781] usb usb1: SerialNumber: xhci-hcd.0.auto [ 17.236085] hub 1-0:1.0: USB hub found [ 17.239152] hub 1-0:1.0: 1 port detected [ 17.242509] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller [ 17.246996] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2 [ 17.253316] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003 [ 17.258872] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 17.264780] usb usb2: Product: xHCI Host Controller [ 17.268764] usb usb2: Manufacturer: Linux 3.10.10 xhci-hcd [ 17.273251] usb usb2: SerialNumber: xhci-hcd.0.auto [ 17.277545] hub 2-0:1.0: USB hub found [ 17.280612] hub 2-0:1.0: 1 port detected [ 17.284090] usbcore: registered new interface driver usb-storage [ 17.289215] mousedev: PS/2 mouse device common for all mice [ 17.293920] i2c /dev entries driver [ 17.297246] watchdog 22f0080.wdt: heartbeat 60 sec [ 17.302598] keystone-crypto 20c0000.crypto: crypto accelerator enabled [ 17.308191] usbcore: registered new interface driver usbhid [ 17.312743] usbhid: USB HID core driver </source>


<source lang="bash" enclose="div" header="" footer=""> [ 18.108263] usb 2-1: new SuperSpeed USB device number 2 using xhci-hcd [ 18.124743] usb 2-1: Parent hub missing LPM exit latency info. Power management will be impacted. [ 18.132308] usb 2-1: New USB device found, idVendor=154b, idProduct=00b2 [ 18.137794] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 18.143633] usb 2-1: Product: USB 3.0 FD [ 18.146837] usb 2-1: Manufacturer: PNY Technologies [ 18.150831] usb 2-1: SerialNumber: AA1CEE60DC4D40E5BBB6E6E495F073 [ 18.156277] usb-storage 2-1:1.0: USB Mass Storage device detected [ 18.161378] scsi0 : usb-storage 2-1:1.0 </source>


<source lang="bash" enclose="div" header="" footer=""> [ 20.110703] scsi 0:0:0:0: Direct-Access PNY USB 3.0 FD PQ: 0 ANSI: 6 [ 20.117900] sd 0:0:0:0: [sda] 245235199 512-byte logical blocks: (125 GB/116 GiB) [ 20.124060] sd 0:0:0:0: Attached scsi generic sg0 type 0 [ 20.128614] sd 0:0:0:0: [sda] Write Protect is off [ 20.132769] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA [ 20.143070] sda: sda1 sda2 [ 20.146461] sd 0:0:0:0: [sda] Attached SCSI removable disk </source>


<source lang="bash" enclose="div" header="Mounting root ext4 filesystem from sda2" footer=""> [ 27.399160] EXT4-fs (sda2): recovery complete [ 27.404117] EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: (null) [ 27.410401] VFS: Mounted root (ext4 filesystem) on device 8:2. </source>

Installing the HPC tools[edit]

Boot Linux on the EVM and log on as user 'root'. Install the packages in the images directory created earlier.

Install the packages[edit]

Note: The install_hpc_packages_evm.sh installs packages in an order that satisfies dependencies between packages.

<source lang="bash" enclose="div" > cd images ./install_hpc_packages_evm.sh </source>

After installing the packages reboot the system.

<source lang="bash" enclose="div" footer=""> reboot </source>

Running the Examples[edit]

OpenCL Example[edit]

<source lang="bash" enclose="div" header="" footer=""> cp -r /usr/share/ti/examples/opencl . cd opencl/vecadd make Compiling main.cpp ./vecadd DEVICE: TI K2H DSP (8x C66)

Write BufA  : Queue to Submit: 3 us Write BufA  : Submit to Start : 60 us Write BufA  : Start to End  : 56 us

Write BufB  : Queue to Submit: 108 us Write BufB  : Submit to Start : 113 us Write BufB  : Start to End  : 40 us

Kernel Exec : Queue to Submit: 2 us Kernel Exec : Submit to Start : 5 us Kernel Exec : Start to End  : 344 us

Read BufDst : Queue to Submit: 341 us Read BufDst : Submit to Start : 11 us Read BufDst : Start to End  : 57 us

Success! </source>

OpenMP Accelerator Model Example[edit]

Due to a defect in the MCSDK HPC 3.0.1.4 ti-openmpacc ipk, the OpenMP Accelerator Model examples are not installed when the ipk is installed. You can scp the examples from [mcsdk_hpc_install_dir]/ti-openmpacc_<version>/openmpacc-examples.

<source lang="bash" enclose="div" header="" footer=""> cd openmpacc-examples/vecadd make arm-linux-gnueabihf-g++ -O3 -c vecadd_main.cpp clacc -v -k --hc="-O3 -Wall -Wextra -fopenmp" --tc="-O3" vecadd_main.o vecadd_target.c -o vecadd cl6x --openmp:host -pds=1173 -I/usr/lib/gcc/arm-oe-linux-gnueabi/4.7.2/include -I/usr/lib/gcc/arm-oe-linux-gnueabi/4.7.2/include-fixed -I/usr/include vecadd_target.c cl6x --openmp:device -mv6600 -I/usr/share/ti/cgt-c6x/include -I/usr/share/ti/openmpacc/dsp/include -O3 vecadd_target.c clocl -t -v __TI_CLACC_KERNEL.cl vecadd_target.obj arm-linux-gnueabihf-g++ -O3 -Wall -Wextra -fopenmp -c __TI_CLACC_KERNEL.c arm-linux-gnueabihf-gcc -O3 -Wall -Wextra -fopenmp -c vecadd_target.int.c arm-linux-gnueabihf-g++ -O3 -Wall -Wextra -fopenmp vecadd_main.o __TI_CLACC_KERNEL.o vecadd_target.int.o -L/usr/lib -lOpenMPAcc -lOpenCL -locl_util -Wl,-rpath-link,/usr/lib -o vecadd ./vecadd PASS! </source>


Mounting the EVM filesystem[edit]

To easily access the EVM file system, its possible to use sshfs to mount it on an Ubuntu PC <source lang="bash" strict enclose="div" header="" footer=""> sudo apt-get install sshfs sshfs <evm ip>:<directory to mount> <mount point> </source>

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article EVMK2H Booting from USB Flash Drive here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article EVMK2H Booting from USB Flash Drive here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article EVMK2H Booting from USB Flash Drive here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article EVMK2H Booting from USB Flash Drive here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article EVMK2H Booting from USB Flash Drive here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article EVMK2H Booting from USB Flash Drive here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article EVMK2H Booting from USB Flash Drive here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article EVMK2H Booting from USB Flash Drive here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article EVMK2H Booting from USB Flash Drive here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity