강좌 & 팁
1. ALSA 라이브러리 다운로드 받기
http://alsa.cybermirror.org/lib/
alsa-lib-1.0.14rc3.tar.bz2
[ 컴파일 환경 ]
우분투 9.10
크로스컴파일러 : gcc 3.4.3
작업디렉토리 : /project
[컴파일]
[root@hw27:#] tar -jxvf alsa-lib-1.0.14rc3.tar.bz2
[root@hw27:#] cd alsa-lib-1.0.14rc3
[root@hw27:alsa-lib-1.0.14rc3#] ./configure --host=arm-linux --prefix=/usr/alsa
[root@hw27:alsa-lib-1.0.14rc3#] make
[root@hw27:alsa-lib-1.0.14rc3#] make intall
2. ncurses-5.6 컴파일 하기
ftp://ftp.sg.linuxfromscratch.org/pub/lfs/lfs-packages/6.3/
ncurses-5.6.tar.gz
ncurses-5.6-coverity_fixes-1.patch
[root@hw27:#] tar -zxvf ncurses-5.6.tar.gz
[root@hw27:#] cd ncurses-5.6
[root@hw27:ncurses-5.6#] cat ../ncurses-5.6-coverity_fixes-1.patch |patch -p1
[root@hw27:ncurses-5.6#] LD=arm-linux-ld AR=arm-linux-ar RANLIB=arm-linux-ranlib CC=arm-linux-gcc CXX=arm-linux-g++ ./configure --host=i686-linux --target=arm-linux --prefix=/usr/arm-linux --with-shared
다음 내용을 수정한다.
[root@hw27:ncurses-5.6#] vi misc/Makefile
HOSTCC = $(CC) 를 HOSTCC = gcc 로 바꾼다.
[root@hw27:ncurses-5.6#] vi ncurses/Makefile
BUILD_CC = $(CC) 를 BUILD_CC = gcc 로 바꾼다.
컴파일을 수행한다.
[root@hw27:ncurses-5.6#] make
[root@hw27:ncurses-5.6#] make install
3. ALSA 유틸리티 컴파일 하기
http://alsa.cybermirror.org/utils/
alsa-utils-1.0.14rc2.tar.bz2
[root@hw27:#] tar -jxvf alsa-utils-1.0.14rc2.tar.bz2
[root@hw27:#] cd alsa-utils-1.0.14rc2
[root@hw27:alsa-utils-1.0.14rc2#] ./configure --host=arm-linux --prefix=/project/alsa-utils-1.0.14rc2/_install
[root@hw27:alsa-utils-1.0.14rc2#] make
-----
ncurses.h 파일을 찾을 수 없다는 에러메세지가 나오면 다음과 같이 한다.
[root@hw27:alsa-utils-1.0.14rc2#] cd /usr/arm-linux/include
[root@hw27:include#] ln -s ncurses/curses.h ncurses.h
[root@hw27:include#] cd -
-----
[root@hw27:alsa-utils-1.0.14rc2#] make
----
PATH_MAX 가 등록되어 있지 않다는 아래와 같은 메세지가 나오면
aplay.c:973: warning: `snd_pcm_sw_params_get_xfer_align' is deprecated (declared at /usr/lib/gcc/arm- linux/3.4.3/../../../../arm-linux/include/alsa/pcm.h:1105)
aplay.c:980: warning: `snd_pcm_sw_params_set_sleep_min' is deprecated (declared at /usr/lib/gcc/arm-linux/3.4.3/../../../../arm-linux/include/alsa/pcm.h:1106)
aplay.c:1008: warning: `snd_pcm_sw_params_set_xfer_align' is deprecated (declared at /usr/lib/gcc/arm-linux/3.4.3/../../../../arm-linux/include/alsa/pcm.h:1104)
aplay.c: In function `new_capture_file':
aplay.c:2058: error: `PATH_MAX' undeclared (first use in this function)
aplay.c:2058: error: (Each undeclared identifier is reported only once
aplay.c:2058: error: for each function it appears in.)
aplay.c: In function `capture':
aplay.c:2096: error: `PATH_MAX' undeclared (first use in this function)
make[1]: *** [aplay.o] Error 1
make[1]: Leaving directory `/staff/tsheaven/em-s2440/trunk/prg/for_aesop_ac97/alsa-utils-1.0.14rc2/aplay'
[root@hw27:alsa-utils-1.0.14rc2#] vi aplay/aplay.c
57라인을 추가한다.
53 #ifndef LLONG_MAX
54 #define LLONG_MAX 9223372036854775807LL
55 #endif
56
57 #define PATH_MAX 4096
58
59 #define DEFAULT_FORMAT SND_PCM_FORMAT_U8
----
[root@hw27:alsa-utils-1.0.14rc2#] make
[root@hw27:alsa-utils-1.0.14rc2#] make intall
여기까지가 ALSA 라이브러리와 유틸리티를 컴파일 하는 방법입니다.
다음에는 컴파일한 ALSA 라이브러리와 유틸리티를 ARM 보드에서 동작시키는 방법을 설명하도록 하겠습니다.