Yocto開發筆記之《快速入門,環境搭建 & 編譯》(QQ交流群:519230208)


開了一個交流群,歡迎愛好者和開發者一起交流,轉載請注明出處。

QQ群:519230208,為避免廣告騷擾,申請時請注明 “開發者” 字樣

========================================================

主機系統:Ubuntu 14.04

開發板子:freescale 6ul,http://freescale.github.io/#contributing

Yocto :  www.yoctoproject.org/ 

IDE:eclipse

========================================================

工程獲取、編譯:

1. 翻牆:

    教程:https://www.jsqgreen.com/shiyong/67.html,

    網關:a.jpgjsq.com

2. Host工具

# sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
  build-essential chrpath socat libsdl1.2-dev
# sudo apt-get install libsdl1.2-dev xterm sed cvs subversion coreutils texi2html \
  docbook-utils python-pysqlite2 help2man make gcc g++ desktop-file-utils \
  libgl1-mesa-dev libglu1-mesa-dev mercurial autoconf automake groff curl lzop asciidoc
# sudo apt-get install u-boot-tools

 3. repo

# mkdir ~/bin (this step may not be needed if the bin folder already exists)
# curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
# chmod a+x ~/bin/repo
# export PATH=~/bin:$PATH

# git config --global user.name "Your Name"
# git config --global user.email "Your Email"
# git config --list

# mkdir fsl-release-bsp
# cd fsl-release-bsp
# repo init -u git://git.freescale.com/imx/fsl-arm-yocto-bsp.git -b imx-3.14.38-6UL_ga
# repo sync

 4. comlipe project

# MACHINE=imx6ulevk source fsl-setup-release.sh -b <build dir>
# bitbake fsl-image-gui

========================================================

燒寫《i.MX_Linux_User's_Guide.pdf》

Image結構

1. Bootloader (U-boot) ---> U-boot-[platform]-[board]_[machine_configeration].imx
2. Linux kernel image (zImage) ---> 3.14.38,所有平台一致
3. A Device tree file --->
  配置:arch/arm/boot/dts ---> *.dts
  zImage: [kernel]-[platform]-[board][configuration].dtb
4. A root file system (rootfs) ---> Busy common libs, fundermental element

Image Layout (boot from SD/MMC) (4G flash need)

0x400      0x09FFC00 bytes    RAW    u-boot
0xa00000    500Mbytes        FAT      kernel image & *.dtb
0x25800000    Remaning space      ext3/ext4   rootfs

 SD卡燒寫

# cat proc/partitions     // 查看
# sudo dd if=<.sdcard image> of=/dev/sdx bs=1M conv=fsync    // 燒寫到sdcard

 ========================================================

========================================================

紀錄

 

bitbake編譯命令

# bitbake -c cleansstate u-boot
# bitbake -c path u-boot  // 如此才可以從本地編譯,否則會從網上fetch代碼
# bitbake -e u-boot | grep ^S= // 獲取u-boot的代碼路徑,進入后可以修改
# bitbake -c compile -f u-boot >> log.txt  //將輸出結果顯示在log.txt中
# bitbake u-boot

# bitbake
-c cleansstate virtual/kernel # bitbake -c patch virtual/kernel # bitbake -e virtual/kernel | grep ^S=
# update KERNEL_DEFCONFIG variable in meta-fsl-ppc/conf/machine/<machine>.conf // 修改kernel defconfig
# update KERNEL_DEVICETREE variable in meta-fsl-ppc/conf/machine/<machine>.conf // 修改dts
# bitbake -c menuconfig virtual/kernel
# screen -r devshell
# bitbake
# bitbake
-c menuconfig virtual/kernel # screen -r devshell # bitbake -c compile -f virtual/kernel # bitbake virtual/kernel # bitbake -b imx-test_3.10.17-1.0.0 -c compile -f # bitbake -b imx-test_3.10.17-1.0.0 -c install # bitbake recipe -c listtasks // 查看task列表

 

make clean  // 刪除大多數的編譯生成文件, 但是會保留內核的配置文件.config, 還有足夠的編譯支持來建立擴展模塊
make mrproper  // 刪除所有的編譯生成文件, 還有內核配置文件, 再加上各種備份文件
make distclean  // mrproper 刪除的文件, 加上編輯備份文件和一些補丁文件。

執行make mrproper, 會先執行make clean, 執行make distclean之前, 會先執行make mrproper。

 

包的位置

# bitbake -e virtual/kernel | grep ^S=
S="/media/summer/fsl-release-bsp/build-x11/tmp/work/imx6ulevk-poky-linux-gnueabi/linux-imx/3.14.38-r0/git"

 

====================================================================

理解 shared state cache

Poky通過scratch編譯所有的東西,除非bitbake認為某個recipe不需要重新編譯。shared state cache存放了一些中間產物,當bitbake編譯內容時,先查看這個文件夾中有沒有需要的中間文件。這個文件隨着編譯次數增多變大,我們時刻記住要定時清空它。當我們需要從scratch重新編譯的時候,我們可以刪除build/tmp文件夾,這樣會通過sstate-cache加速編譯過程,也可以把sstate-cache也刪除掉,這樣不會有cache文件被復用。

# ./scripts/sstate-cache-management.sh --remove-duplicated -d --cache-dir=<path to sstate-cached>  // this removes the duplicated and old data from the cache

 ====================================================================

Yocto Project complier:

1. ubuntu has "sudo" installed

2. needed packages:

 $ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
     build-essential chrpath socat libsdl1.2-dev xter
3.1 Host packages
A Yocto Project build requires that some packages be installed for the build that are documented under the Yocto Project. You can go to Yocto Project Quick Start and check for the packages that must be installed for your build machine.
Essential Yocto Project host packages are:
Freescale Yocto Project User's Guide, Rev. L3.14.38_6ul-ga, 09/20154 Freescale Semiconductor, Inc.
Yocto Project Setup
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
  build-essential chrpath  socat  libsdl1.2-dev
i.MX layers host packages for a Ubuntu 12.04 or 14.04 host setup are:
$ sudo apt-get install libsdl1.2-dev xterm  sed cvs subversion coreutils texi2html \
docbook-utils python-pysqlite2 help2man make gcc g++ desktop-file-utils \
libgl1-mesa-dev libglu1-mesa-dev mercurial autoconf automake groff curl lzop asciidoc
i.MX layers host packages for a Ubuntu 12.04 host setup only are:
$ sudo apt-get install uboot-mkimage
i.MX layers host packages for a Ubuntu 14.04 host setup only are:
$ sudo apt-get install u-boot-tools
The configuration tool uses the default version of grep that is on your build machine. If there is a different version of grep in your path, it may cause builds to fail. One workaround is to rename the special version to something not containing "grep".

 

 

 3. 獲取工程代碼

  $ git clone git://git.yoctoproject.org/poky
     Cloning into 'poky'...
     remote: Counting objects: 226790, done.
     remote: Compressing objects: 100% (57465/57465), done.
     remote: Total 226790 (delta 165212), reused 225887 (delta 164327)
     Receiving objects: 100% (226790/226790), 100.98 MiB | 263 KiB/s, done.
     Resolving deltas: 100% (165212/165212), done.
  $ git checkout jethro

  因為我們要獲取板子對應的工程,所以不用以上方式,直接按照開發板的快速指南,下載repo,直接run.

4. Initialize the build enviroment

  $ source oe-init-build-env

=======================================================

summer@summer-ThinkPad-X230:~/fsl-community-bsp$ . ./setup-environment fsl_linux_project/

Welcome to Freescale Community BSP

The Yocto Project has extensive documentation about OE including a
reference manual which can be found at:
    http://yoctoproject.org/documentation

For more information about OpenEmbedded see their website:
    http://www.openembedded.org/

You can now run 'bitbake <target>'

Common targets are:
    core-image-minimal
    meta-toolchain
    meta-toolchain-sdk
    adt-installer
    meta-ide-support

 

 

 

編譯問題紀錄:

沒有lsusb、file等命令

之前的helloworld程序在這兒不能運行

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM