[meta-arm] optee-os: fix build race

Submitted by Ross Burton on July 31, 2020, 11:20 a.m. | Patch ID: 174934

Details

Message ID 20200731112011.1862712-1-ross@burtonini.com
State New
Headers show

Commit Message

Ross Burton July 31, 2020, 11:20 a.m.
From: Ross Burton <ross.burton@arm.com>

There's a rare build race where mk/conf.mk.tmp is written to before mk/
exists.  Add an explicit mkdir so that this directory is sure to exist.

Change-Id: I4e907f395679da9354d386301e7bf5da46afdbaf
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 .../optee/optee-os/missing-mkdir.patch        | 31 +++++++++++++++++++
 .../recipes-security/optee/optee-os_git.bb    |  1 +
 2 files changed, 32 insertions(+)
 create mode 100644 meta-arm/recipes-security/optee/optee-os/missing-mkdir.patch

Patch hide | download patch | download mbox

diff --git a/meta-arm/recipes-security/optee/optee-os/missing-mkdir.patch b/meta-arm/recipes-security/optee/optee-os/missing-mkdir.patch
new file mode 100644
index 0000000..db1b47f
--- /dev/null
+++ b/meta-arm/recipes-security/optee/optee-os/missing-mkdir.patch
@@ -0,0 +1,31 @@ 
+Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/4000]
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+
+From 79384a244d1972cdb02114f5cde6fcaf2e014c9b Mon Sep 17 00:00:00 2001
+From: Jerome Forissier <jerome@forissier.org>
+Date: Tue, 28 Jul 2020 17:28:43 +0200
+Subject: [PATCH] build: fix race when generating conf.mk
+
+This patch fixes the following error triggered by a heavily parallel build:
+
+ echo sm := ta_arm64 > .../export-ta_arm64/mk/conf.mk.tmp
+ /bin/bash: .../export-ta_arm64/mk/conf.mk.tmp: No such file or directory
+
+Fixes: https://github.com/OP-TEE/optee_os/issues/3999
+Signed-off-by: Jerome Forissier <jerome@forissier.org>
+---
+ ta/ta.mk | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/ta/ta.mk b/ta/ta.mk
+index 59ed87f71d..ad97edaf08 100644
+--- a/ta/ta.mk
++++ b/ta/ta.mk
+@@ -190,6 +190,7 @@ define mk-file-export
+ .PHONY: $(conf-mk-file-export)
+ $(conf-mk-file-export):
+ 	@$$(cmd-echo-silent) '  CHK    ' $$@
++	$(q)mkdir -p $$(dir $$@)
+ 	$(q)echo sm := $$(sm-$(conf-mk-file-export)) > $$@.tmp
+ 	$(q)echo sm-$$(sm-$(conf-mk-file-export)) := y >> $$@.tmp
+ 	$(q)($$(foreach v, $$(ta-mk-file-export-vars-$$(sm-$(conf-mk-file-export))), \
diff --git a/meta-arm/recipes-security/optee/optee-os_git.bb b/meta-arm/recipes-security/optee/optee-os_git.bb
index 52c1155..deeb515 100644
--- a/meta-arm/recipes-security/optee/optee-os_git.bb
+++ b/meta-arm/recipes-security/optee/optee-os_git.bb
@@ -21,6 +21,7 @@  SRC_URI = " \
     file://0004-Cleanup-unused-comp-cflags-sm-from-libgcc-lookup-com.patch \
     file://0005-Fixup-Allow-use-of-cc-option-in-core-arch-arm-arm.mk.patch \
     file://0006-allow-setting-sysroot-for-libgcc-lookup.patch \
+    file://missing-mkdir.patch \
 "
 
 S = "${WORKDIR}/git"

Comments

Jon Mason July 31, 2020, 2:06 p.m.
On Fri, Jul 31, 2020 at 12:20:11PM +0100, Ross Burton wrote:
> From: Ross Burton <ross.burton@arm.com>
> 
> There's a rare build race where mk/conf.mk.tmp is written to before mk/
> exists.  Add an explicit mkdir so that this directory is sure to exist.
> 
> Change-Id: I4e907f395679da9354d386301e7bf5da46afdbaf
> Signed-off-by: Ross Burton <ross.burton@arm.com>

Pulled into master.

Thanks,
Jon

> ---
>  .../optee/optee-os/missing-mkdir.patch        | 31 +++++++++++++++++++
>  .../recipes-security/optee/optee-os_git.bb    |  1 +
>  2 files changed, 32 insertions(+)
>  create mode 100644 meta-arm/recipes-security/optee/optee-os/missing-mkdir.patch
> 
> diff --git a/meta-arm/recipes-security/optee/optee-os/missing-mkdir.patch b/meta-arm/recipes-security/optee/optee-os/missing-mkdir.patch
> new file mode 100644
> index 0000000..db1b47f
> --- /dev/null
> +++ b/meta-arm/recipes-security/optee/optee-os/missing-mkdir.patch
> @@ -0,0 +1,31 @@
> +Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/4000]
> +Signed-off-by: Ross Burton <ross.burton@arm.com>
> +
> +From 79384a244d1972cdb02114f5cde6fcaf2e014c9b Mon Sep 17 00:00:00 2001
> +From: Jerome Forissier <jerome@forissier.org>
> +Date: Tue, 28 Jul 2020 17:28:43 +0200
> +Subject: [PATCH] build: fix race when generating conf.mk
> +
> +This patch fixes the following error triggered by a heavily parallel build:
> +
> + echo sm := ta_arm64 > .../export-ta_arm64/mk/conf.mk.tmp
> + /bin/bash: .../export-ta_arm64/mk/conf.mk.tmp: No such file or directory
> +
> +Fixes: https://github.com/OP-TEE/optee_os/issues/3999
> +Signed-off-by: Jerome Forissier <jerome@forissier.org>
> +---
> + ta/ta.mk | 1 +
> + 1 file changed, 1 insertion(+)
> +
> +diff --git a/ta/ta.mk b/ta/ta.mk
> +index 59ed87f71d..ad97edaf08 100644
> +--- a/ta/ta.mk
> ++++ b/ta/ta.mk
> +@@ -190,6 +190,7 @@ define mk-file-export
> + .PHONY: $(conf-mk-file-export)
> + $(conf-mk-file-export):
> + 	@$$(cmd-echo-silent) '  CHK    ' $$@
> ++	$(q)mkdir -p $$(dir $$@)
> + 	$(q)echo sm := $$(sm-$(conf-mk-file-export)) > $$@.tmp
> + 	$(q)echo sm-$$(sm-$(conf-mk-file-export)) := y >> $$@.tmp
> + 	$(q)($$(foreach v, $$(ta-mk-file-export-vars-$$(sm-$(conf-mk-file-export))), \
> diff --git a/meta-arm/recipes-security/optee/optee-os_git.bb b/meta-arm/recipes-security/optee/optee-os_git.bb
> index 52c1155..deeb515 100644
> --- a/meta-arm/recipes-security/optee/optee-os_git.bb
> +++ b/meta-arm/recipes-security/optee/optee-os_git.bb
> @@ -21,6 +21,7 @@ SRC_URI = " \
>      file://0004-Cleanup-unused-comp-cflags-sm-from-libgcc-lookup-com.patch \
>      file://0005-Fixup-Allow-use-of-cc-option-in-core-arch-arm-arm.mk.patch \
>      file://0006-allow-setting-sysroot-for-libgcc-lookup.patch \
> +    file://missing-mkdir.patch \
>  "
>  
>  S = "${WORKDIR}/git"
> -- 
> 2.26.2
> 

>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#941): https://lists.yoctoproject.org/g/meta-arm/message/941
Mute This Topic: https://lists.yoctoproject.org/mt/75904953/3617530
Group Owner: meta-arm+owner@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/meta-arm/unsub  [oe-patchwork@oe-patch.openembedded.org]
-=-=-=-=-=-=-=-=-=-=-=-