Commit e0f0466e22d70a3467b1747d2ba6e5b46fc78073
1 parent
24429fdecb
Exists in
8mm_5.4.24_2.1.0_zeus
Yocto Zeus meta layer support for SMARC-iMX8MM, Initial Release
Showing 17 changed files with 1083 additions and 41 deletions Inline Diff
- 11.patch
- conf/machine/include/smarc-common.inc
- conf/machine/smarcimx8mm2g.conf
- conf/machine/smarcimx8mm4g.conf
- recipes-bsp/imx-atf/imx-atf/imx8mm-atf-uart4.patch
- recipes-bsp/imx-atf/imx-atf_2.2.bbappend
- recipes-bsp/imx-mkimage/imx-boot_1.0.bbappend
- recipes-bsp/u-boot/u-boot-smarcimx8mm_2020.04.bb
- recipes-core/systemd/systemd-serialgetty.bbappend
- recipes-core/systemd/systemd-serialgetty/disable-serialgetty.service
- recipes-core/systemd/systemd-serialgetty/disable-serialgetty.sh
- recipes-kernel/linux/linux-smarcimx8mm_5.4.bb
- scripts/emb_mk_yocto_sdcard/README.txt
- scripts/emb_mk_yocto_sdcard/emb-create-yocto-emmc.sh
- scripts/emb_mk_yocto_sdcard/emb-create-yocto-sdcard.sh
- scripts/emb_mk_yocto_sdcard/uEnv.txt
- scripts/emb_mk_yocto_sdcard/uEnv_emmc.txt
11.patch
File was created | 1 | diff --git a/conf/machine/include/smarc-common.inc b/conf/machine/include/smarc-common.inc | |
2 | index b5c7db6..6606669 100644 | ||
3 | --- a/conf/machine/include/smarc-common.inc | ||
4 | +++ b/conf/machine/include/smarc-common.inc | ||
5 | @@ -73,3 +73,8 @@ MACHINE_FEATURES_remove_smarcimx8mq2g = "qca6174" | ||
6 | MACHINE_FEATURES_append_smarcimx8mq2g = " mrvl8997 jailhouse" | ||
7 | MACHINE_FEATURES_remove_smarcimx8mq4g = "qca6174" | ||
8 | MACHINE_FEATURES_append_smarcimx8mq4g = " mrvl8997 jailhouse" | ||
9 | + | ||
10 | +MACHINE_FEATURES_remove_smarcimx8mm2g = "qca6174" | ||
11 | +MACHINE_FEATURES_append_smarcimx8mm2g = " mrvl8997 jailhouse" | ||
12 | +MACHINE_FEATURES_remove_smarcimx8mm4g = "qca6174" | ||
13 | +MACHINE_FEATURES_append_smarcimx8mm4g = " mrvl8997 jailhouse" | ||
14 | diff --git a/conf/machine/smarcimx8mm2g.conf b/conf/machine/smarcimx8mm2g.conf | ||
15 | new file mode 100644 | ||
16 | index 0000000..bca4d4b | ||
17 | --- /dev/null | ||
18 | +++ b/conf/machine/smarcimx8mm2g.conf | ||
19 | @@ -0,0 +1,92 @@ | ||
20 | +#@TYPE: Machine | ||
21 | +#@NAME: EMBEDIAN SMARC-iMX8MM COMPUTER ON MODULES with 4GB LPDDR4 MEMORY | ||
22 | +#@SOC: i.MX8MQ | ||
23 | +#@DESCRIPTION: Machine configuration for Embedian SMARC-iMX8M | ||
24 | +#@MAINTAINER: Eric Lee <eric.lee@embedian.com> | ||
25 | +# | ||
26 | +# http://www.www.embedian.com | ||
27 | + | ||
28 | +MACHINEOVERRIDES =. "mx8:mx8m:mx8mm:" | ||
29 | + | ||
30 | +require conf/machine/include/imx-base.inc | ||
31 | +require conf/machine/include/tune-cortexa53.inc | ||
32 | +require conf/machine/include/smarc-common.inc | ||
33 | + | ||
34 | +MACHINE_FEATURES += " usbgadget vfat ext2 alsa serial pci wifi bluetooth" | ||
35 | + | ||
36 | +# Embedian BSP default providers | ||
37 | +PREFERRED_PROVIDER_virtual/kernel_smarcimx8mm2g ?= "linux-smarcimx8mm" | ||
38 | +PREFERRED_VERSION_linux-smarcimx8mm2g_smarcimx8mm2g = "5.4" | ||
39 | + | ||
40 | +KERNEL_DEVICETREE = " \ | ||
41 | + embedian/imx8mm-smarc.dtb \ | ||
42 | + embedian/imx8mm-smarc-m4.dtb \ | ||
43 | +" | ||
44 | +MACHINE_EXTRA_RRECOMMENDS_append_mx8mm = " imx-m4-demos" | ||
45 | +IMAGE_BOOTFILES_DEPENDS += "imx-m4-demos:do_deploy" | ||
46 | +IMAGE_BOOT_FILES += "imx8mm_m4_TCM_hello_world.bin imx8mm_m4_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin imx8mm_m4_TCM_rpmsg_lite_str_echo_rtos.bin" | ||
47 | + | ||
48 | +PREFERRED_PROVIDER_u-boot_smarcimx8mm2g = "u-boot-smarcimx8mm" | ||
49 | +PREFERRED_PROVIDER_virtual/bootloader_smarcimx8mm2g = "u-boot-smarcimx8mm" | ||
50 | + | ||
51 | +UBOOT_CONFIG ??= "sd" | ||
52 | +UBOOT_CONFIG[sd] = "smarcimx8mm_2g_ser3_defconfig,sdcard" | ||
53 | +SPL_BINARY = "spl/u-boot-spl.bin" | ||
54 | + | ||
55 | +# Set DDR FIRMWARE | ||
56 | +DDR_FIRMWARE_NAME = "lpddr4_pmu_train_1d_imem.bin lpddr4_pmu_train_1d_dmem.bin lpddr4_pmu_train_2d_imem.bin lpddr4_pmu_train_2d_dmem.bin" | ||
57 | + | ||
58 | +# Set U-Boot DTB | ||
59 | +UBOOT_DTB_NAME = "imx8mm-smarc.dtb" | ||
60 | + | ||
61 | +# Set imx-mkimage boot target | ||
62 | +IMXBOOT_TARGETS = "flash_evk" | ||
63 | + | ||
64 | +SERIAL_CONSOLE = "115200 ttymxc1" | ||
65 | + | ||
66 | +IMAGE_BOOTLOADER = "imx-boot" | ||
67 | + | ||
68 | +LOADADDR = "" | ||
69 | +UBOOT_MAKE_TARGET = "" | ||
70 | +IMX_BOOT_SEEK = "33" | ||
71 | + | ||
72 | +MACHINE_EXTRA_RDEPENDS += " \ | ||
73 | + imx-boot \ | ||
74 | + packagegroup-tools-bluetooth \ | ||
75 | + pm-utils \ | ||
76 | + kmod \ | ||
77 | + hdparm \ | ||
78 | + gptfdisk \ | ||
79 | + lftp \ | ||
80 | + vim \ | ||
81 | + ntp \ | ||
82 | + boost \ | ||
83 | + nodejs \ | ||
84 | + networkmanager \ | ||
85 | + imx-gpu-viv \ | ||
86 | + " | ||
87 | + | ||
88 | +# Packages added to all images (including core-image-minimal) | ||
89 | + | ||
90 | +# eIQ Machine Learning. Note that many of the features require Qt 5. Disable | ||
91 | +# this when you build image without QT 5. | ||
92 | +IMAGE_INSTALL_append = " \ | ||
93 | + packagegroup-imx-ml \ | ||
94 | + firmware-imx-sdma \ | ||
95 | + firmware-imx-regulatory \ | ||
96 | + fsl-rc-local \ | ||
97 | + android-tools \ | ||
98 | + " | ||
99 | +#IMAGE_INSTALL_append = " \ | ||
100 | +# firmware-imx-sdma \ | ||
101 | +# firmware-imx-regulatory \ | ||
102 | +# fsl-rc-local \ | ||
103 | +# android-tools \ | ||
104 | +# " | ||
105 | + | ||
106 | +IMAGE_FSTYPES = "tar.bz2" | ||
107 | + | ||
108 | +# Ship all kernel modules by default | ||
109 | +MACHINE_EXTRA_RRECOMMENDS = "kernel-modules" | ||
110 | + | ||
111 | +MACHINE_FIRMWARE_append_mx8 = " linux-firmware-ath10k" | ||
112 | diff --git a/conf/machine/smarcimx8mm4g.conf b/conf/machine/smarcimx8mm4g.conf | ||
113 | new file mode 100644 | ||
114 | index 0000000..4640f62 | ||
115 | --- /dev/null | ||
116 | +++ b/conf/machine/smarcimx8mm4g.conf | ||
117 | @@ -0,0 +1,92 @@ | ||
118 | +#@TYPE: Machine | ||
119 | +#@NAME: EMBEDIAN SMARC-iMX8MM COMPUTER ON MODULES with 4GB LPDDR4 MEMORY | ||
120 | +#@SOC: i.MX8MQ | ||
121 | +#@DESCRIPTION: Machine configuration for Embedian SMARC-iMX8M | ||
122 | +#@MAINTAINER: Eric Lee <eric.lee@embedian.com> | ||
123 | +# | ||
124 | +# http://www.www.embedian.com | ||
125 | + | ||
126 | +MACHINEOVERRIDES =. "mx8:mx8m:mx8mm:" | ||
127 | + | ||
128 | +require conf/machine/include/imx-base.inc | ||
129 | +require conf/machine/include/tune-cortexa53.inc | ||
130 | +require conf/machine/include/smarc-common.inc | ||
131 | + | ||
132 | +MACHINE_FEATURES += " usbgadget vfat ext2 alsa serial pci wifi bluetooth" | ||
133 | + | ||
134 | +# Embedian BSP default providers | ||
135 | +PREFERRED_PROVIDER_virtual/kernel_smarcimx8mm4g ?= "linux-smarcimx8mm" | ||
136 | +PREFERRED_VERSION_linux-smarcimx8mm4g_smarcimx8mm4g = "5.4" | ||
137 | + | ||
138 | +KERNEL_DEVICETREE = " \ | ||
139 | + embedian/imx8mm-smarc.dtb \ | ||
140 | + embedian/imx8mm-smarc-m4.dtb \ | ||
141 | +" | ||
142 | +MACHINE_EXTRA_RRECOMMENDS_append_mx8mm = " imx-m4-demos" | ||
143 | +IMAGE_BOOTFILES_DEPENDS += "imx-m4-demos:do_deploy" | ||
144 | +IMAGE_BOOT_FILES += "imx8mm_m4_TCM_hello_world.bin imx8mm_m4_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin imx8mm_m4_TCM_rpmsg_lite_str_echo_rtos.bin" | ||
145 | + | ||
146 | +PREFERRED_PROVIDER_u-boot_smarcimx8mm4g = "u-boot-smarcimx8mm" | ||
147 | +PREFERRED_PROVIDER_virtual/bootloader_smarcimx8mm4g = "u-boot-smarcimx8mm" | ||
148 | + | ||
149 | +UBOOT_CONFIG ??= "sd" | ||
150 | +UBOOT_CONFIG[sd] = "smarcimx8mm_4g_ser3_defconfig,sdcard" | ||
151 | +SPL_BINARY = "spl/u-boot-spl.bin" | ||
152 | + | ||
153 | +# Set DDR FIRMWARE | ||
154 | +DDR_FIRMWARE_NAME = "lpddr4_pmu_train_1d_imem.bin lpddr4_pmu_train_1d_dmem.bin lpddr4_pmu_train_2d_imem.bin lpddr4_pmu_train_2d_dmem.bin" | ||
155 | + | ||
156 | +# Set U-Boot DTB | ||
157 | +UBOOT_DTB_NAME = "imx8mm-smarc.dtb" | ||
158 | + | ||
159 | +# Set imx-mkimage boot target | ||
160 | +IMXBOOT_TARGETS = "flash_evk" | ||
161 | + | ||
162 | +SERIAL_CONSOLE = "115200 ttymxc1" | ||
163 | + | ||
164 | +IMAGE_BOOTLOADER = "imx-boot" | ||
165 | + | ||
166 | +LOADADDR = "" | ||
167 | +UBOOT_MAKE_TARGET = "" | ||
168 | +IMX_BOOT_SEEK = "33" | ||
169 | + | ||
170 | +MACHINE_EXTRA_RDEPENDS += " \ | ||
171 | + imx-boot \ | ||
172 | + packagegroup-tools-bluetooth \ | ||
173 | + pm-utils \ | ||
174 | + kmod \ | ||
175 | + hdparm \ | ||
176 | + gptfdisk \ | ||
177 | + lftp \ | ||
178 | + vim \ | ||
179 | + ntp \ | ||
180 | + boost \ | ||
181 | + nodejs \ | ||
182 | + networkmanager \ | ||
183 | + imx-gpu-viv \ | ||
184 | + " | ||
185 | + | ||
186 | +# Packages added to all images (including core-image-minimal) | ||
187 | + | ||
188 | +# eIQ Machine Learning. Note that many of the features require Qt 5. Disable | ||
189 | +# this when you build image without QT 5. | ||
190 | +IMAGE_INSTALL_append = " \ | ||
191 | + packagegroup-imx-ml \ | ||
192 | + firmware-imx-sdma \ | ||
193 | + firmware-imx-regulatory \ | ||
194 | + fsl-rc-local \ | ||
195 | + android-tools \ | ||
196 | + " | ||
197 | +#IMAGE_INSTALL_append = " \ | ||
198 | +# firmware-imx-sdma \ | ||
199 | +# firmware-imx-regulatory \ | ||
200 | +# fsl-rc-local \ | ||
201 | +# android-tools \ | ||
202 | +# " | ||
203 | + | ||
204 | +IMAGE_FSTYPES = "tar.bz2" | ||
205 | + | ||
206 | +# Ship all kernel modules by default | ||
207 | +MACHINE_EXTRA_RRECOMMENDS = "kernel-modules" | ||
208 | + | ||
209 | +MACHINE_FIRMWARE_append_mx8 = " linux-firmware-ath10k" | ||
210 | diff --git a/recipes-bsp/imx-atf/imx-atf/imx8mm-atf-uart4.patch b/recipes-bsp/imx-atf/imx-atf/imx8mm-atf-uart4.patch | ||
211 | new file mode 100644 | ||
212 | index 0000000..5a0a416 | ||
213 | --- /dev/null | ||
214 | +++ b/recipes-bsp/imx-atf/imx-atf/imx8mm-atf-uart4.patch | ||
215 | @@ -0,0 +1,14 @@ | ||
216 | +diff --git a/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c b/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c | ||
217 | +index 049192880..57c404675 100644 | ||
218 | +--- a/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c | ||
219 | ++++ b/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c | ||
220 | +@@ -58,7 +58,8 @@ static const struct imx_rdc_cfg rdc[] = { | ||
221 | + RDC_MDAn(RDC_MDA_M4, DID1), | ||
222 | + | ||
223 | + /* peripherals domain permission */ | ||
224 | +- RDC_PDAPn(RDC_PDAP_UART4, D1R | D1W), | ||
225 | ++ /*RDC_PDAPn(RDC_PDAP_UART4, D1R | D1W),*/ | ||
226 | ++ RDC_PDAPn(RDC_PDAP_UART4, D0R | D0W), | ||
227 | + RDC_PDAPn(RDC_PDAP_UART2, D0R | D0W), | ||
228 | + | ||
229 | + /* memory region */ | ||
230 | diff --git a/recipes-bsp/imx-atf/imx-atf_2.2.bbappend b/recipes-bsp/imx-atf/imx-atf_2.2.bbappend | ||
231 | index 7e0f6f9..b8758c5 100644 | ||
232 | --- a/recipes-bsp/imx-atf/imx-atf_2.2.bbappend | ||
233 | +++ b/recipes-bsp/imx-atf/imx-atf_2.2.bbappend | ||
234 | @@ -2,4 +2,5 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | ||
235 | |||
236 | SRC_URI_append = " \ | ||
237 | file://imx8m-atf-ddr-timing.patch \ | ||
238 | + file://imx8mm-atf-uart4.patch \ | ||
239 | " | ||
240 | diff --git a/recipes-bsp/u-boot/u-boot-smarcimx8mm_2020.04.bb b/recipes-bsp/u-boot/u-boot-smarcimx8mm_2020.04.bb | ||
241 | new file mode 100644 | ||
242 | index 0000000..b9b853b | ||
243 | --- /dev/null | ||
244 | +++ b/recipes-bsp/u-boot/u-boot-smarcimx8mm_2020.04.bb | ||
245 | @@ -0,0 +1,57 @@ | ||
246 | +# Copyright (C) 2013-2016 Freescale Semiconductor | ||
247 | +# Copyright 2017-2019 NXP | ||
248 | + | ||
249 | +DESCRIPTION = "i.MX U-Boot suppporting i.MX reference boards." | ||
250 | +require recipes-bsp/u-boot/u-boot-common.inc | ||
251 | +require recipes-bsp/u-boot/u-boot.inc | ||
252 | +inherit pythonnative | ||
253 | + | ||
254 | +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" | ||
255 | + | ||
256 | +PROVIDES += "u-boot" | ||
257 | +DEPENDS_append = " dtc-native" | ||
258 | + | ||
259 | +LICENSE = "GPLv2+" | ||
260 | +LIC_FILES_CHKSUM = "file://Licenses/gpl-2.0.txt;md5=b234ee4d69f5fce4486a80fdaf4a4263" | ||
261 | + | ||
262 | +UBOOT_SRC ?= "${EMB_UBOOT_MIRROR};protocol=ssh" | ||
263 | +SRCBRANCH = "smarc_8mm-imx_v2020.04_5.4.24_2.1.0" | ||
264 | +SRC_URI = "${UBOOT_SRC};branch=${SRCBRANCH}" | ||
265 | +SRCREV = "2d41934ee1ca738d6a2083dc43304fa55ff5e547" | ||
266 | + | ||
267 | +S = "${WORKDIR}/git" | ||
268 | + | ||
269 | +inherit fsl-u-boot-localversion | ||
270 | + | ||
271 | +LOCALVERSION ?= "-${SRCBRANCH}" | ||
272 | + | ||
273 | +BOOT_TOOLS = "imx-boot-tools" | ||
274 | + | ||
275 | +do_deploy_append_mx8m () { | ||
276 | + # Deploy the mkimage, u-boot-nodtb.bin and fsl-imx8mq-XX.dtb for mkimage to generate boot binary | ||
277 | + if [ -n "${UBOOT_CONFIG}" ] | ||
278 | + then | ||
279 | + for config in ${UBOOT_MACHINE}; do | ||
280 | + i=$(expr $i + 1); | ||
281 | + for type in ${UBOOT_CONFIG}; do | ||
282 | + j=$(expr $j + 1); | ||
283 | + if [ $j -eq $i ] | ||
284 | + then | ||
285 | + install -d ${DEPLOYDIR}/${BOOT_TOOLS} | ||
286 | + install -m 0777 ${B}/${config}/arch/arm/dts/${UBOOT_DTB_NAME} ${DEPLOYDIR}/${BOOT_TOOLS} | ||
287 | + install -m 0777 ${B}/${config}/u-boot-nodtb.bin ${DEPLOYDIR}/${BOOT_TOOLS}/u-boot-nodtb.bin-${MACHINE}-${UBOOT_CONFIG} | ||
288 | + fi | ||
289 | + done | ||
290 | + unset j | ||
291 | + done | ||
292 | + unset i | ||
293 | + fi | ||
294 | + | ||
295 | +} | ||
296 | + | ||
297 | +PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
298 | +COMPATIBLE_MACHINE = "(mx6|mx7|mx8)" | ||
299 | + | ||
300 | +UBOOT_NAME_mx6 = "u-boot-${MACHINE}.bin-${UBOOT_CONFIG}" | ||
301 | +UBOOT_NAME_mx7 = "u-boot-${MACHINE}.bin-${UBOOT_CONFIG}" | ||
302 | +UBOOT_NAME_mx8 = "u-boot-${MACHINE}.bin-${UBOOT_CONFIG}" | ||
303 | diff --git a/recipes-core/systemd/systemd-serialgetty.bbappend b/recipes-core/systemd/systemd-serialgetty.bbappend | ||
304 | new file mode 100644 | ||
305 | index 0000000..fdb94d8 | ||
306 | --- /dev/null | ||
307 | +++ b/recipes-core/systemd/systemd-serialgetty.bbappend | ||
308 | @@ -0,0 +1,39 @@ | ||
309 | +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | ||
310 | + | ||
311 | +SRC_URI_append_smarcimx8mm2g = " \ | ||
312 | + file://disable-serialgetty.sh \ | ||
313 | + file://disable-serialgetty.service \ | ||
314 | +" | ||
315 | +FILES_${PN}_append_smarcimx8mm2g = " \ | ||
316 | + /lib/systemd/system/* \ | ||
317 | + /etc/systemd/system/* \ | ||
318 | +" | ||
319 | + | ||
320 | +do_install_append_smarcimx8mm2g() { | ||
321 | + install -d ${D}${systemd_unitdir}/system | ||
322 | + install -d ${D}${sysconfdir}/systemd/system/sysinit.target.wants | ||
323 | + install -m 0644 ${WORKDIR}/disable-serialgetty.service ${D}${systemd_unitdir}/system | ||
324 | + install -m 0755 ${WORKDIR}/disable-serialgetty.sh ${D}${systemd_unitdir}/system | ||
325 | + | ||
326 | + ln -sf ${systemd_unitdir}/system/disable-serialgetty.service \ | ||
327 | + ${D}${sysconfdir}/systemd/system/sysinit.target.wants/disable-serialgetty.service | ||
328 | +} | ||
329 | + | ||
330 | +SRC_URI_append_smarcimx8mm4g = " \ | ||
331 | + file://disable-serialgetty.sh \ | ||
332 | + file://disable-serialgetty.service \ | ||
333 | +" | ||
334 | +FILES_${PN}_append_smarcimx8mm4g = " \ | ||
335 | + /lib/systemd/system/* \ | ||
336 | + /etc/systemd/system/* \ | ||
337 | +" | ||
338 | + | ||
339 | +do_install_append_smarcimx8mm4g() { | ||
340 | + install -d ${D}${systemd_unitdir}/system | ||
341 | + install -d ${D}${sysconfdir}/systemd/system/sysinit.target.wants | ||
342 | + install -m 0644 ${WORKDIR}/disable-serialgetty.service ${D}${systemd_unitdir}/system | ||
343 | + install -m 0755 ${WORKDIR}/disable-serialgetty.sh ${D}${systemd_unitdir}/system | ||
344 | + | ||
345 | + ln -sf ${systemd_unitdir}/system/disable-serialgetty.service \ | ||
346 | + ${D}${sysconfdir}/systemd/system/sysinit.target.wants/disable-serialgetty.service | ||
347 | +} | ||
348 | diff --git a/recipes-core/systemd/systemd-serialgetty/disable-serialgetty.service b/recipes-core/systemd/systemd-serialgetty/disable-serialgetty.service | ||
349 | new file mode 100644 | ||
350 | index 0000000..4c98261 | ||
351 | --- /dev/null | ||
352 | +++ b/recipes-core/systemd/systemd-serialgetty/disable-serialgetty.service | ||
353 | @@ -0,0 +1,11 @@ | ||
354 | +[Unit] | ||
355 | +Description=Disable redundant serial getty service | ||
356 | +After=systemd-remount-fs.service | ||
357 | +ConditionPathIsReadWrite=/etc | ||
358 | + | ||
359 | +[Service] | ||
360 | +Type=oneshot | ||
361 | +ExecStart=/lib/systemd/system/disable-serialgetty.sh | ||
362 | + | ||
363 | +[Install] | ||
364 | +WantedBy=sysinit.target | ||
365 | diff --git a/recipes-core/systemd/systemd-serialgetty/disable-serialgetty.sh b/recipes-core/systemd/systemd-serialgetty/disable-serialgetty.sh | ||
366 | new file mode 100755 | ||
367 | index 0000000..6dbc806 | ||
368 | --- /dev/null | ||
369 | +++ b/recipes-core/systemd/systemd-serialgetty/disable-serialgetty.sh | ||
370 | @@ -0,0 +1,20 @@ | ||
371 | +#!/bin/sh | ||
372 | + | ||
373 | +UART0_SERVICE=serial-getty@ttymxc0.service | ||
374 | +UART1_SERVICE=serial-getty@ttymxc1.service | ||
375 | +UART2_SERVICE=serial-getty@ttymxc2.service | ||
376 | +UART3_SERVICE=serial-getty@ttymxc3.service | ||
377 | + | ||
378 | +tty_service_enabled() | ||
379 | +{ | ||
380 | + test -f /etc/systemd/system/getty.target.wants/$1 | ||
381 | +} | ||
382 | + | ||
383 | +if tty_service_enabled ${UART0_SERVICE}; then | ||
384 | + systemctl stop ${UART0_SERVICE} | ||
385 | + systemctl disable ${UART0_SERVICE} | ||
386 | + systemctl enable ${UART1_SERVICE} | ||
387 | +fi | ||
388 | + | ||
389 | + | ||
390 | + | ||
391 | diff --git a/recipes-kernel/linux/linux-smarcimx8mm_5.4.bb b/recipes-kernel/linux/linux-smarcimx8mm_5.4.bb | ||
392 | new file mode 100644 | ||
393 | index 0000000..94fe8c3 | ||
394 | --- /dev/null | ||
395 | +++ b/recipes-kernel/linux/linux-smarcimx8mm_5.4.bb | ||
396 | @@ -0,0 +1,62 @@ | ||
397 | +# Copyright (C) 2013-2016 Freescale Semiconductor | ||
398 | +# Copyright 2017-2019 NXP | ||
399 | +# Copyright 2018-2019 Embedian, Inc. | ||
400 | +# Released under the MIT license (see COPYING.MIT for the terms) | ||
401 | + | ||
402 | +SUMMARY = "Linux kernel provided and supported by Embedian" | ||
403 | +DESCRIPTION = "Linux kernel provided and supported by Embedian (based on the kernel imx_5.4.24_2.1.0 provided by NXP) \ | ||
404 | +with focus on i.MX Family SOMs. It includes support for many IPs such as GPU, VPU and IPU." | ||
405 | + | ||
406 | +require recipes-kernel/linux/linux-imx.inc | ||
407 | + | ||
408 | +LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814" | ||
409 | + | ||
410 | +DEPENDS += "lzop-native bc-native" | ||
411 | + | ||
412 | +SRCBRANCH = "smarc_8mm_imx_5.4.24_2.1.0" | ||
413 | +LOCALVERSION = "-2.1.0" | ||
414 | +KERNEL_DEFCONFIG = "${S}/arch/arm64/configs/smarcimx8mm_defconfig" | ||
415 | + | ||
416 | +KERNEL_SRC ?= "git@git.embedian.com:developer/smarc-fsl-linux-kernel.git;protocol=git" | ||
417 | +SRC_URI = "${EMB_KERNEL_MIRROR};protocol=ssh;branch=${SRCBRANCH}" | ||
418 | +SRCREV = "8b44baa3bf3c4262181cfd1e77017ed58fbd4e3c" | ||
419 | + | ||
420 | +S = "${WORKDIR}/git" | ||
421 | +FILES_${KERNEL_PACKAGE_NAME}-base += "${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.builtin.modinfo " | ||
422 | + | ||
423 | +KERNEL_CONFIG_COMMAND = "oe_runmake_call -C ${S} CC="${KERNEL_CC}" O=${B} olddefconfig" | ||
424 | + | ||
425 | +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | ||
426 | + | ||
427 | +DEFAULT_PREFERENCE = "1" | ||
428 | + | ||
429 | +addtask copy_defconfig after do_patch before do_preconfigure | ||
430 | + | ||
431 | +do_copy_defconfig () { | ||
432 | + install -d ${B} | ||
433 | + # copy kernel defconfig smarcimx8mm_defconfig to use for mx8 | ||
434 | + mkdir -p ${B} | ||
435 | + cp ${KERNEL_DEFCONFIG} ${B}/.config | ||
436 | + cp ${KERNEL_DEFCONFIG} ${B}/../defconfig | ||
437 | +} | ||
438 | + | ||
439 | +DELTA_KERNEL_DEFCONFIG ?= "" | ||
440 | +#DELTA_KERNEL_DEFCONFIG_prepend_mx8 = "sdk_imx.config " | ||
441 | + | ||
442 | +do_merge_delta_config[dirs] = "${B}" | ||
443 | +do_merge_delta_config() { | ||
444 | + for deltacfg in ${DELTA_KERNEL_DEFCONFIG}; do | ||
445 | + if [ -f ${S}/arch/${ARCH}/configs/${deltacfg} ]; then | ||
446 | + ${KERNEL_CONFIG_COMMAND} | ||
447 | + oe_runmake_call -C ${S} CC="${KERNEL_CC}" O=${B} ${deltacfg} | ||
448 | + elif [ -f "${WORKDIR}/${deltacfg}" ]; then | ||
449 | + ${S}/scripts/kconfig/merge_config.sh -m .config ${WORKDIR}/${deltacfg} | ||
450 | + elif [ -f "${deltacfg}" ]; then | ||
451 | + ${S}/scripts/kconfig/merge_config.sh -m .config ${deltacfg} | ||
452 | + fi | ||
453 | + done | ||
454 | + cp .config ${WORKDIR}/defconfig | ||
455 | +} | ||
456 | +addtask merge_delta_config before do_preconfigure after do_copy_defconfig | ||
457 | + | ||
458 | +COMPATIBLE_MACHINE = "(mx6|mx7|mx8)" | ||
459 | diff --git a/scripts/emb_mk_yocto_sdcard/README.txt b/scripts/emb_mk_yocto_sdcard/README.txt | ||
460 | index 8747d67..5f3d08c 100644 | ||
461 | --- a/scripts/emb_mk_yocto_sdcard/README.txt | ||
462 | +++ b/scripts/emb_mk_yocto_sdcard/README.txt | ||
463 | @@ -11,7 +11,7 @@ Before running this script you need to bitbake fsl-image-gui. | ||
464 | |||
465 | |||
466 | Usage: | ||
467 | -sudo MACHINE=<smarcimx8m2g|smarcimx8m4g> ./emb-create-yocto-sdcard.sh [options] /dev/sdX | ||
468 | +sudo MACHINE=<smarcimx8mm2g|smarcimx8mm4g> ./emb-create-yocto-sdcard.sh [options] /dev/sdX | ||
469 | (Change /dev/sdX to your device name) | ||
470 | |||
471 | options: | ||
472 | diff --git a/scripts/emb_mk_yocto_sdcard/emb-create-yocto-emmc.sh b/scripts/emb_mk_yocto_sdcard/emb-create-yocto-emmc.sh | ||
473 | index 59c2410..fbadf48 100755 | ||
474 | --- a/scripts/emb_mk_yocto_sdcard/emb-create-yocto-emmc.sh | ||
475 | +++ b/scripts/emb_mk_yocto_sdcard/emb-create-yocto-emmc.sh | ||
476 | @@ -22,7 +22,6 @@ ROOTFS_IMAGE=rootfs.tar.bz2 | ||
477 | BOOTLOADER_RESERVED_SIZE=2 | ||
478 | PART1_SIZE=48 | ||
479 | BOOTLOADER_OFFSET=33 | ||
480 | -DISPLAY=-hdmi | ||
481 | PART=p | ||
482 | BOOTPART=1 | ||
483 | ROOTFSPART=2 | ||
484 | @@ -30,16 +29,11 @@ BOOTDIR=/boot | ||
485 | |||
486 | check_board() | ||
487 | { | ||
488 | - if grep -q "i.MX8M" /sys/devices/soc0/soc_id; then | ||
489 | - BOARD=smarc-imx8m | ||
490 | - DTB_PREFIX=imx8mq-smarc | ||
491 | + if grep -q "i.MX8MM" /sys/devices/soc0/soc_id; then | ||
492 | + BOARD=smarc-imx8mm | ||
493 | + DTB_PREFIX=imx8mm-smarc | ||
494 | BLOCK=mmcblk0 | ||
495 | |||
496 | - if [[ $DISPLAY != "-lvds" && $DISPLAY != "-hdmi" && \ | ||
497 | - $DISPLAY != "-dual-display" && $DISPLAY != "" ]]; then | ||
498 | - red_bold_echo "ERROR: invalid display, should be lvds, hdmi, dual-display or empty" | ||
499 | - exit 1 | ||
500 | - fi | ||
501 | else | ||
502 | red_bold_echo "ERROR: Unsupported board" | ||
503 | exit 1 | ||
504 | @@ -65,8 +59,8 @@ check_images() | ||
505 | exit 1 | ||
506 | fi | ||
507 | |||
508 | - if [[ ! -f $IMGS_PATH/${DTB_PREFIX}${DISPLAY}.dtb ]] ; then | ||
509 | - red_bold_echo "ERROR: \"$IMGS_PATH/${DTB_PREFIX}${DISPLAY}.dtb\" does not exist" | ||
510 | + if [[ ! -f $IMGS_PATH/${DTB_PREFIX}.dtb ]] ; then | ||
511 | + red_bold_echo "ERROR: \"$IMGS_PATH/${DTB_PREFIX}.dtb\" does not exist" | ||
512 | exit 1 | ||
513 | fi | ||
514 | |||
515 | @@ -149,7 +143,7 @@ install_kernel_to_emmc() | ||
516 | mount /dev/${BLOCK}${PART}${BOOTPART} ${MOUNTDIR} | ||
517 | mkdir -p ${MOUNTDIR}/dtbs/ | ||
518 | cp -v ${IMGS_PATH}/${KERNEL_IMAGE} ${MOUNTDIR} | ||
519 | - cp -v ${IMGS_PATH}/${DTB_PREFIX}${DISPLAY}.dtb ${MOUNTDIR}/dtbs/imx8mq-smarc.dtb | ||
520 | + cp -v ${IMGS_PATH}/${DTB_PREFIX}.dtb ${MOUNTDIR}/dtbs/imx8mm-smarc.dtb | ||
521 | cp -v ${IMGS_PATH}/uEnv.txt ${MOUNTDIR} | ||
522 | |||
523 | echo | ||
524 | @@ -171,7 +165,7 @@ install_rootfs_to_emmc() | ||
525 | tar --warning=no-timestamp -jxvf ${IMGS_PATH}/${ROOTFS_IMAGE} -C ${MOUNTDIR} --checkpoint=.1200 | ||
526 | |||
527 | # Create DTB symlink | ||
528 | - (cd ${MOUNTDIR}/${BOOTDIR}; ln -fs ${DTB_PREFIX}${DISPLAY}.dtb ${DTB_PREFIX}.dtb) | ||
529 | + (cd ${MOUNTDIR}/${BOOTDIR}; ln -fs ${DTB_PREFIX}.dtb ${DTB_PREFIX}.dtb) | ||
530 | |||
531 | echo | ||
532 | sync | ||
533 | @@ -198,7 +192,7 @@ start_udev() | ||
534 | usage() | ||
535 | { | ||
536 | echo | ||
537 | - echo "This script installs Yocto Rootfs on the SMARC-iMX8M's internal eMMC storage device" | ||
538 | + echo "This script installs Yocto Rootfs on the SMARC-iMX8MM's internal eMMC storage device" | ||
539 | echo | ||
540 | echo " Usage: $(basename $0) <option>" | ||
541 | echo | ||
542 | @@ -224,7 +218,7 @@ if [[ $EUID != 0 ]] ; then | ||
543 | exit 1 | ||
544 | fi | ||
545 | |||
546 | -blue_underlined_bold_echo "*** Embedian SMARC-iMX8M on-module eMMC Recovery ***" | ||
547 | +blue_underlined_bold_echo "*** Embedian SMARC-iMX8MM on-module eMMC Recovery ***" | ||
548 | echo | ||
549 | |||
550 | while getopts d:h OPTION; | ||
551 | diff --git a/scripts/emb_mk_yocto_sdcard/emb-create-yocto-sdcard.sh b/scripts/emb_mk_yocto_sdcard/emb-create-yocto-sdcard.sh | ||
552 | index 69b4522..9712e14 100755 | ||
553 | --- a/scripts/emb_mk_yocto_sdcard/emb-create-yocto-sdcard.sh | ||
554 | +++ b/scripts/emb_mk_yocto_sdcard/emb-create-yocto-sdcard.sh | ||
555 | @@ -21,9 +21,6 @@ readonly YOCTO_DEFAULT_IMAGE=fsl-image-qt5-validation-imx | ||
556 | readonly YOCTO_SCRIPTS_PATH=${SCRIPT_POINT} | ||
557 | readonly YOCTO_IMGS_PATH=${YOCTO_BUILD}/tmp/deploy/images/${MACHINE} | ||
558 | |||
559 | -## display (one of "-hdmi", "-lcdif-lvds", "-dp", "-dcss-lvds", "-dual-display", "-edp") | ||
560 | -readonly DISPLAY="-hdmi" | ||
561 | - | ||
562 | # $1 -- block device | ||
563 | # $2 -- output images dir | ||
564 | readonly LPARAM_BLOCK_DEVICE=${1} | ||
565 | @@ -100,7 +97,7 @@ echo "================================================" | ||
566 | |||
567 | help() { | ||
568 | bn=`basename $0` | ||
569 | - echo " Usage: MACHINE=<smarcimx8mq2g|smarcimx8mq4g> $bn <options> device_node" | ||
570 | + echo " Usage: MACHINE=<smarcimx8mm2g|smarcimx8mm4g> $bn <options> device_node" | ||
571 | echo | ||
572 | echo " options:" | ||
573 | echo " -h display this Help message" | ||
574 | @@ -117,7 +114,7 @@ if [[ $EUID -ne 0 ]] ; then | ||
575 | exit 1 | ||
576 | fi | ||
577 | |||
578 | -if [[ $MACHINE != "smarcimx8mq2g" && $MACHINE != "smarcimx8mq4g" ]] ; then | ||
579 | +if [[ $MACHINE != "smarcimx8mm2g" && $MACHINE != "smarcimx8mm4g" ]] ; then | ||
580 | help | ||
581 | exit 1 | ||
582 | fi | ||
583 | @@ -262,7 +259,7 @@ function install_yocto | ||
584 | echo "Flashing \"Image, device tree and uEnv.txt\" partition" | ||
585 | cp -v ${YOCTO_IMGS_PATH}/Image ${P1_MOUNT_DIR}/ | ||
586 | mkdir -p ${P1_MOUNT_DIR}/dtbs/ | ||
587 | - cp -v ${YOCTO_IMGS_PATH}/imx8mq-smarc${DISPLAY}.dtb ${P1_MOUNT_DIR}/dtbs/imx8mq-smarc.dtb | ||
588 | + cp -v ${YOCTO_IMGS_PATH}/imx8mm-smarc.dtb ${P1_MOUNT_DIR}/dtbs/imx8mm-smarc.dtb | ||
589 | cp -v ${YOCTO_SCRIPTS_PATH}/uEnv.txt ${P1_MOUNT_DIR}/ | ||
590 | |||
591 | echo | ||
592 | @@ -296,7 +293,7 @@ function copy_images | ||
593 | echo "Copying Kernel Parameter uEnv.txt to /opt/images/" | ||
594 | cp -v ${YOCTO_SCRIPTS_PATH}/uEnv_emmc.txt ${P2_MOUNT_DIR}/opt/images/Yocto/uEnv.txt | ||
595 | |||
596 | - if [[ $MACHINE = "smarcimx8mq2g" || ${MACHINE} = "smarcimx8mq4g" ]]; then | ||
597 | + if [[ $MACHINE = "smarcimx8mm2g" || ${MACHINE} = "smarcimx8mm4g" ]]; then | ||
598 | cp ${YOCTO_IMGS_PATH}/imx-boot-${MACHINE}-sd.bin-* ${P2_MOUNT_DIR}/opt/images/Yocto | ||
599 | (cd ${P2_MOUNT_DIR}/opt/images/Yocto; ln -fs imx-boot-${MACHINE}-sd.bin-flash_evk imx-boot-sd.bin) | ||
600 | else | ||
601 | diff --git a/scripts/emb_mk_yocto_sdcard/uEnv.txt b/scripts/emb_mk_yocto_sdcard/uEnv.txt | ||
602 | index fab33cb..080d766 100644 | ||
603 | --- a/scripts/emb_mk_yocto_sdcard/uEnv.txt | ||
604 | +++ b/scripts/emb_mk_yocto_sdcard/uEnv.txt | ||
605 | @@ -1,14 +1,11 @@ | ||
606 | -optargs="video=HDMI-A-1:1920x1080-32@60 consoleblank=0" | ||
607 | -#optargs="video=HDMI-A-1:3840x2160-32@30 consoleblank=0" | ||
608 | -#optargs="video=HDMI-A-1:3840x2160-32@60 consoleblank=0" | ||
609 | #console port SER3 | ||
610 | -console=ttymxc0,115200 earlycon=ec_imx6q,0x30860000,115200 | ||
611 | +console=ttymxc1,115200 earlycon=ec_imx6q,0x30890000,115200 | ||
612 | #console port SER2 | ||
613 | -#console=ttymxc1,115200 earlycon=ec_imx6q,0x30890000,115200 | ||
614 | -#console port SER1 | ||
615 | #console=ttymxc2,115200 earlycon=ec_imx6q,0x30880000,115200 | ||
616 | +#console port SER1 | ||
617 | +#console=ttymxc3,115200 earlycon=ec_imx6q,0x30a60000,115200 | ||
618 | #console port SER0 | ||
619 | -#console=ttymxc3,115200 earlycon=ec_imx6q,0x30A60000,115200 | ||
620 | +#console=ttymxc0,115200 earlycon=ec_imx6q,0x30860000,115200 | ||
621 | mmcdev=1 | ||
622 | mmcpart=1 | ||
623 | image=Image | ||
624 | @@ -22,7 +19,7 @@ ethact=FEC0 | ||
625 | ipaddr=192.168.1.150 | ||
626 | serverip=192.168.1.53 | ||
627 | gatewayip=192.168.1.254 | ||
628 | -mmcargs=setenv bootargs cma=960M console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs} | ||
629 | +mmcargs=setenv bootargs console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs} cma=400M | ||
630 | uenvcmd=run loadimage; run loadfdt; run mmcboot | ||
631 | # USB Boot | ||
632 | #usbargs=setenv bootargs console=${console} root=${usbroot} rootfstype=${mmcrootfstype} ${optargs} | ||
633 | diff --git a/scripts/emb_mk_yocto_sdcard/uEnv_emmc.txt b/scripts/emb_mk_yocto_sdcard/uEnv_emmc.txt | ||
634 | index 64692b6..7650031 100644 | ||
635 | --- a/scripts/emb_mk_yocto_sdcard/uEnv_emmc.txt | ||
636 | +++ b/scripts/emb_mk_yocto_sdcard/uEnv_emmc.txt | ||
637 | @@ -1,14 +1,11 @@ | ||
638 | -optargs="video=HDMI-A-1:1920x1080-32@60 consoleblank=0" | ||
639 | -#optargs="video=HDMI-A-1:3840x2160-32@30 consoleblank=0" | ||
640 | -#optargs="video=HDMI-A-1:3840x2160-32@60 consoleblank=0" | ||
641 | #console port SER3 | ||
642 | -console=ttymxc0,115200 earlycon=ec_imx6q,0x30860000,115200 | ||
643 | +console=ttymxc1,115200 earlycon=ec_imx6q,0x30890000,115200 | ||
644 | #console port SER2 | ||
645 | -#console=ttymxc1,115200 earlycon=ec_imx6q,0x30890000,115200 | ||
646 | -#console port SER1 | ||
647 | #console=ttymxc2,115200 earlycon=ec_imx6q,0x30880000,115200 | ||
648 | +#console port SER1 | ||
649 | +#console=ttymxc3,115200 earlycon=ec_imx6q,0x30a60000,115200 | ||
650 | #console port SER0 | ||
651 | -#console=ttymxc3,115200 earlycon=ec_imx6q,0x30A60000,115200 | ||
652 | +#console=ttymxc0,115200 earlycon=ec_imx6q,0x30860000,115200 | ||
653 | mmcdev=0 | ||
654 | mmcpart=1 | ||
655 | image=Image | ||
656 | @@ -22,7 +19,7 @@ ethact=FEC0 | ||
657 | ipaddr=192.168.1.150 | ||
658 | serverip=192.168.1.53 | ||
659 | gatewayip=192.168.1.254 | ||
660 | -mmcargs=setenv bootargs cma=960M console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs} | ||
661 | +mmcargs=setenv bootargs console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs} cma=400M | ||
662 | uenvcmd=run loadimage; run loadfdt; run mmcboot | ||
663 | # USB Boot | ||
664 | #usbargs=setenv bootargs console=${console} root=${usbroot} rootfstype=${mmcrootfstype} ${optargs} | ||
665 |
conf/machine/include/smarc-common.inc
1 | MACHINE_USES_VIVANTE_KERNEL_DRIVER_MODULE ?= "0" | 1 | MACHINE_USES_VIVANTE_KERNEL_DRIVER_MODULE ?= "0" |
2 | 2 | ||
3 | PACKAGE_CLASSES = "package_ipk" | 3 | PACKAGE_CLASSES = "package_ipk" |
4 | 4 | ||
5 | MACHINE_SOCARCH_FILTER_append_imxgpu = " opencv" | 5 | MACHINE_SOCARCH_FILTER_append_imxgpu = " opencv" |
6 | 6 | ||
7 | MACHINE_SOCARCH_FILTER_remove = " imx-parser" | 7 | MACHINE_SOCARCH_FILTER_remove = " imx-parser" |
8 | 8 | ||
9 | MACHINE_SOCARCH_FILTER_append_imxgpu = " opencv" | 9 | MACHINE_SOCARCH_FILTER_append_imxgpu = " opencv" |
10 | 10 | ||
11 | MACHINE_SOCARCH_FILTER_remove = " imx-parser" | 11 | MACHINE_SOCARCH_FILTER_remove = " imx-parser" |
12 | 12 | ||
13 | # Extra Marvell Wi-Fi & BTE driver and firmware | 13 | # Extra Marvell Wi-Fi & BTE driver and firmware |
14 | MACHINE_EXTRA_RRECOMMENDS_append = " ${@bb.utils.contains('MACHINE_FEATURES', 'mrvl8997', 'packagegroup-imx-mrvl8997', '', d)}" | 14 | MACHINE_EXTRA_RRECOMMENDS_append = " ${@bb.utils.contains('MACHINE_FEATURES', 'mrvl8997', 'packagegroup-imx-mrvl8997', '', d)}" |
15 | 15 | ||
16 | # Extra NXP Wlan SDK | 16 | # Extra NXP Wlan SDK |
17 | MACHINE_EXTRA_RRECOMMENDS_append = " ${@bb.utils.contains('MACHINE_FEATURES', 'nxp8987', 'nxp-wlan-sdk', '', d)}" | 17 | MACHINE_EXTRA_RRECOMMENDS_append = " ${@bb.utils.contains('MACHINE_FEATURES', 'nxp8987', 'nxp-wlan-sdk', '', d)}" |
18 | 18 | ||
19 | MACHINE_GSTREAMER_1_0_PLUGIN_mx8 ?= "imx-gst1.0-plugin" | 19 | MACHINE_GSTREAMER_1_0_PLUGIN_mx8 ?= "imx-gst1.0-plugin" |
20 | 20 | ||
21 | PREFERRED_VERSION_weston_mx8 ?= "8.0.0.imx" | 21 | PREFERRED_VERSION_weston_mx8 ?= "8.0.0.imx" |
22 | 22 | ||
23 | PREFERRED_VERSION_wayland-protocols_mx8 = "1.18.imx" | 23 | PREFERRED_VERSION_wayland-protocols_mx8 = "1.18.imx" |
24 | 24 | ||
25 | PREFERRED_VERSION_libdrm_mx8 ?= "2.4.99.imx" | 25 | PREFERRED_VERSION_libdrm_mx8 ?= "2.4.99.imx" |
26 | 26 | ||
27 | PREFERRED_VERSION_isp-imx ?= "4.0.8.2" | 27 | PREFERRED_VERSION_isp-imx ?= "4.0.8.2" |
28 | PREFERRED_VERSION_basler-camera ?= "1.0.2" | 28 | PREFERRED_VERSION_basler-camera ?= "1.0.2" |
29 | 29 | ||
30 | PREFERRED_VERSION_optee-client_mx8 = "3.7.0.imx" | 30 | PREFERRED_VERSION_optee-client_mx8 = "3.7.0.imx" |
31 | PREFERRED_VERSION_optee-os_mx8 = "3.7.0.imx" | 31 | PREFERRED_VERSION_optee-os_mx8 = "3.7.0.imx" |
32 | PREFERRED_VERSION_optee-test_mx8 = "3.7.0.imx" | 32 | PREFERRED_VERSION_optee-test_mx8 = "3.7.0.imx" |
33 | 33 | ||
34 | # Use the stable version 3.2.0. Version 3.7.0 is still | 34 | # Use the stable version 3.2.0. Version 3.7.0 is still |
35 | # in an experimental state | 35 | # in an experimental state |
36 | PREFERRED_VERSION_optee-os ?= "3.2.0.imx" | 36 | PREFERRED_VERSION_optee-os ?= "3.2.0.imx" |
37 | PREFERRED_VERSION_optee-client ?= "3.2.0.imx" | 37 | PREFERRED_VERSION_optee-client ?= "3.2.0.imx" |
38 | PREFERRED_VERSION_optee-test ?= "3.2.0.imx" | 38 | PREFERRED_VERSION_optee-test ?= "3.2.0.imx" |
39 | # Temporary workaround to override specific prefered version | 39 | # Temporary workaround to override specific prefered version |
40 | # in meta-freescale layer for i.MX8. | 40 | # in meta-freescale layer for i.MX8. |
41 | PREFERRED_VERSION_optee-os_mx8 ?= "3.7.0.imx" | 41 | PREFERRED_VERSION_optee-os_mx8 ?= "3.7.0.imx" |
42 | PREFERRED_VERSION_optee-client_mx8 ?= "3.7.0.imx" | 42 | PREFERRED_VERSION_optee-client_mx8 ?= "3.7.0.imx" |
43 | PREFERRED_VERSION_optee-test_mx8 ?= "3.7.0.imx" | 43 | PREFERRED_VERSION_optee-test_mx8 ?= "3.7.0.imx" |
44 | 44 | ||
45 | IMX_DEFAULT_KERNEL_mx6ulz = "linux-imx" | 45 | IMX_DEFAULT_KERNEL_mx6ulz = "linux-imx" |
46 | 46 | ||
47 | SOC_DEFAULT_IMAGE_FSTYPES_remove = "wic.gz" | 47 | SOC_DEFAULT_IMAGE_FSTYPES_remove = "wic.gz" |
48 | SOC_DEFAULT_IMAGE_FSTYPES_append = " wic.bz2 tar.bz2" | 48 | SOC_DEFAULT_IMAGE_FSTYPES_append = " wic.bz2 tar.bz2" |
49 | 49 | ||
50 | # Remove from upstream | 50 | # Remove from upstream |
51 | SDCARD_ROOTFS = "NO_LONGER_USED" | 51 | SDCARD_ROOTFS = "NO_LONGER_USED" |
52 | 52 | ||
53 | OPTEE_BOOT_IMAGE_mx8 ?= "tee.bin" | 53 | OPTEE_BOOT_IMAGE_mx8 ?= "tee.bin" |
54 | 54 | ||
55 | IMAGE_BOOT_FILES_append = " \ | 55 | IMAGE_BOOT_FILES_append = " \ |
56 | ${@bb.utils.contains('COMBINED_FEATURES', 'xen', 'xen', '', d)} \ | 56 | ${@bb.utils.contains('COMBINED_FEATURES', 'xen', 'xen', '', d)} \ |
57 | " | 57 | " |
58 | 58 | ||
59 | IMAGE_INSTALL_append = " \ | 59 | IMAGE_INSTALL_append = " \ |
60 | ${@bb.utils.contains('COMBINED_FEATURES', 'jailhouse', 'jailhouse', '', d)} \ | 60 | ${@bb.utils.contains('COMBINED_FEATURES', 'jailhouse', 'jailhouse', '', d)} \ |
61 | ${@bb.utils.contains('MACHINE_FEATURES', 'optee', 'packagegroup-fsl-optee-imx', '', d)} \ | 61 | ${@bb.utils.contains('MACHINE_FEATURES', 'optee', 'packagegroup-fsl-optee-imx', '', d)} \ |
62 | ${@bb.utils.contains('COMBINED_FEATURES', 'xen', 'imx-xen-base imx-xen-hypervisor', '', d)} \ | 62 | ${@bb.utils.contains('COMBINED_FEATURES', 'xen', 'imx-xen-base imx-xen-hypervisor', '', d)} \ |
63 | " | 63 | " |
64 | 64 | ||
65 | MACHINE_FEATURES_append_imx = " nxp8987" | 65 | MACHINE_FEATURES_append_imx = " nxp8987" |
66 | 66 | ||
67 | # Overrides for all MACHINE.conf with optee support | 67 | # Overrides for all MACHINE.conf with optee support |
68 | UBOOT_CONFIG_OPTEE_CONFIG = "mx${OPTEE_BIN_EXT}_optee_config" | 68 | UBOOT_CONFIG_OPTEE_CONFIG = "mx${OPTEE_BIN_EXT}_optee_config" |
69 | UBOOT_CONFIG[sd-optee] = "${UBOOT_CONFIG_OPTEE_CONFIG},sdcard" | 69 | UBOOT_CONFIG[sd-optee] = "${UBOOT_CONFIG_OPTEE_CONFIG},sdcard" |
70 | 70 | ||
71 | 71 | ||
72 | MACHINE_FEATURES_remove_smarcimx8mq2g = "qca6174" | 72 | MACHINE_FEATURES_remove_smarcimx8mq2g = "qca6174" |
73 | MACHINE_FEATURES_append_smarcimx8mq2g = " mrvl8997 jailhouse" | 73 | MACHINE_FEATURES_append_smarcimx8mq2g = " mrvl8997 jailhouse" |
74 | MACHINE_FEATURES_remove_smarcimx8mq4g = "qca6174" | 74 | MACHINE_FEATURES_remove_smarcimx8mq4g = "qca6174" |
75 | MACHINE_FEATURES_append_smarcimx8mq4g = " mrvl8997 jailhouse" | 75 | MACHINE_FEATURES_append_smarcimx8mq4g = " mrvl8997 jailhouse" |
76 | |||
77 | MACHINE_FEATURES_remove_smarcimx8mm2g = "qca6174" | ||
78 | MACHINE_FEATURES_append_smarcimx8mm2g = " mrvl8997 jailhouse" | ||
79 | MACHINE_FEATURES_remove_smarcimx8mm4g = "qca6174" | ||
80 | MACHINE_FEATURES_append_smarcimx8mm4g = " mrvl8997 jailhouse" | ||
76 | 81 |
conf/machine/smarcimx8mm2g.conf
File was created | 1 | #@TYPE: Machine | |
2 | #@NAME: EMBEDIAN SMARC-iMX8MM COMPUTER ON MODULES with 4GB LPDDR4 MEMORY | ||
3 | #@SOC: i.MX8MQ | ||
4 | #@DESCRIPTION: Machine configuration for Embedian SMARC-iMX8M | ||
5 | #@MAINTAINER: Eric Lee <eric.lee@embedian.com> | ||
6 | # | ||
7 | # http://www.www.embedian.com | ||
8 | |||
9 | MACHINEOVERRIDES =. "mx8:mx8m:mx8mm:" | ||
10 | |||
11 | require conf/machine/include/imx-base.inc | ||
12 | require conf/machine/include/tune-cortexa53.inc | ||
13 | require conf/machine/include/smarc-common.inc | ||
14 | |||
15 | MACHINE_FEATURES += " usbgadget vfat ext2 alsa serial pci wifi bluetooth" | ||
16 | |||
17 | # Embedian BSP default providers | ||
18 | PREFERRED_PROVIDER_virtual/kernel_smarcimx8mm2g ?= "linux-smarcimx8mm" | ||
19 | PREFERRED_VERSION_linux-smarcimx8mm2g_smarcimx8mm2g = "5.4" | ||
20 | |||
21 | KERNEL_DEVICETREE = " \ | ||
22 | embedian/imx8mm-smarc.dtb \ | ||
23 | embedian/imx8mm-smarc-m4.dtb \ | ||
24 | " | ||
25 | MACHINE_EXTRA_RRECOMMENDS_append_mx8mm = " imx-m4-demos" | ||
26 | IMAGE_BOOTFILES_DEPENDS += "imx-m4-demos:do_deploy" | ||
27 | IMAGE_BOOT_FILES += "imx8mm_m4_TCM_hello_world.bin imx8mm_m4_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin imx8mm_m4_TCM_rpmsg_lite_str_echo_rtos.bin" | ||
28 | |||
29 | PREFERRED_PROVIDER_u-boot_smarcimx8mm2g = "u-boot-smarcimx8mm" | ||
30 | PREFERRED_PROVIDER_virtual/bootloader_smarcimx8mm2g = "u-boot-smarcimx8mm" | ||
31 | |||
32 | UBOOT_CONFIG ??= "sd" | ||
33 | UBOOT_CONFIG[sd] = "smarcimx8mm_2g_ser3_defconfig,sdcard" | ||
34 | SPL_BINARY = "spl/u-boot-spl.bin" | ||
35 | |||
36 | # Set DDR FIRMWARE | ||
37 | DDR_FIRMWARE_NAME = "lpddr4_pmu_train_1d_imem.bin lpddr4_pmu_train_1d_dmem.bin lpddr4_pmu_train_2d_imem.bin lpddr4_pmu_train_2d_dmem.bin" | ||
38 | |||
39 | # Set U-Boot DTB | ||
40 | UBOOT_DTB_NAME = "imx8mm-smarc.dtb" | ||
41 | |||
42 | # Set imx-mkimage boot target | ||
43 | IMXBOOT_TARGETS = "flash_evk" | ||
44 | |||
45 | SERIAL_CONSOLE = "115200 ttymxc1" | ||
46 | |||
47 | IMAGE_BOOTLOADER = "imx-boot" | ||
48 | |||
49 | LOADADDR = "" | ||
50 | UBOOT_MAKE_TARGET = "" | ||
51 | IMX_BOOT_SEEK = "33" | ||
52 | |||
53 | MACHINE_EXTRA_RDEPENDS += " \ | ||
54 | imx-boot \ | ||
55 | packagegroup-tools-bluetooth \ | ||
56 | pm-utils \ | ||
57 | kmod \ | ||
58 | hdparm \ | ||
59 | gptfdisk \ | ||
60 | lftp \ | ||
61 | vim \ | ||
62 | ntp \ | ||
63 | boost \ | ||
64 | nodejs \ | ||
65 | networkmanager \ | ||
66 | imx-gpu-viv \ | ||
67 | " | ||
68 | |||
69 | # Packages added to all images (including core-image-minimal) | ||
70 | |||
71 | # eIQ Machine Learning. Note that many of the features require Qt 5. Disable | ||
72 | # this when you build image without QT 5. | ||
73 | IMAGE_INSTALL_append = " \ | ||
74 | packagegroup-imx-ml \ | ||
75 | firmware-imx-sdma \ | ||
76 | firmware-imx-regulatory \ | ||
77 | fsl-rc-local \ | ||
78 | android-tools \ | ||
79 | " | ||
80 | #IMAGE_INSTALL_append = " \ | ||
81 | # firmware-imx-sdma \ | ||
82 | # firmware-imx-regulatory \ | ||
83 | # fsl-rc-local \ | ||
84 | # android-tools \ | ||
85 | # " | ||
86 | |||
87 | IMAGE_FSTYPES = "tar.bz2" | ||
88 | |||
89 | # Ship all kernel modules by default | ||
90 | MACHINE_EXTRA_RRECOMMENDS = "kernel-modules" | ||
91 | |||
92 | MACHINE_FIRMWARE_append_mx8 = " linux-firmware-ath10k" | ||
93 |
conf/machine/smarcimx8mm4g.conf
File was created | 1 | #@TYPE: Machine | |
2 | #@NAME: EMBEDIAN SMARC-iMX8MM COMPUTER ON MODULES with 4GB LPDDR4 MEMORY | ||
3 | #@SOC: i.MX8MQ | ||
4 | #@DESCRIPTION: Machine configuration for Embedian SMARC-iMX8M | ||
5 | #@MAINTAINER: Eric Lee <eric.lee@embedian.com> | ||
6 | # | ||
7 | # http://www.www.embedian.com | ||
8 | |||
9 | MACHINEOVERRIDES =. "mx8:mx8m:mx8mm:" | ||
10 | |||
11 | require conf/machine/include/imx-base.inc | ||
12 | require conf/machine/include/tune-cortexa53.inc | ||
13 | require conf/machine/include/smarc-common.inc | ||
14 | |||
15 | MACHINE_FEATURES += " usbgadget vfat ext2 alsa serial pci wifi bluetooth" | ||
16 | |||
17 | # Embedian BSP default providers | ||
18 | PREFERRED_PROVIDER_virtual/kernel_smarcimx8mm4g ?= "linux-smarcimx8mm" | ||
19 | PREFERRED_VERSION_linux-smarcimx8mm4g_smarcimx8mm4g = "5.4" | ||
20 | |||
21 | KERNEL_DEVICETREE = " \ | ||
22 | embedian/imx8mm-smarc.dtb \ | ||
23 | embedian/imx8mm-smarc-m4.dtb \ | ||
24 | " | ||
25 | MACHINE_EXTRA_RRECOMMENDS_append_mx8mm = " imx-m4-demos" | ||
26 | IMAGE_BOOTFILES_DEPENDS += "imx-m4-demos:do_deploy" | ||
27 | IMAGE_BOOT_FILES += "imx8mm_m4_TCM_hello_world.bin imx8mm_m4_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin imx8mm_m4_TCM_rpmsg_lite_str_echo_rtos.bin" | ||
28 | |||
29 | PREFERRED_PROVIDER_u-boot_smarcimx8mm4g = "u-boot-smarcimx8mm" | ||
30 | PREFERRED_PROVIDER_virtual/bootloader_smarcimx8mm4g = "u-boot-smarcimx8mm" | ||
31 | |||
32 | UBOOT_CONFIG ??= "sd" | ||
33 | UBOOT_CONFIG[sd] = "smarcimx8mm_4g_ser3_defconfig,sdcard" | ||
34 | SPL_BINARY = "spl/u-boot-spl.bin" | ||
35 | |||
36 | # Set DDR FIRMWARE | ||
37 | DDR_FIRMWARE_NAME = "lpddr4_pmu_train_1d_imem.bin lpddr4_pmu_train_1d_dmem.bin lpddr4_pmu_train_2d_imem.bin lpddr4_pmu_train_2d_dmem.bin" | ||
38 | |||
39 | # Set U-Boot DTB | ||
40 | UBOOT_DTB_NAME = "imx8mm-smarc.dtb" | ||
41 | |||
42 | # Set imx-mkimage boot target | ||
43 | IMXBOOT_TARGETS = "flash_evk" | ||
44 | |||
45 | SERIAL_CONSOLE = "115200 ttymxc1" | ||
46 | |||
47 | IMAGE_BOOTLOADER = "imx-boot" | ||
48 | |||
49 | LOADADDR = "" | ||
50 | UBOOT_MAKE_TARGET = "" | ||
51 | IMX_BOOT_SEEK = "33" | ||
52 | |||
53 | MACHINE_EXTRA_RDEPENDS += " \ | ||
54 | imx-boot \ | ||
55 | packagegroup-tools-bluetooth \ | ||
56 | pm-utils \ | ||
57 | kmod \ | ||
58 | hdparm \ | ||
59 | gptfdisk \ | ||
60 | lftp \ | ||
61 | vim \ | ||
62 | ntp \ | ||
63 | boost \ | ||
64 | nodejs \ | ||
65 | networkmanager \ | ||
66 | imx-gpu-viv \ | ||
67 | " | ||
68 | |||
69 | # Packages added to all images (including core-image-minimal) | ||
70 | |||
71 | # eIQ Machine Learning. Note that many of the features require Qt 5. Disable | ||
72 | # this when you build image without QT 5. | ||
73 | IMAGE_INSTALL_append = " \ | ||
74 | packagegroup-imx-ml \ | ||
75 | firmware-imx-sdma \ | ||
76 | firmware-imx-regulatory \ | ||
77 | fsl-rc-local \ | ||
78 | android-tools \ | ||
79 | " | ||
80 | #IMAGE_INSTALL_append = " \ | ||
81 | # firmware-imx-sdma \ | ||
82 | # firmware-imx-regulatory \ | ||
83 | # fsl-rc-local \ | ||
84 | # android-tools \ | ||
85 | # " | ||
86 | |||
87 | IMAGE_FSTYPES = "tar.bz2" | ||
88 | |||
89 | # Ship all kernel modules by default | ||
90 | MACHINE_EXTRA_RRECOMMENDS = "kernel-modules" | ||
91 | |||
92 | MACHINE_FIRMWARE_append_mx8 = " linux-firmware-ath10k" | ||
93 |
recipes-bsp/imx-atf/imx-atf/imx8mm-atf-uart4.patch
File was created | 1 | diff --git a/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c b/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c | |
2 | index 049192880..57c404675 100644 | ||
3 | --- a/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c | ||
4 | +++ b/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c | ||
5 | @@ -58,7 +58,8 @@ static const struct imx_rdc_cfg rdc[] = { | ||
6 | RDC_MDAn(RDC_MDA_M4, DID1), | ||
7 | |||
8 | /* peripherals domain permission */ | ||
9 | - RDC_PDAPn(RDC_PDAP_UART4, D1R | D1W), | ||
10 | + /*RDC_PDAPn(RDC_PDAP_UART4, D1R | D1W),*/ | ||
11 | + RDC_PDAPn(RDC_PDAP_UART4, D0R | D0W), | ||
12 | RDC_PDAPn(RDC_PDAP_UART2, D0R | D0W), | ||
13 | |||
14 | /* memory region */ | ||
15 |
recipes-bsp/imx-atf/imx-atf_2.2.bbappend
1 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" |
2 | 2 | ||
3 | SRC_URI_append = " \ | 3 | SRC_URI_append = " \ |
4 | file://imx8m-atf-ddr-timing.patch \ | 4 | file://imx8m-atf-ddr-timing.patch \ |
5 | file://imx8mm-atf-uart4.patch \ | ||
5 | " | 6 | " |
6 | 7 |
recipes-bsp/imx-mkimage/imx-boot_1.0.bbappend
1 | # Workaround to fix do_compile() failure due to missing fsl-imx8mq-evk.dtb | 1 | # Workaround to fix do_compile() failure due to missing fsl-imx8mq-evk.dtb |
2 | do_compile_prepend() { | 2 | do_compile_prepend() { |
3 | echo "Copying DTB" | 3 | echo "Copying DTB" |
4 | if [ -f ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/imx8mq-smarc.dtb ]; then | 4 | if [ -f ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/imx8mm-smarc.dtb ]; then |
5 | cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/imx8mq-smarc.dtb ${S}/iMX8M/imx8mq-evk.dtb | 5 | cp ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/imx8mm-smarc.dtb ${S}/iMX8M/imx8mm-evk.dtb |
6 | fi | 6 | fi |
7 | } | 7 | } |
8 | 8 |
recipes-bsp/u-boot/u-boot-smarcimx8mm_2020.04.bb
File was created | 1 | # Copyright (C) 2013-2016 Freescale Semiconductor | |
2 | # Copyright 2017-2019 NXP | ||
3 | |||
4 | DESCRIPTION = "i.MX U-Boot suppporting i.MX reference boards." | ||
5 | require recipes-bsp/u-boot/u-boot-common.inc | ||
6 | require recipes-bsp/u-boot/u-boot.inc | ||
7 | inherit pythonnative | ||
8 | |||
9 | FILESEXTRAPATHS_prepend := "${THISDIR}/files:" | ||
10 | |||
11 | PROVIDES += "u-boot" | ||
12 | DEPENDS_append = " dtc-native" | ||
13 | |||
14 | LICENSE = "GPLv2+" | ||
15 | LIC_FILES_CHKSUM = "file://Licenses/gpl-2.0.txt;md5=b234ee4d69f5fce4486a80fdaf4a4263" | ||
16 | |||
17 | UBOOT_SRC ?= "${EMB_UBOOT_MIRROR};protocol=ssh" | ||
18 | SRCBRANCH = "smarc_8mm-imx_v2020.04_5.4.24_2.1.0" | ||
19 | SRC_URI = "${UBOOT_SRC};branch=${SRCBRANCH}" | ||
20 | SRCREV = "2d41934ee1ca738d6a2083dc43304fa55ff5e547" | ||
21 | |||
22 | S = "${WORKDIR}/git" | ||
23 | |||
24 | inherit fsl-u-boot-localversion | ||
25 | |||
26 | LOCALVERSION ?= "-${SRCBRANCH}" | ||
27 | |||
28 | BOOT_TOOLS = "imx-boot-tools" | ||
29 | |||
30 | do_deploy_append_mx8m () { | ||
31 | # Deploy the mkimage, u-boot-nodtb.bin and fsl-imx8mq-XX.dtb for mkimage to generate boot binary | ||
32 | if [ -n "${UBOOT_CONFIG}" ] | ||
33 | then | ||
34 | for config in ${UBOOT_MACHINE}; do | ||
35 | i=$(expr $i + 1); | ||
36 | for type in ${UBOOT_CONFIG}; do | ||
37 | j=$(expr $j + 1); | ||
38 | if [ $j -eq $i ] | ||
39 | then | ||
40 | install -d ${DEPLOYDIR}/${BOOT_TOOLS} | ||
41 | install -m 0777 ${B}/${config}/arch/arm/dts/${UBOOT_DTB_NAME} ${DEPLOYDIR}/${BOOT_TOOLS} | ||
42 | install -m 0777 ${B}/${config}/u-boot-nodtb.bin ${DEPLOYDIR}/${BOOT_TOOLS}/u-boot-nodtb.bin-${MACHINE}-${UBOOT_CONFIG} | ||
43 | fi | ||
44 | done | ||
45 | unset j | ||
46 | done | ||
47 | unset i | ||
48 | fi | ||
49 | |||
50 | } | ||
51 | |||
52 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
53 | COMPATIBLE_MACHINE = "(mx6|mx7|mx8)" | ||
54 | |||
55 | UBOOT_NAME_mx6 = "u-boot-${MACHINE}.bin-${UBOOT_CONFIG}" | ||
56 | UBOOT_NAME_mx7 = "u-boot-${MACHINE}.bin-${UBOOT_CONFIG}" | ||
57 | UBOOT_NAME_mx8 = "u-boot-${MACHINE}.bin-${UBOOT_CONFIG}" | ||
58 |
recipes-core/systemd/systemd-serialgetty.bbappend
File was created | 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | |
2 | |||
3 | SRC_URI_append_smarcimx8mm2g = " \ | ||
4 | file://disable-serialgetty.sh \ | ||
5 | file://disable-serialgetty.service \ | ||
6 | " | ||
7 | FILES_${PN}_append_smarcimx8mm2g = " \ | ||
8 | /lib/systemd/system/* \ | ||
9 | /etc/systemd/system/* \ | ||
10 | " | ||
11 | |||
12 | do_install_append_smarcimx8mm2g() { | ||
13 | install -d ${D}${systemd_unitdir}/system | ||
14 | install -d ${D}${sysconfdir}/systemd/system/sysinit.target.wants | ||
15 | install -m 0644 ${WORKDIR}/disable-serialgetty.service ${D}${systemd_unitdir}/system | ||
16 | install -m 0755 ${WORKDIR}/disable-serialgetty.sh ${D}${systemd_unitdir}/system | ||
17 | |||
18 | ln -sf ${systemd_unitdir}/system/disable-serialgetty.service \ | ||
19 | ${D}${sysconfdir}/systemd/system/sysinit.target.wants/disable-serialgetty.service | ||
20 | } | ||
21 | |||
22 | SRC_URI_append_smarcimx8mm4g = " \ | ||
23 | file://disable-serialgetty.sh \ | ||
24 | file://disable-serialgetty.service \ | ||
25 | " | ||
26 | FILES_${PN}_append_smarcimx8mm4g = " \ | ||
27 | /lib/systemd/system/* \ | ||
28 | /etc/systemd/system/* \ | ||
29 | " | ||
30 | |||
31 | do_install_append_smarcimx8mm4g() { | ||
32 | install -d ${D}${systemd_unitdir}/system | ||
33 | install -d ${D}${sysconfdir}/systemd/system/sysinit.target.wants | ||
34 | install -m 0644 ${WORKDIR}/disable-serialgetty.service ${D}${systemd_unitdir}/system | ||
35 | install -m 0755 ${WORKDIR}/disable-serialgetty.sh ${D}${systemd_unitdir}/system | ||
36 | |||
37 | ln -sf ${systemd_unitdir}/system/disable-serialgetty.service \ | ||
38 | ${D}${sysconfdir}/systemd/system/sysinit.target.wants/disable-serialgetty.service | ||
39 | } | ||
40 |
recipes-core/systemd/systemd-serialgetty/disable-serialgetty.service
File was created | 1 | [Unit] | |
2 | Description=Disable redundant serial getty service | ||
3 | After=systemd-remount-fs.service | ||
4 | ConditionPathIsReadWrite=/etc | ||
5 | |||
6 | [Service] | ||
7 | Type=oneshot | ||
8 | ExecStart=/lib/systemd/system/disable-serialgetty.sh | ||
9 | |||
10 | [Install] | ||
11 | WantedBy=sysinit.target | ||
12 |
recipes-core/systemd/systemd-serialgetty/disable-serialgetty.sh
File was created | 1 | #!/bin/sh | |
2 | |||
3 | UART0_SERVICE=serial-getty@ttymxc0.service | ||
4 | UART1_SERVICE=serial-getty@ttymxc1.service | ||
5 | UART2_SERVICE=serial-getty@ttymxc2.service | ||
6 | UART3_SERVICE=serial-getty@ttymxc3.service | ||
7 | |||
8 | tty_service_enabled() | ||
9 | { | ||
10 | test -f /etc/systemd/system/getty.target.wants/$1 | ||
11 | } | ||
12 | |||
13 | if tty_service_enabled ${UART0_SERVICE}; then | ||
14 | systemctl stop ${UART0_SERVICE} | ||
15 | systemctl disable ${UART0_SERVICE} | ||
16 | systemctl enable ${UART1_SERVICE} | ||
17 | fi | ||
18 | |||
19 | |||
20 | |||
21 |
recipes-kernel/linux/linux-smarcimx8mm_5.4.bb
File was created | 1 | # Copyright (C) 2013-2016 Freescale Semiconductor | |
2 | # Copyright 2017-2019 NXP | ||
3 | # Copyright 2018-2019 Embedian, Inc. | ||
4 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
5 | |||
6 | SUMMARY = "Linux kernel provided and supported by Embedian" | ||
7 | DESCRIPTION = "Linux kernel provided and supported by Embedian (based on the kernel imx_5.4.24_2.1.0 provided by NXP) \ | ||
8 | with focus on i.MX Family SOMs. It includes support for many IPs such as GPU, VPU and IPU." | ||
9 | |||
10 | require recipes-kernel/linux/linux-imx.inc | ||
11 | |||
12 | LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814" | ||
13 | |||
14 | DEPENDS += "lzop-native bc-native" | ||
15 | |||
16 | SRCBRANCH = "smarc_8mm_imx_5.4.24_2.1.0" | ||
17 | LOCALVERSION = "-2.1.0" | ||
18 | KERNEL_DEFCONFIG = "${S}/arch/arm64/configs/smarcimx8mm_defconfig" | ||
19 | |||
20 | KERNEL_SRC ?= "git@git.embedian.com:developer/smarc-fsl-linux-kernel.git;protocol=git" | ||
21 | SRC_URI = "${EMB_KERNEL_MIRROR};protocol=ssh;branch=${SRCBRANCH}" | ||
22 | SRCREV = "8b44baa3bf3c4262181cfd1e77017ed58fbd4e3c" | ||
23 | |||
24 | S = "${WORKDIR}/git" | ||
25 | FILES_${KERNEL_PACKAGE_NAME}-base += "${nonarch_base_libdir}/modules/${KERNEL_VERSION}/modules.builtin.modinfo " | ||
26 | |||
27 | KERNEL_CONFIG_COMMAND = "oe_runmake_call -C ${S} CC="${KERNEL_CC}" O=${B} olddefconfig" | ||
28 | |||
29 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | ||
30 | |||
31 | DEFAULT_PREFERENCE = "1" | ||
32 | |||
33 | addtask copy_defconfig after do_patch before do_preconfigure | ||
34 | |||
35 | do_copy_defconfig () { | ||
36 | install -d ${B} | ||
37 | # copy kernel defconfig smarcimx8mm_defconfig to use for mx8 | ||
38 | mkdir -p ${B} | ||
39 | cp ${KERNEL_DEFCONFIG} ${B}/.config | ||
40 | cp ${KERNEL_DEFCONFIG} ${B}/../defconfig | ||
41 | } | ||
42 | |||
43 | DELTA_KERNEL_DEFCONFIG ?= "" | ||
44 | #DELTA_KERNEL_DEFCONFIG_prepend_mx8 = "sdk_imx.config " | ||
45 | |||
46 | do_merge_delta_config[dirs] = "${B}" | ||
47 | do_merge_delta_config() { | ||
48 | for deltacfg in ${DELTA_KERNEL_DEFCONFIG}; do | ||
49 | if [ -f ${S}/arch/${ARCH}/configs/${deltacfg} ]; then | ||
50 | ${KERNEL_CONFIG_COMMAND} | ||
51 | oe_runmake_call -C ${S} CC="${KERNEL_CC}" O=${B} ${deltacfg} | ||
52 | elif [ -f "${WORKDIR}/${deltacfg}" ]; then | ||
53 | ${S}/scripts/kconfig/merge_config.sh -m .config ${WORKDIR}/${deltacfg} | ||
54 | elif [ -f "${deltacfg}" ]; then | ||
55 | ${S}/scripts/kconfig/merge_config.sh -m .config ${deltacfg} | ||
56 | fi | ||
57 | done | ||
58 | cp .config ${WORKDIR}/defconfig | ||
59 | } | ||
60 | addtask merge_delta_config before do_preconfigure after do_copy_defconfig | ||
61 | |||
62 | COMPATIBLE_MACHINE = "(mx6|mx7|mx8)" | ||
63 |
scripts/emb_mk_yocto_sdcard/README.txt
1 | How to use the Embedian SD card creation script: | 1 | How to use the Embedian SD card creation script: |
2 | ================================================= | 2 | ================================================= |
3 | 3 | ||
4 | This utility is provided on an "AS IS" basis. | 4 | This utility is provided on an "AS IS" basis. |
5 | This is the script we use to create our recovery SD card. | 5 | This is the script we use to create our recovery SD card. |
6 | For machines with Android support, it is a part of a larger script we use to create our recovery SD card, which also includes Android. | 6 | For machines with Android support, it is a part of a larger script we use to create our recovery SD card, which also includes Android. |
7 | It is a good example for using the output of the Yocto build to create a bootable SD card, and use it to flash the target NAND flash/eMMC. | 7 | It is a good example for using the output of the Yocto build to create a bootable SD card, and use it to flash the target NAND flash/eMMC. |
8 | 8 | ||
9 | Note: | 9 | Note: |
10 | Before running this script you need to bitbake fsl-image-gui. | 10 | Before running this script you need to bitbake fsl-image-gui. |
11 | 11 | ||
12 | 12 | ||
13 | Usage: | 13 | Usage: |
14 | sudo MACHINE=<smarcimx8m2g|smarcimx8m4g> ./emb-create-yocto-sdcard.sh [options] /dev/sdX | 14 | sudo MACHINE=<smarcimx8mm2g|smarcimx8mm4g> ./emb-create-yocto-sdcard.sh [options] /dev/sdX |
15 | (Change /dev/sdX to your device name) | 15 | (Change /dev/sdX to your device name) |
16 | 16 | ||
17 | options: | 17 | options: |
18 | -h Display help message | 18 | -h Display help message |
19 | -s Only show partition sizes to be written, without actually write them | 19 | -s Only show partition sizes to be written, without actually write them |
20 | -a Automatically set the rootfs partition size to fill the SD card | 20 | -a Automatically set the rootfs partition size to fill the SD card |
21 | -r Select alternative rootfs for recovery images (default: build_x11/tmp/deploy/images/<machine name>/fsl-image-validation-imx.tar.bz2) | 21 | -r Select alternative rootfs for recovery images (default: build_x11/tmp/deploy/images/<machine name>/fsl-image-validation-imx.tar.bz2) |
22 | 22 | ||
23 | If you don't use the '-a' option, a default rootfs size of 3700MiB will be used. | 23 | If you don't use the '-a' option, a default rootfs size of 3700MiB will be used. |
24 | The '-r' option allows you to create a bootable sdcard with an alternative image for the installation to NAND flash or eMMC. | 24 | The '-r' option allows you to create a bootable sdcard with an alternative image for the installation to NAND flash or eMMC. |
25 | Example: "-r tmp/deploy/images/<machine name>/fsl-image-qt5-validation-imx" -- selects the "Qt5 image with X11" recovery image | 25 | Example: "-r tmp/deploy/images/<machine name>/fsl-image-qt5-validation-imx" -- selects the "Qt5 image with X11" recovery image |
26 | 26 | ||
27 | 27 | ||
28 | Once the script is done, use the SD card to boot, and then to flash your internal storage/s either use the icons, | 28 | Once the script is done, use the SD card to boot, and then to flash your internal storage/s either use the icons, |
29 | or the following linux shell script: | 29 | or the following linux shell script: |
30 | install_yocto.sh | 30 | install_yocto.sh |
31 | 31 |
scripts/emb_mk_yocto_sdcard/emb-create-yocto-emmc.sh
1 | #!/bin/bash -e | 1 | #!/bin/bash -e |
2 | 2 | ||
3 | blue_underlined_bold_echo() | 3 | blue_underlined_bold_echo() |
4 | { | 4 | { |
5 | echo -e "\e[34m\e[4m\e[1m$@\e[0m" | 5 | echo -e "\e[34m\e[4m\e[1m$@\e[0m" |
6 | } | 6 | } |
7 | 7 | ||
8 | blue_bold_echo() | 8 | blue_bold_echo() |
9 | { | 9 | { |
10 | echo -e "\e[34m\e[1m$@\e[0m" | 10 | echo -e "\e[34m\e[1m$@\e[0m" |
11 | } | 11 | } |
12 | 12 | ||
13 | red_bold_echo() | 13 | red_bold_echo() |
14 | { | 14 | { |
15 | echo -e "\e[31m\e[1m$@\e[0m" | 15 | echo -e "\e[31m\e[1m$@\e[0m" |
16 | } | 16 | } |
17 | 17 | ||
18 | IMGS_PATH=/opt/images/Yocto | 18 | IMGS_PATH=/opt/images/Yocto |
19 | UBOOT_IMAGE=imx-boot-sd.bin | 19 | UBOOT_IMAGE=imx-boot-sd.bin |
20 | KERNEL_IMAGE=Image | 20 | KERNEL_IMAGE=Image |
21 | ROOTFS_IMAGE=rootfs.tar.bz2 | 21 | ROOTFS_IMAGE=rootfs.tar.bz2 |
22 | BOOTLOADER_RESERVED_SIZE=2 | 22 | BOOTLOADER_RESERVED_SIZE=2 |
23 | PART1_SIZE=48 | 23 | PART1_SIZE=48 |
24 | BOOTLOADER_OFFSET=33 | 24 | BOOTLOADER_OFFSET=33 |
25 | DISPLAY=-hdmi | ||
26 | PART=p | 25 | PART=p |
27 | BOOTPART=1 | 26 | BOOTPART=1 |
28 | ROOTFSPART=2 | 27 | ROOTFSPART=2 |
29 | BOOTDIR=/boot | 28 | BOOTDIR=/boot |
30 | 29 | ||
31 | check_board() | 30 | check_board() |
32 | { | 31 | { |
33 | if grep -q "i.MX8M" /sys/devices/soc0/soc_id; then | 32 | if grep -q "i.MX8MM" /sys/devices/soc0/soc_id; then |
34 | BOARD=smarc-imx8m | 33 | BOARD=smarc-imx8mm |
35 | DTB_PREFIX=imx8mq-smarc | 34 | DTB_PREFIX=imx8mm-smarc |
36 | BLOCK=mmcblk0 | 35 | BLOCK=mmcblk0 |
37 | 36 | ||
38 | if [[ $DISPLAY != "-lvds" && $DISPLAY != "-hdmi" && \ | ||
39 | $DISPLAY != "-dual-display" && $DISPLAY != "" ]]; then | ||
40 | red_bold_echo "ERROR: invalid display, should be lvds, hdmi, dual-display or empty" | ||
41 | exit 1 | ||
42 | fi | ||
43 | else | 37 | else |
44 | red_bold_echo "ERROR: Unsupported board" | 38 | red_bold_echo "ERROR: Unsupported board" |
45 | exit 1 | 39 | exit 1 |
46 | fi | 40 | fi |
47 | 41 | ||
48 | 42 | ||
49 | if [[ ! -b /dev/${BLOCK} ]] ; then | 43 | if [[ ! -b /dev/${BLOCK} ]] ; then |
50 | red_bold_echo "ERROR: Can't find eMMC device (/dev/${BLOCK})." | 44 | red_bold_echo "ERROR: Can't find eMMC device (/dev/${BLOCK})." |
51 | red_bold_echo "Please verify you are using the correct options for your SMARC Module." | 45 | red_bold_echo "Please verify you are using the correct options for your SMARC Module." |
52 | exit 1 | 46 | exit 1 |
53 | fi | 47 | fi |
54 | } | 48 | } |
55 | 49 | ||
56 | check_images() | 50 | check_images() |
57 | { | 51 | { |
58 | if [[ ! -f $IMGS_PATH/$UBOOT_IMAGE ]] ; then | 52 | if [[ ! -f $IMGS_PATH/$UBOOT_IMAGE ]] ; then |
59 | red_bold_echo "ERROR: \"$IMGS_PATH/$UBOOT_IMAGE\" does not exist" | 53 | red_bold_echo "ERROR: \"$IMGS_PATH/$UBOOT_IMAGE\" does not exist" |
60 | exit 1 | 54 | exit 1 |
61 | fi | 55 | fi |
62 | 56 | ||
63 | if [[ ! -f $IMGS_PATH/$KERNEL_IMAGE ]] ; then | 57 | if [[ ! -f $IMGS_PATH/$KERNEL_IMAGE ]] ; then |
64 | red_bold_echo "ERROR: \"$IMGS_PATH/$KERNEL_IMAGE\" does not exist" | 58 | red_bold_echo "ERROR: \"$IMGS_PATH/$KERNEL_IMAGE\" does not exist" |
65 | exit 1 | 59 | exit 1 |
66 | fi | 60 | fi |
67 | 61 | ||
68 | if [[ ! -f $IMGS_PATH/${DTB_PREFIX}${DISPLAY}.dtb ]] ; then | 62 | if [[ ! -f $IMGS_PATH/${DTB_PREFIX}.dtb ]] ; then |
69 | red_bold_echo "ERROR: \"$IMGS_PATH/${DTB_PREFIX}${DISPLAY}.dtb\" does not exist" | 63 | red_bold_echo "ERROR: \"$IMGS_PATH/${DTB_PREFIX}.dtb\" does not exist" |
70 | exit 1 | 64 | exit 1 |
71 | fi | 65 | fi |
72 | 66 | ||
73 | if [[ ! -f $IMGS_PATH/uEnv.txt ]] ; then | 67 | if [[ ! -f $IMGS_PATH/uEnv.txt ]] ; then |
74 | red_bold_echo "ERROR: \"$IMGS_PATH/uEnv.txt\" does not exist" | 68 | red_bold_echo "ERROR: \"$IMGS_PATH/uEnv.txt\" does not exist" |
75 | exit 1 | 69 | exit 1 |
76 | fi | 70 | fi |
77 | 71 | ||
78 | if [[ ! -f $IMGS_PATH/$ROOTFS_IMAGE ]] ; then | 72 | if [[ ! -f $IMGS_PATH/$ROOTFS_IMAGE ]] ; then |
79 | red_bold_echo "ERROR: \"$IMGS_PATH/$ROOTFS_IMAGE\" does not exist" | 73 | red_bold_echo "ERROR: \"$IMGS_PATH/$ROOTFS_IMAGE\" does not exist" |
80 | exit 1 | 74 | exit 1 |
81 | fi | 75 | fi |
82 | } | 76 | } |
83 | 77 | ||
84 | delete_emmc() | 78 | delete_emmc() |
85 | { | 79 | { |
86 | echo | 80 | echo |
87 | blue_underlined_bold_echo "Deleting current partitions" | 81 | blue_underlined_bold_echo "Deleting current partitions" |
88 | 82 | ||
89 | umount /dev/${BLOCK}${PART}* 2>/dev/null || true | 83 | umount /dev/${BLOCK}${PART}* 2>/dev/null || true |
90 | 84 | ||
91 | for ((i=1; i<=16; i++)); do | 85 | for ((i=1; i<=16; i++)); do |
92 | if [[ -e /dev/${BLOCK}${PART}${i} ]]; then | 86 | if [[ -e /dev/${BLOCK}${PART}${i} ]]; then |
93 | dd if=/dev/zero of=/dev/${BLOCK}${PART}${i} bs=1M count=1 2>/dev/null || true | 87 | dd if=/dev/zero of=/dev/${BLOCK}${PART}${i} bs=1M count=1 2>/dev/null || true |
94 | fi | 88 | fi |
95 | done | 89 | done |
96 | sync | 90 | sync |
97 | 91 | ||
98 | dd if=/dev/zero of=/dev/${BLOCK} bs=1M count=${BOOTLOADER_RESERVED_SIZE} | 92 | dd if=/dev/zero of=/dev/${BLOCK} bs=1M count=${BOOTLOADER_RESERVED_SIZE} |
99 | 93 | ||
100 | sync; sleep 1 | 94 | sync; sleep 1 |
101 | } | 95 | } |
102 | 96 | ||
103 | create_emmc_parts() | 97 | create_emmc_parts() |
104 | { | 98 | { |
105 | echo | 99 | echo |
106 | blue_underlined_bold_echo "Creating new partitions" | 100 | blue_underlined_bold_echo "Creating new partitions" |
107 | 101 | ||
108 | SECT_SIZE_BYTES=`cat /sys/block/${BLOCK}/queue/hw_sector_size` | 102 | SECT_SIZE_BYTES=`cat /sys/block/${BLOCK}/queue/hw_sector_size` |
109 | PART1_FIRST_SECT=$(($BOOTLOADER_RESERVED_SIZE * 1024 * 1024 / $SECT_SIZE_BYTES)) | 103 | PART1_FIRST_SECT=$(($BOOTLOADER_RESERVED_SIZE * 1024 * 1024 / $SECT_SIZE_BYTES)) |
110 | PART1_END_SECT=$((($BOOTLOADER_RESERVED_SIZE + $PART1_SIZE) * 1024 * 1024 / $SECT_SIZE_BYTES)) | 104 | PART1_END_SECT=$((($BOOTLOADER_RESERVED_SIZE + $PART1_SIZE) * 1024 * 1024 / $SECT_SIZE_BYTES)) |
111 | PART2_FIRST_SECT=`expr ${PART1_END_SECT} + 1` | 105 | PART2_FIRST_SECT=`expr ${PART1_END_SECT} + 1` |
112 | 106 | ||
113 | (echo n; echo p; echo $BOOTPART; echo $PART1_FIRST_SECT; \ | 107 | (echo n; echo p; echo $BOOTPART; echo $PART1_FIRST_SECT; \ |
114 | echo $PART1_END_SECT; echo n; echo p; echo $ROOTFSPART; \ | 108 | echo $PART1_END_SECT; echo n; echo p; echo $ROOTFSPART; \ |
115 | echo $PART2_FIRST_SECT; echo; \ | 109 | echo $PART2_FIRST_SECT; echo; \ |
116 | echo p; echo w) | fdisk -u /dev/${BLOCK} > /dev/null | 110 | echo p; echo w) | fdisk -u /dev/${BLOCK} > /dev/null |
117 | 111 | ||
118 | sync; sleep 1 | 112 | sync; sleep 1 |
119 | fdisk -u -l /dev/${BLOCK} | 113 | fdisk -u -l /dev/${BLOCK} |
120 | } | 114 | } |
121 | 115 | ||
122 | format_emmc_parts() | 116 | format_emmc_parts() |
123 | { | 117 | { |
124 | echo | 118 | echo |
125 | blue_underlined_bold_echo "Formatting partitions" | 119 | blue_underlined_bold_echo "Formatting partitions" |
126 | 120 | ||
127 | mkfs.vfat -F 16 /dev/${BLOCK}${PART}${BOOTPART} -n boot | 121 | mkfs.vfat -F 16 /dev/${BLOCK}${PART}${BOOTPART} -n boot |
128 | mkfs.ext4 /dev/${BLOCK}${PART}${ROOTFSPART} -L rootfs | 122 | mkfs.ext4 /dev/${BLOCK}${PART}${ROOTFSPART} -L rootfs |
129 | 123 | ||
130 | sync; sleep 1 | 124 | sync; sleep 1 |
131 | } | 125 | } |
132 | 126 | ||
133 | install_bootloader_to_emmc() | 127 | install_bootloader_to_emmc() |
134 | { | 128 | { |
135 | echo | 129 | echo |
136 | blue_underlined_bold_echo "Installing booloader" | 130 | blue_underlined_bold_echo "Installing booloader" |
137 | 131 | ||
138 | dd if=${IMGS_PATH}/${UBOOT_IMAGE} of=/dev/${BLOCK} bs=1K seek=${BOOTLOADER_OFFSET} | 132 | dd if=${IMGS_PATH}/${UBOOT_IMAGE} of=/dev/${BLOCK} bs=1K seek=${BOOTLOADER_OFFSET} |
139 | sync | 133 | sync |
140 | } | 134 | } |
141 | 135 | ||
142 | install_kernel_to_emmc() | 136 | install_kernel_to_emmc() |
143 | { | 137 | { |
144 | echo | 138 | echo |
145 | blue_underlined_bold_echo "Installing kernel" | 139 | blue_underlined_bold_echo "Installing kernel" |
146 | 140 | ||
147 | MOUNTDIR=/run/media/${BLOCK}${PART}${BOOTPART} | 141 | MOUNTDIR=/run/media/${BLOCK}${PART}${BOOTPART} |
148 | mkdir -p ${MOUNTDIR} | 142 | mkdir -p ${MOUNTDIR} |
149 | mount /dev/${BLOCK}${PART}${BOOTPART} ${MOUNTDIR} | 143 | mount /dev/${BLOCK}${PART}${BOOTPART} ${MOUNTDIR} |
150 | mkdir -p ${MOUNTDIR}/dtbs/ | 144 | mkdir -p ${MOUNTDIR}/dtbs/ |
151 | cp -v ${IMGS_PATH}/${KERNEL_IMAGE} ${MOUNTDIR} | 145 | cp -v ${IMGS_PATH}/${KERNEL_IMAGE} ${MOUNTDIR} |
152 | cp -v ${IMGS_PATH}/${DTB_PREFIX}${DISPLAY}.dtb ${MOUNTDIR}/dtbs/imx8mq-smarc.dtb | 146 | cp -v ${IMGS_PATH}/${DTB_PREFIX}.dtb ${MOUNTDIR}/dtbs/imx8mm-smarc.dtb |
153 | cp -v ${IMGS_PATH}/uEnv.txt ${MOUNTDIR} | 147 | cp -v ${IMGS_PATH}/uEnv.txt ${MOUNTDIR} |
154 | 148 | ||
155 | echo | 149 | echo |
156 | sync | 150 | sync |
157 | 151 | ||
158 | umount ${MOUNTDIR} | 152 | umount ${MOUNTDIR} |
159 | } | 153 | } |
160 | 154 | ||
161 | install_rootfs_to_emmc() | 155 | install_rootfs_to_emmc() |
162 | { | 156 | { |
163 | echo | 157 | echo |
164 | blue_underlined_bold_echo "Installing rootfs" | 158 | blue_underlined_bold_echo "Installing rootfs" |
165 | 159 | ||
166 | MOUNTDIR=/run/media/${BLOCK}${PART}${ROOTFSPART} | 160 | MOUNTDIR=/run/media/${BLOCK}${PART}${ROOTFSPART} |
167 | mkdir -p ${MOUNTDIR} | 161 | mkdir -p ${MOUNTDIR} |
168 | mount /dev/${BLOCK}${PART}${ROOTFSPART} ${MOUNTDIR} | 162 | mount /dev/${BLOCK}${PART}${ROOTFSPART} ${MOUNTDIR} |
169 | 163 | ||
170 | printf "Extracting files" | 164 | printf "Extracting files" |
171 | tar --warning=no-timestamp -jxvf ${IMGS_PATH}/${ROOTFS_IMAGE} -C ${MOUNTDIR} --checkpoint=.1200 | 165 | tar --warning=no-timestamp -jxvf ${IMGS_PATH}/${ROOTFS_IMAGE} -C ${MOUNTDIR} --checkpoint=.1200 |
172 | 166 | ||
173 | # Create DTB symlink | 167 | # Create DTB symlink |
174 | (cd ${MOUNTDIR}/${BOOTDIR}; ln -fs ${DTB_PREFIX}${DISPLAY}.dtb ${DTB_PREFIX}.dtb) | 168 | (cd ${MOUNTDIR}/${BOOTDIR}; ln -fs ${DTB_PREFIX}.dtb ${DTB_PREFIX}.dtb) |
175 | 169 | ||
176 | echo | 170 | echo |
177 | sync | 171 | sync |
178 | 172 | ||
179 | umount ${MOUNTDIR} | 173 | umount ${MOUNTDIR} |
180 | } | 174 | } |
181 | 175 | ||
182 | stop_udev() | 176 | stop_udev() |
183 | { | 177 | { |
184 | if [ -f /lib/systemd/system/systemd-udevd.service ]; then | 178 | if [ -f /lib/systemd/system/systemd-udevd.service ]; then |
185 | systemctl -q mask --runtime systemd-udevd | 179 | systemctl -q mask --runtime systemd-udevd |
186 | systemctl -q stop systemd-udevd | 180 | systemctl -q stop systemd-udevd |
187 | fi | 181 | fi |
188 | } | 182 | } |
189 | 183 | ||
190 | start_udev() | 184 | start_udev() |
191 | { | 185 | { |
192 | if [ -f /lib/systemd/system/systemd-udevd.service ]; then | 186 | if [ -f /lib/systemd/system/systemd-udevd.service ]; then |
193 | systemctl -q unmask --runtime systemd-udevd | 187 | systemctl -q unmask --runtime systemd-udevd |
194 | systemctl -q start systemd-udevd | 188 | systemctl -q start systemd-udevd |
195 | fi | 189 | fi |
196 | } | 190 | } |
197 | 191 | ||
198 | usage() | 192 | usage() |
199 | { | 193 | { |
200 | echo | 194 | echo |
201 | echo "This script installs Yocto Rootfs on the SMARC-iMX8M's internal eMMC storage device" | 195 | echo "This script installs Yocto Rootfs on the SMARC-iMX8MM's internal eMMC storage device" |
202 | echo | 196 | echo |
203 | echo " Usage: $(basename $0) <option>" | 197 | echo " Usage: $(basename $0) <option>" |
204 | echo | 198 | echo |
205 | echo " options:" | 199 | echo " options:" |
206 | echo " -h show help message" | 200 | echo " -h show help message" |
207 | echo " -d <lvds|hdmi|dual-display> set display type, default is lvds" | 201 | echo " -d <lvds|hdmi|dual-display> set display type, default is lvds" |
208 | echo | 202 | echo |
209 | } | 203 | } |
210 | 204 | ||
211 | finish() | 205 | finish() |
212 | { | 206 | { |
213 | echo | 207 | echo |
214 | blue_bold_echo "Yocto Sumo installed successfully" | 208 | blue_bold_echo "Yocto Sumo installed successfully" |
215 | exit 0 | 209 | exit 0 |
216 | } | 210 | } |
217 | 211 | ||
218 | ################################################# | 212 | ################################################# |
219 | # Execution starts here # | 213 | # Execution starts here # |
220 | ################################################# | 214 | ################################################# |
221 | 215 | ||
222 | if [[ $EUID != 0 ]] ; then | 216 | if [[ $EUID != 0 ]] ; then |
223 | red_bold_echo "This script must be run with super-user privileges" | 217 | red_bold_echo "This script must be run with super-user privileges" |
224 | exit 1 | 218 | exit 1 |
225 | fi | 219 | fi |
226 | 220 | ||
227 | blue_underlined_bold_echo "*** Embedian SMARC-iMX8M on-module eMMC Recovery ***" | 221 | blue_underlined_bold_echo "*** Embedian SMARC-iMX8MM on-module eMMC Recovery ***" |
228 | echo | 222 | echo |
229 | 223 | ||
230 | while getopts d:h OPTION; | 224 | while getopts d:h OPTION; |
231 | do | 225 | do |
232 | case $OPTION in | 226 | case $OPTION in |
233 | d) | 227 | d) |
234 | DISPLAY=$OPTARG | 228 | DISPLAY=$OPTARG |
235 | ;; | 229 | ;; |
236 | h) | 230 | h) |
237 | usage | 231 | usage |
238 | exit 0 | 232 | exit 0 |
239 | ;; | 233 | ;; |
240 | *) | 234 | *) |
241 | usage | 235 | usage |
242 | exit 1 | 236 | exit 1 |
243 | ;; | 237 | ;; |
244 | esac | 238 | esac |
245 | done | 239 | done |
246 | 240 | ||
247 | printf "Board: " | 241 | printf "Board: " |
248 | blue_bold_echo $BOARD | 242 | blue_bold_echo $BOARD |
249 | 243 | ||
250 | printf "Installing to internal storage device: " | 244 | printf "Installing to internal storage device: " |
251 | blue_bold_echo eMMC | 245 | blue_bold_echo eMMC |
252 | 246 | ||
253 | check_board | 247 | check_board |
254 | check_images | 248 | check_images |
255 | stop_udev | 249 | stop_udev |
256 | delete_emmc | 250 | delete_emmc |
257 | create_emmc_parts | 251 | create_emmc_parts |
258 | format_emmc_parts | 252 | format_emmc_parts |
259 | install_bootloader_to_emmc | 253 | install_bootloader_to_emmc |
260 | install_kernel_to_emmc | 254 | install_kernel_to_emmc |
261 | install_rootfs_to_emmc | 255 | install_rootfs_to_emmc |
262 | start_udev | 256 | start_udev |
263 | finish | 257 | finish |
264 | 258 |
scripts/emb_mk_yocto_sdcard/emb-create-yocto-sdcard.sh
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | set -e | 2 | set -e |
3 | 3 | ||
4 | #### Script version #### | 4 | #### Script version #### |
5 | SCRIPT_NAME=${0##*/} | 5 | SCRIPT_NAME=${0##*/} |
6 | readonly SCRIPT_VERSION="0.7" | 6 | readonly SCRIPT_VERSION="0.7" |
7 | 7 | ||
8 | #### Exports Variables #### | 8 | #### Exports Variables #### |
9 | #### global variables #### | 9 | #### global variables #### |
10 | readonly ABSOLUTE_FILENAME=`readlink -e "$0"` | 10 | readonly ABSOLUTE_FILENAME=`readlink -e "$0"` |
11 | readonly ABSOLUTE_DIRECTORY=`dirname ${ABSOLUTE_FILENAME}` | 11 | readonly ABSOLUTE_DIRECTORY=`dirname ${ABSOLUTE_FILENAME}` |
12 | readonly SCRIPT_POINT=${ABSOLUTE_DIRECTORY} | 12 | readonly SCRIPT_POINT=${ABSOLUTE_DIRECTORY} |
13 | readonly SCRIPT_START_DATE=`date +%Y%m%d` | 13 | readonly SCRIPT_START_DATE=`date +%Y%m%d` |
14 | 14 | ||
15 | readonly YOCTO_ROOT="${SCRIPT_POINT}/../../../../" | 15 | readonly YOCTO_ROOT="${SCRIPT_POINT}/../../../../" |
16 | 16 | ||
17 | readonly BSP_TYPE="YOCTO" | 17 | readonly BSP_TYPE="YOCTO" |
18 | readonly YOCTO_BUILD=${YOCTO_ROOT}/build-qt5wayland | 18 | readonly YOCTO_BUILD=${YOCTO_ROOT}/build-qt5wayland |
19 | readonly YOCTO_DEFAULT_IMAGE=fsl-image-qt5-validation-imx | 19 | readonly YOCTO_DEFAULT_IMAGE=fsl-image-qt5-validation-imx |
20 | 20 | ||
21 | readonly YOCTO_SCRIPTS_PATH=${SCRIPT_POINT} | 21 | readonly YOCTO_SCRIPTS_PATH=${SCRIPT_POINT} |
22 | readonly YOCTO_IMGS_PATH=${YOCTO_BUILD}/tmp/deploy/images/${MACHINE} | 22 | readonly YOCTO_IMGS_PATH=${YOCTO_BUILD}/tmp/deploy/images/${MACHINE} |
23 | 23 | ||
24 | ## display (one of "-hdmi", "-lcdif-lvds", "-dp", "-dcss-lvds", "-dual-display", "-edp") | ||
25 | readonly DISPLAY="-hdmi" | ||
26 | |||
27 | # $1 -- block device | 24 | # $1 -- block device |
28 | # $2 -- output images dir | 25 | # $2 -- output images dir |
29 | readonly LPARAM_BLOCK_DEVICE=${1} | 26 | readonly LPARAM_BLOCK_DEVICE=${1} |
30 | readonly LPARAM_OUTPUT_DIR=${2} | 27 | readonly LPARAM_OUTPUT_DIR=${2} |
31 | readonly P1_MOUNT_DIR="${G_TMP_DIR}/p1" | 28 | readonly P1_MOUNT_DIR="${G_TMP_DIR}/p1" |
32 | readonly P2_MOUNT_DIR="${G_TMP_DIR}/p2" | 29 | readonly P2_MOUNT_DIR="${G_TMP_DIR}/p2" |
33 | 30 | ||
34 | readonly BOOTLOAD_RESERVE_SIZE=2 | 31 | readonly BOOTLOAD_RESERVE_SIZE=2 |
35 | readonly PART1_SIZE=48 | 32 | readonly PART1_SIZE=48 |
36 | readonly BOOTPART=1 | 33 | readonly BOOTPART=1 |
37 | readonly ROOTFSPART=2 | 34 | readonly ROOTFSPART=2 |
38 | readonly SPARE_SIZE=4 | 35 | readonly SPARE_SIZE=4 |
39 | 36 | ||
40 | # Sizes are in MiB | 37 | # Sizes are in MiB |
41 | BOOTLOADER_OFFSET=33 | 38 | BOOTLOADER_OFFSET=33 |
42 | 39 | ||
43 | AUTO_FILL_SD=0 | 40 | AUTO_FILL_SD=0 |
44 | LOOP_MAJOR=7 | 41 | LOOP_MAJOR=7 |
45 | 42 | ||
46 | # This function performs sanity check to verify that the target device is removable devise of proper size | 43 | # This function performs sanity check to verify that the target device is removable devise of proper size |
47 | function check_device() | 44 | function check_device() |
48 | { | 45 | { |
49 | # Check that parameter is a valid block device | 46 | # Check that parameter is a valid block device |
50 | if [ ! -b "$1" ]; then | 47 | if [ ! -b "$1" ]; then |
51 | echo "$1 is not a valid block device, exiting" | 48 | echo "$1 is not a valid block device, exiting" |
52 | exit 1 | 49 | exit 1 |
53 | fi | 50 | fi |
54 | 51 | ||
55 | local dev=$(basename $1) | 52 | local dev=$(basename $1) |
56 | 53 | ||
57 | # Check that /sys/block/$dev exists | 54 | # Check that /sys/block/$dev exists |
58 | if [ ! -d /sys/block/$dev ]; then | 55 | if [ ! -d /sys/block/$dev ]; then |
59 | echo "Directory /sys/block/${dev} missing, exiting" | 56 | echo "Directory /sys/block/${dev} missing, exiting" |
60 | exit 1 | 57 | exit 1 |
61 | fi | 58 | fi |
62 | 59 | ||
63 | # Get device parameters | 60 | # Get device parameters |
64 | local removable=$(cat /sys/block/${dev}/removable) | 61 | local removable=$(cat /sys/block/${dev}/removable) |
65 | local size_bytes=$((512*$(cat /sys/class/block/${dev}/size))) | 62 | local size_bytes=$((512*$(cat /sys/class/block/${dev}/size))) |
66 | local size_gb=$((size_bytes/1000000000)) | 63 | local size_gb=$((size_bytes/1000000000)) |
67 | 64 | ||
68 | # Non-removable SD card readers require additional check | 65 | # Non-removable SD card readers require additional check |
69 | if [ "${removable}" != "1" ]; then | 66 | if [ "${removable}" != "1" ]; then |
70 | local drive=$(udisksctl info -b /dev/${dev}|grep "Drive:"|cut -d"'" -f 2) | 67 | local drive=$(udisksctl info -b /dev/${dev}|grep "Drive:"|cut -d"'" -f 2) |
71 | local mediaremovable=$(gdbus call --system --dest org.freedesktop.UDisks2 \ | 68 | local mediaremovable=$(gdbus call --system --dest org.freedesktop.UDisks2 \ |
72 | --object-path ${drive} --method org.freedesktop.DBus.Properties.Get \ | 69 | --object-path ${drive} --method org.freedesktop.DBus.Properties.Get \ |
73 | org.freedesktop.UDisks2.Drive MediaRemovable) | 70 | org.freedesktop.UDisks2.Drive MediaRemovable) |
74 | if [[ "${mediaremovable}" = *"true"* ]]; then | 71 | if [[ "${mediaremovable}" = *"true"* ]]; then |
75 | removable=1 | 72 | removable=1 |
76 | fi | 73 | fi |
77 | fi | 74 | fi |
78 | 75 | ||
79 | # Check that device is either removable or loop | 76 | # Check that device is either removable or loop |
80 | if [ "$removable" != "1" -a $(stat -c '%t' /dev/$dev) != ${LOOP_MAJOR} ]; then | 77 | if [ "$removable" != "1" -a $(stat -c '%t' /dev/$dev) != ${LOOP_MAJOR} ]; then |
81 | echo "$1 is not a removable device, exiting" | 78 | echo "$1 is not a removable device, exiting" |
82 | exit 1 | 79 | exit 1 |
83 | fi | 80 | fi |
84 | 81 | ||
85 | # Check that device is attached | 82 | # Check that device is attached |
86 | if [ ${size_bytes} -eq 0 ]; then | 83 | if [ ${size_bytes} -eq 0 ]; then |
87 | echo "$1 is not attached, exiting" | 84 | echo "$1 is not attached, exiting" |
88 | exit 1 | 85 | exit 1 |
89 | fi | 86 | fi |
90 | 87 | ||
91 | # Check that device has a valid size | 88 | # Check that device has a valid size |
92 | echo "Detected removable device $1, size=${size_gb}GB" | 89 | echo "Detected removable device $1, size=${size_gb}GB" |
93 | } | 90 | } |
94 | 91 | ||
95 | YOCTO_RECOVERY_ROOTFS_PATH=${YOCTO_IMGS_PATH} | 92 | YOCTO_RECOVERY_ROOTFS_PATH=${YOCTO_IMGS_PATH} |
96 | 93 | ||
97 | echo "================================================" | 94 | echo "================================================" |
98 | echo "= Embedian recovery SD card creation script =" | 95 | echo "= Embedian recovery SD card creation script =" |
99 | echo "================================================" | 96 | echo "================================================" |
100 | 97 | ||
101 | help() { | 98 | help() { |
102 | bn=`basename $0` | 99 | bn=`basename $0` |
103 | echo " Usage: MACHINE=<smarcimx8mq2g|smarcimx8mq4g> $bn <options> device_node" | 100 | echo " Usage: MACHINE=<smarcimx8mm2g|smarcimx8mm4g> $bn <options> device_node" |
104 | echo | 101 | echo |
105 | echo " options:" | 102 | echo " options:" |
106 | echo " -h display this Help message" | 103 | echo " -h display this Help message" |
107 | echo " -s only Show partition sizes to be written, without actually write them" | 104 | echo " -s only Show partition sizes to be written, without actually write them" |
108 | echo " -a Automatically set the rootfs partition size to fill the SD card (leaving spare ${SPARE_SIZE}MiB)" | 105 | echo " -a Automatically set the rootfs partition size to fill the SD card (leaving spare ${SPARE_SIZE}MiB)" |
109 | echo " -r ROOTFS_NAME select an alternative Rootfs for recovery images" | 106 | echo " -r ROOTFS_NAME select an alternative Rootfs for recovery images" |
110 | echo " (default: \"${YOCTO_RECOVERY_ROOTFS_PATH}/${YOCTO_DEFAULT_IMAGE}\")" | 107 | echo " (default: \"${YOCTO_RECOVERY_ROOTFS_PATH}/${YOCTO_DEFAULT_IMAGE}\")" |
111 | echo " -n TEXT_FILE add a release Notes text file" | 108 | echo " -n TEXT_FILE add a release Notes text file" |
112 | echo | 109 | echo |
113 | } | 110 | } |
114 | 111 | ||
115 | if [[ $EUID -ne 0 ]] ; then | 112 | if [[ $EUID -ne 0 ]] ; then |
116 | echo "This script must be run with super-user privileges" | 113 | echo "This script must be run with super-user privileges" |
117 | exit 1 | 114 | exit 1 |
118 | fi | 115 | fi |
119 | 116 | ||
120 | if [[ $MACHINE != "smarcimx8mq2g" && $MACHINE != "smarcimx8mq4g" ]] ; then | 117 | if [[ $MACHINE != "smarcimx8mm2g" && $MACHINE != "smarcimx8mm4g" ]] ; then |
121 | help | 118 | help |
122 | exit 1 | 119 | exit 1 |
123 | fi | 120 | fi |
124 | 121 | ||
125 | 122 | ||
126 | # Parse command line | 123 | # Parse command line |
127 | moreoptions=1 | 124 | moreoptions=1 |
128 | node="na" | 125 | node="na" |
129 | cal_only=0 | 126 | cal_only=0 |
130 | 127 | ||
131 | while [ "$moreoptions" = 1 -a $# -gt 0 ]; do | 128 | while [ "$moreoptions" = 1 -a $# -gt 0 ]; do |
132 | case $1 in | 129 | case $1 in |
133 | -h) help; exit 3 ;; | 130 | -h) help; exit 3 ;; |
134 | -s) cal_only=1 ;; | 131 | -s) cal_only=1 ;; |
135 | -a) AUTO_FILL_SD=1 ;; | 132 | -a) AUTO_FILL_SD=1 ;; |
136 | -r) shift; | 133 | -r) shift; |
137 | YOCTO_RECOVERY_ROOTFS_MASK_PATH=`readlink -e "${1}.tar.bz2"`; | 134 | YOCTO_RECOVERY_ROOTFS_MASK_PATH=`readlink -e "${1}.tar.bz2"`; |
138 | YOCTO_RECOVERY_ROOTFS_PATH=`dirname ${YOCTO_RECOVERY_ROOTFS_MASK_PATH}` | 135 | YOCTO_RECOVERY_ROOTFS_PATH=`dirname ${YOCTO_RECOVERY_ROOTFS_MASK_PATH}` |
139 | YOCTO_RECOVERY_ROOTFS_BASE_IN_NAME=`basename ${1}` | 136 | YOCTO_RECOVERY_ROOTFS_BASE_IN_NAME=`basename ${1}` |
140 | ;; | 137 | ;; |
141 | -n) shift; | 138 | -n) shift; |
142 | RELEASE_NOTES_FILE=${1} | 139 | RELEASE_NOTES_FILE=${1} |
143 | ;; | 140 | ;; |
144 | *) moreoptions=0;; | 141 | *) moreoptions=0;; |
145 | esac | 142 | esac |
146 | [ "$moreoptions" = 0 ] && [ $# -gt 1 ] && help && exit 1 | 143 | [ "$moreoptions" = 0 ] && [ $# -gt 1 ] && help && exit 1 |
147 | [ "$moreoptions" = 1 ] && shift | 144 | [ "$moreoptions" = 1 ] && shift |
148 | done | 145 | done |
149 | 146 | ||
150 | part="" | 147 | part="" |
151 | if [ `echo ${LPARAM_BLOCK_DEVICE} | grep -c mmcblk` -ne 0 ]; then | 148 | if [ `echo ${LPARAM_BLOCK_DEVICE} | grep -c mmcblk` -ne 0 ]; then |
152 | part="p" | 149 | part="p" |
153 | fi | 150 | fi |
154 | 151 | ||
155 | # allow only removable/loopback devices, to protect host PC | 152 | # allow only removable/loopback devices, to protect host PC |
156 | echo "MACHINE=${MACHINE}" | 153 | echo "MACHINE=${MACHINE}" |
157 | echo "SD card rootfs: ${YOCTO_DEFAULT_IMAGE}" | 154 | echo "SD card rootfs: ${YOCTO_DEFAULT_IMAGE}" |
158 | echo "Recovery rootfs: ${YOCTO_DEFAULT_IMAGE}" | 155 | echo "Recovery rootfs: ${YOCTO_DEFAULT_IMAGE}" |
159 | echo "================================================" | 156 | echo "================================================" |
160 | check_device ${LPARAM_BLOCK_DEVICE} | 157 | check_device ${LPARAM_BLOCK_DEVICE} |
161 | echo "================================================" | 158 | echo "================================================" |
162 | read -p "Press Enter to continue" | 159 | read -p "Press Enter to continue" |
163 | 160 | ||
164 | function delete_device | 161 | function delete_device |
165 | { | 162 | { |
166 | echo | 163 | echo |
167 | echo "Deleting current partitions" | 164 | echo "Deleting current partitions" |
168 | for ((i=0; i<10; i++)) | 165 | for ((i=0; i<10; i++)) |
169 | do | 166 | do |
170 | if [ `ls ${LPARAM_BLOCK_DEVICE}${part}$i 2> /dev/null | grep -c ${LPARAM_BLOCK_DEVICE}${part}$i` -ne 0 ]; then | 167 | if [ `ls ${LPARAM_BLOCK_DEVICE}${part}$i 2> /dev/null | grep -c ${LPARAM_BLOCK_DEVICE}${part}$i` -ne 0 ]; then |
171 | dd if=/dev/zero of=${LPARAM_BLOCK_DEVICE}${part}$i bs=512 count=1024 | 168 | dd if=/dev/zero of=${LPARAM_BLOCK_DEVICE}${part}$i bs=512 count=1024 |
172 | fi | 169 | fi |
173 | done | 170 | done |
174 | sync | 171 | sync |
175 | 172 | ||
176 | ((echo d; echo 1; echo d; echo 2; echo d; echo 3; echo d; echo w) | fdisk ${LPARAM_BLOCK_DEVICE} &> /dev/null) || true | 173 | ((echo d; echo 1; echo d; echo 2; echo d; echo 3; echo d; echo w) | fdisk ${LPARAM_BLOCK_DEVICE} &> /dev/null) || true |
177 | sync | 174 | sync |
178 | 175 | ||
179 | dd if=/dev/zero of=${LPARAM_BLOCK_DEVICE} bs=1M count=160 | 176 | dd if=/dev/zero of=${LPARAM_BLOCK_DEVICE} bs=1M count=160 |
180 | sync; sleep 1 | 177 | sync; sleep 1 |
181 | } | 178 | } |
182 | 179 | ||
183 | function ceildiv | 180 | function ceildiv |
184 | { | 181 | { |
185 | local num=$1 | 182 | local num=$1 |
186 | local div=$2 | 183 | local div=$2 |
187 | echo $(( (num + div - 1) / div )) | 184 | echo $(( (num + div - 1) / div )) |
188 | } | 185 | } |
189 | 186 | ||
190 | function create_parts | 187 | function create_parts |
191 | { | 188 | { |
192 | echo | 189 | echo |
193 | echo "Creating new partitions" | 190 | echo "Creating new partitions" |
194 | # Get total card size | 191 | # Get total card size |
195 | TOTAL_SIZE=`fdisk -s ${LPARAM_BLOCK_DEVICE}` | 192 | TOTAL_SIZE=`fdisk -s ${LPARAM_BLOCK_DEVICE}` |
196 | TOTAL_SIZE=`expr ${TOTAL_SIZE} / 1024` | 193 | TOTAL_SIZE=`expr ${TOTAL_SIZE} / 1024` |
197 | ROOTFS_SIZE=`expr ${TOTAL_SIZE} - ${BOOTLOAD_RESERVE_SIZE} - ${PART1_SIZE} - ${SPARE_SIZE}` | 194 | ROOTFS_SIZE=`expr ${TOTAL_SIZE} - ${BOOTLOAD_RESERVE_SIZE} - ${PART1_SIZE} - ${SPARE_SIZE}` |
198 | 195 | ||
199 | echo "ROOT SIZE=${ROOTFS_SIZE} TOTAl SIZE=${TOTAL_SIZE}" | 196 | echo "ROOT SIZE=${ROOTFS_SIZE} TOTAl SIZE=${TOTAL_SIZE}" |
200 | 197 | ||
201 | BLOCK=`echo ${LPARAM_BLOCK_DEVICE} | cut -d "/" -f 3` | 198 | BLOCK=`echo ${LPARAM_BLOCK_DEVICE} | cut -d "/" -f 3` |
202 | SECT_SIZE_BYTES=`cat /sys/block/${BLOCK}/queue/physical_block_size` | 199 | SECT_SIZE_BYTES=`cat /sys/block/${BLOCK}/queue/physical_block_size` |
203 | 200 | ||
204 | BOOTLOAD_RESERVE_SIZE_BYTES=$((BOOTLOAD_RESERVE_SIZE * 1024 * 1024)) | 201 | BOOTLOAD_RESERVE_SIZE_BYTES=$((BOOTLOAD_RESERVE_SIZE * 1024 * 1024)) |
205 | PART1_SIZE_BYTES=$((PART1_SIZE * 1024 * 1024)) | 202 | PART1_SIZE_BYTES=$((PART1_SIZE * 1024 * 1024)) |
206 | PART1_END_BYTES=`expr ${BOOTLOAD_RESERVE_SIZE_BYTES} + ${PART1_SIZE_BYTES}` | 203 | PART1_END_BYTES=`expr ${BOOTLOAD_RESERVE_SIZE_BYTES} + ${PART1_SIZE_BYTES}` |
207 | ROOTFS_SIZE_BYTES=$((ROOTFS_SIZE * 1024 * 1024)) | 204 | ROOTFS_SIZE_BYTES=$((ROOTFS_SIZE * 1024 * 1024)) |
208 | 205 | ||
209 | PART1_FIRST_SECT=`ceildiv ${BOOTLOAD_RESERVE_SIZE_BYTES} ${SECT_SIZE_BYTES}` | 206 | PART1_FIRST_SECT=`ceildiv ${BOOTLOAD_RESERVE_SIZE_BYTES} ${SECT_SIZE_BYTES}` |
210 | PART1_END_SECT=`ceildiv ${PART1_END_BYTES} ${SECT_SIZE_BYTES}` | 207 | PART1_END_SECT=`ceildiv ${PART1_END_BYTES} ${SECT_SIZE_BYTES}` |
211 | PART2_FIRST_SECT=`expr ${PART1_END_SECT} + 1 ` | 208 | PART2_FIRST_SECT=`expr ${PART1_END_SECT} + 1 ` |
212 | 209 | ||
213 | (echo n; echo p; echo $BOOTPART; echo $PART1_FIRST_SECT; \ | 210 | (echo n; echo p; echo $BOOTPART; echo $PART1_FIRST_SECT; \ |
214 | echo $PART1_END_SECT; echo n; echo p; echo $ROOTFSPART; \ | 211 | echo $PART1_END_SECT; echo n; echo p; echo $ROOTFSPART; \ |
215 | echo $PART2_FIRST_SECT; echo; echo p; echo w) | fdisk -u ${LPARAM_BLOCK_DEVICE} > /dev/null | 212 | echo $PART2_FIRST_SECT; echo; echo p; echo w) | fdisk -u ${LPARAM_BLOCK_DEVICE} > /dev/null |
216 | 213 | ||
217 | sleep 2; sync; | 214 | sleep 2; sync; |
218 | fdisk -l ${LPARAM_BLOCK_DEVICE} | 215 | fdisk -l ${LPARAM_BLOCK_DEVICE} |
219 | 216 | ||
220 | sleep 2; sync; | 217 | sleep 2; sync; |
221 | } | 218 | } |
222 | 219 | ||
223 | function format_parts | 220 | function format_parts |
224 | { | 221 | { |
225 | echo | 222 | echo |
226 | echo "Formatting partitions" | 223 | echo "Formatting partitions" |
227 | mkfs.vfat -F 16 ${LPARAM_BLOCK_DEVICE}${part}1 -n boot | 224 | mkfs.vfat -F 16 ${LPARAM_BLOCK_DEVICE}${part}1 -n boot |
228 | mkfs.ext4 ${LPARAM_BLOCK_DEVICE}${part}2 -L rootfs | 225 | mkfs.ext4 ${LPARAM_BLOCK_DEVICE}${part}2 -L rootfs |
229 | sync; sleep 1 | 226 | sync; sleep 1 |
230 | } | 227 | } |
231 | 228 | ||
232 | function install_bootloader | 229 | function install_bootloader |
233 | { | 230 | { |
234 | echo | 231 | echo |
235 | echo "Installing U-Boot" | 232 | echo "Installing U-Boot" |
236 | dd if=${YOCTO_IMGS_PATH}/imx-boot-${MACHINE}-sd.bin-flash_evk of=${LPARAM_BLOCK_DEVICE} bs=1K seek=${BOOTLOADER_OFFSET}; sync | 233 | dd if=${YOCTO_IMGS_PATH}/imx-boot-${MACHINE}-sd.bin-flash_evk of=${LPARAM_BLOCK_DEVICE} bs=1K seek=${BOOTLOADER_OFFSET}; sync |
237 | } | 234 | } |
238 | 235 | ||
239 | function mount_parts | 236 | function mount_parts |
240 | { | 237 | { |
241 | mkdir -p ${P1_MOUNT_DIR} | 238 | mkdir -p ${P1_MOUNT_DIR} |
242 | mkdir -p ${P2_MOUNT_DIR} | 239 | mkdir -p ${P2_MOUNT_DIR} |
243 | sync | 240 | sync |
244 | 241 | ||
245 | mount ${LPARAM_BLOCK_DEVICE}${part}1 ${P1_MOUNT_DIR} | 242 | mount ${LPARAM_BLOCK_DEVICE}${part}1 ${P1_MOUNT_DIR} |
246 | mount ${LPARAM_BLOCK_DEVICE}${part}2 ${P2_MOUNT_DIR} | 243 | mount ${LPARAM_BLOCK_DEVICE}${part}2 ${P2_MOUNT_DIR} |
247 | sleep 2; sync; | 244 | sleep 2; sync; |
248 | } | 245 | } |
249 | 246 | ||
250 | function unmount_parts | 247 | function unmount_parts |
251 | { | 248 | { |
252 | umount ${P1_MOUNT_DIR} | 249 | umount ${P1_MOUNT_DIR} |
253 | umount ${P2_MOUNT_DIR} | 250 | umount ${P2_MOUNT_DIR} |
254 | 251 | ||
255 | rm -rf ${P1_MOUNT_DIR} | 252 | rm -rf ${P1_MOUNT_DIR} |
256 | rm -rf ${P2_MOUNT_DIR} | 253 | rm -rf ${P2_MOUNT_DIR} |
257 | } | 254 | } |
258 | 255 | ||
259 | function install_yocto | 256 | function install_yocto |
260 | { | 257 | { |
261 | echo | 258 | echo |
262 | echo "Flashing \"Image, device tree and uEnv.txt\" partition" | 259 | echo "Flashing \"Image, device tree and uEnv.txt\" partition" |
263 | cp -v ${YOCTO_IMGS_PATH}/Image ${P1_MOUNT_DIR}/ | 260 | cp -v ${YOCTO_IMGS_PATH}/Image ${P1_MOUNT_DIR}/ |
264 | mkdir -p ${P1_MOUNT_DIR}/dtbs/ | 261 | mkdir -p ${P1_MOUNT_DIR}/dtbs/ |
265 | cp -v ${YOCTO_IMGS_PATH}/imx8mq-smarc${DISPLAY}.dtb ${P1_MOUNT_DIR}/dtbs/imx8mq-smarc.dtb | 262 | cp -v ${YOCTO_IMGS_PATH}/imx8mm-smarc.dtb ${P1_MOUNT_DIR}/dtbs/imx8mm-smarc.dtb |
266 | cp -v ${YOCTO_SCRIPTS_PATH}/uEnv.txt ${P1_MOUNT_DIR}/ | 263 | cp -v ${YOCTO_SCRIPTS_PATH}/uEnv.txt ${P1_MOUNT_DIR}/ |
267 | 264 | ||
268 | echo | 265 | echo |
269 | echo "Installing Yocto Root File System" | 266 | echo "Installing Yocto Root File System" |
270 | tar jxvf ${YOCTO_IMGS_PATH}/${YOCTO_DEFAULT_IMAGE}-${MACHINE}.tar.bz2 -C ${P2_MOUNT_DIR}/ | 267 | tar jxvf ${YOCTO_IMGS_PATH}/${YOCTO_DEFAULT_IMAGE}-${MACHINE}.tar.bz2 -C ${P2_MOUNT_DIR}/ |
271 | sync | 268 | sync |
272 | } | 269 | } |
273 | 270 | ||
274 | function copy_images | 271 | function copy_images |
275 | { | 272 | { |
276 | echo | 273 | echo |
277 | echo "Copying Yocto images to /opt/images/" | 274 | echo "Copying Yocto images to /opt/images/" |
278 | mkdir -p ${P2_MOUNT_DIR}/opt/images/Yocto | 275 | mkdir -p ${P2_MOUNT_DIR}/opt/images/Yocto |
279 | 276 | ||
280 | # Copy image for eMMC | 277 | # Copy image for eMMC |
281 | if [ -f ${YOCTO_IMGS_PATH}/${YOCTO_DEFAULT_IMAGE}-${MACHINE}.tar.bz2 ]; then | 278 | if [ -f ${YOCTO_IMGS_PATH}/${YOCTO_DEFAULT_IMAGE}-${MACHINE}.tar.bz2 ]; then |
282 | pv ${YOCTO_IMGS_PATH}/${YOCTO_DEFAULT_IMAGE}-${MACHINE}.tar.bz2 > ${P2_MOUNT_DIR}/opt/images/Yocto/rootfs.tar.bz2 | 279 | pv ${YOCTO_IMGS_PATH}/${YOCTO_DEFAULT_IMAGE}-${MACHINE}.tar.bz2 > ${P2_MOUNT_DIR}/opt/images/Yocto/rootfs.tar.bz2 |
283 | else | 280 | else |
284 | echo "rootfs.tar.gz file is not present. Installation on \"eMMC\" will not be supported." | 281 | echo "rootfs.tar.gz file is not present. Installation on \"eMMC\" will not be supported." |
285 | fi | 282 | fi |
286 | 283 | ||
287 | echo | 284 | echo |
288 | echo "Copying Kernel Images to /opt/images/" | 285 | echo "Copying Kernel Images to /opt/images/" |
289 | cp ${YOCTO_IMGS_PATH}/Image ${P2_MOUNT_DIR}/opt/images/Yocto/Image | 286 | cp ${YOCTO_IMGS_PATH}/Image ${P2_MOUNT_DIR}/opt/images/Yocto/Image |
290 | 287 | ||
291 | echo | 288 | echo |
292 | echo "Copying Kernel Device Tree Blob to /opt/images/" | 289 | echo "Copying Kernel Device Tree Blob to /opt/images/" |
293 | cp -v ${YOCTO_IMGS_PATH}/*.dtb ${P2_MOUNT_DIR}/opt/images/Yocto/ | 290 | cp -v ${YOCTO_IMGS_PATH}/*.dtb ${P2_MOUNT_DIR}/opt/images/Yocto/ |
294 | 291 | ||
295 | echo | 292 | echo |
296 | echo "Copying Kernel Parameter uEnv.txt to /opt/images/" | 293 | echo "Copying Kernel Parameter uEnv.txt to /opt/images/" |
297 | cp -v ${YOCTO_SCRIPTS_PATH}/uEnv_emmc.txt ${P2_MOUNT_DIR}/opt/images/Yocto/uEnv.txt | 294 | cp -v ${YOCTO_SCRIPTS_PATH}/uEnv_emmc.txt ${P2_MOUNT_DIR}/opt/images/Yocto/uEnv.txt |
298 | 295 | ||
299 | if [[ $MACHINE = "smarcimx8mq2g" || ${MACHINE} = "smarcimx8mq4g" ]]; then | 296 | if [[ $MACHINE = "smarcimx8mm2g" || ${MACHINE} = "smarcimx8mm4g" ]]; then |
300 | cp ${YOCTO_IMGS_PATH}/imx-boot-${MACHINE}-sd.bin-* ${P2_MOUNT_DIR}/opt/images/Yocto | 297 | cp ${YOCTO_IMGS_PATH}/imx-boot-${MACHINE}-sd.bin-* ${P2_MOUNT_DIR}/opt/images/Yocto |
301 | (cd ${P2_MOUNT_DIR}/opt/images/Yocto; ln -fs imx-boot-${MACHINE}-sd.bin-flash_evk imx-boot-sd.bin) | 298 | (cd ${P2_MOUNT_DIR}/opt/images/Yocto; ln -fs imx-boot-${MACHINE}-sd.bin-flash_evk imx-boot-sd.bin) |
302 | else | 299 | else |
303 | cp ${YOCTO_IMGS_PATH}/imx-boot-${MACHINE}-sd.bin ${P2_MOUNT_DIR}/opt/images/Yocto/imx-boot-sd.bin | 300 | cp ${YOCTO_IMGS_PATH}/imx-boot-${MACHINE}-sd.bin ${P2_MOUNT_DIR}/opt/images/Yocto/imx-boot-sd.bin |
304 | fi | 301 | fi |
305 | } | 302 | } |
306 | 303 | ||
307 | function copy_scripts | 304 | function copy_scripts |
308 | { | 305 | { |
309 | echo | 306 | echo |
310 | echo "Copying scripts" | 307 | echo "Copying scripts" |
311 | 308 | ||
312 | cp ${YOCTO_SCRIPTS_PATH}/emb-create-yocto-emmc.sh ${P2_MOUNT_DIR}/usr/bin/ | 309 | cp ${YOCTO_SCRIPTS_PATH}/emb-create-yocto-emmc.sh ${P2_MOUNT_DIR}/usr/bin/ |
313 | } | 310 | } |
314 | 311 | ||
315 | umount ${LPARAM_BLOCK_DEVICE}${part}* 2> /dev/null || true | 312 | umount ${LPARAM_BLOCK_DEVICE}${part}* 2> /dev/null || true |
316 | 313 | ||
317 | delete_device | 314 | delete_device |
318 | create_parts | 315 | create_parts |
319 | format_parts | 316 | format_parts |
320 | 317 | ||
321 | mount_parts | 318 | mount_parts |
322 | install_yocto | 319 | install_yocto |
323 | copy_images | 320 | copy_images |
324 | copy_scripts | 321 | copy_scripts |
325 | 322 | ||
326 | echo | 323 | echo |
327 | echo "Syncing" | 324 | echo "Syncing" |
328 | sync | pv -t | 325 | sync | pv -t |
329 | 326 | ||
330 | unmount_parts | 327 | unmount_parts |
331 | 328 | ||
332 | install_bootloader | 329 | install_bootloader |
333 | 330 | ||
334 | echo | 331 | echo |
335 | echo "Done" | 332 | echo "Done" |
336 | echo "========Flash to SD card Completed!=========" | 333 | echo "========Flash to SD card Completed!=========" |
337 | 334 | ||
338 | exit 0 | 335 | exit 0 |
339 | 336 |
scripts/emb_mk_yocto_sdcard/uEnv.txt
1 | optargs="video=HDMI-A-1:1920x1080-32@60 consoleblank=0" | ||
2 | #optargs="video=HDMI-A-1:3840x2160-32@30 consoleblank=0" | ||
3 | #optargs="video=HDMI-A-1:3840x2160-32@60 consoleblank=0" | ||
4 | #console port SER3 | 1 | #console port SER3 |
5 | console=ttymxc0,115200 earlycon=ec_imx6q,0x30860000,115200 | 2 | console=ttymxc1,115200 earlycon=ec_imx6q,0x30890000,115200 |
6 | #console port SER2 | 3 | #console port SER2 |
7 | #console=ttymxc1,115200 earlycon=ec_imx6q,0x30890000,115200 | ||
8 | #console port SER1 | ||
9 | #console=ttymxc2,115200 earlycon=ec_imx6q,0x30880000,115200 | 4 | #console=ttymxc2,115200 earlycon=ec_imx6q,0x30880000,115200 |
5 | #console port SER1 | ||
6 | #console=ttymxc3,115200 earlycon=ec_imx6q,0x30a60000,115200 | ||
10 | #console port SER0 | 7 | #console port SER0 |
11 | #console=ttymxc3,115200 earlycon=ec_imx6q,0x30A60000,115200 | 8 | #console=ttymxc0,115200 earlycon=ec_imx6q,0x30860000,115200 |
12 | mmcdev=1 | 9 | mmcdev=1 |
13 | mmcpart=1 | 10 | mmcpart=1 |
14 | image=Image | 11 | image=Image |
15 | loadaddr=0x40480000 | 12 | loadaddr=0x40480000 |
16 | fdt_addr=0x43000000 | 13 | fdt_addr=0x43000000 |
17 | mmcroot=/dev/mmcblk1p2 rw | 14 | mmcroot=/dev/mmcblk1p2 rw |
18 | usbroot=/dev/sda2 rw | 15 | usbroot=/dev/sda2 rw |
19 | mmcrootfstype=ext4 rootwait fixrtc | 16 | mmcrootfstype=ext4 rootwait fixrtc |
20 | netdev=eth0 | 17 | netdev=eth0 |
21 | ethact=FEC0 | 18 | ethact=FEC0 |
22 | ipaddr=192.168.1.150 | 19 | ipaddr=192.168.1.150 |
23 | serverip=192.168.1.53 | 20 | serverip=192.168.1.53 |
24 | gatewayip=192.168.1.254 | 21 | gatewayip=192.168.1.254 |
25 | mmcargs=setenv bootargs cma=960M console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs} | 22 | mmcargs=setenv bootargs console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs} cma=400M |
26 | uenvcmd=run loadimage; run loadfdt; run mmcboot | 23 | uenvcmd=run loadimage; run loadfdt; run mmcboot |
27 | # USB Boot | 24 | # USB Boot |
28 | #usbargs=setenv bootargs console=${console} root=${usbroot} rootfstype=${mmcrootfstype} ${optargs} | 25 | #usbargs=setenv bootargs console=${console} root=${usbroot} rootfstype=${mmcrootfstype} ${optargs} |
scripts/emb_mk_yocto_sdcard/uEnv_emmc.txt
1 | optargs="video=HDMI-A-1:1920x1080-32@60 consoleblank=0" | ||
2 | #optargs="video=HDMI-A-1:3840x2160-32@30 consoleblank=0" | ||
3 | #optargs="video=HDMI-A-1:3840x2160-32@60 consoleblank=0" | ||
4 | #console port SER3 | 1 | #console port SER3 |
5 | console=ttymxc0,115200 earlycon=ec_imx6q,0x30860000,115200 | 2 | console=ttymxc1,115200 earlycon=ec_imx6q,0x30890000,115200 |
6 | #console port SER2 | 3 | #console port SER2 |
7 | #console=ttymxc1,115200 earlycon=ec_imx6q,0x30890000,115200 | ||
8 | #console port SER1 | ||
9 | #console=ttymxc2,115200 earlycon=ec_imx6q,0x30880000,115200 | 4 | #console=ttymxc2,115200 earlycon=ec_imx6q,0x30880000,115200 |
5 | #console port SER1 | ||
6 | #console=ttymxc3,115200 earlycon=ec_imx6q,0x30a60000,115200 | ||
10 | #console port SER0 | 7 | #console port SER0 |
11 | #console=ttymxc3,115200 earlycon=ec_imx6q,0x30A60000,115200 | 8 | #console=ttymxc0,115200 earlycon=ec_imx6q,0x30860000,115200 |
12 | mmcdev=0 | 9 | mmcdev=0 |
13 | mmcpart=1 | 10 | mmcpart=1 |
14 | image=Image | 11 | image=Image |
15 | loadaddr=0x40480000 | 12 | loadaddr=0x40480000 |
16 | fdt_addr=0x43000000 | 13 | fdt_addr=0x43000000 |
17 | mmcroot=/dev/mmcblk0p2 rw | 14 | mmcroot=/dev/mmcblk0p2 rw |
18 | usbroot=/dev/sda2 rw | 15 | usbroot=/dev/sda2 rw |
19 | mmcrootfstype=ext4 rootwait fixrtc | 16 | mmcrootfstype=ext4 rootwait fixrtc |
20 | netdev=eth0 | 17 | netdev=eth0 |
21 | ethact=FEC0 | 18 | ethact=FEC0 |
22 | ipaddr=192.168.1.150 | 19 | ipaddr=192.168.1.150 |
23 | serverip=192.168.1.53 | 20 | serverip=192.168.1.53 |
24 | gatewayip=192.168.1.254 | 21 | gatewayip=192.168.1.254 |
25 | mmcargs=setenv bootargs cma=960M console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs} | 22 | mmcargs=setenv bootargs console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs} cma=400M |
26 | uenvcmd=run loadimage; run loadfdt; run mmcboot | 23 | uenvcmd=run loadimage; run loadfdt; run mmcboot |
27 | # USB Boot | 24 | # USB Boot |
28 | #usbargs=setenv bootargs console=${console} root=${usbroot} rootfstype=${mmcrootfstype} ${optargs} | 25 | #usbargs=setenv bootargs console=${console} root=${usbroot} rootfstype=${mmcrootfstype} ${optargs} |