VAR-SOM-AM33 Linux SDK 7: Difference between revisions
Line 130: | Line 130: | ||
** setenv fdtfile var-som-am33.dtb | ** setenv fdtfile var-som-am33.dtb | ||
** setenv bootcmd 'run mmcboot' | ** setenv bootcmd 'run mmcboot' | ||
** | ** saveenv | ||
* Reboot again and press the boot-select button - Linux system will then boot from the SD-Card | * Reboot again and press the boot-select button - Linux system will then boot from the SD-Card | ||
* Press and hold the boot select switch while powering ON the board | * Press and hold the boot select switch while powering ON the board |
Revision as of 14:01, 9 November 2014
About this Manual
This document describes how to install Variscite's Linux Support Package (LSP) for the VAR-SOM-AM33 based on TI's SDK 7.0
This LSP provides a fundamental software platform for development, deployment and execution on VAR-SOM-AM33. It abstracts the functionality provided by the hardware.
In this context, the document contains instructions to:
- Install the release on a developmant machine.
- Build the sources included in this release.
- Instaling the binaries on the VAR-SOM-AM33.
- Booting the VAR-SOM-AM33.
Installation
Prerequisites
Before starting the installation of the package, make sure below system requirements are met:
- Host machine running a version of Windows OS such as Windows XP / 7 or a Linux such as Ubuntu.
- VAR-SOM-AM33 Evaluation Kit + sources and binaries. 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
Install Required Host packages
Please install the following packages on the Host Ubuntu machine:
$ sudo apt-get install xinetd tftpd nfs-kernel-server minicom
Install LSP packages
Variscite's LSP is based on TI's SDK 7.0 release. Follow TI's SDK installation guide step by step. After completing the initial SDK installation, patch the kernel and u-boot with supplied patches from FTP.
- Download release patches from ftp://ftp.variscite.com/VAR-SOM-AM33/Software/Linux/SDK-07.00.00.0.VAR.R1
- Download Sitara AM335x SDK 7.0 http://software-dl.ti.com/sitara_linux/esd/AM335xSDK/latest/index_FDS.html
- Follow TI's instructions on how to install SDK: : http://processors.wiki.ti.com/index.php/Sitara_SDK_Installer
- After installation is complete, replace kernel and u-boot:
Obtain kernel and u-boot from varigit:
$ cd ~/ti-sdk-am335x-evm-07.00.00.00/board-support/ $ rm -rf linux-3.12.10-ti2013.12.01 $ rm -rf u-boot-2013.10-ti2013.12.01 $ git clone git://github.com/varigit/u-boot-VAR-SOM-AM33-SDK7.git $ git clone git://github.com/varigit/VAR-SOM-AM33-SDK7-Kernel.git
Patch ~/ti-sdk-am335x-evm-07.00.00.00/Rules.make
$ cd ~/ti-sdk-am335x-evm-07.00.00.00 $ patch Rules.make < <path/to/patches>/Rules.patch
Patch ~/ti-sdk-am335x-evm-07.00.00.00/Makefile
$ patch Makefile < <path/to/patches>/Makefile.patch
Compile MLO and U-BOOT
$ make u-boot
Resulted MLO and u-boot.img will be created at ~/ti-sdk-am335x-evm-07.00.00.00/board-support/u-boot-2013.10-ti2013.12.01/
Compile Linux kernel
$ make linux
Installing kernel modules
- Copy the var-som-am33.dtb manually to the prebuilt-images directory:
$ cp board-support/VAR-SOM-AM33-SDK7-Kernel/arch/arm/boot/dts/var-som-am33.dtb ./bin/../board-support/prebuilt-images/zImage-var-som-am33.bin
- Extract pre-built file-system tarball to /home/<user>/ti-sdk-am335x-evm-07.00.00.00/targetNFS/
$ sudo ./setup.sh
- Install kernel modules to file-system folder (/home/<user>/ti-sdk-am335x-evm-07.00.00.00/targetNFS) :
$ sudo make linux_install
Installing wireless firmware binaries
Download firmware package : /VAR-SOM-AM33/Software/Linux/SDK-07.00.00.0.VAR.R1/firmware.tar.gz
extract content to target file-system:
$ tar xvf firmware.tar.gz -C ~/ti-sdk-am335x-evm-07.00.00.00/targetNFS/lib/
Installing Graphics libraries (AM3354/AM3358/AM3359)
Please follow instructions : http://variwiki.com/index.php?title=VAR-SOM-AM33_Linux_SDK_7_installing_graphics_SDK
Create a bootable SD-Card
In general you may Follow http://processors.wiki.ti.com/index.php/Sitara_Linux_SDK_create_SD_card_script
Variscite has modified create-sdcard.sh script with all required options already selected.
Replace ti-sdk-am335x-evm-07.00.00.00/bin/create-sdcard.sh with provided one on FTP and run script.
- Insert a 8GB SD-Card to host computer
- Run dmesg command to identify which /dev/sdX was created
- Run script :
$ cd ~/ti-sdk-am335x-evm-07.00.00.00 $ cp /path to downloaded scripts/create-sdcard.sh bin/ $ sudo ./bin/create-sdcard.sh
The above procedure will result in a bootable SD-Card including MLO, U-boot, Kernel and file system. To boot the bootable SD-Card, follow the below steps :
- Insert the SD card into the SD/MMC slot of the custom board and press the boot-select button
- Press a key to stop in u-boot and type the following commands:
- setenv fdtfile var-som-am33.dtb
- setenv bootcmd 'run mmcboot'
- saveenv
- Reboot again and press the boot-select button - Linux system will then boot from the SD-Card
- Press and hold the boot select switch while powering ON the board
- Login as root (no password)
UBIFS
UBIFS is used for Linux root file-system on the VAR-SOM-AM33 NAND Flash.
Compilling UBIFS Tools
The MTD and UBI user-space tools are available from the the following git repository:
$ git clone git://git.infradead.org/mtd-utils.git $ cd mtd-utils/ $ git checkout v1.5.0 $ make
IMPORTANT
Tested with mtd-utils version is 1.5.0.
For instructions on compiling MTD-utils, refer MTD-Utils Compilation.
Creating UBIFS
This section describes steps for creating a UBI rootfs image to be flashed to the VAR-SOM-AM33 NAND Flash.
- mkfs.ubifs
$ cd ~/ti-sdk-am335x-evm-07.00.00.00 $ sudo mkfs.ubifs/mkfs.ubifs -r targetNFS/ -F -o system_ubifs.img -m 2048 -e 126976 -c 1960
Where:
-m 2KiB (or 2048)
The minimum I/O size of the underlying UBI and MTD devices. In our case, we are running the flash with no sub-page writes, so this is a 2KiB page.
-e 124KiB (or 126976)
Erase Block Size: UBI requires 2 minimum I/O units out of each Physical Erase Block (PEB) for overhead: 1 for maintaining erase count information, and 1 for maintaining the Volume ID information. The PEB size for our flash is 128KiB, so this leads to each Logical Erase Block (LEB) having 124KiB available for data.
-c 1960
The maximum size, in LEBs, of our file system.
-r rootFS
Use the contents of the 'rootFS/' directory to generate the initial file system image.
-F
File-system free space has to be fixed up on first mount (http://www.linux-mtd.infradead.org/faq/ubifs.html#L_free_space_fixup)
-o system_ubifs.img
Output file.
NOTE: On AM335x, -F option is required when creating ubifs image. If this option is not used, Kernel may crash while loading the Filesystem from UBI partition.
The output of the above command, 'system_ubifs.img' is fed into the '<b>ubinize'</b> program to wrap it into a UBI image. The images produced by mkfs.ubifs are later used by the ubinize tool to create a UBI image is flashed to the raw flash to be used a UBI partition.
- Create ubinize.cfg file and write the bellow contents into it:
[rootfs] mode=ubi image=system_ubifs.img vol_id=0 vol_size=220MiB vol_type=dynamic vol_name=rootfs vol_flags=autoresize
- ubinize
$ ubi-utils/ubinize -o rootfs-var-som-am33.ubi.img -m 2048 -p 128KiB -s 2048 -O 2048 ubinize.cfg
Where:
-o rootfs-var-som-am33.ubi.img
Output file.
-m 2KiB (or 2048)
Minimum flash I/O size of 2KiB page.
-p 128KiB
Size of the physical eraseblock of the flash this UBI image is created for
-O 2048
offset if the VID header from start of the physical eraseblock
The output of the above command, 'rootfs-var-som-am33.ubi.img' is the required image.
Flasing UBIFS to NAND-Flash
We can Flash UBIFS image from either Linux Kernel or U-Boot.
From Linux
$ flash_erase /dev/mtd7 0 0 $ ubiformat /dev/mtd7 -f base-rootfs-var-som-am33.ubi.img -s 2048 -O 2048
NAND Recovery
As an easy and fast way to recover the VAR-SOM-AM33 NAND 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 (nand-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)
- gunzip am33-som-nand_recovery-sd-Yocto_1_6_V31.img.gz
- dd if=aam33-som-nand_recovery-sd-Yocto_1_6_V31.img of=/dev/sdX bs=128k
Recover Nand Flash
- 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)
- From Linux command line, type: "nand-recovery.sh". (This will install Linux on the NAND)
- Unplug the SD card and reboot
NAND recovery script usage:
usage: /sbin/nand-recovery.sh options This script install Linux/Android binaries in VAR-SOM-AM33 NAND. OPTIONS: -h Show this message -o <Linux|Android> OS type (defualt: Linux).