1.Ö±½ÓÏÂÔØÒѾ±àÒëºÃµÄÎļþ¡£ÀýÈ磺http://arm.linux.org.uk£¬ÕâÀïÌṩÒѾ±àÒëºÃµÄcross£¬Èçcross- 3.3.2.tar.bz2,cross-3.0.tar.bz2¡£Ö±½ÓÏÂÔØij¸ö°üºó½âѹ£¬È»ºó´´½¨ºÏÊʵÄÁ´½Ó»òÕßÊä³ö»·¾³±äÁ¿¼´¿Éµ÷Óá£
ÕâÖÖ×ö·¨²Ù×÷ºÜ¼òµ¥£¬µ«ÊDz»Äܸù¾Ý×Ô¼ºµÄÐèÇóÈ¥¶¨Ò壬ֻÄÜÑ¡ÔñÒѾ±àÒëºÃµÄ¶«Î÷¡£
2.×Ô¼º¶¯ÊÖÀûÓÃcrosstoolÀ´ÖÆ×÷¡£
A. ÔÚCROSSTOOL¹Ù·½ÍøÕ¾ÏÂÔØÔ´Âë°ü£¬½âѹ£¬½øÈë½âѹºóµÄĿ¼¡£
$sudo wget http://kegel.com/crosstool/crosstool-0.42.tar.gz
$sudo tar -xzvf crosstool-0.42.tar.gz
$cd crosstool-0.42
B. ÒÔROOT½¨Á¢Ä¿Â¼£¬´æ·ÅÉú³ÉµÄ½»²æ±àÒëÁ´
¸Ä±ä¸ÃĿ¼µÄËùÓÐÕßΪÆÕͨÓû§
ÀýÈ磬´æ·ÅÉú³ÉµÄ½»²æ±àÒëÁ´Ä¿Â¼Îª/opt/crosstool£¬ÈçÏÂËùʾ£º
sudo mkdir /opt/crosstool
sudo chown $USER /opt/crosstool
C.ÐÞ¸ÄÕë¶ÔÄ¿±ê°åµÄ½Å±¾Îļþ¡£
$sudo vi demo-arm.sh
£¨1£©Õ⼸¸ö»·¾³±äÁ¿¿ÉÒÔ¸ù¾Ýʵ¼ÊÇé¿öÐÞ¸Ä
TARBALLS_DIR=$HOME/downloads
RESULT_TOP=/opt/crosstool
export TARBALLS_DIR RESULT_TOP
GCC_LANGUAGES="c,c++"
export GCC_LANGUAGES
£¨2£©ÔÚÈô¸ÉÐÐevalÓï¾äÖÐÑ¡ÔñÒª½¨Á¢µÄ½»²æ±àÒëÁ´µÄ×éºÏ£¬È¥µô¸ÃÐÐevalµÄ#ºÅ¡£ÀýÈçÒª×ögccΪ3.3.3£¬glibcΪ2.3.2µÄ¹¤¾ßÁ´
eval `cat arm.dat gcc-3.4.5-glibc-2.3.6.dat` sh all.sh --notest
D.ÐÞ¸ÄÄ¿±ê°å½Å±¾Îļþdemo-arm.shÖÐevalÄÇÒ»ÐгöÏÖµÄÌåϵ½á¹¹µÄÅäÖÃÎļþ
$sudo vi arm.dat
KERNELCONFIG=`pwd`/arm.config
TARGET=arm-unknown-linux-gnu
TARGET_CFLAGS="-O"
¿ÉÒÔÐÞ¸ÄTARGET±äÁ¿Îª
TARGET=arm-S3C2410-linux-gnu£¨ÄãµÄarmÐͺţ©
E.ÐÞ¸ÄÄ¿±ê°å½Å±¾Îļþdemo-arm.shÖÐevalÄÇÒ»ÐгöÏֵŤ¾ßÁ´µÄÆ¥ÅäÎļþ
$sudo vi gcc-3.4.5-glibc-2.3.6.dat
BINUTILS_DIR=binutils-2.15
GCC_DIR=gcc-3.3.3
GLIBC_DIR=glibc-2.3.2
LINUX_DIR=linux-2.4.26
GLIBCTHREADS_FILENAME=glibc-linuxthreads-2.3.2
ÒÔÉϱäÁ¿Òª¸ù¾Ýʵ¼ÊÇé¿öÐ޸ġ£²»¹ýÀýÈçÏëÏÂÔØlinux2.6µÄ°æ±¾£¬²¢ÇÒÏÂÔØgdb×îеİ汾¡£Äں˾ßÌåµÄ°æ±¾Òª²ÎÕÕhttp://kernel.org/ºÍftp://ftp.gnu.org/pub/gnu/gdb¡£ÀýÈç¡£
LINUX_DIR=linux-2.6.12.1
GDB_DIR=gdb-6.0
F.ÒÔÆÕͨÓû§ÔËÐнű¾
$sudo sh demo-arm.sh
½øÈëÂþ³¤µÄµÈ´ý¹ý³ÌÖС¡
3.°²×°Íê³Éºó·¾¶ÉèÖúͲâÊÔ¡£
±à¼~/.bash_profile,ÔÚÆäÖÐexport PATHÇ°¼ÓÈëÕâÑùÒ»ÐУ¬PATH=/opt/crosstool/gcc-3.4.5-glibc-2.3.6/arm-S3C2410-linux-gnu/bin:$PATH£¬¸ÄÍêºóÎÒµÄÊÇÕâÑùµÄ
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
PATH=/opt/crosstool/gcc-3.4.5-glibc-2.3.6/arm-S3C2410-linux-gnu/bin:$PATH
export PATH
unset USERNAME
È»ºó¾ÍºÃÁË¡£¿ÉÒÔ¿ªÊ¼²âÊÔʹÓÃÁË¡£²âÊԵķ½·¨ºÜ¼òµ¥£¬Ëæ±ãÕÒ¸ö³ÌÐòÔ´Âë±àÒëһϾͺÃÁË¡£ÕâÀïÓõÄÕâЩ±àÒëÆ÷Éú³ÉµÄÊǶþ½øÖÆÎļþ£¬ºÍƽʱµÄgccÉú³ÉµÄ¿ÉÖ´ÐÐÎļþ²¢²»Ïàͬ¡£ÀýÈçÎÒ²âÊÔʱµÄÎļþÊÇtest.c£¬
#include
int main()
{
printf("Hello!");
return 0;
}
µ÷ÓÃеÄarm-linux-gccÀ´±àÒ룺arm-S3C2410-linux-gnu-gcc -o test test.c,ÕâʱÉú³ÉµÄtestÎļþÊÇÒ»¸ö¶þ½øÖƵĿÉÖ´ÐÐÎļþ£¬²¢²»ÊÇÎÒÃÇƽʱ³£Óõģ¬ËùÒÔÔÚPCÉÏÖ´ÐÐÕâ¸öÎļþµÄ»°ÊDz»Ðеģ¬ÏµÍ³»áÌáʾ£ºbash: ./test: cannot execute binary file¡£ËùÒÔ²»ÄÜÓÃÕâÖÖ·½·¨À´²âÊÔ½»²æ±àÒëÊÇ·ñ³É¹¦¡£¶øÓ¦¸Ä²ÉÓÃfileÃüÁÀýÈçÎÒµÄÊÇÕâÑùµÄ£º
file test
½á¹ûÈçÏ£º
test: ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.4.3, dynamically linked (uses shared libs), for GNU/Linux 2.4.3, not stripped
Èç¹û³öÏÖÕâÑùµÄ½á¹û˵Ã÷½»²æ±àÒë»·¾³ÒѾ°²×°³É¹¦¡£·ñÔòÖØÐÂÏë°ì·¨°É¡£
Note£ºÔÚµÚ¶þÖÖ·½·¨ÖУ¬gcc£¬gdbµÈÎļþµÄÏÂÔØ·½·¨ÓÐÁ½ÖÖ£¬Ò»ÊÇÉèÖúÃÍøÂçºóÈÃshell³ÌÐò×Ô¼ºÈ¥ÏÂÔØ£¬ÕâÖÖ·½·¨¼òµ¥£¬µ«ÊÇÏÂÔØËٶȲ»¸Ò¹§Î¬¡£ÁíÍâÒ»ÖÖÊÇ×Ô¼ºÊ¹ÓÃÏÂÔع¤¾ßÈ¥ÏÂÔØ£¬È»ºó½«´æ·Å·¾¶¸æËßdemo-arm.sh£¬¼´ 2.CÀïÃæµÄÄÚÈÝ¡£ÕâÖÖ·½·¨ËÙ¶ÈÈÃÈËÂúÒâ¡£ÍƼöʹÓá£
enzo ÓÚ 2009-06-11 14:11:30·¢±í:
лл¡«¡«¡«
anonymous ÓÚ 2008-09-21 10:27:51·¢±í:
лл·ÖÏí£¬ÄÜ×ö³ÉÊÓƵô£¿ÕâÑù¸üºÃ
LinuxÊÓƵÈí¼þÓÐistanbul vnc2swf xvidcap¶¼Í¦ºÃÓõÄ