I get the following error message when trying to build u-boot on scarthgap:
| gcc: error: unrecognized command line option ‘-fcanon-prefix-map’; did you mean ‘-fmacro-prefix-map=’?
| make: *** [Makefile:1817: include/generated/env.in] Error 1
This is because the host compiler version on this Ubuntu version is 9.4 where this option isn’t supported.
The error stems from the following code in the Makefile in the root of the u-boot source directory:
quiet_cmd_gen_envp = ENVP $@
cmd_gen_envp =
if [ -s “$(ENV_FILE)” ]; then
$(CPP) -P $(CFLAGS) -x assembler-with-cpp -D__ASSEMBLY__
-D__UBOOT_CONFIG__
-I . -I include -I $(srctree)/include
-include linux/kconfig.h -include include/config.h
-I$(srctree)/arch/$(ARCH)/include
$< -o $@;
else
rm -f $@;
touch $@ ;
fi
include/generated/env.in: include/generated/env.txt
$(call cmd,gen_envp)
A workaround would be to add the following line to u-boot-mender.inc in line 332:
CFLAGS="${BUILD_CFLAGS}" \ BUILDCC="${BUILD_CC}" \ CROSS_COMPILE="${TARGET_PREFIX}" \
But I’m not sure if this this is correct. Honestly I don’t understand which steps need the host compiler toolchain and which steps should be using the cross compiler toolchain. Perhaps this is something which should be cleaned up in u-boot?