Skip to content

acsbuild.sh computes wrong BSA_PATH when sbsa-acs directory is a symlink #494

Description

@ashok-raj

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

  1. 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
    
  2. Run the normal build sequence (source ShellPkg/Application/sbsa-acs/tools/scripts/acsbuild.sh).
  3. Build fails compiling SbsaAvsMain.c:
    fatal error: val/sbsa/include/sbsa_val_interface.h: No such file or directory
    
  4. 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.

Metadata

Metadata

Labels

bsaBase System Architecture ACS specific issues/enhancements/questions.sbsaServer Base System Architecture ACS specific issues/enhancements/questions.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions