openwrt Installing the Cross-compilation Toolchain (a) The OpenWrt cross-tool chain, like a generic Linux package, needs to be extracted to the directory where it needs to be installed, and then the environment variable can be set. Here are the installation steps. 1) Unzip the cross tool chain package first go to the Download Center and download the OPENWRT-TOOLCHAIN-AR71XX-FOR-MIPS_34KC-GCC-4.8-LINARO_UCLIBC-0.9.33.2.TAR.BZ2 Toolkit to your path. Here we demonstrate installing the cross tool chain into Ubuntu's "/opt" directory. First switch to the root directory of OpenWrt and enter the following command: sudo tar jxvf ... Openwrt-toolchain-ar71xx-for-mips_34kc-gcc-4.8-linaro_uclibc-0.9.33.2.tar.bz2-c/opt/ (...) On behalf of your path) when prompted for the Superuser password, the system extracts the cross-toolchain package into the/opt/directory of the Ubuntu system. Here to tell you a very practical trick, if you use the hand to knock the above command, very time-consuming and laborious, but also easy to make mistakes, you can hit the "sudo tar jxvf./b" After pressing the "tab" key, the system will automatically complete the "sudo tar jxvf./bin", The following folders and files are also the same, very time-saving. 2) Set Environment variables sudo vi/etc/bash.bashrc add exportpath=/opt/openwrt-toolchain-ar71xx-for-mips_34kc-gcc-4.8-linaro_ on the last line uClibc-0.9.33.2/toolchain-mips_34kc_gcc-4.8-linaro_uclibc-0.9.33.2/bin/path Exportstaging_dir=/your_openwrt_ Path/staging_dir notice above this "staging_dir" variable "Your_openwrt_path" is the reader actually put OpenWrt source root directory, if this "staging_dir" variable is not set, Will have a warning when compiling a file with a cross tool chain, but does not affect compilation results. Finally save the exit. Then execute the following command at the terminal: SOURCE/ETC/BASH.BASHRC recommends restarting Ubuntu or you may not be able to find it. 3) to check if the installation is successful mips-openwrt-linux-gcc-v should print out some information about the cross-compilation tool, which indicates the error of installing the diagram prompt on the successful installation. Installation process I encountered problems resolved: Missing ncurses installation package solution: Apt-cachesearch ncurses apt-getinstall libncurses5-dev Checking ' svn ' ... failed. Solution: Apt-getinstall Subversion Checking ' working-g++ ' ... failed. Resolution: Apt-getinstall g++ Error: Mips-openwrt-linux-uclibc-gcc.bin:error while loading sharedlibraries:libstdc++.so.6: Cannot open shared object file:no such file ordirectory reason: 64-bit system, missing lib32stdc++6 this package resolves: ~ $sudo apt-get Install lib32s Tdc++6 not found: MIPS-OPENWRT-LINUX-UCLIBC-GCC path resolved: Sudoapt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 may also need to be installed (as needed): A, Batch command installation sudo apt-get install gcc g++ binutils patchbzip2 Flex bison make Auto Conf gettext texinfo unzip sharutils subversionlibncurses5-dev ncurses-term zlib1g-dev or single command input sudo apt-get install g++ s Udo Apt-get Install Libncurses5-dev sudo apt-get install zlib1g-dev sudo apt-get install bison sudo apt-get install flex s Udo Apt-get install unzip sudo apt-get Install autoconf sudo apt-get install gawk sudo apt-get install make sudo apt-get install gettext sudo apt-get install GC C sudo apt-get install binutils sudo apt-get install patch sudo apt-get install bzip2 sudo apt-get install Libz-dev sudo a Pt-get Install asciidoc sudo apt-get install subversion sudo apt-get install git sudo apt-get install sphinxsearch sudo ap T-get Install libtool sudo apt-get install Sphinx-common test the build environment: under Ubuntu, switch to any directory and enter the following command: VI hello_world.c Create a new named HELLO_WORLD.C file with VI and enter the following. #include <stdio.h> intmain (char argc, char *argv[]) {int i =1; while (1) {//1~10 loop printf ("Helloworld!!! %d\n ", i);//print content if (i<) {i++;} else{i = 1;} sleep (1);//Print once a second} Return0; Then Mips-openwrt-linux-gcchello_world.c-o hello_world//compile "hello_world.c" file with MIPS-OPENWRT-LINUX-GCC and generate "Hello_ World "can execute files. Finally, we use WINSCP to transfer the files to the "/tmp" directory of the WH9331 Development Board, and execute the following commands under the serial terminal of the Development Board. /tmp/hello_world//Execute "hello_world" executable file the user can use "CTRL + C" key combination to stop the program running.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.