diff options
Diffstat (limited to 'yocto/README')
-rw-r--r-- | yocto/README | 179 |
1 files changed, 179 insertions, 0 deletions
diff --git a/yocto/README b/yocto/README new file mode 100644 index 0000000..ef99121 --- /dev/null +++ b/yocto/README @@ -0,0 +1,179 @@ +- release matrix page: +https://developer.toradex.com/software/toradex-embedded-software/embedded-linux-release-matrix/ + +- resources: +https://docs.u-boot.org/en/stable/board/toradex/verdin-imx8mp.html +https://developer.toradex.com/linux-bsp/os-development/build-yocto/build-a-reference-image-with-yocto-projectopenembedded/ +https://developer.toradex.com/linux-bsp/os-development/build-u-boot-and-linux-kernel-from-source-code/build-u-boot/ +https://developer.toradex.com/linux-bsp/os-development/build-u-boot-and-linux-kernel-from-source-code/build-linux-kernel-from-source-code/ +https://developer.toradex.com/linux-bsp/os-development/build-u-boot-and-linux-kernel-from-source-code/build-device-tree-overlays-from-source-code/ + +- install dependencies: +# dependencies for yocto: +apt-get install gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 python3-subunit zstd liblz4-tool file locales libacl1 +apt-get install curl git + +# dependencies for u-boot: +apt-get install bc build-essential git libncurses5-dev lzop perl libssl-dev bison flex swig libyaml-dev pkg-config python3-dev +apt-get install u-boot-tools + +# dependencies for kernel: + apt-get install bc build-essential git libncurses5-dev lzop perl libssl-dev bison flex +apt-get install u-boot-tools + +locale-gen en_US.UTF-8 +# configure git +git config --global user.name "John Doe" +git config --global user.email johndoe@example.com + +- make build directory: +mkdir /build +cd build + + +prepare build environment +------------------------- + +mkdir /build/tools +cd /build/tools + +- install repo bootstrap binary: +mkdir bin +curl https://commondatastorage.googleapis.com/git-repo-downloads/repo > bin/repo +chmod 755 bin/repo + +- install the ARM GCC toolchain: +mkdir arm +cd arm +wget https://developer.arm.com/-/media/Files/downloads/gnu/14.2.rel1/binrel/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu.tar.xz +tar xvf arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu.tar.xz +ln -s arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-linux-gnu gcc-linaro-aarch64 +cd .. + +- install device tree compiler tool: +git clone https://git.kernel.org/pub/scm/utils/dtc/dtc.git -b v1.7.2 +cd dtc +make +cp dtc ../bin/ +cd .. + +- export variables: +cd .. +vi start.sh +... +export ARCH=arm64 +export DTC_FLAGS="-@" +export PATH=/build/tools/gcc-linaro-aarch64/bin:/build/tools/bin:$PATH +export CROSS_COMPILE=aarch64-none-linux-gnu- +... +chmod 755 start.sh +. ./start.sh + + +yocto image +----------- + +- clone meta-information +mkdir oe-core +cd oe-core +# branch: repo init -u git://git.toradex.com/toradex-manifest.git -b scarthgap-7.x.y -m tdxref/default.xml +# specific tag: +repo init -u git://git.toradex.com/toradex-manifest.git -b refs/tags/7.1.0 -m tdxref/default.xml +repo sync +# repeat sync until successful + +- setup environment: +. export + +- edit config: +vi conf/local.conf +... +# set MACHINE: +MACHINE ?= "verdin-imx8mp" +# append: +ACCEPT_FSL_EULA = "1" +TOOLCHAIN_TARGET_TASK:append = " kernel-devsrc" +... + +- build: +bitbake -k tdx-reference-minimal-image -c populate_sdk + +- machine.conf in: layers/meta-toradex-nxp/conf/machine/verdin-imx8mp.conf +- distro.conf in: layers/meta-toradex-distro/conf/distro/*.conf +- demo images in: layers/meta-toradex-demos/recipes-images/images/*.bb + +u-boot +------ + +cd /build +git clone https://source.denx.de/u-boot/u-boot.git +cd u-boot +# adjust tag according to version used in yocto (from release matrix page) +git checkout tags/v2024.07 +git checkout -b toradex-v2024.07 +mkdir patches +cd patches +cp ../../oe-core/layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex/* . +# adjust recipe according to version used in yocto (from release matrix page) +PATCH_RECIPE=../../oe-core/layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex_2024.07.bb +# apply patches in order +git am `grep -n TDX_PATCHES $PATCH_RECIPE | echo $((\`cut -f1 -d:\` + 1)) | xargs -I line_no tail $PATCH_RECIPE --lines=+line_no | grep -v ^\" | cut -d / -f 3 | sed -e "s/ \\\\\\\\//g"` +cd .. +# build ATF (TF-A) +git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git +cd trusted-firmware-a +make PLAT=imx8mp IMX_BOOT_UART_BASE=0x30880000 bl31 +cp build/imx8mp/release/bl31.bin .. +cd .. +# get DDR firmware +wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.10.1.bin +chmod +x firmware-imx-8.10.1.bin +./firmware-imx-8.10.1.bin +cp firmware-imx-8.10.1/firmware/ddr/synopsys/lpddr4*_202006.bin . +# finally, build u-boot +make mrproper +make verdin-imx8mp_defconfig +# dts in: dts/upstream/src/arm64/freescale/imx8mp-verdin-wifi-*.dts +# arch/arm/dts/imx8mp-verdin-wifi-dev-u-boot.dtsi +# make menuconfig (choose dts to build) +make -j$(nproc) 2>&1 | tee build.log + + +kernel +------ + +cd /build +# adjust branch and commit according to version used in yocto: +# vi oe-core/layers/meta-toradex-nxp/recipes-kernel/linux/linux-toradex_*.bb (search for SRCBRANCH, SRCREV_machine) +git clone -b toradex_6.6-2.1.x-imx git://git.toradex.com/linux-toradex.git +cd linux-toradex +git checkout 3493ccd66900420e2462daf4db187b315b50469e +cp ../oe-core/build/deploy/images/verdin-imx8mp/kernel-config .config +# verify config +make olddefconfig +# copy yocto/kernel_lvds_freq.patch from mikroPhone repo +# apply LVDS patch +patch < ../kernel_lvds_freq.patch +# build kernel and dtb +make -j$(nproc) Image.gz 2>&1 | tee build.log +make freescale/imx8mp-verdin-wifi-dev.dtb +# ls ./arch/arm64/boot/Image.gz +# ls ./arch/arm64/boot/dts/freescale/imx8mp-verdin-wifi-dev.dtb +# build kernel modules +make -j$(nproc) modules 2>&1 | tee build.log +mkdir modules +INSTALL_MOD_PATH=`pwd`/modules make modules_install +cd modules +tar -czf ../modules.tar.gz . +cd .. + + +overlay +------- + +# toradex overlays (match branch to kernel branch) +# git clone -b toradex_6.6-2.1.x-imx git://git.toradex.com/device-tree-overlays.git +# copy yocto/overlays from mikroPhone repo +cd overlays +STAGING_KERNEL_DIR=../linux-toradex make mikroPhone-panel_overlay.dtbo +cd .. |