From 96862a8cf399d4e6dc7ec8de89ebd3bc8be0b9be Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Tue, 25 Jul 2023 13:49:00 -0700 Subject: [PATCH] freertos-variscite: Fix compile failure when do_compile is rerun MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit do_compile could be rerun on a previous built tree, the do_compile of this recipe however is doing recursive copying of files, cp -r cmd as specified first time will create disable_cache directory and then copy the contents of hello_world/ directory not the top level hello_world/ itself. So after first run it looks like % ls -l /mnt/b/yoe/master/build/tmp/work/imx8qm_var_som-yoe-linux/freertos-variscite/2.9.x-r0/git/boards/som_mx8qm/demo_apps/disable_cache total 12K drwxr-xr-x 3 kraj kraj 4.0K Jul 25 20:30 cm4_core0/ drwxr-xr-x 3 kraj kraj 4.0K Jul 25 20:30 cm4_core1/ However on rebuild do_compile is executed again and this time disable_cache folder is already existing and this time cp -r will copy complete hello_world/ folder under disable_cache/ so it looks like % ls -l /mnt/b/yoe/master/build/tmp/work/imx8qm_var_som-yoe-linux/freertos-variscite/2.9.x-r0/git/boards/som_mx8qm/demo_apps/disable_cache total 12K drwxr-xr-x 3 kraj kraj 4.0K Jul 25 20:30 cm4_core0/ drwxr-xr-x 3 kraj kraj 4.0K Jul 25 20:30 cm4_core1/ drwxr-xr-x 4 kraj kraj 4.0K Jul 25 20:26 hello_world/ and then find cmd goes wrong | find: ‘/mnt/b/yoe/master/build/tmp/work/imx8qm_var_som-yoe-linux/freertos-variscite/2.9.x-r0/git/boards/som_mx8qm/demo_apps/disable_cache/hello_world’: No such file or directory | WARNING: /mnt/b/yoe/master/build/tmp/work/imx8qm_var_som-yoe-linux/freertos-variscite/2.9.x-r0/temp/run.do_compile.406532:151 exit 1 from 'find /mnt/b/yoe/master/build/tmp/work/imx8qm_var_ som-yoe-linux/freertos-variscite/2.9.x-r0/git/boards/som_mx8qm/demo_apps/disable_cache/ -name '*hello_world*' -exec sh -c 'mv "$1" "$(echo "$1" | sed s/hello_world/disable_cache/)"' _ {} \;' To fix this we make cp -r consistent by explicitly creating disable_cache/ folder and copying whats inside hello_world/ with -u option which will only replace them if source file is newer. This fixes the second rebuild issue Signed-off-by: Khem Raj --- recipes-bsp/freertos-variscite/freertos-variscite.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes-bsp/freertos-variscite/freertos-variscite.inc b/recipes-bsp/freertos-variscite/freertos-variscite.inc index e58d4e43..0cb14b88 100644 --- a/recipes-bsp/freertos-variscite/freertos-variscite.inc +++ b/recipes-bsp/freertos-variscite/freertos-variscite.inc @@ -99,7 +99,8 @@ do_compile() { # Copy and patch hello_world demo to disable_cache demo if [ -e "${WORKDIR}/${DISABLE_CACHE_PATCH}" ]; then # Copy hello_world demo - cp -r ${S}/boards/${CM_BOARD}/demo_apps/hello_world/ ${S}/boards/${CM_BOARD}/demo_apps/disable_cache + mkdir -p ${S}/boards/${CM_BOARD}/demo_apps/disable_cache + cp -ru ${S}/boards/${CM_BOARD}/demo_apps/hello_world/* ${S}/boards/${CM_BOARD}/demo_apps/disable_cache/ # Rename hello_world strings to disable_cache grep -rl hello_world ${S}/boards/${CM_BOARD}/demo_apps/disable_cache | xargs sed -i 's/hello_world/disable_cache/g' # Rename hello_world files to disable_cache