最新消息:20181230 VPS服务器已从Linode换到腾讯云香港,主题仍用朋友推荐的大前端D8

【记录】在Ubuntu下用crosstool-ng编译xscale的交叉工具链

crosstool-ng crifan 1375浏览 0评论

【背景】

之前已经在win7+Cygwin下,用crosstool-ng建立好了for xscale的交叉编译器:

【记录】重试使用最新版本1.18.0的crosstool-ng去配置和编译xscale的交叉编译器

现在打算在刚,新建的Ubuntu(虚拟机):

【记录】VMWare Workstation 8中创建一个Ubuntu的虚拟机

中,再重新弄一遍,建议一个交叉编译器。

【折腾过程】

1.之前已经有个crosstool-ng的配置文件了。

可以拿过来直接用了。

2.但是用之前,还是要把对应的之前下载的文件,都拷贝到Ubuntu中去。

所以要去弄,VMWare Workstation的文件共享的事情:

【记录】VMWare Workstation中实现Win7和Ubuntu虚拟机之间的文件共享

3.然后把之前的src下面的所有tar包都拷贝到Ubuntu中。

crifan@ubuntu:/mnt$ cd /home/crifan/develop/
crifan@ubuntu:~/develop$ ls
crifan@ubuntu:~/develop$ mkdir crosstool-ng
crifan@ubuntu:~/develop$ cd crosstool-ng/
crifan@ubuntu:~/develop/crosstool-ng$ ls
crifan@ubuntu:~/develop/crosstool-ng$ mkdir src
crifan@ubuntu:~/develop/crosstool-ng$ cd src/
crifan@ubuntu:~/develop/crosstool-ng/src$ ls
crifan@ubuntu:~/develop/crosstool-ng/src$ cp /mnt/hgfs/crosstool_ng_src/* .
crifan@ubuntu:~/develop/crosstool-ng/src$ ls
binutils-2.20.tar.bz2     gcc-4.6.0.tar.bz2        ltrace_0.5.3.orig.tar.gz
binutils-2.22.tar.bz2     gdb-6.8a.tar.bz2         make-3.81.tar.bz2
cloog-ppl-0.15.11.tar.gz  gdb-6.8.tar.bz2          mpc-0.9.tar.gz
dmalloc-5.5.2.tar.bz2     glibc-2.9.tar.bz2        mpfr-2.4.2.tar.bz2
expat-2.0.1.tar.bz2       glibc-ports-2.9.tar.bz2  mpfr-3.1.0.tar.xz
expat-2.0.1.tar.gz        gmp-4.3.2.tar.bz2        ncurses-5.7.tar.bz2
expat-2.1.0.tar.gz        gmp-5.0.2.tar.bz2        ncurses-5.7.tar.gz
gcc-4.2.2.tar.bz2         libelf-0.8.13.tar.gz     ncurses-5.9.tar.gz
gcc-4.4.3.tar.bz2         linux-2.6.19.1.tar.bz2   ppl-0.11.2.tar.bz2
gcc-4.4.6.tar.bz2         linux-2.6.36.tar.bz2     strace-4.5.19.tar.bz2
crifan@ubuntu:~/develop/crosstool-ng/src$ 

4.继续参考之前的:

【记录】重试使用最新版本1.18.0的crosstool-ng去配置和编译xscale的交叉编译器

去操作。

5.解压crosstool-ng的tar包,再创建build文件夹,变成:

crifan@ubuntu:~/develop/crosstool-ng$ mkdir crosstool-ng-1.18.0_build
crifan@ubuntu:~/develop/crosstool-ng$ ls
crosstool-ng-1.18.0  crosstool-ng-1.18.0_build  crosstool-ng-1.18.0.tar  src  x-tools

6.先去在当前ubuntu中安装crosstool-ng:

crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ mkdir /opt/crosstool-ng
mkdir: cannot create directory ‘/opt/crosstool-ng’: Permission denied
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ sudo mkdir /opt/crosstool-ng
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ ./cofigure --prefix=/opt/crosstool-ng
bash: ./cofigure: No such file or directory
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ ./configure --prefix=/opt/crosstool-ng
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking whether sed understands -r -i -e... yes
checking whether ln -s works... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for ranlib... ranlib
checking for objcopy... objcopy
checking for absolute path to objcopy... /usr/bin/objcopy
checking for objdump... objdump
checking for absolute path to objdump... /usr/bin/objdump
checking for readelf... readelf
checking for absolute path to readelf... /usr/bin/readelf
checking for bison... no
configure: error: missing required tool: bison
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ sudo apt-install bison
sudo: apt-install: command not found
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ sudo apt-get install bison
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libbison-dev libsigsegv2 m4
Suggested packages:
  bison-doc
The following NEW packages will be installed:
  bison libbison-dev libsigsegv2 m4
0 upgraded, 4 newly installed, 0 to remove and 198 not upgraded.
Need to get 523 kB of archives.
After this operation, 2,011 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ raring/main libsigsegv2 i386 2.9-4ubuntu3 [14.6 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ raring/main m4 i386 1.4.16-5 [199 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ raring/main libbison-dev i386 2:2.5.dfsg-3ubuntu1 [33.4 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ raring/main bison i386 2:2.5.dfsg-3ubuntu1 [276 kB]
Fetched 523 kB in 4s (129 kB/s)
Selecting previously unselected package libsigsegv2.
(Reading database ... 156824 files and directories currently installed.)
Unpacking libsigsegv2 (from .../libsigsegv2_2.9-4ubuntu3_i386.deb) ...
Selecting previously unselected package m4.
Unpacking m4 (from .../archives/m4_1.4.16-5_i386.deb) ...
Selecting previously unselected package libbison-dev:i386.
Unpacking libbison-dev:i386 (from .../libbison-dev_2%3a2.5.dfsg-3ubuntu1_i386.deb) ...
Selecting previously unselected package bison.
Unpacking bison (from .../bison_2%3a2.5.dfsg-3ubuntu1_i386.deb) ...
Processing triggers for install-info ...
Processing triggers for man-db ...
Setting up libsigsegv2 (2.9-4ubuntu3) ...
Setting up m4 (1.4.16-5) ...
Setting up libbison-dev:i386 (2:2.5.dfsg-3ubuntu1) ...
Setting up bison (2:2.5.dfsg-3ubuntu1) ...
update-alternatives: using /usr/bin/bison.yacc to provide /usr/bin/yacc (yacc) in auto mode
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ ./configure --prefix=/opt/crosstool-ng
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking whether sed understands -r -i -e... yes
checking whether ln -s works... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for ranlib... ranlib
checking for objcopy... objcopy
checking for absolute path to objcopy... /usr/bin/objcopy
checking for objdump... objdump
checking for absolute path to objdump... /usr/bin/objdump
checking for readelf... readelf
checking for absolute path to readelf... /usr/bin/readelf
checking for bison... bison
checking for flex... no
configure: error: missing required tool: flex
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ sudo apt-get install flex
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libfl-dev
Suggested packages:
  build-essential
The following NEW packages will be installed:
  flex libfl-dev
0 upgraded, 2 newly installed, 0 to remove and 198 not upgraded.
Need to get 235 kB of archives.
After this operation, 559 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ raring/main libfl-dev i386 2.5.35-10.1ubuntu1 [19.1 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ raring/main flex i386 2.5.35-10.1ubuntu1 [216 kB]
Fetched 235 kB in 25s (9,166 B/s)                                                                                        
Selecting previously unselected package libfl-dev:i386.
(Reading database ... 156937 files and directories currently installed.)
Unpacking libfl-dev:i386 (from .../libfl-dev_2.5.35-10.1ubuntu1_i386.deb) ...
Selecting previously unselected package flex.
Unpacking flex (from .../flex_2.5.35-10.1ubuntu1_i386.deb) ...
Processing triggers for man-db ...
Processing triggers for install-info ...
Setting up libfl-dev:i386 (2.5.35-10.1ubuntu1) ...
Setting up flex (2.5.35-10.1ubuntu1) ...
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ ./configure --prefix=/opt/crosstool-ng
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking whether sed understands -r -i -e... yes
checking whether ln -s works... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for ranlib... ranlib
checking for objcopy... objcopy
checking for absolute path to objcopy... /usr/bin/objcopy
checking for objdump... objdump
checking for absolute path to objdump... /usr/bin/objdump
checking for readelf... readelf
checking for absolute path to readelf... /usr/bin/readelf
checking for bison... bison
checking for flex... flex
checking for gperf... no
configure: error: missing required tool: gperf
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ sudo apt-get install gperf
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  gperf
0 upgraded, 1 newly installed, 0 to remove and 198 not upgraded.
Need to get 95.2 kB of archives.
After this operation, 291 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu/ raring/main gperf i386 3.0.3-1ubuntu2 [95.2 kB]
Fetched 95.2 kB in 14s (6,713 B/s)                                                                                       
Selecting previously unselected package gperf.
(Reading database ... 156961 files and directories currently installed.)
Unpacking gperf (from .../gperf_3.0.3-1ubuntu2_i386.deb) ...
Processing triggers for install-info ...
Processing triggers for doc-base ...
Processing 32 changed doc-base files, 1 added doc-base file...
Processing triggers for man-db ...
Setting up gperf (3.0.3-1ubuntu2) ...
Ignoring install-info called from maintainer script
The package gperf should be rebuilt with new debhelper to get trigger support

7.然后找不到makeinfo:

【已解决】Ubuntu中用sudo apt-get install安装某软件,结果出错:E: Unable to locate package makeinfo

8.再继续安装gawk:

crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ ./configure --prefix=/opt/crosstool-ng
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking whether sed understands -r -i -e... yes
checking whether ln -s works... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for ranlib... ranlib
checking for objcopy... objcopy
checking for absolute path to objcopy... /usr/bin/objcopy
checking for objdump... objdump
checking for absolute path to objdump... /usr/bin/objdump
checking for readelf... readelf
checking for absolute path to readelf... /usr/bin/readelf
checking for bison... bison
checking for flex... flex
checking for gperf... gperf
checking for makeinfo... makeinfo
checking for cut... cut
checking for stat... stat
checking for readlink... readlink
checking for wget... wget
checking for tar... tar
checking for gzip... gzip
checking for bzip2... bzip2
checking for patch... /usr/bin/patch
checking for bash >= 3.1... /bin/bash
checking for GNU awk... no
configure: error: could not find GNU awk
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ sudo apt-get install awk
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package awk is a virtual package provided by:
  original-awk 2011-08-10-2
  mawk 1.3.3-17ubuntu1
  gawk 1:4.0.1+dfsg-2ubuntu1
You should explicitly select one to install.

E: Package 'awk' has no installation candidate
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ awk
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ sudo apt-get install gawk
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  gawk-doc
The following NEW packages will be installed:
  gawk
0 upgraded, 1 newly installed, 0 to remove and 202 not upgraded.
Need to get 737 kB of archives.
After this operation, 1,909 kB of additional disk space will be used.
Get:1 http://mirrors.163.com/ubuntu/ raring/main gawk i386 1:4.0.1+dfsg-2ubuntu1 [737 kB]
Fetched 737 kB in 14s (49.2 kB/s)
Selecting previously unselected package gawk.
(Reading database ... 157098 files and directories currently installed.)
Unpacking gawk (from .../gawk_1%3a4.0.1+dfsg-2ubuntu1_i386.deb) ...
Processing triggers for man-db ...
Setting up gawk (1:4.0.1+dfsg-2ubuntu1) ...

9.然后又是libtool的问题:

【已解决】Ubuntu下去配置crosstool-ng时出现:configure: error: could not find GNU libtool >= 1.5.26

10.接着又是automake:

crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ ./configure --prefix=/opt/crosstool-ng
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking whether sed understands -r -i -e... yes
checking whether ln -s works... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for ranlib... ranlib
checking for objcopy... objcopy
checking for absolute path to objcopy... /usr/bin/objcopy
checking for objdump... objdump
checking for absolute path to objdump... /usr/bin/objdump
checking for readelf... readelf
checking for absolute path to readelf... /usr/bin/readelf
checking for bison... bison
checking for flex... flex
checking for gperf... gperf
checking for makeinfo... makeinfo
checking for cut... cut
checking for stat... stat
checking for readlink... readlink
checking for wget... wget
checking for tar... tar
checking for gzip... gzip
checking for bzip2... bzip2
checking for patch... /usr/bin/patch
checking for bash >= 3.1... /bin/bash
checking for GNU awk... /usr/bin/awk
checking for GNU make >= 3.80... /usr/bin/make
checking whether /usr/bin/make sets $(MAKE)... yes
checking for GNU libtool >= 1.5.26... /usr/bin/libtool
checking for GNU libtoolize >= 1.5.26... /usr/bin/libtoolize
checking for GNU automake >= 1.10... no
configure: error: could not find GNU automake >= 1.10
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ sudo apt-get install automake
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  autoconf
Suggested packages:
  autoconf2.13 autoconf-archive gnu-standards autoconf-doc
The following NEW packages will be installed:
  autoconf automake
0 upgraded, 2 newly installed, 0 to remove and 202 not upgraded.
Need to get 1,146 kB of archives.
After this operation, 3,478 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://mirrors.163.com/ubuntu/ raring/main autoconf all 2.69-1ubuntu1 [568 kB]
Get:2 http://mirrors.163.com/ubuntu/ raring/main automake all 1:1.11.6-1ubuntu1 [578 kB]
Fetched 1,146 kB in 18s (61.9 kB/s)                                                                               
Selecting previously unselected package autoconf.
(Reading database ... 157285 files and directories currently installed.)
Unpacking autoconf (from .../autoconf_2.69-1ubuntu1_all.deb) ...
Selecting previously unselected package automake.
Unpacking automake (from .../automake_1%3a1.11.6-1ubuntu1_all.deb) ...
Processing triggers for man-db ...
Processing triggers for install-info ...
Processing triggers for doc-base ...
Processing 1 added doc-base file...
Setting up autoconf (2.69-1ubuntu1) ...
Setting up automake (1:1.11.6-1ubuntu1) ...
update-alternatives: using /usr/bin/automake-1.11 to provide /usr/bin/automake (automake) in auto mode
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ 

11.然后又是ncurses:

【已解决】Ubuntu中配置crosstool-ng出错:configure: error: could not find curses header, required for the kconfig frontends

12.然后最后就配置完毕了:

crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ ./configure --prefix=/opt/crosstool-ng
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking whether sed understands -r -i -e... yes
checking whether ln -s works... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for ranlib... ranlib
checking for objcopy... objcopy
checking for absolute path to objcopy... /usr/bin/objcopy
checking for objdump... objdump
checking for absolute path to objdump... /usr/bin/objdump
checking for readelf... readelf
checking for absolute path to readelf... /usr/bin/readelf
checking for bison... bison
checking for flex... flex
checking for gperf... gperf
checking for makeinfo... makeinfo
checking for cut... cut
checking for stat... stat
checking for readlink... readlink
checking for wget... wget
checking for tar... tar
checking for gzip... gzip
checking for bzip2... bzip2
checking for patch... /usr/bin/patch
checking for bash >= 3.1... /bin/bash
checking for GNU awk... /usr/bin/awk
checking for GNU make >= 3.80... /usr/bin/make
checking whether /usr/bin/make sets $(MAKE)... yes
checking for GNU libtool >= 1.5.26... /usr/bin/libtool
checking for GNU libtoolize >= 1.5.26... /usr/bin/libtoolize
checking for GNU automake >= 1.10... /usr/bin/automake
checking for xz... xz
checking for cvs... no
checking for svn... no
checking for inline... inline
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible realloc... yes
checking for working alloca.h... yes
checking for alloca... yes
checking libintl.h usability... yes
checking libintl.h presence... yes
checking for libintl.h... yes
checking whether gettext is declared... yes
checking ncurses/ncurses.h usability... no
checking ncurses/ncurses.h presence... no
checking for ncurses/ncurses.h... no
checking ncurses/curses.h usability... no
checking ncurses/curses.h presence... no
checking for ncurses/curses.h... no
checking ncursesw/curses.h usability... no
checking ncursesw/curses.h presence... no
checking for ncursesw/curses.h... no
checking ncurses.h usability... yes
checking ncurses.h presence... yes
checking for ncurses.h... yes
checking for library containing initscr... -lncurses
configure: creating ./config.status
config.status: creating Makefile
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ 

13.此处,整理一下,此处,新安装的Ubuntu 13.04中,去对于crosstool-ng做./configure时,缺少了很多库,对应的安装所用的命令为:

sudo apt-get install bison
sudo apt-get install flex
sudo apt-get install gperf
sudo apt-get install texinfo
sudo apt-get install gawk
sudo apt-get install libtool
sudo apt-get install automake
sudo apt-get install libncurses5-dev

14.然后再去make:

crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ make
  SED    'ct-ng'
  SED    'scripts/crosstool-NG.sh'
  SED    'scripts/saveSample.sh'
  SED    'scripts/showTuple.sh'
  GEN    'config/configure.in'
  GEN    'paths.mk'
  GEN    'paths.sh'
  DEP    'nconf.gui.dep'
  DEP    'nconf.dep'
  DEP    'lxdialog/yesno.dep'
  DEP    'lxdialog/util.dep'
  DEP    'lxdialog/textbox.dep'
  DEP    'lxdialog/menubox.dep'
  DEP    'lxdialog/inputbox.dep'
  DEP    'lxdialog/checklist.dep'
  DEP    'mconf.dep'
  DEP    'conf.dep'
  BISON  'zconf.tab.c'
  GPERF  'zconf.hash.c'
  LEX    'lex.zconf.c'
  DEP    'zconf.tab.dep'
  CC     'zconf.tab.o'
  CC     'conf.o'
  LD     'conf'
  CC     'lxdialog/checklist.o'
  CC     'lxdialog/inputbox.o'
  CC     'lxdialog/menubox.o'
  CC     'lxdialog/textbox.o'
  CC     'lxdialog/util.o'
  CC     'lxdialog/yesno.o'
  CC     'mconf.o'
  LD     'mconf'
  CC     'nconf.o'
  CC     'nconf.gui.o'
  LD     'nconf'
  SED    'docs/ct-ng.1'
  GZIP   'docs/ct-ng.1.gz'
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ 

15.再去make install:

crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ make install
  GEN    'config/configure.in'
  GEN    'paths.mk'
  GEN    'paths.sh'
  MKDIR   '/opt/crosstool-ng/bin/'
/usr/bin/install: cannot change permissions of ‘/opt/crosstool-ng/bin’: No such file or directory
make[1]: *** [/opt/crosstool-ng/bin] Error 1
make: *** [install] Error 2
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ ll /opt/crosstool-ng/
total 8
drwxr-xr-x 2 root root 4096 Aug  7 02:56 ./
drwxr-xr-x 4 root root 4096 Aug  7 02:56 ../
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ ll /opt
total 16
drwxr-xr-x  4 root   root 4096 Aug  7 02:56 ./
drwxr-xr-x 23 root   root 4096 Aug  6 20:52 ../
drwxr-xr-x  2 crifan root 4096 Aug  7 00:59 crosscompile/
drwxr-xr-x  2 root   root 4096 Aug  7 02:56 crosstool-ng/
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ sudo chown -R crifan /opt/crosstool-ng/
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ make install
  GEN    'config/configure.in'
  GEN    'paths.mk'
  GEN    'paths.sh'
  MKDIR   '/opt/crosstool-ng/bin/'
  INST    'ct-ng'
  RMDIR   '/opt/crosstool-ng/lib/ct-ng.1.18.0/'
  MKDIR   '/opt/crosstool-ng/lib/ct-ng.1.18.0/'
  INSTDIR 'config/'
  INSTDIR 'contrib/'
  INSTDIR 'patches/'
  INSTDIR 'scripts/'
  INST    'steps.mk'
  INST    'paths'
  INSTDIR 'samples/'
  INST    'kconfig/'
  MKDIR   '/opt/crosstool-ng/share/doc/crosstool-ng/ct-ng.1.18.0/'
  INST    'docs/*.txt'
  MKDIR   '/opt/crosstool-ng/share/man/man1/'
  INST    'ct-ng.1.gz'

For auto-completion, do not forget to install 'ct-ng.comp' into
your bash completion directory (usually /etc/bash_completion.d)
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ 

 

16.再去把上面的路径:

/opt/crosstool-ng/bin

添加到自己的.bashrc中:

crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ gedit ~/.bashrc

把:

PATH=/opt/crosstool-ng/bin:$PATH

加到最后。

再去source一下,就可以找到ct-ng了:

crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ source ~/.bashrc
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ ct-ng help
This is crosstool-NG version 1.18.0

Copyright (C) 2008  Yann E. MORIN <yann.morin.1998@free.fr>
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

See below for a list of available actions, listed by category:

Configuration actions:
  menuconfig         - Update current config using a menu based program
  oldconfig          - Update current config using a provided .config as base
  extractconfig      - Extract to stdout the configuration items from a
                       build.log file piped to stdin
  defconfig          - Save current config as a mini-defconfig to ${CONFIG}
  olddefconfig       - Update config from a mini-defconfig ${CONFIG}
                       (default: ${CONFIG}=./defconfig)
  saveconfig         - Save current config as a preconfigured target
  show-tuple         - Print the tuple of the currently configured toolchain

Preconfigured toolchains (#: force number of // jobs):
  list-samples       - prints the list of all samples (for scripting)
  show-<sample>      - show a brief overview of <sample> (list with list-samples)
  <sample>           - preconfigure crosstool-NG with <sample> (list with list-samples)
  build-all[.#]      - Build *all* samples (list with list-samples) and install in
                       ${CT_PREFIX} (which you must set)

Build actions (#: force number of // jobs):
  build[.#]          - Build the currently configured toolchain
  list-steps         - List all build steps

Clean actions:
  clean              - Remove generated files
  distclean          - Remove generated files, configuration and build directories

Distribution actions:
  wiki-samples       - Print a DokuWiki table of samples
  updatetools        - Update the config tools
  tarball            - Build a tarball of the configured toolchain

Environment variables (see /opt/crosstool-ng/share/doc/crosstool-ng/ct-ng.1.18.0/0 - Table of content.txt):
  STOP=step          - Stop the build just after this step (list with list-steps)
  RESTART=step       - Restart the build just before this step (list with list-steps)
  CT_PREFIX=dir      - install samples in dir (see action "build-all", above).
  V=0|1|2            - 0 => show only human-readable messages (default)
                       1 => show only the commands being executed
                       2 => show both

Use action "menuconfig" to configure your toolchain
Use action "build" to build your toolchain
Use action "version" to see the version
See "man 1 ct-ng" for some help as well
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ 

17.同样去看看当前已有的示例配置:

crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ ct-ng list-samples
Status  Sample name
  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
[L.X]   alphaev56-unknown-linux-gnu
[L.X]   alphaev67-unknown-linux-gnu
[L.X]   arm-bare_newlib_cortex_m3_nommu-eabi
[L.X]   arm-cortex_a15-linux-gnueabi
[L..]   arm-cortex_a8-linux-gnueabi
[L..]   arm-davinci-linux-gnueabi
[L..]   armeb-unknown-eabi
[L.X]   armeb-unknown-linux-gnueabi
[L.X]   armeb-unknown-linux-uclibcgnueabi
[L..]   arm-unknown-eabi
[L..]   arm-unknown-linux-gnueabi
[L.X]   arm-unknown-linux-uclibcgnueabi
[L.X]   armv6-rpi-linux-gnueabi
[L.X]   avr32-unknown-none
[L..]   bfin-unknown-linux-uclibc
[L..]   i586-geode-linux-uclibc
[L.X]   i586-mingw32msvc,i686-none-linux-gnu
[L.X]   i686-nptl-linux-gnu
[L.X]   i686-unknown-mingw32
[L.X]   m68k-unknown-elf
[L.X]   m68k-unknown-uclinux-uclibc
[L.X]   mips64el-n32-linux-uclibc
[L.X]   mips64el-n64-linux-uclibc
[L.X]   mips-ar2315-linux-gnu
[L..]   mipsel-sde-elf
[L..]   mipsel-unknown-linux-gnu
[L.X]   mips-malta-linux-gnu
[L..]   mips-unknown-elf
[L.X]   mips-unknown-linux-uclibc
[L..]   powerpc-405-linux-gnu
[L.X]   powerpc64-unknown-linux-gnu
[L..]   powerpc-860-linux-gnu
[L.X]   powerpc-e300c3-linux-gnu
[L.X]   powerpc-e500v2-linux-gnuspe
[L..]   powerpc-unknown-linux-gnu
[L..]   powerpc-unknown-linux-uclibc
[L..]   powerpc-unknown_nofpu-linux-gnu
[L.X]   s390-ibm-linux-gnu
[L.X]   s390x-ibm-linux-gnu
[L..]   sh4-unknown-linux-gnu
[L..]   x86_64-unknown-linux-gnu
[L..]   x86_64-unknown-linux-uclibc
[L.X]   x86_64-unknown-mingw32
 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
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0$ 

18.然后就可以去配置crosstool-ng了:

【记录】Ubuntu下更新crosstool-ng的menuconfig配置

19.然后再去编译:

【记录】Ubuntu下用crosstool-ng为xscale建立交叉编译器arm-xscale-linux-gnueabi-gcc

20.编译完成后,去看看生成的交叉编译器:

crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build$ ls /home/crifan/develop/crosstool-ng/x-tools/
arm-xscale-linux-gnueabi
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build$ ls /home/crifan/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/
arm-xscale-linux-gnueabi  bin  build.log.bz2  include  lib  libexec  share
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build$ ls /home/crifan/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/
arm-xscale-linux-gnueabi/ build.log.bz2             lib/                      share/
bin/                      include/                  libexec/                  
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build$ ls /home/crifan/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/
arm-xscale-linux-gnueabi/ build.log.bz2             lib/                      share/
bin/                      include/                  libexec/                  
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build$ ls /home/crifan/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/arm-xscale-linux-gnueabi/
bin/        debug-root/ include/    lib/        lib32/      lib64/      sysroot/    
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build$ ls /home/crifan/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/arm-xscale-linux-gnueabi/bin -lh
total 8.3M
-r-xr-xr-x 2 crifan crifan 633K Aug  8 01:10 ar
-r-xr-xr-x 2 crifan crifan 1.1M Aug  8 01:10 as
-r-xr-xr-x 2 crifan crifan 276K Aug  8 01:10 c++
-r-xr-xr-x 2 crifan crifan 276K Aug  8 01:10 g++
-r-xr-xr-x 1 crifan crifan 272K Aug  8 01:10 gcc
-r-xr-xr-x 4 crifan crifan 1.1M Aug  8 01:10 ld
-r-xr-xr-x 4 crifan crifan 1.1M Aug  8 01:10 ld.bfd
-r-xr-xr-x 2 crifan crifan 617K Aug  8 01:10 nm
-r-xr-xr-x 2 crifan crifan 775K Aug  8 01:10 objcopy
-r-xr-xr-x 2 crifan crifan 943K Aug  8 01:10 objdump
-r-xr-xr-x 2 crifan crifan 633K Aug  8 01:10 ranlib
-r-xr-xr-x 2 crifan crifan 775K Aug  8 01:10 strip
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build$ ls /home/crifan/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/bin -lh
total 18M
-r-xr-xr-x 1 crifan crifan 605K Aug  8 01:10 arm-xscale-linux-gnueabi-addr2line
-r-xr-xr-x 2 crifan crifan 633K Aug  8 01:10 arm-xscale-linux-gnueabi-ar
-r-xr-xr-x 2 crifan crifan 1.1M Aug  8 01:10 arm-xscale-linux-gnueabi-as
-r-xr-xr-x 2 crifan crifan 276K Aug  8 01:10 arm-xscale-linux-gnueabi-c++
lrwxrwxrwx 1 crifan crifan   28 Aug  8 00:54 arm-xscale-linux-gnueabi-cc -> arm-xscale-linux-gnueabi-gcc
-r-xr-xr-x 1 crifan crifan 605K Aug  8 01:10 arm-xscale-linux-gnueabi-c++filt
-r-xr-xr-x 1 crifan crifan 276K Aug  8 01:10 arm-xscale-linux-gnueabi-cpp
-r-xr-xr-x 1 crifan crifan 3.1K Aug  7 23:57 arm-xscale-linux-gnueabi-ct-ng.config
-r-xr-xr-x 1 crifan crifan  26K Aug  8 01:10 arm-xscale-linux-gnueabi-elfedit
-r-xr-xr-x 2 crifan crifan 276K Aug  8 01:10 arm-xscale-linux-gnueabi-g++
-r-xr-xr-x 2 crifan crifan 272K Aug  8 01:10 arm-xscale-linux-gnueabi-gcc
-r-xr-xr-x 2 crifan crifan 272K Aug  8 01:10 arm-xscale-linux-gnueabi-gcc-4.6.0
-r-xr-xr-x 1 crifan crifan  30K Aug  8 01:10 arm-xscale-linux-gnueabi-gcov
-r-xr-xr-x 1 crifan crifan 2.7M Aug  8 01:10 arm-xscale-linux-gnueabi-gdb
-r-xr-xr-x 1 crifan crifan 2.7M Aug  8 01:10 arm-xscale-linux-gnueabi-gdbtui
-r-xr-xr-x 1 crifan crifan 670K Aug  8 01:10 arm-xscale-linux-gnueabi-gprof
-r-xr-xr-x 4 crifan crifan 1.1M Aug  8 01:10 arm-xscale-linux-gnueabi-ld
-r-xr-xr-x 4 crifan crifan 1.1M Aug  8 01:10 arm-xscale-linux-gnueabi-ld.bfd
-r-xr-xr-x 1 crifan crifan  11K Aug  8 01:10 arm-xscale-linux-gnueabi-ldd
-r-xr-xr-x 2 crifan crifan 617K Aug  8 01:10 arm-xscale-linux-gnueabi-nm
-r-xr-xr-x 2 crifan crifan 775K Aug  8 01:10 arm-xscale-linux-gnueabi-objcopy
-r-xr-xr-x 2 crifan crifan 943K Aug  8 01:10 arm-xscale-linux-gnueabi-objdump
-r-xr-xr-x 1 crifan crifan  11K Aug  8 01:10 arm-xscale-linux-gnueabi-populate
-r-xr-xr-x 2 crifan crifan 633K Aug  8 01:10 arm-xscale-linux-gnueabi-ranlib
-r-xr-xr-x 1 crifan crifan 317K Aug  8 01:10 arm-xscale-linux-gnueabi-readelf
-r-xr-xr-x 1 crifan crifan 609K Aug  8 01:10 arm-xscale-linux-gnueabi-size
-r-xr-xr-x 1 crifan crifan 605K Aug  8 01:10 arm-xscale-linux-gnueabi-strings
-r-xr-xr-x 2 crifan crifan 775K Aug  8 01:10 arm-xscale-linux-gnueabi-strip
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build$ 

效果如下:

build out cross compiler

21.再去编译.bashrc,把路径加到PATH中,即最后两行是:

#PATH=/opt/crosstool-ng/bin:$PATH
PATH=/opt/crosstool-ng/bin:$HOME/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/bin:$PATH

保存,退出gedit。

再source一下,就可以找到我们的交叉编译器了:

crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/scripts$ gedit ~/.bashrc
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/scripts$ source ~/.bashrc
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/scripts$ arm-xscale-linux-gnueabi-
arm-xscale-linux-gnueabi-addr2line     arm-xscale-linux-gnueabi-gdbtui
arm-xscale-linux-gnueabi-ar            arm-xscale-linux-gnueabi-gprof
arm-xscale-linux-gnueabi-as            arm-xscale-linux-gnueabi-ld
arm-xscale-linux-gnueabi-c++           arm-xscale-linux-gnueabi-ld.bfd
arm-xscale-linux-gnueabi-cc            arm-xscale-linux-gnueabi-ldd
arm-xscale-linux-gnueabi-c++filt       arm-xscale-linux-gnueabi-nm
arm-xscale-linux-gnueabi-cpp           arm-xscale-linux-gnueabi-objcopy
arm-xscale-linux-gnueabi-ct-ng.config  arm-xscale-linux-gnueabi-objdump
arm-xscale-linux-gnueabi-elfedit       arm-xscale-linux-gnueabi-populate
arm-xscale-linux-gnueabi-g++           arm-xscale-linux-gnueabi-ranlib
arm-xscale-linux-gnueabi-gcc           arm-xscale-linux-gnueabi-readelf
arm-xscale-linux-gnueabi-gcc-4.6.0     arm-xscale-linux-gnueabi-size
arm-xscale-linux-gnueabi-gcov          arm-xscale-linux-gnueabi-strings
arm-xscale-linux-gnueabi-gdb           arm-xscale-linux-gnueabi-strip
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/scripts$ arm-xscale-linux-gnueabi-

 

【总结】

Ubuntu下,用crosstool-ng,使用之前已有的配置,去为xscale编译交叉编译器,相对来说还是很顺利的。

此处,也把当前所用的.config文件,放出来供大家下载参考(右键另存为):

crosstool_ng_1_18_0_for_xscale_ubuntu.config

转载请注明:在路上 » 【记录】在Ubuntu下用crosstool-ng编译xscale的交叉工具链

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
55 queries in 0.096 seconds, using 10.18MB memory