From 9aff1ea15ebfca3278a88e5f684074e9aa71995f Mon Sep 17 00:00:00 2001 From: Vlad Gabriel Serbu Date: Fri, 24 Apr 2026 11:27:06 +0100 Subject: [PATCH 1/2] Fix: unset cflags and other env variables set by the debian package flow Signed-off-by: Vlad Gabriel Serbu --- linker/slashkit/emit/hw/project_gen.py | 30 +++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/linker/slashkit/emit/hw/project_gen.py b/linker/slashkit/emit/hw/project_gen.py index eb362a1c..8b8b4181 100644 --- a/linker/slashkit/emit/hw/project_gen.py +++ b/linker/slashkit/emit/hw/project_gen.py @@ -23,6 +23,7 @@ from enum import Enum from pathlib import Path import logging +import os import re import shutil import subprocess @@ -39,6 +40,28 @@ AVED_DESIGN_NAME = "amd_v80_gen5x8_25.1" +# Host toolchain flags injected by dpkg-buildpackage (e.g. -mno-omit-leaf-frame-pointer, +# -fcf-protection, -fstack-clash-protection) are not understood by the arm-xilinx-eabi +# cross-compiler used for the AVED AMC firmware. Strip them before shelling out. +_CROSS_BUILD_ENV_BLOCKLIST = ( + "CFLAGS", + "CXXFLAGS", + "CPPFLAGS", + "LDFLAGS", + "FFLAGS", + "FCFLAGS", + "OBJCFLAGS", + "OBJCXXFLAGS", + "GCJFLAGS", + "ASFLAGS", +) + + +def _clean_cross_build_env() -> dict[str, str]: + env = {k: v for k, v in os.environ.items() if k not in _CROSS_BUILD_ENV_BLOCKLIST} + return {k: v for k, v in env.items() if not k.startswith("DEB_")} + + def _copy_checked(src: Path, dest: Path) -> None: if not src.exists(): raise FileNotFoundError(f"Expected file not found: {src}") @@ -160,7 +183,12 @@ def generate_base_pdi_with_aved(config: CommandConfiguration) -> Path: _copy_checked(in_path, target_dir / file_name) logger.info("Running AVED build script in %s", aved_hw_dir) - subprocess.run(["bash", "build_all.sh"], cwd=str(aved_hw_dir), check=True) + subprocess.run( + ["bash", "build_all.sh"], + cwd=str(aved_hw_dir), + env=_clean_cross_build_env(), + check=True, + ) aved_pdi = aved_hw_dir / f"{AVED_DESIGN_NAME}.pdi" if not aved_pdi.exists(): From 461798ef9a96bac5ac8511402e2e1e97098446af Mon Sep 17 00:00:00 2001 From: Vlad Gabriel Serbu Date: Thu, 7 May 2026 11:35:41 +0100 Subject: [PATCH 2/2] Fix pep8 formatting on file Signed-off-by: Vlad Gabriel Serbu --- linker/slashkit/emit/hw/project_gen.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linker/slashkit/emit/hw/project_gen.py b/linker/slashkit/emit/hw/project_gen.py index 8b8b4181..df64b558 100644 --- a/linker/slashkit/emit/hw/project_gen.py +++ b/linker/slashkit/emit/hw/project_gen.py @@ -23,7 +23,6 @@ from enum import Enum from pathlib import Path import logging -import os import re import shutil import subprocess @@ -58,7 +57,8 @@ def _clean_cross_build_env() -> dict[str, str]: - env = {k: v for k, v in os.environ.items() if k not in _CROSS_BUILD_ENV_BLOCKLIST} + env = {k: v for k, v in os.environ.items() + if k not in _CROSS_BUILD_ENV_BLOCKLIST} return {k: v for k, v in env.items() if not k.startswith("DEB_")}