From b9441fc2fcbed087cff80997743b94b2d132471e Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Mon, 11 Dec 2023 02:17:09 +0000 Subject: [PATCH 01/11] rimage: remove obsolete, IPC3 tgl.toml and tgl-h.toml The main branch hasn't supported IPC3 for tgl for a long time. Follow-up to commit a17c2823d376 ("xtensa-build-zephyr: remove ipc option") Signed-off-by: Marc Herbert (cherry picked from commit 79e508017522cb0de509ed59d44d7e5df91c9adb) --- tools/rimage/config/tgl-h.toml | 56 ---------------------------------- tools/rimage/config/tgl.toml | 56 ---------------------------------- 2 files changed, 112 deletions(-) delete mode 100644 tools/rimage/config/tgl-h.toml delete mode 100644 tools/rimage/config/tgl.toml diff --git a/tools/rimage/config/tgl-h.toml b/tools/rimage/config/tgl-h.toml deleted file mode 100644 index 997e1a832899..000000000000 --- a/tools/rimage/config/tgl-h.toml +++ /dev/null @@ -1,56 +0,0 @@ -version = [2, 5] - -[adsp] -name = "tgl" -image_size = "0x1F0000" # (30 + 1) bank * 64KB -alias_mask = "0xE0000000" - -[[adsp.mem_zone]] -type = "ROM" -base = "0x9F180000" -size = "0x00002000" -[[adsp.mem_zone]] -type = "IMR" -base = "0xB0038000" -size = "0x100000" -[[adsp.mem_zone]] -type = "SRAM" -base = "0xBE040000" -size = "0x100000" - -[[adsp.mem_alias]] -type = "uncached" -base = "0x9E000000" -[[adsp.mem_alias]] -type = "cached" -base = "0xBE000000" - -[cse] -partition_name = "ADSP" -[[cse.entry]] -name = "ADSP.man" -offset = "0x5c" -length = "0x464" -[[cse.entry]] -name = "cavs0015.met" -offset = "0x4c0" -length = "0x70" -[[cse.entry]] -name = "cavs0015" -offset = "0x540" -length = "0x0" # calculated by rimage - -[css] - -[signed_pkg] -name = "ADSP" -[[signed_pkg.module]] -name = "cavs0015.met" - -[adsp_file] -[[adsp_file.comp]] -base_offset = "0x2000" - -[fw_desc.header] -name = "ADSPFW" -load_offset = "0x30000" diff --git a/tools/rimage/config/tgl.toml b/tools/rimage/config/tgl.toml deleted file mode 100644 index 9a64c694c7f8..000000000000 --- a/tools/rimage/config/tgl.toml +++ /dev/null @@ -1,56 +0,0 @@ -version = [2, 5] - -[adsp] -name = "tgl" -image_size = "0x2F0000" # (46 + 1) bank * 64KB -alias_mask = "0xE0000000" - -[[adsp.mem_zone]] -type = "ROM" -base = "0x9F180000" -size = "0x00002000" -[[adsp.mem_zone]] -type = "IMR" -base = "0xB0038000" -size = "0x100000" -[[adsp.mem_zone]] -type = "SRAM" -base = "0xBE040000" -size = "0x100000" - -[[adsp.mem_alias]] -type = "uncached" -base = "0x9E000000" -[[adsp.mem_alias]] -type = "cached" -base = "0xBE000000" - -[cse] -partition_name = "ADSP" -[[cse.entry]] -name = "ADSP.man" -offset = "0x5c" -length = "0x464" -[[cse.entry]] -name = "cavs0015.met" -offset = "0x4c0" -length = "0x70" -[[cse.entry]] -name = "cavs0015" -offset = "0x540" -length = "0x0" # calculated by rimage - -[css] - -[signed_pkg] -name = "ADSP" -[[signed_pkg.module]] -name = "cavs0015.met" - -[adsp_file] -[[adsp_file.comp]] -base_offset = "0x2000" - -[fw_desc.header] -name = "ADSPFW" -load_offset = "0x30000" From df500512867dd27bb8200588c999711450fd5390 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Mon, 11 Dec 2023 02:34:00 +0000 Subject: [PATCH 02/11] xtensa-build-zephyr.py: remove IPC3/IPC4 "cavs" switch Rename: - tgl-cavs.toml to tgl.toml - tgl-h-cavs.toml to tgl-h.toml Remove the IPC3/IPC4 switch added by commit 6f71808e3ee7 ("xtensa-build-zephyr.py: add ipc4 build support for tgl") This brings back consistency which is required for the .toml split (#8490) Signed-off-by: Marc Herbert (cherry picked from commit ded019bd46b5884e26daf6802b1276f9bed9a697) --- scripts/xtensa-build-zephyr.py | 8 +------- tools/rimage/config/{tgl-h-cavs.toml => tgl-h.toml} | 0 tools/rimage/config/{tgl-cavs.toml => tgl.toml} | 0 3 files changed, 1 insertion(+), 7 deletions(-) rename tools/rimage/config/{tgl-h-cavs.toml => tgl-h.toml} (100%) rename tools/rimage/config/{tgl-cavs.toml => tgl.toml} (100%) diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index 3d2563df6921..a2a6f49ec557 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -82,7 +82,6 @@ class PlatformConfig: XTENSA_CORE: str DEFAULT_TOOLCHAIN_VARIANT: str = "xt-clang" RIMAGE_KEY: pathlib.Path = pathlib.Path(SOF_TOP, "keys", "otc_private_key_3k.pem") - IPC4_RIMAGE_DESC: str = None IPC4_CONFIG_OVERLAY: str = "ipc4_overlay.conf" aliases: list = dataclasses.field(default_factory=list) @@ -94,7 +93,6 @@ class PlatformConfig: f"RG-2017.8{xtensa_tools_version_postfix}", "cavs2x_LX6HiFi3_2017_8", "xcc", - IPC4_RIMAGE_DESC = "tgl-cavs.toml", aliases = ['adl', 'ehl'] ), "tgl-h" : PlatformConfig( @@ -102,7 +100,6 @@ class PlatformConfig: f"RG-2017.8{xtensa_tools_version_postfix}", "cavs2x_LX6HiFi3_2017_8", "xcc", - IPC4_RIMAGE_DESC = "tgl-h-cavs.toml", aliases = ['adl-s'] ), "mtl" : PlatformConfig( @@ -628,10 +625,7 @@ def rimage_options(platform_dict): # test_00_01_load_fw_and_check_version opts.append(("-b", "1")) - if platform_dict.get("IPC4_RIMAGE_DESC", None) is not None: - rimage_desc = platform_dict["IPC4_RIMAGE_DESC"] - else: - rimage_desc = platform_dict["name"] + ".toml" + rimage_desc = platform_dict["name"] + ".toml" opts.append(("-c", str(RIMAGE_SOURCE_DIR / "config" / rimage_desc))) diff --git a/tools/rimage/config/tgl-h-cavs.toml b/tools/rimage/config/tgl-h.toml similarity index 100% rename from tools/rimage/config/tgl-h-cavs.toml rename to tools/rimage/config/tgl-h.toml diff --git a/tools/rimage/config/tgl-cavs.toml b/tools/rimage/config/tgl.toml similarity index 100% rename from tools/rimage/config/tgl-cavs.toml rename to tools/rimage/config/tgl.toml From 4751a788a8c5244a7aa6da1a18120ba005b82455 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Mon, 11 Dec 2023 03:14:02 +0000 Subject: [PATCH 03/11] xtensa-build-zephyr.py: don't pass -c $plat.toml to rimage Let west/sign.py find the appropriate .toml file. This prepares for .toml modularization #8490 Signed-off-by: Marc Herbert (cherry picked from commit d661aadd7ce7c37cf9bdbc55748ea92dc472b245) --- scripts/xtensa-build-zephyr.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index a2a6f49ec557..83534189a1ff 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -625,10 +625,6 @@ def rimage_options(platform_dict): # test_00_01_load_fw_and_check_version opts.append(("-b", "1")) - rimage_desc = platform_dict["name"] + ".toml" - - opts.append(("-c", str(RIMAGE_SOURCE_DIR / "config" / rimage_desc))) - return opts From 4b8fb45eefcf71a7a05523922a1aba8048a0836c Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Fri, 15 Dec 2023 14:11:08 +0200 Subject: [PATCH 04/11] xtensa-build-zephyr.py: Remove IPC4_CONFIG_OVERLAY from PlatformConfig The IPC4_CONFIG_OVERLAY is no longer used, remove it. Signed-off-by: Peter Ujfalusi (cherry picked from commit 4d0da9896b5b21820c369c6a6b711b32b77acb90) --- scripts/xtensa-build-zephyr.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index 83534189a1ff..d0ab847df9ee 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -82,7 +82,6 @@ class PlatformConfig: XTENSA_CORE: str DEFAULT_TOOLCHAIN_VARIANT: str = "xt-clang" RIMAGE_KEY: pathlib.Path = pathlib.Path(SOF_TOP, "keys", "otc_private_key_3k.pem") - IPC4_CONFIG_OVERLAY: str = "ipc4_overlay.conf" aliases: list = dataclasses.field(default_factory=list) # These can all be built out of the box. --all builds all these. From f7c870a271ba16b154541c316cf86b173e630551 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Mon, 18 Dec 2023 09:05:35 +0200 Subject: [PATCH 05/11] xtensa-build-zephyr.py: Fill in missing platform aliases The following aliases are missing: tgl: adl-n, rpl tgl-h: rpl-s mtl: arl Update the aliases list accordingly. Signed-off-by: Peter Ujfalusi (cherry picked from commit 38d447f3f9213a61786dd46d3e3223027607cb6b) --- scripts/xtensa-build-zephyr.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index d0ab847df9ee..991571fd31db 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -92,19 +92,20 @@ class PlatformConfig: f"RG-2017.8{xtensa_tools_version_postfix}", "cavs2x_LX6HiFi3_2017_8", "xcc", - aliases = ['adl', 'ehl'] + aliases = ['adl', 'adl-n', 'ehl', 'rpl'] ), "tgl-h" : PlatformConfig( "tgl-h", "intel_adsp_cavs25_tgph", f"RG-2017.8{xtensa_tools_version_postfix}", "cavs2x_LX6HiFi3_2017_8", "xcc", - aliases = ['adl-s'] + aliases = ['adl-s', 'rpl-s'] ), "mtl" : PlatformConfig( "mtl", "intel_adsp_ace15_mtpm", f"RI-2022.10{xtensa_tools_version_postfix}", "ace10_LX7HiFi4_2022_10", + aliases = ['arl'] ), "lnl" : PlatformConfig( "lnl", "intel_adsp_ace20_lnl", From a1948f9efd9ed2aa4a5db25e32ef59e785a784f8 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Mon, 18 Dec 2023 10:01:17 +0200 Subject: [PATCH 06/11] xtensa-build-zephyr.py: Print out the platform aliases in help Print platform alias information to reduce the need for guessing when trying to figure out what platform supports what platform. Signed-off-by: Peter Ujfalusi (cherry picked from commit 7e42c43c2192a4b1582bf51c528230b63c9d3870) --- scripts/xtensa-build-zephyr.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index 991571fd31db..e82fcb08e9bf 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -177,8 +177,10 @@ def parse_args(): " └── RG-2017.8{}/\n".format(xtensa_tools_version_postfix) + " └── XtensaTools/\n" + "$XTENSA_TOOLS_ROOT=/path/to/myXtensa ...\n" + - f"Supported platforms: {list(platform_configs)}")) + f"\nSupported platforms: {list(platform_configs)}"), add_help=False) + + parser.add_argument('-h', '--help', action='store_true', help='show help') parser.add_argument("-a", "--all", required=False, action="store_true", help="Build all currently supported platforms") parser.add_argument("platforms", nargs="*", action=validate_platforms_arguments, @@ -263,9 +265,14 @@ def parse_args(): args.platforms = list(platform_configs_all) # print help message if no arguments provided - if len(sys.argv) == 1: - parser.print_help() - sys.exit(0) + if len(sys.argv) == 1 or args.help: + for platform in platform_configs: + if platform_configs[platform].aliases: + parser.epilog += "\nPlatform aliases for '" + platform + "':\t" + parser.epilog += f"{list(platform_configs[platform].aliases)}" + + parser.print_help() + sys.exit(0) if args.fw_naming == 'AVS': if not args.use_platform_subdir: From 0b74cc923cd47423e5f0c8d713a896582efcb00f Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Mon, 18 Dec 2023 13:31:31 +0200 Subject: [PATCH 07/11] xtensa-build-zephyr.py: Add option to create deployable build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The default firmware file path is standardized among vendors as follows: IPC3 /lib/firmware/VENDOR/sof/ ├── community │ └── sof-PLAT.ri ├── dbgkey │ └── sof-PLAT.ri └── sof-PLAT.ri IPC4 /lib/firmware/VENDOR/sof-ipc4/ └── PLAT ├── community │ └── sof-PLAT.ri ├── dbgkey │ └── sof-PLAT.ri └── sof-PLAT.ri\n Currently the binaries created by the build can only be used for direct deployment on IPC3 platforms but if one builds different vendor firmwares the files have to be manually picked and sorted out. We have two flags: --fw-naming and --use-platform-subdir which can be played with but still not going to produce deployable build. Introduce a new flag: --deployable-build With the flag specified all other modificators are going to be ignored and the build will do the 'right thing' to create a directory structure which can be deployed as it is to the target's firmware directory. To achieve this several changes needed: PlatformConfig: - drop the name member and replace it with a vendor string - add a flag to indicate IPC4 platforms Later a new option can be added if needed for platforms which can be IPC3 or IPC4 Ignore fw-naming and use-platform-subdir in case of deployable build. The options will be reset to their default in case they are changed. symlink_or_copy extended to handle relative symlinks when the target and link is not under the same directory. The --deployable-build is disabled by default, it has to be enabled to create deployable build for now. Signed-off-by: Peter Ujfalusi (cherry picked from commit 1adb1e45d3ab0ab8f08d3794feea68efbf3a60b1) --- scripts/xtensa-build-zephyr.py | 131 +++++++++++++++++++++++++-------- 1 file changed, 100 insertions(+), 31 deletions(-) diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index e82fcb08e9bf..1b8abc6073d0 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -76,58 +76,63 @@ # pylint:disable=too-many-instance-attributes class PlatformConfig: "Product parameters" - name: str + vendor: str PLAT_CONFIG: str XTENSA_TOOLS_VERSION: str XTENSA_CORE: str DEFAULT_TOOLCHAIN_VARIANT: str = "xt-clang" RIMAGE_KEY: pathlib.Path = pathlib.Path(SOF_TOP, "keys", "otc_private_key_3k.pem") aliases: list = dataclasses.field(default_factory=list) + ipc4: bool = False # These can all be built out of the box. --all builds all these. platform_configs_all = { # Intel platforms "tgl" : PlatformConfig( - "tgl", "intel_adsp_cavs25", + "intel", "intel_adsp_cavs25", f"RG-2017.8{xtensa_tools_version_postfix}", "cavs2x_LX6HiFi3_2017_8", "xcc", - aliases = ['adl', 'adl-n', 'ehl', 'rpl'] + aliases = ['adl', 'adl-n', 'ehl', 'rpl'], + ipc4 = True ), "tgl-h" : PlatformConfig( - "tgl-h", "intel_adsp_cavs25_tgph", + "intel", "intel_adsp_cavs25_tgph", f"RG-2017.8{xtensa_tools_version_postfix}", "cavs2x_LX6HiFi3_2017_8", "xcc", - aliases = ['adl-s', 'rpl-s'] + aliases = ['adl-s', 'rpl-s'], + ipc4 = True ), "mtl" : PlatformConfig( - "mtl", "intel_adsp_ace15_mtpm", + "intel", "intel_adsp_ace15_mtpm", f"RI-2022.10{xtensa_tools_version_postfix}", "ace10_LX7HiFi4_2022_10", - aliases = ['arl'] + aliases = ['arl'], + ipc4 = True ), "lnl" : PlatformConfig( - "lnl", "intel_adsp_ace20_lnl", + "intel", "intel_adsp_ace20_lnl", f"RI-2022.10{xtensa_tools_version_postfix}", "ace10_LX7HiFi4_2022_10", + ipc4 = True ), # NXP platforms "imx8" : PlatformConfig( - "imx8", "nxp_adsp_imx8", + "imx", "nxp_adsp_imx8", f"RI-2023.11{xtensa_tools_version_postfix}", "hifi4_nxp_v5_3_1_prod", RIMAGE_KEY = "key param ignored by imx8", ), "imx8x" : PlatformConfig( - "imx8x", "nxp_adsp_imx8x", + "imx", "nxp_adsp_imx8x", f"RI-2023.11{xtensa_tools_version_postfix}", "hifi4_nxp_v5_3_1_prod", RIMAGE_KEY = "key param ignored by imx8x" ), "imx8m" : PlatformConfig( - "imx8m", "nxp_adsp_imx8m", + "imx", "nxp_adsp_imx8m", f"RI-2023.11{xtensa_tools_version_postfix}", "hifi4_mscale_v2_0_2_prod", RIMAGE_KEY = "key param ignored by imx8m" @@ -137,7 +142,7 @@ class PlatformConfig: # These cannot be built out of the box yet extra_platform_configs = { "imx8ulp" : PlatformConfig( - "imx8ulp", "nxp_adsp_imx8ulp", + "imx", "nxp_adsp_imx8ulp", f"RI-2023.11{xtensa_tools_version_postfix}", "hifi4_nxp2_s7_v2_1a_prod", RIMAGE_KEY = "key param ignored by imx8ulp" @@ -256,6 +261,28 @@ def parse_args(): help="""Run script in non-interactive mode when user input can not be provided. This should be used with programmatic script invocations (eg. Continuous Integration). """) + + parser.add_argument("--deployable-build", default=False, action="store_true", + help="""Create a directory structure for the firmware files which can be deployed on target as it is. +This option will cause the --fw-naming and --use-platform-subdir options to be ignored! +The generic, default directory and file structure is IPC version dependent: +IPC3 + build-sof-staging/sof/VENDOR/sof/ (on target: /lib/firmware/VENDOR/sof/) + ├── community + │ └── sof-PLAT.ri + ├── dbgkey + │ └── sof-PLAT.ri + └── sof-PLAT.ri +IPC4 + build-sof-staging/sof/VENDOR/sof-ipc4/ (on target: /lib/firmware/VENDOR/sof-ipc4/) + └── PLAT + ├── community + │ └── sof-PLAT.ri + ├── dbgkey + │ └── sof-PLAT.ri + └── sof-PLAT.ri\n + """) + parser.add_argument("--version", required=False, action="store_true", help="Prints version of this script.") @@ -274,6 +301,14 @@ def parse_args(): parser.print_help() sys.exit(0) + if args.deployable_build: + if args.fw_naming == 'AVS': + args.fw_naming = 'SOF' + print("The option '--fw-naming AVS' is ignored for deployable builds.") + if args.use_platform_subdir: + args.use_platform_subdir = False + print("The option '--use-platform-subdir' is ignored for deployable builds.") + if args.fw_naming == 'AVS': if not args.use_platform_subdir: args.use_platform_subdir=True @@ -310,18 +345,18 @@ def execute_command(*run_args, **run_kwargs): return subprocess.run(*run_args, **run_kwargs) -def symlink_or_copy(directory, origbase, newbase): - """Create a symbolic link or copy in the same directory. Don't - bother Windows users with symbolic links because they require - special privileges. Windows don't care about /lib/firmware/sof/ - anyway. Make a copy instead to preserve cross-platform consistency. - +def symlink_or_copy(targetdir, targetfile, linkdir, linkfile): + """Create a relative symbolic link or copy. Don't bother Windows users + with symbolic links because they require special privileges. + Windows don't care about /lib/firmware/sof/ anyway. + Make a copy instead to preserve cross-platform consistency. """ - new = pathlib.Path(directory) / newbase + target = pathlib.Path(targetdir) / targetfile + link = pathlib.Path(linkdir) / linkfile if py_platform.system() == "Windows": - shutil.copy2(pathlib.Path(directory) / origbase, new) + shutil.copy2(target, link) else: - new.symlink_to(origbase) + link.symlink_to(os.path.relpath(target, linkdir)) def show_installed_files(): """[summary] Scans output directory building binary tree from files and folders @@ -519,6 +554,12 @@ def clean_staging(platform): for f in sof_output_dir.glob(f"**/sof-{p}.*"): os.remove(f) + # remove IPC4 deployable build directories + if platform_configs[platform].ipc4: + sof_platform_output_dir = sof_output_dir / platform_configs[platform].vendor / "sof-ipc4" + rmtree_if_exists(sof_platform_output_dir / platform) + for p_alias in platform_configs[platform].aliases: + rmtree_if_exists(sof_platform_output_dir / p_alias) RIMAGE_BUILD_DIR = west_top / "build-rimage" @@ -662,11 +703,21 @@ def build_platforms(): sof_output_dir.mkdir(parents=True, exist_ok=True) for platform in args.platforms: platf_build_environ = os.environ.copy() - if args.use_platform_subdir: - sof_platform_output_dir = pathlib.Path(sof_output_dir, platform) + + if args.deployable_build: + vendor_output_dir = pathlib.Path(sof_output_dir, platform_configs[platform].vendor) + if platform_configs[platform].ipc4: + sof_platform_output_dir = pathlib.Path(vendor_output_dir, "sof-ipc4") + else: + sof_platform_output_dir = pathlib.Path(vendor_output_dir, "sof") + sof_platform_output_dir.mkdir(parents=True, exist_ok=True) else: - sof_platform_output_dir = sof_output_dir + if args.use_platform_subdir: + sof_platform_output_dir = pathlib.Path(sof_output_dir, platform) + sof_platform_output_dir.mkdir(parents=True, exist_ok=True) + else: + sof_platform_output_dir = sof_output_dir # For now convert the new dataclass to what it used to be _dict = dataclasses.asdict(platform_configs[platform]) @@ -769,7 +820,7 @@ def build_platforms(): execute_command([str(smex_executable), "-l", str(fw_ldc_file), str(input_elf_file)]) for p_alias in platform_configs[platform].aliases: - symlink_or_copy(sof_platform_output_dir, f"sof-{platform}.ldc", f"sof-{p_alias}.ldc") + symlink_or_copy(sof_platform_output_dir, f"sof-{platform}.ldc", sof_platform_output_dir, f"sof-{p_alias}.ldc") # reproducible-zephyr.ri is less useful now that show_installed_files() shows # checksums too. However: - it's still useful when only the .ri file is @@ -811,7 +862,7 @@ def build_platforms(): symlinks=True, ignore_dangling_symlinks=True, dirs_exist_ok=True) -def install_platform(platform, sof_platform_output_dir, platf_build_environ): +def install_platform(platform, sof_output_dir, platf_build_environ): # Keep in sync with caller platform_build_dir_name = f"build-{platform}" @@ -823,10 +874,14 @@ def install_platform(platform, sof_platform_output_dir, platf_build_environ): # Disguise ourselves for local testing purposes output_fwname = "dsp_basefw.bin" else: - # Regular name + # Regular name (deployable build also uses SOF naming convention) output_fwname = "".join(["sof-", platform, ".ri"]) - install_key_dir = sof_platform_output_dir + if args.deployable_build and platform_configs[platform].ipc4: + install_key_dir = pathlib.Path(sof_output_dir, platform) + else: + install_key_dir = sof_output_dir + if args.key_type_subdir != "none": install_key_dir = install_key_dir / args.key_type_subdir @@ -834,10 +889,24 @@ def install_platform(platform, sof_platform_output_dir, platf_build_environ): # looses file owner and group - file is commonly accessible shutil.copy2(abs_build_dir / "zephyr.ri", install_key_dir / output_fwname) - # The production key is usually different - if args.key_type_subdir != "none" and args.fw_naming != "AVS": + if args.deployable_build and platform_configs[platform].ipc4: + # IPC4 deployable builds are using separate directories per platforms + # create the structure and symlinks for the alias platforms for p_alias in platform_configs[platform].aliases: - symlink_or_copy(install_key_dir, output_fwname, f"sof-{p_alias}.ri") + alias_fwname = "".join(["sof-", p_alias, ".ri"]) + + alias_key_dir = pathlib.Path(sof_output_dir, p_alias) + if args.key_type_subdir != "none": + alias_key_dir = alias_key_dir / args.key_type_subdir + + os.makedirs(alias_key_dir, exist_ok=True) + symlink_or_copy(install_key_dir, output_fwname, alias_key_dir, alias_fwname) + else: + # non deployable builds and IPC3 deployable builds are using the same symlink scheme + # The production key is usually different + if args.key_type_subdir != "none" and args.fw_naming != "AVS": + for p_alias in platform_configs[platform].aliases: + symlink_or_copy(install_key_dir, output_fwname, install_key_dir, f"sof-{p_alias}.ri") # sof-info/ directory From fed9c65af9dd9ae58a131bfa9e3441696a6f5a66 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Fri, 22 Dec 2023 10:34:56 +0200 Subject: [PATCH 08/11] xtensa-build-zephyr.py: Add arl-s alias to mtl platform ARL-S is using the same debugkey/community key binary as MTL. Signed-off-by: Peter Ujfalusi (cherry picked from commit 98cc1d3da330052ac43f269fdce11aa8d4562cf0) --- scripts/xtensa-build-zephyr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index 1b8abc6073d0..92615e5295cb 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -108,7 +108,7 @@ class PlatformConfig: "intel", "intel_adsp_ace15_mtpm", f"RI-2022.10{xtensa_tools_version_postfix}", "ace10_LX7HiFi4_2022_10", - aliases = ['arl'], + aliases = ['arl', 'arl-s'], ipc4 = True ), "lnl" : PlatformConfig( From d4f8c97c2c72cfdf6dabc3118d93028277ce82ed Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Fri, 12 Jan 2024 23:26:05 +0000 Subject: [PATCH 09/11] xtensa-build-zephyr.py: show symbolic links at the end Not sure why I thought it would be complicated; I should have done this much sooner. Before: ``` build-sof-staging |-- sof | +-- intel | +-- sof-ipc4 | |-- adl | | +-- community | | +-- sof-adl.ri | |-- adl-n | | +-- community | | +-- sof-adl-n.ri | |-- arl | | +-- community | | +-- sof-arl.ri ``` After: ``` build-sof-staging |-- sof | +-- intel | +-- sof-ipc4 | |-- adl | | +-- community | | +-- sof-adl.ri -> ../../tgl/community/sof-tgl.ri | |-- adl-n | | +-- community | | +-- sof-adl-n.ri -> ../../tgl/community/sof-tgl.ri | |-- arl | | +-- community | | +-- sof-arl.ri -> ../../mtl/community/sof-mtl.ri ``` Signed-off-by: Marc Herbert (cherry picked from commit c8eb21621a11ee78c8a8ca40754b04a5fd0d2f89) --- scripts/xtensa-build-zephyr.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index 92615e5295cb..88d563630838 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -377,13 +377,17 @@ def show_installed_files(): for pre, _, node in RenderTree(graph_root, render.AsciiStyle): fpath = STAGING_DIR / node.long_name + + # pathLib.readlink() requires Python 3.9 + symlink_trailer = f" -> {os.readlink(fpath)}" if fpath.is_symlink() else "" + stem = node.name[:-3] if node.name.endswith(".gz") else node.name shasum_trailer = "" if checksum_wanted(stem) and fpath.is_file() and not fpath.is_symlink(): shasum_trailer = "\tsha256=" + checksum(fpath) - print(f"{pre}{node.name} {shasum_trailer}") + print(f"{pre}{node.name} {symlink_trailer} {shasum_trailer}") # TODO: among other things in this file it should be less SOF-specific; From d8d05d06f5a84374cd664974b07324245c2e38b5 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Sat, 13 Jan 2024 00:32:38 +0000 Subject: [PATCH 10/11] xtensa-build-zephyr.py: fix --help text for --fw-naming=AVS Better late than never... zero functional change. Signed-off-by: Marc Herbert (cherry picked from commit e24ccd2c19bb26d1ace252172de9ba303172b5ac) --- scripts/xtensa-build-zephyr.py | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index 88d563630838..89488b7fdca9 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -197,25 +197,32 @@ def parse_args(): # the kernel 'ipc_type' expects CAVS IPC4. In this way, developers and CI can test # IPC4 on older platforms. parser.add_argument("--fw-naming", required=False, choices=["AVS", "SOF"], - default="SOF", help=""" -Determine firmware naming conversion and folder structure -For SOF: - /lib/firmware/intel/sof - └───────community + default="SOF", +help="""Determine firmware naming conversion and folder structure. +See also the newer and better '--deployable-build' for IPC4. +With "SOF" (default): + +build-sof-staging (for /lib/firmware/intel/sof/) + ├───community │ └── sof-tgl.ri ├── dbgkey │ └── sof-tgl.ri - └── sof-tgl.ri -For AVS(filename dsp_basefw.bin): -Noted that with fw_naming set as 'AVS', there will be output subdirectories for each platform - /lib/firmware/intel/sof-ipc4 + ├── sof-tgl.ri + └── sof-tgl.ldc + +With "AVS"; filename 'dsp_basefw.bin'. +'AVS' automatically enables --use-platform-subdir which uses one subdirectory for each platform: + +build-sof-staging (for old, developer /lib/firmware/intel/sof-ipc4/) └── tgl ├── community │ └── dsp_basefw.bin ├── dbgkey │ └── dsp_basefw.bin - └── dsp_basefw.bin""" - ) + ├── dsp_basefw.bin + └── sof-tgl.ldc + +""") parser.add_argument("-j", "--jobs", required=False, type=int, help="Number of concurrent jobs. Passed to west build and" " to cmake (for rimage)") From c33329dc36909c801f5b59bacef2c69ede942f70 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Sat, 13 Jan 2024 00:56:26 +0000 Subject: [PATCH 11/11] xtensa-build-zephyr.py: fail on --deployable-build + older options From experience, no one scrolls up and looks at warnings that are not in the current screen. Signed-off-by: Marc Herbert (cherry picked from commit f4ce8b537b94d8710ff34f88de966dce48d2ba86) --- scripts/xtensa-build-zephyr.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index 89488b7fdca9..3a5426d470c4 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -309,12 +309,9 @@ def parse_args(): sys.exit(0) if args.deployable_build: - if args.fw_naming == 'AVS': - args.fw_naming = 'SOF' - print("The option '--fw-naming AVS' is ignored for deployable builds.") - if args.use_platform_subdir: - args.use_platform_subdir = False - print("The option '--use-platform-subdir' is ignored for deployable builds.") + if args.fw_naming == 'AVS' or args.use_platform_subdir: + sys.exit("Options '--fw-naming=AVS' and '--use-platform-subdir'" + " are incompatible with --deployable-build.") if args.fw_naming == 'AVS': if not args.use_platform_subdir: