【微赢 源码】【文件监控源码】【wegame饥荒源码】重载内核源码_重载内核源码是什么
1.å¦ä½ä¸ºåµå
¥å¼å¼å建ç«äº¤åç¼è¯ç¯å¢
å¦ä½ä¸ºåµå ¥å¼å¼å建ç«äº¤åç¼è¯ç¯å¢
ããä¸é¢æ们å°ä»¥å»ºç«é对armç交åç¼è¯å¼åç¯å¢ä¸ºä¾æ¥è§£è¯´æ´ä¸ªè¿ç¨ï¼å ¶ä»çä½ç³»ç»æä¸è¿ä¸ªç¸ç±»ä¼¼ï¼åªè¦ä½ä¸äºå¯¹åºçæ¹å¨ãæçå¼åç¯å¢æ¯ï¼å®¿ä¸»æº i-redhat-7.2ï¼ç®æ æº armã
ããè¿ä¸ªè¿ç¨å¦ä¸
ãã1. ä¸è½½æºæ件ãè¡¥ä¸å建ç«ç¼è¯çç®å½
ãã2. 建ç«å æ ¸å¤´æ件
ãã3. 建ç«äºè¿å¶å·¥å ·ï¼binutilsï¼
ãã4. 建ç«åå§ç¼è¯å¨ï¼bootstrap gccï¼
ãã5. 建ç«cåº(glibc)
ãã6. 建ç«å ¨å¥ç¼è¯å¨ï¼full gccï¼
ããä¸è½½æºæ件ãè¡¥ä¸å建ç«ç¼è¯çç®å½
ãã1. éå®è½¯ä»¶çæ¬å·
ããéæ©è½¯ä»¶çæ¬å·æ¶ï¼å ççglibcæºä»£ç ä¸çINSTALLæ件ãé£éå举äºè¯¥çæ¬çglibcç¼è¯æ¶æéçbinutils ågccççæ¬å·ãä¾å¦å¨ glibc-2.2.3/INSTALL æ件ä¸æ¨è gcc ç¨ 2.以ä¸ï¼binutils ç¨ 2..1 以ä¸çæ¬ã
ããæéçå个软件ççæ¬æ¯ï¼
ããlinux-2.4.+rmk2
ããbinutils-2..1
ããgcc-2..3
ããglibc-2.2.3
ããglibc-linuxthreads-2.2.3
ããå¦æä½ éçglibcççæ¬å·ä½äº2.2ï¼ä½ è¿è¦ä¸è½½ä¸ä¸ªå«glibc-cryptçæ件ï¼ä¾å¦glibc-crypt-2.1.tar.gzã Linux å æ ¸ä½ å¯ä»¥ä»www.kernel.org æå®çéåä¸è½½ã
ããBinutilsãgccåglibcä½ å¯ä»¥ä»FSFçFTPç«ç¹ftp://ftp.gun.org/gnu/ æå®çéåå»ä¸è½½ã å¨ç¼è¯glibcæ¶ï¼è¦ç¨å° Linux å æ ¸ä¸ç include ç®å½çå æ ¸å¤´æ件ãå¦æä½ åç°æåé没æå®ä¹è导è´ç¼è¯å¤±è´¥ï¼ä½ å°±æ¹åä½ çå æ ¸çæ¬å·ãä¾å¦æå¼å§ç¨linux-2.4.+vrs2ï¼ç¼è¯glibc-2.2.3 æ¶æ¥ BUS_ISA 没å®ä¹ï¼åæ¥åç°å¨ 2.4. å¼å§å®çåå被æ¹ä¸º CTL_BUS_ISAãå¦æä½ æ²¡æå®å ¨çææ¡ä¿è¯ä½ æ¹çå æ ¸æ¹å®å ¨äºï¼å°±ä¸è¦å¨å æ ¸ï¼èæ¯æä½ ç Linux å æ ¸ççæ¬å·éä½æåé«ï¼æ¥éåº glibcã
ããGcc ççæ¬å·ï¼æ¨èç¨ gcc-2. 以ä¸çã太èççæ¬ç¼è¯å¯è½ä¼åºé®é¢ãGcc-2..3 æ¯ä¸ä¸ªæ¯è¾ç¨³å®ççæ¬ï¼ä¹æ¯å æ ¸å¼å人åæ¨èç¨çä¸ä¸ª gcc çæ¬ã
ããå¦æä½ åç°æ æ³ç¼è¯è¿å»ï¼æå¯è½æ¯ä½ éç¨ç软件ä¸æçå å ¥äºä¸äºæ°çç¹æ§èå ¶ä»æé软件ä¸æ¯æçåå ï¼å°±ç¸åºéä½è¯¥è½¯ä»¶ççæ¬å·ãä¾å¦æå¼å§ç¨ gcc-3.3.2ï¼åç°ç¼è¯ä¸è¿ï¼æ¥ asãld ççæ¬å¤ªèï¼æå°±æ gcc é为 2..3ã 太æ°ççæ¬å¤§å¤æ²¡ç»è¿å¤§éçæµè¯ï¼å»ºè®®ä¸è¦éç¨ã
ããå页é¦
ãã2. 建ç«å·¥ä½ç®å½
ããé¦å ï¼æ们建ç«å 个ç¨æ¥å·¥ä½çç®å½ï¼
ããå¨ä½ çç¨æ·ç®å½ï¼æç¨çæ¯ç¨æ·liangï¼å æ¤ç¨æ·ç®å½ä¸º /home/liangï¼å 建ç«ä¸ä¸ªé¡¹ç®ç®å½embeddedã
ãã$pwd
ãã/home/liang
ãã$mkdir embedded
ããåå¨è¿ä¸ªé¡¹ç®ç®å½ embedded ä¸å»ºç«ä¸ä¸ªç®å½ build-toolsãkernel å toolsã
ããbuild-tools-ç¨æ¥åæ¾ä½ ä¸è½½ç binutilsãgcc å glibc çæºä»£ç åç¨æ¥ç¼è¯è¿äºæºä»£ç çç®å½ã
ããkernel-ç¨æ¥åæ¾ä½ çå æ ¸æºä»£ç åå æ ¸è¡¥ä¸ã
ããtools-ç¨æ¥åæ¾ç¼è¯å¥½ç交åç¼è¯å·¥å ·ååºæ件ã
ãã$cd embedded
ãã$mkdir build-tools kernel tools
ããæ§è¡å®åç®å½ç»æå¦ä¸ï¼
ãã$ls embedded
ããbuild-tools kernel tools
ãã3. è¾åºåç¯å¢åé
ããæ们è¾åºå¦ä¸çç¯å¢åéæ¹ä¾¿æ们ç¼è¯ã
ãã$export PRJROOT=/home/liang/embedded
ãã$export TARGET=arm-linux
ãã$export PREFIX=$PRJROOT/tools
ãã$export TARGET_PREFIX=$PREFIX/$TARGET
ãã$export PATH=$PREFIX/bin:$PATH
ããå¦æä½ ä¸æ¯ç¨ç¯å¢åéçï¼ä½ å¯ä»¥ç´æ¥ç¨ç»å¯¹æç¸å¯¹è·¯å¾ãæå¦æä¸ç¨ç¯å¢åéï¼ä¸è¬é½ç¨ç»å¯¹è·¯å¾ï¼ç¸å¯¹è·¯å¾ææ¶ä¼å¤±è´¥ãç¯å¢åéä¹å¯ä»¥å®ä¹å¨.bashrcæ件ä¸ï¼è¿æ ·å½ä½ logoutææ¢äºæ§å¶å°æ¶ï¼å°±ä¸ç¨èæ¯exportè¿äºåéäºã
ããä½ç³»ç»æåä½ çTAEGETåéç对åºå¦ä¸è¡¨
ããä½ å¯ä»¥å¨éè¿glibcä¸çconfig.subèæ¬æ¥ç¥éï¼ä½ çTARGETåéæ¯å¦è¢«æ¯æï¼ä¾å¦ï¼
ãã$./config.sub arm-linux
ããarm-unknown-linux-gnu
ããå¨æçç¯å¢ä¸ï¼config.sub å¨ glibc-2.2.3/scripts ç®å½ä¸ã
ããç½ä¸è¿æä¸äº HOWTO å¯ä»¥åèï¼ARM ä½ç³»ç»æçãThe GNU Toolchain for ARM Target HOWTOãï¼PowerPC ä½ç³»ç»æçãLinux for PowerPC Embedded Systems HOWTOãçã对TARGETçéåå¯è½æ帮å©ã
ãã4. 建ç«ç¼è¯ç®å½
ãã为äºææºç åç¼è¯æ¶çæçæ件åå¼ï¼ä¸è¬çç¼è¯å·¥ä½ä¸å¨çæºç ç®å½ä¸ï¼è¦å¦å»ºä¸ä¸ªç®å½æ¥ä¸é¨ç¨äºç¼è¯ãç¨ä»¥ä¸çå½ä»¤æ¥å»ºç«ç¼è¯ä½ ä¸è½½çbinutilsãgccåglibcçæºä»£ç çç®å½ã
ãã$cd $PRJROOT/build-tools
ãã$mkdir build-binutils build-boot-gcc build-gcc build-glibc gcc-patch
ããbuild-binutils-ç¼è¯binutilsçç®å½
ããbuild-boot-gcc-ç¼è¯gcc å¯å¨é¨åçç®å½
ããbuild-glibc-ç¼è¯glibcçç®å½
ããbuild-gcc-ç¼è¯gcc å ¨é¨çç®å½
ããgcc-patch-æ¾gccçè¡¥ä¸çç®å½
ããgcc-2..3 çè¡¥ä¸æ gcc-2..3-2.patchãgcc-2..3-no-fixinc.patch ågcc-2..3-returntype-fix.patchï¼å¯ä»¥ä» http://www.linuxfromscratch.org/ ä¸è½½å°è¿äºè¡¥ä¸ã
ããåå°ä½ ä¸è½½ç binutils-2..1ãgcc-2..3ãglibc-2.2.3 å glibc-linuxthreads-2.2.3 çæºä»£ç æ¾å ¥ build-tools ç®å½ä¸
ããçä¸ä¸ä½ ç build-tools ç®å½ï¼æ以ä¸å 容ï¼
ãã$ls
ããbinutils-2..1.tar.bz2 build-gcc gcc-patch
ããbuild-binutls build-glibc glibc-2.2.3.tar.gz
ããbuild-boot-gcc gcc-2..3.tar.gz glibc-linuxthreads-2.2.3.tar.gz
ããå页é¦
ãã建ç«å æ ¸å¤´æ件
ããæä½ ä» www.kernel.org ä¸è½½çå æ ¸æºä»£ç æ¾å ¥ $PRJROOT /kernel ç®å½
ããè¿å ¥ä½ ç kernel ç®å½ï¼
ãã$cd $PRJROOT /kernel
ãã解å¼å æ ¸æºä»£ç
ãã$tar -xzvf linux-2.4..tar.gz
ããæ
ãã$tar -xjvf linux-2.4..tar.bz2
ããå°äº 2.4. çå æ ¸çæ¬è§£å¼ä¼çæä¸ä¸ª linux ç®å½ï¼æ²¡å¸¦çæ¬å·ï¼å°±å°å ¶æ¹åã
ãã$mv linux linux-2.4.x
ããç» Linux å æ ¸æä¸ä½ çè¡¥ä¸
ãã$cd linux-2.4.
ãã$patch -p1 < ../patch-2.4.-rmk2
ããç¼è¯å æ ¸çæ头æ件
ãã$make ARCH=arm CROSS_COMPILE=arm-linux- menuconfig
ããä½ ä¹å¯ä»¥ç¨ config å xconfig æ¥ä»£æ¿ menuconfigï¼ä½è¿æ ·ç¨å¯è½ä¼æ²¡æ设置æäºé ç½®æ件é项å没æçæä¸é¢ç¼è¯æéç头æ件ãæ¨èå¤§å®¶ç¨ make menuconfigï¼è¿ä¹æ¯å æ ¸å¼å人åç¨çæå¤çé ç½®æ¹æ³ãé ç½®å®éåºå¹¶ä¿åï¼æ£æ¥ä¸ä¸çå æ ¸ç®å½ä¸ç include/linux/version.h å include/linux/autoconf.h æ件æ¯ä¸æ¯çæäºï¼è¿æ¯ç¼è¯ glibc æ¯è¦ç¨å°çï¼version.h å autoconf.h æ件çåå¨ï¼ä¹è¯´æäºä½ çæäºæ£ç¡®ç头æ件ã
ããè¿è¦å»ºç«å 个æ£ç¡®çé¾æ¥
ãã$cd include
ãã$ln -s asm-arm asm
ãã$cd asm
ãã$ln -s arch-epxa arch
ãã$ln -s proc-armv proc
ããæ¥ä¸æ¥ä¸ºä½ ç交åç¼è¯ç¯å¢å»ºç«ä½ çå æ ¸å¤´æ件çé¾æ¥
ãã$mkdir -p $TARGET_PREFIX/include
ãã$ln -s $PRJROOT/kernel/linux-2.4./include/linux $TARGET_PREFIX/include/linux
ãã$in -s $PRJROOT/kernel/linux-2.4./include/asm-arm $TARGET_PREFIX/include/asm
ããä¹å¯ä»¥æ Linux å æ ¸å¤´æ件æ·è´è¿æ¥ç¨
ãã$mkdir -p $TARGET_PREFIX/include
ãã$cp -r $PRJROOT/kernel/linux-2.4./include/linux $TARGET_PREFIX/include
ãã$cp -r $PRJROOT/kernel/linux-2.4./include/asm-arm $TARGET_PREFIX/include
ããå页é¦
ãã建ç«äºè¿å¶å·¥å ·ï¼binutilsï¼
ããbinutilsæ¯ä¸äºäºè¿å¶å·¥å ·çéåï¼å ¶ä¸å å«äºæ们常ç¨å°çasåldã
ããé¦å ï¼æ们解åæ们ä¸è½½çbinutilsæºæ件ã
ãã$cd $PRJROOT/build-tools
ãã$tar -xvjf binutils-2..1.tar.bz2
ããç¶åè¿å ¥build-binutilsç®å½é ç½®åç¼è¯binutilsã
ãã$cd build-binutils
ãã$../binutils-2..1/configure --target=$TARGET --prefix=$PREFIX
ãã--target é项æ¯æåºæ们çæçæ¯ arm-linux çå·¥å ·ï¼--prefix æ¯æåºæ们å¯æ§è¡æ件å®è£ çä½ç½®ã
ããä¼åºç°å¾å¤ checkï¼æå产ç Makefile æ件ã
ããæäº Makefile åï¼æ们æ¥ç¼è¯å¹¶å®è£ binutilsï¼å½ä»¤å¾ç®åã
ãã$make
ãã$make install
ããçä¸ä¸æ们 $PREFIX/bin ä¸ççæçæ件
ãã$ls $PREFIX/bin
ããarm-linux-addr2line arm-linux-gasp arm-linux-objdump arm-linux-strings
ããarm-linux-ar arm-linux-ld arm-linux-ranlib arm-linux-strip
ããarm-linux-as arm-linux-nm arm-linux-readelf
ããarm-linux-c++filt arm-linux-objcopy arm-linux-size
ããæ们æ¥è§£éä¸ä¸ä¸é¢çæçå¯æ§è¡æ件é½æ¯ç¨æ¥å¹²ä»ä¹ç
ããadd2line - å°ä½ è¦æ¾çå°å转ææ件åè¡å·ï¼å®è¦ä½¿ç¨ debug ä¿¡æ¯ã
ããAr-产çãä¿®æ¹å解å¼ä¸ä¸ªåæ¡£æ件
ããAs-gnu çæ±ç¼å¨
ããC++filt-C++ å java ä¸æä¸ç§éè½½å½æ°ï¼æç¨çéè½½å½æ°æåä¼è¢«ç¼è¯è½¬åææ±ç¼çæ å·ï¼c++filt å°±æ¯å®ç°è¿ç§ååç转åï¼æ ¹æ®æ å·å¾å°å½æ°åã
ããGasp-gnu æ±ç¼å¨é¢ç¼è¯å¨ã
ããLd-gnu çè¿æ¥å¨
ããNm-ååºç®æ æ件ç符å·å对åºçå°å
ããObjcopy-å°æç§æ ¼å¼çç®æ æ件转åæå¦å¤æ ¼å¼çç®æ æ件
ããObjdump-æ¾ç¤ºç®æ æ件çä¿¡æ¯
ããRanlib-为ä¸ä¸ªåæ¡£æ件产çä¸ä¸ªç´¢å¼ï¼å¹¶å°è¿ä¸ªç´¢å¼åå ¥åæ¡£æ件ä¸
ããReadelf-æ¾ç¤º elf æ ¼å¼çç®æ æ件çä¿¡æ¯
ããSize-æ¾ç¤ºç®æ æ件å个èç大å°åç®æ æ件ç大å°
ããStrings-æå°åºç®æ æ件ä¸å¯ä»¥æå°çå符串ï¼æ个é»è®¤çé¿åº¦ï¼ä¸º4
ããStrip-å¥æç®æ æ件çææç符å·ä¿¡æ¯
ããå页é¦
ãã建ç«åå§ç¼è¯å¨ï¼bootstrap gccï¼
ããé¦å è¿å ¥ build-tools ç®å½ï¼å°ä¸è½½ gcc æºä»£ç 解å
ãã$cd $PRJROOT/build-tools
ãã$tar -xvzf gcc-2..3.tar.gz
ããç¶åè¿å ¥ gcc-2..3 ç®å½ç» gcc æä¸è¡¥ä¸
ãã$cd gcc-2..3
ãã$patch -p1< ../gcc-patch/gcc-2..3.-2.patch
ãã$patch -p1< ../gcc-patch/gcc-2..3.-no-fixinc.patch
ãã$patch -p1< ../gcc-patch/gcc-2..3-returntype-fix.patch
ããecho timestamp > gcc/cstamp-h.in
ããå¨æ们ç¼è¯å¹¶å®è£ gcc åï¼æ们å è¦æ¹ä¸ä¸ªæ件 $PRJROOT/gcc/config/arm/t-linuxï¼æ
ããTARGET_LIBGCC2-CFLAGS = -fomit-frame-pointer -fPIC
ããè¿ä¸è¡æ¹ä¸º
ããTARGET_LIBGCC2-CFLAGS = -fomit-frame-pointer -fPIC -Dinhibit_libc -D__gthr_posix_h
ããä½ å¦æ没å®ä¹ -Dinhibitï¼ç¼è¯æ¶å°ä¼æ¥å¦ä¸çé误
ãã../../gcc-2..3/gcc/libgcc2.c:: stdlib.h: No such file or directory
ãã../../gcc-2..3/gcc/libgcc2.c:: unistd.h: No such file or directory
ããmake[3]: *** [libgcc2.a] Error 1
ããmake[2]: *** [stmp-multilib-sub] Error 2
ããmake[1]: *** [stmp-multilib] Error 1
ããmake: *** [all-gcc] Error 2
ããå¦æ没æå®ä¹ -D__gthr_posix_hï¼ç¼è¯æ¶ä¼æ¥å¦ä¸çé误
ããIn file included from gthr-default.h:1,
ããfrom ../../gcc-2..3/gcc/gthr.h:,
ããfrom ../../gcc-2..3/gcc/libgcc2.c::
ãã../../gcc-2..3/gcc/gthr-posix.h:: pthread.h: No such file or directory
ããmake[3]: *** [libgcc2.a] Error 1
ããmake[2]: *** [stmp-multilib-sub] Error 2
ããmake[1]: *** [stmp-multilib] Error 1
ããmake: *** [all-gcc] Error 2
ããè¿æä¸ç§ä¸-Dinhibitåçææçæ¹æ³ï¼é£å°±æ¯å¨ä½ é ç½®configureæ¶å¤å ä¸ä¸ªåæ°-with-newlibï¼è¿ä¸ªé项ä¸ä¼è¿«ä½¿æä»¬å¿ é¡»ä½¿ç¨newlibãæ们ç¼è¯äºbootstrap-gccåï¼ä»ç¶å¯ä»¥éæ©ä»»ä½cåºã
ããæ¥çå°±æ¯é ç½®boostrap gccï¼ åé¢è¦ç¨bootstrap gcc æ¥ç¼è¯ glibc åºã
ãã$cd ..; cd build-boot-gcc
ãã$../gcc-2..3/configure --target=$TARGET --prefix=$PREFIX \
ãã>--without-headers --enable-languages=c --disable-threads
ããè¿æ¡å½ä»¤ä¸ç -targetã--prefix åé ç½® binutils çå«ä¹æ¯ç¸åçï¼--without-headers å°±æ¯æä¸éè¦å¤´æ件ï¼å 为æ¯äº¤åç¼è¯å·¥å ·ï¼ä¸éè¦æ¬æºä¸ç头æ件ã-enable-languages=cæ¯ææ们ç boot-gcc åªæ¯æ c è¯è¨ã--disable-threads æ¯å»æ thread åè½ï¼è¿ä¸ªåè½éè¦ glibc çæ¯æã
ããæ¥çæ们ç¼è¯å¹¶å®è£ boot-gcc
ãã$make all-gcc
ãã$make install-gcc
ããæ们æ¥çç $PREFIX/bin éé¢å¤äºåªäºä¸è¥¿
ãã$ls $PREFIX/bin
ããä½ ä¼åç°å¤äº arm-linux-gcc ãarm-linux-unprotoizeãcpp å gcov å 个æ件ã
ããGcc-gnu ç C è¯è¨ç¼è¯å¨
ããUnprotoize-å° ANSI C çæºç 转å为 K&R C çå½¢å¼ï¼å»æå½æ°ååä¸çåæ°ç±»åã
ããCpp-gnuç C çé¢ç¼è¯å¨
ããGcov-gcc çè¾ å©æµè¯å·¥å ·ï¼å¯ä»¥ç¨å®æ¥åæåä¼ç¨åºã
ããä½¿ç¨ gcc3.2 以å gcc3.2 以ä¸çæ¬æ¶ï¼é ç½® boot-gcc ä¸è½ä½¿ç¨ --without-headers é项ï¼èéè¦ä½¿ç¨ glibc ç头æ件ã
ããå页é¦
ããå»ºç« c åº(glibc)
ããé¦å 解å glibc-2.2.3.tar.gz å glibc-linuxthreads-2.2.3.tar.gz æºä»£ç
ãã$cd $PRJROOT/build-tools
ãã$tar -xvzf glibc-2.2.3.tar.gz
ãã$tar -xzvf glibc-linuxthreads-2.2.3.tar.gz --directory=glibc-2.2.3
ããç¶åè¿å ¥ build-glibc ç®å½é ç½® glibc
ãã$cd build-glibc
ãã$CC=arm-linux-gcc ../glibc-2.2.3/configure --host=$TARGET --prefix="/usr"
ãã--enable-add-ons --with-headers=$TARGET_PREFIX/include
ããCC=arm-linux-gcc æ¯æ CC åé设æä½ åç¼è¯å®çboostrap gccï¼ç¨å®æ¥ç¼è¯ä½ çglibcã--enable-add-onsæ¯åè¯glibcç¨ linuxthreads å ï¼å¨ä¸é¢æ们已ç»å°å®æ¾å ¥äº glibc æºç ç®å½ä¸ï¼è¿ä¸ªé项çä»·äº -enable-add-ons=linuxthreadsã--with-headers åè¯ glibc æ们çlinux å æ ¸å¤´æ件çç®å½ä½ç½®ã
ããé ç½®å®åå°±å¯ä»¥ç¼è¯åå®è£ glibc
ãã$make
ãã$make install_root=$TARGET_PREFIX prefix="" install
ããç¶åä½ è¿è¦ä¿®æ¹ libc.so æ件
ããå°
ããGROUP ( /lib/libc.so.6 /lib/libc_nonshared.a)
ããæ¹ä¸º
ããGROUP ( libc.so.6 libc_nonshared.a)
ããè¿æ ·è¿æ¥ç¨åº ld å°±ä¼å¨ libc.so æå¨çç®å½æ¥æ¾å®éè¦çåºï¼å ä¸ºä½ çæºåç/libç®å½å¯è½å·²ç»è£ äºä¸ä¸ªç¸åååçåºï¼ä¸ä¸ªä¸ºç¼è¯å¯ä»¥å¨ä½ ç宿主æºä¸è¿è¡çç¨åºçåºï¼èä¸æ¯ç¨äºäº¤åç¼è¯çã
ããå页é¦
ãã建ç«å ¨å¥ç¼è¯å¨ï¼full gccï¼
ããå¨å»ºç«boot-gcc çæ¶åï¼æ们åªæ¯æäºCãå°è¿éï¼æ们就è¦å»ºç«å ¨å¥ç¼è¯å¨ï¼æ¥æ¯æCåC++ã
ãã$cd $PRJROOT/build-tools/build-gcc
ãã$../gcc-2..3/configure --target=$TARGET --prefix=$PREFIX --enable-languages=c,c++
ãã--enable-languages=c,c++ åè¯ full gcc æ¯æ c å c++ è¯è¨ã
ããç¶åç¼è¯åå®è£ ä½ ç full gcc
ãã$make all
ãã$make install
ããæ们åæ¥çç $PREFIX/bin éé¢å¤äºåªäºä¸è¥¿
ãã$ls $PREFIX/bin
ããä½ ä¼åç°å¤äº arm-linux-g++ ãarm-linux-protoize å arm-linux-c++ å 个æ件ã
ããG++-gnuç c++ ç¼è¯å¨ã
ããProtoize-ä¸Unprotoizeç¸åï¼å°K&R Cçæºç 转å为ANSI Cçå½¢å¼ï¼å½æ°ååä¸å å ¥åæ°ç±»åã
ããC++-gnu ç c++ ç¼è¯å¨ã
ããå°è¿éä½ ç交åç¼è¯å·¥å ·å°±ç®åå®äºï¼ç®åéªè¯ä¸ä¸ä½ ç交åç¼è¯å·¥å ·ã
ããç¨å®æ¥ç¼è¯ä¸ä¸ªå¾ç®åçç¨åº helloworld.c
ãã#include <stdio.h>
ããint main(void)
ãã{
ããprintf("hello world\n");
ããreturn 0;
ãã}
ãã$arm-linux-gcc helloworld.c -o helloworld
ãã$file helloworld
ããhelloworld: ELF -bit LSB executable, ARM, version 1,
ããdynamically linked (uses shared libs), not stripped
ããä¸é¢çè¾åºè¯´æä½ ç¼è¯äºä¸ä¸ªè½å¨ arm ä½ç³»ç»æä¸è¿è¡ç helloworldï¼è¯æä½ çç¼è¯å·¥å ·åæåäºã
è½¬è½½ä» ä¾åèï¼çæå±äºåä½è