1.6.3. 编译后代码的位置
1、Linux的kernel的源代码在 fsl-releases-bsp/imx6q-x11/tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/3.14.52-r0/git下 说明imx6q-x11是我们在“DISTRO=<distro name> MACHINE=<machine name> source fsl-setup-release.sh -b <build dir>”中指定的build dir。 git是一个链接文件,实际的源代码在 fsl-releases-bsp/imx6q-x11/tmp/work-shared/imx6qsabresd/kernel-source/ 2、u-boot的源代码的位置在 fsl-releases-bsp/imx6q-x11/tmp/work/imx6qsabresd-poky-linux-gnueabi/u-boot-imx/2015.04-r0/git/ 这里要注意,对于不同的版本的BSP 可能就不是3.14.52-r0或者2015.04-r0了,可以根据实际的版本在linux-imx和u-boot-imx看到的。 1.6.4. 编译出来的image的位置
编译出来的image在 fsl-releases-bsp/imx6q-x11/tmp/deploy/images/目录下,包括的u-boot zImage rootfs 1.6.5. 编译的log信息
在我们编译的过程中,在Terminal中是看不到编译的log信息的,那么我们怎么直到编译的时候我们的代码有没有编译到,有没有警告呢? 其实yocto已经帮我们保存了编译的log信息。 Linux kernel的编译的log就在fsl-releases-bsp/imx6q-x11/tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/3.14.52-r0/temp/目录下。 例如 log.do_compile就是编译内核的log信息 。 u-boot的编译的log就在fsl-releases-bsp/imx6q-x11/tmp/work/imx6qsabresd-poky-linux-gnueabi/u-boot-imx/2015.04-r0/temp/目录下 其他的也类似在对应的目录的temp目录下。 1.6.6. 如何单独编译kernel和u-boot
我们修改了kernel或者u-boot的源代码,直接运行bitbake fsl-image-qt5是不会编译我们修改的源代码的。所以就需要我们单独编译源代码。 编译kernel 配置menuconfig:bitbake -c menuconfig -v linux-imx 1、单独编译kernel bitbake -c compile -f -v linux-imx bitbake linux-imx -c compile_kernelmodules -f -v bitbake -c deploy -f -v linux-imx 需要重新生成rootfs,再执行命令:bitbake fsl-image-qt5 实际上我们修改了内核,往往不需要更新rootfs的,而我们 执行bitbake fsl-image-qt5时会重新生成rootfs,这个操作会耗费很长的时间。所以可只执行前三个命令 编译出来的zImage和设备树在fsl-releases-bsp/imx6q-x11/tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/3.14.52-r0/deploy-linux-imx/目录下。 2、单独编译u-boot
bitbake -c compile -f -v u-boot-imx
bitbake -c deploy -f -v u-boot-imx 同样需要重新生成rootfs,再执行命令:bitbake fsl-image-qt5 实际上我们修改了uboot,往往不需要更新rootfs的,而我们 执行bitbake fsl-image-qt5时会重新生成rootfs,这个操作会耗费很长的时间。所以可只执行前两个命令
编译出来的u-boot在fsl-releases-bsp/imx6q-x11/tmp/work/imx6qsabresd-poky-linux-gnueabi/u-boot-imx/2015.04-r0/deploy-u-boot-imx/目录下。
3、单独强制编译应用程序
bitbake -c compile -f -v xxx
bitbake -b xxx_1.2.bb
4、qt交叉编译环境搭建与开发,参考以下地址:
如果出现编译错误,请从下面地址下载linux-arm-poky-qnueabi-g++,配置qmake spec
5、运行qt软件;
5.1、export DISPLAY=:0.0
5.2、export QT_QPA_PLATFORM=eglfs
5.3、copy编译的软件(hello)到imx6q平台
5.4、./hello -platform eglfs -plugin evdevtouch:/dev/input/event0
三、android版本
1、Setting up your computer
$ sudo apt-get install uuid uuid-dev
$ sudo apt-get install zlib1g-dev liblz-dev
$ sudo apt-get install liblzo2-2 liblzo2-dev
$ sudo apt-get install lzop
$ sudo apt-get install git-core curl
$ sudo apt-get install u-boot-tools
$ sudo apt-get install mtd-utils
$ sudo apt-get install android-tools-fsutils
$ sudo apt-get install openjdk-8-jdk
Note:If you have trouble installing the JDK in Ubuntu, see How to install misc JDK in Ubuntu
for Android build.
Configure git before use. Set the name and email as follows:
• git config --global user.name "First Last"
• git config --global user.email "first.last@company.com"
2、Unpacking the Android release package
cd /opt (or any other directory where the android_N7.1.2_2.0.0_source.tar.gz file is
placed)
$ tar xzvf android_N7.1.2_2.0.0_source.tar.gz
3、Get source code
3.1、Getting Android source code (Android/kernel/U-Boot)
3.1.1. get android source code from google server
$ cd ~
$ mkdir myandroid
$ mkdir bin
$ cd myandroid
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ ~/bin/repo init -u https://android.googlesource.com/platform/manifest -b android-7.1.2_r9
$ ~/bin/repo sync
# This command loads most needed repos. Therefore, it can take several hours to load.
# clone bpt.git from google repo, and checkout to the
$ cd ~/myandroid/system/tools
$ git clone https://android.googlesource.com/platform/system/tools/bpt
$ cd bpt
$ git checkout -b n7.1.2_2.0.0-ga b7c3059e5d8c408f60222edc898ef1c229d8fc2d
3.1.2. if cann't connect to google server, instead of tinghua server
$ curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o repo
$ chmod +x repo
$ export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'
$ ../bin/repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-7.1.2_r9
$../bin/repo sync
3.2、Get the N7.1.2_2.0.0 kernel source code from Freescale open source git:
$ cd ~/myandroid
$ git clone git://git.freescale.com/imx/linux-imx.git kernel_imx # the kernel repo is large. Therefore, this process can take a while.
$ cd kernel_imx
$ git checkout n7.1.2_2.0.0-ga
3.3、If you use U-Boot as your bootloader, clone the U-Boot git repository from the open source git:
$ cd ~/myandroid/bootable
$ mkdir bootloader
$ cd bootloader
$ git clone git://git.freescale.com/imx/uboot-imx.git uboot-imx
$ cd uboot-imx
$ git checkout n7.1.2_2.0.0-ga
3.4、Patch standard features code package
Apply all the i.MX Android patches by performing the following steps:
1. Assume you have unzipped the i.MX Android release package to /opt/android_N7.1.2_2.0.0_source.
$ cd ~/myandroid
$ source /opt/android_N7.1.2_2.0.0_source/code/N7.1.2_2.0.0/and_patch.sh
$ help
2. You should see that the "c_patch" function is available.
$ c_patch /opt/android_N7.1.2_2.0.0_source/code/N7.1.2_2.0.0/ imx_N7.1.2_2.0.0-ga
Here, "/opt/android_N7.1.2_2.0.0_source/code/N7.1.2_2.0.0" is the location of the patches, which is the directory created when you unzip the release package.
"imx_N7.1.2_2.0.0" is the branch which is created automatically to hold all patches (only in those existing Google gits).
Choose any branch name instead of "imx_N7.1.2_2.0.0".3.
If everything is OK, "c_patch" generates the following output to indicate the successful patch:
*****************************************************************
Success: Now you can build the Android code for FSL i.MX platform
*****************************************************************
NOTE:The patch script (and_patch.sh) requires some basic utilities like awk/sed. If they are not available on the computer running Linux OS, install them first.
4、Android build steps are as follows:
4.1. Change to the top level build directory.
$ cd ~/myandroid
4.2. Set up the environment for building. This only configures the current terminal.
$ source build/envsetup.sh
4.3. Execute the Android lunch command. In this example, the setup is for the production image of i.MX 6DualQuad SABRE Board/Platform device with user type.
$ lunch sabresd_6dq-user
4.4. Execute the make command to generate the image.
$ make 2>&1 | tee build-log.txt
5、设置环境变量,显示屏设置:
Linux mipi dsi显示:setenv mmcargs 'setenv bootargs ${bootargs} console=${console},${baudrate} ${smp} root=/dev/mmcblk3p2 rootwait rw video=mxcfb0:dev=mipi_dsi,TRULY-WVGA,if=RGB24'
Android mipi dsi显示:setenv bootargs console=ttymxc0,115200 androidboot.console=ttymxc0 consoleblank=0 vmalloc=128M init=/init video=mxcfb0:dev=mipi_dsi,TRULY-WVGA,if=RGB24 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off androidboot.hardware=freescale cma=448M
Linux hdmi 显示:setenv mmcargs 'setenv bootargs ${bootargs} console=${console},${baudrate} ${smp} root=/dev/mmcblk3p2 rootwait rw video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24'
Android hdmi 显示:setenv bootargs console=ttymxc0,115200 androidboot.console=ttymxc0 consoleblank=0 vmalloc=128M init=/init video=mxcfb0:dev=hdmi,1920x1080M@60,bpp=32 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off androidboot.hardware=freescale cma=448M