Install and Compile Linux

Create Working Directory and Decompress Source File

  • Create a working directory (“WORK DIR” is used as user working directory):
    $ mkdir <WORKDIR> -p
  • Decompress the source code from directory “05-Linux_Source” in the CD-ROM to the working directory:
    $ cd <WORKDIR>
    $ tar xvjf /media/cdrom/05-Linux_Source/U-Boot/u-boot.tar.bz2
    $ tar xvjf /media/cdrom/05-Linux_Source/Linux_Kernel/linux-3.2.0.tar.bz2
    $ tar xvjf /media/cdrom/05-Linux_Source/Rootfs/myd-am335x_rootfs.tar.bz2
    $ tar xvjf /media/cdrom/05-Linux_Source/Rootfs/myd-am335x_rootfs.tar.bz2

1.4.2 Install Cross Compiler Tools

  • Install necessary tools:
    $ sudo apt-get install build-essential git-core libncurses5-dev
    $ sudo apt-get install flex bison texinfo zip unzip zlib1g-dev gettext
    $ sudo apt-get install gperf libsdl-dev libesd0-dev libwxgtk2.6-dev
    $ sudo apt-get install uboot-mkimage
    $ sudo apt-get install g++ xz-utils
  • Decompress cross compiler tool to the specified directory (Here decompress it to “WORK DIR” as an example):
    $ cd <WORKDIR>
    $ cd /media/cdrom/03-Tools/Cross_compiler
    $ tar xvjf gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux.tar.bz2
  • Add environment variables:
    $ export PATH=$PATH: <WORKDIR>/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin
    $ export CROSS_COMPILE=arm-linux-gnueabihf-

Install Uboot Source and Compile

  • Build configure:

Note:Here we use the u-boot for 4.3” LCD for example. If you want to use the u-boot for 7” LCD or HDMI, please use the corresponding configuration file:

Disaplay Mode Config
LCD 4.3 inch (480 x 272) myd_am335x_lcd4.3_config
LCD 7.0 inch (800 x 480, Resistive) myd_am335x_lcd7.0r_config
LCD 7.0 inch (800 x 480, Capacitive) myd_am335x_lcd7.0c_config
HDMI 720P (1280 x 720) myd_am335x_hdmi720p_config
HDMI 640x480 myd_am335x_hdmi640x480_config

Table 1-2

    $ cd  <WORKDIR>/u-boot
    $ make  distclean    
    $ make  myd_am335x_lcd4.3_config 
    $ make

After accomplishing above operations, the system will generate boot code image “MLO” and “u-boot.img” file in the current directory.

  • Boot configure

There are several configurations of MYD-AM335X, must to set the right argument according to the actual situation of the hardware. The following is a relationship between the u-boot parameters and hardware:

Memory mem
DDR 256MB 256M
DDR 512MB 512M

Table 1-3

Display and touch board-am335xevm.display_mode
LCD 4.3 inch Resistive lcd4i3
LCD 7 inch Resistive lcd7ir
7inch Capacitive lcd7ic
HDMI 720P hdmi720p
HDMI 640x480 hdmi640x480

Table 1-4

For example, the following command at the U0boot command line is means 4.3-inch resistive touch screen and 256M memory is set.

    # setenv optargs board-am335xevm.display_mode=lcd7ir mem=256M
    # saveenv

Install and Compile Linux Kernel Source Code

  • Install necessary tools:
    $ sudo apt-get install ncurses-dev
    $ sudo apt-get install uboot-mkimage
  • Configure the kernel:
    $ cd <WORKDIR>/linux-3.2.0
    $ make distclean
    $ make myd_am335x_defconfig
  • Compile the kernel:
    $ make uImage

After executing the above operations, uImage will be generated under arch/arm/boot/.

Compile File System

  • Copy necessary tools from the CD:
    $ cp /media/cdrom/03-Tools/mk-ubi-256mb <WORKDIR>
    $ cp /media/cdrom/03-Tools/mk-ubi-512mb <WORKDIR>
    $ cp /media/cdrom/03-Tools/ubinize_256M.cfg <WORKDIR>
    $ cp /media/cdrom/03-Tools/ubinize_512M.cfg <WORKDIR>

If a tools can’t execut, use “chmod” add executable permission, for example:

    $ chmod +x <WORKDIR>/mk-ubi-256mb
  • Make filesystem for 256M NandFlash:
    $ cd  <WORKDIR>
    $ ./mk-ubi-256mb myd-am335x_rootfs

After executing the above operations, the “ubi.img” is the ubi image file of the 256M NandFlash can be found under the current directory.

  • Make filesystem for 512M NandFlash:
    $ cd  <WORKDIR>
    $ ./mk-ubi-512mb myd-am335x_rootfs

After executing the above operations, the “ubi.img” is the ubi image file of the 512M NandFlash can be found under the current directory.