Skip to content

Commit

Permalink
freertos-variscite: Fix compile failure when do_compile is rerun
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
kraj committed Jul 26, 2023
1 parent 91661b4 commit 96862a8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion recipes-bsp/freertos-variscite/freertos-variscite.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 96862a8

Please sign in to comment.