34
Hanbat National University Prof. Lee Jaeheung Host System 구축

Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Host System 구축

Page 2: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

목차

? Linux 개요

? Linux 구동되는 하드웨어

? Linux 구동되는 소프트웨어

? Linux 설치

? Cross Compile 환경 구축

? Test program

Page 3: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 개요? 리눅스란?

– 정의?리눅스는 운영체제 (일반적으로 커널을 뜻함)?모든 프로그램은 공유되어야 한다는 리차드 스톨먼의 GNU프로젝트에

서 개발된 유틸리티와 인터넷을 통한 많은 공개 소프트웨어들로 이루어진 운영체제

? 리눅스의 특징– 멀티 유저, 멀티 태스킹 시스템– 인텔 계열의 프로세서 및 Cyrix와 AMD의 CPU에 최적화– 효율적인 가상 메모리 사용– 동적 공유 라이브러리 사용– UNIX표준인 POSIX와 완벽한 호환

? 리눅스의 장점– GUI의 불필요– 원격 관리의 용이성– 리부팅의 불필요– 바이러스 안전– 보안

Page 4: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 구동되는 하드웨어? CPU

– ARM : 영국의 ARM사와 미국의 DEC가 공동 개발한 마이크로 프로세서

– Alpha : 1992년에 발표된 세계 최초 64비트 RISC 마이크로프로세서

– Intel : 미국의 세계 최대의 반도체 회사 8086, 80386, 80486, 펜티엄

계열이 있음

– MIPS : 1982년에 Standford 대학에서 교육용으로 개발된 축소 명령 집합의 RISC 프로세서

– M68K : 모토롤라의 68000계열의 마이크로 프로세서

– PowerPC : IBM, Apple, Motorola의 합작품으로 Macintosh컴퓨터에 주로 사용

– SPARC : SPARC (Scalable Processor Architecture)는 미국의Sun Microsystems사의 대표적인 RISC마이크로 프로세서로 RISC칩을 내장한 시스템을 말함, 썬 마이크로 시스템즈의워크스테이션의 CPU로사용

– 기타 : 커널소스의 수정에 의해 다른 CPU에서도 구동 시킬 수 있음

Page 5: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 적용되는 하드웨어? 메모리

– DRAM, EDO, SDRAM 등 널리 사용되는 메모리 모두 가능

? VGA

– 모노 VGA, 또는 표준 VGA 드라이버를 사용하는 VGA 카드

? Hard Disk Controllers

– 모든 표준 IDE지원 특정 SCSI Controller 지원

? 기타 하드웨어

– 일반적인 하드웨어들을 거의 모두 지원하고 있음

Page 6: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 구동되는 소프트웨어? 오피스 프로그램

– StarOffice, Koffice, GnomeOffice, 한컴 오피스, AbiWord등

? 데이터 베이스– Oracle, Sybase, Infomix, MySQL, PstgreSQL등

? 그래픽 툴– Gimp, Xpaint, Electric Eyes, Picview, Photo Paint등

? 웹브라우저– 넷스케이프, 모질라, 오페라, 텍스트 브라우저 Lynx등

? 네트워크 프로그램– Ncftp, gftp, gnomeicu, kicp, 가우 등

? 데스크탑 관리자– GNOME, KDE 등

? 에디터– Vi, emacs, CoffeCup, HTML Editor등

Page 7: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 설치(1)

그래픽 모드 설치

텍스트 모드 설치

?엔 터…

Page 8: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 설치(2)

키보드 설정기본설정 사용

?다음…

Page 9: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 설치(3)

마우스 설정Microsoft

InterliMouse(ps/2)체크

?다음…

Page 10: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 설치(4)

설치 유형사용자 설치 체크

?다음…

Page 11: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 설치(5)

설치 유형설치 프로그램에 의한자동 파티션 설정 체크

?다음…자동 파티션 설정시스템 상의 모든리눅스 파티션 삭제사용 드라이브 설정 체크Hdb선택

?다음…

Page 12: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 설치(6)

?다음…

Page 13: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 설치(6)

부트로더 설치부트로더 설정?LILO 부트로더 사용부트로더가 설치될 위치?Dev/hdb1기본 부트 이미지?/dev/hdb2 ex3

?다음…

Page 14: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 설치(7)

네트웍 설정DHCP 사용 환경으로 설정?체크 해제IP 주소 : pc 의 주소게이트 웨이:203.230.96.11차 DNS:202.30.46.2?다음…

Page 15: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 설치(8)

방화벽 설정?방화벽을 사용하지 않음체크

?다음…

Page 16: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 설치(9)

언어 지원 선택기본 설정 사용

?다음…

Page 17: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 설치(10)

시간대 설정기본 설정 사용

?다음…

Page 18: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 설치(10)

계정 설정루트 패스워드:embeddedsw확인 : embeddedsw

?다음…

Page 19: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 설치(11)

인증에 관한 설정기본 설정 사용

?다음…

Page 20: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 설치(11)

패키지 그룹 선택랩탑 지원 , 웹서버 ,

GNOME, DNS 서버 , 전부 설치 제외 체크

?다음…

Page 21: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 설치(12)

비디오 카드 설정기본 설정 사용

?다음…

Page 22: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 설치(13)

설치 시작?다음…

Page 23: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 설치(14)

부팅 디스켓 제작디스크를 넣고… ..?다음…

Page 24: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 설치(15)

모니터 설정기본 설정 사용

?다음…

Page 25: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Linux 설치(16)

설치 종료?종료…재부팅

Page 26: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Cross Compile 환경 구축? Cross Compile 환경 구축이란?

– 타겟 플랫폼 : Cross Compile가 생성하는 오브젝트 코드가 실제로 수

행되는 시스템

– 호스트 플랫폼 : 크로스 컴파일러를 수행하는 시스템

– 플랫폼을 가로질러서 컴파일하다라는 뜻으로 호스트 플랫폼에서 컴

파일된 파일을 타겟 플랫폼에서 실행하기 위해 준비하는 환경 설정

Page 27: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Cross Compile 환경 구축

Host System Target system

Targetdebugger

T-OS

T-Appl

T-VM

T-Appl

Target 용cross compiler

Crossdownloader

Crossdebugger

Targetmonitor

Case 1) Serial line

Case 2) LAN line

LAN line

Serial line

Target Software Development Kit (SDK)Target

code

< 개발 지원 호스트 와 타겟 시스템의 관계 >

Page 28: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Cross Compile 환경 구축? Cross Compile 환경 구축에 필요한 파일

– binutils : 어셈블러 및 로더 기타 툴

– linux-2.4.18 : 커널 소스

– gcc : 컴파일러

– glibc : Cross Compile 구축을 위한 라이브러리 및 일반 라이브러리1) binutils-2.12.tar.gz

2) linux-2.4.18-rmk7-ez1.tar.gz

3) gcc-2.95.3.tar.gz

4) gcc-2.95.3-2.patch.bz2

5) glibc-2.2.4.tar.gz

6) glibc-linuxthreads-2.2.4.tar.gz

?위 파일들은 artoa.hanbat.ac.kr에서 다운로드 받을 수 있음

Page 29: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Binutils 패키지 설치? Binutils 패키지 설치

[root@root download]# tar zxvf binutils-2.12.tar.gz

[root@root download]# cd binutils-2.12

[root@root binutils-2.12]# ./configure --target=arm-linux

[root@root binutils-2.12]# make

[root@root binutils-2.12]# make install

? 수행하고 나면 /usr/local/arm-linux/bin 란 디렉토리가 생성 이 부분을실행환경 패스로 설정

– vi /root/.bash_profile 실행 후

– PATH=$PATH:$HOME/bin를

– PATH=$PATH:$HOME/bin:/usr/local/arm-linux/bin으로 변경

– source /root/.bash_profile 실행

Page 30: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

커널 소스 설치? 사용 커널 소스 : linux-2.4.18-rmk7-ez1.tar.gz

[download]# tar zxvf linux-2.4.18-rmk7-ez1.tar.gz

[download]# cd linux-2.4.18-rmk7-ez1

[linux-2.4.18-rmk7-ez1]# mkdir /usr/local/arm-linux/include

[linux-2.4.18-rmk7-ez1]# cp -dR include/asm-arm usr/local/arm-linux/include/asm

[linux-2.4.18-rmk7-ez1]# cp -dR include/linux /usr/local/arm-linux/include/linux

[linux-2.4.18-rmk7-ez1]# cd /usr/local/arm-linux/

[arm-linux]# ln –s include sys-linux

Page 31: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

gcc 패키지 설치? Gcc 란?

– gcc 는 GNU 프로젝트에 의해 만들어짐

– AT&T 스타일, BSD 스타일의 C 언어 문법은 물론 ANSI C 를 기본으로 하여 모든 문법을 소화함

– 매우 단순한 사용 환경, GUI환경을 제공하지 않음

? 설치 방법

[download]# tar zxvf gcc-2.95.3.tar.gz

[download]# cd gcc-2.95.3

[gcc-2.95.3]# patch -Np1 -i ../gcc-2.95.3-2.patch.bz2

Page 32: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

gcc 패키지 설치vi /down/gcc-2.95.3/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 를 추가

[arm]#cd /down/gcc-2.95.3

[gcc-2.95.3]# mkdir ../gcc-build

[gcc-2.95.3]# cd ../gcc-build

[gcc-build]# ../gcc-2.95.3/configure --target=arm-linux -v

--with-gnu-as --with-gnu-ld --with-gnu-newlib

[gcc-build]# ../gcc-2.95.3/configure --target=arm-linux -v

--with-gnu-as --with-gnu-ld

[gcc-build]# make -w all-gcc install-gcc LANGUAGE="c c++"

Page 33: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

glibc 패키지 설치[download]# tar zxvf glibc-2.2.4.tar.gz

[download]# cd glibc-2.2.4

[glibc-2.2.4]# tar zxvf ../glibc-linuxthreads-2.2.4.tar.gz

[glibc-2.2.4]# mkdir ../glibc-build

[glibc-2.2.4]# cd ../glibc-build

[glibc-build]# CC=arm-linux-gcc ../glibc-2.2.4/configure

arm-linux --prefix=/usr/local/arm-linux --enable-add-ons

--with-headers=/down/linux-2.4.18-rmk7-ez1/include

--with-cpu=strongarm110

[glibc-build]# make

[glibc-build]# make install

Page 34: Host System - Hanbatartoa.hanbat.ac.kr/lecture_data/embedded_sw/02_old.pdfHanbat National University Prof. Lee Jaeheung Cross Compile 환경구축 Host System Target system Target

Hanbat National University Prof. Lee Jaeheung

Test program? Hello program

[download]# vi test.c#include <stdio.h>main(){

printf( “Hello\n" );

}

[download]# arm-linux-gcc -o test test.c[download]# file testtest: ELF 32-bit LSB executable, Advanced RISC Machines ARM, version

1, dynamically linked (uses shared libs), not stripped