[BUG] Fail to build: "cp: target `defaultenv/barebox_default_env.genenv.tmp' is not a directory"

Sascha Hauer s.hauer at pengutronix.de
Mon Apr 28 04:00:39 PDT 2014


Hi Christoph,

On Mon, Apr 28, 2014 at 12:03:47PM +0200, Christoph Fritz wrote:
> Hi,
> 
>  while building current Barebox, with out-of-tree make parameter O=,
> there is an error which leads to lack of environment in final image. The
> build process itself falsely doesn't get interrupted.
> 
> 
> make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-cortexa8-linux-gnueabihf- O=../o_beagle omap3530_beagle_defconfig
> make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-cortexa8-linux-gnueabihf- O=../o_beagle
> 
>   CC      drivers/of/mem_generic.o
>   ENV     defaultenv/barebox_default_env
>   CC      drivers/of/partition.o
> cp: target `defaultenv/barebox_default_env.genenv.tmp' is not a directory
>   ENV     defaultenv/defaultenv-2-base.bbenv
>   CC      commands/automount.o
> cp: target `defaultenv/defaultenv-2-base.bbenv.genenv.tmp' is not a directory
>   CC      commands/global.o
> 
> 
> in contrast to:
> 
> make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-cortexa8-linux-gnueabihf- omap3530_beagle_defconfig
> make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-cortexa8-linux-gnueabihf-
> 
>   AS      arch/arm/lib/memcpy.o
>   LD      arch/arm/mach-omap/built-in.o
>   ENV     defaultenv/defaultenv-2-base.bbenv
>   PBLLD   arch/arm/mach-omap/built-in-pbl.o
>   CC      drivers/usb/core/usb.o
>   ENVH    defaultenv/barebox_default_env.h
> 
> 
> I haven't done bisecting, but barebox-2013.07 is fine.
> 
> Any ideas?

I can confirm this. Could you try the attached patch?

Sascha

----------------------------8<-----------------------

>From 08786dce36d9b6a317d927eba6ac0f41a8b3280e Mon Sep 17 00:00:00 2001
From: Sascha Hauer <s.hauer at pengutronix.de>
Date: Mon, 28 Apr 2014 12:46:06 +0200
Subject: [PATCH] genenv: fix tempdir creation when target is a relative path

when $target is a path relative to $objtree the script fails.
This is because we cd to $basedir and then copy to $tempdir which
then is no longer valid. Fix this by converting $tempdir to an
absolute path first.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 scripts/genenv | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/scripts/genenv b/scripts/genenv
index d0b0ffd..9f22ade 100755
--- a/scripts/genenv
+++ b/scripts/genenv
@@ -10,7 +10,26 @@ basedir=$1
 target=$3
 shift 3
 
-tempdir="${target}.genenv.tmp"
+abspath() {
+	local fn dn
+	if [ $# -ne 1 ]; then
+		echo "usage: ptxd_abspath <path>"
+		exit 1
+	fi
+	if [ -d "${1}" ]; then
+		fn=""
+		dn="${1}"
+	else
+		fn="/$(basename "${1}")"
+		dn="$(dirname "${1}")"
+	fi
+
+	[ ! -d "${dn}" ] && exit 1
+	echo "$(cd "${dn}" && pwd)${fn}"
+}
+export -f abspath
+
+tempdir=$(abspath "${target}.genenv.tmp")
 tmpfile="$(mktemp)"
 
 mkdir -p "$tempdir"
-- 
1.9.1

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list