(1)機器現況
# uname -a Linux w3-kmvs-km-edu-tw 4.4.14-200.fc22.x86_64 #1 SMP Fri Jun 24 21:19:33 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
(2)下載核心壓縮檔:
wget https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/linux-4.20.tar.gz
:
2019-01-16 07:53:04 (784 KB/s) - ‘linux-4.20.tar.gz’ saved [161141903/161141903]
(3)解開核心# tar xvzf linux-4.20.tar.gz
(4)用現有的組態為預設值建立核心組態
# uname -r 4.4.14-200.fc22.x86_64
# cp /boot/config-4.4.14-200.fc22.x86_64 /root/inux-4.20
(5) # make menuconfig
HOSTCC scripts/basic/fixdep UPD scripts/kconfig/.mconf-cfg HOSTCC scripts/kconfig/mconf.o YACC scripts/kconfig/zconf.tab.c /bin/sh: bison:命令找不到 scripts/Makefile.lib:196: recipe for target 'scripts/kconfig/zconf.tab.c' failed make[1]: *** [scripts/kconfig/zconf.tab.c] Error 127 Makefile:544: recipe for target 'menuconfig' failed make: *** [menuconfig] Error 2
(6)# yum install bison
(6b)# make menuconfig YACC scripts/kconfig/zconf.tab.c LEX scripts/kconfig/zconf.lex.c /bin/sh: flex:命令找不到 scripts/Makefile.lib:188: recipe for target 'scripts/kconfig/zconf.lex.c' failed make[1]: *** [scripts/kconfig/zconf.lex.c] Error 127 Makefile:544: recipe for target 'menuconfig' failed make: *** [menuconfig] Error 2
(6c)# yum install flex
(6d)# make menuconfig 終於成功
(7)# make
You are building kernel with non-retpoline compiler. Please update your compiler. arch/x86/Makefile:302: recipe for target 'checkbin' failed make: *** [checkbin] Error 1 [root@w3-kmvs-km-edu-tw linux-4.20]#
仍未成功
(8)#wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-7.4.0/gcc-7.4.0.tar.gz
:
2019-01-18 10:35:46 (635 KB/s) - ‘gcc-7.4.0.tar.gz’ saved [112420370/112420370]
(9)解開
# tar xvzf gcc-7.4.0.tar.gz
#cd /root/gcc-7.4.0
(10)安裝說明網頁:http://gcc.gnu.org/install/
(11)下載支援的程式庫並建立符號連結以支持建立GCC
# ./contrib/download_prerequisites
:
gmp-6.1.0.tar.bz2: 正確 mpfr-3.1.4.tar.bz2: 正確 mpc-1.0.3.tar.gz: 正確 isl-0.16.1.tar.bz2: 正確 All prerequisites downloaded successfully.
(12)建立組態失敗:
# cd ..
# mkdir gcc7obj
# cd gcc7obj
# ../gcc-7.4.0/configure --prefix=$HOME/GCC-7.4.0 --enable-languages=c,c++,fortran,go
:
configure: WARNING: using in-tree isl, disabling version check *** This configuration is not supported in the following subdirectories: gnattools target-libada target-libhsail-rt target-libobjc target-liboffload mic (Any other directories should still work fine.) checking for default BUILD_CONFIG... bootstrap-debug checking for --enable-vtable-verify... no /usr/bin/ld: cannot find crt1.o: No such file or directory /usr/bin/ld: cannot find crti.o: No such file or directory /usr/bin/ld: cannot find -lc /usr/bin/ld: cannot find crtn.o: No such file or directory collect2: error: ld returned 1 exit status configure: error: I suspect your system does not have 32-bit development libraries (libc and headers). If you have them, rerun configure with --enable-multilib.
If you do not have them, and want to build a 64-bit-only compiler, rerun configure with --disable-multilib.
(12b)重組態ok:
# ../gcc-7.4.0/configure --prefix=$HOME/GCC-7.4.0 --enable-languages=c,c++,fortran,go --disable-multilib
:
configure: creating ./config.status config.status: creating Makefile
(13) # make
要編譯很久…
(14)
]# ls gcc7obj -lt 總計 1436 drwxr-xr-x 17 root root 4096 1月 18 14:26 x86_64-pc-linux-gnu drwxr-xr-x 3 root root 4096 1月 18 14:21 gotools drwxr-xr-x 4 root root 4096 1月 18 14:16 libcc1 drwxr-xr-x 2 root root 4096 1月 18 14:16 fixincludes -rw-r--r-- 1 root root 7 1月 18 14:16 stage_current -rw-r--r-- 1 root root 7 1月 18 14:16 stage_last -rw-r--r-- 1 root root 10 1月 18 14:16 compare drwxr-xr-x 2 root root 4096 1月 18 14:16 prev-zlib drwxr-xr-x 2 root root 4096 1月 18 14:16 zlib drwxr-xr-x 4 root root 4096 1月 18 14:16 libiberty drwxr-xr-x 4 root root 4096 1月 18 14:16 prev-libiberty drwxr-xr-x 2 root root 4096 1月 18 14:16 libdecnumber drwxr-xr-x 2 root root 4096 1月 18 14:16 prev-libdecnumber drwxr-xr-x 3 root root 4096 1月 18 14:16 libcpp drwxr-xr-x 3 root root 4096 1月 18 14:16 prev-libcpp drwxr-xr-x 3 root root 4096 1月 18 14:16 libbacktrace drwxr-xr-x 3 root root 4096 1月 18 14:16 prev-libbacktrace drwxr-xr-x 7 root root 12288 1月 18 14:16 isl drwxr-xr-x 7 root root 12288 1月 18 14:16 prev-isl drwxr-xr-x 15 root root 4096 1月 18 14:16 gmp drwxr-xr-x 15 root root 4096 1月 18 14:16 prev-gmp drwxr-xr-x 19 root root 32768 1月 18 14:16 gcc drwxr-xr-x 19 root root 32768 1月 18 14:16 prev-gcc drwxr-xr-x 3 root root 4096 1月 18 14:00 lto-plugin drwxr-xr-x 5 root root 4096 1月 18 13:59 mpc drwxr-xr-x 6 root root 4096 1月 18 13:58 mpfr drwxr-xr-x 2 root root 4096 1月 18 13:57 intl drwxr-xr-x 5 root root 4096 1月 18 13:56 prev-x86_64-pc-linux-gnu drwxr-xr-x 3 root root 4096 1月 18 12:47 prev-lto-plugin drwxr-xr-x 5 root root 4096 1月 18 12:42 prev-mpc drwxr-xr-x 6 root root 4096 1月 18 12:40 prev-mpfr drwxr-xr-x 2 root root 4096 1月 18 12:38 prev-intl drwxr-xr-x 2 root root 4096 1月 18 12:38 prev-fixincludes drwxr-xr-x 5 root root 4096 1月 18 12:30 stage1-x86_64-pc-linux-gnu drwxr-xr-x 19 root root 32768 1月 18 12:30 stage1-gcc drwxr-xr-x 2 root root 4096 1月 18 12:22 stage1-libdecnumber drwxr-xr-x 3 root root 4096 1月 18 12:22 stage1-libcpp drwxr-xr-x 3 root root 4096 1月 18 12:22 stage1-libbacktrace drwxr-xr-x 2 root root 4096 1月 18 12:22 stage1-zlib drwxr-xr-x 5 root root 4096 1月 18 12:21 build-x86_64-pc-linux-gnu drwxr-xr-x 3 root root 4096 1月 18 12:21 stage1-lto-plugin drwxr-xr-x 4 root root 4096 1月 18 12:21 stage1-libiberty drwxr-xr-x 7 root root 12288 1月 18 12:21 stage1-isl drwxr-xr-x 5 root root 4096 1月 18 12:20 stage1-mpc drwxr-xr-x 6 root root 4096 1月 18 12:20 stage1-mpfr drwxr-xr-x 15 root root 4096 1月 18 12:20 stage1-gmp drwxr-xr-x 2 root root 4096 1月 18 12:19 stage1-intl drwxr-xr-x 2 root root 4096 1月 18 12:19 stage1-fixincludes -rw-r--r-- 1 root root 7 1月 18 12:19 stage_final -rw-r--r-- 1 root root 26811 1月 18 12:17 config.log -rw-r--r-- 1 root root 1077363 1月 18 12:17 Makefile -rwxr-xr-x 1 root root 35455 1月 18 12:17 config.status -rw-r--r-- 1 root root 13 1月 18 12:17 serdep.tmp [root@w3-kmvs-km-edu-tw ~]#
|