2012年6月23日 星期六

[ToolChain] How to use buildroot to make toolchain

2.3.1 Using buildroot to build  toolchain up


  1. Essential tools Before build up buildroot
    Install some package like below:
    sudo apt-get install bison flex gettext patch build-essential texinfo
    sudo apt-get install subversion
    sudo apt-get install libncurses5-dev

  2. Download the source code of buildroot.
    we can use subversion [Using buildroot make toolchain] to download the source code of buildroot.
    In Terminal type
       svn co -r 21163 svn://uclibc.org/trunk/buildroot

  3. Change configure

    We want build up cross-compilation toolchain ,close the other function of  buildroot.

    In the directory of buildroot.

    Type

       make menuconfig

Into the menu selection of  buildroot like below:

images/lab01_buildroot.png

 target change to  ARM ,don't do filesystem 。

  1. Change target as ARM architechure
「Target Architechure」-->「arm」,press Enter.
  1. Cancel build up filesystem
In Main menu,entry「Target filesystem options」-->「ext2 root filesystem」 choose 「n」to cancel build up 「ext2 root filesystem 」,go to main menu。 「Package Selection for the target」--> press  n to cancel option of 「Busybox」.
  1. Cancel compile  kernel
「Kernel」-->「Kernel type」-->「none」to cancel build up linux kernel 。
  1. Extend the function of  toolchain
NFS (Network filesystem),add some funcion of  toolchain.

「Toolchain」-->「Enable RPC」,press y.
go back to main menu,then save.
  1. make toolchain
    After setting.

    Type 「make」 ,buildroot will to compile toolchain Keep internet is connection, because if need some package will download from internet.

    Take a rest, and wait for a while


2.3.2 setting toolchain

After compiling  buildroot , we can find  some toolchain bin file under build_arm/staging_dir/usr/bin.

At the front of toolchain like  arm-linux-uclibc-, at the end will like gcc '   as '  ld ......

Set $PATH ,let  bash shell can search to toolchain 。

Assume  the root directory of buildroot is <buildroot> ,then type
 export PATH=<buildroot>/build_arm/staging_dir/usr/bin:$PATH

or wirte the above command into  .bashrc then use

 source ~/.bashrc


to load the new setting of  bash shell.
We can test under terminal.
Press tab will appear the command  like below.
'arm-linux- xxxxx '


images/lab01_setPath.png


Reference:

Related Posts:

0 意見:

張貼留言