主机平台: UBUNTU16.04
硬件平台:明远智睿MY-IMX8M-EVK
内核版本 :Linux-4.14.98
交叉编译链:aarch64-linux-gnu
文件系统:fsl-image-qt5-validation-imx-imx8mqevk.rootfs.tar.bz2
设置交叉工具链: $ source /home/jj/my-work/03_toolchain/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.env $export CC=aarch64-linux-gnu-gcc 把源码包复制到虚拟机后解压: $ tar xzvf jpegsrc.v9c.tar.gz $ tar xzvf libpng-1.6.37.tar.gz $ tar xzvf zlib-1.2.11.tar.gz
$ mkdir gsnap $ cd gsnap/ $ mkdir jpeg zlib png install $ mv gsnap.c /home/jj/my-work/transplant/gsnap/install
jpeg库编译安装: $ cd ../jpeg-9c/ $ ./configure --host=aarch64-linux-gnu --prefix=/home/jj/my-work/transplant/gsnap/jpeg/ $ make $ make install
zlib库编译安装: $ cd ../zlib-1.2.11/ $ ./configure --prefix=/home/jj/my-work/transplant/gsnap/zlib/ $ make $ make install
png库编译安装: $ cd ../libpng-1.6.37/ $ ./configure --host=aarch64-linux-gnu --prefix=/home/jj/my-work/transplant/gsnap/png/ $ make $ make install
gsnap编译: $ cd ../gsnap/install/ $ $CC gsnap.c -o gsnap -L/home/jj/my-work/transplant/gsnap/jpeg/lib/ -I/home/jj/my-work/transplant/gsnap/jpeg/include/ -L/home/jj/my-work/transplant/gsnap/zlib/lib/ -I/home/jj/my-work/transplant/gsnap/zlib/include/ -L/home/jj/my-work/transplant/gsnap/png/lib/ -I/home/jj/my-work/transplant/gsnap/png/include/ -lpng -ljpeg -lz -lm
将编译生成的gsnap可执行文件复制到开发板文件系统的/usr/bin/目录
打包库和头文件 cd .. sudo tar -cjf gsnaplib.tar.bz2 peg/lib/* ./zlib/lib/* ./png/lib/* sudo tar -cjf gsnap_include.tar.bz2 ./jpeg/include/* ./zlib/include/* ./png/include/*
将gsnaplib.tar.bz2拉到开发板文件系统的/usr/lib目录下 并且解压 sudo tar -xvf gsnaplib.tar.bz2 rm gsnaplib.tar.bz2
将gsnap_include.tar.bz2拉到开发板文件系统的/usr/lib目录下 并且解压 sudo tar -xvf gsnap_include.tar.bz2 rm gsnap_include.tar.bz2
运行gsnap fb.jpg /dev/fb0
|