[john@localhost build-binutils]$ # 6
[john@localhost build-binutils]$ cd $PRJROOT/setup-dir
[john@localhost setup-dir]$ mv gcc-core-2.95.3.tar.gz gcc-2.95.3.tar.gz #rename
[john@localhost setup-dir]$ ls
binutils-2.11.2.tar.gz glibc-2.2.4.tar.gz patch-2.4.21-rmk1
gcc-2.95.3.tar.gz glibc-linuxthreads-2.2.4.tar.gz
gcc-g++-2.95.3.tar.gz linux-2.4.21.tar.gz
[john@localhost setup-dir]$ cd $PRJROOT/src-dir
[john@localhost src-dir]$ tar zxvf ../setup-dir/gcc-2.95.3.tar.gz
[john@localhost build-gcc]$ ../../src-dir/gcc-2.95.3/configure --target=$TARGET --prefix=$PREFIX --without-headers --enable-languages=c
[john@localhost build-gcc]$ vi ../../src-dir/gcc-2.95.3/gcc/config/arm/t-linux
[john@localhost build-gcc]$ #modified :TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC -Dinhibit_libc -D__gthr_posix_h
[john@localhost build-gcc]$ make
../../../src-dir/gcc-2.95.3/gcc/config/arm/arm.c: 在函数‘arm_override_options’中:
../../../src-dir/gcc-2.95.3/gcc/config/arm/arm.c:286: 警告:赋值丢弃了指针目标类型的限定
../../../src-dir/gcc-2.95.3/gcc/config/arm/arm.c:530: 错误:赋值运算的左操作数必须是左值
# arm_prog_mode = TARGET_APCS_32 ? PROG_MODE_PROG32 : PROG_MODE_PROG26;
#slove this problem:
#http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2007-October/129673.html
make[1]: *** [arm.o] 错误 1
make[1]: Leaving directory `/home/john/embedded-system/build-dir/build-gcc/gcc'
make: *** [all-gcc] 错误 2
[john@localhost build-gcc]$
#slove this problem:
#http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2007-October/129673.html
[john@localhost build-gcc]$ make
#pass
[john@localhost build-gcc]$ make install
[john@localhost ~]$ #7
[john@localhost ~]$ cd embedded-system/
[john@localhost embedded-system]$ . doc/scripts/hjbl
[john@localhost embedded-system]$ cd $PRJROOT/src-dir
[john@localhost src-dir]$ tar zxvf ../setup-dir/glibc-2.2.4.tar.gz
[john@localhost src-dir]$ tar zxvf ../setup-dir/glibc-linuxthreads-2.2.4.tar.gz --directory=glibc-2.2.4
[john@localhost src-dir]$ cd $PRJROOT/build-dir/build-glibc
[john@localhost build-glibc]$ CC=arm-linux-gcc ../../src-dir/glibc-2.2.4/configure --host=$TARGET --prefix="/usr" --enable-add-ons --with-headers=$TARGET_PREFIX/include
[john@localhost build-glibc]$ make
[john@localhost build-glibc]$ #make install_root=$TARGET_PREFIX prefix=""install #error:there is a blank before the last word --install
[john@localhost build-glibc]$ make install_root=$TARGET_PREFIX prefix="" install
[john@localhost build-glibc]$ cd $TARGET_PREFIX/lib
[john@localhost lib]$ ls
[john@localhost lib]$ cp ./libc.so ./libc.so.orig
[john@localhost lib]$
[john@localhost lib]$ vi libc.so
[john@localhost lib]$ cat -n lib.so
cat: lib.so: 没有那个文件或目录
[john@localhost lib]$ cat -n libc.so
1 /* GNU ld script
2 Use the shared library, but some functions are only in
3 the static library, so try that secondarily. */
4 /*before modify: GROUP ( /lib/libc.so.6 /lib/libc_nonshared.a )*/
5 GROUP ( libc.so.6 libc_nonshared.a )
[john@localhost lib]$
[john@localhost lib]$ # 8
[john@localhost lib]$ # 8
[john@localhost lib]$ cd $PRJROOT/build-dir/build-gcc
[john@localhost build-gcc]$ ../../src-dir/gcc-2.95.3/configure --target=$TARGET --prefix=$PREFIX --enable-languages=c,c++
[john@localhost build-gcc]$ make all
[john@localhost build-gcc]$ make install
[john@localhost build-gcc]$
[john@localhost build-gcc]$ # 9
[john@localhost build-gcc]$ cd $TARGET_PREFIX/bin
[john@localhost build-gcc]$ cd $TARGET_PREFIX/bin
[john@localhost bin]$ file as ar gcc ld nm ranlib strip
as: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
ar: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
gcc: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
ld: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
nm: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
ranlib: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
strip: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
[john@localhost bin]$
[john@localhost bin]$ arm-linux-gcc -print-search-dirs
install: /home/john/embedded-system/tool-chain/lib/gcc-lib/arm-linux/2.95.3/
programs: /home/john/embedded-system/tool-chain/lib/gcc-lib/arm-linux/2.95.3/:/home/john/embedded-system/tool-chain/lib/gcc-lib/arm-linux/:/usr/lib/gcc/arm-linux/2.95.3/:/usr/lib/gcc/arm-linux/:/home/john/embedded-system/tool-chain/arm-linux/bin/arm-linux/2.95.3/:/home/john/embedded-system/tool-chain/arm-linux/bin/
libraries: /home/john/embedded-system/tool-chain/lib/gcc-lib/arm-linux/2.95.3/:/usr/lib/gcc/arm-linux/2.95.3/:/home/john/embedded-system/tool-chain/arm-linux/lib/arm-linux/2.95.3/:/home/john/embedded-system/tool-chain/arm-linux/lib/
[john@localhost bin]$
[john@localhost bin]$ mv as ar gcc ld nm ranlib strip $PREFIX/lib/gcc-lib/arm-linux/2.95.3
[john@localhost bin]$ man file
[john@localhost bin]$ for file in as ar gcc ld nm ranlib strip
> do
> ln -s $PREFIX/lib/gcc-lib/arm-linux/2.95.3/$file
> done
[john@localhost bin]$
[john@localhost bin]$ # 10
[john@localhost bin]$ cd $PRJROOT/program
[john@localhost program]$ vi hello.c
[john@localhost program]$ cat -n hello.c
1 #include <stdio.h>
2 int main()
3 {
4 printf("hello world/n");
5 return 0;
6 }
[john@localhost program]$
[john@localhost program]$ gcc -g hello.c -o hello
[john@localhost program]$ ls
hello hello.c
[john@localhost program]$ gdb
GNU gdb Fedora (6.8-1.fc9)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu".
(gdb) file hello
Reading symbols from /home/john/embedded-system/program/hello...done.
(gdb) l
1 #include <stdio.h>
2 int main()
3 {
4 printf("hello world/n");
5 return 0;
6 }
(gdb)
(gdb) r
Starting program: /home/john/embedded-system/program/hello
hello world
Program exited normally.
Missing separate debuginfos, use: debuginfo-install glibc.i686
(gdb) q
[john@localhost program]$
[john@localhost program]$ arm-linux-gcc -g hello.c -o hello-linux
[john@localhost program]$ file hello-linux
hello-linux: ELF 32-bit LSB executable, ARM, version 1, dynamically linked (uses shared libs), for GNU/Linux 2.0.0, not stripped
[john@localhost program]$
[john@localhost build-binutils]$ cd $PRJROOT/setup-dir
[john@localhost setup-dir]$ mv gcc-core-2.95.3.tar.gz gcc-2.95.3.tar.gz #rename
[john@localhost setup-dir]$ ls
binutils-2.11.2.tar.gz glibc-2.2.4.tar.gz patch-2.4.21-rmk1
gcc-2.95.3.tar.gz glibc-linuxthreads-2.2.4.tar.gz
gcc-g++-2.95.3.tar.gz linux-2.4.21.tar.gz
[john@localhost setup-dir]$ cd $PRJROOT/src-dir
[john@localhost src-dir]$ tar zxvf ../setup-dir/gcc-2.95.3.tar.gz
[john@localhost build-gcc]$ ../../src-dir/gcc-2.95.3/configure --target=$TARGET --prefix=$PREFIX --without-headers --enable-languages=c
[john@localhost build-gcc]$ vi ../../src-dir/gcc-2.95.3/gcc/config/arm/t-linux
[john@localhost build-gcc]$ #modified :TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC -Dinhibit_libc -D__gthr_posix_h
[john@localhost build-gcc]$ make
../../../src-dir/gcc-2.95.3/gcc/config/arm/arm.c: 在函数‘arm_override_options’中:
../../../src-dir/gcc-2.95.3/gcc/config/arm/arm.c:286: 警告:赋值丢弃了指针目标类型的限定
../../../src-dir/gcc-2.95.3/gcc/config/arm/arm.c:530: 错误:赋值运算的左操作数必须是左值
# arm_prog_mode = TARGET_APCS_32 ? PROG_MODE_PROG32 : PROG_MODE_PROG26;
#slove this problem:
#http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2007-October/129673.html
make[1]: *** [arm.o] 错误 1
make[1]: Leaving directory `/home/john/embedded-system/build-dir/build-gcc/gcc'
make: *** [all-gcc] 错误 2
[john@localhost build-gcc]$
#slove this problem:
#http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2007-October/129673.html
[john@localhost build-gcc]$ make
#pass
[john@localhost build-gcc]$ make install
[john@localhost ~]$ #7
[john@localhost ~]$ cd embedded-system/
[john@localhost embedded-system]$ . doc/scripts/hjbl
[john@localhost embedded-system]$ cd $PRJROOT/src-dir
[john@localhost src-dir]$ tar zxvf ../setup-dir/glibc-2.2.4.tar.gz
[john@localhost src-dir]$ tar zxvf ../setup-dir/glibc-linuxthreads-2.2.4.tar.gz --directory=glibc-2.2.4
[john@localhost src-dir]$ cd $PRJROOT/build-dir/build-glibc
[john@localhost build-glibc]$ CC=arm-linux-gcc ../../src-dir/glibc-2.2.4/configure --host=$TARGET --prefix="/usr" --enable-add-ons --with-headers=$TARGET_PREFIX/include
[john@localhost build-glibc]$ make
[john@localhost build-glibc]$ #make install_root=$TARGET_PREFIX prefix=""install #error:there is a blank before the last word --install
[john@localhost build-glibc]$ make install_root=$TARGET_PREFIX prefix="" install
[john@localhost build-glibc]$ cd $TARGET_PREFIX/lib
[john@localhost lib]$ ls
[john@localhost lib]$ cp ./libc.so ./libc.so.orig
[john@localhost lib]$
[john@localhost lib]$ vi libc.so
[john@localhost lib]$ cat -n lib.so
cat: lib.so: 没有那个文件或目录
[john@localhost lib]$ cat -n libc.so
1 /* GNU ld script
2 Use the shared library, but some functions are only in
3 the static library, so try that secondarily. */
4 /*before modify: GROUP ( /lib/libc.so.6 /lib/libc_nonshared.a )*/
5 GROUP ( libc.so.6 libc_nonshared.a )
[john@localhost lib]$
[john@localhost lib]$ # 8
[john@localhost lib]$ # 8
[john@localhost lib]$ cd $PRJROOT/build-dir/build-gcc
[john@localhost build-gcc]$ ../../src-dir/gcc-2.95.3/configure --target=$TARGET --prefix=$PREFIX --enable-languages=c,c++
[john@localhost build-gcc]$ make all
[john@localhost build-gcc]$ make install
[john@localhost build-gcc]$
[john@localhost build-gcc]$ # 9
[john@localhost build-gcc]$ cd $TARGET_PREFIX/bin
[john@localhost build-gcc]$ cd $TARGET_PREFIX/bin
[john@localhost bin]$ file as ar gcc ld nm ranlib strip
as: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
ar: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
gcc: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
ld: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
nm: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
ranlib: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
strip: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
[john@localhost bin]$
[john@localhost bin]$ arm-linux-gcc -print-search-dirs
install: /home/john/embedded-system/tool-chain/lib/gcc-lib/arm-linux/2.95.3/
programs: /home/john/embedded-system/tool-chain/lib/gcc-lib/arm-linux/2.95.3/:/home/john/embedded-system/tool-chain/lib/gcc-lib/arm-linux/:/usr/lib/gcc/arm-linux/2.95.3/:/usr/lib/gcc/arm-linux/:/home/john/embedded-system/tool-chain/arm-linux/bin/arm-linux/2.95.3/:/home/john/embedded-system/tool-chain/arm-linux/bin/
libraries: /home/john/embedded-system/tool-chain/lib/gcc-lib/arm-linux/2.95.3/:/usr/lib/gcc/arm-linux/2.95.3/:/home/john/embedded-system/tool-chain/arm-linux/lib/arm-linux/2.95.3/:/home/john/embedded-system/tool-chain/arm-linux/lib/
[john@localhost bin]$
[john@localhost bin]$ mv as ar gcc ld nm ranlib strip $PREFIX/lib/gcc-lib/arm-linux/2.95.3
[john@localhost bin]$ man file
[john@localhost bin]$ for file in as ar gcc ld nm ranlib strip
> do
> ln -s $PREFIX/lib/gcc-lib/arm-linux/2.95.3/$file
> done
[john@localhost bin]$
[john@localhost bin]$ # 10
[john@localhost bin]$ cd $PRJROOT/program
[john@localhost program]$ vi hello.c
[john@localhost program]$ cat -n hello.c
1 #include <stdio.h>
2 int main()
3 {
4 printf("hello world/n");
5 return 0;
6 }
[john@localhost program]$
[john@localhost program]$ gcc -g hello.c -o hello
[john@localhost program]$ ls
hello hello.c
[john@localhost program]$ gdb
GNU gdb Fedora (6.8-1.fc9)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu".
(gdb) file hello
Reading symbols from /home/john/embedded-system/program/hello...done.
(gdb) l
1 #include <stdio.h>
2 int main()
3 {
4 printf("hello world/n");
5 return 0;
6 }
(gdb)
(gdb) r
Starting program: /home/john/embedded-system/program/hello
hello world
Program exited normally.
Missing separate debuginfos, use: debuginfo-install glibc.i686
(gdb) q
[john@localhost program]$
[john@localhost program]$ arm-linux-gcc -g hello.c -o hello-linux
[john@localhost program]$ file hello-linux
hello-linux: ELF 32-bit LSB executable, ARM, version 1, dynamically linked (uses shared libs), for GNU/Linux 2.0.0, not stripped
[john@localhost program]$