? ? ? ? 使用yocto平台搭建IMX8QXP开发环境,学习yocto编译开发环境。
环境准备
? ? ? ? Ubuntu 16.04?工具软件
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 uboot-mkimage
sudo apt-get install u-boot-tools
sudo apt-get install libncurses5-dev
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
????????git配置
git config --global user.name "Your Name"
git config --global user.email "Your Email"
git config --list
? ? ? ? 下载NXP yocto源码
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.78-1.0.0_ga.xml
repo sync
? ? ? ? 代码目录树
.
├── fsl-setup-release.sh -> sources/meta-fsl-bsp-release/imx/tools/fsl-setup-release.sh
├── README -> sources/base/README
├── README-IMXBSP -> sources/meta-fsl-bsp-release/imx/README
├── setup-environment -> sources/base/setup-environment
└── sources
├── base
├── meta-browser
├── meta-freescale
├── meta-freescale-3rdparty
├── meta-freescale-distro
├── meta-fsl-bsp-release
├── meta-openembedded
├── meta-qt5
└── poky
编译流程
? ? ? ? 查看yocto版本,也是看poky版本
sources/poky/meta-poky/conf/distro/poky.conf
DISTRO = "poky"
DISTRO_NAME = "Poky (Yocto Project Reference Distro)"
DISTRO_VERSION = "2.5.1"
DISTRO_CODENAME = "sumo"
?
DISTRO=fsl-imx-wayland MACHINE=imx8qxpmek source fsl-setup-release.sh -b build_imx8qxp
? ? ? ? 环境设置脚本
fsl-setup-release.sh
. sources/meta-fsl-bsp-release/imx/tools/setup-utils.sh
提供4个函数
file_override
machine_overrides
bbclass_overrides
hook_in_layer
shift
PROGNAME="setup-environment"【sources/base/setup-environment】
OLD_OPTIND=$OPTIND【getopts命令自动产生两个变量OPTIND和OPTARG】【OPTIND下一个待处理的参数的索引】【OPTARG是当getopts获取到其期望的参数后存入的位置】
getopts "k:r:t:b:e:gh"
$OPTARG【只接收-b -h,其他报错返回】
FSLDISTRO="$DISTRO" 【默认是fsl-imx-xwayland】
BUILD_DIR='build' 【默认是build】
MACHINE='imx6qpsabresd'【默认是imx6qpsabresd】
cp sources/meta-fsl-bsp-release/imx/EULA.txt sources/meta-freescale/EULA
MACHINE=$MACHINE . ./$PROGNAME $BUILD_DIR
MACHINE=imx8qxpmek . ./setup-environment build_imx8qxp
setup-environment
PROGNAME="setup-environment"
- To create a new Yocto build directory:
$ MACHINE=imx6qdlsabresd DISTRO=fslc-framebuffer source $PROGNAME build
- To use an existing Yocto build directory:
$ source $PROGNAME build
-h|--help
OEROOT=$PWD/sources/poky【默认使用poky】
if [ -e $PWD/sources/oe-core ]; then
OEROOT=$PWD/sources/oe-core【否则使用oe-core】
fi
. $OEROOT/oe-init-build-env $CWD/$1 > /dev/null
. sources/poky/oe-init-build-env ./build_imx8qxp
oe-init-build-env
export OEROOT
. $OEROOT/scripts/oe-buildenv-internal &&
TEMPLATECONF="$TEMPLATECONF" $OEROOT/scripts/oe-setup-builddir || {
unset OEROOT
return 1
}
oe-buildenv-internal
# Make sure our paths are at the beginning of $PATH【设置bitbake环境变量】
for newpath in "$BITBAKEDIR/bin" "$OEROOT/scripts"; do
# Remove any existences of $newpath from $PATH
PATH=$(echo $PATH | sed -re "s#(^|:)$newpath(:|$)#\2#g;s#^:##")
# Add $newpath to $PATH
PATH="$newpath:$PATH"
done
oe-setup-builddir
mkdir -p "$BUILDDIR/conf"
echo "" >> $BUILD_DIR/conf/bblayers.conf
echo "# i.MX Yocto Project Release layers" >> $BUILD_DIR/conf/bblayers.conf
hook_in_layer meta-fsl-bsp-release/imx/meta-bsp
hook_in_layer meta-fsl-bsp-release/imx/meta-sdk
echo "" >> $BUILD_DIR/conf/bblayers.conf
echo "BBLAYERS += \" \${BSPDIR}/sources/meta-browser \"" >> $BUILD_DIR/conf/bblayers.conf
echo "BBLAYERS += \" \${BSPDIR}/sources/meta-openembedded/meta-gnome \"" >> $BUILD_DIR/conf/bblayers.conf
echo "BBLAYERS += \" \${BSPDIR}/sources/meta-openembedded/meta-networking \"" >> $BUILD_DIR/conf/bblayers.conf
echo "BBLAYERS += \" \${BSPDIR}/sources/meta-openembedded/meta-python \"" >> $BUILD_DIR/conf/bblayers.conf
echo "BBLAYERS += \" \${BSPDIR}/sources/meta-openembedded/meta-filesystems \"" >> $BUILD_DIR/conf/bblayers.conf
echo "BBLAYERS += \" \${BSPDIR}/sources/meta-qt5 \"" >> $BUILD_DIR/conf/bblayers.conf
????????DISTRO参数
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.
DISTRO:
meta-fsl-bsp-release/imx/meta-sdk/conf/distro/
fsl-imx-fb.conf
fsl-imx-x11.conf
fsl-imx-xwayland.conf【default】
imx-wayland-ivi.conf
fsl-imx-wayland.conf:
# i.MX DISTRO for Wayland without X11
include conf/distro/include/fsl-imx-base.inc
include conf/distro/include/fsl-imx-preferred-env.inc
DISTRO = "fsl-imx-wayland"
# Remove conflicting backends
DISTRO_FEATURES_remove = "directfb x11 "
DISTRO_FEATURES_append = " wayland pam systemd"
meta-fsl-bsp-release/imx/meta-sdk/conf/distro/include
fsl-imx-base.inc
DISTRO = "fsl-imx"
DISTRO_NAME = "NXP i.MX Release Distro"
DISTRO_VERSION = "4.14-sumo"
DISTRO_CODENAME = "sumo"
SDK_VENDOR = "-pokysdk"
SDK_VERSION := "${DISTRO_VERSION}"
#SDK_VERSION := "${@'${DISTRO_VERSION}'.replace('snapshot-${DATE}','snapshot')}"
IMX_DEFAULT_DISTRO_FEATURES = "largefile opengl ptest multiarch bluez"
# Enable vulkan distro feature only for mx8
IMX_DEFAULT_DISTRO_FEATURES_append_mx8 = " vulkan"
IMX_DEFAULT_EXTRA_RDEPENDS = "packagegroup-core-boot"
IMX_DEFAULT_EXTRA_RRECOMMENDS = "kernel-module-af-packet"
IMAGE_FSTYPES = "tar.bz2 ext4 sdcard.bz2"
fsl-imx-preferred-env.inc
# Use i.MX Kernel, U-Boot and Gstreamer 1.0 providers
PREFERRED_PROVIDER_virtual/bootloader_imx = "u-boot-imx"
PREFERRED_PROVIDER_virtual/kernel_imx = "linux-imx"
PREFERRED_VERSION_linux-libc-headers_imx = "4.14"
DEFAULTTUNE_mx8 = "aarch64"
# Use systemd as default init manager
VIRTUAL-RUNTIME_init_manager = "systemd"
PREFERRED_PROVIDER_udev = "systemd"
PREFERRED_PROVIDER_udev-utils = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
IMX_DEFAULT_DISTRO_FEATURES += " systemd"
UBOOT_MAKE_TARGET_mx6ul = "u-boot.imx"
????????MACHINE参数
MACHINE:
meta-fsl-bsp-release/imx/meta-bsp/conf/machine/
imx6dlsabreauto.conf
imx7dsabresd.conf
imx8qxpmek.conf :
MACHINEOVERRIDES =. "mx8:mx8qxp:"
require conf/machine/include/imx-base.inc
require conf/machine/include/arm/arch-arm64.inc
SERIAL_CONSOLE = "115200 ttyAMA0"
KERNEL_DEVICETREE = "freescale/fsl-imx8qxp-mek.dtb freescale/fsl-imx8qxp-mek-dom0.dtb"
UBOOT_MAKE_TARGET = "u-boot.bin"
UBOOT_SUFFIX = "bin"
UBOOT_CONFIG ??= "sd"
UBOOT_CONFIG[sd] = "imx8qxp_mek_config,sdcard"
UBOOT_CONFIG[fspi] = "imx8qxp_mek_fspi_defconfig"
BOOT_SPACE = "65536"
IMAGE_BOOTLOADER = "imx-boot"
IMX_BOOT_SEEK = "32"
IMXBOOT_TARGETS = "${@bb.utils.contains('UBOOT_CONFIG', 'fspi', 'flash_flexspi', \
'flash_all flash', d)}"
BOARD_TYPE = "mek"
genvict_imx8qxp.conf:
KERNEL_DEVICETREE = "freescale/fsl-imx8qxp-mek.dtb"
UBOOT_CONFIG ??= "emmc"
UBOOT_CONFIG[emmc] = "imx8qxp_mek_config,sdcard"
? ? ? ? 编译环境配置后
build_imx8qxp/conf/bblayers.conf【带conf/layer.conf层配置的目录文件】
LCONF_VERSION = "6"
BBPATH = "${TOPDIR}"
BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}"
BBFILES ?= ""
BBLAYERS = " \
${BSPDIR}/sources/poky/meta \
${BSPDIR}/sources/poky/meta-poky \
\
${BSPDIR}/sources/meta-openembedded/meta-oe \
${BSPDIR}/sources/meta-openembedded/meta-multimedia \
\
${BSPDIR}/sources/meta-freescale \
${BSPDIR}/sources/meta-freescale-3rdparty \
${BSPDIR}/sources/meta-freescale-distro \
"
# i.MX Yocto Project Release layers
BBLAYERS += " ${BSPDIR}/sources/meta-fsl-bsp-release/imx/meta-bsp "
BBLAYERS += " ${BSPDIR}/sources/meta-fsl-bsp-release/imx/meta-sdk "
BBLAYERS += " ${BSPDIR}/sources/meta-browser "
BBLAYERS += " ${BSPDIR}/sources/meta-openembedded/meta-gnome "
BBLAYERS += " ${BSPDIR}/sources/meta-openembedded/meta-networking "
BBLAYERS += " ${BSPDIR}/sources/meta-openembedded/meta-python "
BBLAYERS += " ${BSPDIR}/sources/meta-openembedded/meta-filesystems "
BBLAYERS += " ${BSPDIR}/sources/meta-qt5 "
build_imx8qxp/conf/local.conf
MACHINE ??= 'imx8qxpmek'
DISTRO ?= 'fsl-imx-wayland'
PACKAGE_CLASSES ?= "package_rpm"
EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS ??= "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
STOPTASKS,/tmp,100M,100K \
ABORT,${TMPDIR},100M,1K \
ABORT,${DL_DIR},100M,1K \
ABORT,${SSTATE_DIR},100M,1K \
ABORT,/tmp,10M,1K"
PACKAGECONFIG_append_pn-qemu-native = " sdl"
PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
CONF_VERSION = "1"
DL_DIR ?= "${BSPDIR}/downloads/"
ACCEPT_FSL_EULA = "1"
编译完成后
? ? ? ??bitbake fsl-image-validation-imx
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
Your build environment has been configured with:
MACHINE=imx8qxpmek
SDKMACHINE=i686
DISTRO=fsl-imx-wayland
EULA=
BSPDIR=
BUILD_DIR=.
meta-freescale directory found
|