On 30 June 2015 at 18:22, Ryan Harkin ryan.harkin@linaro.org wrote:
Hello UEFI builders!
I'd like your feedback on this patch.
I often look at boot logs from LAVA and other people and don't quite know
where the UEFI binary came from. With ones that I've provided, I can often
recognise the build date stamp. But at other times, I'm simply trying to
work out if someone is building the code they say they are, or some other
code.
As the commit message says, rather than leaving the version string blank, my
patch will append the git commit id of the current commit, with "dirty"
appended if the user is building with uncommited mods.
I considered including the code from linux scripts/setlocalversion, but
apart from giving me a "-" at the front, I thought it was overkill.
Comments?
Looks good to me. I haven't been in this position myself, but I see
how it would be very useful to have this information available in a
binary build.
--
Ard.
> --
> From af952a40005536215cedbbeea9102915e461486f Mon Sep 17 00:00:00 2001
> From: Ryan Harkin
ryan.harkin@linaro.org
> Date: Tue, 30 Jun 2015 15:10:56 +0100
> Subject: [PATCH] Use commit id as default FIRMWARE_VER
>
> If a FIRMWARE_VER setting is not provided and we are building from a GIT
> repo, provide a default value based on the SHA ID of the commit where we
> built from.
>
> If the repo has local uncommited changes, then we mark the version
> string with "-dirty".
>
> This is based loosely on the same idea from the linux kernel in:
> scripts/setlocalversion
>
> Signed-off-by: Ryan Harkin
ryan.harkin@linaro.org
> ---
> uefi-build.sh | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/uefi-build.sh b/uefi-build.sh
> index 486cf86..60ea872 100755
> --- a/uefi-build.sh
> +++ b/uefi-build.sh
> @@ -27,6 +27,16 @@ function build_platform
> PLATFORM_DSC="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $board
> get -o dsc`"
> PLATFORM_ARCH="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p
> $board get -o arch`"
>
> + if [[ $PLATFORM_BUILDFLAGS != *"FIRMWARE_VER"* ]]; then
> + if test -d .git && head=`git rev-parse --verify --short HEAD
> 2>/dev/null`; then
> + FIRMWARE_VER=`git rev-parse --short HEAD`
> + if ! git diff-index --quiet HEAD --; then
> + FIRMWARE_VER="${FIRMWARE_VER}-dirty"
> + fi
> + PLATFORM_BUILDFLAGS="$PLATFORM_BUILDFLAGS -D
> FIRMWARE_VER=$FIRMWARE_VER"
> + fi
> + fi
> +
> set_cross_compile
> CROSS_COMPILE="$TEMP_CROSS_COMPILE"
>
> --
> 2.1.0
>
>
> _______________________________________________
> Linaro-uefi mailing list
> Linaro-uefi@lists.linaro.org
>
https://lists.linaro.org/mailman/listinfo/linaro-uefi
>