VAR-SOM-AM43 Yocto Daisy GS: Difference between revisions

From Variscite Wiki
m (Text replacement - "http://variwiki" to "https://variwiki")
 
(28 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{PageHeader|VAR-SOM-AM43 Yocto 1.6 (Daisy) Distribution User's Guide}}
{{PageHeader|VAR-SOM-AM43 Yocto 1.6 (Daisy) Distribution User's Guide}}
{{DocImage|category1=VAR-SOM-AM33|category2=Yocto}}
{{DocImage|category1=VAR-SOM-AM33|category2=Yocto}}
Line 10: Line 9:


In this context, the document contains instructions to:
In this context, the document contains instructions to:
*Install the release on a development machine.
*Install the release on a development machine.
*Build the sources included in this release.
*Build the sources included in this release.
Line 21: Line 19:


Before starting the installation, make sure below system requirements are met:
Before starting the installation, make sure below system requirements are met:
*Host machine running a Ubuntu 12.04 64 LTS.
*Host machine running a Ubuntu 12.04 64 LTS.
*[http://www.variscite.com/products/evaluation-kits/var-dvk-am43 VAR-SOM-AM43 Evaluation Kit] + VAR-SOM-AM43 Yocto support installation sources and binaries (from FTP). Please refer to support@variscite.com for obtaining FTP credentials.
*[http://www.variscite.com/products/evaluation-kits/var-dvk-am43 VAR-SOM-AM43 Evaluation Kit] + VAR-SOM-AM43 Yocto support installation sources and binaries (from FTP). Please refer to support@variscite.com for obtaining FTP credentials.


<br/>The Linux host is used for the following:  
The Linux host is used for the following:  
*Recompiling U-Boot / kernel.
*Recompiling U-Boot / kernel.
*Hosting the NFS server to boot the EVM with NFS as root filesystem.
*Hosting the NFS server to boot the EVM with NFS as root filesystem.


<br/>Either of Windows or Linux host can be used for:  
Either of Windows or Linux host can be used for:  
 
*Hosting the TFTP server required for downloading the kernel and file-system images from U-Boot using Ethernet.
*Hosting the TFTP server required for downloading the kernel and file-system images from U-Boot using Ethernet.
*Running a serial console terminal application
*Running a serial console terminal application


Building the Yocto distribution via Bitbake will produce a complete set of downloaded source code + binaries for each component: <br/>
Building the Yocto distribution via Bitbake will produce a complete set of downloaded source code + binaries for each component: <br/>
Line 43: Line 38:
=== Install the Arago toolchain ===
=== Install the Arago toolchain ===
<pre>
<pre>
$ wget --no-check-certificate https://launchpad.net/linaro-toolchain-binaries/trunk/2013.03/+download/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux.tar.bz2
wget --no-check-certificate https://launchpad.net/linaro-toolchain-binaries/trunk/2013.03/+download/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux.tar.bz2
$ sudo tar -jxvf gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux.tar.bz2 -C /opt
sudo tar -jxvf gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux.tar.bz2 -C /opt
</pre>
</pre>


=== Install development tools ===
=== Install development tools ===
  $ sudo apt-get install git build-essential diffstat texinfo gawk chrpath gcc-multilib wget socat libsdl1.2-dev ia32-libs mtd-utils
  sudo apt-get install git build-essential diffstat texinfo gawk chrpath gcc-multilib wget socat libsdl1.2-dev ia32-libs mtd-utils


=== Download the Yocto Distribution ===
=== Download the Yocto Distribution ===
To quickly start making your own builds using meta-ti BSP layer and meta-arago Distribution layer, you can follow this short Quick Start section by entering below commands. For  
To quickly start making your own builds using meta-ti BSP layer and meta-arago Distribution layer, you can follow this short Quick Start section by entering below commands. For more expanded guide with each step detailed and sample output of the entered commands shown, please see the next Detailed Setup section.  
more expanded guide with each step detailed and sample output of the entered commands shown, please see the next Detailed Setup section.  
<pre>
<pre>
$ mkdir ~/yocto_varsomam43_daisy
mkdir ~/yocto_varsomam43_daisy
$ cd ~/yocto_varsomam43_daisy
cd ~/yocto_varsomam43_daisy
$ git clone git://arago-project.org/git/projects/oe-layersetup.git tisdk
git clone git://arago-project.org/git/projects/oe-layersetup.git tisdk
$ cd tisdk
cd tisdk
</pre>
</pre>


==== Downloading VAR-SOM-AM43 Support ====
==== Downloading VAR-SOM-AM43 Support ====
Download the VAR-SOM-AM43 Yocto support installation from Variscite FTP:
Download the VAR-SOM-AM43 Yocto support installation from Variscite FTP:
*/VAR-SOM-AM43/Software/Linux/YOCTO_Daisy_1.6_Release_2_v2/VAR-SOM-AMxx-Yocto_1_6_installation_Release2_v2.tar.gz
*/VAR-SOM-AM43/Software/Linux/YOCTO_Daisy_1.6_Release_2_v5/VAR-SOM-AM43-Yocto_1_6_installation_Release_2_V5.tar.gz


Extract Variscite Yocto installation as follows:
Extract Variscite Yocto installation as follows:
  $ mkdir ~/yocto_varsomam43_daisy/var_yocto_installation
  mkdir ~/yocto_varsomam43_daisy/var_yocto_installation
  $ cd ~/yocto_varsomam43_daisy/var_yocto_installation
  cd ~/yocto_varsomam43_daisy/var_yocto_installation
  $ tar -xvzf VAR-SOM-AMxx-Yocto_1_6_installation_Release2_v2.tar.gz
  tar xvf VAR-SOM-AM43-Yocto_1_6_installation_Release_2_V5.tar.gz


==== Installing the Yocto Daisy 1.6 Distribution ====
==== Installing the Yocto Daisy 1.6 Distribution ====
To install the YOCTO distribution, please type the following commands:
To install the YOCTO distribution, please type the following commands:
<pre>
<pre>
$ cd ~/yocto_varsomam33/tisdk
cd ~/yocto_varsomam43_daisy/tisdk
$ ./oe-layertool-setup.sh -f ~/yocto_varsomam33/var_yocto_installation/tisdk/var_configs/var_arago-daisy-config.txt
./oe-layertool-setup.sh -f ../var_yocto_installation/tisdk/var_configs/var_arago-daisy-config.txt
$ cd build
cd build
$ . conf/setenv
. conf/setenv
</pre>
</pre>


==== Installing the VAR-SOM-AM43 support ====
==== Installing the VAR-SOM-AM43 support ====
Once the Arago Yocto distribution is installed on the Host Ubuntu machine, the developer should apply the Variscite installation, as follows:
Once the Arago Yocto distribution is installed on the Host Ubuntu machine, the developer should apply the Variscite installation, as follows:
  $ cd ~/yocto_varsomam43_daisy/tisdk
  cd ~/yocto_varsomam43_daisy/tisdk
  $ ../var_yocto_installation/variscite_utils/install_var_yocto.sh
  ../var_yocto_installation/variscite_utils/install_var_yocto.sh


At this point, Variscite Yocto support has been installed over the Yocto distribution and can be built.
At this point, Variscite Yocto support has been installed over the Yocto distribution and can be built.
Line 92: Line 86:
==== Parallel build ====
==== Parallel build ====
Set the build parameters to fully utilize your host machine  
Set the build parameters to fully utilize your host machine  
BB_NUMBER_THREADS = '4'<br>PARALLEL_MAKE = '-j 6'  
BB_NUMBER_THREADS = '4'
PARALLEL_MAKE = '-j 6'  
BB_NUMBER_THREADS should be your host machine's number of threads minus 2 or same.  
BB_NUMBER_THREADS should be your host machine's number of threads minus 2 or same.  
PARALLEL_MAKE should be the number of threads your host machine has plus two.<br>
PARALLEL_MAKE should be the number of threads your host machine has plus two.


==== Download directory.  ====
==== Download directory.  ====
Recommended to save download time and space.  
Recommended to save download time and space.  
DL_DIR = "/home/&lt;uname&gt;/yocto_dl"<br>
DL_DIR = "/home/&lt;uname&gt;/yocto_dl"
 
==== TI MIRRORS  ====
One common location for hosting packages, gforge.ti.com, has recently been decommissioned. This will cause fetch failures for the current and past releases. Please add the following lines to your local.cof to configure the build to obtain these packages from the TI mirror.
 
TI_MIRROR = "http:&#47;&#47;software-dl.ti.com/processor-sdk-mirror/sources/"
MIRRORS += " \
  bzr:&#47;&#47;.*/.*      ${TI_MIRROR} \n \
  cvs:&#47;&#47;.*/.*      ${TI_MIRROR} \n \
  git:&#47;&#47;.*/.*      ${TI_MIRROR} \n \
  gitsm:&#47;&#47;.*/.*    ${TI_MIRROR} \n \
  hg:&#47;&#47;.*/.*      ${TI_MIRROR} \n \
  osc:&#47;&#47;.*/.*      ${TI_MIRROR} \n \
  p4:&#47;&#47;.*/.*      ${TI_MIRROR} \n \
  npm:&#47;&#47;.*/.*      ${TI_MIRROR} \n \
  ftp:&#47;&#47;.*/.*      ${TI_MIRROR} \n \
  https?$:&#47;&#47;.*/.*  ${TI_MIRROR} \n \
  svn:&#47;&#47;.*/.*      ${TI_MIRROR} \n \
"


=== Setting up the Toolchain ===
=== Setting up the Toolchain ===
<pre>
<pre>
$ export PATH=/opt/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin:$PATH
export PATH=/opt/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin:$PATH
</pre>
</pre>


= Building the VAR-SOM-AM43 Yocto image =
= Building the VAR-SOM-AM43 Yocto image =
First, change directory to the build directory of Yocto:
First, change directory to the build directory of Yocto:
  $ cd ~/yocto_varsomam43_daisy/tisdk/build
  cd ~/yocto_varsomam43_daisy/tisdk/build


The developer can build the tisdk-rootfs-image image as follows:
The developer can build the tisdk-rootfs-image image as follows:
  $ MACHINE=varsomam43 bitbake tisdk-rootfs-image
  MACHINE=varsomam43 bitbake tisdk-rootfs-image


After the image was built, all images will be located in: ~/yocto_varsomam43_daisy/tisdk/build/arago-tmp-external-linaro-toolchain/deploy/images/varsomam43 - Specifically:
After the image was built, all images will be located in: ~/yocto_varsomam43_daisy/tisdk/build/arago-tmp-external-linaro-toolchain/deploy/images/varsomam43 - Specifically:
Line 120: Line 133:


If the rootfs directory already exists - Please make sure to erase all its content before extracting a new rootfs image into it:
If the rootfs directory already exists - Please make sure to erase all its content before extracting a new rootfs image into it:
  $ . conf/setenv
  . conf/setenv
  $ sudo rm -rf ~/yocto_varsomam43_daisy/rootfs/*
  sudo rm -rf ~/yocto_varsomam43_daisy/rootfs/*


Extract the rootfs as follows:
Extract the rootfs as follows:
<pre>
<pre>
  $ sudo mkdir ~/yocto_varsomam43_daisy/rootfs
  sudo mkdir ~/yocto_varsomam43_daisy/rootfs
  $ sudo tar xvf ./arago-tmp-external-linaro-toolchain/deploy/images/varsomam43/tisdk-rootfs-image-varsomam43.tar.gz -C ~/yocto_varsomam43_daisy/rootfs
  sudo tar xvf ./arago-tmp-external-linaro-toolchain/deploy/images/varsomam43/tisdk-rootfs-image-varsomam43.tar.gz -C ~/yocto_varsomam43_daisy/rootfs
</pre>
</pre>


Line 139: Line 152:


= Create a bootable SD-Card =
= Create a bootable SD-Card =
In general you may Follow http://processors.wiki.ti.com/index.php/Sitara_Linux_SDK_create_SD_card_script
In general you may follow [http://processors.wiki.ti.com/index.php/Sitara_Linux_SDK_create_SD_card_script Sitara Linux SDK create SD card script]
<br>
 
Variscite has modified create-sdcard.sh script with all required options already selected.
Variscite has modified create-sdcard.sh script with all required options already selected.


Line 148: Line 161:
* To generate a UBIFS rootfs image that fits into 256MB flash (image size == 220MB) - Run script:
* To generate a UBIFS rootfs image that fits into 256MB flash (image size == 220MB) - Run script:
<pre>
<pre>
$ cd ~/yocto_varsomam43_daisy/variscite_utils
cd ~/yocto_varsomam43_daisy/variscite_utils
$ sudo ./create-ubi.sh ~/yocto_varsomam43_daisy/rootfs/ tisdk-rootfs-image/
sudo ./create-ubi.sh ~/yocto_varsomam43_daisy/rootfs/ tisdk-rootfs-image/
</pre>
</pre>


Line 159: Line 172:
For example:
For example:
<pre>
<pre>
$ cd ~/yocto_varsomam43_daisy/variscite_utils
cd ~/yocto_varsomam43_daisy/variscite_utils
$ sudo ./create-sdcard.sh /ws/am43/yocto_varsomam43_daisy/tisdk /ws/am43/yocto_varsomam43_daisy/rootfs/
sudo ./create-sdcard.sh /ws/am43/yocto_varsomam43_daisy/tisdk /ws/am43/yocto_varsomam43_daisy/rootfs/
</pre>
</pre>


The above procedure will result in a bootable SD-Card including MLO, U-boot, Kernel and file system + Linux recovery image to flash the NAND based on UBI file-system.
The above procedure will result in a bootable SD-Card including MLO, U-boot, Kernel and file system + Linux recovery image to flash the NAND based on UBI file-system.
To boot the bootable SD-Card, follow the steps below:
To boot the bootable SD-Card, follow the steps below:
* Insert the SD card into the SD/MMC slot of the custom board
* Insert the SD card into the SD/MMC slot of the custom board
* Press and hold the boot select switch while powering ON the board
* Press and hold the boot select switch while powering ON the board
* Login as root (no password)
* Login as root (no password)
== Touch screen calibration ==
The image skips Touch screen calibration by default in order to support carrier boards without Touch screen => The user should calibrate the screen manually on the first boot after burning an image (either on new MMC or to NAND), As follows:
Connect Touch screen and display and type the following command in the Linux shell:
<pre>
weston-calibrator
</pre>


== Support carrier boards without a Touch screen ==
== Support carrier boards without a Touch screen ==
Line 176: Line 197:
Please insert the SD-Card to a Linux machine (or VM) after creating the SD-Card and type the following command to disable touch screen calibration at the first boot:
Please insert the SD-Card to a Linux machine (or VM) after creating the SD-Card and type the following command to disable touch screen calibration at the first boot:
<pre>
<pre>
$ sudo touch /media/boot/ws-calibrate.rules
sudo touch /media/boot/ws-calibrate.rules
sync
</pre>
</pre>


Line 194: Line 216:


  U-Boot# run mmc_boot
  U-Boot# run mmc_boot
== Boot from NAND ==
By default the VAR-SOM-AM43 boots from NAND (or eMMC).
The SPL, U-Boot, kernel uImage and UBIFS filesystem are flashed on the NAND flash at production.
=== Flash Images to NAND ===
Replacing Nand Flash images can be done from either Linux user space or U-Boot.
<u>From Linux shell</u>
<pre>
$ nand-recovery.sh -o TISDK
</pre>
After the image is burned to the NAND flash device, please do as follows:
:1) Set dip-switches to boot from NAND on the carrier board.
:2) Restart the board.
:3) Remove the SD-Card.
Please notice, that the VAR-SOM-AM43 has 2 variants:
:1) ETH + WiFi ==> Need to download zImage-var-som-am43.dtb ==> No need to change anything in the download script.
:2) 2 x ETH devices ==> Need to download zImage-var-som-am43-eth1.dtb ==> The user should update the download script (/sbin/nand-recovery.sh to download zImage-var-som-am43-eth1.dtb to the flash.)


== Boot from eMMC  ==
== Boot from eMMC  ==


By default the VAR-SOM-AM43 boots from eMMC.
By default the VAR-SOM-AM43 boots from eMMC (or NAND).


The SPL, U-Boot, kernel uImage and UBIFS filesystem are flashed on the eMMC flash at production.  
The SPL, U-Boot, kernel uImage and UBIFS filesystem are flashed on the eMMC flash at production.  
Line 205: Line 251:
Replacing Nand Flash images can be done from either Linux user space or U-Boot.  
Replacing Nand Flash images can be done from either Linux user space or U-Boot.  


<u>From Linux shell</u><u></u><br>  
<u>From Linux shell</u>
<pre>
<pre>
$ yocto-emmc-recovery.sh
$ yocto-emmc-recovery.sh
</pre>
</pre>


After the image is burned to the EMMC device, please do as follows:
After the image is burned to the eMMC device, please do as follows:
1) Remove the SD-Card.
:1) Set dip-switches to boot from eMMC on the carrier board.
2) Reset the board.
:2) Restart the board.
3) Update the following environment variables of U-boot (which is booting from EMMC at this point):
:3) Remove the SD-Card.
<pre>
$ setenv bootpart '1:2'
$ setenv mmcroot '/dev/mmcblk0p2 rw'
$ setenv mmcdev '1'


$ saveenv
Please notice, that the VAR-SOM-AM43 has 2 variants:
 
:1) ETH + WiFi ==> Need to download zImage-var-som-am43.dtb ==> No need to change anything in the download script.
$ boot
:2) 2 x ETH devices ==> Need to download zImage-var-som-am43-eth1.dtb ==> The user should update the download script (/sbin/nand-recovery.sh to download zImage-var-som-am43-eth1.dtb to the flash.)
</pre>


== Boot over Network (Ethernet)  ==
== Boot over Network (Ethernet)  ==
Line 228: Line 269:
{{note|'''NOTE''':<br/>When setting a MAC address please ensure that the LS-bit of the 1st byte is not 1 i.e. when setting the MAC address: y in x'''y''':ab:cd:ef:gh:jk has to be an even number. |info}}
{{note|'''NOTE''':<br/>When setting a MAC address please ensure that the LS-bit of the 1st byte is not 1 i.e. when setting the MAC address: y in x'''y''':ab:cd:ef:gh:jk has to be an even number. |info}}


&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; For more info this refer to the wiki page [http://en.wikipedia.org/wiki/MAC_address http://en.wikipedia.org/wiki/MAC_address].<br>  
<p class="pl-4">For more info this refer to the wiki page [http://en.wikipedia.org/wiki/MAC_address http://en.wikipedia.org/wiki/MAC_address].</p>


When kernel image and root file-system are fetched from a TFTP/NFS server:  
When kernel image and root file-system are fetched from a TFTP/NFS server:  
*Ensure that the SOM is connected to network with DHCP and TFTP server set up  
*Ensure that the SOM is connected to network with DHCP and TFTP server set up  
*If the TFTP server supports negotiation between client and server, Disable it  
*If the TFTP server supports negotiation between client and server, Disable it  
*Copy 'uImage' kernel image to TFTP server's root directory.  
*Copy 'uImage' kernel image to TFTP server's root directory.  
*Set 'ethaddr' U-Boot environment variable with proper ethernet address in format 'xx:xx:xx:xx:xx:xx' (replace 'xx' with proper hexadecimal values)<br>
*Set 'ethaddr' U-Boot environment variable with proper ethernet address in format 'xx:xx:xx:xx:xx:xx' (replace 'xx' with proper hexadecimal values)
*Setup NFS server and export one of the provided pre-build root file-system  
*Setup NFS server and export one of the provided pre-build root file-system  
*Execute following commands at U-Boot prompt. Assuming kernel image name as 'uImage':<br>
*Execute following commands at U-Boot prompt. Assuming kernel image name as 'uImage':
   
   
  U-Boot # setenv fdtfile '&lt;var-som-am43.dtb filename on TFTP&gt;'
  U-Boot # setenv fdtfile '&lt;var-som-am43.dtb filename on TFTP&gt;'
Line 246: Line 286:
  U-Boot # run netboot
  U-Boot # run netboot


'''Note, that the roopath parameter should be the directory of the extracted rootfs image, as explained above in section [http://variwiki.com/index.php?title=VAR-SOM-AM43_Yocto_GS#Building_the_VAR-SOM-AM43_Yocto_image Building the VAR-SOM-AM43 Yocto image] extracting the image to '[/home/user]/yocto_varsomam43_daisy/rootfs/'.'''
'''Note, that the roopath parameter should be the directory of the extracted rootfs image, as explained above in section [https://variwiki.com/index.php?title=VAR-SOM-AM43_Yocto_GS#Building_the_VAR-SOM-AM43_Yocto_image Building the VAR-SOM-AM43 Yocto image] extracting the image to '[/home/user]/yocto_varsomam43_daisy/rootfs/'.'''


= eMMC Recovery  =
= eMMC Recovery  =
Line 253: Line 293:


'''Preparing rescue SD-Card'''  
'''Preparing rescue SD-Card'''  
*Plug your SD card to your Linux machine, run dmesg and see what device is added (i.e. /dev/sd<span style="color: rgb(255, 0, 0);">'''X'''</span>)  
*Plug your SD card to your Linux machine, run dmesg and see what device is added (i.e. /dev/sd<span style="color: rgb(255, 0, 0);">'''X'''</span>)  
*xz -d am43-som-recovery-sd_Yocto_1_6_v1.img.xz
*xz -d am43-som-recovery-sd_Yocto_1_6_v1.img.xz
Line 260: Line 299:


'''Recover eMMC Flash: TI-SDK  (Linux with TI Matrix)'''  
'''Recover eMMC Flash: TI-SDK  (Linux with TI Matrix)'''  
*Insert the SD-card into the SD/MMC slot of the custom board  
*Insert the SD-card into the SD/MMC slot of the custom board  
*Make sure that the state of the following dip-switches on the VAR-SOM-AM43 carrier CustomBoard is the following:
*Make sure that the state of the following dip-switches on the VAR-SOM-AM43 carrier CustomBoard is the following:
Line 270: Line 308:


= U-Boot  =
= U-Boot  =
In AM437x the ROM code serves as the 1st stage bootloader.&nbsp;The 2nd and the 3rd stage bootloaders are based on U-Boot.  
In AM437x the ROM code serves as the 1st stage bootloader.&nbsp;The 2nd and the 3rd stage bootloaders are based on U-Boot.  


The binary for the 2nd stage is referred to as SPL and the binary for the 3rd stage as simply U-Boot. SPL is a non-interactive loader and is a specially built version of U-Boot. It is built concurrently when building U-Boot.  
The binary for the 2nd stage is referred to as SPL and the binary for the 3rd stage as simply U-Boot. SPL is a non-interactive loader and is a specially built version of U-Boot. It is built concurrently when building U-Boot.  


The ROM code can load the SPL image from the NAND or SDMMC devices.<br>
The ROM code can load the SPL image from the NAND or SDMMC devices.


== Building U-Boot out-of-tree  ==
== Building U-Boot out-of-tree  ==


=== Downloading source code ===  
=== Downloading source code ===  
*U-Boot sources can be downloaded from&nbsp;'''https://github.com/varigit/u-boot-VAR-SOM-AM43.git'''.
*U-Boot sources can be downloaded from&nbsp;'''git://github.com/varigit/u-boot-VAR-SOM-AMxx'''.
*U-boot is built automatically by bitbake.
*U-boot is built automatically by bitbake.
*This directory already includes Variscite's patches (already applied) to support the VAR-SOM-AM43.  
*This directory already includes Variscite's patches (already applied) to support the VAR-SOM-AM43.  
Line 287: Line 324:
First, clone the git repositories to a local directory, as follows:
First, clone the git repositories to a local directory, as follows:
<pre>
<pre>
$ mkdir ~/varsomam43
mkdir ~/varsomam43
$ cd ~/varsomam43
cd ~/varsomam43
$ git clone https://github.com/varigit/u-boot-VAR-SOM-AM43.git
git clone git://github.com/varigit/u-boot-VAR-SOM-AMxx
</pre>
</pre>


=== Setup Toolchain path ===
=== Setup Toolchain path ===
<pre>
<pre>
$ export PATH=/opt/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin:$PATH
export PATH=/opt/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin:$PATH
</pre>
</pre>


Line 300: Line 337:
*To configure U-boot to varsomam43 / MMC configuration, please type:
*To configure U-boot to varsomam43 / MMC configuration, please type:
<pre>
<pre>
$ make -j6 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mrproper
make -j6 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mrproper
$ make -j12 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-  varsomam43_config
make -j12 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-  varsomam43_config
</pre>
</pre>
*To configure U-boot to varsomam43 / eMMC configuration, please type:
*To configure U-boot to varsomam43 / eMMC configuration, please type:
<pre>
<pre>
$ make -j6 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mrproper
make -j6 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mrproper
$ make -j12 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-  varsomam43_emmc_config
make -j12 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-  varsomam43_emmc_config
</pre>
 
*To configure U-boot to varsomam43 / NAND flash configuration, please type:
<pre>
make -j6 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mrproper
make -j12 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-  varsomam43_nand_config
</pre>
</pre>


*Build U-boot:  
*Build U-boot:  
<pre>
<pre>
$ make -j6 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
make -j6 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
</pre>
</pre>


Line 317: Line 360:
*Copy to SD-Card:
*Copy to SD-Card:
<pre>
<pre>
$ sudo cp MLO /media/boot
sudo cp MLO /media/boot
$ sudo cp u-boot.img /media/boot
sudo cp u-boot.img /media/boot
$ sync
sync
$ sudo umount /media/boot/
sudo umount /media/boot/
$ sudo umount /media/rootfs
sudo umount /media/rootfs
$ sudo umount /media/user
sudo umount /media/user
</pre>
</pre>


Line 334: Line 377:


== Downloading source code ==
== Downloading source code ==
*Linux kernel sources can be downloaded from&nbsp;'''git://github.com/varigit/kernel-VAR-SOM-AMxx'''<br>
*Linux kernel sources can be downloaded from&nbsp;'''git://github.com/varigit/kernel-VAR-SOM-AMxx'''
*The kernel is built automatically by bitbake.
*The kernel is built automatically by bitbake.
*This directory includes Variscite's patches(already applied)&nbsp;to support the VAR-SOM-AM43.  
*This directory includes Variscite's patches(already applied)&nbsp;to support the VAR-SOM-AM43.  
Line 341: Line 384:
First, clone the git repositories to a local directory, as follows:
First, clone the git repositories to a local directory, as follows:
<pre>
<pre>
$ mkdir ~/varsomam43
mkdir ~/varsomam43
$ cd ~/varsomam43
cd ~/varsomam43
$ git clone https://github.com/varigit/kernel-VAR-SOM-AMxx
git clone https://github.com/varigit/kernel-VAR-SOM-AMxx
</pre>
</pre>


== Setup Toolchain path ==
== Setup Toolchain path ==
<pre>
<pre>
$ export PATH=/opt/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin:$PATH
export PATH=/opt/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin:$PATH
</pre>
</pre>


Line 356: Line 399:


Enter linux kernel directory:  
Enter linux kernel directory:  
 
  cd kernel-VAR-SOM-AMxx
  $ cd kernel-VAR-SOM-AMxx


{{note|'''NOTE:'''The next step will delete any saved .config file in the kernel tree as well as the generated object files. If you have done a previous configuration and do not wish to lose your configuration file you should save a copy of the configuration file before proceeding. |info}}
{{note|'''NOTE:'''The next step will delete any saved .config file in the kernel tree as well as the generated object files. If you have done a previous configuration and do not wish to lose your configuration file you should save a copy of the configuration file before proceeding. |info}}


The command to clean the kernel is:  
The command to clean the kernel is:  
 
  make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mrproper
  $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mrproper


== Configuring the Kernel  ==
== Configuring the Kernel  ==
Line 372: Line 413:


To build the defualt configuration for the VAR-SOM-AM43:  
To build the defualt configuration for the VAR-SOM-AM43:  
 
  make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- tisdk_var-som-am43_defconfig
  $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- tisdk_var-som-am43_defconfig


=== Customizing the Configuration<br>  ===
=== Customizing the Configuration<br>  ===


For configuring the kernel run:  
For configuring the kernel run:  
 
  make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
  $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig


Once the configuration window is open you can select which kernel components will be included in the build. Exiting the configuration will save your selections to a file in the root of the kernel tree called .config.  
Once the configuration window is open you can select which kernel components will be included in the build. Exiting the configuration will save your selections to a file in the root of the kernel tree called .config.  
Line 386: Line 425:


Once the kernel has been configured compile kernel:  
Once the kernel has been configured compile kernel:  
 
  make -j12 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage LOADADDR=0x80200000
  $ make -j12 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage LOADADDR=0x80200000


This will result in a kernel image file being created in the arch/arm/boot/ directory called uImage. This file can be used by u-boot to boot your device.  
This will result in a kernel image file being created in the arch/arm/boot/ directory called uImage. This file can be used by u-boot to boot your device.  


If you selected any components of the kernel to be build as dynamic modules you must issue an additional command to compile those modules. The command is:  
If you selected any components of the kernel to be build as dynamic modules you must issue an additional command to compile those modules. The command is:  
 
  make -j12 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules
  $ make -j12 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules


This will result in .ko (kernel object) files being placed in the kernel tree. These .ko files are the dynamic kernel modules. The next section will cover how to install these modules.
This will result in .ko (kernel object) files being placed in the kernel tree. These .ko files are the dynamic kernel modules. The next section will cover how to install these modules.
Line 399: Line 436:
== Building the VAR-SOM-AM43 device tree ==
== Building the VAR-SOM-AM43 device tree ==
To build the VAR-SOM-AM43 device tree (dtb image), please note the following - VAR-SOM-AM43 platform has 2 different device tree source files for different
To build the VAR-SOM-AM43 device tree (dtb image), please note the following - VAR-SOM-AM43 platform has 2 different device tree source files for different
SOM configurations:  
SOM configurations:
1) var-som-am43.dts: To be used for a SOM with WIFI + on-SOM Gbit Ethernet
:1) var-som-am43.dts: To be used for a SOM with WIFI + on-SOM Gbit Ethernet
2) var-som-am43-eth1.dts: To be used for a SOM with dual Gbit Ethernet ports. On-SOM + on-Carrier.
:2) var-som-am43-eth1.dts: To be used for a SOM with dual Gbit Ethernet ports. On-SOM + on-Carrier.


To build for a SOM with WIFI + on-SOM Gbit Ethernet, please use the following command line:
To build for a SOM with WIFI + on-SOM Gbit Ethernet, please use the following command line:
<pre>
<pre>
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- var-som-am43.dtb
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- var-som-am43.dtb
</pre>
</pre>


Line 412: Line 449:
To build for a SOM with dual Gbit Ethernet ports. On-SOM + on-Carrier., please use the following command line:
To build for a SOM with dual Gbit Ethernet ports. On-SOM + on-Carrier., please use the following command line:
<pre>
<pre>
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- var-som-am43-eth1.dtb
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- var-som-am43-eth1.dtb
</pre>
</pre>


Line 427: Line 464:
First, extract the rootfs of the tisdk-rootfs-image image as follows:
First, extract the rootfs of the tisdk-rootfs-image image as follows:
<pre>
<pre>
$ sudo mkdir ~/yocto_varsomam43_daisy/rootfs
sudo mkdir ~/yocto_varsomam43_daisy/rootfs
$ sudo tar xvf ./arago-tmp-external-linaro-toolchain/deploy/images/tisdk-rootfs-image-varsomam43.tar.bz2 -C ../../rootfs
sudo tar xvf ./arago-tmp-external-linaro-toolchain/deploy/images/tisdk-rootfs-image-varsomam43.tar.bz2 -C ../../rootfs
</pre>
</pre>


If the rootfs directory already exists - Please make sure to erase all its content before extracting a new rootfs image into it:
If the rootfs directory already exists - Please make sure to erase all its content before extracting a new rootfs image into it:
$ sudo rm -rf ~/yocto_varsomam43/rootfs/*
sudo rm -rf ~/yocto_varsomam43/rootfs/*


This command will create a directory tree in that location: lib/modules/&lt;kernel version&gt; which will contain the dynamic modules corresponding to this version of the kernel. The base location should usually be the root of your target file system. The general format of the command is:  
This command will create a directory tree in that location: lib/modules/&lt;kernel version&gt; which will contain the dynamic modules corresponding to this version of the kernel. The base location should usually be the root of your target file system. The general format of the command is:  


  $ sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules_install INSTALL_MOD_PATH=&lt;path to root of file system&gt;  
  sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules_install INSTALL_MOD_PATH=&lt;path to root of file system&gt;  


For example if you are installing the modules to an NFS share located at ~/yocto_varsomam43_daisy/rootfs you would do:  
For example if you are installing the modules to an NFS share located at ~/yocto_varsomam43_daisy/rootfs you would do:  


  $ sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules_install INSTALL_MOD_PATH=~/yocto_varsomam43_daisy/rootfs
  sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules_install INSTALL_MOD_PATH=~/yocto_varsomam43_daisy/rootfs


=== Installing the kernel to a VAR-SOM-AM43 SD-Card ===
=== Installing the kernel to a VAR-SOM-AM43 SD-Card ===


In order to install the kernel to the SD-Card, please follow the instructions below:<br>
In order to install the kernel to the SD-Card, please follow the instructions below:
1) Insert SD-Card with VAR-SOM-AM43 image.<br>
:1) Insert SD-Card with VAR-SOM-AM43 image.
2) Build the kernel as explained above.<br>
:2) Build the kernel as explained above.
3) Install by executing the following commands:
:3) Install by executing the following commands:
<pre>
<pre>
$ sudo cp -a arch/arm/boot/zImage /media/rootfs/boot
sudo cp -a arch/arm/boot/zImage /media/rootfs/boot
$ sudo cp -a arch/arm/boot/dts/var-som-am43.dtb /media/rootfs/boot
sudo cp -a arch/arm/boot/dts/var-som-am43.dtb /media/rootfs/boot
$ sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules_install INSTALL_MOD_PATH=/media/rootfs  
sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules_install INSTALL_MOD_PATH=/media/rootfs  
$ sync
sync
$ sudo umount /media/boot
sudo umount /media/boot
$ sudo umount /media/rootfs
sudo umount /media/rootfs
$ sudo umount /media/user
sudo umount /media/user
</pre>
</pre>


Line 463: Line 500:


= Reference Documentation  =
= Reference Documentation  =
*[http://arago-project.org/wiki/index.php/Setting_Up_Build_Environment Instructions for downloading and installing the Yocto project]
*[http://arago-project.org/wiki/index.php/Setting_Up_Build_Environment Instructions for downloading and installing the Yocto project]
*[http://processors.wiki.ti.com/index.php/How_to_Flash_Linux_System_from_U-boot How to Flash Linux System from U-boot]  
*[http://processors.wiki.ti.com/index.php/How_to_Flash_Linux_System_from_U-boot How to Flash Linux System from U-boot]  

Latest revision as of 11:56, 10 June 2020

VAR-SOM-AM43 Yocto 1.6 (Daisy) Distribution User's Guide

About this Manual

This document describes how to install Variscite's Yocto release for the VAR-SOM-AM43.

The Yocto distribution provides a fundamental software platform for development, deployment and execution on VAR-SOM-AM43. It abstracts the functionality provided by the hardware.

In this context, the document contains instructions to:

  • Install the release on a development machine.
  • Build the sources included in this release.
  • Installing the binaries on the VAR-SOM-AM43.
  • Booting the VAR-SOM-AM43.

Installation

Prerequisites

Before starting the installation, make sure below system requirements are met:

  • Host machine running a Ubuntu 12.04 64 LTS.
  • VAR-SOM-AM43 Evaluation Kit + VAR-SOM-AM43 Yocto support installation sources and binaries (from FTP). Please refer to support@variscite.com for obtaining FTP credentials.

The Linux host is used for the following:

  • Recompiling U-Boot / kernel.
  • Hosting the NFS server to boot the EVM with NFS as root filesystem.

Either of Windows or Linux host can be used for:

  • Hosting the TFTP server required for downloading the kernel and file-system images from U-Boot using Ethernet.
  • Running a serial console terminal application

Building the Yocto distribution via Bitbake will produce a complete set of downloaded source code + binaries for each component:

  • Yocto build environment
  • Downloaded Linux kernel source code + build kernel binaries (DTB and zImage) for VAR-SOM-AM43.
  • Downloaded U-Boot source code + build U-boot binaries (MLO and U-boot) for VAR-SOM-AM43.
  • Linux root file-system.

Install the Arago toolchain

wget --no-check-certificate https://launchpad.net/linaro-toolchain-binaries/trunk/2013.03/+download/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux.tar.bz2
sudo tar -jxvf gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux.tar.bz2 -C /opt

Install development tools

sudo apt-get install git build-essential diffstat texinfo gawk chrpath gcc-multilib wget socat libsdl1.2-dev ia32-libs mtd-utils

Download the Yocto Distribution

To quickly start making your own builds using meta-ti BSP layer and meta-arago Distribution layer, you can follow this short Quick Start section by entering below commands. For more expanded guide with each step detailed and sample output of the entered commands shown, please see the next Detailed Setup section.

mkdir ~/yocto_varsomam43_daisy
cd ~/yocto_varsomam43_daisy
git clone git://arago-project.org/git/projects/oe-layersetup.git tisdk
cd tisdk

Downloading VAR-SOM-AM43 Support

Download the VAR-SOM-AM43 Yocto support installation from Variscite FTP:

  • /VAR-SOM-AM43/Software/Linux/YOCTO_Daisy_1.6_Release_2_v5/VAR-SOM-AM43-Yocto_1_6_installation_Release_2_V5.tar.gz

Extract Variscite Yocto installation as follows:

mkdir ~/yocto_varsomam43_daisy/var_yocto_installation
cd ~/yocto_varsomam43_daisy/var_yocto_installation
tar xvf VAR-SOM-AM43-Yocto_1_6_installation_Release_2_V5.tar.gz

Installing the Yocto Daisy 1.6 Distribution

To install the YOCTO distribution, please type the following commands:

cd ~/yocto_varsomam43_daisy/tisdk
./oe-layertool-setup.sh -f ../var_yocto_installation/tisdk/var_configs/var_arago-daisy-config.txt
cd build
. conf/setenv

Installing the VAR-SOM-AM43 support

Once the Arago Yocto distribution is installed on the Host Ubuntu machine, the developer should apply the Variscite installation, as follows:

cd ~/yocto_varsomam43_daisy/tisdk
../var_yocto_installation/variscite_utils/install_var_yocto.sh

At this point, Variscite Yocto support has been installed over the Yocto distribution and can be built.

local.conf customizations

Edit you local.conf file:

$ gedit conf/local.conf 

Change your parallel build and download directory:

Parallel build

Set the build parameters to fully utilize your host machine

BB_NUMBER_THREADS = '4'
PARALLEL_MAKE = '-j 6' 

BB_NUMBER_THREADS should be your host machine's number of threads minus 2 or same. PARALLEL_MAKE should be the number of threads your host machine has plus two.

Download directory.

Recommended to save download time and space.

DL_DIR = "/home/<uname>/yocto_dl"

TI MIRRORS

One common location for hosting packages, gforge.ti.com, has recently been decommissioned. This will cause fetch failures for the current and past releases. Please add the following lines to your local.cof to configure the build to obtain these packages from the TI mirror.

TI_MIRROR = "http://software-dl.ti.com/processor-sdk-mirror/sources/"
MIRRORS += " \
 bzr://.*/.*      ${TI_MIRROR} \n \
 cvs://.*/.*      ${TI_MIRROR} \n \
 git://.*/.*      ${TI_MIRROR} \n \
 gitsm://.*/.*    ${TI_MIRROR} \n \
 hg://.*/.*       ${TI_MIRROR} \n \
 osc://.*/.*      ${TI_MIRROR} \n \
 p4://.*/.*       ${TI_MIRROR} \n \
 npm://.*/.*      ${TI_MIRROR} \n \
 ftp://.*/.*      ${TI_MIRROR} \n \
 https?$://.*/.*  ${TI_MIRROR} \n \
 svn://.*/.*      ${TI_MIRROR} \n \
"

Setting up the Toolchain

export PATH=/opt/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin:$PATH

Building the VAR-SOM-AM43 Yocto image

First, change directory to the build directory of Yocto:

cd ~/yocto_varsomam43_daisy/tisdk/build

The developer can build the tisdk-rootfs-image image as follows:

MACHINE=varsomam43 bitbake tisdk-rootfs-image

After the image was built, all images will be located in: ~/yocto_varsomam43_daisy/tisdk/build/arago-tmp-external-linaro-toolchain/deploy/images/varsomam43 - Specifically:

  • MLO image
  • u-boot.img image
  • zImage
  • zImage-var-som-am43.dtb
  • Compressed rootfs image: tisdk-rootfs-image-varsomam43.tar.bz2

If the rootfs directory already exists - Please make sure to erase all its content before extracting a new rootfs image into it:

. conf/setenv
sudo rm -rf ~/yocto_varsomam43_daisy/rootfs/*

Extract the rootfs as follows:

 sudo mkdir ~/yocto_varsomam43_daisy/rootfs
 sudo tar xvf ./arago-tmp-external-linaro-toolchain/deploy/images/varsomam43/tisdk-rootfs-image-varsomam43.tar.gz -C ~/yocto_varsomam43_daisy/rootfs

This creates a rootfs directory for the Yocto / VAR-SOM-AM43 build.

Linux Root File-System

To boot-up Linux, a target file-system is needed. A file-systems is built from the Yocto distribution for VAR-SOM-AM43.

  • Demo filesystem (~250MB) - This file system is created by taking the base file system and adding all the additional SDK components such as 3D graphics, matrix, profiling tools, etc... - tisdk-rootfs-image-varsomam43.tar.bz2

Further explanation about customizing these file-systems can be found here.

Create a bootable SD-Card

In general you may follow Sitara Linux SDK create SD card script

Variscite has modified create-sdcard.sh script with all required options already selected.

To create a bootable SD-Card image, which includes a UBIFS file-system based recovery image - Please do as follows:

  • Insert a 4GB SD-Card to host computer
  • Run dmesg command to identify which /dev/sdX was created
  • To generate a UBIFS rootfs image that fits into 256MB flash (image size == 220MB) - Run script:
cd ~/yocto_varsomam43_daisy/variscite_utils
sudo ./create-ubi.sh ~/yocto_varsomam43_daisy/rootfs/ tisdk-rootfs-image/
  • To generate the SD-Card - Run script (and choose the correct /dev/sdX of the 4GB SD-Card inserted):
$ cd ~/yocto_varsomam43_daisy/variscite_utils
$ sudo ./create-sdcard.sh [/home/user]/yocto_varsomam43_daisy/tisdk [/home/user]/yocto_varsomam43_daisy/rootfs/

For example:

cd ~/yocto_varsomam43_daisy/variscite_utils
sudo ./create-sdcard.sh /ws/am43/yocto_varsomam43_daisy/tisdk /ws/am43/yocto_varsomam43_daisy/rootfs/

The above procedure will result in a bootable SD-Card including MLO, U-boot, Kernel and file system + Linux recovery image to flash the NAND based on UBI file-system. To boot the bootable SD-Card, follow the steps below:

  • Insert the SD card into the SD/MMC slot of the custom board
  • Press and hold the boot select switch while powering ON the board
  • Login as root (no password)

Touch screen calibration

The image skips Touch screen calibration by default in order to support carrier boards without Touch screen => The user should calibrate the screen manually on the first boot after burning an image (either on new MMC or to NAND), As follows:

Connect Touch screen and display and type the following command in the Linux shell:

weston-calibrator

Support carrier boards without a Touch screen

In order to skip the Touch screen calibration on the first boot on carrier boards without a Touch screen -

Please insert the SD-Card to a Linux machine (or VM) after creating the SD-Card and type the following command to disable touch screen calibration at the first boot:

sudo touch /media/boot/ws-calibrate.rules
sync

Boot

The Kernel and root the file-system can be booted either from NAND, SD-Card or can be retrieved via ethernet to RAM using TFTP.

eMMC root file-system is ext4 based which is the recommended filesystem for eMMC flashes.

Following sections describe various kernel boot options possible.

Boot from MMC/SD

For creating a bootable SD , follow the below instruction on creating a rescue SD. http://www.variwiki.com/index.php?title=VAR-SOM-AM43_Arago_GS#NAND_Recovery

To boot the Linux, type:

U-Boot# run mmc_boot

Boot from NAND

By default the VAR-SOM-AM43 boots from NAND (or eMMC).

The SPL, U-Boot, kernel uImage and UBIFS filesystem are flashed on the NAND flash at production.

Flash Images to NAND

Replacing Nand Flash images can be done from either Linux user space or U-Boot.

From Linux shell

$ nand-recovery.sh -o TISDK

After the image is burned to the NAND flash device, please do as follows:

1) Set dip-switches to boot from NAND on the carrier board.
2) Restart the board.
3) Remove the SD-Card.

Please notice, that the VAR-SOM-AM43 has 2 variants:

1) ETH + WiFi ==> Need to download zImage-var-som-am43.dtb ==> No need to change anything in the download script.
2) 2 x ETH devices ==> Need to download zImage-var-som-am43-eth1.dtb ==> The user should update the download script (/sbin/nand-recovery.sh to download zImage-var-som-am43-eth1.dtb to the flash.)

Boot from eMMC

By default the VAR-SOM-AM43 boots from eMMC (or NAND).

The SPL, U-Boot, kernel uImage and UBIFS filesystem are flashed on the eMMC flash at production.

Flash Images to eMMC

Replacing Nand Flash images can be done from either Linux user space or U-Boot.

From Linux shell

$ yocto-emmc-recovery.sh

After the image is burned to the eMMC device, please do as follows:

1) Set dip-switches to boot from eMMC on the carrier board.
2) Restart the board.
3) Remove the SD-Card.

Please notice, that the VAR-SOM-AM43 has 2 variants:

1) ETH + WiFi ==> Need to download zImage-var-som-am43.dtb ==> No need to change anything in the download script.
2) 2 x ETH devices ==> Need to download zImage-var-som-am43-eth1.dtb ==> The user should update the download script (/sbin/nand-recovery.sh to download zImage-var-som-am43-eth1.dtb to the flash.)

Boot over Network (Ethernet)

NOTE:
When setting a MAC address please ensure that the LS-bit of the 1st byte is not 1 i.e. when setting the MAC address: y in xy:ab:cd:ef:gh:jk has to be an even number.

For more info this refer to the wiki page http://en.wikipedia.org/wiki/MAC_address.

When kernel image and root file-system are fetched from a TFTP/NFS server:

  • Ensure that the SOM is connected to network with DHCP and TFTP server set up
  • If the TFTP server supports negotiation between client and server, Disable it
  • Copy 'uImage' kernel image to TFTP server's root directory.
  • Set 'ethaddr' U-Boot environment variable with proper ethernet address in format 'xx:xx:xx:xx:xx:xx' (replace 'xx' with proper hexadecimal values)
  • Setup NFS server and export one of the provided pre-build root file-system
  • Execute following commands at U-Boot prompt. Assuming kernel image name as 'uImage':
U-Boot # setenv fdtfile '<var-som-am43.dtb filename on TFTP>'
U-Boot # setenv bootfile <zImage filename on TFTP>
U-Boot # setenv netargs 'setenv bootargs console=${console} ${optargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=dhcp vram=50M'
U-Boot # setenv serverip <Server IP address>
U-Boot # setenv rootpath '<Path of the exported root file-system on the NFS server>'
U-Boot # run netboot

Note, that the roopath parameter should be the directory of the extracted rootfs image, as explained above in section Building the VAR-SOM-AM43 Yocto image extracting the image to '[/home/user]/yocto_varsomam43_daisy/rootfs/'.

eMMC Recovery

As an easy and fast way to recover the VAR-SOM-AM43 eMMC flash, Variscite provides a recovery SD card image that can be used to install the pre-built Linux and Android systems.
This SD card image includes a script (emmc-recovery.sh) that installs all the boot images and root file-system.

Preparing rescue SD-Card

  • Plug your SD card to your Linux machine, run dmesg and see what device is added (i.e. /dev/sdX)
  • xz -d am43-som-recovery-sd_Yocto_1_6_v1.img.xz
  • dd if=am43-som-recovery-sd_Yocto_1_6_v1.img of=/dev/sdX bs=128k
  • sync

Recover eMMC Flash: TI-SDK (Linux with TI Matrix)

  • Insert the SD-card into the SD/MMC slot of the custom board
  • Make sure that the state of the following dip-switches on the VAR-SOM-AM43 carrier CustomBoard is the following:
    • SW1=1
    • SW2=2
  • Login as root (no password)
  • From Linux command line, type: "yocto-emmc-recovery.sh -o TISDK". (This will install Linux on the eMMC flash)
  • Unplug the SD card and reboot

U-Boot

In AM437x the ROM code serves as the 1st stage bootloader. The 2nd and the 3rd stage bootloaders are based on U-Boot.

The binary for the 2nd stage is referred to as SPL and the binary for the 3rd stage as simply U-Boot. SPL is a non-interactive loader and is a specially built version of U-Boot. It is built concurrently when building U-Boot.

The ROM code can load the SPL image from the NAND or SDMMC devices.

Building U-Boot out-of-tree

Downloading source code

First, clone the git repositories to a local directory, as follows:

mkdir ~/varsomam43
cd ~/varsomam43
git clone git://github.com/varigit/u-boot-VAR-SOM-AMxx

Setup Toolchain path

export PATH=/opt/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin:$PATH

Building U-boot

  • To configure U-boot to varsomam43 / MMC configuration, please type:
make -j6 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mrproper
make -j12 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-  varsomam43_config
  • To configure U-boot to varsomam43 / eMMC configuration, please type:
make -j6 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mrproper
make -j12 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-  varsomam43_emmc_config
  • To configure U-boot to varsomam43 / NAND flash configuration, please type:
make -j6 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mrproper
make -j12 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-  varsomam43_nand_config
  • Build U-boot:
make -j6 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
  • Insert VAR-SOM-AM43 SD-Card to Host PC.
  • Copy to SD-Card:
sudo cp MLO /media/boot
sudo cp u-boot.img /media/boot
sync
sudo umount /media/boot/
sudo umount /media/rootfs
sudo umount /media/user

U-Boot Environment Settings

The VAR-SOM-AM43 U-Boot has default environmant settings that allows boot from SD/MMC card, eMMC device, and Ethernet.

By default the boot device is SD/MMC card.

Linux Kernel

Downloading source code

First, clone the git repositories to a local directory, as follows:

mkdir ~/varsomam43
cd ~/varsomam43
git clone https://github.com/varigit/kernel-VAR-SOM-AMxx

Setup Toolchain path

export PATH=/opt/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin:$PATH

Cleaning the Kernel Sources

Prior to compiling the Linux kernel make sure that the kernel sources are clean.

Enter linux kernel directory:

cd kernel-VAR-SOM-AMxx


NOTE:The next step will delete any saved .config file in the kernel tree as well as the generated object files. If you have done a previous configuration and do not wish to lose your configuration file you should save a copy of the configuration file before proceeding.

The command to clean the kernel is:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mrproper

Configuring the Kernel

Before compiling the Linux kernel it needs to be configured to select which components will become part of the kernel image:

Using Default Configurations

To build the defualt configuration for the VAR-SOM-AM43:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- tisdk_var-som-am43_defconfig

Customizing the Configuration

For configuring the kernel run:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig

Once the configuration window is open you can select which kernel components will be included in the build. Exiting the configuration will save your selections to a file in the root of the kernel tree called .config.

Compiling the Kernel

Once the kernel has been configured compile kernel:

make -j12 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage LOADADDR=0x80200000

This will result in a kernel image file being created in the arch/arm/boot/ directory called uImage. This file can be used by u-boot to boot your device.

If you selected any components of the kernel to be build as dynamic modules you must issue an additional command to compile those modules. The command is:

make -j12 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules

This will result in .ko (kernel object) files being placed in the kernel tree. These .ko files are the dynamic kernel modules. The next section will cover how to install these modules.

Building the VAR-SOM-AM43 device tree

To build the VAR-SOM-AM43 device tree (dtb image), please note the following - VAR-SOM-AM43 platform has 2 different device tree source files for different SOM configurations:

1) var-som-am43.dts: To be used for a SOM with WIFI + on-SOM Gbit Ethernet
2) var-som-am43-eth1.dts: To be used for a SOM with dual Gbit Ethernet ports. On-SOM + on-Carrier.

To build for a SOM with WIFI + on-SOM Gbit Ethernet, please use the following command line:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- var-som-am43.dtb

The image will be located in: arch/arm/boot/dts/var-som-am43.dtb

To build for a SOM with dual Gbit Ethernet ports. On-SOM + on-Carrier., please use the following command line:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- var-som-am43-eth1.dtb

The image will be located in: arch/arm/boot/dts/var-som-am43-eth1.dtb

Installing the Kernel

Once the Linux kernel and modules have been compiled they must be installed. In the case of the kernel image this can be installed by copying the uImage file to the location for downloading using TFTP, or put in an SD-card.

For example: when using TFTP boot,  /tftpboot directory is the common location, whereas when booting from SD card, file should be put in the first FAT partition.

To install the kernel modules, provide the rootfs location, see below.

First, extract the rootfs of the tisdk-rootfs-image image as follows:

sudo mkdir ~/yocto_varsomam43_daisy/rootfs
sudo tar xvf ./arago-tmp-external-linaro-toolchain/deploy/images/tisdk-rootfs-image-varsomam43.tar.bz2 -C ../../rootfs

If the rootfs directory already exists - Please make sure to erase all its content before extracting a new rootfs image into it: sudo rm -rf ~/yocto_varsomam43/rootfs/*

This command will create a directory tree in that location: lib/modules/<kernel version> which will contain the dynamic modules corresponding to this version of the kernel. The base location should usually be the root of your target file system. The general format of the command is:

sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules_install INSTALL_MOD_PATH=<path to root of file system> 

For example if you are installing the modules to an NFS share located at ~/yocto_varsomam43_daisy/rootfs you would do:

sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules_install INSTALL_MOD_PATH=~/yocto_varsomam43_daisy/rootfs

Installing the kernel to a VAR-SOM-AM43 SD-Card

In order to install the kernel to the SD-Card, please follow the instructions below:

1) Insert SD-Card with VAR-SOM-AM43 image.
2) Build the kernel as explained above.
3) Install by executing the following commands:
sudo cp -a arch/arm/boot/zImage /media/rootfs/boot
sudo cp -a arch/arm/boot/dts/var-som-am43.dtb /media/rootfs/boot
sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules_install INSTALL_MOD_PATH=/media/rootfs 
sync
sudo umount /media/boot
sudo umount /media/rootfs
sudo umount /media/user

Out-of-tree Kernel Modules

NOTE:
Some drivers like the SGX and WLAN drivers are delivered as modules outside of the kernel tree. These drivers binaries are already included in the pre-built root file-systems provided by Variscite.

Reference Documentation