2017年(111)
分类: LINUX
2017-06-19 18:13:07
RK3288 系统软件搭建手册
略
略
1、sudo apt-get update
2、sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libwxgtk2.8-dev build-essential zip curl libncurses5-dev zlib1g-dev genromfs u-boot-tools libxml2-utils texinfo mercurial subversion whois
3、安装64位系统补丁包
sudo apt-get install lsb-core libc6-dev-i386 g++-multilib lib32z1-dev lib32ncurses5-dev
4、安装jdk
sun-java6-jdk不能用apt-get安装,使用安装文件jdk-6u27-linux-i586.bin来安装
或者jdk-7u79-linux-x64.tar.gz安装1.7版本的
4.1、安装java1.6 for android 4.4
chmod +x jdk-6u27-linux-i586.bin
sudo ./jdk-6u27-linux-i586.bin
sudo gedit /etc/profile
添加下面内容到最后:(会导致ubuntu登录不了)
#set java environment
JAVA_HOME=/home/niuyi/jdk1.6.0_27 // 注意和安装路径一致
export JRE_HOME=/home/niuyi/jdk1.6.0_27/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
4.2、安装java1.7 for android 5.1
chmod +x jdk-7u79-linux-x64.tar.gz
tar xvf jdk-7u79-linux-x64.tar.gz
sudo gedit /etc/profile
添加下面内容到最后:(会导致ubuntu登录不了)
#set java environment
JAVA_HOME=/home/niuyi/jdk1.7.0_79 // 注意和安装路径一致
export JRE_HOME=/home/niuyi/jdk1.7.0_79/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
5、降级gcc版本到4.4:
sudo apt-get install gcc-4.4 g++-4.4 g++-4.4-multilib
cd /usr/bin
sudo mv gcc gcc.bk
sudo ln -s gcc-4.4 gcc
sudo mv g++ g++.bk
sudo ln -s g++-4.4 g++
6、交叉工具链路径:
$sourcetree/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8
vi /etc/profile
PATH=$PATH:/home/niuyi/x3288_lollipop_v10/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin
PATH=$PATH:/home/niuyi/x3288_lollipop_v10/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin
7、编译uboot
cd ~/rk3288_src/android/x3288_lollipop_v10
./mk -u
生成:
./out/release/RK3288UbootLoader_V2.30.10.bin
8、编译kernel
cd ~/rk3288_src/android/x3288_lollipop_v10
sudo apt-get install lzop
./mk -k
生成:
./out/release/kernel.img
./out/release/resource.img
9、文件系统编译:
1、sudo apt-get install git
2、sudo apt-get install lib32stdc++-4.9-dev
3、sudo apt-get install lib32z1
sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6
10、busybox 交叉编译器
tar xvf arm-linux-gcc-4.4.3.tar.gz
sudo mv opt/ /usr/local/
11、make busybox 脚本:
cd ~/rk3288_src/qt/busybox-1.19.4
sudo gedit mkbusybox.sh
输入:
make
make install
dd if=/dev/zero of=initrd.img bs=1k count=8192
sudo mkfs.ext2 -F initrd.img
mkdir -p rootfs/initrd
sudo mount -t ext2 -o loop initrd.img rootfs/initrd
sudo cp _install/* rootfs/initrd/ -a
sudo umount rootfs/initrd
gzip --best -c initrd.img>ramdisk.img
sudo chmod 777 ramdisk.img
/home/niuyi/rk3288_src/x3288_lollipop_v10/rkst/mkkrnlimg ramdisk.img boot.img >/dev/null
执行:
./mkbusybox.sh
生成:
./boot.img
12、编译buildroot
make
遇到fakeroot: preload library `libfakeroot.so' not found, aborting.
按照《libfakeroot.so no found 解决办法.docx》解决
生成:
output/images/rootfs.ext2
(system.img)
下载此文件到小机即可
以上为弯路:
直接在android 4.4下
./mk -j=4 -a
13、启动app
在buildroot/output/target/etc/init.d文件夹下rcS是第一个启动的文件
随后依次启动
find . -type f -name "*" | xargs grep -n "CONFIG_LOGO_LINUX_CLUT224"
14、修改开机logo
sudo apt-get install netpbm
pngtopnm logo1.png > logo1.pnm
pnmquant 224 logo1.pnm > logo1_224.pnm
pnmtoplainpnm logo1_224.pnm > logo1_224.ppm
cp logo1_224.ppm driver/video/logo/logo_linux_clut224.ppm
编辑KConfig、Makefile
打开宏:CONFIG_LOGO_LINUX_CLUT224
mklogo.sh:
#!/bin/bash
if [ $# -eq 0 ]; then
echo "pls input file name."
else
# sudo apt-get install netpbm
pngtopnm "$1" > logo1.pnm
pnmquant 224 logo1.pnm > logo1_224.pnm
pnmtoplainpnm logo1_224.pnm > logo1_224.ppm
mv logo1_224.ppm "$1".ppm
rm logo1.pnm
rm logo1_224.pnm
rm logo1_224.ppm
# cp "$1".ppm to kernel/drivers/video/logo/logo_linux_clut224.ppm
fi
15、qte移植
<<<<下载>>>>:
qt-creator-opensource-linux-x86_64-3.0.0.run
qt-everywhere-opensource-src-4.8.4.tar.gz
arm-linux-gcc-4.4.3.tar.gz
<<<<<安装Qt-creator>>>>>>:
chmod +x qt-creator-opensource-linux-x86_64-3.0.0.run
sudo ./qt-creator-opensource-linux-x86_64-3.0.0.run
<<<<<安装Qt for Linux/X11>>>>>>:
tar xvf qt-everywhere-opensource-src-4.8.4.tar.gz
cd qt-everywhere-opensource-src-4.8.4
./configure -opensource -confirm-license -embedded x86_64 -qvfb
make (tow hours)
make install
<<<<<<<编译安装arm平台Embedded qt库 qt-everywhere-opensource-src-4.8.5:::::::>>>>>>>
http://blog.csdn.net/gatieme/article/details/22919963?spm=5176.100239.blogcont47428.5.91boCT
分四部分:
arm-linux-编译器
+ qt库(qt-everywhere-opensource-src-4.8.4.tar.gz)
+ 触摸屏库(tslib)
+ QT IDE(Qt Creator)
A、安装arm-linux-gcc-4.4.3.tar.gz
a、解压安装
tar xvf arm-linux-gcc-4.4.3.tar.gz
sudo cp -rf opt /usr/local/
b、配置环境变量
打开/etc/profile文件(修改此文件对所有用户有效)或者~/.bash_profile或者~/.bashrc下
PATH=$PATH:/usr/local/opt/FriendlyARM/toolschain/4.4.3/bin/
export PATH
source ~/.profile
c、验证
arm-linux-gcc -v
B、安装tslib触摸屏校准库
下载tslib-1.4.tar.gz
tar xvf tslib-1.4.tar.gz
./autogen.sh
问题:
./autogen.sh: 4: autoreconf: not found
是在不同版本的 tslib 下执行 autogen.sh 产生。它们产生的原因一样,是因为没有安装
automake 工具, (ubuntu 8.04)用下面的命令安装好就可以了。
sudo apt-get install autoconf automake libtool
./configure --prefix=/usr/local/tslib/ --host=arm-linux ac_cv_func_malloc_0_nonnull=yes
make
问题:
error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT in second argument needs 3 arguments
修改:
cal_fd = open (calfile, O_CREAT | O_RDWR);
->
cal_fd = open (calfile, O_CREAT | O_RDWR,0);
make
sudo make install
//交叉编译器是:/usr/local/opt/FriendlyARM/toolschain/4.4.3/bin/arm-linux-gcc -v
问题:
在开发板上运行校正程序时出现 No raw modules loaded
修改:
把 tslib/etc 目录下的 ts.conf 的 "#module_raw input"的注释符号"#"去掉。但记住不要在前面留有空格 ,否则还会出现错误。
C、编译并安装qt-4.8.4-arm
tar -xvf qt-everywhere-opensource-src-4.8.4.tar.gz
cp -rf qt-everywhere-opensource-src-4.8.4 qt-4.8.4-arm-src
cd qt-4.8.4-arm-src
./configure -v -prefix /opt/qt-4.8.4-arm -opensource -confirm-license -embedded arm -release -shared -fast -no-largefile -qt-sql-sqlite -qt3support -no-xmlpatterns -no-glib -no-phonon -no-mmx -no-3dnow -no-sse -no-sse2 -no-svg -webkit -qt-zlib -qt-libtiff -qt-libpng -qt-libjpeg -make libs -make tools -make examples -make demos -make translations -no-nis -no-cups -iconv -no-dbus -xplatform qws/linux-arm-g++ -little-endian -qt-freetype -depths 16,24,32 -qt-gfx-linuxfb -qt-gfx-transformed -qt-gfx-multiscreen -no-gfx-vnc -no-gfx-qvfb -qt-kbd-linuxinput -no-kbd-qvfb -armfpa -no-mouse-qvfb -qt-mouse-linuxtp -qt-mouse-tslib -DQT_QLOCALE_USES_FCVT -I/usr/local/tslib/include -L/usr/local/tslib/lib -no-pch
make
问题:
a. ../../include/QtCore/../../src/corelib/arch/qatomic_armv5.h:236: error: `count' was not declared in this scope
修改:/src/corelib/arch/qatomic_armv5.h 236,373加声明 int count=0;
b.obj/release-shared-emb-mips/qthread_unix.o: In function `set_thread_data(QThreadData*)': qthread_unix.cpp.text+0xec): undefined reference to `__tls_get_addr' 修复: 关掉该宏后再编译 #if defined(Q_OS_LINUX) && defined(__GLIBC__) && (defined(Q_CC_GNU) || defined(Q_CC_INTEL))
//#define HAVE_TLS
make install
把交叉编译器的库拷贝到板子文件系统上
cp -rf /usr/local/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi/sys-root/lib/* rootfs/usr/lib/
把QT交叉编译器的库拷贝到板子文件系统上
cp -rf /opt/qt-4.8.4-arm/lib/* rootfs/usr/lib/
把QT的字体拷贝到板子的文件系统上
cp -rf /opt/qt-4.8.4-arm/lib/fonts/* rootfs/usr/lib/fonts/
cp -rf /opt/qt-4.8.4-arm/lib/fonts/* rootfs/opt/qt-4.8.4-arm/lib/fonts/
修改用户环境变量
gedit ~/.profile
文件尾加入
export ARMQTDIR=/opt/qt-4.8.4-arm
export PATH=$ARMQTDIR/bin:$PATH
export MANPATH=$ARMQTDIR/man:$MANPATH
export LD_LIBRARY_PATH=$ARMQTDIR/lib:$LD_LIBRARY_PATH
export QMAKESPEC=/opt/qt-4.8.4-arm/mkspecs/qws/linux-arm-g++
source ~/.profile
测试 ARM 版 QT 是否安装并配置成功:
qmake -v
打印以下对应信息:
QMake version 2.01a
Using Qt version 4.8.4 in /opt/qt-4.8.4-arm/lib
which qmake
打印以下对应信息:
/opt/qt-4.8.4-arm/bin/qmake
编写一个简单的测试程序:
cat testapp.cpp
#include
#include
int main(int argc, char *argv[])
{
qDebug("testapp,.......");
return 0;
}
qmake -project testapp.cpp
生成testapp.pro
qmake testapp.pro
生成Makefile
问题:
QMAKESPEC has not been set, so configuration cannot be deduced.
Error processing project file: hello1.pro
则是 QMAKESPEC 变量没有设置好,执行:
export QMAKESPEC=/opt/qt-4.8.4-arm/mkspecs/qws/linux-arm-g++
make
生成testapp.o testapp
在板子上运行
./testapp
至此系统软件搭建完毕。
参考信息:
/* Qt is now configured for building. Just run 'make'.
* Once everything is built, you must run 'make install'.
* Qt will be installed into /usr/local/Trolltech/QtEmbedded-4.8.4-i386
*
* To reconfigure, run 'make confclean' and 'configure'.
*/
遇到问题:
1、Error: incorrect register `%rbp' used with `l' suffix
./configure -opensource -confirm-license -embedded x86_64 -qvfb
ubuntu为64位时应该使用x86_64配置,否则使用x86配置
14、建立app
cd buildroot/package
mkdir nova_qt_app
touch nova_qt_app.mk Config.in
在buildroot/package/Config.in中加入:
sudo gedit buildroot/package/Config.in
source "package/nova_qt_app/Config.in"
sudo gedit buildroot/package/nova_qt_app/Config.in
输入:
config BR2_PACKAGE_NOVA_QT_APP
bool "nova qt app"
help
nova qt app
注意,nova_qt_app.mk并不能实际代替nova_qt_app源代码的Makefile文件,它只是一个上层的make文件,告诉Buildroot,应该到哪个地方拿源代码,应该如何解压源代码,应该给源代码中的Makefile中的变量传递哪些编译参数,编译出来的库和bin文件,应该安装到rootfs的哪个路径下。具体nova_qt_app源代码是如何一步一步编译的,还得靠nova_qt_app源代码本身的Makefile去做。
下载:
http://developer.t-firefly.com/forum-117-1.html
http://developer.t-firefly.com/thread-793-1-1.html
http://developer.t-firefly.com/thread-10874-1-1.html
http://developer.t-firefly.com/thread-11077-1-1.html
上面的所需文件的下载地址:
ftp://ftp.infradead.org/pub/mtd-utils/mtd-utils-1.4.9.tar.bz2
4、安装java1.6 for android 4.4
chmod +x jdk-6u27-linux-i586.bin
sudo ./jdk-6u27-linux-i586.bin
sudo gedit /etc/profile
添加下面内容到最后:
#set java environment
JAVA_HOME=/home/niuyi/jdk1.6.0_27 // 注意和安装路径一致
export JRE_HOME=/home/niuyi/jdk1.6.0_27/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
5、安装java1.7 for android 5.1
chmod +x jdk-7u79-linux-x64.tar.gz
tar xvf jdk-7u79-linux-x64.tar.gz
sudo gedit /etc/profile
添加下面内容到最后:
#set java environment
JAVA_HOME=/home/niuyi/jdk1.7.0_79 // 注意和安装路径一致
export JRE_HOME=/home/niuyi/jdk1.7.0_79/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
make buildroot
The following packages were automatically installed and are no longer required:
account-plugin-windows-live kde-l10n-engb libdlrestrictions1 libkdecore5
libmbim-glib0 libntdb1 libqmi-glib0 python-ntdb usb-modeswitch
usb-modeswitch-data
在 trusty 发行版中 i386 硬件架构下的 libfakeroot 软件包文件清单
/etc/ld.so.conf.d/fakeroot-i386-linux-gnu.conf
/usr/lib/i386-linux-gnu/libfakeroot/libfakeroot-sysv.so
/usr/lib/i386-linux-gnu/libfakeroot/libfakeroot-tcp.so
/usr/share/doc/libfakeroot/DEBUG
/usr/share/doc/libfakeroot/README
/usr/share/doc/libfakeroot/README.saving
/usr/share/doc/libfakeroot/changelog.Debian.gz
/usr/share/doc/libfakeroot/copyright
git clone
./output/build/host-fakeroot-1.20.2/scripts/fakeroot.in:134: fatal "preload library \`$LIB' not found, aborting."
./output/build/host-fakeroot-1.20.2/scripts/fakeroot:134: fatal "preload library \`$LIB' not found, aborting."