Chinaunix首页 | 论坛 | 博客
  • 博客访问: 312872
  • 博文数量: 68
  • 博客积分: 1501
  • 博客等级: 上尉
  • 技术积分: 1010
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-30 09:52
文章分类

全部博文(68)

文章存档

2010年(1)

2009年(67)

我的朋友

分类:

2009-01-07 14:16:19

madplay  移植经历

1: wget 

cd  mad-0.10.1b

./configure

生成Makefile

 再修改Makefile 

ARCH= -march=armv4

CC=armv4l-unknown-linux-gcc
AR=armv4l-unknown-linux-ar
RANLIB=armv4l-unknown-linux-ranlib

make  即可得到

体会: 对于象这种由configure 脚本生成Makefile的源码程序的移植的方法, 往往在别人的帖子中看到的是
./configure 后面加上合适的选项生成Makefile编译出可执行程序,我上面采用的对于不容易写configure选项的
软件移植时,也不失为一种方法, 我还要多次试验方可下结论。

file madplay
/madplay: ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.0.0, dynamically linked (uses shared libs), not stripped

可见是动态连接的,如想静态连接,则拷贝 make的输出中的最后一个命令, 在其后面加上-static
[root@hujunlinux mad-0.10.1b]# armv4l-unknown-linux-gcc  -o madplay madplay.o id3.o id3v2.o audio.o audio_null.o audio_wav.o audio_raw.o audio_oss.o libmad.a -static
[root@hujunlinux mad-0.10.1b]# file madplay
madplay: ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.0.0, statically linked, not stripped


下载到2410板子上:
[root@Today2410 /usr]# ln -s /dev/sound/dsp   /dev/audio
[root@Today2410 /usr]# ./madplay.static sample/ningxia.mp3
MPEG Audio Decoder version 0.10.1 (beta) - Copyright (C) 2000 Robert Leslie
 Title: 宁夏                            Artist: 梁静茹
 Album: 燕尾蝶下定爱的决心               Genre: Pop
  Year: 2004  Track: 1                 Comment:
ID3: version 2.3.0, flags 0x00, size 246 bytes
 Lead performer(s)/Soloist(s): 梁静茹
 Title/Songname/Content description: 宁夏
 Album/Movie/Show title: 燕尾蝶下定爱的决心
 Year: 2004
 Track number/Position in set: 1
 Comments:
                                                                               
 Content type: Pop


正常放音。

说明:此次移植的环境是2.4.18 kernel  + armv4l  toolchain  ,filesystem.


参考文档:



这里有splay_fp版本的。

madplay也可以播放的,libmad是定点运算的。播放很流畅。

如果采用madplay,需要libmad, libid3tag, zlib等。

我给出我的configure

1.
编译zlib 因为libid3tag需要这个库
./configure --prefix=/usr/local/arm/2.95.3/arm-linux
修改Makefile
AR=/usr/local/arm/2.95.3/bin/arm-linux-ar
CC=/usr/local/arm/2.95.3/bin/arm-linux-gcc
RANLIB=/usr/local/arm/2.95.3/bin/arm-linux-ranlib

最后AR 命令要添加rcs,否则出错

make
make install

2.
编译libid3tag
./configure --host=arm-linux CC=arm-linux-gcc --disable-debugging --disable-shared --prefix=/usr/local/arm/2.95.3/arm-linux
make
make install

3.
编译libmad
./configure --enable-fpm=arm --host=arm-linux --disable-shared --disable-debugging --prefix=/usr/local/arm/2.95.3/arm-linux CC=arm-linux-gcc
make
make install

4.
编译madplay
./configure --host=arm-linux CC=arm-linux-gcc --disable-debugging --disable-shared
make
但是,这样得到的是动态连接的。
rm madplay
拷贝make的最后一个连接的命令,在最后加上-static,然后运行,得到静态连接的程序
OK
阅读(1536) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~