[[bc10-router]]
#contents

* About arago-project [#qe4441ca]
>
arago-project is a set of layers for OpenEmbedded. This set of layers allows to integrate, to build, and to test framework and infrastructure. This project is maintained by TI. This is used for creating Linux SDK, which runs TI's evaluation boards. This article introduces how to create the build environment, which let it run on bc10, and shows the build process step by step.~

* How to Create the Build Environment [#sd87d0bd]
>
The host that uses for the build environment is Ubuntu 10.04 (64bit). The added packages and modified configuration, and how to create the build environment are explained later.

** Adding extra package [#y41f307f]
>
These packages listed below are added for creating the build environment.
 ssh vim git-core build-essential curl ia32-libs diffstat cvs subversion chrpath texi2html texinfo 
 libncurses5-dev bison flex gettext

** Changing from dash to bash [#v00a69e6]
>
shell that Ubuntu 10.04 uses is dash, and cases an error as bitbake is executed. To avoid the error happening, shell of Ubuntu 10.04 is changed from dash to bash. Changing the shell, please apply the command below.~
 $ sudo dpkg-reconfigure dash
Executing the command, it asks to install dash. Then, please select NO. This means that bash is specified for shell of this Ubuntu.~

** Creating the build environment [#zc78d024]
>
This part explains how to create the arago-project build environment for bc10-router.~
~
Up to setting up of Toolchain, the configuration process is identical to the process listed at the web page. (The URL is shown below.) The process is roughly three steps. The first step is to obtain the files, which require for creating the arago-projectenvironment. Then, the second and third steps are to edit the files and to set up the environment variables, respectively.~
~
[[http://arago-project.org/wiki/index.php/Setting_Up_Build_Environment]]~
~
 $ mkdir $HOME/oe
 $ cd $HOME/oe
 $ git clone git://arago-project.org/git/arago.git
 $ git clone git://arago-project.org/git/arago-oe-dev.git
 $ git clone git://arago-project.org/git/arago-bitbake.git
~
Copy the configuration file and samples.~
 $ cp arago/setenv.sample arago/setenv
 $ cp arago/conf/local.conf.sample arago/conf/local.conf
~
Modify the copied local.conf. In the file, the specification of MACHINE section is changed to beagleboard.~
 $ vi arago/conf/local.conf
 
 @@ -22,9 +22,9 @@ TMPDIR = "${SCRATCH}/arago-tmp"
 # Select the machine platform to build for
 # The default value is "arago", which is a unified armv5te MACHINE
 # to build filesystem images for OMAP3 and DaVinci
 -MACHINE ?= "arago"
 +# MACHINE ?= "arago"
 # MACHINE = "omap3evm"
 -# MACHINE = "beagleboard"
 +MACHINE = "beagleboard"
 # MACHINE = "davinci-dvevm"
~
Change the specification of TOOLCHAIN_BRAND is changed to arago.~
 @@ -32,7 +32,8 @@ MACHINE ?= "arago"
 DISTRO = "arago"
 
 # What toolchain to use (csl, arago, angstrom etc.)
 -TOOLCHAIN_BRAND ?= "csl"
 +#TOOLCHAIN_BRAND ?= "csl"
 +TOOLCHAIN_BRAND ?= "arago"
~
The parallel make and number of threads are set to 2. (This number is highly depending on your working environment. The number is specified based upon your working environment.)~
 @@ -85,6 +86,8 @@ IMAGE_FSTYPES = "jffs2 tar.gz ext2.gz"
 # in the process of marking these so let us know if you find any.
 #PARALLEL_MAKE = "-j 4"
 #BB_NUMBER_THREADS = "4"
 +PARALLEL_MAKE = "-j 2"
 +BB_NUMBER_THREADS = "2"
~
Configure the environment setting of arago-project .~
 $ source arago/setenv
~
** Installing Toolchain [#k1e67472]
>
Toolchain used here is the one listed at TI's web page. Do NOT use the Toolchain of arago-project. If you follow the direction to build the arago-project environment, which is listed at the web pages, you will encounter a build error of sysvinit. This is due to select and to use CodeSourcery for Toolchain of arago-project.~
[[http://arago-project.org/wiki/index.php/Setting_Up_Build_Environment]]~
~
There is a patch for avoiding this error. However, at the ML of arago-project, the arago-project reported to have never used CodeSourcery, and the arago-project expressed concerns for other build errors. Therefore, to prevent errors to occur, use TI's Toolchain, instead of Toolchain of arago-project. ~
This article uses TI's Toolchain which is developed for BeagleBoard project. The name of Toolchain,is ti-sdk-beagleboard-0.5.05.01.00, and this is available at TI's web site.~
[[http://software-dl.ti.com/dsps/dsps_public_sw/am_bu/sdk/BeagleBoardSDK/latest/index_FDS.html]]~
~
To download the Toolchain from the URL above to any directory, the install the Toolchain. If you do not change the targeted directory, BeagleBoard SDK will be installed at ${HOME}/ti-sdk-beagleboard-0.5.0.5.01.00, and it will be extracted under the directory of ${HOME}/ti-sdk-beagleboard-0.5.0.5.01.00/linux-devkit/.~
 $ wget http://software-dl.ti.com/dsps/dsps_public_sw/am_bu/sdk/BeagleBoardSDK/latest/exports/ti-sdk-beagleboard-05.05.01.00-Linux-x86-Install
 $ chmod +x ti-sdk-beagleboard-05.05.01.00-Linux-x86-Install
 ~
To install it for the console, add the option of --made console, and execute it.~
 $ ./ti-sdk-beagleboard-05.05.01.00-Linux-x86-Install --mode console
~
PATH of the newly installed Toolchain is added to bashrc file.~
 $ vi ${HOME}/.bashrc
 
 PATH=${HOME}/ti-sdk-beagleboard-05.05.01.00/linux-devkit/bin:$PATH
 $ source ${HOME}/.bashrc

** Setting up the additional packages for bc10-router [#y5314269]
>
The additional packages listed below. These packages are required for the features of bc10-router but not installed by the default setting of arago-console-image.~
 bridge-utils
 dnsmasq
 dropbear
 ebtables 
 grep 
 hostap-daemon
 hostap-utils
 ifplugd
 iperf
 iproute2
 iptables
 iw
 ntpclient 
 nuttcp 
 procps 
 openssl
 rp-pppoe
 u-boot-spl(MLO)
 wireless-tools
~
Also, to use bitbake command, you can list out all packages, which will be installed. The listt of installed packages is quit long, so the output is redirected to list file.~
 $ bitbake -s > lists
~
** bb files for bc10-router [#ne2fff30]
>
To avoid building unnecessary packages, and to make sure that all needed packages including the additional packages shown above are build, the list of packages files are checked and edited. The names of files are task-arago-base.bb and task-arago-console.bb. These files are located at ~/oe/arago/recopes/tasks/.
 $ cd arago/recipes/tasks
~
- task-arago-base.bb
 --- __task-arago-base.bb_orig   2012-12-13 10:58:06.961625083 +0900
 +++ task-arago-base.bb  2012-12-13 10:58:46.651002889 +0900
 @@ -8,13 +8,13 @@ inherit task
 MACHINE_ESSENTIAL_EXTRA_RDEPENDS ?= ""
 MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS ?= ""
 
 -ARAGO_ALSA_BASE = "\
 -    alsa-lib \
 -    alsa-utils-aplay \
 -       "
 +#ARAGO_ALSA_BASE = "\
 +#    alsa-lib \
 +#    alsa-utils-aplay \
 -#     "
 
 ARAGO_BASE = "\
 -    ${ARAGO_ALSA_BASE} \
 +#    ${ARAGO_ALSA_BASE} \
     mtd-utils \
     curl \
     arago-feed-configs \
~
- task-arago-console.bb
 --- __task-arago-console.bb_orig  2013-01-16 12:03:46.169805920 +0900
 +++ task-arago-console.bb       2013-01-15 20:08:00.067476800 +0900
 @@ -5,21 +5,21 @@ PR = "r16"
 inherit task
 
 # alsa-utils-alsamixer depends on ncurses
 -ARAGO_ALSA_EXTRA = "\
 -    alsa-conf \
 -    alsa-conf-base \
 -    alsa-server \
 -    alsa-utils \
 -    alsa-utils-aconnect \
 -    alsa-utils-alsaconf \
 -    alsa-utils-alsactl \
 -    alsa-utils-alsamixer \
 -    alsa-utils-amixer \
 -    alsa-utils-iecset \
 -    alsa-utils-midi \
 -    alsa-utils-speakertest \
 -    alsa-state \
 -    "
 +#ARAGO_ALSA_EXTRA = "\
 +#    alsa-conf \
 +#    alsa-conf-base \
 +#    alsa-server \
 +#    alsa-utils \
 +#    alsa-utils-aconnect \
 +#    alsa-utils-alsaconf \
 +#    alsa-utils-alsactl \
 +#    alsa-utils-alsamixer \
 +#    alsa-utils-amixer \
 +#    alsa-utils-iecset \
 +#    alsa-utils-midi \
 +#    alsa-utils-speakertest \
 +#    alsa-state \
 +#    "
 
 ARAGO_TSLIB = "\
     tslib-conf \
 @@ -47,6 +47,25 @@ ARAGO_UTILS = "\
     i2c-tools \
     iproute2 \
     tcpdump \
 +    bridge-utils \
 +    dnsmasq \
 +    dropbear \
 +    ebtables \
 +    grep \
 +    hostap-daemon \
 +    hostap-utils \
 +    ifplugd \
 +    iperf \
 +    iproute2 \
 +    iptables \
 +    iw \
 +    ntpclient \
 +    nuttcp \
 +    procps \
 +    openssl \
 +    rp-pppoe \
 +    u-boot-spl \
 +    wireless-tools \
     "
 
 ARAGO_DVSDK_PREREQ = "\
 @@ -61,7 +80,7 @@ ARAGO_DVSDK_PREREQ = "\ 
 
 # cppstub is needed to install libstdc++ in the image
 ARAGO_CONSOLE = "\
 -    ${ARAGO_ALSA_EXTRA} \
 +#    ${ARAGO_ALSA_EXTRA} \
     ${ARAGO_TSLIB} \
     ${ARAGO_NCURSES} \
     ${ARAGO_FSTOOLS} 

** Creating the image of bc10-router [#i24341ee]
>
This section build arago-console-image. This build process includes the build process of arago-base-image. To use a computer which has a Core i7 2.93GHz with 8GB memory, the whole process, including download of all needed packages, will be 3 ~ 4 hours approximately, and it will be 2 hours if it takes its building process.~
 $ time bitbake arago-console-image
~

** The directory, which stores built images [#u49b24f3]
>
The directories, which store the built images is created below of ~/oe/arago-tmp/deploy/glibc/images/beagleboard/. The built files, which are stored at these directories, are shown below.~
 $ cd ~/oe/arago-tmp/deploy/glibc/images/beagleboard 
 $ ls -l
 lrwxrwxrwx 1 beat beat       29 2012-12-13 13:58 MLO-beagleboard -> MLO-beagleboard-2012.04.01-r0
 -rwxr-xr-x 1 beat beat    43468 2012-12-13 13:58 MLO-beagleboard-2012.04.01-r0
 lrwxrwxrwx 1 beat beat       64 2012-12-13 14:30 arago-console-image-beagleboard.ext2.gz -> arago-console-image-glibc-ipk-2011.09-beagleboard.rootfs.ext2.gz
 lrwxrwxrwx 1 beat beat       62 2012-12-13 14:29 arago-console-image-beagleboard.jffs2 -> arago-console-image-glibc-ipk-2011.09-beagleboard.rootfs.jffs2
 lrwxrwxrwx 1 beat beat       64 2012-12-13 14:30 arago-console-image-beagleboard.tar.bz2 -> arago-console-image-glibc-ipk-2011.09-beagleboard.rootfs.tar.bz2
 lrwxrwxrwx 1 beat beat       63 2012-12-13 14:29 arago-console-image-beagleboard.tar.gz -> arago-console-image-glibc-ipk-2011.09-beagleboard.rootfs.tar.gz
 lrwxrwxrwx 1 beat beat       60 2012-12-13 14:30 arago-console-image-beagleboard.ubi -> arago-console-image-glibc-ipk-2011.09-beagleboard.rootfs.ubi
 drwxr-xr-x 2 beat beat     4096 2012-12-13 14:31 arago-console-image-glibc-ipk-2011.09-beagleboard-testlab
 -rw-r--r-- 1 beat beat 20488760 2012-12-13 14:29 arago-console-image-glibc-ipk-2011.09-beagleboard.rootfs.ext2.gz
 -rw-r--r-- 1 beat beat 26935296 2012-12-13 14:29 arago-console-image-glibc-ipk-2011.09-beagleboard.rootfs.jffs2
 -rw-r--r-- 1 beat beat 17672000 2012-12-13 14:30 arago-console-image-glibc-ipk-2011.09-beagleboard.rootfs.tar.bz2
 -rw-r--r-- 1 beat beat 19988817 2012-12-13 14:29 arago-console-image-glibc-ipk-2011.09-beagleboard.rootfs.tar.gz
 -rw-r--r-- 1 beat beat 34603008 2012-12-13 14:30 arago-console-image-glibc-ipk-2011.09-beagleboard.rootfs.ubi
 -rw-r--r-- 1 beat beat 33804288 2012-12-13 14:30 arago-console-image-glibc-ipk-2011.09-beagleboard.ubifs.img
 -rw-r--r-- 1 beat beat  9637520 2012-12-13 14:24 modules-3.3.7-r115-beagleboard.tgz
 drwxr-xr-x 2 beat beat     4096 2012-12-13 14:30 tmp.gz
 -rwxr-xr-x 1 beat beat   336080 2012-12-13 14:00 u-boot-beagleboard-2012.04.01-r3.0.img
 lrwxrwxrwx 1 beat beat       38 2012-12-13 14:00 u-boot-beagleboard.img -> u-boot-beagleboard-2012.04.01-r3.0.img
 -rw-r--r-- 1 beat beat  3425936 2012-12-13 14:24 uImage-3.3.7-r115-beagleboard.bin
 lrwxrwxrwx 1 beat beat       33 2012-12-13 14:24 uImage-beagleboard.bin -> uImage-3.3.7-r115-beagleboard.bin
 -rw-r--r-- 1 beat beat      218 2012-12-13 14:30 ubinize.cfg
 uImage-beagleboard.bin
 ubinize.cfg
The files, which will be used for creating the images are shown below.~
 MLO-beagleboard-2012.04.01-r0
 arago-console-image-glibc-ipk-2011.09-beagleboard.rootfs.tar.gz
 u-boot-beagleboard-2012.04.01-r3.0.img
 uImage-3.3.7-r115-beagleboard.bin

*** About MLO [#r7ea734b]
>
Adding u-bot-spl, MLO has already been created. But, you may use TI's MLO, which is includeded in ti-sdk-beagleboard-05.05.01.00.

** Writing down images to a SD card [#h0fa9d94]
>
The SD cards used here are created in the same way as the SD cards of bc10 are created. The details  of how to create SD card are listed at [[http://labs.beatcraft.com/en/index.php?bc10%2Fbooting#mef5758b]]. The directories of FAT32 and Ext3 are named as /media/FAT and /media/EXT3, respectively.~
~
The files, which have been created at the previous section are copied the directories and extracted at there.
<Code and Command>
The files, which have been created at the previous section are copied the directories and extracted at there.~
 $ cp MLO-beagleboard-2012.04.01-r0 /media/FAT/MLO
 $ cp u-boot-beagleboard-2012.04.01-r3.0.img /media/FAT/u-boot.img
 $ cp uImage-3.3.7-r115-beagleboard.bin /media/FAT/uImage
 $ sudo tar xvfz arago-console-image-glibc-ipk-2011.09-beagleboard.rootfs.tar.gz -C /media/EXT3
Create uEnv.txt, the environment-configuration file for uboot, is created and stored below /media/FAT. The contents of uEnv.txt are shown below.
<Code and Command>
 mmcroot=/dev/mmcblk0p2 rw
 uenvcmd=run loaduimagefat; run mmcboot

*** Driver for Wireless LAN USB adapter [#g14922f6]
To use Wireless LAN USB adapter, WLI-UC-AG300N, firmware, ra2800usb, is required. Please download it from ralink's web site below.~
[[http://www.ralinktech.com/en/04_support/license.php?sn=5030]]~
-Caution~
Since Ralink has been merged with MediaTek, the firmware cannot be obtainable from the URL above. You cannot find the whole firmware, but you may find the driver, which is used for the Wireless LAN USB adapter. The name of driver is rt2870.bin, which is a part of RT2870_Firmware_v22.zip file. To search RT2870_Firmware_v22.zip in the internet, you may find the file and driver. Please be careful. Since MediaTek does not maintain the firmware anymore,  some files you found in the internet could be malware instead of the driver you need. Please be careful.~ 

Download the firmware file, RT2870_Firmware_V22.zip and extract it to any directory. In the directory, you may find License.ralink-firmware.txt and rt2870.bin. These files are placed at the directory of /media/EXT3/lib/firmware.
<Code and Command>
~
This is the end of the writing down the images to the SD Card. At the first time to boot, it will take time, and it may fail to recognize the USB devices. After boot is completed, it may start recognizing the devices again. If you encounter these issues, please try to reboot agaon.
Download the firmware file, RT2870_Firmware_V22.zip and extract it to any directory. In the directory, you may find License.ralink-firmware.txt and rt2870.bin. These files are placed at the directory of /media/EXT3/lib/firmware.~
 $ unzip RT2870_Firmware_V22.zip
 $ cd RT2870_Firmware_V22
 $ ls 
 LICENSE.ralink-firmware.txt  rt2870.bin
 $ sudo cp * /media/EXT3/lib/firmware/
~
This is the end of the writing down the images to the SD Card. At the first time to boot, it will take time, and it may fail to recognize the USB devices. After boot is completed, it may start recognizing the devices again. If you encounter these issues, please try to reboot agaon.~

* Adding and Installing Extra Packages After Building the Original Packages [#x08e514f]
>
This section introduces how to build and to install the extra packages, which are included in bitbake, after the writing down bitbake arago-console-image to the SD Card is completed.~
To use vim, this example explains how to build and to install the packages step by step. After executing bitbake vim, the file vim_7.2-r8.3.6_armv7a.ipk is created below the directory of arago-tmp/deploy/glibc/ipk/armv7a.
<Code and Command>
Copy vim_7.2-r8.3.6_armv7a.ipk to bc10 via the SD card or network. To execute ipk file, vim is installed at the same directory as the ipk file is the placed.
<Code and Command>
To use vim, this example explains how to build and to install the packages step by step. After executing bitbake vim, the file vim_7.2-r8.3.6_armv7a.ipk is created below the directory of arago-tmp/deploy/glibc/ipk/armv7a.~
 $ cd ~/oe
 $ bitbake vim
 NOTE: Handling BitBake files: / (7722/7722) [100 %]
 Parsing of 7722 .bb files complete (7256 cached, 466 parsed). 7962 targets, 408 skipped, 585 masked, 0 errors.
 
 Build Configuration:
 BB_VERSION        = "1.10.2"
 METADATA_BRANCH   = "master"
 METADATA_REVISION = "9e4a18d"
 TARGET_ARCH       = "arm"
 TARGET_OS         = "linux-gnueabi"
 MACHINE           = "beagleboard"
 DISTRO            = "angstrom"
 DISTRO_VERSION    = "2011.09"
 TARGET_FPU        = "hard"
 ...<Skip>
 Packaged contents of vim-dev into /home/syariten/oe/arago-tmp/deploy/glibc/ipk/armv7a/vim-dev_7.2-r8.3.6_armv7a.ipk
 NOTE: Not creating empty archive for vim-static-7.2-r8.3.6
 NOTE: Not creating empty archive for vim-locale-7.2-r8.3.6
 NOTE: package vim-7.2-r8.3: task do_package_write_ipk: Succeeded
 NOTE: Running task 525 of 528 (ID: 5, /home/syariten/oe/arago-oe-dev/recipes/vim/vim_7.2.bb, do_package_write)
 NOTE: package vim-7.2-r8.3: task do_package_write: Started
 NOTE: package vim-7.2-r8.3: task do_package_write: Succeeded
 NOTE: Running task 526 of 528 (ID: 6, /home/syariten/oe/arago-oe-dev/recipes/vim/vim_7.2.bb, do_package_stage)
 NOTE: package vim-7.2-r8.3: task do_package_stage: Started
 NOTE: package vim-7.2-r8.3: task do_package_stage: Succeeded
 NOTE: Running task 527 of 528 (ID: 7, /home/syariten/oe/arago-oe-dev/recipes/vim/vim_7.2.bb, do_package_stage_all)
 NOTE: package vim-7.2-r8.3: task do_package_stage_all: Started
 NOTE: package vim-7.2-r8.3: task do_package_stage_all: Succeeded
 NOTE: Running task 528 of 528 (ID: 9, /home/syariten/oe/arago-oe-dev/recipes/vim/vim_7.2.bb, do_build)
 NOTE: package vim-7.2-r8.3: task do_build: Started
 NOTE: package vim-7.2-r8.3: task do_build: Succeeded
 NOTE: Tasks Summary: Attempted 528 tasks of which 510 didn't need to be rerun and 0 failed.
 $ cd arago-tmp/deploy/glibc/ipk/armv7a
~
Copy vim_7.2-r8.3.6_armv7a.ipk to bc10 via the SD card or network. To execute ipk file, vim is installed at the same directory as the ipk file is the placed.~
 # opkg install vim_7.2-r8.3.6_armv7a.ipk
 Installing vim (7.2-r8.3.6) to root...
 vim: unsatisfied recommendation for diffutils
 Configuring vim.
 update-alternatives: Linking //bin/vi to /usr/bin/vim

* Revision History [#p81bda79]
>
- 2013/07/08 This article is initially published

Front page   Edit Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   RSS of recent changes