Skip to contentSkip to conversation

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

BUG Christoph Fritz 2 participants 3 messages Apr 28, 2014

lore
Share & tools
lore
#0 lore raw

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?

Thanks
-- Christoph

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#1 lore raw

Hi Christoph,

Quoted 33 lines · Christoph Fritz

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
Quoted 3 lines

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 <[email protected]>
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.

---
 scripts/genenv | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
scripts/genenv +20 -1
index d0b0ffd..9f22ade 100755
@@ -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"
Signature · 12 lines
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 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox