[Embedded] Cross compile and transplant MPlayer to ARM development board (Method 2)

1. Basic information

1. Transplant environment

①:ubuntu16.04

②: iMX6Q development board

2. Software source code required for transplantation

①: zlib zlib download

②: alsa-lib alsa-lib download

③: mplayer mplayer download

Two, install zlib

1: Version selection: zlib-1.2.8.tar.gz

2: Configure zlib

CC=arm-linux-gnueabihf-gcc ./configure --prefix=/home/icedustpan/software/zlib

①:CC=arm-linux-gnueabihf-gcc

My cross-compilation tool chain: arm-linux-gnueabihf-gcc

②:–prefix=/home/icedustpan/software/zlib

Installation path: /home/icedustpan/software/zlib

Insert picture description here

3: Compile zlib

make

4: Install zlib

make install

Insert picture description here

Three, install alsa-lib

1: Version selection: alsa-lib-1.0.22

2: Configure alsa-lib

Create configuration script

vim icedustpan.sh

Fill in the configuration below

#!/bin/sh
./configure \
        --host=arm-linux-gnueabihf \
        CC=arm-linux-gnueabihf-gcc \
        --enable-shared \
        --disable-python \
        --prefix=/usr/local/mplayer

①:–host=arm-linux-gnueabihf

Entangling editing tool chain

②:–prefix=/usr/local/mplayer

The installation path, the compiled library files will be placed on the development board later, and the location of the library files must be the path specified by --prefix! ! !
The installation path, the compiled library files will be placed on the development board later, and the location of the library files must be the path specified by --prefix! ! !
The installation path, the compiled library files will be placed on the development board later, and the location of the library files must be the path specified by --prefix! ! !

Grant permissions

chmod +x icedustpan.sh

Execute configuration script

./icedustpan.sh

Insert picture description here

3: Compile alsa-lib

make

4: Install alsa-lib

Enter the root user installation

sudo su

Import the cross compilation environment

export PATH=/usr/lib/gcc/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin:$PATH

installation

make install

Insert picture description here

Fourth, install mplayer

1: Version selection: MPlayer-1.4.tar.xz

2: Configure mplayer

Create configuration script

vim icedustpan.sh

Fill in the configuration below

Should not add --disable-ossaudio \

#!/bin/sh 
./configure \
	--enable-cross-compile --prefix=/usr/local/mplayer \
	--cc=arm-linux-gnueabihf-gcc  --ar=arm-linux-gnueabihf-ar  --as=arm-linux-gnueabihf-as \
	--ranlib=arm-linux-gnueabihf-ranlib \
	--target=arm-armv7-linux \
	--prefix=./build \
	--enable-alsa \
	--extra-cflags="-I/home/icedustpan/software/zlib/include -I/usr/local/mplayer/include/" \
	--extra-ldflags="-L/home/icedustpan/software/zlib/lib -L/usr/local/mplayer/lib -lasound" \
	--enable-ass \
	--host-cc=gcc \
	--enable-fbdev --disable-dvdread \
	--disable-dvdnav --disable-jpeg --disable-tga \
	--disable-pnm --disable-tv --disable-ivtv \
	--disable-xanim --disable-win32dll --disable-armv5te --disable-armv6 \
	--disable-png  2>&1 |tee logfile
#!/bin/sh 
./configure \
	--enable-cross-compile --prefix=/usr/local/mplayer \
	--cc=arm-linux-gnueabihf-gcc  --ar=arm-linux-gnueabihf-ar  --as=arm-linux-gnueabihf-as \
	--ranlib=arm-linux-gnueabihf-ranlib \
	--target=arm-armv7-linux \
	--prefix=./build \
	--disable-ossaudio \
	--enable-alsa \
	--extra-cflags="-I/home/icedustpan/software/zlib/include -I/usr/local/mplayer/include/" \
	--extra-ldflags="-L/home/icedustpan/software/zlib/lib -L/usr/local/mplayer/lib -lasound" \
	--enable-ass \
	--host-cc=gcc \
	--enable-fbdev --disable-dvdread \
	--disable-dvdnav --disable-jpeg --disable-tga \
	--disable-pnm --disable-tv --disable-ivtv \
	--disable-xanim --disable-win32dll --disable-armv5te --disable-armv6 \
	--disable-png  2>&1 |tee logfile

①:–extra-cflags="-I/home/icedustpan/software/zlib/include -I/usr/local/mplayer/include/"

The include file path of zlib and alsa-lib compiled earlier

②:–extra-cflags="-I/home/icedustpan/software/zlib/include -I/usr/local/mplayer/include/"

The lib file path of zlib and alsa-lib compiled earlier

Grant permissions

chmod +x icedustpan.sh

Execute configuration script

./icedustpan.sh

3: Compile mplayer

make

Five, transplant related library files

1. Copy zlib

The installation path specified before: /home/icedustpan/software/zlib/lib

libz.so

libz.so.1

libz.so.1.2.8

Copy the three files to the /usr/lib/ directory of the development board

sudo cp /home/icedustpan/software/zlib/lib/ -a .

2. Copy mplayer

Copy the compiled mplayer to the /bin directory of the development board

sudo cp /home/icedustpan/software/MPlayer-1.4/mplayer .

3. Copy alsa-lib

Copy libasound.so.2.0.0 in the /usr/local/mplayer/lib/ directory to the /lib directory of the development board

sudo cp /usr/local/mplayer/lib/libasound.so.2.0.0 .

/usr/local/mplayer/lib This path is specified by our previous compilation and must be the same

And the soft link is libasound.so.2

sudo ln -s libasound.so.2.0.0 libasound.so.2

Next, copy the entire mplayer directory under the /usr/local/ directory to /usr/local/ of the development board

sudo cp /usr/local/mplayer/ -a .

Guess you like

Origin blog.csdn.net/weixin_44205779/article/details/107960678