Description
tools/scripts/acsbuild.sh derives BSA_PATH as a sibling directory relative to its own script location:
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
sbsa_path="$(dirname "$(dirname "$script_dir")")"
bsa_path="$sbsa_path/../bsa-acs"
export BSA_PATH=$(realpath "$bsa_path")
cd ... && pwd always resolves through symlinks in bash. If ShellPkg/Application/sbsa-acs is a symlink to a checkout that lives elsewhere on disk (a common pattern when reusing an existing sbsa-acs clone instead of re-cloning it into the EDK2 tree), script_dir resolves to the real path of that checkout rather than its location under ShellPkg/Application/. bsa_path then points at a nonexistent sibling directory instead of the actual bsa-acs clone under ShellPkg/Application/bsa-acs/.
Reproduction
- Set up the EDK2 build tree per the README, but instead of cloning sbsa-acs directly into
ShellPkg/Application/sbsa-acs, symlink it in from an existing checkout elsewhere:
ln -s ~/work/sbsa-acs edk2/ShellPkg/Application/sbsa-acs
git clone https://github.com/ARM-software/bsa-acs.git edk2/ShellPkg/Application/bsa-acs
- Run the normal build sequence (
source ShellPkg/Application/sbsa-acs/tools/scripts/acsbuild.sh).
- Build fails compiling
SbsaAvsMain.c:
fatal error: val/sbsa/include/sbsa_val_interface.h: No such file or directory
- Inspecting the failing compile command shows
-I include paths pointing at a directory that doesn't exist (a sibling of the real, symlinked-to sbsa-acs checkout), not the actual bsa-acs clone under ShellPkg/Application/bsa-acs/.
Workaround
Export BSA_PATH explicitly before invoking build, bypassing acsbuild.sh's auto-detection:
export BSA_PATH=/path/to/edk2/ShellPkg/Application/bsa-acs
build -a AARCH64 -t GCC49 -p ShellPkg/ShellPkg.dsc -m ShellPkg/Application/sbsa-acs/uefi_app/SbsaAvs.inf
Suggested fix
Don't infer BSA_PATH from the script's resolved filesystem location via ${BASH_SOURCE[0]} + cd/pwd (which follows symlinks). Either:
- Require/prefer an explicitly-exported
BSA_PATH env var if already set, or
- Derive the path from
$WORKSPACE (already set by EDK2's edksetup.sh) plus the known relative package path, rather than the script's own resolved location.
Description
tools/scripts/acsbuild.shderivesBSA_PATHas a sibling directory relative to its own script location:cd ... && pwdalways resolves through symlinks in bash. IfShellPkg/Application/sbsa-acsis a symlink to a checkout that lives elsewhere on disk (a common pattern when reusing an existing sbsa-acs clone instead of re-cloning it into the EDK2 tree),script_dirresolves to the real path of that checkout rather than its location underShellPkg/Application/.bsa_paththen points at a nonexistent sibling directory instead of the actualbsa-acsclone underShellPkg/Application/bsa-acs/.Reproduction
ShellPkg/Application/sbsa-acs, symlink it in from an existing checkout elsewhere:source ShellPkg/Application/sbsa-acs/tools/scripts/acsbuild.sh).SbsaAvsMain.c:-Iinclude paths pointing at a directory that doesn't exist (a sibling of the real, symlinked-to sbsa-acs checkout), not the actualbsa-acsclone underShellPkg/Application/bsa-acs/.Workaround
Export
BSA_PATHexplicitly before invokingbuild, bypassing acsbuild.sh's auto-detection:export BSA_PATH=/path/to/edk2/ShellPkg/Application/bsa-acs build -a AARCH64 -t GCC49 -p ShellPkg/ShellPkg.dsc -m ShellPkg/Application/sbsa-acs/uefi_app/SbsaAvs.infSuggested fix
Don't infer
BSA_PATHfrom the script's resolved filesystem location via${BASH_SOURCE[0]}+cd/pwd(which follows symlinks). Either:BSA_PATHenv var if already set, or$WORKSPACE(already set by EDK2'sedksetup.sh) plus the known relative package path, rather than the script's own resolved location.