Build OpenWrt cross compiler environment

From WRTnode Wiki
Jump to: navigation, search
This page is a translated version of the page 搭建OpenWrt交叉编译环境 and the translation is 100% complete.

Other languages:

Build OpenWrt cross compiler environment

Cross-compiler

Cross compilation is the executable code on a platform to generate another platform.
The application development environment based on the Linux operating system is generally composed of the target system hardware(WRTnode development board) and the host PC machine.
Target development board to run the operating system and application software, but the operating system kernel compiler and application development, debugging is completed by the host PC.(so called cross compilation).
Host and target development board generally through the serial port, WiFi or Ethernet interface to establish a connection relationship.
WRTnode support GCC, but limited by the compilation speed and space, so it is not suitable for the development of software. WRTnode software development process: edit and compile software on the PC, and then upload to the WRTnode development board to run and verify.

Configure OpenWrt compiler environment

PC need to have Linux system. (liunx virtual machine or dual system, etc.)
Configure Linux compiler environment on the PC ; different Linux systems have different installation commands. The following is a common Linux system to install the necessary tools to compile the OpenWrt system.

  • Debian 5 Lenny:
apt-get install gawk ncurses-dev unzip zlib1g-dev
  • Debian 6 Squeeze:
apt-get install libncurses5-dev zlib1g-dev gawk flex libssl-dev sdcc-nf
  • Debian 7 Wheezy:
apt-get install libncurses5-dev zlib1g-dev gawk
  • Ubuntu 13.10:
sudo apt-get install build-essential subversion git-core libncurses5-dev zlib1g-dev gawk flex quilt xsltproc
  • Ubuntu 12.04LTS:
sudo apt-get install build-essential subversion git-core libncurses5-dev zlib1g-dev gawk  flex quilt libssl-dev xsltproc \
libxml-parser-perl mercurial bzr ecj cvs unzip
  • Ubuntu 64bit:
sudo apt-get install build-essential subversion libncurses5-dev zlib1g-dev gawk gcc-multilib flex git-core gettext
  • Fedora 17:
yum install -y subversion binutils bzip2 gcc gcc-c++ gawk gettext flex libz-dev flex ncurses-devel zlib-devel make patch unzip \
perl-ExtUtils-MakeMaker
  • Fedora 18 – 64Bit (Maybe also for lower versions, some packages seem to be missing above):
yum install -y subversion binutils bzip2 gcc gcc-c++ gawk gettext flex ncurses-devel zlib-devel make patch unzip perl-ExtUtils-MakeMaker \
glibc glibc-devel glibc-static quilt ncurses-lib sed sdcc intltool sharutils bison
  1. Maybe you need glibc.i686 glibc-static.i686 glibc-devel.i686 libgcc.i686 too
  • Fedora 19 – 64Bit (Maybe also for lower versions, some packages seem to be missing above):
yum install -y subversion binutils bzip2 gcc gcc-c++ gawk gettext flex ncurses-devel zlib-devel make patch unzip perl-ExtUtils-MakeMaker \ 
glibc glibc-devel glibc-static quilt ncurses-lib sed sdcc intltool sharutils bison wget
  • openSuSE 11.1
zypper install binutils bzip2 gawk gcc gcc-c++ gettext make ncurses-devel patch unzip wget zlib-devel flex git-core

Three parts of WRTnode development

  • Compile & flash U-Boot

WRTnode board factory U-Boot has been programmed into the SPI Flash, U-Boot has a network transmission, serial transmission, Flash programming and other functions, so the programmer does not need to use programmer. Flashing U-Boot to be careful to prevent a brick~

  • Compile & flash the openwrt system

编译WRTnode静态SDK

  • Compile & flash & run the application program

Please refer to :如何使用OpenWrt的toolchain编译一个可以在WRTnode上运行的程序