创建于2017/06/16:
开发平台:Freescale i.MX6 Ultralite (Device Tree)
processor : 0
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 48.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5
Hardware : Freescale i.MX6 Ultralite (Device Tree)
Revision : 0000
Serial : 0000000000000000
软件平台:ubuntu 64-bit 14.0,编译器:arm-linux-gnueabihf-gcc
0.编译QT-4.8.6
a.下载 qt-everywhere-opensource-src-4.8.6.tar.gz
b.tar -zxvf qt-everywhere-opensource-src-4.8.6.tar.gz
c. 在qt目录下新建一个脚本文件
将如下内容拷贝到.sh文件
#!/bin/sh
./configure \
-verbose \
-prefix /arm-install/nuc970/Trolltech \
-opensource \
-confirm-license \
-release -shared \
-embedded arm \
-xplatform qws/linux-arm-g++ \
-depths all \
-fast \
-optimized-qmake \
-qt-libjpeg \
-qt-zlib \
-qt-libpng \
-qt-freetype \
-qt-libtiff \
-qt-mouse-linuxinput \
-little-endian -host-little-endian \
-no-libmng \
-no-webkit \
-declarative \
-no-qt3support \
-no-mmx -no-sse -no-sse2 \
-no-3dnow \
-no-openssl \
-no-qvfb \
-no-phonon \
-no-nis \
-no-cups \
-no-pch \
-no-xcursor -no-xfixes -no-xrandr -no-xrender \
-no-separate-debug-info \
-nomake examples -nomake tools -nomake docs \
-qt-sql-sqlite \
-qt-gfx-linuxfb \
-qt-gfx-transformed \
注意:-prefix
-xplatform
两个变量,还有mkspecs\qws\ 目录下面指定的编译器
make
make install
然后再将-prefix中路径中的lib/下so库拷贝到开发板中
1.编译openssl
安装的时候注意sudo 引起的环境变量问题
切换到root用户
./config no-asm shared --prefix=/home/jetchen/soft/arm-install --cross-compile-prefix=arm-linux-gnueabihf-
sudo -s
去掉makefile中的-m64
执行make -j8
make install
2.编译mqtt
(1)修改makefile中指向第一步编译的openssl库和头文件的路径
(2)
make CC=arm-none-linux-gnueabi-arm
make CC=arm-linux-gnueabihf-gcc
安装之前需要:
sudo make uninstall
sudo make install
(3)生成动态库,本例中选用的是libpaho-mqtt3as.so
检查生成的动态库是不是arm文件格式
file libpatho-mqtt3as.so.1.0
如果如下面所示:
libpaho-mqtt3as.so.1.0: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[sha1]=32a481e898440c5369ff4b3e79c053f985b5ee51, not stripped
需要手动拷贝另此so库的索引文件,make install不会拷贝到lib目录中.
(4)动态库指定路径
export LD_LIBRARY_PATH=xxx
或者放到板中/lib路径下面
编译工程中添加:
LIBS += -L/home/jetchen/soft/arm-install/zlg/lib -lpaho-mqtt3as -lssl -lcrypto
(5)首先检查板子是否能联通外网
ping 8.8.8.8
如果不能联网,是要设置网关
route add default gw 192.168.0.1
//完成mqtt 移植
1.交叉编译openssl
2.生成mqtt动态库
//代码备份
修复rtc
3.增加sim800c模块GPRS上网
(1).修改epc_m6g2c_wifi_defconfig,使其支持ppp协议
(2).编译ppp,make CC=arm-linux-gnueabihf-gcc
nslookup reg.yunba.io 114.114.114.114
nslookup www.narwhale.io 8.8.8.8
wr vi /etc/resolv.conf
nameserver 10.202.72.118
nameserver 114.114.114.114
nameserver 8.8.8.8
//下面这两个域名才能访问yunba.io
nameserver 223.5.5.5
nameserver 223.6.6.6
i.MX 6UltraLite
ppp模块需要在文件系统中写入/etc/resolv.conf文件,系统默认是只读的,因此在系统启动的时候需要加上
mount -o remount,rw rootfs /
//查看字符串
grep -r hello /home
12.修改uboot delay 时间的文件:common/autoboot.c
setenv bootdelay
13.编译qrencode
//不需要libpng支持
./configure --prefix=/home/jetchen/soft/arm-install/zlg --host=arm-linux-gnueabihf --with-tools=no
make
make install
14.gprs模块增加cmux模块,可以在保证ppp拨号的时候能够读取信号质量和sim模块其它数据:
(1)make ARCH=arm menuconfig
(2):> Device Drivers > Character devices
---> GSM MUX line disciipline support
选项选择y
或者 在 linux-src\arch\arm\configs\epc_m6g2c_wifi_defconfig 配置文件中添加剂CONFIG_N_GSM=y
受影响的源码在:
linux-src\drivers\tty\n_gsm.c
才可以使用cmux
给root用户添加密码
su - root Password: su: Authentication failure Sorry.
这时候输入
$ sudo passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
这时候就可以进入根目录了。
添加驱动模块
给系统添加一个iic接口的按键驱动为例,本项目中采用芯片是zlg7290,简要操作步骤如下:
1.在linux-3.10.x\drivers\目录下面添加一目录:
mkdir i2c-key-board
2.在i2c-key-borad目录中新建两个文件:Kconfig Makefile
Kconfig内容:
#
# Touchscreen driver configuration
#
config ZLG_I2C_KEY
tristate "i2c keyboard driver"
depends on INPUT && I2C
default m
help
i2c key board driver
Makefile内容:
#
# Makefile for the touchscreen drivers.
#
# Each configuration option enables a list of files.
obj-$(CONFIG_ZLG_I2C_KEY) += zlg_i2c_driver_mod.o
zlg_i2c_driver-objs := xxx_source_file.o
3.添加源文件xxx_source_file.c
4.在drivers目录下,修改Kconfig 和Makefile文件,分别在两文件结尾加上:
Kconfig 文件中添加 :source "drivers/i2c-key-borad/Kconfig"
Makefile中添加:
obj-$(CONFIG_ZLG_I2C_KEY) += i2c-key-borad/
5.添加完成后,make menuconfig 可以在
Device Drivers---->
<>i2c keyboard driver
配置成M,方便调试。