1 / 16

Installing Linux Kernel

Installing Linux Kernel. 임베디드 시스템에 리눅스 커널을 사용하기 위한 준비 과정 Kernel selection Configuration Compilation Installation. process 1. User Space. process 2. process 3. process n. System Call Interface. Filesystem Manager. Process Manager. Task Management Scheduler Signaling IPC.

tomas
Download Presentation

Installing Linux Kernel

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. Installing Linux Kernel • 임베디드 시스템에 리눅스 커널을 사용하기 위한 준비 과정 • Kernel selection • Configuration • Compilation • Installation 충북대학교 임베디드 시스템 연구실

  2. process 1 User Space process 2 process 3 process n System Call Interface Filesystem Manager Process Manager Task Management Scheduler Signaling IPC Ext2fs proc xiafs nfs msdos ntfs Memory Manager Paging/Segmentation Kernel Space Buffer Cache Device Manager Network Manager character block socket Ipv6 IrDA Bluetooth Console KBD SCSI CD-ROM PCI ethernet Hardware Interface dev1 dev2 dev3 dev4 devn 6-1 리눅스 커널의 구조 충북대학교 임베디드 시스템 연구실

  3. 1. Selecting a Kernel • http://www.kernel.org/ • 리눅스 커널의 주 저장소: • 여기에서 제공하는 커널들이 리눅스가 지원하는 모든 아키텍처에 적합하도록 만들어진 것은 아니다. • 아키텍처에서 수행되는 리눅스의 개발과 the main kernel releases가 일치하지 않기 때문이다. • 타겟에 장착되어 있는 프로세서 아키텍처에 적합한 리눅스 커널을 선택해야 하며, 이에 따라 커널을 다운 받을 사이트도 달라진다. 충북대학교 임베디드 시스템 연구실

  4. 프로세서별 커널 저장소 충북대학교 임베디드 시스템 연구실

  5. ARM site • Full kernel을 제공하지 않고, official kernel에 대한 patches를 배포한다. • 아키텍처에 적합한 커널을 구하기 위하여, 먼저 main repository에서 커널을 다운 받은 다음에 적절한 패치를 적용해야 한다. • 예) • http://www.kernel.org/에서 2.4.18을 다운 받고, • ARM Linux site인 http://www.arm.linux.org.uk/에서 2.4.18-rmk5 patch를 다운 받는다. • rmk5 patch를 vanilla 2.4.18에 적용함으로써, 2.4.18-rmk5 kernel을 얻을 수 있다. • 이것이 ARM 기반 시스템에 필요한 모든 특성들을 포함하고 있다. 충북대학교 임베디드 시스템 연구실

  6. Version의 선택 • 대부분의 경우에 가장 최근의 known-to-be-functional version을 선택하는 것이 최선이다. • 예) 만일 2.4.17과 2.4.18이 target에서 안정적으로 동작한다면, 2.4.18을 선택하는 것이 좋다. • 그렇지만, 항상 옳은 것은 아니다. • 일단 적절한 커널을 선택하였으면 • ${PRJROOT}/kernel 디렉토리에 다운 받고, 추출하고, rename 하라. • 커널 디렉토리의 이름을 변경하는 것이 다른 커널과 혼합되지 않는다. 충북대학교 임베디드 시스템 연구실

  7. 2. Configuring the kernel • 커널에 포함되어 있는 기능들 중에서 타겟에 필요한 기능만 선택하는 과정 • 결과물은 kernel build 때 사용된다. • .config file • A number of symbolic links and file headers 충북대학교 임베디드 시스템 연구실

  8. Code maturity level options Loadable module support General setup Memory technology devices Block devices Network options ATA/IDE/MFM/RLL support SCSI support Network device support Input core support Character devices Filesystems Console drivers Sound Kernel hacking Configuring options 충북대학교 임베디드 시스템 연구실

  9. Processor architecture System and processor selection option Kernel architecture name x86 Processor type and features i386 ARM System type arm PPC Platform support ppc MIPS Machine selection/CPUselection mips or mips64 SH Processor type and features sh M68k Platform-dependent support m68k n 프로세서 선택 옵션 • nmake command를 실행할 때 ARCH variable을 커널 Makefiles가 인식하는 architecture name으로 설정하여야 한다. 충북대학교 임베디드 시스템 연구실

  10. Configuration methods • make config • 각 옵션을 하나씩 물어보는 a command-line interface • 만일 .config configuration file이 존재하면, 그 파일의 내용으로 default 값을 설정한다. • make oldconfig • 기존의 .config configuration file을 기반으로 이전에 설정하지 않은 옵션들만 구성하도록 메뉴가 나타난다. • make menuconfig • Displays a curses-based terminal configuration menu. • 만일 .config configuration file이 존재하면, 그 파일의 내용으로 default 값을 설정한다. • 가장 많이 사용하는 방법 • make xconfig • Displays a Tk-based X Window configuration menu. • 만일 .config configuration file이 존재하면, 그 파일의 내용으로 default 값을 설정한다. 충북대학교 임베디드 시스템 연구실

  11. Configuration 과정 • 생성되는 파일 • 커널 소스의 root directory에 a .config file을 생성한다. • a few header files and symbolic links도 함께 생성된다. • ARM-based user interface modules를 위한 command line 예 • $ make ARCH=arm CROSS_COMPILE=arm-linux- menuconfig • Configuration 과정 • Target에 적절한 configuration options를 선택 • 많은 특징과 드라이버들을 • 커널 안에 포함시키거나 • 모듈로 빌드하도록 만들 수 있다. • Escape key or Exit을 선택하여 빠져 나오고, Save 충북대학교 임베디드 시스템 연구실

  12. 3. Compiling the kernel • 컴파일 단계: • building the kernel dependencies • building the kernel image • building the kernel modules 충북대학교 임베디드 시스템 연구실

  13. Building dependencies • .depend file • dependencies build하는 도중에 커널 트리의 각 서브디렉토리마다 생성되는 파일 • 각 파일과 관련이 있는 the list of header files를 포함하고 있다. • 커널의 dependencies를 생성하는 command • $ make ARCH=arm CROSS_COMPILE=arm-linux- clean dep • 커널의 root directory에서 실행 • CROSS_COMPILE=arm-linux-: 소스 코드를 실제로 컴파일할 때만 필요하므로 여기에서는 dependencies만 생성하므로 생략해도 좋다. • ARCH variable • 이 커널이 빌드되는 아키텍처를 나타낸다. • CROSS_COMPILE variable • 커널 Makefiles은 이 변수를 사용하여 커널 빌드에 사용되는 툴의 이름을 만든다. • 예) ARM target의 C 컴파일러 이름: arm-linux-gcc 충북대학교 임베디드 시스템 연구실

  14. Building the kernel • Compile the kernel image: • $ make ARCH=arm CROSS_COMPILE=arm-linux- zImage • zImage: gzip 알고리즘으로 압축한 커널 이미지를 생성한다. • X86의 경우에는 bzImage를 생성할 수도 있다. • zImage와 bzImage 모두 gzip 알고리즘으로 압축. • 차이점 • zImage로 압축된 커널 이미지는 크기가 512 KB 이하이다. • bzImage로 압축된 커널 이미지는 크기에 제한이 없다. 충북대학교 임베디드 시스템 연구실

  15. Building the modules • Build the kernel modules: • $ make ARCH=arm CROSS_COMPILE=arm-linux- modules • 커널 소스들을 모두 정리하고(clean up) configuration, dependency building, or compilation 이전의 상태로 되돌아 가기 위한 명령: • $ make ARCH=arm CROSS_COMPILE=arm-linux- distclean • .config file, all object files, and the kernel images 등 이전 단계에서 생성한 모든 파일들을 지운다. • 이 명령을 수행하기 전에 kernel configuration file을 반드시 백업할 것 충북대학교 임베디드 시스템 연구실

  16. 4. Installing the Kernel • 생성된 커널 이미지들을 ${PRJROOT}/images 디렉토리로 복사한다. • 여러 가지 kernel configurations에 따라 다른 커널 이미지들을 생성한다. • 각 kernel configurations마다 네 개의 파일들을 복사해야 한다. • The compressed kernel image: zImage or bzImage • arch/YOUR_ARCH/boot 디렉토리에 있다. • 예) arch/arm/boot/zImage • The uncompressed kernel image: vmlinux • The kernel symbol map: System.map • The configuration file: .config • 마지막 세 개는 커널 소스의 루트 디렉토리에 있다. 충북대학교 임베디드 시스템 연구실

More Related