73 lines
1.7 KiB
Diff
73 lines
1.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: monok8s <monok8s@example.invalid>
|
|
Date: Sun, 10 May 2026 00:00:00 +0000
|
|
Subject: [PATCH] dpa_app: allow XML config paths to be overridden by env
|
|
|
|
Keep the vendor default XML paths, but allow deployments to override them
|
|
without patching the binary or placing board-specific XML files directly
|
|
under /etc.
|
|
|
|
Supported environment variables:
|
|
|
|
CDX_CFG_FILE
|
|
CDX_PCD_FILE
|
|
CDX_PDL_FILE
|
|
CDX_SP_FILE
|
|
|
|
This is useful for monok8s/OpenRC integration where board-specific DPA
|
|
configuration can live under a managed config directory.
|
|
---
|
|
dpa_app/dpa.c | 30 ++++++++++++++++++++++++++++++
|
|
1 file changed, 30 insertions(+)
|
|
|
|
diff --git a/dpa_app/dpa.c b/dpa_app/dpa.c
|
|
index 91ca1d4..960afcd 100644
|
|
--- a/dpa_app/dpa.c
|
|
+++ b/dpa_app/dpa.c
|
|
@@ -91,6 +91,34 @@ char *pcd_file = DEFAULT_PCD_FILE;
|
|
char *pdl_file = DEFAULT_PDL_FILE;
|
|
char *sp_file = DEFAULT_SP_FILE;
|
|
|
|
+static void dpa_load_env_paths(void)
|
|
+{
|
|
+ char *v;
|
|
+
|
|
+ v = getenv("CDX_CFG_FILE");
|
|
+ if (v && *v)
|
|
+ cfg_file = v;
|
|
+
|
|
+ v = getenv("CDX_PCD_FILE");
|
|
+ if (v && *v)
|
|
+ pcd_file = v;
|
|
+
|
|
+ v = getenv("CDX_PDL_FILE");
|
|
+ if (v && *v)
|
|
+ pdl_file = v;
|
|
+
|
|
+ v = getenv("CDX_SP_FILE");
|
|
+ if (v && *v)
|
|
+ sp_file = v;
|
|
+
|
|
+#ifdef DPA_C_DEBUG
|
|
+ printf("%s::cfg_file %s\n", __func__, cfg_file);
|
|
+ printf("%s::pcd_file %s\n", __func__, pcd_file);
|
|
+ printf("%s::pdl_file %s\n", __func__, pdl_file);
|
|
+ printf("%s::sp_file %s\n", __func__, sp_file);
|
|
+#endif
|
|
+}
|
|
+
|
|
//fmc model from xml files
|
|
static struct fmc_model_t cmodel;
|
|
|
|
@@ -752,6 +780,8 @@ int dpa_init(void)
|
|
char devname[64];
|
|
int retval;
|
|
|
|
+ dpa_load_env_paths();
|
|
+
|
|
//open cdx control device
|
|
sprintf(devname, "/dev/%s", CDX_CTRL_CDEVNAME);
|
|
cdx_dev_handle = open(devname, O_RDWR);
|
|
--
|
|
2.39.5
|