mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-18 12:46:26 +00:00
Makefile: Use relative paths in configs generated from templates
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>
This commit is contained in:
parent
6ce3d21e4c
commit
c7f652bf89
8
Makefile
8
Makefile
@ -268,12 +268,10 @@ all payload:
|
||||
FORCE:
|
||||
|
||||
# Copies config while replacing predefined placeholders with actual values
|
||||
# This is used in a command like 'this && $(call install_config ...) && that'
|
||||
# so it needs to evaluate to a shell command.
|
||||
define install_config =
|
||||
sed -e 's!@BOARD_BUILD_DIR@!$(board_build)!g' \
|
||||
-e 's!@BLOB_DIR@!$(pwd)/blobs!g' \
|
||||
-e 's!@BRAND_DIR@!$(pwd)/branding/$(BRAND_NAME)!g' \
|
||||
-e 's!@BRAND_NAME@!$(BRAND_NAME)!g' \
|
||||
"$1" > "$2"
|
||||
$(pwd)/bin/prepare_module_config.sh "$1" "$2" "$(board_build)" "$(BRAND_NAME)"
|
||||
endef
|
||||
|
||||
# Make helpers to operate on lists of things
|
||||
|
27
bin/prepare_module_config.sh
Executable file
27
bin/prepare_module_config.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#! /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"
|
Loading…
Reference in New Issue
Block a user