1 / 24

Kernel Porting

Kernel Porting. Lecture #7. 목 차. 임베디드리눅스 최신 경향 Kernel Porting Overview ARM Patch Xscale Patch PXA255-PRO3 Board Patch Kernel Configuration & Compiling Kernel fusing & Testing. 임베디드 리눅스 관련 최신 경향 #1 : 삼성전자. 임베디드 리눅스 관련 최신 경향 #2 : 구글 (Google). 임베디드 리눅스 관련 최신 경향 #3 : Paradigm Shift.

shawn
Download Presentation

Kernel Porting

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Kernel Porting Lecture #7

  2. 목 차 • 임베디드리눅스 최신 경향 • Kernel Porting Overview • ARM Patch • Xscale Patch • PXA255-PRO3 Board Patch • Kernel Configuration & Compiling • Kernel fusing & Testing

  3. 임베디드 리눅스 관련 최신 경향 #1 : 삼성전자

  4. 임베디드 리눅스 관련 최신 경향 #2 : 구글(Google)

  5. 임베디드 리눅스 관련 최신 경향 #3 : Paradigm Shift Linux Win CE Ports Tool-chain Networks GUI Mobile Network GUI Networks ex) 휴대폰, 차세대 가전기기 ex) 홈 게이트웨이, 로봇

  6. Kernel Porting Overview(1) • Kernel Porting • 리눅스 커널을 특정 타겟 보드의 하드웨어 환경 및 특정 응용에 맞게 수정하는 과정 • 포팅 영역 • H/W-dependent • CPU porting • Board porting • H/W-independent • Linux kernel의 주요 기능 선별 및 수정 • 특정 응용 실행에 효율적인 환경 구축 Application H/W-indep. Linux Kernel H/W-dep. Hardware 주로 H/W-dep. 영역에 대한 포팅을 kernel porting이라 함

  7. Kernel Porting Overview(2) • Kernel Porting 절차 이론적인 포팅 절차  Original Kernel  ARM Core Patch  Target Board Patch  XScale Core Patch 실무에서의 포팅 절차  Reference Kernel  ARM Core Patch  Target Board Patch  Why? 1) 시간 2) 기능 구현 여부 : ex) SDIO, BlueTooth, CF I/O mode 3) 성능, 안정성

  8. ARM Core Patch (1`) • Linux kernel 준비 • http://www.kernel.org/ • 원하는 버전의 리눅스 커널을 상기의 사이트에서 다운로드받아 준비한다 • 예: linux-2.6.21.tar.gz linux-2.4.19.tar.gz • ARM Core Patch 준비 • ARM core patch는 ARM사에서 제공하나 리눅스 커널 2.6에 대해 더 이상 지원되지 않음 • 리눅스 커널 2.4(e.g, linux-2.4.19)에 대해 설명 • http://www.arm.uk.linux.org/ • 상기의 사이트에서 원하는 커널의 ARM core patch 파일을 다운로드한다 (e.g, patch-2.4.19-rmk4.gz)

  9. ARM Core Patch (2`) • ARM Core Patch 적용 # pwd /home/pxa255/kernel # ls linux-2.4.19.tar.gz patch-2.4.19-rmk4.gz # tar xvfz linux-2.4.19.tar.gz # cd /home/pxa255/kernel/linux-2.4.19 # zcat ../patch-2.4.19-rmk4.gz | patch –p1 (or # gunzip –d ../patch-2.4.19-rmk4.gz # patch –p1 < patch-2.4.19-rmk4 )

  10. Xscale Patch (1`) • Xscale Patch 필요성 • 타켓 보드에서 사용하는 CPU:Xscale PXA255 processor • 상기의 processor는 SoC processor로 ARM core 이외에 외부 장치와의 인터페이스 기능, 몇가지 기본적인 I/O 기능을 포함 • 추가적인 기능들에 대해 kernel patch가 필요 • Xscale Patch 준비 • 특정 processor에 대한 patch는 몇몇 프리랜서들에 의해 제공 • Xscale patch는 nico라는 프리랜서가 제공 • ftp://ftp.arm.uk.linux.org/pub/linux/arm/people/nico/v.2.4 • 상기의 사이트에서 원하는 커널의 Xscale patch 파일을 다운로드한다 (e.g, diff-2.4.19-rmk4-pxa2.gz)

  11. Xscale Patch (2) • Xscale Patch 적용 # pwd /home/pxa255/kernel # ls diff-2.4.19-rmk4-pxa2.gz linux-2.4.19 linux-2.4.19.tar.gz patch-2.4.19-rmk4.gz # cd /home/pxa255/kernel/linux-2.4.19 # zcat ../diff-2.4.19-rmk4-pxa2.gz | patch –p1 (or # gunzip –d ../diff-2.4.19-rmk4-pxa2.gz # patch –p1 < diff-2.4.19-rmk4-pxa2 )

  12. PXA255-PRO3 Board Patch (1) • Board Patch 개요 • 타켓 보드에서 지원하는 각종 I/O 장치 및 인터페이스에 대한 kernel patch • 예: • Board description • Ethernet I/F • LCD display • USB • PCMCIA, CF, SD I/F etc. • 타겟 보드 제조업체에서 제공

  13. PXA255-PRO3 Board Patch (2) • Board Patch 준비 • 휴인스 사이트나 제공된 CD-ROM으로 부터 board patch 파일을 복사하여 준비 • 예: diff-2.4.19-rmk4-pro3.gz • Board Patch 적용 # pwd /home/pxa255/kernel # cd /home/pxa255/kernel/linux-2.4.19 # zcat ../diff-2.4.19-rmk4-pro3.gz | patch –p1 (or # gunzip –d ../diff-2.4.19-rmk4-pro3.gz # patch –p1 < diff-2.4.19-rmk4-pro3 )

  14. Kenel Compiling (1) • Kernel image making • Kenel Configuration  Kernel Compiling • Kernel Configuration • 타겟 보드에 탑재될 linux kernel의 구성, 주요 기능 및 옵션들을 설정  특정 응용에 적합하게 linux kernel 환경을 구축 • 커널 기능에 대해 ‘지원함’, ‘지원하지 않음’, ‘module로 지원함’으로 선택 • 실행 명령: # make menuconfig • Kernel Compiling • 커널 설정에 따라 커널 소스를 컴파일하여 커널 이미지를 생성 • 실행 명령: # make dep # make zImage

  15. Kenel Compiling (2) • Kernel image making 절차 # pwd /home/pxa255/kernel # cd /home/pxa255/kernel/linux-2.4.19 # make pro3_config // default configuration 적용 // 타겟 보드에 따라 지원되지 않을 수 있음 # make oldconfig (or # make menuconfig // default config.를 수정하고자 할 때.) # make clean // # make distclean # make dep # make zImage

  16. Kenel Fusing • Kernel Fusing • 새롭게 생성된 커널 이미지를 u-boot bootloader 프로그램을 통해 타겟 보드의 플래시 메모리에 퓨징한다 • 퓨징 절차는 “강의-5” 내용을 참조

  17. PXA255-PRO3 Board 실습 (1) • PXA255-PRO3 Board Patch 실습 • 현재 실습중인 커널 버전은 linux-2.6.21이고, 이에 대한 kernel patch & compiling을 실습한다. • Step 1: 커널 소스 준비 • http://www.kernel.org/사이트에서 커널 소스 linux-2.6.21.tar.gz을 다운로드한다 • 커널 소스 압축을 해제한다: # tar xvfz linux-2.6.21.tar.gz • Step 2: PXA255-PRO3 board patch 준비 • PXA255-PRO3 board patch 파일 diff-2.6.21-pxa255-pro3.gz을 준비한다

  18. PXA255-PRO3 Board 실습 (2) • PXA255-PRO3 Board Patch 실습 (cont’n) • Step 3: Board patch 적용 # cd ~/pxa255/kernel/linux-2.6.21 # ls ../diff-2.6.21-pxa255-pro3.gz diff-2.6.21-pxa255-pro3.gz # zcat ../ diff-2.6.21-pxa255-pro3.gz | patch –p1 • Step 4: Kernel compiling # pwd /home/pxa255-pro3/kernel/linux-2.6.21 # make pro3_defconfig # make oldconfig # make uImage

  19. PXA255-PRO3 Board 실습 (3) • PXA255-PRO3 Board Patch 실습 (cont’n) • Step 5: Kernel image 생성 결과 확인 • 현재 board patch에서는 커널 컴파일 후에 커널 이미지를 /tftpboot/pxa255_pro3/uImage-2.6.21-pro3로 복사한다 • ls 명령어를 통해 생성된 커널 이미지를 확인한다 # ls –al /tftpboot/pxa255_pro3 • Step 6: Kernel fusing • 타겟 보드를 리셋하여 u-boot의 command mode로 들어간다 • 커널 퓨징과 관련하여 환경 변수를 확인 및 수정한다 PRO3> printenv • 커널을 퓨징한다 PRO3> run linuxf

  20. 부록 : Menuconfig flow make pro3_defconfig make menuconfig cd include ; ln -sf asm-arm asm lxdialog compile script/Menuconfig arch/arm/config.in .config 有 no arch/arm/defconfig yes lxdialog Configuration .tmpconfig , .tmpconfig.h mv .tmpconfig .config mv .tmpconfig.h include/linux/autoconf.h exit

  21. 부록 : Patch file 만들기 • Patch file • Patch file은 두 파일이나 디렉토리간의 차이점을 출력해주는 프로그램인 diff에 의해 만들어진 파일을 의미. • 프로그램의 기능향상이나 문제점을 파악하기 위함. • 보관의 용이, Version up 관리 용이

  22. 부록 : Patch file 만들기(con’t) • diff 사용법 hello.c hello2.c #include <stdio.h> int main(void) { printf("hello world!!!\n"); return 0; } #include <stdio.h> int main(void) { printf("hello world!!!\n"); printf("hello bedguy!!!\n"); return 0; } [root@bedguy /root]# diff -uNr hello.c hello2.c > hello.patch [root@bedguy /root]# cat hello.patch --- hello.c Thu Aug 30 14:08:05 2001 +++ hello2.c Thu Aug 30 14:06:54 2001 @@ -2,6 +2,7 @@ int main(void) { printf("hello world!!!\n"); + printf("hello bedguy!!!\n"); return 0; } [root@bedguy /root]# Org file New file Patch file

  23. 부록 : Patch file 만들기(con’t) • Patch 적용 • -p option • p1 - 첫번째 슬래쉬를 뺀 곳부터 Patch 적용(보통 디렉토리 전체) • p0 –그 상위 디렉토리에서부터 적용(파일 하나 비교) [root@bedguy /root]# cat hello.patch | patch -p0 [root@bedguy /root]# cat hello.c #include <stdio.h> int main(void) { printf("hello world!!!\n"); printf("hello bedguy!!!\n"); return 0; } [root@bedguy /root]#

  24. 부록: Link • http://www.arm.linux.org.uk/ The ARM Linux Project • http://www.netwinder.org/ netwinder • http://handhelds.org/ IPAQ 관련 • http://www.cs.cmu.edu/~wearable/software/ The Wearable Group • http://www.lart.tudelft.nl The LART Pages • http://www.kelp.or.kr/ Korea Embedded Linux Project • http://www.kesl.org/ Korea Embedded System og Linux • http://www.huins.com/ Huins, Co. • http://linux.flyduck.com/ Kernel site • http://kernelkorea.org/ Linux kernel • http://www.linuxro.com/ ecos porting • http://pcmcia-cs.sourceforge.net/ Linux PCMCIA Information Page • http://ftp.arm.linux.org.uk/ The ARM Linux Project FTP • http://www.kr.ibm.com/developerworks/전문 강좌 • http://www.freechal.com/embedded/임베디드 리눅스 개발자 그룹 • http://www.fsf.org/ gnu homepage • http://www.phystech.com/download/ server demon program

More Related