도전2022

리눅스 커널 구하자. 본문

작업/리눅스

리눅스 커널 구하자.

hotdigi 2010. 2. 10. 16:31
리눅스 커널에 대한 이해가 필요하기 시작했다. .ㅠㅠ.

www.kernel.org에서 소스를 받을 수 있다. 

2월 10일 현재의 메인 페이지의 화면은 다음과 같다. 

The Linux Kernel Archives

Welcome to the Linux Kernel Archives. This is the primary site for the Linux kernel source, but it has much more than just Linux kernels. 
Frequently Asked Questions

US EU
ProtocolLocation
HTTP http://www.kernel.org/pub/
FTP ftp://ftp.kernel.org/pub/
RSYNC rsync://rsync.kernel.org/pub/
Latest Stable Kernel:
Download

2.6.32.8




linux-next: next-20100210 2010-02-10 [Patch] [View Patch] [Gitweb]
snapshot: 2.6.33-rc7-git3 2010-02-09 [Patch] [View Patch]
mainline: 2.6.33-rc7 2010-02-06 [Full Source] [Patch] [View Patch] [View Inc.] [Gitweb] [Changelog]
stable: 2.6.32.8 2010-02-09 [Full Source] [Patch] [View Patch] [View Inc.] [Gitweb] [Changelog]
stable: 2.6.31.12 2010-01-18 [Full Source] [Patch] [View Patch] [View Inc.] [Gitweb] [Changelog]
stable: 2.6.30.10 2009-12-04 [Full Source] [Patch] [View Patch] [View Inc.] [Gitweb] [Changelog]
stable: 2.6.27.45 2010-01-28 [Full Source] [Patch] [View Patch] [View Inc.] [Gitweb] [Changelog]
stable: 2.4.37.9 2010-02-01 [Full Source] [Patch] [View Patch] [Gitweb] [Changelog]

Changelogs are provided by the kernel authors directly. Please don't write the webmaster about them.
Customize the patch viewer



리눅스 시스템에 /usr/src/linux 디렉토리에 압축을 풀어서 소스를 살펴보도록 하자. 
(난, xp의 Source Insight 3와 Araxis Merge 를 좋아하므로 윈도우즈 폴더에도 하나 압축 풀어서 살펴본다.)


(1) 큰 디렉토리 단위 내용 익히기
  : documentation, arch, kernel, include, init, drivers, ipc, fs, lib, net, mm, scripts 등으로 구성된다. 

(2) 이전 소스와 비교하면서 학습하기
   : 초자인 내가 전체를 이해하기에는 무리가 있고, 이전버전과 비교하면서 무엇이 개선되는지 중심으로 살펴보자.ㅋ

(3) 리눅스 커널 컴파일 방법 익히자. 
1. C언어와 AT&T 어셈블리 언어를 알고 있어야 한다고 한다. 
2. 다운로드 하여 압축을 풀자. 
  - kernel.org에서 소스를 수신 받아 /usr/src/linux에 압축을 풀자. 
     #tar zxvf linux-2.6.32.8.tar.gz
  - 컴파일 해보자. 
     #make clean
     #make mrproper
     #make menuconfig
     #make dep
     #make clean
     #make bzImage
     #make modules
     #make modules_install
     #make install
커널 컴파일이 잘 되었는지를 확인 하기 위해서는 부팅을 시켜서 모든 기능이 정상적으로 동작되는지를 확인하는 작업이 필요하다. 

(4) 커널 코드 분석
1. 커널 코드 분석을 위한 도구를 찾자. 
- windows 용
  : source insight, araxis merge, ultra edit, edit plus
- linux 용
  : ultra edit, vi(m) edit, KDevelop, ctags, 
- 쉽게 구할수 있는 무료를 구하는 것이 좋을 것 같다. 
2. 디버그 도구를 구하자.
- TRACE32 : 고가이지만, 매우 강력하다. 
- GDB : 인터페이스가 불편하지만, 강력하다.
- printk() : 커널 내에서 커널 메시지로 택스트를 화면에 출력한다. 





관련된 링크

'작업 > 리눅스' 카테고리의 다른 글

linux 웹 서버 만들기  (0) 2010.02.19
putty를 사용하자.  (0) 2010.02.19
DDD 사용하자.  (0) 2010.02.18
so 파일 동작 원리 학습  (0) 2010.01.21
opensource 리눅스 게임 자료조사  (0) 2009.12.23