본문 바로가기
Programming Language/Linux

리눅스 커널 컴파일 및 Xenomai 설치

by 민트초코맛꼬깔콘 2014. 7. 1.

Linux ubuntu 12.04.3 LTS x86

Linux kernel : linux-3.8.13

Xenomai : xenomai-2.6.3

ipipe : 3.8.13


- 커널 컴파일을 위한 기본적으로 필요한 프로그램 설치

$ sudo apt-get install build-essential kernel-package libncurses5-dev doxygen


build-essential : 컴파일 할 때 사용하는 gcc 및 C library 등을 설치

kernel-package : 데비안 시스템에서 커널 빌드를 위해 필요한 프로그램들

libncurses5-dev : 커널 컴파일 시, 커널의 옵션을 세팅할 때, 텍스트 베이스의 ncurse 그래픽 라이브러리를 사용하는데, 이를 위해 필요

doxygen : API의 설명문서를 만드는데 필요


- Linux kernel 다운로드

xenomai : www.xenomai.org

linux kernel : http://ftp.kernel.org

ipipe : http://download.gna.org/adeos/patches/v3.x/x86/


- 다운 받은 파일을 /usr/src로 이동

$ sudo cp linux-3.8.13.tar.bz2 /usr/src

$ sudo cp xenomai-2.6.3.tar.bz2 /usr/src

$ cd /usr/src


- 압축풀기

sudo tar --bzip2 -xvf linux-3.8.13.tar.bz2

sudo tar --bzip2 -xvf xenomai-2.6.3.tar.bz2


심볼릭 링크

$ cd /usr/src

$ sudo ln -s linux-3.8.13 linux

$ sudo ln -s xenomai-2.6.3 xenomai



- Linux kernel patch


$ cd /usr/src/xenomai/scripts

$ sudo ./prepare-kernel.sh --arch=x86 --adeos=/usr/src/xenomai-2.6.3/ksrc/arch/x86/patches/ipipe-core-3.8.13-x86-4.patch --linux=/usr/src/linux-3.8.13



- Linux kernel config & compile


$ cd /usr/src/linux


$ sudo make-kpkg clean


$ cd /boot

$ sudo cp /boot/config-3.x.x-xx-generic /usr/src/linux/.config

$ cd /usr/src/linux

$ sudo make oldconfig

(all enter)


$ sudo make menuconfig




아래의 항목들을 Disable 해준다.


>Power management and ACPI options > CPU Frequency scaling > CPU frequency scaling


> Power management and ACPI options > ACPI (Advanced Configuration and Power Interface) Support


> Power management and ACPI options > CPU idle PM support


> Processor type and features > Enable-fstack-protector buffer overflow detection


> Power management and ACPI options > APM (Advanced Power Management) BIOS support


> Device Drivers > Input device support > Miscellaneous devices > PC Speaker support


> Bus options (PCI etc.) > Message Signaled Interrupts (MSI and MSI-X)


> Processor type and features > Processor family => core 2 / newer Xeon


Save & Exit

$ cd /usr/src/linux

$ sudo vi .config

RTS5139를 검색 후 해당라인을 #주석처리


- 컴파일 시작

("CONCURRENCY_LEVEL=4 make-kpkg"-여러개의 프로세서를 사용하여 동시에 컴파일할 수 있는 옵션)

$ sudo CONCURRENCY_LEVEL=4 make-kpkg --initrd --stem linux --append-to-version=.01rt kernel_image kernel_headers


(도중에 한번 엔터)


- 커널 컴파일이 정상적으로 수행됐다면, /usr/src 폴더를 보면, 다음과 같이 두 파일이 생성된 것을 볼 수 있다.


linux-headers-3.8.13.01rt_3.8.13.01rt-10.00.Custom_i386.deb

linux-image-3.8.13.01rt_3.8.13.01rt-10.00.Custom_i386.deb


- 데비안 패키지 파일(deb)를 설치한다.

$ sudo dpkg -i linux-headers-3.8.13.01rt_3.8.13.01rt-10.00.Custom_i386.deb linux-image-3.8.13.01rt_3.8.13.01rt-10.00.Custom_i386.deb


- 설치가 끝나면 실제로 컴파일한 커널이 부트로더에 등록되었는지 확인해보자.

$ sudo update-grub


- 새로 설치한 커널버젼으로 재부팅 -



Xenomai 설치


$ sudo su

$ cd /usr/src/xenomai

$ ./configure

$ make

$ make install


$ cp /etc/ld.so.conf.d/libc.conf /etc/ld.so.conf.d/xenomai.conf

$ vim /etc/ld.so.conf.d/xenomai.conf


아래와 같이 설정된 내용을

#libc default configuration

/usr/local/lib


다음과 같이 변경한다.

# xenomai libs

/usr/xenomai/lib


저장한 다음 configuration load

$ ldconfig


- 예제 프로그램

$ cd /usr/src/xenomai/examples/native

$ make

$ ./trivial-periodic


$ exit

'Programming Language > Linux' 카테고리의 다른 글

apt-get 소스리스트 변경 (kr.archive.ubuntu.com)  (0) 2014.08.12
우분투 GRUB 복구하기  (0) 2014.07.10
리눅스 vi 명령어  (0) 2014.07.04
리눅스 터미널 명령어  (0) 2014.07.04
vim 환경설정  (0) 2014.07.04