2015. 2. 23.

Raspberry pi에 Xenomai 설치하기

라즈베리파이(RPi)에 제노마이 설치를 하겠습니다.

 RPi에서 컴파일을 하려면 많은 시간이 필요하므로 일반적인 컴퓨터에서 모든 작업을 한 후
라즈베리파이에는 마지막에 이미지파일만 바꿔치기 하겠습니다.


1. 커널 빌드와 menuconfig 하기 위한 패키지 설치

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install ncurses-dev
sudo apt-get install kernel-package
sudo apt-get install ia32-libs


2. working 이라는 디렉토리를 만들고 그 안에 tool 다운 후 압축 해제
wget https://github.com/raspberrypi/tools/archive/master.tar.gz
tar xzf master.tar.gz


3. kernel 다운로드
git clone -b rpi-3.8.y --depth 1 git://github.com/raspberrypi/linux.git linux-rpi-3.8.y


4. xenomai 다운로드
git clone git://git.xenomai.org/xenomai-head.git xenomai-head


5. minimal config 다운로드
wget https://www.dropbox.com/s/dcju74md5sz45at/rpi_xenomai_config


6. 패치 적용(버젼 숫자는 다를 수 있으므로 확인할 것)
cd linux-rpi-3.8.y

patch -Np1 < ../xenomai-head/ksrc/arch/arm/patches/raspberry/ipipe-core-3.8.13-raspberry-pre-2.patch

cd ..

xenomai-head/scripts/prepare-kernel.sh --arch=arm --linux=linux-rpi-3.8.y --adeos=xenomai-head/ksrc/arch/arm/patches/ipipe-core-3.8.13-arm-4.patch

cd linux-rpi-3.8.y

patch -Np1 < ../xenomai-head/ksrc/arch/arm/patches/raspberry/ipipe-core-3.8.13-raspberry-post-2.patch


7. 위 과정으로 리눅스 커널에 제노마이가 설치 되었고 이제 리눅스를 빌드한다

mkdir linux-rpi-3.8.y/build


미리 만들어진 config 파일 사용

cp rpi_xenomai_config linux-rpi-3.8.y/build/.config
cd linux-rpi-3.8.y
make mrproper
make ARCH=arm O=build oldconfig


컴파일

make ARCH=arm O=build CROSS_COMPILE=../../tools-master/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-

모듈 설치

make ARCH=arm O=build INSTALL_MOD_PATH=dist modules_install

헤더 설치

make ARCH=arm O=build INSTALL_HDR_PATH=dist headers_install

find build/dist/include \( -name .install -o -name ..install.cmd \) -delete


8. USB FIQ 설치
cd working

패치 다운로드

wget https://gist.githubusercontent.com/kinsamanka/10256843/raw/4d5d3e02a443e4d17d9b82a1fe027ef17fb14470/usb_fiq.patch


패치 적용

cd linux-rpi-3.8.y

patch -p1 < ../usb_fiq.patch


커널 재컴파일

make ARCH=arm O=build CROSS_COMPILE=../../tools-master/arm-bcm2708/arm-
bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-



9. 라즈베리파이로 이동!

 이제 빌드된 이미지 파일(zImage)은 linux-rpi-3.8.y/build/arch/arm/boot/ 에 위치하게 된다. 이 파일을 라즈베리파이의 /boot(fat32파티션)에 있는 kernel.img와 바꾸면 된다.
바꿀 시에는 확장자를 img로 바꾸고 이름도 kernel로 바꾸어야 한다.

또한 자신이 작업할 폴더에 리눅스에서 작업했던 xenomai-head 폴더와 linux-rpi-3.8.y/dist/lib 를 가져온다.

sudo cp lib / -r
cd xenomai-head
./configure
make
sudo make install
sudo reboot

이제 제노마이가 설치되었고 테스트 하기 위해 latency를 실행.

sudo /usr/xenomai/bin/latency -p 100 -T 3000 


출처 :
http://naudhizb.tistory.com/280
https://code.google.com/p/picnc/wiki/RPiXenomaiKernel

댓글 없음: