노무현 대통령 배너


2007. 7. 13. 09:53

리눅스에서 maemo 실행하기

maemo는 노키아에서 만든 open development platform이다. 자세한 내용은 www.maemo.org를 참고한다.

문서를 보면 테스트는 Debian Sarge와 Ubuntu Breezy에서 했다고 나오는데 여기에서는 Ubuntu Dapper에서 테스트했다.

maemo SDK를 설정하고 실행하기 위해 필요로하는 하드웨어와 소프트웨어 사양은 다음과 같이 문서에 나온다.
* Intel compatible x86 processor, 500 MHz or faster
* 256 MB RAM or more
* 2 GB free hard disk space
* Linux OS (Debian or Ubuntu are recommended, but others fairly recent distributions should also work)

maemo Development Platform 2.0을 설치하기 위해서는 scratchbox가 필요하다.
scratchbox는 http://scratchbox.org/download/files/sbox-releases/0.9.8/deb/에서 다음의 파일들을 다운로드한다. maemo 실행을 위해 필요한 버전은 0.9.8.7이다.
  • scratchbox-core_0.9.8.7_i386.deb
  • scratchbox-devkit-debian_0.9.8.7_i386.deb
  • scratchbox-libs_0.9.8.7_i386.deb
  • scratchbox-toolchain-cs2005q3.2-glibc-arm_0.9.8.5-6_i386.deb
  • scratchbox-toolchain-cs2005q3.2-glibc-i386_0.9.8.5-6_i386.deb
또는 http://scratchbox.org/download/files/sbox-releases/0.9.8/tarball/에서 다음의 파일을 다운로드하여 / 디렉토리에 압축을 푼다. (sudo tar xzvf xxx.tar.gz -C /)
  • scratchbox-core-0.9.8.7.tar.gz
  • scratchbox-devkit-debian-0.9.8.7.tar.gz
  • scratchbox-libs-0.9.8.7.tar.gz
  • scratchbox-toolchain-cs2005q3.2-glibc-arm-0.9.8.5-6.tar.gz
  • scratchbox-toolchain-cs2005q3.2-glibc-i386-0.9.8.5-6.tar.gz
여기서는 debian package 파일을 다운로드하여 dpkg -i xxx.deb 명령어를 실행하였다.

우선 scratchbox-libs_0.9.8.7_i386.deb를 설치한다. 그리고 scratchbox-core_0.9.8.7_i386.deb를 설치한다. 설치되는 디렉토리는 /scratchbox이다. 마찬가지로 scratchbox-devkit-debian_0.9.8.7_i386.deb, scratchbox-toolchain-cs2005q3.2-glibc-arm_0.9.8.5-6_i386.deb, scratchbox-toolchain-cs2005q3.2-glibc-i386_0.9.8.5-6_i386.deb를 설치한다.

sudo dpkg -i scratchbox-libs_0.9.8.7_i386.deb
sudo dpkg -i scratchbox-core_0.9.8.7_i386.deb
sudo dpkg -i scratchbox-devkit-debian_0.9.8.7_i386.deb
sudo dpkg -i scratchbox-toolchain-cs2005q3.2-glibc-arm_0.9.8.5-6_i386.deb
sudo dpkg -i scratchbox-toolchain-cs2005q3.2-glibc-i386_0.9.8.5-6_i386.deb

scratchbox-core_0.9.8.7_i386.deb를 설치하는 중에 Configuring scratchbox-core 화면이 나타난다. sbox 그룹을 만들고 sbox 그룹에 추가할 user를 선택하는 화면이다.
만약 tarball file로 설치했다면 /scratchbox/run_me_first.sh 스크립트를 실행한 후 sbox_adduser 명령어를 이용하여 scratchbox에 user를 추가한다.

# /scratchbox/run_me_first.sh
# /scratchbox/sbin/sbox_adduser username

그룹을 update하기 위해 현재 사용중인 session을 재시작한다. (화면을 로그아웃한 후 다시 로그인한다.)
groups 명령어를 통해 현재 사용자 그룹에 sbox가 추가되어 있는지 확인한다.

$ groups
hopemini adm dialout cdrom floppy audio dip video plugdev lpadmin scanner admin sbox


maemo platform과 application을 테스트하기 위해 SDK rootstrap을 다운로드한다.
Maemo_Dev_Platform_v2.0rc16_i386-rootstrap.tgz를 다운로드한 후 /scratchbox/packages/ 디렉토리에 옮겨놓는다.
그리고 다음과 같이 실행한다.

$ sudo /scratchbox/sbin/sbox_ctl start
$ /scratchbox/login

Welcome to *Scratchbox*, the cross-compilation SDK!

Scratchbox is a self-contained mini-distribution that contains all the
tools needed to configure and cross-compile Open Source software using
GNU make and *autoconf*. All the software configuration, compilation
and installation is done in a sandbox environment exactly like on your
target device. This is achieved by using chroot to limit system
visibility for configuration scripts you run from this shell, into what
exists inside the Scratchbox sandbox.
The Scratchbox utilities are:
sbox-config - Change your compilation target
ps - List processes running inside your sandbox

Completed writing configuration to: /targets/HOST.config
libtool disabled

[sbox-SDK_PC: ~] >


새로운 rootstrap target을 만들기 위해 sbox-config -ct SDK_PC를 실행하고 새로 만들어진 rootstrap target을 선택하기 위해 sbox-config -st SDK_PC를 실행한다.

[sbox-SDK_PC: ~] > sbox-config -ct SDK_PC

Available compilers:
0) cs2005q3.2-glibc-arm
1) cs2005q3.2-glibc-i386
2) host-gcc

Enter compiler number: 1

Available CPU-transparency methods:
sbrsh
qemu-arm
qemu-ppc

Enter method name (none):

Available devkits:
debian

Enter list of devkit names (none): debian

Completed writing configuration to: /targets/SDK_PC.config
Appending to /targets/SDK_PC/etc/passwd: daemon bin sys sync games man lp mail news uucp proxy www-data backup list irc gnats nobody
Appending to /targets/SDK_PC/etc/group: daemon bin sys adm tty disk lp mail news uucp man proxy kmem dialout fax voice cdrom floppy tape sudo audio dip www-data backup operator list irc src gnats shadow utmp video sasl staff games users nogroup
[sbox-SDK_PC: ~] >
[sbox-SDK_PC: ~] > sbox-config -st SDK_PC
Restarting Scratchbox shell...
Hangup
Shell restarting...
[sbox-SDK_PC: ~] >


다운로드한 rootstrap을 extract한다. tgz package의 size가 크기 때문에 시간이 오래 걸린다.

[sbox-SDK_PC: ~] > sbox-config -er /scratchbox/packages/Maemo_Dev_Platform_v2.0rc16_i386-rootstrap.tgz
Extracting /scratchbox/packages/Maemo_Dev_Platform_v2.0rc16_i386-rootstrap.tgz to /targets/.tmp/SDK_PC
Moving /targets/SDK_PC to /targets/.old/SDK_PC
Moving /targets/.tmp/SDK_PC to /targets/SDK_PC
Restarting Scratchbox shell...
Hangup
Shell restarting...
[sbox-SDK_PC: ~] >

새로 만들어진 target compiler를 configure한다.
[sbox-SDK_PC: ~] > sbox-config -cc

libfakeroot 환경을 설정한다.
[sbox-SDK_PC: ~] > sbox-config -cf
Copying libfakeroot from /scratchbox/device_tools/fakeroot-1.3/cs2005q3.2-glibc-i386/lib to /usr/lib/libfakeroot
[sbox-SDK_PC: ~] >

여기까지가 maemo application을 컴파일하기 위한 maemo 개발 환경을 설정한 것이다.


리눅스 PC에서 maemo 환경을 가동하기 위해서는 graphical window가 필요한데 여기에서는 Xephyr를 사용한다. Xephyr는 rootstrap을 설치할 때 이미 설치가 되었기 때문에 start-xephyr.sh와 같은 스크립트를 만들어 리눅스 PC에서 실행시키면 된다.

$ vi start-xephyr.sh
#!/bin/sh -e
prefix=/scratchbox/users/${LOGNAME}/targets/SDK_PC/usr
export LD_LIBRARY_PATH=${prefix}/lib; export LD_LIBRARY_PATH
exec ${prefix}/bin/Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac
$ chmod +x start-xephyr.sh
$ ./start-xephyr.sh &


start-xephyr.sh를 실행시키면 empty Xephyr window가 화면에 생성된다.
scratchbox에서는 maemo를 X window에 실행시키기 위해 DISPLAY를 설정한 후 maemo를 실행한다.

[sbox-SDK_PC: ~] > export DISPLAY=:2
[sbox-SDK_PC: ~] > af-sb-init.sh start

GUI를 중지하기 위해서는 다음과 같이 start 대신 stop이라고 적는다.
[sbox-SDK_PC: ~] > af-sb-init.sh stop


만약 application을 만들어 실행해보고자 한다면 run-standalone.sh을 이용한다.
[sbox-SDK_PC: ~] >run-standalone.sh ./maemo_hello


그리고 scratchbox를 실행하기 위해서는 /scratchbox/login을 해도 되지만 그냥 scratchbox라고 입력해도 된다.

보다 자세한 내용은 http://www.maemo.org/platform/docs/tutorials/Maemo_tutorial.html을 참고하기 바란다.


참고 사이트
http://repository.maemo.org/unstable/2.0rc16/Maemo_Dev_Platform_v2.0rc16
_relnotes.txt

http://repository.maemo.org/unstable/2.0rc16/i386/Maemo_Dev_Platform_RS
_v2.0rc16_i386_relnotes.txt

http://www.maemo.org/platform/docs/tutorials/Maemo_tutorial.html