ARM的一些总结

#!/bin/bash

#filename:wang

 // 把一些库放到root下

echo"******************************************************"

echo     "1       运行SDL"  ***********echo "2 PC上运行MP3 "

echo     "3     生成静态库"   ***************echo  "4 生成动态库 "

echo     "5  makefile编译 "  ***************echo  "6 运行autotools"

echo     "7           挂载"  ***************echo  "8 开发板播放mp3"

echo     "9  开发板运行SDL"

echo"******************************************************"

echo "Enter Choice"

read CHOICE

case "$CHOICE" in

1)

cd /root/wangjie/yizi/SDL

 tar-zxvf SDL-1.2.14.tar.tar //解压

 cdSDL-1.2.14

 ./configure

 make&&make install

 cdtest

 gcctestsprite.c  -o wang1-I/usr/include/SDL  -L/usr/lib  -lSDL

 ./wang1

;;

 

2)

cd /root/wangjie/yizi/mp3

 tar-zxvf libid3tag-0.15.1b.tar.gz

 cdlibid3tag-0.15.1b

 ./configure --prefix=/root/wangjie

make&&make install

cd ..

tar -zxvf libmad-0.15.1b.tar.gz 

cd libmad-0.15.1b

./configure --prefix=/root/wangjie

make&&make install

cd ..

tar -zxvf madplay-0.15.2b.tar.gz

cd madplay-0.15.2b

./configure --prefix=/root/wangjie  LDFLAGS=-L/root/wangjie/lib  CPPFLAGS=-I/root/wangjie/include

make&&make install

cd /root/wangjie/bin

cp madplay /root/wangjie/yizi/mp3

cd /root/wangjie/lib

cp libid3tag.so.0.3.0  libmad.so.0.2.1 /root/wangjie/yizi/mp3

 cd/root/wangjie/yizi/mp3

./madplay a.mp3

;;

 

3)

gcc -c main.c

ar cr libmain.a  main.o

gcc -o wang3 main.c max.c -L. -lmain

./wang3

 

;;

 

4)

gcc -c -fPIC main.c

 gcc-shared -fPIC -o libmain.so main.o

export LD_LIBRARY_PATH=.

 gcc-o wang4 main.c max.c max.h

./wang4

 

;;

 

5)

echo -en file:wang50

       gccmain.c max.c -o wang5  >wang60

make -f wang50

 ./wang5

;;

 

6)

autoscan                          //

aclocal                           //

autoconf                                    //

autoheader                       //

automake--add-missing                       //

./configure                                         //

make                                                 //

./wang6

 

;;

 

7)

arm-linux-gcc main.c max.c -o wang7

cd /etc/init.d

 ./nfs stop

./nfs start

cd ~

echo "mountnfs"

minicom

echo "以下不可以在开发板上执行因为开发板上缺少GCC"

mountnfs 192.168.1.18:/root/wangjie  /mnt/nfs

echo "以下不可以在开发板上执行因为开发板上缺少GCC"

cd /mnt/nfs

cd /dev

/mnt/nfs/wang7 >> tty0

 

;;

 

 

8)

cd /root/wangjie/yizi/mp3

 tar-zxvf libid3tag-0.15.1b.tar.gz

 cdlibid3tag-0.15.1b

 ./configure --prefix=/root/wangjie  --host=arm-linux

make&&make install

cd ..

tar -zxvf libmad-0.15.1b.tar.gz 

cd libmad-0.15.1b

./configure --prefix=/root/wangjie  --host=arm-linux

make&&make install

gedit Makefile

echo "请修改Makefile文件"

echo "Do you wang to continue"

read ANSWER

if [ $ANSWER=y -o $ANSWER=Y ]

 

make&&make install

cd ..

tar -zxvf madplay-0.15.2b.tar.gz

cd madplay-0.15.2b

./configure --prefix=/root/wangjie  LDFLAGS=-L/root/wangjie/lib  CPPFLAGS=-I/root/wangjie/include  --host=arm-linux

make&&make install 

cd /root/wangjie/bin

cp madplay /root/wangjie

cd /root/wangjie/lib

cp libid3tag.so.0.3.0  libmad.so.0.2.1 /root/wangjie

then

exit

fi

 

cd /etc/init.d

 ./nfs stop

./nfs start

cd  ~

minicom

echo "以下不可以在开发板上执行因为开发板上缺少GCC"

mountnfs 192.168.1.18:/root/wangjie/mnt/nfs

cd /mnt/nfs

cp libid3tag.so.0.3.0  libmad.so.0.2.1 /mnt/nfs/Qtopia/lib -f

./madplay a.mp3

 

;;

9)

cd /root/wangjie/yizi/SDL

 tar-zxvf SDL-1.2.14.tar.tar

 cdSDL-1.2.14

./configure --prefix=/usr/arm  --enable-shared=yes --enable-nasm=yes  --enable-audio=yes --enable-oss=yes--enable-joystick=no  --enable-cdrom=no--enable-threads=yes --enable-timers=yes --enable-file=yes --enable-esd=no --enable-arts=no --enable-nas=no--enable-diskaudio=no --enable-mintaudio=no --enable-video-x11=no --enable-dga=no --enable-video-x11-vm=no--enable-video-x11-dgamouse=no --enable-video-x11-xv=no --enable-video-x11-xinerama=no--enable-video-x11-xme=no --enable-video-dga=no --enable-video-photon=no--enable-video-directfb=no --enable-video-ps2gs=no  --enable-video-opengl=no --enable-pth=no--enable-pthreads=yes --enable-pthread-sem=no --enable-input-events=no --build=arm--host=arm-linux CC=arm-linux-gcc AR=arm-linux-ar --enable-input-tslib=yesCPPFLAGS=-I/usr/arm/include LDFLAGS=-L/usr/arm/lib

make&&make install

cd test

arm-linux-gcc testsprite.c -o wang9-I/root/wangjie/arm/include/SDL -L/root/wangjie/arm/lib -lSDL

 

cd /etc/init.d

 ./nfs stop

./nfs start

cd ~

echo "以下不可以在开发板上执行因为开发板上缺少GCC"

minicom

echo "*****"

mountnfs 192.168.1.18:/root/wangjie/mnt/nfs

cd /mnt/nfs

cp /root/wangjie/lib/libSDL*/mnt/nfs/Qtopia/lib -f

cd SDL-1.2.14

cd test

./wang9

 

;;

 

 

 

esac

1.挂载:

主机

ifconfig

cd  /etc/init.d

./nfs stop

./nfs start

gcc  *.c(hello.c) -o 可执行文件名(a)

或者:arm-linux-gcc  *.c(hello.c) -o 可执行文件名(a)

开发板:

minicom -s

mountnfs IP(192.168.1.13主机IP):路径(/root/wang)  /mnt/nfs

cd  /dev

/mnt/nfs/可执行的文件名(a) >> tty0

./a(可执行文件名)

2.makefile工具

vim a

file:a

tab键gcc *.c(hello.c) -o s(可执行文件名)

make                                                                                        //名称(a))

./名称(a)

3.autotools

hello.c                                                                                     //函数的实现

hello.h                                                                                     //函数的声明

main.c                                                                                    //主函数

gedit Makefile

{

AUTOMAKE_OPTIONS=foreign                                           //设置automake的选项

bin_PROGRAMS=test(可执行文件名)                                //生成可执行文件名

test_SOURCES=test.c(依赖的文件名)                               //可执行文件依赖的文件

}

autoscan                                                  //生成configure.scan                        

mv configure.scan  configure.in

gedit configure.in

{

AC_INIT(test软件名,1.0版本号)

AM_INIT_AUTOMAKE                               //automke的宏

AC_PROG_RANLIB                     

//AC_CONFIG_FILES([Makefile])

}

aclocal                                                    //生成aclocal.*

autoconf                                                  //生成configure脚本

autoheader                                           //生成模板文件configure.in(configure脚本的宏定义)

automake  --missing                             //让automake添加必要的脚本

./configure                                             //生成Makefile文件

make                                                     //生成可执行文件

./test

make dist                                                 打包

4:图片移植

pc机上:

tar  -xvzf SDL-1.2.14

./configure

make

make install

cd test

gcc testsprite.c -o test-I/usr/include/SDL -L/usr/lib

./test

 

 

pc:                                                   //交叉编译

cd SDL-1.2.14

 ./configure--prefix=/usr/arm  --enable-shared=yes --enable-nasm=yes --enable-audio=yes --enable-oss=yes --enable-joystick=no --enable-cdrom=no --enable-threads=yes --enable-timers=yes --enable-file=yes --enable-esd=no --enable-arts=no --enable-nas=no--enable-diskaudio=no --enable-mintaudio=no  --enable-video-x11=no--enable-dga=no --enable-video-x11-vm=no --enable-video-x11-dgamouse=no--enable-video-x11-xv=no --enable-video-x11-xinerama=no--enable-video-x11-xme=no --enable-video-dga=no --enable-video-photon=no--enable-video-directfb=no --enable-video-ps2gs=no --enable-video-opengl=no --enable-pth=no --enable-pthreads=yes--enable-pthread-sem=no --enable-input-events=no --build=arm --host=arm-linuxCC=arm-linux-gcc (使用版本为3.3.2的交叉编译器)AR=arm-linux-ar--enable-input-tslib=yes CPPFLAGS=-I/usr/arm/include LDFLAGS=-L/usr/arm/lib

 make

make install

cd test

arm-linux-gcc testsprite.c -o test-I/usr/arm/include/SDL  -L/usr/arm/lib -lSDL

 

开发板:

cd nfs

cp libSDL* /mnt/yaffs/Qtopia/lib

cd SDL-1.2.14

cd test

./test

 5.音乐移植

tar -zxvf   三个文件.tar.gz

cd libid3tag-0.15.1b

./configure  --prefix=/root/wang(路径)  --host=arm-linux

make&&make intall

cd ..

cd libmads0.0.21

./configure  --prefix=/root/wang(路径)  --host=arm-linux

make                                                      //出错

geditMakefile                                        //改错(-fforce-men)

make&&make intall

cd  madplay*

./configure  --prefix=/root/wang(路径)LDFLAGS=-L/root/wang/lib CPPFLAGS=-I/root/wang/include  --host=arm-linux

make&&make install

开发板:

cd /mnt/nfs

cp lib*.so.* /mnt/yaffs/Qtopia/lib -f

拷贝lib和madply放在挂载的文件夹中 libmad.so.o.2.1   libid3tag.so.o.30

./madplay    *.mp3(歌曲)

6.静态库(lib*.a)

gcc *.c(hello.c)    -c                                //生成hello.o源文件

ar cr lib*.a(hello.a) hello.o                     //生成libhello.a

gcc -o main(可执行文件名)  *.c(main.c hello.c)  -L.(路径.当前目录) -lhello(链接库名)

./main(可执行文件名)

7.动态库(lib*.so)

 gcc  -c -fPIChello.c                               //生成hello.o

gcc -shared  -fPIC  -olibhello.so  hello.o//生成libhello.so    

 export LD_LIBRARY_PATH=.(当前目录/root)

gcc -o main(可执行文件名)  *.c(hello.cmain.c)   -L.

./main

8 GDB调试

gcc -g(加入一些gdb的调试信息) *.c(hello.c)   -o(指定编译后可执行的文件名) hello(可执行文件名)

gdb

file hello

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值