mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-18 12:46:26 +00:00
c7f652bf89
Use relative paths in configs generated from templates, so the final build doesn't depend on the absolute location of the repository. The coreboot config is part of the final ROM. Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm> Signed-off-by: Thierry Laurion <insurgo@riseup.net>
28 lines
896 B
Bash
Executable File
28 lines
896 B
Bash
Executable File
#! /usr/bin/env bash
|
|
|
|
TEMPLATE="$1"
|
|
RESULT="$2"
|
|
BOARD_BUILD="$3"
|
|
BRAND_NAME="$4"
|
|
|
|
repo="$(realpath "$(dirname "${BASH_SOURCE[0]}")/..")"
|
|
# For both coreboot and Linux, the config file is in a board-
|
|
# specific build directory, but the build occurs from the
|
|
# parent of that directory.
|
|
module_dir="$(realpath "$(dirname "$2")/..")"
|
|
|
|
# Use relative paths since the config may be part of the ROM
|
|
# artifacts, and relative paths won't depend on the workspace
|
|
# absolute path.
|
|
board_build_rel="$(realpath --relative-to "$module_dir" "$BOARD_BUILD")"
|
|
repo_rel="$(realpath --relative-to "$module_dir" "$repo")"
|
|
|
|
echo "board_build_rel=$board_build_rel"
|
|
echo "repo_rel=$repo_rel"
|
|
|
|
sed -e "s!@BOARD_BUILD_DIR@!${board_build_rel}!g" \
|
|
-e "s!@BLOB_DIR@!${repo_rel}/blobs!g" \
|
|
-e "s!@BRAND_DIR@!${repo_rel}/branding/$BRAND_NAME!g" \
|
|
-e "s!@BRAND_NAME@!$BRAND_NAME!g" \
|
|
"$TEMPLATE" > "$RESULT"
|