blob: ef99121c5eabec05d8053c62714ba7aa394c4696 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
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 ..
|