Host Environment: ubuntu 16.04 LTS
Linux BSP For i.MX : version 4.9.88
The document has 5 main contents:
1. Compiling core-image-base in Yocto BSP
--Copy u-boot source code to a new directory
--Copy linux kernel source code to a new directory
2. Exporting 4.9.88 toolchain from Freescale Yocto BSP
(1) Using MACHINE=imx7dsabresd to export the toolchain
(2) Using MACHINE=imx6qsabresd to export the toolchain.
Actually above 2 are the same toolchain after exporting. Here , only show any one of boards(not ARM64) can be used for MACHINE. So users only need to export it for one time, select (1) or (2) to export toolchain.
(3) Using MACHINE=imx8mqevk to export ARM64 toolchain
3. Compling u-boot & linux kernel under Stanalone
--Compiling u-boot for imx7dsabresd
--Compiling kernel and dtb for imx7dsabresd
--Compiling u-boot for imx8mqevk
--Compiling kernel and dtb for imx8mqevk
4. Compiling OS Firmware for i.MX7DSabreSD board
--u-boot for mfg tools
--kernel and dtb for mfg tools
5. Copy OS Firmware to the related path of MFG tools
---------------------------------------------------------------------------------------------------------------------------
[Content of Document]
1. Compiling core-image-base in Yocto BSP
After repo syn is done according to “i.MX_Yocto_Project_User's_Guide.pdf”, Use the command to compile linux BSP, u-boot & kernel source code will be released.
# DISTRO=fsl-imx-fb MACHINE=imx7dsabresd source fsl-setup-release.sh -b build-fb
# bitbake core-image-base
After compiling is done, u-boot & linux kernel source code is in the path below:
u-boot: ~/imx-yocto-bsp/build-fb/tmp/work/imx7dsabresd-poky-linux-gnueabi/u-boot-imx/2017.03-r0/git
linux: ~/imx-yocto-bsp/build-fb/tmp/work/imx7dsabresd-poky-linux-gnueabi/linux-imx/4.9.88-r0/git
We can create a new directory for uboot and linux kernel source code. Here I created a directory named disk2.
# cd ~/
# mkdir disk2
# cd disk2
# mkdir u-boot-2017-03
# mkdir linux-imx-4.9.88
--Copy u-boot source code to a new directory
# cd ~/imx-yocto-bsp/build-fb/tmp/work/imx7dsabresd-poky-linux-gnueabi/u-boot-imx/2017.03-r0/git
# cp –r ./* ~/disk2/u-boot-2017-03
--Copy linux kernel source code to a new directory
# cd ~/imx-yocto-bsp/build-fb/tmp/work/imx7dsabresd-poky-linux-gnueabi/linux-imx/4.9.88-r0/git
# cp –r ./* ~/disk2/ linux-imx-4.9.88
2. Exporting 4.9.88 toolchain from Freescale Yocto BSP
(1) Using MACHINE=imx7dsabresd to export the toolchain
Step1:
# cd ~/imx-yocto-bsp/
# DISTRO=fsl-imx-fb MACHINE=imx7dsabresd source fsl-setup-release.sh -b build-minimal
… …
Do you accept the EULA you just read? (y/n) y
EULA has been accepted.
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:
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=imx7dsabresd
SDKMACHINE=i686
DISTRO=fsl-imx-fb
EULA=
BSPDIR=
BUILD_DIR=.
meta-freescale directory found
Here “build-minimal” is a directory for compiling source code, users can also set it other name.
In ~/imx-yocto-bsp/build-minimal, Begin to export toolchain with the command.
Step2:
# DISTRO=fsl-imx-fb MACHINE=imx7dsabresd bitbake core-image-minimal -c populate_sdk
[Comment-1] About DISTRO and MACHINE on above 2 commands
So MACHINE’s value is the name each Evaluation Borad.
DISTRO can be set the values below:
bitbake rootfs type
Below is the detailed description for above rootfs type:
[Comment-2] Descriptions on difference of toolchain between i.MX6/7 and i.MX8MQ
i.MX6 and i.MX7 are both 32bit ARM processor, they use the same toolchain.
i.MX8MQ is 64bit ARM processor, so it’s toolchain is different from that of i.MX6/7.
Setp 3:
After above compiling is done, enter into ~/imx-yocto-bsp/build-minimal/tmp/deploy/sdk
# cd ~/imx-yocto-bsp/build-minimal/tmp/deploy/sdk
# ls
Run .sh file:
Then continue operations according to guidance:
Done:
OK, Let us check /opt/fsl-imx-fb/ directory:
# ls /opt/fsl-imx-fb/4.9.88-2.0.0/
Because we used MACHINE=imx7dsabresd, environment was named “cortex-A7”, compiler’s version is still 4.9.88.
(2) Using MACHINE=imx6qsabresd to export the toolchain.
We can change “MACHINE=imx6qsabresd” and repeat above 3 steps, environment will be named “cortex-A9”.
Close the current terminal, and open a new one.
# cd ~/ imx-yocto-bsp
# DISTRO=fsl-imx-fb MACHINE=imx6qsabresd source fsl-setup-release.sh -b build-A9-min
Then automatically enter “~/imx-yocto-bsp/build-A9-min”, run command below.
# DISTRO=fsl-imx-fb MACHINE=imx6qsabresd bitbake core-image-minimal -c populate_sdk
# ~/imx-yocto-bsp/build-A9-min/tmp/deploy/sdk
# ls
# ./ fsl-imx-fb-glibc-x86_64-core-image-minimal-cortexa9hf-neon-toolchain-4.9.88-2.0.0.sh
Set it up in another directory: /opt/fsl-imx-fb/4.9.88
(3) Using MACHINE=imx8mqevk to export ARM64 toolchain
Export Toolchain for i.MX8MQ, create a new terminal, then run these 2 commands below.
# ~/imx-yocto-bsp
# DISTRO=fsl-imx-xwayland MACHINE=imx8mqevk source fsl-setup-release.sh -b build-xwayland
# DISTRO=fsl-imx-fb MACHINE=imx8mqevk bitbake core-image-minimal -c populate_sdk
Done.
Copy the toolchain to /opt/fsl-imx-fb directory
# cd ~/imx-yocto-bsp/build-xwayland/tmp/deploy/sdk
# ls
#./fsl-imx-fb-glibc-x86_64-core-image-minimal-aarch64-toolchain-4.9.88-2.0.0.sh
I installed it to a new directory: /opt/fsl-imx-fb/4.9.88-arm64
#ls ls /opt/fsl-imx-fb/4.9.88-arm64/
OK, 64bit toolchain for i.MX8MQ has been exported to the directory.
3. Compling u-boot & linux kernel under Stanalone
--Compiling u-boot for imx7dsabresd
# cd ~/disk2/u-boot-2017-03
# source /opt/fsl-imx-fb/4.9.88-2.0.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi
# export ARCH=arm
# make clean
# make mx7dsabresd_defconfig
# make u-boot.imx
Done.
--Compiling kernel and dtb for imx7dsabresd
# cd ~/disk2/linux-imx-4.9.88/
[comment] If environment has been configured, that is, these 2 commands have been run on the current terminal, don’t need to run them again.
“source /opt/fsl-imx-fb/4.9.88-2.0.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi”
and
“export ARCH=arm”
# make clean
# make imx_v7_defconfig
# make
zImage is in “~/disk2/linux-imx-4.9.88/arch/arm/boot”
dtb is in “~/disk2/linux-imx-4.9.88/arch/arm/boot/dts”
Probably users want to run “make menuconfig”, and meet the errors like below.
# sudo apt-get install libncurses* (To solve the problem below)
# make menuconfig
[Comment-3] Users can also use "environment-setup-cortexa9hf-neon-poky-linux-gnueabi" to compile u-boot and kernel.
--Compiling u-boot for imx8mqevk
# cd ~/disk2/u-boot-2017-03
# source /opt/fsl-imx-fb/4.9.88-arm64/environment-setup-aarch64-poky-linux
# export ARCH=arm64
# make clean
# make imx8mq_evk_defconfig
# make u-boot.imx
Done.
--Compiling kernel and dtb for imx8mqevk
# cd ~/disk2/linux-imx-4.9.88/
[comment] If environment has been configured, that is, these 2 commands have been run on the current terminal, don’t need to run them again.
“source /opt/fsl-imx-fb/4.9.88-arm64/environment-setup-aarch64-poky-linux”
and
“export ARCH=arm64”
# make clean
# make defconfig
# make
Run the command to unset LDFLAGS:
# unset LDFLAGS
# make
Done.
4. Compiling OS Firmware for i.MX7DSabreSD board
--u-boot for mfg tools
# make mx7dsabresd_config
# make u-boot.imx
Then rename u-boot.imx to be “u-boot-mx7dsabresd-mfg.imx”.
--kernel and dtb for mfg tools
Copy imx_v7_mfg_defconfig file to “arch/arm/configs”, then run commands below.
# make imx_v7_mfg_defconfig
# make
zImage will be generated at path arch/arm/boot.
dtb file will be generated at path arch/arm/boot/dts
Then rename zImage to be zImage-mx7dsabre-mfg,
Rename imx7d-sdb.dtb to be zImage-imx7d-sdb-mfg.dtb
5. Copy OS Firmware to the related path of MFG tools
Up to now, 3 files for OS Firmware has been generated, then copy these 3 files to mfgtools\Profiles\Linux\OS Firmware\firmware
When MFG Tools begins to run, these 3 files and ramdisk will be downloaded to SDRAM on board, then run them, and download images(u-boot\kernel\rootfs\) which have been ready in “mfgtools\Profiles\Linux\OS Firmware\files”.
Above steps and commands will be performed according to list in ucl2.xml. So customer will add a new list for her downloading or change an existing list according to image’s name.
NXP TIC team
Weidong Sun
04-25-2019