首先说一下大环境和总体步骤:
下载lirc 0.8.7源码,使用ubuntu的setup.sh,配置为mceusb的驱动,生成configure.sh,然后丢到raspberry中,只改为如下:
./configure \
--with-moduledir=/lib/modules/3.2.0-29-generic/misc
\
--without-x
\
--with-kerneldir=/media/61f7e2bf-c92c-4a36-8b26-9c175f2f286b/kernel
\
--with-driver=mceusb \
--with-major=61 \
--with-port=none
\
--with-irq=none \
其中主要是指定了内核树位置,这个位置的内核树是从android SDK中编译好的内核数拿过来的,如果要开debug信息,则加上:
--enable-debug \
然后运行configure.sh,
生成make文件,再运行make命令,即可生成所需的。
然后在raspberry上安装,记录下安装的输出,在android上做同样的操作,具体如下:
首先使根目录可读写:(主要参考:http://blog.chinaunix.net/uid-24856020-id-3389654.html)
adb remount
adb shell
mount -o remount,rw rootfs /
安装lirc_dev.ko:
adb push lirc_dev.ko /system/lib/modules/lirc_dev.ko
adb shell
cd /system/lib/modules
chmod 644 lirc_dev.ko
insmod /system/lib/modules/lirc_dev.ko
然后创建节点:
busybox mknod /dev/lirc c 61 0
然后安装lirc_mceusb.ko:
adb push lirc_mceusb.ko /system/lib/modules/lirc_mceusb.ko
adb shell
cd /system/lib/modules
chmod 644 lirc_mceusb.ko
insmod /system/lib/modules/lirc_mceusb.ko
然后:
adb push irrecord /system/bin/
adb shell
chmod 777 irrecord
创建目录并挂载节点:
mkdir -p /var/run/lirc
busybox mknod /var/run/lirc/lircd p
busybox mknod /var/run/lirc/lircm p
创建目录:
mkdir -p /etc/lirc
adb push lircd.conf.mceusb /etc/lirc/lircd.conf
adb shell
chmod 644 /etc/lirc/lircd.conf
#adb push lircmd.conf /etc/lirc/lircmd.conf
#chmod 644 /etc/lirc/lircmd.conf //注释:lircmd.conf没找到
adb push lircd /system/bin
adb push lircmd /system/bin
复制lib文件:
adb push liblirc_client.la /system/lib
adb push liblirc_client.so.0.2.1 /system/lib
adb shell
cd system/lib
ln -s liblirc_client.so.0.2.1 liblirc_client.so.0
ln -s liblirc_client.so.0.2.1 liblirc_client.so //注释:ln -s -f liblirc_client.so.0.2.1 liblirc_client.so不成功
adb push liblirc_client.a /system/lib
adb push liblirc_client.lai /system/lib
chmod 644 /system/lib/liblirc*
为保险起见,又将所有复制到/system/lib的文件又复制到 /usr/local/lib下了。(测试发现不用复制)
最后执行lircd,出现system/bin sh:lircd: No such file or directory的错误,最后参考:
http://bbs.csdn.net/topics/390349057?page=1#post-393513107
执行:readelf -l lircd
输出如下:
Elf file type is EXEC (Executable file)
Entry point 0x9e3c
There
are 8 program headers, starting at offset 52
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz
MemSiz Flg Align
EXIDX 0x016420 0x0001e420 0x0001e420 0x00008
0x00008 R 0x4
PHDR 0x000034 0x00008034 0x00008034 0x00100
0x00100 R E 0x4
INTERP 0x000134 0x00008134 0x00008134 0x00019
0x00019 R 0x1
[Requesting program interpreter:
/lib/ld-linux-armhf.so.3]
LOAD 0x000000 0x00008000 0x00008000
0x1642c 0x1642c R E 0x8000
LOAD 0x017000 0x00027000 0x00027000
0x01464 0x03c38 RW 0x8000
DYNAMIC 0x01700c 0x0002700c 0x0002700c
0x000f0 0x000f0 RW 0x4
NOTE 0x000150 0x00008150 0x00008150
0x00044 0x00044 R 0x4
GNU_STACK 0x000000 0x00000000 0x00000000
0x00000 0x00000 RW 0x4
Section to Segment mapping:
Segment Sections...
00 .ARM.exidx
01
02 .interp
03 .interp .note.ABI-tag
.note.gnu.build-id .hash .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r
.rel.dyn .rel.plt .init .plt .text .fini .rodata .ARM.exidx .eh_frame
04
.init_array .fini_array .jcr .dynamic .got .data .bss
05 .dynamic
06 .note.ABI-tag .note.gnu.build-id
发现缺少:/lib/ld-linux-armhf.so.3
从raspberry中将该库考到android的相同位置,
chmod 777 /lib/ld-linux-armhf.so.3
然后运行:
lircd: error while loading shared libraries: libc.so.6: cannot open shared
objec
t file: No such file or directory
发现缺少:libc.so.6,同样考入android的/system/lib下;
运行lircd,出现:
lircd: could not open logfile
lircd: No such file or directory
修改logfile的路径为"/dev/null",
运行lircd,ok!,运行irw,ok!
自动生成解码配置文件:
irrecord -f /sam_conf //注释:/sam_conf配置文件路径及名称