Presentation is loading. Please wait.

Presentation is loading. Please wait.

Kernel Image Generation

Similar presentations


Presentation on theme: "Kernel Image Generation"— Presentation transcript:

1 Kernel Image Generation

2 Contents Understanding of Linux kernel
기능 구조 file system Kernel image generation (compile) 방법 CPU dependent patch: ARM(SA 1100), Xscale(PXA 255) make menuconfig, make depend, make clean, make zImage Kernel zImage generation Summary

3 Kernel ? Kernel, Nucleus Kernel 기능 정보통신, 컴퓨터기술의 발전으로 커널의 기능 변화
운영체제의 핵심 기능(core functions)을 담당 DRAM에 상주하며, 시스템 구동에 필요한 환경설정과 수행되는 프로세스의 scheduling Kernel 기능 Process Management Memory Management File System Management Device Driver Management Network Management 기타: Interrupt processing, Procedure Call/Recover 정보통신, 컴퓨터기술의 발전으로 커널의 기능 변화 종래 커널은 단순한 process, memory, device, file system 관리에서 network, GUI 관리까지 확장

4 Kernel Function Core (kernel) + Utilities Kernel User Processes
System Call Process Management I/O Services Scheduler Device Driver Hardware I/O Buffer Memory Management File System Interface(Library Routines) User Processes

5 Linux Kernel 기본 구조 Process, Memory, File System, Networking, Device Drivers Management 사용자 관점에서 Kernel: User program (User Application), Library & Shell, System Call, Kernel, Hardware

6 Kernel의 세부 기능 Process management Memory management
프로세스의 생성 및 소멸, 프로세스간의 통신(IPC, pipe, signal), CPU 스케줄링 동기화, 제한된 자원에서 다중 프로세서의 효율적인 관리 기법 등 Memory management 가상 메모리 관리기법, 메모리 하드웨어의 효율적인 관리 File system management 가상 파일 시스템(VFS)에 의한 여러 파일 시스템 지원, 디스크의 물리구조에 따른 논리기법 표현, 파일/directory 관리, block 입출력을 위한 버퍼 cache 관리 Device management 입출력 요청의 검증, 입출력 작업 scheduling, 주변장치간의 자료전송, 제어기 관리, 인터럽트 요청 및 처리 Network management 통신 프로토콜 구현(TCP/UDP, IP 등), 네트워크 routing 및 주소 지정, 네트워크 제어기 관리, 네트워크 드라이버와 접속

7 Linux kernel 특징 (1) The process/Kernel mode Process Implementation
System call: User mode, kernel mode로 수행 Kernel threads: Boot 초기에 init를 kernel thread로 생성 Process Implementation Process descriptor Reentrant Kernels Reentrant, Reentrant functions, Kernel control path Process Address Space mmap( ) Synchronization & Critical Regions Non-preemptive kernel, interrupt disabling, semaphores, spin locks, avoiding deadlock

8 Linux kernel 특징 (2) Signal & IPC Process Management Memory Management
Notifications, synchronous errors & exceptions Semaphores, message queues, shared memory Process Management Process groups, login sessions Memory Management Random access memory usage, kernel memory allocator, process virtual address space handing, swapping & caching Device Drivers

9 Linux Kernel Architecture (1)
5 Functional Blocks File system management: VFS(Virtial File System) Process management Device (I/O) management Memory management Network management Device Interface Device Driver (Character, Stream, Block unit) System Call Interface User mode, Supervisor/Kernel mode

10 Linux Kernel Architecture (2)
Process-1 Process-2 Process-3 Process-n System Call Interface File Manager Ext2fs, proc, nfs Msdoc, ………. Process Manager Task manager Scheduler Signaling Memory Manager Network Manager Ipv4, ipv6 Ethernet, ATM, … Device Manager Console, Keyboard SCSI, CD-ROM PCIbus Block Char Device Interface Device-1 Device-2 Device-3 Device-n buffer cache User Space Device Space Kernel Space VFS (Virtial File System)

11 Monolithic vs Micro kernel (1)
Monolithic kernel 하나의 커널에 필요한 모든 기능이 통합되어 있는 형태 코널 내부에 시스템 운영에 필요한 서비스 루틴으로 구성 적은 메모리 공간에 필요한 기능을 내장 함으로서 “function call”로 기능 제공 구현이 간단,시스템 자원을 효율적으로 관리하는 장점 다양한 환경의 시스템에 포팅이 어려운 단점과 커널의 크기가 상대적으로 커지는 단점 Linux, Solaris, AIX, HP-UX, DG-UX, IRIX 등 Micro kernel 핵심적인 기능 구현한 최소한의 기능을 커널로 구성 서버 모듈(서비스 프로세스)로 나눠 설계하고, 이들 서버를 관리하는 기능을 커널로 구성 기능 확장이 용의, 시스템의 재사용에 장점 메시지 전달 방식에 의한 기능 접근으로 태스크 스위칭에 오버헤드 자원의 효율적 이용에 단점 CPU Mach OS, Digital Unix, Sunsoft Chorus 등

12 Monolithic vs Micro kernel (2)
Monolithic, Micro kernel 구조 (a) Monolithic kernel (b) Micro kernel System Service API Hardware Integrated Kernel Architecture 1 n 2 Micro Kernel Architecture Service Server

13 System Call User 모드에서 커널 모드로 변환: System Call, Interrupt 모드 변환과정 Trap
IRQ(IRQ service : ISR, Interrupt Service Routine) User Mode Kernel Mode System Call & Interrupt (trap, IRQ)

14 System Call: Mode Conversion
Task is Running Execute ISR System Call Placed Execute System Functions Return from System Call Schedule New Task Task Continues Running Schedule Bottom half if Needed IRQ Trap Slow Fast ret_from-sys_call ISR: Interrupt Service Routine res_from-sys_call

15 Kernel 모듈과 관계 프로그램 수행 모드: Kernel model, User mode
Context Switch(환경 전환) User Application은 1) System Library, 2) Software Interrupt를 이용하여 Trap을 걸어서 Kernel에 접근: System call interface User mode System mode(TRAP)  Kernel mode : ret_from_sys_call( )

16 Kernel Generation Procedures (1)
Kernel source를 작업 디렉토리(/usr/src/linux) 에 복사 Tool Chain 환경 설치 확인: cross-compiler (/usr/local/arm/bin) ARM, Xscale 환경으로 patch 커널의 컴파일 환경을 타켓보드에 맞게 적용: make empos_config 작업 디렉토리에서 이전에 작업한 관련 커널 작업 환경을 삭제: make clean 커널 설정 수행 (make menuconfig): .config Make empos_config를 통해 구성된 메뉴를 소스에 적용 GNU C compiler를 이용하여 Makefile 간의 상호 연관성 파일 생성: make dep(.depend 파일에 소스의 pass 정보가 저장) 컴파일을 수행한 후에 불필요한 object 파일을 삭제: make clean 커널을 compile (make zImage): arch/arm /boot/zImage

17 Kernel Generation Procedures (2)
make menuconfig make depend make zImage Kernel Image file: zImage Kernel configuration file: .config depend file: .depend Device Drivers Hardware Environments

18 Kernel Source 구조 커널 소스: http://www.kernel.org/pub/linux/v2.4
커널 소스: 소스 버전 할당 원칙: 메인 버젼 번호(커널 상의 변화) 짝수 버젼은 안정 버전으로 일정 시험을 통과, 홀수 버전은 시험용 버전 커널의 작은 변화에 따른 업그레이드 버전 주요 소스 디렉토리 arch(arch/arm/kernel, mach-sa-1100, mm), drivers init, kernel, fs, mm, net, lib, include

19 Linux File system Ext2 파일 시스템 사용 JFFS(Journalling Flash File System)
NTFS, VFAT, UFS, NFS등의 다양한 파일 시스템의 사용 가능 VFS으로 실제 사용자와 인터페이스: 커널과 파일 시스템 의 중간에서 일관성 있는 파일 시스템을 제공 2Gbytes의 파일 크기와 4Tbytes늬 전체 파일 시스템 구성 가능 가변 블록 크기와 확장가능 기능 JFFS(Journalling Flash File System) 스웨덴 Axis Communications에세 개발, 디스크가 없는 임베디드 시스템에 flash 메모리를 이용한 전원/파손에 안전한 파일 시스템 MTD 디바이스를 통해 접근 디렉토리 /root bin boot dev etc home lib mnt proc root sbin tmp usr var user1 user2 include lib local sbin src

20 Kernel Source Directories
Source directory LINUX Modules mm net kernel init lib include lpc unix inet fs arch drivers mips alpha sparc ppc i386 char block scsi sound asm-alpha linux asm-i386 asm-m88k asm-generic asm-mips asm-sparc ext ext2 xiafs lsofs hpfs unsdos nfs proc minix msdos sysv boot math-emu

21 Check Hardware Environments
Kernel Compile Blob> tftp zImage kernel Blob> flash kernel #jflash-Xscale zImage make menuconfig make depend make zImage Kernel Image file: /arch/arm/boot/ zImage (compressed image file) Kernel configuration file: .config (make empos_config, make oldconfig) depend file: .depend Device Drivers Check Hardware Environments make clean Delete object files (xxx.o) Target Board: HB-EMPOS Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 move zImage to ROM 득정 하드웨어인 경우 scripts로 설정

22 make menuconfig (1)

23 make menuconfig (2)

24 make menuconfig (3)

25 make menuconfig (4)

26 make menuconfig (5)

27 make menuconfig (6)

28 Configuration (1) .config (make menuconfig)에서 해당 하드웨어 환경에 따른 Configuration Parameter를 정의 COBFIG_CPU_32=y, COBFIG_CPU_SA1100=y, CONFIG_VT=y 등등 하드웨어 환경에 따른 설정에 해당되는 서브 모듈을 해당 디렉토리에서 바인딩 (make dep): Config.in 가상터미널 설정 환경의 예제

29 Configuration (2) UART 예제 Makefile

30 make menuconfig (7)

31 make menuconfig: .config (1)

32 make menuconfig: .config (2)

33 make dep: end (2)

34 make dep: start (1)

35 make dep: .depend

36 make dep: .hdepend

37 make clean: start (1)

38 make clean: end (2)

39 make zImage: start (1)

40 make zImage: end (2)

41 Summary Understanding of Linux Kernel (for Embedded System)
The procedure of kernel configuration (regeneration) Problems Understanding of kernel functions and sources Hardware Environments: device drivers The Basics of kernel and embedded system “백번 듣는 것보다 한번 보는 것이 이해하는데 유리하다”

42 Report Lunux에서 제공되는 파일 시스템에 대한 조사 예) ext2, ext3, cramfs, jffs2, MTD 등
Root File System ext2 ext3 cramfs jffs2 RAM Frash ROM HDD DOC Which file system ? What media ? What method ? initd MTD


Download ppt "Kernel Image Generation"

Similar presentations


Ads by Google