[fedora@localhost lqm]$ pwd
/home/fedora/lqm
[fedora@localhost lqm]$ mkdir embedded-system
[fedora@localhost lqm]$ ls
embedded-system
[fedora@localhost lqm]$ cd embedded-system/
[fedora@localhost embedded-system]$ mkdir setup-dir src-dir kernel build-dir tool-chain program doc
[fedora@localhost embedded-system]$ ls
build-dir doc kernel program setup-dir src-dir tool-chain
[fedora@localhost embedded-system]$ cd setup-dir/
[fedora@localhost setup-dir]$ ls
[fedora@localhost setup-dir]$ wget ftp://ftp.gnu.org/gnu/binutils/binutils-2.11.2.tar.gz
--10:07:01-- ftp://ftp.gnu.org/gnu/binutils/binutils-2.11.2.tar.gz
=> `binutils-2.11.2.tar.gz'
正在解析主机 ftp.gnu.org... 140.186.70.20
Connecting to ftp.gnu.org|140.186.70.20|:21... 已连接。
正在以 anonymous 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD /gnu/binutils ... 完成。
==> PASV ... 完成。 ==> RETR binutils-2.11.2.tar.gz ... 完成。
长度:9,934,295 (9.5M) (非正式数据)
100%[====================================>] 9,934,295 211.27K/s ETA 00:00
10:07:58 (188.07 KB/s) - `binutils-2.11.2.tar.gz' saved [9934295]
[fedora@localhost setup-dir]$ wget ftp://ftp.gnu.org/gnu/gcc/gcc-2.95.3/gcc-core-2.95.3.tar.gz
--10:09:04-- ftp://ftp.gnu.org/gnu/gcc/gcc-2.95.3/gcc-core-2.95.3.tar.gz
=> `gcc-core-2.95.3.tar.gz'
正在解析主机 ftp.gnu.org... 140.186.70.20
Connecting to ftp.gnu.org|140.186.70.20|:21... 已连接。
正在以 anonymous 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD /gnu/gcc/gcc-2.95.3 ... 完成。
==> PASV ... 完成。 ==> RETR gcc-core-2.95.3.tar.gz ... 完成。
长度:8,896,721 (8.5M) (非正式数据)
100%[====================================>] 8,896,721 210.93K/s ETA 00:00
10:09:53 (199.28 KB/s) - `gcc-core-2.95.3.tar.gz' saved [8896721]
[fedora@localhost setup-dir]$ wget ftp://ftp.gnu.org/gnu/gcc/gcc-2.95.3/gcc-g++-2.95.3.tar.gz
--10:10:28-- ftp://ftp.gnu.org/gnu/gcc/gcc-2.95.3/gcc-g++-2.95.3.tar.gz
=> `gcc-g++-2.95.3.tar.gz'
正在解析主机 ftp.gnu.org... 140.186.70.20
Connecting to ftp.gnu.org|140.186.70.20|:21... 已连接。
正在以 anonymous 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD /gnu/gcc/gcc-2.95.3 ... 完成。
==> PASV ... 完成。 ==> RETR gcc-g++-2.95.3.tar.gz ... 完成。
长度:1,627,575 (1.6M) (非正式数据)
100%[====================================>] 1,627,575 176.52K/s ETA 00:00
10:10:45 (139.26 KB/s) - `gcc-g++-2.95.3.tar.gz' saved [1627575]
[fedora@localhost setup-dir]$ wget ftp://ftp.gnu.org/gnu/glibc/glibc-2.2.4.tar.gz
--10:11:18-- ftp://ftp.gnu.org/gnu/glibc/glibc-2.2.4.tar.gz
=> `glibc-2.2.4.tar.gz'
正在解析主机 ftp.gnu.org... 140.186.70.20
Connecting to ftp.gnu.org|140.186.70.20|:21... 已连接。
正在以 anonymous 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD /gnu/glibc ... 完成。
==> PASV ... 完成。 ==> RETR glibc-2.2.4.tar.gz ... 完成。
长度:16,407,357 (16M) (非正式数据)
100%[============================================================>] 16,407,357 212.15K/s ETA 00:00
10:12:41 (204.07 KB/s) - `glibc-2.2.4.tar.gz' saved [16407357]
[fedora@localhost setup-dir]$ wget ftp://ftp.gnu.org/gnu/glibc/glibc-linuxthreads-2.2.4.tar.gz
--10:12:53-- ftp://ftp.gnu.org/gnu/glibc/glibc-linuxthreads-2.2.4.tar.gz
=> `glibc-linuxthreads-2.2.4.tar.gz'
正在解析主机 ftp.gnu.org... 140.186.70.20
Connecting to ftp.gnu.org|140.186.70.20|:21... 已连接。
正在以 anonymous 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD /gnu/glibc ... 完成。
==> PASV ... 完成。 ==> RETR glibc-linuxthreads-2.2.4.tar.gz ... 完成。
长度:219,721 (215K) (非正式数据)
100%[============================================================>] 219,721 63.56K/s ETA 00:00
10:13:01 (63.42 KB/s) - `glibc-linuxthreads-2.2.4.tar.gz' saved [219721]
[fedora@localhost setup-dir]$ wget ftp://ftp.kernel.org/pub/linux/kernel/v2.4/linux-2.4.21.tar.gz
--10:14:19-- ftp://ftp.kernel.org/pub/linux/kernel/v2.4/linux-2.4.21.tar.gz
=> `linux-2.4.21.tar.gz'
正在解析主机 ftp.kernel.org... 199.6.1.164, 204.152.191.5, 204.152.191.37, ...
Connecting to ftp.kernel.org|199.6.1.164|:21... 已连接。
正在以 anonymous 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD /pub/linux/kernel/v2.4 ... 完成。
==> PASV ... 完成。 ==> RETR linux-2.4.21.tar.gz ... 完成。
长度:35,475,346 (34M) (非正式数据)
100%[============================================================>] 35,475,346 211.62K/s ETA 00:00
10:17:24 (196.04 KB/s) - `linux-2.4.21.tar.gz' saved [35475346]
[fedora@localhost setup-dir]$ wget ftp://ftp.arm.linux.org.uk/pub/linux/arm/kernel/v2.4/patch-2.4.21-rmk1.gz
--10:17:30-- ftp://ftp.arm.linux.org.uk/pub/linux/arm/kernel/v2.4/patch-2.4.21-rmk1.gz
=> `patch-2.4.21-rmk1.gz.1'
正在解析主机 ftp.arm.linux.org.uk... 195.92.253.2, 2002:c35c:fd02::1
Connecting to ftp.arm.linux.org.uk|195.92.253.2|:21... 已连接。
正在以 anonymous 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> CWD /pub/linux/arm/kernel/v2.4 ... 完成。
==> PASV ... 完成。 ==> RETR patch-2.4.21-rmk1.gz ... 完成。
长度:821,147 (802K) (非正式数据)
100%[============================================================>] 821,147 135.76K/s ETA 00:00
10:17:43 (110.61 KB/s) - `patch-2.4.21-rmk1.gz.1' saved [821147]
[fedora@localhost setup-dir]$ ls
binutils-2.11.2.tar.gz gcc-g++-2.95.3.tar.gz glibc-linuxthreads-2.2.4.tar.gz patch-2.4.21-rmk1.gz
gcc-core-2.95.3.tar.gz glibc-2.2.4.tar.gz linux-2.4.21.tar.gz
[fedora@localhost setup-dir]$ cd ../build-dir/
[fedora@localhost build-dir]$ mkdir build-binutils build-gcc build-glibc
[fedora@localhost build-dir]$ ls
build-binutils build-gcc build-glibc
[fedora@localhost build-dir]$ type
[fedora@localhost build-dir]$ ls
build-binutils build-gcc build-glibc
[fedora@localhost build-dir]$ pwd
/home/fedora/lqm/embedded-system/build-dir
[fedora@localhost build-dir]$ #输出环境变量
[fedora@localhost build-dir]$ cd ../doc
[fedora@localhost doc]$ mkdir scripts
[fedora@localhost doc]$ cd scripts/
[fedora@localhost scripts]$ vi hjbl
[fedora@localhost scripts]$ cat -n hjbl
1 export PRJROOT=/home/lqm/embedded-system
2 export TARGEG=arm-linux
3 export PREFIX=$PRJROOT/tool-chain
4 export TARGET_PREFIX=$PREFIX/$TARGET
5 export PATH=$PREFIX/bin:$PATH
[fedora@localhost scripts]$ . hjbl #在点和hjbl之间有一个空格
[fedora@localhost scripts]$ $PRJROOT
bash: /home/lqm/embedded-system: 没有那个文件或目录
[fedora@localhost scripts]$ cd $PRJROOT
bash: cd: /home/lqm/embedded-system: 没有那个文件或目录
[fedora@localhost scripts]$ vi hjbl
[fedora@localhost scripts]$ cat hjbl
export PRJROOT=/home/fedora/lqm/embedded-system
export TARGEG=arm-linux
export PREFIX=$PRJROOT/tool-chain
export TARGET_PREFIX=$PREFIX/$TARGET
export PATH=$PREFIX/bin:$PATH
[fedora@localhost scripts]$ . hjbl
[fedora@localhost scripts]$ echo $PRJROOT
/home/fedora/lqm/embedded-system
[fedora@localhost scripts]$ cd $PRJROOT
[fedora@localhost embedded-system]$ ls
build-dir doc kernel program setup-dir src-dir tool-chain
[fedora@localhost embedded-system]$ cd kernel/
[fedora@localhost kernel]$ #内核头文件的配置
[fedora@localhost kernel]$ tar zxvf ../setup-dir/linux-2.4.21.tar.gz
[fedora@localhost kernel]$ gunzip ../setup-dir/patch-2.4.21-rmk1.gz
[fedora@localhost kernel]$ cd linux-2.4.21/
[fedora@localhost linux-2.4.21]$ patch -p1 < ../../setup-dir/patch-2.4.21-rmk1
[fedora@localhost linux-2.4.21]$ make ARCH=arm CROSS_COMPILE=arm-linux-menuconfig #配置
[fedora@localhost linux-2.4.21]$ make dep
[fedora@localhost linux-2.4.21]$ make distclean
[fedora@localhost linux-2.4.21]$ make ARCH=arm CROSS_COMPILE=arm-linux- menuconfig #配置:menuconfig和前面部分是有空格隔开的
[fedora@localhost linux-2.4.21]$ make dep
[fedora@localhost linux-2.4.21]$ ls include/linux/version.h
include/linux/version.h
[fedora@localhost linux-2.4.21]$ ls include/linux/auto
ls: 无法访问 include/linux/auto: 没有那个文件或目录
[fedora@localhost linux-2.4.21]$ ls include/linux/autoconf.h
include/linux/autoconf.h
[fedora@localhost linux-2.4.21]$
[fedora@localhost linux-2.4.21]$ cd include/
[fedora@localhost include]$ ln -s asm-arm asm
[fedora@localhost include]$ ls
asm asm-arm asm-generic asm-ia64 asm-mips asm-parisc asm-ppc64 asm-s390x asm-sparc asm-x86_64 math-emu pcmcia video
asm-alpha asm-cris asm-i386 asm-m68k asm-mips64 asm-ppc asm-s390 asm-sh asm-sparc64 linux net scsi
[fedora@localhost include]$ cd asm
[fedora@localhost asm]$ ln -s arch-epxa/ arch
[fedora@localhost asm]$ ln -s proc-armv proc
[fedora@localhost asm]$ mkdir -p $TARGET_PREFIX/include
[fedora@localhost asm]$ cp -r $PROJROOT/kernel/linux-2.4.21/include/linux $TARGET_PREFIX/include
cp: 无法 stat “/kernel/linux-2.4.21/include/linux”: 没有那个文件或目录
[fedora@localhost asm]$ cp -r $PRJROOT/kernel/linux-2.4.21/include/linux $TARGET_PREFIX/include
[fedora@localhost asm]$ cp -r $PRJROOT/kernel/linux-2.4.21/include/asm-arm $TARGET_PREFIX/include/asm
[fedora@localhost asm]$
[fedora@localhost src-dir]$ #binutils' setup
[fedora@localhost src-dir]$ cd $PRJROOT/src-dir
[fedora@localhost src-dir]$ tar zxvf ../setup-dir/binutils-2.11.2.tar.gz
[fedora@localhost src-dir]$ cd $PRJROOT/build-dir/build-binutils
[fedora@localhost build-binutils]$
[fedora@localhost build-binutils]$ ../../src-dir/binutils-2.11.2/configure --target=$TARGET --prefix=$PREFIX
[fedora@localhost build-binutils]$ ../../src-dir/binutils-2.11.2/configure --target=$TARGET --prefix=$PREFIX
expr: 语法错误
Configuring for a i686-pc-linux-gnu host.
config.sub: missing argument
Try `config.sub --help' for more information.
Unrecognized target system name .
[fedora@localhost build-binutils]$ echo $TARGET
[fedora@localhost build-binutils]$ . /home/fedora/lqm/embedded-system/doc/scripts/hjbl
[fedora@localhost build-binutils]$ echo $TARGET
[fedora@localhost build-binutils]$ vi /home/fedora/lqm/embedded-system/doc/scripts/hjbl
[fedora@localhost build-binutils]$ cat -n /home/fedora/lqm/embedded-system/doc/scripts/hjbl
1 export PRJROOT=/home/fedora/lqm/embedded-system
2 export TARGET=arm-linux #原来错成targeg了
3 export PREFIX=$PRJROOT/tool-chain
4 export TARGET_PREFIX=$PREFIX/$TARGET
5 export PATH=$PREFIX/bin:$PATH
[fedora@localhost build-binutils]$
[fedora@localhost build-binutils]$ . /home/fedora/lqm/embedded-system/doc/scripts/hjbl
[fedora@localhost build-binutils]$ echo $TARGET
arm-linux
[fedora@localhost build-binutils]$
[fedora@localhost build-binutils]$ ../../src-dir/binutils-2.11.2/configure --target=$TARGET --prefix=$PREFIX
[fedora@localhost build-binutils]$ make
[fedora@localhost build-binutils]$ make install
[fedora@localhost build-binutils]$ ls $PREFIX/bin #验证安装
arm-linux-addr2line arm-linux-as arm-linux-gasp arm-linux-nm arm-linux-objdump arm-linux-readelf arm-linux-strings
arm-linux-ar arm-linux-c++filt arm-linux-ld arm-linux-objcopy arm-linux-ranlib arm-linux-size arm-linux-strip
[fedora@localhost build-binutils]$