NXP的imx系列芯片使用很广的芯片,这篇文章就介绍下imx 芯片 Yocto 环境的搭建,以及单独编译 uboot,kernel 的方法。

PC: ubuntu 16.04

1.环境设置

1.1 PC软件预装

在编译之前首先要预装一些相关的软件,安装命令如下:

sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
build-essential chrpath socat libsdl1.2-dev

如果PC版本是ubuntu 12.04或者14.04:
安装命令如下:

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

单独对于ubuntu 12,04的,安装命令如下:

sudo apt-get install uboot-mkimage

单独对于ubuntu 14,04的,安装命令如下:

sudo apt-get install u-boot-tools
1.2 设置repo

由于我们要用repo下载Yocto工程代码,所以在这里我们需要设置下repo工具,具体命令如下:

$ mkdir ~/bin (this step may not be needed if the bin folder already exists)
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ export PATH=~/bin:$PATH
1.3 Yocto 环境设置

设置git config 参数

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

2.下载源代码&编译

2.1下载源码

以kernel版本4.14.98-2.3.0为例

$ mkdir imx-yocto-bsp
$ cd imx-yocto-bsp
$ repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-sumo -m imx-4.14.98-2.3.0.xml
$ repo sync

如果repo init 失败,可以参考文章:
https://blog.csdn.net/StevenYang2008/article/details/106505696

2.2编译

首先运行fsl-setup-release.sh文件进行一些初始化的设置。
运行命令:

$ DISTRO=<distro name> MACHINE=<machine name> source fsl-setup-release.sh -b <build dir>

其中distro name可选如下:

Here are the list of DISTRO configurations. Note that DirectFB is no longer supported, and fsl-imx-wayland and fsl-imx-fb are not
supported on i.MX 8.
• fsl-imx-x11 - X11 graphics are not supported on i.MX 8.
• fsl-imx-wayland - Wayland weston graphics.
• fsl-imx-xwayland - Wayland graphics and X11. X11 applications using EGL are not supported.
• fsl-imx-fb - Frame Buffer graphics - no X11 or Wayland. Frame Buffer is not supported on i.MX 8.

其machine name可选如下:

• imx6qpsabreauto
• imx6qpsabresd
• imx6ulevk
• imx6ulz14x14evk
• imx6ull14x14evk
• imx6ull9x9evk
• imx6dlsabreauto
• imx6dlsabresd
• imx6qsabreauto
• imx6qsabresd
• imx6slevk
• imx6solosabreauto
• imx6solosabresd
• imx6sxsabresd
• imx6sxsabreauto
• imx6sllevk
• imx7dsabresd
• imx7ulpevk
• imx8qmmek
• imx8qxpmek
• imx8mqevk
• imx8mmevk
• imx8mnevk

然后运行命令:

bitbake <image name>

image name 可选如下:

以下是两条命令例子:
X-11 image on i.MX 6Quad SABRE-SD

$ DISTRO=fsl-imx-x11 MACHINE=imx6qsabresd source fsl-setup-release.sh -b build-x11
$ bitbake fsl-image-validation-imx

XWayland image on i.MX 8QuadXPlus MEK

$ DISTRO=fsl-imx-xwayland MACHINE=imx8qxpmek source fsl-setup-release.sh -b build-xwayland
$ bitbake fsl-image-qt5-validation-imx

3.单独编译uboot & kernel

3.1toolchain 设置

如果你有自己的toolchain,并且已经安装成功,你可以跳过这一小节,下面讲一下怎么编译Yocto的SDK,里面包含一些工具,toolchain等
编译命令如下:

DISTRO=fsl-imx-fb MACHINE=Target-Machine bitbake core-image-minimal -c populate_sdk

编译好之后就可以安装自己的toolchain了。

3.2 编译uboot

对IMX8设备:

source /opt/fsl-imx-xwayland/4.14.98/environment-setup-aarch64-poky-linux
export ARCH=arm64

对IMX6或者IMX7

source /opt/fsl-imx-fb/4.9.98/environment-setup-cortexa9hf-neon-poky-linux-gnueab
export ARCH=arm

以imx8qm为例,编译uboot

make clean
make imx8qm_mek_defconfig
make

编译SPL命令如下:

make clean
make imx8qm_mek_spl_defconfig
make

对于i.MX 8M Nano EVK

make clean
make imx8mn_ddr4_evk_defconfig
make

对于i.MX6 or i.MX 7,在这里以i.MX 6ULL为例

git clone https://source.codeaurora.org/external/imx/uboot-imx -b imx_v2018.03_4.14.98-2.0.0_ga
cd uboot-imx
make clean
make mx6ull_14x14_evk_defconfig
make
3.3 Use imx-mkimage
For i.MX 8QuadMax, to build imx-boot image by using imx-mkimage, perform the following steps:
1. Copy u-boot.bin from u-boot/u-boot.bin to imx-mkimage/iMX8QM/.
2. Copy scfw_tcm.bin from SCFW porting kit to imx-mkimage/iMX8QM/.
3. Copy bl31.bin from ARM Trusted Firmware (imx-atf) to imx-mkimage/iMX8QM/.
4. Copy the SECO firmware container image (ahab-container.img) to imx-mkimage/iMX8QM/.
5. Run make SOC=iMX8QM flash to generate flash.bin.
6. If using OPTEE, copy tee.bin to imx-mkimage/iMX8QM/ and copy u-boot/spl/u-boot-spl.bin to imx-mkimage/iMX8QM/.
Run make SOC=iMX8QM flash_spl to generate flash.bin.For i.MX 8QuadXPlus, to build imx-boot image by using imx-mkimage, perform the following steps:
1. Copy u-boot.bin from u-boot/u-boot.bin to imx-mkimage/iMX8QX/.
2. Copy scfw_tcm.bin from SCFW porting kit to imx-mkimage/iMX8QX/.
3. Copy bl31.bin from ARM Trusted Firmware (imx-atf) to imx-mkimage/iMX8QX/.
4. Copy the SECO firmware container image (ahab-container.img) to imx-mkimage/iMX8QX/.
5. Run make SOC=iMX8QX flash to generate flash.bin.
6. If using OPTEE, copy tee.bin to imx-mkimage/iMX8QX/ and copy u-boot/spl/u-boot-spl.bin to imx-mkimage/iMX8QX/.
Run make SOC=iMX8QX flash_spl to generate flash.bin.

以下表格是4.14.98-2.3.0版本的

For i.MX 8M Quad EVK, i.MX 8M Mini EVK, and 8M Nano EVK, to build imx-boot image using imx-mkimage, perform the following
steps:
1. Copy and rename mkimage from u-boot/tools/mkimage to imx-mkimage/iMX8M/mkimage_uboot.
2. Copy u-boot-spl.bin from u-boot/spl/u-boot-spl.bin to imx-mkimage/iMX8M/.
3. Copy u-boot-nodtb.bin from u-boot/u-boot-nodtb.bin to imx-mkimage/iMX8M/.
4. Copy fsl-imx8mq-evk.dtb (for i.MX 8M Quad EVK), fsl-imx8mm-evk (for i.MX 8M Mini LPDDR4 EVK EVK), fsl-imx8mmddr4-evk (for i.MX 8M Mini LPDDR4 EVK), or fsl-imx8mn-ddr4-evk (for i.MX 8M Nano DDR4 EVK) from u-boot/
arch/arm/dts/ to imx-mkimage/iMX8M/.
5. Copy bl31.bin from ARM Trusted Firmware (imx-atf) to imx-mkimage/iMX8M/.
6. Copy firmware/hdmi/cadence/signed_hdmi_imx8m.bin from firmware-imx package to imx-mkimage/iMX8M/.
7. For i.MX 8M Quad and i.MX 8M Mini LPDDR4 EVK, copy lpddr4_pmu_train_1d_dmem.bin,
lpddr4_pmu_train_1d_imem.bin, lpddr4_pmu_train_2d_dmem.bin, and lpddr4_pmu_train_2d_imem.bin from
firmware/ddr/synopsys of firmware-imx package to imx-mkimage/iMX8M/.
For i.MX 8M Mini DDR4 EVK, copy ddr4_imem_1d.bin, ddr4_dmem_1d.bin, ddr4_imem_2d.bin, and ddr4_dmem_2d.bin from firmware/ddr/synopsys of firmware-imx package to imx-mkimage/iMX8M.
For i.MX 8M Nano DDR4 EVK, copy ddr4_dmem_1d_201810.bin, dr4_dmem_2d_201810.bin, ddr4_imem_1d_201810.bin,
and ddr4_imem_2d_201810.bin from firmware/ddr/synopsys of firmware-imx package to imx-mkimage/iMX8M.
For i.MX 8M Quad EVK, run make SOC=iMX8M flash_evk to generate flash.bin (imx-boot image) with HDMI FW included.
For i.MX 8M Mini LPDDR4 EVK, run make SOC=iMX8MM flash_evk to generate flash.bin (imx-boot image).
For i.MX 8M Mini DDR4 EVK, run make SOC=iMX8MM flash_ddr4_evk to generate flash.bin (imx-boot image).
For i.MX8M Nano DDR4 EVK, run make SOC=iMX8MN flash_ddr4_evk to generate flash.bin (imx-boot image).
3.4 编译kernnel

对于i.MX 8

make defconfig
make

对于i.MX 6 或者i.MX 7系列

git clone https://source.codeaurora.org/external/imx/linux-imx -b
imx_4.14.98-2.0.0_ga
cd linux-imx
make imx_v7_defconfig
make

4.烧写文件

4.1 烧写sdcard文件

将便已经编译好的.sdcard文件烧入板子中,命令如下:

 sudo dd if=xxxxxx.sdcard of=/dev/sdx bs=1M && sync

4.1 烧写bootloader文件

命令如下:

sudo dd if=<U-Boot image> of=/dev/sdx bs=1k seek=<offset> conv=fsync

Where offset is:

• 1 - for i.MX 6 or i.MX 7
• 33 - for i.MX 8QuadMax A0, i.MX 8QuadXPlus A0, i.MX 8M Quad, and i.MX 8M Mini
• 32 - for i.MX 8QuadXPlus B0, i.MX 8QuadMax B0, and i.MX 8M Nano
参考文章

i.MX Linux User’s Guide
i.MX Yocto Project User’s Guide

NXP之imx系列芯片 linux代码编译简介相关推荐

  1. Linux代码编译(模式切换、gdb、编译器之间的对比、彩色进度条、rpm与yum区别)

    常用工具: 软件包管理工具:yum 编程相关工具:vim.gcc/g++.gdb 项目相关工具:make/Makefile.git 查看软件包:yum list/grep key 安装软件包:yum ...

  2. 【Linux系列】Linux下编译C/C++环境变量设置

    DATE: 2020.6.29 本文目录 0.参考 1.环境变量配置文件 2.环境变量配置 0.参考 Windows/Unix/Linux编译C/C++添加头文件与库的搜索路径 1.环境变量配置文件 ...

  3. Linux gcc编译简介、常用命令

    gcc作为linux平台下的标准C编译器,功能很强大.格式如下: gcc [option] [filename] -x language 指定使用的语言 -c 对文件进行编译和汇编,但不进行连接 -S ...

  4. NXP 之s32系列 汽车平台芯片及应用集锦

    S32系列是NXP开发的针对汽车的芯片,在这里总结一下下官的资料,希望对大家有所帮助. 如果需要,Android,Linux软件资源,请参考文章: NXP I.MX 芯片软件资源集锦 如果需要NXP ...

  5. RH系列linux上编译android2.3(gingerbread)

    在RH系列linux上编译android2.3(gingerbread)的过程如下: 官方源码及ubuntu编译过程在(http://source.android.com/source/index.h ...

  6. linux嵌入式开发arm7,基于ARM7系列芯片嵌入式平台上实现的设计方案-嵌入式系统-与非网...

    本文介绍的方法是在用ARM7系列芯片S3C4510B和μClinux构建的嵌入式平台上实现的.在嵌入式系统设计过程中,系统的掉电保护越来越受到重视整个掉电保护实现的基本思路是:产生掉电信号,捕捉掉电信 ...

  7. linux下编译make文件报错“/bin/bash^M: 坏的解释器,使用grep快速定位代码位置

    一.linux下编译make文件报错"/bin/bash^M: 坏的解释器 参考文章:http://blog.csdn.net/liuqiyao_01/article/details/415 ...

  8. 一份简单的在 Linux下编译及调试 C 代码的指南

    摘要: 一份简单的在 Linux下编译及调试 C 代码的指南 对于Linux下的C程序员来说,几乎天天都会和Linux打交道.但在很多人的眼中,Linux是一个易用性极差.靠命令驱动的操作系统,根本无 ...

  9. tar在linux编译为exe,将Linux代码移植到Windows的简单方法 1

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 一.前言 Linux拥有丰富各种源代码资源,但是大部分代码在Windows平台情况是无法正常编译的.Windows平台根本无法直接利用这些源代码资源.如果 ...

最新文章

  1. 《挑战程序设计竞赛(第2版)》习题册攻略
  2. spark读取文件源码分析-1
  3. python创建虚拟环境venv_Python 3 使用venv创建虚拟环境
  4. 设计一个名为complex的类来表示复数_CAE必修课:结构动力优化设计_搜狐汽车
  5. 《Cisco安全防火墙服务模块(FWSM)解决方案》——1.4 利用包检测技术
  6. java笔记_2020年java程序员、java工程师必备资料(内含java学习思维图、视频教程、源码笔记等)...
  7. 二倍图css,css二倍图的使用
  8. a better git log
  9. java 解压Kmz文件selectNodes获取指定标签内容
  10. java读取excrl模板填充数据_java中自定义excel模板并且填充内容
  11. automake manul
  12. paddlepaddle波士顿房价预测
  13. Chrome离线安装CRX插件方法
  14. android直播sdk+美颜,直播美颜sdk的三大功能及注意事项
  15. windows下、Linux下最好用markdown查看器:Typora(查看.md文件)
  16. linux程序提示killed的原因
  17. 红外夜视摄像头 小方智能摄像头使用手记
  18. 新一代人工智能发展规划发布
  19. 谷氨酰胺(Glutamine)检测实验分析方案
  20. app store/ios开发证书、发布证书、推送证书的快捷制作

热门文章

  1. 把数据保存到数据库附加表 `dede_addonarticle` 时出错,请把相关信息提交给DedeCms官方
  2. ssh 配置了,但git clone失败了,hostkeys_find_by_key_hostfile: hostkeys file /Users/XX/.ssh/known_hosts
  3. 刷脸移动考勤系统实时掌握学生考勤动态
  4. 分享个人常用的15 款开发神器
  5. 【Neuron】数据从南向设备管理到北向应用,然后发布到mqtt-broker中
  6. Qgis开发5-完整的Qgis系统库——qis_app库
  7. 重磅!九州云获颁“2020年度运营商最佳合作伙伴”奖
  8. yum 安装oraclejdk_linux服务器上安装jdk的两种方法(yum+下载包)
  9. 华为设备如何将接口配置为中继模式_华为eNSP——DHCP中继配置
  10. 计算机组系统原理—模型机