Difference between revisions of "IoTGateway/BSP/Linux/iMX6/Yocto LBVC User Guide"
(→Download_BSP_From_GitHub) |
|||
Line 129: | Line 129: | ||
| | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
:During building Yocto image , it will generate downloads folder which includes all packages we need , but it usually can't fetch normally, so we keep this downloads folder. Then we can reduce some fetch failed issue. | :During building Yocto image , it will generate downloads folder which includes all packages we need , but it usually can't fetch normally, so we keep this downloads folder. Then we can reduce some fetch failed issue. | ||
Line 202: | Line 173: | ||
to the sources directory. This sets up the recipes that are used to build the project. | to the sources directory. This sets up the recipes that are used to build the project. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=== <span style="color:#0070c0">BSP Content</span> === | === <span style="color:#0070c0">BSP Content</span> === | ||
Line 247: | Line 201: | ||
:Perform the following command in terminal console | :Perform the following command in terminal console | ||
::<code>$ bitbake imx-image-full</code> | ::<code>$ bitbake imx-image-full</code> | ||
− | :The file, imx-image-full-<span style="color:#7030a0">'''${MC}'''</span>.wic. | + | :The file, imx-image-full-<span style="color:#7030a0">'''${MC}'''</span>.wic.zst, will be located in directory, ./tmp/deploy/images/<span style="color:#7030a0">'''${MC}'''</span>, while building process finished successfully. |
=== <span style="color:#0070c0">To build toolchain installer</span> === | === <span style="color:#0070c0">To build toolchain installer</span> === | ||
Line 255: | Line 209: | ||
::<code>$ bitbake meta-toolchain</code> | ::<code>$ bitbake meta-toolchain</code> | ||
:The below installer will be located in the directory "./tmp/deploy/sdk". | :The below installer will be located in the directory "./tmp/deploy/sdk". | ||
− | ::<tt>fsl-imx-xwayland-glibc-x86_64- | + | ::<tt>fsl-imx-xwayland-glibc-x86_64-imx-image-full-cortexa9t2hf-neon-imx6qsabresd-toolchain-5.15-kirkstone</tt> |
=== <span style="color:#0070c0">To build bootloader</span> === | === <span style="color:#0070c0">To build bootloader</span> === | ||
Line 283: | Line 237: | ||
:: | :: | ||
:::<code>$ bitbake linux-imx</code> | :::<code>$ bitbake linux-imx</code> | ||
− | :The two files, Image & Image-<span style="color:#7030a0">'''${ | + | :The two files, Image & Image-<span style="color:#7030a0">'''${IMX6PROC}'''</span>-<span style="color:#7030a0">'''${BOARD}'''</span>-<span style="color:#7030a0">'''${BOARD'''</span>'''<span style="color:#7030a0">_REV</span><span style="color:#7030a0">}</span>'''.dtb, will be located in the directory, ./tmp/deploy/images/<span style="color:#7030a0">'''${MC}'''</span>. |
== <span style="color:#0070c0">Creating boot-up on-board flash from prebuilt image</span> == | == <span style="color:#0070c0">Creating boot-up on-board flash from prebuilt image</span> == | ||
Line 317: | Line 271: | ||
*You need to prepare the debug console tool. For example: "minicom" tool or "putty" tool. | *You need to prepare the debug console tool. For example: "minicom" tool or "putty" tool. | ||
*Baud rate: 115200 | *Baud rate: 115200 | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
= Customization = | = Customization = | ||
Line 347: | Line 279: | ||
:Perform the following command in terminal console | :Perform the following command in terminal console | ||
::<code>$ cd <span style="color:#7030a0">'''${BSP_HOME}'''</span>/<span style="color:#7030a0">'''${BDIR}'''</span>/tmp/deploy/sdk</code> | ::<code>$ cd <span style="color:#7030a0">'''${BSP_HOME}'''</span>/<span style="color:#7030a0">'''${BDIR}'''</span>/tmp/deploy/sdk</code> | ||
− | ::<code>$ sudo ./fsl-imx- | + | ::<code>$ sudo ./</code><tt>fsl-imx-xwayland-glibc-x86_64-imx-image-full-cortexa9t2hf-neon-imx6qsabresd-toolchain-5.15-kirkstone</tt> |
:Enter new installed directory or just press <code>Enter</code> to use default directory. | :Enter new installed directory or just press <code>Enter</code> to use default directory. | ||
:While <code>Proceed[y/n]?</code> shows up, please enter the correct one. | :While <code>Proceed[y/n]?</code> shows up, please enter the correct one. | ||
Line 362: | Line 294: | ||
:SDK has been set up (ref.[[#Setting_up_SDK|<span style="color:#FF0000">Setting up SDK</span>]]) | :SDK has been set up (ref.[[#Setting_up_SDK|<span style="color:#FF0000">Setting up SDK</span>]]) | ||
:Perform the following command in terminal console | :Perform the following command in terminal console | ||
− | ::<code>$ source <span style="color:#7030a0">'''${TOOLCHAIN}'''</span>/environment-setup- | + | ::<code>$ source <span style="color:#7030a0">'''${TOOLCHAIN}'''</span>/environment-setup-cortexa9t2hf-neon-poky-linux-gnueabi</code> |
== <span style="color:#0070c0">Build U-Boot in standalone environment</span> == | == <span style="color:#0070c0">Build U-Boot in standalone environment</span> == | ||
Line 372: | Line 304: | ||
eg. | eg. | ||
− | make | + | make mx6qrom7420a1_1G_defconfig |
==== <span style="color:#0070c0">Build u-boot</span> ==== | ==== <span style="color:#0070c0">Build u-boot</span> ==== | ||
Line 378: | Line 310: | ||
make -j4 | make -j4 | ||
− | == | + | == == |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== <span style="color:#0070c0">Building & updating kernel/modules/dtb manually</span> == | == <span style="color:#0070c0">Building & updating kernel/modules/dtb manually</span> == |
Revision as of 11:36, 25 October 2023
Contents
- 1 Getting Started
- 2 Customization
- 3 Reflash EMMC from Boot SD CARD
Getting Started
Conventions
${PREBUILT_IMAGE} : compressed prebuilt image (*.img.gz)
${CONTAINER_NAME} : container name (e.g. imx6LBVC0002)
${BSP_TARBALL} : BSP tarball (*.tgz)
${BSP_HOME} : home directory of the BSP
${BDIR} : build directory (e.g. build_x11)
${MX6PROC} : i.MX6 Processor
- mx6q for iMX6 Dual Quad Core
${IMX6PROC} : i.MX6 Processor
- imx6q
${BOARD} : available target boards list below
- rom7420
- rsb4411
${BOARD_REV} : board revision
- a1
${MC} : machine code combined with ${IMX6PROC}${BOARD}${BOARD_REV}
- for example,
-
- imx6qrom7420a1 for ROM-7420 A1
- imx6qrsb4411a1 for RSB-4411 A1
- You can also use the command below to check supported machines on BSP
$ source setup-environment
${MEM_SIZE} : memory size
- 1G/2G
${UC} : u-boot config
- 1G/2G/4G/FSPI_1G/FSPI_2G...
${SD_DEVICE} : device name of SD card in Linux (e.g. /dev/sdf)
${SDCARD_IMAGE} : sdcard image built by bitbake (*.wic.zst)
${WORKSPACE} : host workspace folders
${UBOOT} :u-boot version(e.g. v2022.04_5.15.52_2.1.0)
${KERNEL} : linux kernel version(e.g. 5.15.52_2.1.0)
${TOOLCHAIN} : toolchain installed directory(e.g. opt/fsl-imx-wayland/5-15-kirkstone/environment)
debug console / serial console
- serial terminal program (e.g. minicom, putty, teraterm ...) that serial port is configured to 115200 8N1
terminal console
- terminal program (e.g. gnome-terminal, xfce4-terminal ...)
Docker install and setting
If you don't have docker in your system, then you can follow the below steps to install docker and run it first.
To install Docker Engine on your platform
- Please refer to Docker Installation Guide for details
To pull ubuntu 20.04 image from Docker Hub
$ docker pull advrisc/u20.04-imx8lbv1
To create container
$ docker run --privileged -it --name ${CONTAINER_NAME} -v ${WORKSPACE}:/home/adv/adv-release-bsp -v /dev:/dev advrisc/u20.04-imx8lbv1 /bin/bash
Get BSP
- You have two methods to put BSP into container created above
Download_BSP_From_GitHub
- The following example shows how to download the Advantech Yocto BSP from GitHub.
- For this example, a directory called adv-release-bsp is created for the project.
- Refer to IoTGateway/BSP/Linux/iMX6/OS_Support_List , Official version "imx6LBVC0XXX" is taken as an example :
$ git config --global user.name "Your Name" $ git config --global user.email you@example.com $ sudo chown adv:adv adv-release-bsp $ cd adv-release-bsp $ repo init -u git://github.com/ADVANTECH-Corp/adv-arm-yocto-bsp.git -b imx-linux-kirkstone -m adv-5.15.52-2.1.0.xml $ repo sync
- After repo sync and finished. Please modify the "meta-freescale/recipes-bsp/u-boot/u-boot-imx-common_2022.04.inc"
- Please Reference the commit https://github.com/Freescale/meta-freescale/commit/f851708484206263aecee032288d27c948745ce8
- If you suffer "server certificate verification failed", you can use the following command to disable SSL verification in git repositories with self-signed certificates.
$ export GIT_SSL_NO_VERIFY=1
or
$ git config --global http.sslverify false
- If you get "The unauthenticated git protocol on port 9418 is no longer supported.", you can try it.
$ git config --global url."https://".insteadOf git://
- During building Yocto image , it will generate downloads folder which includes all packages we need , but it usually can't fetch normally, so we keep this downloads folder. Then we can reduce some fetch failed issue.
- You can get Downloads tarball (downloads_imx6_5.15.52_2.1.0.tar.gz) from following URL:
- If you get downloads tarball, you can copy to your ${WORKSPACE}
Follow the steps below:
1.Exit container and back to local machine
$ exit
2.Copy Downloads tarball to ${WORKSPACE} , and change owner
$ cp downloads_imx6_5.15.52_2.1.0.tar.gz ${WORKSPACE} $ sudo chown adv:adv ${WORKSPACE}/downloads_imx6_5.15.52_2.1.0.tar.gz
3.Back to container
$ docker start ${CONTAINER_NAME} $ docker attach ${CONTAINER_NAME}
4.Unpack Downloads tarball
$ tar zxvf downloads_imx6_5.15.52_2.1.0.tar.gz
5.make link to downloads folder
$ cd adv-release-bsp $ ln -s ${WORKSPACE}/downloads_imx6_5.15.52_2.1.0 downloads
Introducing BSP
- The BSP is based on Yocto Project with Freescale enhanced features for i.MX8, plus specific target board features from Advantech Inc..
- The Advantech Yocto Project BSP Release directory contains a "sources" directory, which contains the recipes used to build,
one or more build directories, and a set of scripts used to set up the environment.
- The recipes used to build the project come from both the community and Advantech. The Yocto Project layers are downloaded
to the sources directory. This sets up the recipes that are used to build the project.
BSP Content
Build Instructions
To create one new build environment
- Perform the following commands in terminal console
$ cd ${BSP_HOME}
$ MACHINE=${MC}
DISTRO=fsl-imx-xwayland
source imx-setup-release.sh -b ${BDIR}
- We can specify u-boot default config like below
$ MACHINE=${MC}
UBOOT_CONFIG=${UC}
DISTRO=fsl-imx-xwayland
source imx-setup-release.sh -b ${BDIR}
- You need to read and accept the EULA.
To continue an exist build environment
- Perform the following commands in terminal console
$ cd ${BSP_HOME}
$ source setup-environment ${BDIR}
To build sdcard image
- To create/continue a build environment
- Perform the following command in terminal console
$ bitbake imx-image-full
- The file, imx-image-full-${MC}.wic.zst, will be located in directory, ./tmp/deploy/images/${MC}, while building process finished successfully.
To build toolchain installer
- To create/continue a build environment
- Perform the following command in terminal console
$ bitbake meta-toolchain
- The below installer will be located in the directory "./tmp/deploy/sdk".
- fsl-imx-xwayland-glibc-x86_64-imx-image-full-cortexa9t2hf-neon-imx6qsabresd-toolchain-5.15-kirkstone
To build bootloader
- To create/continue a build environment
- Perform the following command in terminal console
$ bitbake imx-boot
To build linux kernel
- To create/continue a build environment
- If you operate on docker images, please install tmux application before running this command
-
$ sudo apt-get install tmux
-
- Type following command to enter tmux
-
$ tmux
-
- Perform the following command in terminal console to show up menuconfig
-
$ bitbake linux-imx -c menuconfig
-
- After edit menuconfig, type following command to exit tmux windows
-
$ exit
-
- to build kernel image
-
$ bitbake linux-imx
-
- The two files, Image & Image-${IMX6PROC}-${BOARD}-${BOARD_REV}.dtb, will be located in the directory, ./tmp/deploy/images/${MC}.
Creating boot-up on-board flash from prebuilt image
To create one boot-up SD card
- Perform the following command in terminal console
# gunzip -c ${PREBUILT_IMAGE} | dd of=${SD_DEVICE} bs=1M
# sync
Creating boot-up on-board flash from built sdcard image
To create one boot-up SD card
- Perform the following commands in terminal console
$ pushd ${BSP_HOME}/${BDIR}/tmp/deploy/images/${MC}
$ sudo bzcat ${SDCARD_IMAGE} | sudo dd of=${SD_DEVICE} bs=1M
$ sync
$ popd
Debug console information
If you want to see debug message from device, you need to prepare for hardware device and software tool.
Preparing for hardware device
- The following URL provides information about the debug port slot and the debug port line for each device
Preparing for software tool
- You need to prepare the debug console tool. For example: "minicom" tool or "putty" tool.
- Baud rate: 115200
Customization
Setting up SDK
- Please follow the section,To build toolchain installer, to build one toolchain installer
- Perform the following command in terminal console
$ cd ${BSP_HOME}/${BDIR}/tmp/deploy/sdk
$ sudo ./
fsl-imx-xwayland-glibc-x86_64-imx-image-full-cortexa9t2hf-neon-imx6qsabresd-toolchain-5.15-kirkstone
- Enter new installed directory or just press
Enter
to use default directory. - While
Proceed[y/n]?
shows up, please enter the correct one. - Waiting for the SDK installed (while the following messages show up completely)
- Download SDK Link (Just Only reference), [downloads_SDK]
Setting up cross compiling environment
- SDK has been set up (ref.Setting up SDK)
- Perform the following command in terminal console
$ source ${TOOLCHAIN}/environment-setup-cortexa9t2hf-neon-poky-linux-gnueabi
Build U-Boot in standalone environment
Config u-boot
make ${IMX8PROC}_${BOARD}${BOARD_REV}_${MEM_SIZE}_defconfig
eg.
make mx6qrom7420a1_1G_defconfig
Build u-boot
make -j4
Building & updating kernel/modules/dtb manually
- The cross compiling environment has been set up. (ref. Setting up cross compiling environment)
Copy BSP tarball to Container
Refer to Copy_BSP_tarball_to_Container , copy kernel tarball to ${WORKSPACE} and back to container
Download kernel source from Github
$ git clone https://github.com/ADVANTECH-Corp/linux-imx.git -b adv_5.15.52_2.1.0
Config kernel
- Configure linux kernel
$ cd linux-imx $ make distclean $ make imx_v7_adv_defconfig $ make menuconfig
- Start building linux kernel
$ make -j4 Image
- When you get error like below
- run command then rebuild
$ unset LDFLAGS
- The kernel image file, Image, is located in the directory "./arch/arm64/boot/".
- Start building kernel modules
$ make -j4 modules
- Copy all modules to a temporary rootfs directory, "~/temp/rootfs"
$ make modules_install INSTALL_MOD_PATH=~/temp/rootfs
- Building device tree blob
$ make -j4 ${IMX6PROC}-${BOARD}-${BOARD_REV}.dtb eg. $ make -j4 imx6q-rom7420-a1.dtb
- The device tree blob, ${IMX6PROC}-${BOARD}-${BOARD_REV}.dtb, is located in the directory "./arch/arm/boot/dts/".
Replace kernel & dts
- Replace kernel
- copy Image to SDcard or emmc
- Replace dtb file
- copy dtb file to SDcard or emmc
Reflash EMMC from Boot SD CARD
Download mksd-linux.sh in https://github.com/ADVANTECH-Corp/RISC_tools_scripts/blob/kirkstone/imx8/mksd-linux.sh
Download "Product_AIM_Release_version"_flash_tool.tgz
Unzip the "Product_AIM_Release_version"_flash_tool.tgz
Copy the mksd-linux.sh to mk_inand folder.
Run mksd-linux.sh