pebble/platform/snowy/boot/spalding-bin-update.sh
2025-01-27 11:38:16 -08:00

42 lines
1.3 KiB
Bash
Executable file

#!/bin/bash
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit -o xtrace
cd "${0%/*}"
reloutdir="../../../bin/boot"
OUTDIR=`cd "${reloutdir}"; pwd`
# Use commit timestamp, same as the one compiled into the bootloader binary
VERSION=`git log -1 --format=%ct HEAD`
# Clear out old versions of the bootloader binaries
git rm ${OUTDIR}/{nowatchdog_,}boot_spalding@*.{hex,elf} || true
# Build all bootloader variants and copy them into OUTDIR
build_and_copy () {
local variant="$1";
shift;
pypy ./waf configure --board=spalding $@ build --progress
for ext in hex elf; do
mv build/snowy_boot.${ext} \
"${OUTDIR}/${variant}boot_spalding@${VERSION}.${ext}"
done
}
build_and_copy ""
build_and_copy nowatchdog_ --nowatchdog