|
Big Endian & Littel Endian ?
빅 엔디안은 큰 쪽 (바이트 열에서 가장 큰 값)이 먼저 저장되는 순서이며, 리틀 엔디안은 작은 쪽 (바이트 열에서 가장 작은 값)이 먼저 저장되는 순서이다. 예를 들면, 빅 엔디안 컴퓨터에서는 16진수 "4F52"를 저장공간에 "4F52"라고 저장할 것이다 (만약 4F가 1000번지에 저장되었다면, 52는 1001번지에 저장될 것이다). 반면에, 리틀 엔디안 시스템에서 이것은 "524F"와 같이 저장될 것이다. - 텀즈 (http://www.terms.co.kr/) "Little Endian" means that the low-order byte of the number is stored in memory at the lowest address, and the high-order byte at the highest address. Byte3 Byte2 Byte1 Byte0 will be arranged in memory as follows: Base Address+0 Byte0 Base Address+1 Byte1 Base Address+2 Byte2 Base Address+3 Byte3 Intel processors (those used in PC's) use "Little Endian" byte order. "Big Endian" means that the high-order byte of the number is stored in memory at the lowest address, and the low-order byte at the highest address. (The big end comes first.) Our LongInt, would then be stored as: Base Address+0 Byte3 Base Address+1 Byte2 Base Address+2 Byte1 Base Address+3 Byte0 Motorola processors (those used in Mac's) use "Big Endian" byte order. - Willam T. Verts's Home (http://www.cs.umass.edu/~verts/) Download ● binutils ■ binutils-2.13.90.0.10.tar.gz (H.J. Lu) : http://ftp.kernel.org/pub/linux/devel/binutils/ ● gcc ■ gcc-3.2-7.1.src.rpm (H.J. Lu) : ftp://ftp.linux-mips.org/pub/linux/mips/redhat/7.3/test/ ● glibc ■ glibc-2.2.5.tar.gz ■ glibc-linuxthreads-2.2.5.tar.gz : ftp://ftp.gnu.org/gnu/glibc/ ■ glibc-2.2.5-mips-build-gmon.diff (patch 용) : http://www.ltc.com/~brad/mips/ ● kernel source ■ linux-2.4.2.tar.gz : http://www.kernel.org/pub/linux/kernel/v2.4/ 설치 환경 ● Red Hat Linux release 7.1 ● Kernel 2.4.2-2 on an i686 ● <Install-path> : /opt/toolchains/mips 설치 과정 ※ make install 시에 “su root” 사용 1. tar 파일 및 rpm 파일을 다음 위치에 unpack ~/mipsel-cross/binutils-2.13 ~/mipsel-cross/gcc-3.2 : /usr/src/redhat/SOURCES 에 풀린 파일 중 gcc-3.2-20020903.tar.bz2 unpack ~/mipsel-cross/glibc-2.2.5 : linuxthreads는 glibc-2.2.5 디렉토리 안에 unpack ~/linux-2.4 2. Binutils cd ~/mipsel-cross/binutils-2.13/mips chmod 744 README cd .. ./mips/README : apply HJ Lu's patches mkdir ~/mipsel-cross/mipsel-binutils cd ~/mipsel-cross/mipsel-binutils ../binutils-2.13/configure --prefix=/opt/toolchains/mips -enable-targets=mips64el-linux,mipsel-linux --target=mipsel-linux --enable-shared make make install 3. 커널 소스 make config cd ~/linux-2.4 mv -f Makefile Makefile.org sed "s/ARCH := .*$/ARCH := mips/1" Makefile.org > Makefile mv -f Makefile Makefile.org sed "s/CROSS_COMPILE .*=$/CROSS_COMPILE = mips-linux/1" Makefile.org > Makefile rm -f Makefile.org make menuconfig : Machine Selection에서 MIPS가 표시된 항목만 선택 : include/linux/version.h 와 include/linux/autoconf.h 가 생겼는지 확인!! cd .. 4. Gcc (1st time) -------------------------------------------------------------- vi ~/.bash_profile PATH에 /opt/toolchains/mips/bin 추가 Logout 후 다시 login -------------------------------------------------------------- mkdir /opt/toolchains/mips/mipsel-linux/include cp -R linux-2.4/include/asm-mips/ /opt/toolchains/mips/mipsel-linux/include/ cp -R linux-2.4/include/linux/ /opt/toolchains/mips/mipsel-linux/include/ cd /opt/toolchains/mips/mipsel-linux/include ln -s asm-mips asm mkdir ~/mipsel-cross/mipsel-gcc cd ~/mipsel-cross/mipsel-gcc AR=mipsel-linux-ar RANLIB=mipsel-linux-ranlib ../gcc-3.2/configure --prefix=/opt/toolcha 설치 확인 설치가 성공적으로 되면 /opt/toolchains/mips/mipsel-linux/bin 디렉토리에 gcc, g++, c++ 등 mipsel 용 프로그램을 만들 수 있는 컴파일러 파일들이 생긴다. 기존 컴파일러 파일들과 이름이 같아 혼동되므로 ln 명령으로 usr/bin 디렉토리 밑에 다른 이름으로 링크 파일을 만들어 사용하자. $ cd /usr/bin $ ln -s /opt/toolchains/mips/mipsel-linux/bin/c++ mipsel-c++ $ ln -s /opt/toolchains/mips/mipsel-linux/bin/g++ mipsel-g++ $ ln -s /opt/toolchains/mips/mipsel-linux/bin/gcc mipsel-gcc ... 간단한 예제를 컴파일 해보자. $ vi hello.c int main() { printf("Hello, Mipsel\n"); return 1; } $ mipsel-gcc hello.c $ file a.out a.out: ELF 32-bit LSB MIPS-I executable, MIPS, version 1 (SYSV), for GNU/Linux 2.4.0, dynamically linked (uses shared libs), not stripped 컴파일이 잘 되었으면 a.out 파일이 생기고, file 명령으로 a.out을 확인해보면 MIPS 용 실행 파일임을 확인할 수 있다. 실행 컴파일된 실행 파일 a.out을 MIPS kit에 ftp로 전송하고 chmod로 실행 모드로 바꾼 후 실행시키면 된다. # chmod 755 a.out # ./a.out Hello, Mipsel # [출처] Embedded Linux (2)|작성자 넘쿨
|
||||