diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2022-07-29 18:21:01 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-29 18:21:01 -0300 |
commit | 8b801b824e696babbe1569e8f53657f83694ce71 (patch) | |
tree | fcf9d6ff9237b85bc4109199366baede27d1e7a7 | |
parent | 10f4c0df3437696a3be3851cdc909b3d5dc94b41 (diff) | |
parent | b511d2ad3ba4b8175b68eca8410ff8cb1c7d2792 (diff) | |
download | meta-freescale-8b801b824e696babbe1569e8f53657f83694ce71.tar.gz |
Merge pull request #1153 from Freescale/backport-1141-to-kirkstone
[Backport kirkstone] Secure boot rework
-rw-r--r-- | classes/imx-boot-container.bbclass | 3 | ||||
-rw-r--r-- | conf/machine/imx8mq-evk.conf | 3 | ||||
-rw-r--r-- | conf/machine/include/imx-base.inc | 31 | ||||
-rw-r--r-- | conf/machine/include/imx8mm-evk.inc | 3 | ||||
-rw-r--r-- | conf/machine/include/imx8mn-evk.inc | 3 | ||||
-rw-r--r-- | conf/machine/include/imx8mp-evk.inc | 3 | ||||
-rw-r--r-- | recipes-bsp/imx-atf/imx-atf_2.6.bb | 16 | ||||
-rw-r--r-- | recipes-bsp/imx-mkimage/imx-boot_1.0.bb | 3 | ||||
-rw-r--r-- | recipes-bsp/u-boot/u-boot-fslc_2022.07.bb | 6 |
9 files changed, 36 insertions, 35 deletions
diff --git a/classes/imx-boot-container.bbclass b/classes/imx-boot-container.bbclass index 711bbd9e..a420b4c4 100644 --- a/classes/imx-boot-container.bbclass +++ b/classes/imx-boot-container.bbclass | |||
@@ -20,6 +20,9 @@ | |||
20 | # by variable UBOOT_PROVIDES_BOOT_CONTAINER, which is defined in the | 20 | # by variable UBOOT_PROVIDES_BOOT_CONTAINER, which is defined in the |
21 | # base machine include file (imx-base.inc), and is set to "1" when the | 21 | # base machine include file (imx-base.inc), and is set to "1" when the |
22 | # 'imx-boot-container' is present in MACHINEOVERRIDES. | 22 | # 'imx-boot-container' is present in MACHINEOVERRIDES. |
23 | # | ||
24 | # NOTE: A backwards-compatible symlink is added for 'flash.bin', named | ||
25 | # 'imx-boot', during the deployment task. | ||
23 | 26 | ||
24 | # Define ATF binary file to be deployed to the U-Boot build folder | 27 | # Define ATF binary file to be deployed to the U-Boot build folder |
25 | ATF_MACHINE_NAME = "bl31-${ATF_PLATFORM}.bin" | 28 | ATF_MACHINE_NAME = "bl31-${ATF_PLATFORM}.bin" |
diff --git a/conf/machine/imx8mq-evk.conf b/conf/machine/imx8mq-evk.conf index 1e8146a8..a2a81f4c 100644 --- a/conf/machine/imx8mq-evk.conf +++ b/conf/machine/imx8mq-evk.conf | |||
@@ -68,9 +68,6 @@ UBOOT_DTB_NAME = "imx8mq-evk.dtb" | |||
68 | # Set ATF platform name | 68 | # Set ATF platform name |
69 | ATF_PLATFORM = "imx8mq" | 69 | ATF_PLATFORM = "imx8mq" |
70 | 70 | ||
71 | # Extra firmware package name, that is required to build boot container for fslc bsp | ||
72 | IMX_EXTRA_FIRMWARE = "firmware-imx-8m" | ||
73 | |||
74 | # Set imx-mkimage boot target | 71 | # Set imx-mkimage boot target |
75 | IMXBOOT_TARGETS = "flash_evk flash_evk_no_hdmi flash_dp_evk" | 72 | IMXBOOT_TARGETS = "flash_evk flash_evk_no_hdmi flash_dp_evk" |
76 | IMX_BOOT_SOC_TARGET = "iMX8M" | 73 | IMX_BOOT_SOC_TARGET = "iMX8M" |
diff --git a/conf/machine/include/imx-base.inc b/conf/machine/include/imx-base.inc index e24e14e1..2962c9e9 100644 --- a/conf/machine/include/imx-base.inc +++ b/conf/machine/include/imx-base.inc | |||
@@ -113,6 +113,15 @@ UBOOT_PROVIDES_BOOT_CONTAINER:imx-boot-container = "1" | |||
113 | # Default TF-A provider to NXP downstream fork | 113 | # Default TF-A provider to NXP downstream fork |
114 | IMX_DEFAULT_ATF_PROVIDER ??= "imx-atf" | 114 | IMX_DEFAULT_ATF_PROVIDER ??= "imx-atf" |
115 | 115 | ||
116 | # Allow setting the UART used during the boot by ATF. | ||
117 | |||
118 | # FIXME: We should return INVALID here but currently only i.MX8M has support to override the UART | ||
119 | # base address in source code. | ||
120 | SOC_ATF_BOOT_UART_BASE = "" | ||
121 | |||
122 | SOC_ATF_BOOT_UART_BASE:mx8m-generic-bsp = "0x30890000" | ||
123 | ATF_BOOT_UART_BASE ?= "${SOC_ATF_BOOT_UART_BASE}" | ||
124 | |||
116 | PREFERRED_PROVIDER_virtual/xserver = "xserver-xorg" | 125 | PREFERRED_PROVIDER_virtual/xserver = "xserver-xorg" |
117 | XSERVER_DRIVER = "xf86-video-fbdev" | 126 | XSERVER_DRIVER = "xf86-video-fbdev" |
118 | XSERVER_DRIVER:vf-generic-bsp = "xf86-video-modesetting" | 127 | XSERVER_DRIVER:vf-generic-bsp = "xf86-video-modesetting" |
@@ -343,6 +352,12 @@ SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS:append = " \ | |||
343 | imx-test->virtual/imxvpu \ | 352 | imx-test->virtual/imxvpu \ |
344 | " | 353 | " |
345 | 354 | ||
355 | # Firmware used for boot. | ||
356 | IMX_EXTRA_FIRMWARE ?= "" | ||
357 | IMX_EXTRA_FIRMWARE:mx8-generic-bsp = "firmware-imx-8 imx-sc-firmware imx-seco" | ||
358 | IMX_EXTRA_FIRMWARE:mx8m-generic-bsp = "firmware-imx-8m" | ||
359 | IMX_EXTRA_FIRMWARE:mx8x-generic-bsp = "imx-sc-firmware imx-seco" | ||
360 | |||
346 | # Firmware | 361 | # Firmware |
347 | MACHINE_FIRMWARE ?= "" | 362 | MACHINE_FIRMWARE ?= "" |
348 | MACHINE_FIRMWARE:append:mx27-generic-bsp = " firmware-imx-vpu-imx27" | 363 | MACHINE_FIRMWARE:append:mx27-generic-bsp = " firmware-imx-vpu-imx27" |
@@ -503,22 +518,18 @@ WKS_FILE_DEPENDS ?= " \ | |||
503 | ${@bb.utils.contains('MACHINE_FEATURES', 'optee', '${OPTEE_WKS_FILE_DEPENDS}', '', d)} \ | 518 | ${@bb.utils.contains('MACHINE_FEATURES', 'optee', '${OPTEE_WKS_FILE_DEPENDS}', '', d)} \ |
504 | " | 519 | " |
505 | 520 | ||
506 | WKS_FILE_DEPENDS:append:mx8-nxp-bsp = " imx-boot" | ||
507 | WKS_FILE_DEPENDS:append:mx8m-nxp-bsp = " imx-boot" | ||
508 | |||
509 | # We need to restrict the append so we don't add this for other i.MX SoC's. | 521 | # We need to restrict the append so we don't add this for other i.MX SoC's. |
510 | # Derivatives that are not yet adopted the usage of boot container provided | 522 | # Derivatives that are not yet adopted the usage of boot container provided |
511 | # by U-Boot build are still targeted to use 'imx-boot' package provided by | 523 | # by U-Boot build are still targeted to use 'imx-boot' package provided by |
512 | # NXP. Moving those derivatives to mainline BSP would require to define an | 524 | # NXP. |
525 | # | ||
526 | # Moving those derivatives to mainline BSP would require to define an | ||
513 | # 'imx-boot-container' override, and test if the U-Boot built 'flash.bin' | 527 | # 'imx-boot-container' override, and test if the U-Boot built 'flash.bin' |
514 | # binary is used a replacement. | 528 | # binary is used a replacement. |
515 | # Note, that the results binary name of the boot container is set to 'imx-boot' | 529 | # |
530 | # NOTE: the results binary name of the boot container is set to 'imx-boot' | ||
516 | # for both NXP and Mainline BSP. | 531 | # for both NXP and Mainline BSP. |
517 | # For Mainline BSP: the 'flash.bin' boot container is renamed during the | 532 | WKS_FILE_DEPENDS:append:imx-generic-bsp:aarch64 = " \ |
518 | # deployment task extesion execution defined in imx-boot-container class. | ||
519 | # For NXP BSP: rename is done in 'imx-boot' recipe at the execution of compile | ||
520 | # task. | ||
521 | WKS_FILE_DEPENDS:append:imx-mainline-bsp:aarch64 = " \ | ||
522 | ${@oe.utils.ifelse(d.getVar('UBOOT_PROVIDES_BOOT_CONTAINER') == '0', 'imx-boot', '')} \ | 533 | ${@oe.utils.ifelse(d.getVar('UBOOT_PROVIDES_BOOT_CONTAINER') == '0', 'imx-boot', '')} \ |
523 | " | 534 | " |
524 | 535 | ||
diff --git a/conf/machine/include/imx8mm-evk.inc b/conf/machine/include/imx8mm-evk.inc index 41f7bad4..6d317f11 100644 --- a/conf/machine/include/imx8mm-evk.inc +++ b/conf/machine/include/imx8mm-evk.inc | |||
@@ -37,9 +37,6 @@ SPL_BINARY = "spl/u-boot-spl.bin" | |||
37 | 37 | ||
38 | ATF_PLATFORM = "imx8mm" | 38 | ATF_PLATFORM = "imx8mm" |
39 | 39 | ||
40 | # Extra firmware package name, that is required to build boot container for fslc bsp | ||
41 | IMX_EXTRA_FIRMWARE = "firmware-imx-8m" | ||
42 | |||
43 | IMXBOOT_TARGETS = "${@bb.utils.contains('UBOOT_CONFIG', 'fspi', '${IMXBOOT_TARGETS_BASENAME}_flexspi', '${IMXBOOT_TARGETS_BASENAME}', d)}" | 40 | IMXBOOT_TARGETS = "${@bb.utils.contains('UBOOT_CONFIG', 'fspi', '${IMXBOOT_TARGETS_BASENAME}_flexspi', '${IMXBOOT_TARGETS_BASENAME}', d)}" |
44 | 41 | ||
45 | IMX_BOOT_SOC_TARGET = "iMX8MM" | 42 | IMX_BOOT_SOC_TARGET = "iMX8MM" |
diff --git a/conf/machine/include/imx8mn-evk.inc b/conf/machine/include/imx8mn-evk.inc index 5a5b447f..2f2c02f9 100644 --- a/conf/machine/include/imx8mn-evk.inc +++ b/conf/machine/include/imx8mn-evk.inc | |||
@@ -42,9 +42,6 @@ SPL_BINARY = "spl/u-boot-spl.bin" | |||
42 | 42 | ||
43 | ATF_PLATFORM = "imx8mn" | 43 | ATF_PLATFORM = "imx8mn" |
44 | 44 | ||
45 | # Extra firmware package name, that is required to build boot container for fslc bsp | ||
46 | IMX_EXTRA_FIRMWARE = "firmware-imx-8m" | ||
47 | |||
48 | IMXBOOT_TARGETS = "${@bb.utils.contains('UBOOT_CONFIG', 'fspi', '${IMXBOOT_TARGETS_BASENAME}_flexspi', '${IMXBOOT_TARGETS_BASENAME}', d)}" | 45 | IMXBOOT_TARGETS = "${@bb.utils.contains('UBOOT_CONFIG', 'fspi', '${IMXBOOT_TARGETS_BASENAME}_flexspi', '${IMXBOOT_TARGETS_BASENAME}', d)}" |
49 | 46 | ||
50 | IMX_BOOT_SOC_TARGET = "iMX8MN" | 47 | IMX_BOOT_SOC_TARGET = "iMX8MN" |
diff --git a/conf/machine/include/imx8mp-evk.inc b/conf/machine/include/imx8mp-evk.inc index 3e98d3c1..d93557d2 100644 --- a/conf/machine/include/imx8mp-evk.inc +++ b/conf/machine/include/imx8mp-evk.inc | |||
@@ -37,9 +37,6 @@ SPL_BINARY = "spl/u-boot-spl.bin" | |||
37 | 37 | ||
38 | ATF_PLATFORM = "imx8mp" | 38 | ATF_PLATFORM = "imx8mp" |
39 | 39 | ||
40 | # Extra firmware package name, that is required to build boot container for fslc bsp | ||
41 | IMX_EXTRA_FIRMWARE = "firmware-imx-8m" | ||
42 | |||
43 | IMXBOOT_TARGETS = \ | 40 | IMXBOOT_TARGETS = \ |
44 | "${@bb.utils.contains('UBOOT_CONFIG', 'fspi', '${IMXBOOT_TARGETS_BASENAME}_flexspi', \ | 41 | "${@bb.utils.contains('UBOOT_CONFIG', 'fspi', '${IMXBOOT_TARGETS_BASENAME}_flexspi', \ |
45 | '${IMXBOOT_TARGETS_BASENAME}', d)}" | 42 | '${IMXBOOT_TARGETS_BASENAME}', d)}" |
diff --git a/recipes-bsp/imx-atf/imx-atf_2.6.bb b/recipes-bsp/imx-atf/imx-atf_2.6.bb index b0cd4d3d..194ef935 100644 --- a/recipes-bsp/imx-atf/imx-atf_2.6.bb +++ b/recipes-bsp/imx-atf/imx-atf_2.6.bb | |||
@@ -18,9 +18,11 @@ S = "${WORKDIR}/git" | |||
18 | 18 | ||
19 | inherit deploy | 19 | inherit deploy |
20 | 20 | ||
21 | BOOT_TOOLS = "imx-boot-tools" | 21 | ATF_PLATFORM ??= "INVALID" |
22 | 22 | ||
23 | ATF_PLATFORM ??= "INVALID" | 23 | # FIXME: We should return INVALID here but currently only i.MX8M has support to override the UART |
24 | # base address in source code. | ||
25 | ATF_BOOT_UART_BASE ?= "" | ||
24 | 26 | ||
25 | EXTRA_OEMAKE += " \ | 27 | EXTRA_OEMAKE += " \ |
26 | CROSS_COMPILE="${TARGET_PREFIX}" \ | 28 | CROSS_COMPILE="${TARGET_PREFIX}" \ |
@@ -34,7 +36,8 @@ AS[unexport] = "1" | |||
34 | LD[unexport] = "1" | 36 | LD[unexport] = "1" |
35 | 37 | ||
36 | # Baremetal, just need a compiler | 38 | # Baremetal, just need a compiler |
37 | DEPENDS:remove = "virtual/${TARGET_PREFIX}compilerlibs virtual/libc" | 39 | INHIBIT_DEFAULT_DEPS = "1" |
40 | DEPENDS = "virtual/${HOST_PREFIX}gcc" | ||
38 | 41 | ||
39 | BUILD_OPTEE = "${@bb.utils.contains('MACHINE_FEATURES', 'optee', 'true', 'false', d)}" | 42 | BUILD_OPTEE = "${@bb.utils.contains('MACHINE_FEATURES', 'optee', 'true', 'false', d)}" |
40 | 43 | ||
@@ -49,6 +52,11 @@ EXTRA_OEMAKE += 'LD="${@remove_options_tail(d.getVar('LD'))}"' | |||
49 | 52 | ||
50 | EXTRA_OEMAKE += 'CC="${@remove_options_tail(d.getVar('CC'))}"' | 53 | EXTRA_OEMAKE += 'CC="${@remove_options_tail(d.getVar('CC'))}"' |
51 | 54 | ||
55 | # Set the UART to use during the boot. | ||
56 | EXTRA_OEMAKE += 'IMX_BOOT_UART_BASE=${ATF_BOOT_UART_BASE}' | ||
57 | |||
58 | do_configure[noexec] = "1" | ||
59 | |||
52 | do_compile() { | 60 | do_compile() { |
53 | # Clear LDFLAGS to avoid the option -Wl recognize issue | 61 | # Clear LDFLAGS to avoid the option -Wl recognize issue |
54 | oe_runmake bl31 | 62 | oe_runmake bl31 |
@@ -68,5 +76,5 @@ do_deploy() { | |||
68 | } | 76 | } |
69 | addtask deploy after do_compile | 77 | addtask deploy after do_compile |
70 | 78 | ||
71 | PACKAGE_ARCH = "${MACHINE_SOCARCH}" | 79 | PACKAGE_ARCH = "${MACHINE_ARCH}" |
72 | COMPATIBLE_MACHINE = "(mx8-generic-bsp)" | 80 | COMPATIBLE_MACHINE = "(mx8-generic-bsp)" |
diff --git a/recipes-bsp/imx-mkimage/imx-boot_1.0.bb b/recipes-bsp/imx-mkimage/imx-boot_1.0.bb index f35561de..ae7e2638 100644 --- a/recipes-bsp/imx-mkimage/imx-boot_1.0.bb +++ b/recipes-bsp/imx-mkimage/imx-boot_1.0.bb | |||
@@ -9,9 +9,6 @@ SECTION = "BSP" | |||
9 | 9 | ||
10 | inherit use-imx-security-controller-firmware uboot-sign | 10 | inherit use-imx-security-controller-firmware uboot-sign |
11 | 11 | ||
12 | IMX_EXTRA_FIRMWARE = "firmware-imx-8 imx-sc-firmware imx-seco" | ||
13 | IMX_EXTRA_FIRMWARE:mx8m-generic-bsp = "firmware-imx-8m" | ||
14 | IMX_EXTRA_FIRMWARE:mx8x-generic-bsp = "imx-sc-firmware imx-seco" | ||
15 | DEPENDS += " \ | 12 | DEPENDS += " \ |
16 | u-boot \ | 13 | u-boot \ |
17 | ${IMX_EXTRA_FIRMWARE} \ | 14 | ${IMX_EXTRA_FIRMWARE} \ |
diff --git a/recipes-bsp/u-boot/u-boot-fslc_2022.07.bb b/recipes-bsp/u-boot/u-boot-fslc_2022.07.bb index de6d22d0..1953d788 100644 --- a/recipes-bsp/u-boot/u-boot-fslc_2022.07.bb +++ b/recipes-bsp/u-boot/u-boot-fslc_2022.07.bb | |||
@@ -10,12 +10,6 @@ inherit ${@oe.utils.ifelse(d.getVar('UBOOT_PROVIDES_BOOT_CONTAINER') == '1', 'im | |||
10 | 10 | ||
11 | DEPENDS += "bc-native dtc-native python3-setuptools-native" | 11 | DEPENDS += "bc-native dtc-native python3-setuptools-native" |
12 | 12 | ||
13 | # Location known to imx-boot component, where U-Boot artifacts | ||
14 | # should be additionally deployed. | ||
15 | # See below note above do_deploy:append:mx8m-nxp-bsp for the purpose of | ||
16 | # this delopyment location | ||
17 | BOOT_TOOLS = "imx-boot-tools" | ||
18 | |||
19 | PROVIDES += "u-boot" | 13 | PROVIDES += "u-boot" |
20 | 14 | ||
21 | B = "${WORKDIR}/build" | 15 | B = "${WORKDIR}/build" |