2023年6月21日发(作者:)

在LSDK中使⽤yocto与yocto独⽴环境搭建⼀、LSDK中使⽤yoctoyocto rootfs编译命令# flex-builder -i mkrfs -r yocto:tiny -m ls1046ardb⽣成⽂件: ./flexbuild_lsdk2108/build/images/rootfs_lsdk2108_yocto_tiny_注意:不要使⽤root⽤户编译,即使修改脚本跳过校验后⾯还会有很多难以修复的故障。脚本第⼀步会下载yocto-poky到lexbuild_lsdk2108/components/rfs,这⾥如果是离线下载拷贝进来也要⽤普通⽤户解压,否则亦会出错;pathname: flexbuild_lsdk2108/tools/distro_yocto## yocto编译脚本 FBDIR=flexbuild_lsdk2108路径build_distro_rfs_yocto() { [ $username = root ] && fbprint_w "Please build yocto as non-root account" && exit ## root⽤户编译直接退出 [ -f $PACKAGES_PATH/rfs/yocto-poky/meta-poky/recipes-core/tiny-init/files/init ] || git clone $repo_yocto_poky_url $PACKAGES_PATH/rfs/yocto-poky -b $repo_yocto_poky_tag ## clone代码 yoctorfs=rootfs_${DISTRIB_VERSION}_yocto_${DISTROSCALE}_${DESTARCH} ## DISTRIB_VERSION=lsdk2108 DISTROSCALE=tiny DESTAR $FBDIR/configs/yocto/ fixcfg ## configs/yocto/ --> 按照deconfig修改配置 cp -f $FBDIR/configs/yocto/local_${DESTARCH}_${DISTROSCALE}.conf $FBOUTDIR/rfs/$yoctorfs/conf/ -8 [ $DESTARCH = arm64 ] && export MACHINE=qemuarm64 || export MACHINE=qemuarm bitbake $yoctoimgtype [ $DESTARCH = arm64 -a $DISTROSCALE = devel ] && $FBDIR/configs/yocto/ fixlib $RFSDIR/usr/lib/ [ -L $FBOUTDIR/rfs/$yoctorfs/target ] || ln -s $RFSDIR $FBOUTDIR/rfs/$yoctorfs/target ## FBOUTDIR=build yoctorfs=rootfs_lsdk2108_yocto_tiny_arm64 # RFSDIR=/home/[username]/yoctobuild/tmp/work/qemuarm64-poky-linux/core-image-minimal/1.0-r0/rootfs # setup app components (restool, aiop_tool, tsntool, fmc, etc) in yocto userland echo Building and installing app components for $DISTROTYPE $DISTROSCALE flex-builder -c apps -r yocto:$DISTROSCALE -a ${DESTARCH} -f $CFGLISTYML ## 编译DISTROSCALE范围的apps if [ $DISTROSCALE = tiny ]; then ## 将⽣成⽂件塞进⽂件系统[ -f $DESTDIR/usr/local/bin/restool ] && sudo cp -f $DESTDIR/usr/local/bin/{ls-*,restool} $RFSDIR/usr/bin[ -f $DESTDIR/usr/bin/aiop_tool ] && sudo cp -f $DESTDIR/usr/bin/aiop_tool $RFSDIR/usr/bin[ -f $DESTDIR/lib/libfm-arm.a ] && sudo cp -f $DESTDIR/lib/libfm-arm.a $RFSDIR/lib[ -f $DESTDIR/usr/local/bin/fmc ] && sudo cp -f $DESTDIR/usr/local/bin/fmc $RFSDIR/usr/bin && sudo cp -Prf --preserve=mode,timestamps $DESTDIR/etc/fmc $RFSDIR/etc && sudo cp -f $DESTDIR/usr/local/lib/*/libfmc.a $RFSDIR/usr/lib[ -f $DESTDIR/usr/local/bin/tsntool ] && sudo cp -f $DESTDIR/usr/local/bin/tsntool $RFSDIR/usr/bin && sudo cp -f $DESTDIR/usr/lib/ $RFSDIR/usr/libsudo mkdir -p $RFSDIR/usr/local/bin && [ -f $DESTDIR/usr/local/bin/ccsr ] && sudo cp -f $DESTDIR/usr/local/bin/ccsr $RFSDIR/usr/local/bin/sudo rm -rf $RFSDIR/usr/include/* $RFSDIR/usr/lib/aarch64-poky-linux $RFSDIR/usr/share/libtool $RFSDIR/usr/share/aclocalsudo echo TinyLinux | sudo tee $RFSDIR/etc/hostname 1>/dev/null ## 将主机名写⼊/etc/hostnamesudo cp -f $FBDIR/packages/rfs/misc/mount-modules $RFSDIR/usr/local/bin ## mount-modules 启动⽅式不同挂载的⽬录也不同 elif [ $DISTROSCALE = devel ]; then ## another scalesudo cp -Prf --preserve=mode,timestamps $DESTDIR/* $RFSDIR/sudo mkdir -p $RFSDIR/etc/systemd/system && sudo cp -f $FBDIR/packages/rfs/misc/ $RFSDIR/etc/systemd/system/sudo echo DevelLinux | sudo tee $RFSDIR/etc/hostname 1>/dev/null fi distroinfo="$DISTRIB_NAME $DISTROSCALE ${DISTRIB_VERSION:4:4} (based on Yocto)" echo $distroinfo | sudo tee $RFSDIR/etc/issue 1>/dev/null echo $distroinfo | sudo tee $RFSDIR/etc/buildinfo 1>/dev/null distrostamp="Build: `date +'%Y-%m-%d %H:%M:%S'`" echo "$distrostamp" | sudo tee -a $RFSDIR/etc/buildinfo 1>/dev/null ## 信息写⼊ sudo cp -f $FBDIR/tools/flex-installer $RFSDIR/usr/bin ## flex-installer拷⼊bin⽬录 $FBDIR/configs/yocto/ fixsys $RFSDIR cd $RFSDIR && sudo chown -h -R 0:0 * && sudo find . | sudo cpio --quiet -o -H newc | gzip > $FBOUTDIR/images/$ && fbprint_d $FBOUTDIR/images/$ cp -f $yoctotmpdir/deploy/images/$MACHINE/${yoctoimgtype}-${MACHINE}.manifest $FBOUTDIR/rfs/$yoctorfs/$st [ $DISTROSCALE = tiny ] && cp -f $yoctotmpdir/deploy/images/$MACHINE/${yoctoimgtype}-${MACHINE}.ubifs $FBOUTDIR/images/$ && cp -f $yoctotmpdir/deploy/images/$MACHINE/${yoctoimgtype}-${MACHINE}.squashfs $FBOUTDIR/images/$fs flex-builder -i packrfs -r yocto:$DISTROSCALE -a $DESTARCH -f $CFGLISTYML ## 打包 ls -goh $FBOUTDIR/images/$yoctorfs*} . $PACKAGES_PATH/rfs/yocto-poky/oe-init-build-env $FBOUTDIR/rfs/$yoctorfs ## components/rfs/yocto-poky/oe-init-build-env 为yocto环境设置环境变编译⽇志:xxx@xxx:/disk2/code/flexbuild_lsdk2108$ flex-builder -i mkrfs -r yocto:tiny -m ls1046ardbDISTRO TYPE: yoctoDISTRO SCALE: tinyMACHINE: ls1046ardbYou had no conf/ file. This configuration file has therefore beencreated for you with some default values. You may wish to edit it to, forexample, select a different MACHINE (target hardware). See conf/ample, select a different MACHINE (target hardware). See conf/r more information as common configuration options are had no conf/ file. This configuration file has therefore beencreated for you with some default values. To add additional metadata layersinto your configuration please add entries to conf/ Yocto Project has extensive documentation about OE including a referencemanual which can be found at: /documentationFor more information about OpenEmbedded see their website: /### Shell environment set up for builds. ###You can now run 'bitbake 'Common targets are: core-image-minimal core-image-full-cmdline core-image-sato core-image-weston meta-toolchain meta-ide-supportYou can also run generated qemu images with a command like 'runqemu qemux86'Other commonly useful commands are: - 'devtool' and 'recipetool' handle common recipe tasks - 'bitbake-layers' handles common layer tasks - 'oe-pkgdata-util' handles common target package tasksLoading cache: 100% | | ETA: --:--:--Loaded 0 entries from dependency g recipes: 100% |###########################################################################| Time: 0:00:16Parsing of 818 .bb files complete (0 cached, 818 parsed). 1443 targets, 56 skipped, 0 masked, 0 : Resolving any missing task queue dependenciesBuild Configuration:BB_VERSION = "1.50.0"BUILD_SYS = "x86_64-linux"NATIVELSBSTRING = "ubuntu-20.04"TARGET_SYS = "aarch64-poky-linux"MACHINE = "qemuarm64"DISTRO = "poky"DISTRO_VERSION = "3.3.1"TUNE_FEATURES = "aarch64 armv8a crc cortexa57"TARGET_FPU = ""meta

meta-poky

meta-yocto-bsp = "master:7cf369c910ddc43b61d86a88a1fb771b9d6d4549"Initialising tasks: 100% |########################################################################| Time: 0:00:03Sstate summary: Wanted 1190 Local 1187 Network 0 Missed 3 Current 0 (99% match, 0% complete)NOTE: Executing TasksNOTE: Tasks Summary: Attempted 3277 tasks of which 3014 didn't need to be rerun and all ng and installing app components for yocto tiny以下内容来⾃⼆、常规yocto环境搭建⽤户磁盘预留⾄少80G硬盘空间1、apt-get update2、apt-get install wget git-core unzip make gcc g++ build-essentialsubversion sed autoconf automake texi2html texinfocoreutils diffstatpython-pysqlite2 docbook-utils libsdl1.2-dev libxml-parser-perl libgl1-mesa-devlibglu1-mesa-dev xsltprocdesktop-file-utils chrpath groff libtool xterm gawkfop3、clone poky 的 morty 稳定分⽀:git clone -b mortygit:///4、进⼊poky⽬录,然后运⾏下⾯的命令为 Yocto 开发环境设置(设置/导出)⼀些环境变量:source oe-init-build-env5、若正常,会⾃动进⼊build⽬录6、修改build/conf/⽂件,如提供的⽂件所⽰。7、编译:bitbake core-image-minimal编译过程会下载很多东西,编译持续时间较久。8、编译完成后runqemu qemux86-64为运⾏新的基于 Yocto 的 Linux 发⾏版的 qemu 打开⼀个新屏幕,则表⽰安装完成。三、YOCTO BSP编译:1、 下载repo:mkdir ~/bin (this step may not be needed if the bin folder already exists)chmod a+x ~/bin/repo2、设置搜索路径:export PATH=~/bin:$PATH3、设置⽤户名和邮箱gitconfig --global "Your Name"gitconfig --global "Your Email"gitconfig –list4、获取linux BSP:mkdir fsl-release-bspcd fsl-release-bsprepo init -ugit:///imx/ -b imx-3.14.52-1.1.0_garepo sync说明:reposync 将会是⼀个漫长的等待过程,中间可能会出错。如果出错了就重新repo sync,直到成功为⽌。另外有的时候可能会很长时间不动了,看下载的流量也⼀直是0,也可以ctrl+C终⽌,然后重新repo sync。注意在yocto下,我们下载BSP实际上只是⼀些配置⽂件,实际编译的时候边编译边下载的,所以在我们下载的BSP⾥⾯是找不到代码的。5、编译BSP前的准备⼯作:格式:DISTRO=MACHINE= source -b distro name有下⾯4个值fsl-imx-x11 说明只⽀持X11 graphicsfsl-imx-wayland 说明只⽀持Wayland weston graphicsfsl-imx-xwayland 说明⽀持 Wayland graphics 和 -imx-fb 说明只⽀持Frame Buffer graphics 不⽀持 X11 和 Waylandmachine name 对应我们的开发板的类型,有下⾯的值imx6qpsabreauto 、 imx6qpsabresd、 imx6ulevk 、imx6dlsabreautoimx6dlsabresd 、 imx6qsabreauto 、 imx6qsabresd 、 imx6slevk 、 imx6solosabreautoimx6solosabresd 、 imx6sxsabresd 、 imx6sxsabreauto 、 imx7dsabresdbuild dir 是编译的⽬录,我们可以任意指定⼀个⽬录名,编译的时候将在当前⽬录下新建这个⽬录。例如我是这样设置的MACHINE=imx6qsabresd DISTRO=fsl-imx-x11 source ./ -bimx6q-x11⾸次运⾏这个命令的时候会提⽰时候遵循EULA协议,我们选y就好了。6、编译BSP:设置好后开始编译。我们⽤bitbake来编译的。格式是 bitbake project name有下⾯的选项core-image-minimal 这个是构建⼀个能启动的最⼩的系统core-image-base 这个是构建⼀个只有命令⾏的系统core-image-sato 这个是⼀个⽀持X11图形界⾯的系统fsl-image-machine-test 这个imx内核的只有命令⾏的系统fsl-image-gui 这个是IMX内核的不⽀持qt的图形界⾯的系统fsl-image-qt5 这个是⽀持qt5的图形界⾯的系统例如我运⾏的命令是bitbake fsl-image-qt57、编译过程中,有可能会产⽣错误,产⽣错误的时候先尝试再次编译,如果还有相同的错误,再解决。编译完成后,在fsl-release-bsp/imx6q-x11/tmp/deploy/images/imx6qsabresd⽬录下会产⽣uboot,zImage,rootfs等映象⽂件。三、⼯具链的制作:1、 GCC⼯具链安装包的制作:bitbakemeta-toolchain编译完成后,在imx6q-x11/tmp/deploy/sdk/⽬录下⽣成⼀个可执⾏的sh⽂件。在别的PC上安装即可。2、 QT⼯具链安装包的制作:bitbakemeta-toolchain-qt5

2023年6月21日发(作者:)

在LSDK中使⽤yocto与yocto独⽴环境搭建⼀、LSDK中使⽤yoctoyocto rootfs编译命令# flex-builder -i mkrfs -r yocto:tiny -m ls1046ardb⽣成⽂件: ./flexbuild_lsdk2108/build/images/rootfs_lsdk2108_yocto_tiny_注意:不要使⽤root⽤户编译,即使修改脚本跳过校验后⾯还会有很多难以修复的故障。脚本第⼀步会下载yocto-poky到lexbuild_lsdk2108/components/rfs,这⾥如果是离线下载拷贝进来也要⽤普通⽤户解压,否则亦会出错;pathname: flexbuild_lsdk2108/tools/distro_yocto## yocto编译脚本 FBDIR=flexbuild_lsdk2108路径build_distro_rfs_yocto() { [ $username = root ] && fbprint_w "Please build yocto as non-root account" && exit ## root⽤户编译直接退出 [ -f $PACKAGES_PATH/rfs/yocto-poky/meta-poky/recipes-core/tiny-init/files/init ] || git clone $repo_yocto_poky_url $PACKAGES_PATH/rfs/yocto-poky -b $repo_yocto_poky_tag ## clone代码 yoctorfs=rootfs_${DISTRIB_VERSION}_yocto_${DISTROSCALE}_${DESTARCH} ## DISTRIB_VERSION=lsdk2108 DISTROSCALE=tiny DESTAR $FBDIR/configs/yocto/ fixcfg ## configs/yocto/ --> 按照deconfig修改配置 cp -f $FBDIR/configs/yocto/local_${DESTARCH}_${DISTROSCALE}.conf $FBOUTDIR/rfs/$yoctorfs/conf/ -8 [ $DESTARCH = arm64 ] && export MACHINE=qemuarm64 || export MACHINE=qemuarm bitbake $yoctoimgtype [ $DESTARCH = arm64 -a $DISTROSCALE = devel ] && $FBDIR/configs/yocto/ fixlib $RFSDIR/usr/lib/ [ -L $FBOUTDIR/rfs/$yoctorfs/target ] || ln -s $RFSDIR $FBOUTDIR/rfs/$yoctorfs/target ## FBOUTDIR=build yoctorfs=rootfs_lsdk2108_yocto_tiny_arm64 # RFSDIR=/home/[username]/yoctobuild/tmp/work/qemuarm64-poky-linux/core-image-minimal/1.0-r0/rootfs # setup app components (restool, aiop_tool, tsntool, fmc, etc) in yocto userland echo Building and installing app components for $DISTROTYPE $DISTROSCALE flex-builder -c apps -r yocto:$DISTROSCALE -a ${DESTARCH} -f $CFGLISTYML ## 编译DISTROSCALE范围的apps if [ $DISTROSCALE = tiny ]; then ## 将⽣成⽂件塞进⽂件系统[ -f $DESTDIR/usr/local/bin/restool ] && sudo cp -f $DESTDIR/usr/local/bin/{ls-*,restool} $RFSDIR/usr/bin[ -f $DESTDIR/usr/bin/aiop_tool ] && sudo cp -f $DESTDIR/usr/bin/aiop_tool $RFSDIR/usr/bin[ -f $DESTDIR/lib/libfm-arm.a ] && sudo cp -f $DESTDIR/lib/libfm-arm.a $RFSDIR/lib[ -f $DESTDIR/usr/local/bin/fmc ] && sudo cp -f $DESTDIR/usr/local/bin/fmc $RFSDIR/usr/bin && sudo cp -Prf --preserve=mode,timestamps $DESTDIR/etc/fmc $RFSDIR/etc && sudo cp -f $DESTDIR/usr/local/lib/*/libfmc.a $RFSDIR/usr/lib[ -f $DESTDIR/usr/local/bin/tsntool ] && sudo cp -f $DESTDIR/usr/local/bin/tsntool $RFSDIR/usr/bin && sudo cp -f $DESTDIR/usr/lib/ $RFSDIR/usr/libsudo mkdir -p $RFSDIR/usr/local/bin && [ -f $DESTDIR/usr/local/bin/ccsr ] && sudo cp -f $DESTDIR/usr/local/bin/ccsr $RFSDIR/usr/local/bin/sudo rm -rf $RFSDIR/usr/include/* $RFSDIR/usr/lib/aarch64-poky-linux $RFSDIR/usr/share/libtool $RFSDIR/usr/share/aclocalsudo echo TinyLinux | sudo tee $RFSDIR/etc/hostname 1>/dev/null ## 将主机名写⼊/etc/hostnamesudo cp -f $FBDIR/packages/rfs/misc/mount-modules $RFSDIR/usr/local/bin ## mount-modules 启动⽅式不同挂载的⽬录也不同 elif [ $DISTROSCALE = devel ]; then ## another scalesudo cp -Prf --preserve=mode,timestamps $DESTDIR/* $RFSDIR/sudo mkdir -p $RFSDIR/etc/systemd/system && sudo cp -f $FBDIR/packages/rfs/misc/ $RFSDIR/etc/systemd/system/sudo echo DevelLinux | sudo tee $RFSDIR/etc/hostname 1>/dev/null fi distroinfo="$DISTRIB_NAME $DISTROSCALE ${DISTRIB_VERSION:4:4} (based on Yocto)" echo $distroinfo | sudo tee $RFSDIR/etc/issue 1>/dev/null echo $distroinfo | sudo tee $RFSDIR/etc/buildinfo 1>/dev/null distrostamp="Build: `date +'%Y-%m-%d %H:%M:%S'`" echo "$distrostamp" | sudo tee -a $RFSDIR/etc/buildinfo 1>/dev/null ## 信息写⼊ sudo cp -f $FBDIR/tools/flex-installer $RFSDIR/usr/bin ## flex-installer拷⼊bin⽬录 $FBDIR/configs/yocto/ fixsys $RFSDIR cd $RFSDIR && sudo chown -h -R 0:0 * && sudo find . | sudo cpio --quiet -o -H newc | gzip > $FBOUTDIR/images/$ && fbprint_d $FBOUTDIR/images/$ cp -f $yoctotmpdir/deploy/images/$MACHINE/${yoctoimgtype}-${MACHINE}.manifest $FBOUTDIR/rfs/$yoctorfs/$st [ $DISTROSCALE = tiny ] && cp -f $yoctotmpdir/deploy/images/$MACHINE/${yoctoimgtype}-${MACHINE}.ubifs $FBOUTDIR/images/$ && cp -f $yoctotmpdir/deploy/images/$MACHINE/${yoctoimgtype}-${MACHINE}.squashfs $FBOUTDIR/images/$fs flex-builder -i packrfs -r yocto:$DISTROSCALE -a $DESTARCH -f $CFGLISTYML ## 打包 ls -goh $FBOUTDIR/images/$yoctorfs*} . $PACKAGES_PATH/rfs/yocto-poky/oe-init-build-env $FBOUTDIR/rfs/$yoctorfs ## components/rfs/yocto-poky/oe-init-build-env 为yocto环境设置环境变编译⽇志:xxx@xxx:/disk2/code/flexbuild_lsdk2108$ flex-builder -i mkrfs -r yocto:tiny -m ls1046ardbDISTRO TYPE: yoctoDISTRO SCALE: tinyMACHINE: ls1046ardbYou had no conf/ file. This configuration file has therefore beencreated for you with some default values. You may wish to edit it to, forexample, select a different MACHINE (target hardware). See conf/ample, select a different MACHINE (target hardware). See conf/r more information as common configuration options are had no conf/ file. This configuration file has therefore beencreated for you with some default values. To add additional metadata layersinto your configuration please add entries to conf/ Yocto Project has extensive documentation about OE including a referencemanual which can be found at: /documentationFor more information about OpenEmbedded see their website: /### Shell environment set up for builds. ###You can now run 'bitbake 'Common targets are: core-image-minimal core-image-full-cmdline core-image-sato core-image-weston meta-toolchain meta-ide-supportYou can also run generated qemu images with a command like 'runqemu qemux86'Other commonly useful commands are: - 'devtool' and 'recipetool' handle common recipe tasks - 'bitbake-layers' handles common layer tasks - 'oe-pkgdata-util' handles common target package tasksLoading cache: 100% | | ETA: --:--:--Loaded 0 entries from dependency g recipes: 100% |###########################################################################| Time: 0:00:16Parsing of 818 .bb files complete (0 cached, 818 parsed). 1443 targets, 56 skipped, 0 masked, 0 : Resolving any missing task queue dependenciesBuild Configuration:BB_VERSION = "1.50.0"BUILD_SYS = "x86_64-linux"NATIVELSBSTRING = "ubuntu-20.04"TARGET_SYS = "aarch64-poky-linux"MACHINE = "qemuarm64"DISTRO = "poky"DISTRO_VERSION = "3.3.1"TUNE_FEATURES = "aarch64 armv8a crc cortexa57"TARGET_FPU = ""meta

meta-poky

meta-yocto-bsp = "master:7cf369c910ddc43b61d86a88a1fb771b9d6d4549"Initialising tasks: 100% |########################################################################| Time: 0:00:03Sstate summary: Wanted 1190 Local 1187 Network 0 Missed 3 Current 0 (99% match, 0% complete)NOTE: Executing TasksNOTE: Tasks Summary: Attempted 3277 tasks of which 3014 didn't need to be rerun and all ng and installing app components for yocto tiny以下内容来⾃⼆、常规yocto环境搭建⽤户磁盘预留⾄少80G硬盘空间1、apt-get update2、apt-get install wget git-core unzip make gcc g++ build-essentialsubversion sed autoconf automake texi2html texinfocoreutils diffstatpython-pysqlite2 docbook-utils libsdl1.2-dev libxml-parser-perl libgl1-mesa-devlibglu1-mesa-dev xsltprocdesktop-file-utils chrpath groff libtool xterm gawkfop3、clone poky 的 morty 稳定分⽀:git clone -b mortygit:///4、进⼊poky⽬录,然后运⾏下⾯的命令为 Yocto 开发环境设置(设置/导出)⼀些环境变量:source oe-init-build-env5、若正常,会⾃动进⼊build⽬录6、修改build/conf/⽂件,如提供的⽂件所⽰。7、编译:bitbake core-image-minimal编译过程会下载很多东西,编译持续时间较久。8、编译完成后runqemu qemux86-64为运⾏新的基于 Yocto 的 Linux 发⾏版的 qemu 打开⼀个新屏幕,则表⽰安装完成。三、YOCTO BSP编译:1、 下载repo:mkdir ~/bin (this step may not be needed if the bin folder already exists)chmod a+x ~/bin/repo2、设置搜索路径:export PATH=~/bin:$PATH3、设置⽤户名和邮箱gitconfig --global "Your Name"gitconfig --global "Your Email"gitconfig –list4、获取linux BSP:mkdir fsl-release-bspcd fsl-release-bsprepo init -ugit:///imx/ -b imx-3.14.52-1.1.0_garepo sync说明:reposync 将会是⼀个漫长的等待过程,中间可能会出错。如果出错了就重新repo sync,直到成功为⽌。另外有的时候可能会很长时间不动了,看下载的流量也⼀直是0,也可以ctrl+C终⽌,然后重新repo sync。注意在yocto下,我们下载BSP实际上只是⼀些配置⽂件,实际编译的时候边编译边下载的,所以在我们下载的BSP⾥⾯是找不到代码的。5、编译BSP前的准备⼯作:格式:DISTRO=MACHINE= source -b distro name有下⾯4个值fsl-imx-x11 说明只⽀持X11 graphicsfsl-imx-wayland 说明只⽀持Wayland weston graphicsfsl-imx-xwayland 说明⽀持 Wayland graphics 和 -imx-fb 说明只⽀持Frame Buffer graphics 不⽀持 X11 和 Waylandmachine name 对应我们的开发板的类型,有下⾯的值imx6qpsabreauto 、 imx6qpsabresd、 imx6ulevk 、imx6dlsabreautoimx6dlsabresd 、 imx6qsabreauto 、 imx6qsabresd 、 imx6slevk 、 imx6solosabreautoimx6solosabresd 、 imx6sxsabresd 、 imx6sxsabreauto 、 imx7dsabresdbuild dir 是编译的⽬录,我们可以任意指定⼀个⽬录名,编译的时候将在当前⽬录下新建这个⽬录。例如我是这样设置的MACHINE=imx6qsabresd DISTRO=fsl-imx-x11 source ./ -bimx6q-x11⾸次运⾏这个命令的时候会提⽰时候遵循EULA协议,我们选y就好了。6、编译BSP:设置好后开始编译。我们⽤bitbake来编译的。格式是 bitbake project name有下⾯的选项core-image-minimal 这个是构建⼀个能启动的最⼩的系统core-image-base 这个是构建⼀个只有命令⾏的系统core-image-sato 这个是⼀个⽀持X11图形界⾯的系统fsl-image-machine-test 这个imx内核的只有命令⾏的系统fsl-image-gui 这个是IMX内核的不⽀持qt的图形界⾯的系统fsl-image-qt5 这个是⽀持qt5的图形界⾯的系统例如我运⾏的命令是bitbake fsl-image-qt57、编译过程中,有可能会产⽣错误,产⽣错误的时候先尝试再次编译,如果还有相同的错误,再解决。编译完成后,在fsl-release-bsp/imx6q-x11/tmp/deploy/images/imx6qsabresd⽬录下会产⽣uboot,zImage,rootfs等映象⽂件。三、⼯具链的制作:1、 GCC⼯具链安装包的制作:bitbakemeta-toolchain编译完成后,在imx6q-x11/tmp/deploy/sdk/⽬录下⽣成⼀个可执⾏的sh⽂件。在别的PC上安装即可。2、 QT⼯具链安装包的制作:bitbakemeta-toolchain-qt5