Ubuntu16.04無法安裝libtool,只能在Ubuntu14.04以下版本安裝。 cp 下載/crosstool-ng-1.22.0.tar.bz2 /home/hou/ tar -xvf crosstool-ng-1.22.0.tar.bz2 cd crosstool-ng 安裝一些必要的... ...
Ubuntu16.04無法安裝libtool,只能在Ubuntu14.04以下版本安裝。
cp 下載/crosstool-ng-1.22.0.tar.bz2 /home/hou/
tar -xvf crosstool-ng-1.22.0.tar.bz2
cd crosstool-ng
安裝一些必要的軟體:
apt install gperf bison flex texinfo help2man gawk libtool libncurses5-dev
Make
./configure --prefix=/home/hou/arm/crosstool-ng-1.22.0_install
屏幕剪輯的捕獲時間: 2016/5/22 11:18
sudo make install
屏幕剪輯的捕獲時間: 2016/5/22 11:20
在~/.bashrc 配置ct-ng命令的環境變數
目錄:
love-xin :: ~/arm/crosstool-ng-1.22.0_build % ct-ng list-steps
Available build steps, in order:
- libc_check_config
- companion_libs_for_build
- binutils_for_build
- companion_libs_for_host
- binutils_for_host
- cc_core_pass_1
- kernel_headers
- libc_start_files
- cc_core_pass_2
- libc
- cc_for_build
- cc_for_host
- libc_post_cc
- companion_libs_for_target
- binutils_for_target
- debug
- test_suite
- finish
Use "<step>" as action to execute only that step.
Use "+<step>" as action to execute up to that step.
Use "<step>+" as action to execute from that step onward.
love-xin :: ~/arm/crosstool-ng-1.22.0_build % ct-ng list-samples
Status Sample name
LN config
MKDIR config.gen
IN config.gen/arch.in
IN config.gen/kernel.in
IN config.gen/cc.in
IN config.gen/binutils.in
IN config.gen/libc.in
IN config.gen/debug.in
[G..] alphaev56-unknown-linux-gnu
[G..] alphaev67-unknown-linux-gnu
[G..] arm-bare_newlib_cortex_m3_nommu-eabi
[G..] arm-cortex_a15-linux-gnueabi
[G.X] arm-cortexa5-linux-uclibcgnueabihf
[G..] arm-cortex_a8-linux-gnueabi
[G.X] arm-cortexa9_neon-linux-gnueabihf
[G..] armeb-unknown-eabi
[G..] armeb-unknown-linux-gnueabi
[G..] armeb-unknown-linux-uclibcgnueabi
[G..] arm-unknown-eabi
[G..] arm-unknown-linux-gnueabi
[G.X] arm-unknown-linux-musleabi
[G..] arm-unknown-linux-uclibcgnueabi
[G.X] arm-unknown-linux-uclibcgnueabihf
[G..] armv6-rpi-linux-gnueabi
[G..] armv7-rpi2-linux-gnueabihf
[G..] avr
[G..] i586-geode-linux-uclibc
[G..] i586-mingw32msvc,i686-none-linux-gnu
[G..] i686-nptl-linux-gnu
[G.X] i686-w64-mingw32
[G..] m68k-unknown-elf
[G..] m68k-unknown-uclinux-uclibc
[G..] mips64el-n32-linux-uclibc
[G..] mips64el-n64-linux-uclibc
[G..] mips-ar2315-linux-gnu
[G..] mipsel-sde-elf
[G..] mipsel-unknown-linux-gnu
[G..] mips-malta-linux-gnu
[G..] mips-unknown-elf
[G..] mips-unknown-linux-uclibc
[G.X] i686-w64-mingw32,nios2-spico-elf
[G..] powerpc-405-linux-gnu
[G..] powerpc64-unknown-linux-gnu
[G..] powerpc-860-linux-gnu
[G..] powerpc-e300c3-linux-gnu
[G..] powerpc-e500v2-linux-gnuspe
[G..] powerpc-unknown-linux-gnu
[G..] powerpc-unknown-linux-uclibc
[G..] powerpc-unknown_nofpu-linux-gnu
[G.X] s390-ibm-linux-gnu
[G..] s390x-ibm-linux-gnu
[G..] sh4-unknown-linux-gnu
[G..] sparc-unknown-linux-gnu
[G.X] x86_64-w64-mingw32,x86_64-pc-linux-gnu
[G..] x86_64-unknown-linux-gnu
[G..] x86_64-unknown-linux-uclibc
[G.X] x86_64-w64-mingw32
[G..] xtensa-unknown-linux-uclibc
L (Local) : sample was found in current directory
G (Global) : sample was installed with crosstool-NG
X (EXPERIMENTAL): sample may use EXPERIMENTAL features
B (BROKEN) : sample is currently broken
love-xin :: ~/arm/crosstool-ng-1.22.0_build %
在後續的配置(和編譯)之後,可以通過show-tuple,去查看到當前配置的交叉編譯器是啥樣的
love-xin :: ~/arm/crosstool-ng-1.22.0_build % ct-ng show-tuple
arm-cortexa9_neon-linux-gnueabihf
查看當前有哪些(預設的)示例配置,可以用:
ct-ng list-samples
查看單個的某個示例配置的核心參數,用:
ct-ng show-<sample>
love-xin :: ~/arm/crosstool-ng-1.22.0_build % ct-ng show-arm-cortexa9_neon-linux-gnueabihf
IN config.gen/arch.in
IN config.gen/kernel.in
IN config.gen/cc.in
IN config.gen/binutils.in
IN config.gen/libc.in
[G.X] arm-cortexa9_neon-linux-gnueabihf
OS : linux-4.3
Companion libs : gmp-6.0.0a mpfr-3.1.3 mpc-1.0.3 expat-2.1.0 ncurses-6.0
binutils : binutils-2.22
C compilers : gcc | 5.2.0
Languages : C,C++
C library : glibc-2.22 (threads: nptl)
Tools : gdb-7.10
love-xin :: ~/arm/crosstool-ng-1.22.0_build %
屏幕剪輯的捕獲時間: 2016/5/22 12:34
iTop4412是使用cortex-a9,所以按照這個配置就OK,上面是軟體要求。
可以直接去調用此配置了:
ct-ng arm-cortexa9-linux-gnueabi
屏幕剪輯的捕獲時間: 2016/5/22 13:08
接下來,你就可以去進入配置:
ct-ng menuconfig
源碼包下載保存路徑
Paths and misc options
(${HOME}/arm/src) Local tarballs directory
工作路徑
一般使用預設配置
Paths and misc options
(${CT_TOP_DIR}/.build) Working directory
目標安裝路徑
Paths and misc options
(${HOME}/arm/x-tools/${CT_TARGET}) Prefix directory
一些詳細的配置請參考網站:
src下麵主要用到linux、gcc兩個安裝包,這兩個包比較大,可以提前下載好。其它的包自動下載。
配置好後,保存退出。執行ct-ng build編譯
屏幕剪輯的捕獲時間: 2016/5/22 15:06
編譯詳細過程:
╭─hou@love-xin ~/arm/crosstool-ng-1.22.0_build
╰─$ ct-ng build
[INFO ] Performing some trivial sanity checks
[INFO ] Build started 20160522.191913
[INFO ] Building environment variables
[EXTRA] Preparing working directories
[EXTRA] Installing user-supplied crosstool-NG configuration
[EXTRA] =================================================================
[EXTRA] Dumping internal crosstool-NG configuration
[EXTRA] Building a toolchain for:
[EXTRA] build = x86_64-pc-linux-gnu
[EXTRA] host = x86_64-pc-linux-gnu
[EXTRA] target = arm-cortexa9_neon-linux-gnueabihf
[EXTRA] Dumping internal crosstool-NG configuration: done in 0.10s (at 00:08)
[INFO ] =================================================================
[INFO ] Retrieving needed toolchain components' tarballs
[EXTRA] Retrieving 'glibc-libidn-2.22'
[INFO ] Retrieving needed toolchain components' tarballs: done in 362.72s (at 06:11)
[INFO ] =================================================================
[INFO ] Extracting and patching toolchain components
[INFO ] Extracting and patching toolchain components: done in 2.59s (at 06:13)
[INFO ] Saving state to restart at step 'libc_check_config'...
[INFO ] Saving state to restart at step 'companion_libs_for_build'...
[INFO ] =================================================================
[INFO ] Installing ncurses for build
[EXTRA] Configuring ncurses
[EXTRA] Building ncurses
[EXTRA] Installing ncurses
[INFO ] Installing ncurses for build: done in 39.95s (at 06:53)
[INFO ] Saving state to restart at step 'binutils_for_build'...
[INFO ] Saving state to restart at step 'companion_libs_for_host'...
[INFO ] =================================================================
[INFO ] Installing GMP for host
[EXTRA] Configuring GMP
[EXTRA] Building GMP
[EXTRA] Installing GMP
[INFO ] Installing GMP for host: done in 47.59s (at 07:42)
[INFO ] =================================================================
[INFO ] Installing MPFR for host
[EXTRA] Configuring MPFR
[EXTRA] Building MPFR
[EXTRA] Installing MPFR
[INFO ] Installing MPFR for host: done in 36.57s (at 08:19)
[INFO ] =================================================================
[INFO ] Installing ISL for host
[EXTRA] Configuring ISL
[EXTRA] Building ISL
[EXTRA] Installing ISL
[INFO ] Installing ISL for host: done in 33.91s (at 08:53)
[INFO ] =================================================================
[INFO ] Installing MPC for host
[EXTRA] Configuring MPC
[EXTRA] Building MPC
[EXTRA] Installing MPC
[INFO ] Installing MPC for host: done in 16.35s (at 09:09)
[INFO ] =================================================================
[INFO ] Installing expat for host
[EXTRA] Configuring expat
[EXTRA] Building expat
[EXTRA] Installing expat
[INFO ] Installing expat for host: done in 7.11s (at 09:16)
[INFO ] Saving state to restart at step 'binutils_for_host'...
[INFO ] =================================================================
[INFO ] Installing binutils for host
[EXTRA] Configuring binutils
[EXTRA] Building binutils
[EXTRA] Installing binutils
[EXTRA] Installing ld wrapper
[INFO ] Installing binutils for host: done in 199.40s (at 12:37)
[INFO ] Saving state to restart at step 'cc_core_pass_1'...
[INFO ] =================================================================
[INFO ] Installing pass-1 core C gcc compiler
[EXTRA] Configuring core C gcc compiler
[EXTRA] Building gcc
[EXTRA] Installing gcc
[EXTRA] Housekeeping for final gcc compiler
[INFO ] Installing pass-1 core C gcc compiler: done in 538.26s (at 21:46)
[INFO ] Saving state to restart at step 'kernel_headers'...
[INFO ] =================================================================
[INFO ] Installing kernel headers
[EXTRA] Installing kernel headers
[EXTRA] Checking installed headers
[INFO ] Installing kernel headers: done in 11.64s (at 22:16)
[INFO ] Saving state to restart at step 'libc_start_files'...
[INFO ] =================================================================
[INFO ] Installing C library headers & start files
[EXTRA] Configuring C library
[EXTRA] Installing C library headers
[EXTRA] Installing C library start files
[INFO ] Installing C library headers & start files: done in 23.37s (at 22:54)
[INFO ] Saving state to restart at step 'cc_core_pass_2'...
[INFO ] =================================================================
[INFO ] Installing pass-2 core C gcc compiler
[EXTRA] Configuring core C gcc compiler
[EXTRA] Building gcc
[EXTRA] Installing gcc
[EXTRA] Housekeeping for final gcc compiler
[INFO ] Installing pass-2 core C gcc compiler: done in 657.92s (at 34:06)
[INFO ] Saving state to restart at step 'libc'...
[INFO ] =================================================================
[INFO ] Installing C library
[EXTRA] Configuring C library
[EXTRA] Building C library
[EXTRA] Installing C library
[EXTRA] Configuring C library localedef
[EXTRA] Building C library localedef
[EXTRA] Installing C library locales
[INFO ] Installing C library: done in 861.70s (at 48:47)
[INFO ] Saving state to restart at step 'cc_for_build'...
[INFO ] Saving state to restart at step 'cc_for_host'...
[INFO ] =================================================================
[INFO ] Installing final gcc compiler
[EXTRA] Configuring final gcc compiler
[EXTRA] Building final gcc compiler
[EXTRA] Installing final gcc compiler
[EXTRA] Housekeeping for final gcc compiler
[INFO ] Installing final gcc compiler: done in 902.17s (at 64:39)
[INFO ] Saving state to restart at step 'libc_post_cc'...
[INFO ] Saving state to restart at step 'companion_libs_for_target'...
[INFO ] =================================================================
[INFO ] Installing expat for target
[EXTRA] Configuring expat
[EXTRA] Building expat
[EXTRA] Installing expat
[INFO ] Installing expat for target: done in 6.22s (at 66:33)
[INFO ] =================================================================
[INFO ] Installing ncurses for target
[EXTRA] Configuring ncurses
[EXTRA] Building ncurses
[EXTRA] Installing ncurses
[INFO ] Installing ncurses for target: done in 49.44s (at 67:22)
[INFO ] Saving state to restart at step 'binutils_for_target'...
[INFO ] Saving state to restart at step 'debug'...
[INFO ] =================================================================
[INFO ] Installing cross-gdb
[EXTRA] Configuring cross-gdb
[EXTRA] Building cross-gdb
[EXTRA] Installing cross-gdb
[EXTRA] Installing '.gdbinit' template
[INFO ] Installing cross-gdb: done in 197.27s (at 71:44)
[INFO ] =================================================================
[INFO ] Installing native gdb
[EXTRA] Configuring native gdb
[EXTRA] Building native gdb
[EXTRA] Installing native gdb
[INFO ] Installing native gdb: done in 184.36s (at 74:48)
[INFO ] =================================================================
[INFO ] Installing gdbserver
[EXTRA] Configuring gdbserver
[EXTRA] Building gdbserver
[EXTRA] Installing gdbserver
[INFO ] Installing gdbserver: done in 60.28s (at 75:49)
[INFO ] Saving state to restart at step 'test_suite'...
[INFO ] Saving state to restart at step 'finish'...
[INFO ] =================================================================
[INFO ] Cleaning-up the toolchain's directory
[INFO ] Stripping all toolchain executables
[EXTRA] Installing the populate helper
[EXTRA] Installing a cross-ldd helper
[EXTRA] Creating toolchain aliases
[EXTRA] Removing access to the build system tools
[EXTRA] Removing installed documentation
[INFO ] Cleaning-up the toolchain's directory: done in 3.83s (at 77:27)
[INFO ] Build completed at 20160522.203639
[INFO ] (elapsed: 77:26.35)
[INFO ] Finishing installation (may take a few seconds)...
[77:27] / % ╭─hou@love-xin ~/arm/crosstool-ng-1.22.0_build
╰─$
添加環境變數:
sudo vim ~/.bashrc
在PATH變數中添加:${HOME}/arm/x-tools/arm-cortexa9_neon-linux-gnueabihf/bin
刷新:
source ~/.bashrc
屏幕剪輯的捕獲時間: 2016/5/22 21:01
love-xin :: ~/arm/crosstool-ng-1.22.0_build » arm-cortexa9_neon-linux-gnueabihf-gcc --version
arm-cortexa9_neon-linux-gnueabihf-gcc (crosstool-NG crosstool-ng-1.22.0) 5.2.0
Copyright © 2015 Free Software Foundation, Inc.
本程式是自由軟體;請參看源代碼的版權聲明。本軟體沒有任何擔保;
包括沒有適銷性和某一專用目的下的適用性擔保。
love-xin :: ~/arm/crosstool-ng-1.22.0_build »
為了不影響主機看網頁、玩游戲,當時設置Ubuntu是2G運行記憶體,所以時間有點慢,想要快點可以設置大一點。