Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

U-Boot calculates wrong version string #33

Open
Toasterson opened this issue Dec 20, 2023 · 5 comments
Open

U-Boot calculates wrong version string #33

Toasterson opened this issue Dec 20, 2023 · 5 comments

Comments

@Toasterson
Copy link
Contributor

When I try to do make setup the u-boot script seems to calculate the wrong version string

mkdir -p /var/lib/abuild/arm64-gate/build/u-boot && \
gmake -C /var/lib/abuild/arm64-gate/src/u-boot V=1 O=/var/lib/abuild/arm64-gate/build/u-boot \
    HOSTCC="gcc -m64"                                    HOSTCFLAGS="-I/opt/ooce/include"                        HOSTLDLIBS="-L/opt/ooce/lib/amd64 -lnsl -lsocket" sandbox_defconfig && \
gmake -C /var/lib/abuild/arm64-gate/src/u-boot V=1 O=/var/lib/abuild/arm64-gate/build/u-boot \
    HOSTCC="gcc -m64"                                    HOSTCFLAGS="-I/opt/ooce/include"                        HOSTLDLIBS="-L/opt/ooce/lib/amd64 -lnsl -lsocket" tools && \
touch /var/lib/abuild/arm64-gate/stamps/u-boot-stamp
gmake[1]: Entering directory '/var/lib/abuild/arm64-gate/src/u-boot'
gmake -C /var/lib/abuild/arm64-gate/build/u-boot KBUILD_SRC=/var/lib/abuild/arm64-gate/src/u-boot \
-f /var/lib/abuild/arm64-gate/src/u-boot/Makefile sandbox_defconfig
gmake[2]: Entering directory '/var/lib/abuild/arm64-gate/build/u-boot'
gmake -f /var/lib/abuild/arm64-gate/src/u-boot/scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
ln -fsn /var/lib/abuild/arm64-gate/src/u-boot source
/bin/bash /var/lib/abuild/arm64-gate/src/u-boot/scripts/mkmakefile /var/lib/abuild/arm64-gate/src/u-boot
  GEN     Makefile
gmake -f /var/lib/abuild/arm64-gate/src/u-boot/scripts/Makefile.build obj=scripts/kconfig sandbox_defconfig
scripts/kconfig/conf  --defconfig=arch/../configs/sandbox_defconfig Kconfig
#
# configuration written to .config
#
gmake[2]: Leaving directory '/var/lib/abuild/arm64-gate/build/u-boot'
gmake[1]: Leaving directory '/var/lib/abuild/arm64-gate/src/u-boot'
gmake[1]: Entering directory '/var/lib/abuild/arm64-gate/src/u-boot'
gmake -C /var/lib/abuild/arm64-gate/build/u-boot KBUILD_SRC=/var/lib/abuild/arm64-gate/src/u-boot \
-f /var/lib/abuild/arm64-gate/src/u-boot/Makefile tools
gmake[2]: Entering directory '/var/lib/abuild/arm64-gate/build/u-boot'
gmake -f /var/lib/abuild/arm64-gate/src/u-boot/Makefile syncconfig
gmake -f /var/lib/abuild/arm64-gate/src/u-boot/scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
ln -fsn /var/lib/abuild/arm64-gate/src/u-boot source
/bin/bash /var/lib/abuild/arm64-gate/src/u-boot/scripts/mkmakefile /var/lib/abuild/arm64-gate/src/u-boot
  GEN     Makefile
gmake -f /var/lib/abuild/arm64-gate/src/u-boot/scripts/Makefile.build obj=scripts/kconfig syncconfig
scripts/kconfig/conf  --syncconfig Kconfig
gmake -f /var/lib/abuild/arm64-gate/src/u-boot/scripts/Makefile.autoconf || \
        { rm -f include/config/auto.conf; false; }
set -e; mkdir -p include/;      (echo "/* Automatically generated - do not edit */"; echo \#define CONFIG_BOARDDIR board/sandbox; echo \#include \<config_uncmd_spl.h\>; echo \#include \<configs/"sandbox".h\>; echo \#include \<asm/config.h\>; echo \#include \<linux/kconfig.h\>; echo \#include \<config_fallbacks.h\>;) < /var/lib/abuild/arm64-gate/src/u-boot/scripts/Makefile.autoconf > include/config.h.tmp; if [ -r include/config.h ] && cmp -s include/config.h include/config.h.tmp; then rm -f include/config.h.tmp; else : '  UPD     include/config.h'; mv -f include/config.h.tmp include/config.h; fi
  gcc -E -Wall -Wstrict-prototypes -Wno-format-security -fno-builtin -ffreestanding -std=gnu11 -fshort-wchar -fno-strict-aliasing -fno-PIE -Os -flto=63 -fstack-protector-strong -fno-delete-null-pointer-checks -Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-maybe-uninitialized -fmacro-prefix-map=/var/lib/abuild/arm64-gate/src/u-boot/= -g -fstack-usage -Wno-format-nonliteral -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=date-time -Wno-packed-not-aligned  -D__KERNEL__ -D__UBOOT__ -D__SANDBOX__ -U_FORTIFY_SOURCE -fPIC -I/usr/include/SDL2 -D_REENTRANT -pipe -Iinclude  -I/var/lib/abuild/arm64-gate/src/u-boot/include -I/var/lib/abuild/arm64-gate/src/u-boot/arch/sandbox/include -include /var/lib/abuild/arm64-gate/src/u-boot/include/linux/kconfig.h -nostdinc -isystem /usr/gcc/13/lib/gcc/x86_64-pc-solaris2.11/13.2.0/include  -DDO_DEPS_ONLY -dM /var/lib/abuild/arm64-gate/src/u-boot/include/common.h > u-boot.cfg.tmp && { grep 'define CONFIG_' u-boot.cfg.tmp | sed '/define CONFIG_IS_ENABLED(/d;/define CONFIG_IF_ENABLED_INT(/d;/define CONFIG_VAL(/d;' > u-boot.cfg; rm u-boot.cfg.tmp; } || { rm u-boot.cfg.tmp; false; }
  sed -n -f /var/lib/abuild/arm64-gate/src/u-boot/tools/scripts/define2mk.sed u-boot.cfg | while read line; do if [ -n "" ] || ! grep -q "${line%=*}=" include/config/auto.conf; then echo "$line"; fi; done > include/autoconf.mk
  gcc -x c -DDO_DEPS_ONLY -M -MP -Wall -Wstrict-prototypes -Wno-format-security -fno-builtin -ffreestanding -std=gnu11 -fshort-wchar -fno-strict-aliasing -fno-PIE -Os -flto=63 -fstack-protector-strong -fno-delete-null-pointer-checks -Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-maybe-uninitialized -fmacro-prefix-map=/var/lib/abuild/arm64-gate/src/u-boot/= -g -fstack-usage -Wno-format-nonliteral -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=date-time -Wno-packed-not-aligned  -D__KERNEL__ -D__UBOOT__ -D__SANDBOX__ -U_FORTIFY_SOURCE -fPIC -I/usr/include/SDL2 -D_REENTRANT -pipe -Iinclude  -I/var/lib/abuild/arm64-gate/src/u-boot/include -I/var/lib/abuild/arm64-gate/src/u-boot/arch/sandbox/include -include /var/lib/abuild/arm64-gate/src/u-boot/include/linux/kconfig.h -nostdinc -isystem /usr/gcc/13/lib/gcc/x86_64-pc-solaris2.11/13.2.0/include -MQ include/config/auto.conf /var/lib/abuild/arm64-gate/src/u-boot/include/common.h > include/autoconf.mk.dep || { rm include/autoconf.mk.dep; false; }
touch include/config/auto.conf
set -e; mkdir -p include/config/;       echo "2022.10$(/bin/bash /var/lib/abuild/arm64-gate/src/u-boot/scripts/setlocalversion /var/lib/abuild/arm64-gate/src/u-boot)" < include/config/auto.conf > include/config/uboot.release.tmp; if [ -r include/config/uboot.release ] && cmp -s include/config/uboot.release include/config/uboot.release.tmp; then rm -f include/config/uboot.release.tmp; else : '  UPD     include/config/uboot.release'; mv -f include/config/uboot.release.tmp include/config/uboot.release; fi
if [ -f /var/lib/abuild/arm64-gate/src/u-boot/.config -o -d /var/lib/abuild/arm64-gate/src/u-boot/include/config ]; then \
        echo >&2 "  /var/lib/abuild/arm64-gate/src/u-boot is not clean, please run 'make mrproper'"; \
        echo >&2 "  in the '/var/lib/abuild/arm64-gate/src/u-boot' directory.";\
        /bin/false; \
fi;
ln -fsn /var/lib/abuild/arm64-gate/src/u-boot source
/bin/bash /var/lib/abuild/arm64-gate/src/u-boot/scripts/mkmakefile /var/lib/abuild/arm64-gate/src/u-boot
  GEN     Makefile
set -e; mkdir -p include/generated/;    (echo \#define PLAIN_VERSION \"2022.10-dirty\"; echo \#define U_BOOT_VERSION \"U-Boot \" PLAIN_VERSION; echo \#define U_BOOT_VERSION_NUM 2022; echo \#define U_BOOT_VERSION_NUM_PATCH $(echo 10 | sed -e "s/^0*//"); echo \#define CC_VERSION_STRING \"$(LC_ALL=C gcc --version | head -n 1)\"; echo \#define LD_VERSION_STRING \"$(LC_ALL=C ld.bfd --version | head -n 1)\"; ) < include/config/uboot.release > include/generated/version_autogenerated.h.tmp; if [ -r include/generated/version_autogenerated.h ] && cmp -s include/generated/version_autogenerated.h include/generated/version_autogenerated.h.tmp; then rm -f include/generated/version_autogenerated.h.tmp; else : '  UPD     include/generated/version_autogenerated.h'; mv -f include/generated/version_autogenerated.h.tmp include/generated/version_autogenerated.h; fi
set -e; mkdir -p include/generated/;    (if test -n "${SOURCE_DATE_EPOCH}"; then SOURCE_DATE="@${SOURCE_DATE_EPOCH}"; DATE=""; for date in gdate date.gnu date; do ${date} -u -d "${SOURCE_DATE}" >/dev/null 2>&1 && DATE="${date}"; done; if test -n "${DATE}"; then LC_ALL=C ${DATE} -u -d "${SOURCE_DATE}" +'#define U_BOOT_DATE "%b %d %C%y"'; LC_ALL=C ${DATE} -u -d "${SOURCE_DATE}" +'#define U_BOOT_TIME "%T"'; LC_ALL=C ${DATE} -u -d "${SOURCE_DATE}" +'#define U_BOOT_TZ "%z"'; LC_ALL=C ${DATE} -u -d "${SOURCE_DATE}" +'#define U_BOOT_EPOCH %s'; else return 42; fi; else LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"'; LC_ALL=C date +'#define U_BOOT_TIME "%T"'; LC_ALL=C date +'#define U_BOOT_TZ "%z"'; LC_ALL=C date +'#define U_BOOT_EPOCH %s'; fi) < /var/lib/abuild/arm64-gate/src/u-boot/Makefile > include/generated/timestamp_autogenerated.h.tmp; if [ -r include/generated/timestamp_autogenerated.h ] && cmp -s include/generated/timestamp_autogenerated.h include/generated/timestamp_autogenerated.h.tmp; then rm -f include/generated/timestamp_autogenerated.h.tmp; else : '  UPD     include/generated/timestamp_autogenerated.h'; mv -f include/generated/timestamp_autogenerated.h.tmp include/generated/timestamp_autogenerated.h; fi
set -e; mkdir -p include/generated/;    (if test -n "${DEVICE_TREE}"; then echo \#define DEVICE_TREE \"\"; else echo \#define DEVICE_TREE CONFIG_DEFAULT_DEVICE_TREE; fi) < /var/lib/abuild/arm64-gate/src/u-boot/Makefile > include/generated/dt.h.tmp; if [ -r include/generated/dt.h ] && cmp -s include/generated/dt.h include/generated/dt.h.tmp; then rm -f include/generated/dt.h.tmp; else : '  UPD     include/generated/dt.h'; mv -f include/generated/dt.h.tmp include/generated/dt.h; fi
  if [ -f "/var/lib/abuild/arm64-gate/src/u-boot/board/sandbox/sandbox.env" ]; then cat /var/lib/abuild/arm64-gate/src/u-boot/board/sandbox/sandbox.env > include/generated/env.txt; elif [ -n "" ]; then echo "Missing file /var/lib/abuild/arm64-gate/src/u-boot/board/sandbox/.env"; else touch include/generated/env.txt ; fi
  if [ -s "/var/lib/abuild/arm64-gate/src/u-boot/board/sandbox/sandbox.env" ]; then gcc -E -P  -x assembler-with-cpp -D__ASSEMBLY__ -D__UBOOT_CONFIG__ -I . -I include -I /var/lib/abuild/arm64-gate/src/u-boot/include -include linux/kconfig.h -include include/config.h -I/var/lib/abuild/arm64-gate/src/u-boot/arch/sandbox/include include/generated/env.txt -o include/generated/env.in; else rm -f include/generated/env.in; touch include/generated/env.in ; fi
  awk -f /var/lib/abuild/arm64-gate/src/u-boot/scripts/env2string.awk include/generated/env.in >include/generated/environment.h
gmake -f /var/lib/abuild/arm64-gate/src/u-boot/scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
gmake -f /var/lib/abuild/arm64-gate/src/u-boot/scripts/Makefile.build obj=.
set -e; mkdir -p include/generated/;    (set -e; echo "#ifndef __GENERIC_ASM_OFFSETS_H__"; echo "#define __GENERIC_ASM_OFFSETS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by Kbuild"; echo " */"; echo ""; sed -ne     "s:[[:space:]]*\.ascii[[:space:]]*\"\(.*\)\":\1:; /^->/{s:->#\(.*\):/* \1 */:; s:^->\([^ ]*\) [\$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; echo ""; echo "#endif" ) < lib/asm-offsets.s > include/generated/generic-asm-offsets.h.tmp; if [ -r include/generated/generic-asm-offsets.h ] && cmp -s include/generated/generic-asm-offsets.h include/generated/generic-asm-offsets.h.tmp; then rm -f include/generated/generic-asm-offsets.h.tmp; else : '  UPD     include/generated/generic-asm-offsets.h'; mv -f include/generated/generic-asm-offsets.h.tmp include/generated/generic-asm-offsets.h; fi
if test "./scripts/dtc/dtc" = "./scripts/dtc/dtc"; then \
        gmake -f /var/lib/abuild/arm64-gate/src/u-boot/scripts/Makefile.build obj=scripts/dtc; \
else \
        if ! ./scripts/dtc/dtc -v >/dev/null; then \
                echo '*** Failed to check dtc version: ./scripts/dtc/dtc'; \
                false; \
        else \
                if test "Error: Cannot find dtc: ./scripts/dtc/dtc" -lt 010406; then \
                        echo '*** Your dtc is too old, please upgrade to dtc 010406 or newer'; \
                        false; \
                else \
                        if [ -n "y" ]; then \
                                if ! echo "import libfdt" | python3 2>/dev/null; then \
                                        echo '*** pylibfdt does not seem to be available with python3'; \
                                        false; \
                                fi; \
                        fi; \
                fi; \
        fi; \
fi
gmake -f /var/lib/abuild/arm64-gate/src/u-boot/scripts/Makefile.build obj=scripts/dtc/pylibfdt
  unset CROSS_COMPILE; unset CFLAGS; CC="gcc -m64" LDSHARED="gcc -m64 -shared " LDFLAGS="" VERSION="u-boot-2022.10" CPPFLAGS="-I/opt/ooce/include -I/var/lib/abuild/arm64-gate/src/u-boot/scripts/dtc/libfdt" OBJDIR=scripts/dtc/pylibfdt SOURCES="/var/lib/abuild/arm64-gate/src/u-boot/scripts/dtc/libfdt/fdt.c /var/lib/abuild/arm64-gate/src/u-boot/scripts/dtc/libfdt/fdt_ro.c /var/lib/abuild/arm64-gate/src/u-boot/scripts/dtc/libfdt/fdt_wip.c /var/lib/abuild/arm64-gate/src/u-boot/scripts/dtc/libfdt/fdt_sw.c /var/lib/abuild/arm64-gate/src/u-boot/scripts/dtc/libfdt/fdt_rw.c /var/lib/abuild/arm64-gate/src/u-boot/scripts/dtc/libfdt/fdt_strerror.c /var/lib/abuild/arm64-gate/src/u-boot/scripts/dtc/libfdt/fdt_empty_tree.c /var/lib/abuild/arm64-gate/src/u-boot/scripts/dtc/libfdt/fdt_addresses.c /var/lib/abuild/arm64-gate/src/u-boot/scripts/dtc/libfdt/fdt_overlay.c scripts/dtc/pylibfdt/libfdt.i" SWIG_OPTS="-I/var/lib/abuild/arm64-gate/src/u-boot/scripts/dtc/libfdt -I/var/lib/abuild/arm64-gate/src/u-boot/scripts/dtc/libfdt/.." python3 /var/lib/abuild/arm64-gate/src/u-boot/scripts/dtc/pylibfdt/setup.py --quiet build_ext --inplace
Traceback (most recent call last):
  File "/var/lib/abuild/arm64-gate/src/u-boot/scripts/dtc/pylibfdt/setup.py", line 115, in <module>
    setup(
  File "/usr/lib/python3.9/vendor-packages/setuptools/_distutils/core.py", line 147, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/lib/python3.9/vendor-packages/setuptools/dist.py", line 314, in __init__
    self.metadata.version = self._normalize_version(self.metadata.version)
  File "/usr/lib/python3.9/vendor-packages/setuptools/dist.py", line 350, in _normalize_version
    normalized = str(Version(version))
  File "/usr/lib/python3.9/vendor-packages/setuptools/_vendor/packaging/version.py", line 198, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
setuptools.extern.packaging.version.InvalidVersion: Invalid version: 'u-boot-c'
gmake[4]: *** [/var/lib/abuild/arm64-gate/src/u-boot/scripts/dtc/pylibfdt/Makefile:30: rebuild] Error 1
gmake[3]: *** [/var/lib/abuild/arm64-gate/src/u-boot/scripts/Makefile.build:398: scripts/dtc/pylibfdt] Error 2
gmake[2]: *** [/var/lib/abuild/arm64-gate/src/u-boot/Makefile:2035: scripts_dtc] Error 2
gmake[2]: Leaving directory '/var/lib/abuild/arm64-gate/build/u-boot'
gmake[1]: *** [Makefile:177: sub-make] Error 2
gmake[1]: Leaving directory '/var/lib/abuild/arm64-gate/src/u-boot'
*** Error code 2
make: Fatal error: Command failed for target `/var/lib/abuild/arm64-gate/stamps/u-boot-stamp'

Seems it should be a valid semver but I can't find out from where it picks up this string.
We don't set it. Has this happened before?

@richlowe
Copy link
Owner

I've never seen this before, no. I haven't heard of anyone else seeing it before either.

@citrus-it
Copy link
Collaborator

It looks like this is done during the build with this bit:

echo "2022.10$(/bin/bash /var/lib/abuild/arm64-gate/src/u-boot/scripts/setlocalversion /var/lib/abuild/arm64-gate/src/u-boot)" < include/config/auto.conf > include/config/uboot.release.tmp

What's in the generated src/u-boot/include/config/uboot.release and what does running this command by hand do?

Here's the output from my system:

build:arm64-gate:main% cat build/u-boot/include/config/uboot.release
2022.10-dirty
build:arm64-gate:main% cd build/u-boot
build:arm64-gate:main% /bin/bash ../../src/u-boot/scripts/setlocalversion ../../src/u-boot
-dirty

@Toasterson
Copy link
Contributor Author

Running this by hand and via make u-boot writes 2022.10-dirty into the release file. But the make script still fails. The commands return the same as yours.

@richlowe
Copy link
Owner

I think that what's happened here is that python setuptools has become more strict about versions, and is complaining about the text (that is uboot-).

Can you try

diff --git a/scripts/dtc/pylibfdt/Makefile b/scripts/dtc/pylibfdt/Makefile
index 493995e303..a7579f0c5f 100644
--- a/scripts/dtc/pylibfdt/Makefile
+++ b/scripts/dtc/pylibfdt/Makefile
@@ -17,7 +17,7 @@ quiet_cmd_pymod = PYMOD   $@
       cmd_pymod = unset CROSS_COMPILE; unset CFLAGS; \
                CC="$(HOSTCC)" LDSHARED="$(HOSTCC) -shared " \
                LDFLAGS="$(HOSTLDFLAGS)" \
-               VERSION="u-boot-$(UBOOTVERSION)" \
+               VERSION="$(UBOOTVERSION)" \
                CPPFLAGS="$(HOSTCFLAGS) -I$(LIBFDT_srcdir)" OBJDIR=$(obj) \
                SOURCES="$(PYLIBFDT_srcs)" \
                SWIG_OPTS="-I$(LIBFDT_srcdir) -I$(LIBFDT_srcdir)/.." \

@richlowe
Copy link
Owner

yeah, we want a u-boot with this commit:

c977b18435 ([email protected] 1 year, 4 months ago) libfdt: Fix invalid version warning

or to update to a u-boot that contains that commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants