Ghostscript移植
1,下载ghostscript-9.04.tar.bz2
wget http://iweb.dl.sourceforge.net/project/ghostscript/GPL%20Ghostscript/9.04/ghostscript-9.04.tar.bz2
2,解压源码
tar xvjf ghostscript-9.04.tar.bz2
3,分别拷贝为PC版本和ARM版本
cp ghostscript-9.04 ghostscript-9.04-arm -r && mv ghostscript-9.04 ghostscript-9.04-pc
4,编译PC版本
cd ghostscript-9.04-pc && ./configure && make XCFLAGS=-DHAVE_SYS_TIME_H=1 && cd ../
5,修改Makefile.in中STDLIBS=@PTHREAD_LIBS@ -lm 为STDLIBS=@PTHREAD_LIBS@ -static -lm
cd ghostscript-9.04-arm &&
sed -i '387s/STDLIBS=@PTHREAD_LIBS@ -lm/STDLIBS=@PTHREAD_LIBS@ -static -lm/' ./Makefile.in
6,修定/tmp目录,在开发板路里也要有这个目录才可以
sed -i '74s/"\/tmp\/"/"\/data\/misc\/printer\/tmp\/"/' ./base/gp_unifs.c
7,配置arm版本
./configure --host=arm-linux --prefix=/system/usr/ --disable-fontconfig --disable-gtk --disable-cups
8,拷贝PC版本工具
test -d ./obj/aux || mkdir -p obj/aux/ && cp ../ghostscript-9.04-pc/obj/aux/genarch ../ghostscript-9.04-pc/obj/aux/genconf ../ghostscript-9.04-pc/obj/aux/echogs ../ghostscript-9.04-pc/obj/aux/mkromfs ./obj/aux/
9,编译
make XCFLAGS=-DHAVE_SYS_TIME_H=1 || cp ../ghostscript-9.04-pc/obj/aux/mkromfs ./obj/aux/ && make XCFLAGS=-DHAVE_SYS_TIME_H=1
10,安装
make install DESTDIR=${DESTDIR}
rm -rf ${DESTDIR}/system/usr/share/ghostscript/9.04/doc
rm -rf ${DESTDIR}/system/usr/share/ghostscript/9.04/examples
cd ${DESTDIR}/system/usr/bin && rm -f !(gs) && cd - &&
cd ${DESTDIR}/ && tar cvzf gs904.tar.gz system/
11.测试
./bin/gs -q -dBATCH -dSAFER -dQUIET -dNOPAUSE -sPAPERSIZE=a4 -r1200x1200 -sDEVICE=pbmraw -sOutputFile=./test.pbm test.pdf
此时会生成test.pbm文件
移植cups-1.3.9到
1,移植时需要cpus的动态库支持所以要先安装cpus
cups-1.3.9下载地址, wget http://www.cups.org/software/1.3.9/cups-1.3.9-source.tar.gz
<span style="color:#212529">git clone -b branch-2.2 https://github.com/apple/cups.git cups-2.2</span>
2,解压
tar xvjf ghostscript-9.04.tar.bz2
3,配置
./configure --host=arm-linux --target=arm-linux --build=i686-linux CC=arm-linux-gcc CXX=arm-linux-g++ LD=arm-linux-ld RANLIB=arm-linux-ranlib AR=arm-linux-ar --disable-gnutls --disable-gssapi --disable-dbus --prefix=/
4,修改Makefile第22行
把locale man monitor修改为locale monitor
5,编译并且安装
make && make install DSTROOT=${PWD}/_install
./_install/etc/init.d/cups start
cupsd: Child exited with status 1!
cups: unable to start scheduler.
结束
foo2xqx移植
1,下载地址
2,修改makefile,
修改动态链接库的支持:
command2foo2lava-pjl: command2foo2lava-pjl.o
#注释掉 $(CC) $(CFLAGS) -L/usr/local/lib command2foo2lava-pjl.o -lcups -o $@
$(CC) $(CFLAGS) -L$(HOME)/cups/cups-2.0/out/opt/usr/local/lib command2foo2lava-pjl.o -lcups -o $@
修改command2foo2lava-pjl.c文件
//#include <cups/sidechannel.h>
//#include <cups/cups.h>
//#include <cups/ppd.h>
#include "${PWD}/_install/usr/include/cups/sidechannel.h"
#include "${PWD}/_install/usr/include/cups/cups.h"
#include "${PWD}/_install/usr/include/cups/ppd.h"
3,编译
make CC=arm-linux-gcc
使CC=arm-linux-gcc,然后make,
注意:cp版本和arm版本不能在同一文件夹下交替编译
使用编译出来的getweb程序,命令./getweb 1020得到sihp1020.img
这时候再用我们刚才用x86 gcc编译的arm2hpdl工具将sihp1020.img转化为sihp1020.dl(这一步非常重要)
将生产的sihp1020.dl和foo2zjs拷贝至开发板端的文件系统中。完成
3,测试
执行命令,可以得到打印机的相关信息
./usb_printerid /dev/usb/lp0
GET_DEVICE_ID string:
MFG:Hewlett-Packard;MDL:HP LaserJet M1005;CMD:ACL;CLS:PRINTER;DES:HP LaserJet M1005;FWVER:20141010;
打印测试
./foo2xqx -p9 -r1200x1200 test.pbm > /dev/usb/lp0
4,添加打印机:
/opt/usr/local/sbin/lpadmin -p HP_LaserJet_P1008 -E -v /dev/usb/lp0 -m /opt/usr/local/etc/cups/ppd/hp-laserjet_p1008.ppd
5,设置默认打印机
lpoptions -d HP_LaserJet_P1008
6,其他
生成固件: ./getweb P1008
利用x86平台的arm2hpdl ./arm2hpdl sihpP1006.img > sihpP1008.dl
cat /bin/sihpP1007.dl > /dev/lp0
将需要的可执行文件copy到板子上