Skip to content

Commit 4c01b06

Browse files
authored
Update DSP mount and search path configuration (#234)
Update DSP mount and search path configuration to support dynamic runtime resolution - Refactored mount logic to allow flexible path overrides - Added support for environment-based search path injection
2 parents 5171117 + 520324d commit 4c01b06

16 files changed

Lines changed: 574 additions & 120 deletions

.github/workflows/abi-compat.yml

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,69 @@ jobs:
3636
# fetch-depth: 0 required for git worktree to access development branch
3737
# without full history, worktree creation will fail
3838
fetch-depth: 0
39-
40-
- name: Install ABI tools & build dependencies
39+
40+
- name: Configure APT for amd64 + arm64 (ports) and update
41+
shell: bash
4142
run: |
43+
set -euxo pipefail
44+
45+
# Detect Ubuntu codename
46+
CODENAME="$(. /etc/os-release; echo "${VERSION_CODENAME}")"
47+
: "${CODENAME:?Failed to read VERSION_CODENAME from /etc/os-release}"
48+
echo "Detected Ubuntu codename: ${CODENAME}"
49+
50+
# 1) Enable ARM64 multiarch
51+
sudo dpkg --add-architecture arm64
52+
53+
# 2) Overwrite main sources to be amd64-only (archive + security)
54+
sudo tee /etc/apt/sources.list > /dev/null <<EOF
55+
deb [arch=amd64] http://archive.ubuntu.com/ubuntu ${CODENAME} main restricted universe multiverse
56+
deb [arch=amd64] http://archive.ubuntu.com/ubuntu ${CODENAME}-updates main restricted universe multiverse
57+
deb [arch=amd64] http://archive.ubuntu.com/ubuntu ${CODENAME}-backports main restricted universe multiverse
58+
deb [arch=amd64] http://security.ubuntu.com/ubuntu ${CODENAME}-security main restricted universe multiverse
59+
EOF
60+
61+
# 3) Add Ubuntu Ports for arm64 only
62+
sudo tee /etc/apt/sources.list.d/arm64-ports.list > /dev/null <<EOF
63+
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${CODENAME} main restricted universe multiverse
64+
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${CODENAME}-updates main restricted universe multiverse
65+
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${CODENAME}-backports main restricted universe multiverse
66+
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${CODENAME}-security main restricted universe multiverse
67+
EOF
68+
69+
# 4) Remove deb822 sources that may still request arm64 from security.ubuntu.com
70+
sudo rm -f /etc/apt/sources.list.d/ubuntu.sources || true
71+
72+
# 5) Clean and update indices (amd64 from archive/security; arm64 from ports)
73+
sudo apt-get clean
4274
sudo apt-get update
43-
sudo apt-get install -y abi-compliance-checker abi-dumper automake g++-aarch64-linux-gnu binutils-aarch64-linux-gnu
75+
76+
- name: Install ABI tools & build dependencies (incl. ARM64 libyaml)
77+
shell: bash
78+
run: |
79+
set -euxo pipefail
80+
sudo apt-get install -y \
81+
abi-compliance-checker abi-dumper elfutils \
82+
automake autoconf libtool pkg-config \
83+
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu \
84+
libyaml-dev \
85+
libyaml-0-2:arm64 libyaml-dev:arm64
86+
87+
# Sanity checks
4488
abi-compliance-checker -version
4589
abi-dumper -version
4690
91+
# ARM64 pkg-config file for yaml must exist
92+
ls -l /usr/include/yaml.h
93+
ls -l /usr/lib/aarch64-linux-gnu/pkgconfig/yaml-0.1.pc
94+
4795
# -------------------------------------------------------------------------
4896
# Build Phase: Compile both PR and baseline versions
4997
# -------------------------------------------------------------------------
5098
- name: Build PR (AArch64, with debug info)
99+
shell: bash
100+
env:
101+
PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig
51102
run: |
52103
./gitcompile --host=aarch64-linux-gnu
53104
ls -l src/.libs || true
@@ -59,6 +110,9 @@ jobs:
59110
60111
- name: Build baseline (AArch64, with debug info)
61112
working-directory: ../baseline
113+
shell: bash
114+
env:
115+
PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig
62116
run: |
63117
./gitcompile --host=aarch64-linux-gnu
64118
ls -l src/.libs || true

.github/workflows/build_linux_arm64.yml

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,69 @@ jobs:
2020
- name: Git checkout
2121
uses: actions/checkout@v4
2222

23-
- name: Install auto tools
23+
- name: Configure APT for amd64 + arm64 (ports) and update
24+
shell: bash
2425
run: |
25-
sudo apt-get install automake
26-
27-
- name: Download Linaro tools and untar
26+
set -euxo pipefail
27+
28+
# Detect Ubuntu codename
29+
CODENAME="$(. /etc/os-release; echo "${VERSION_CODENAME}")"
30+
: "${CODENAME:?Failed to read VERSION_CODENAME from /etc/os-release}"
31+
echo "Detected Ubuntu codename: ${CODENAME}"
32+
33+
# 1) Enable arm64 multiarch
34+
sudo dpkg --add-architecture arm64
35+
36+
# 2) Overwrite main sources to be amd64-only (archive + security)
37+
sudo tee /etc/apt/sources.list > /dev/null <<EOF
38+
deb [arch=amd64] http://archive.ubuntu.com/ubuntu ${CODENAME} main restricted universe multiverse
39+
deb [arch=amd64] http://archive.ubuntu.com/ubuntu ${CODENAME}-updates main restricted universe multiverse
40+
deb [arch=amd64] http://archive.ubuntu.com/ubuntu ${CODENAME}-backports main restricted universe multiverse
41+
deb [arch=amd64] http://security.ubuntu.com/ubuntu ${CODENAME}-security main restricted universe multiverse
42+
EOF
43+
44+
# 3) Add Ubuntu Ports for arm64 only
45+
sudo tee /etc/apt/sources.list.d/arm64-ports.list > /dev/null <<EOF
46+
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${CODENAME} main restricted universe multiverse
47+
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${CODENAME}-updates main restricted universe multiverse
48+
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${CODENAME}-backports main restricted universe multiverse
49+
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${CODENAME}-security main restricted universe multiverse
50+
EOF
51+
52+
# 4) Remove deb822 sources that may still request arm64 from security.ubuntu.com
53+
sudo rm -f /etc/apt/sources.list.d/ubuntu.sources || true
54+
55+
# 5) Clean and update indices (amd64 from archive/security; arm64 from ports)
56+
sudo apt-get clean
57+
sudo apt-get update
58+
59+
- name: Install auto tools and dependencies
2860
run: |
29-
wget -c https://releases.linaro.org/components/toolchain/binaries/latest-7/aarch64-linux-gnu/gcc-linaro-7.5.0-2019.12-i686_aarch64-linux-gnu.tar.xz
30-
tar xf gcc-linaro-7.5.0-2019.12-i686_aarch64-linux-gnu.tar.xz
61+
set -euxo pipefail
62+
sudo apt-get install -y --no-install-recommends \
63+
automake autoconf libtool pkg-config \
64+
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu\
65+
libyaml-dev \
66+
libyaml-0-2:arm64 libyaml-dev:arm64
67+
68+
- name: Sanity check libyaml (headers + ARM64 pc)
69+
run: |
70+
set -euxo pipefail
71+
ls -l /usr/include/yaml.h
72+
ls -l /usr/lib/aarch64-linux-gnu/pkgconfig/yaml-0.1.pc
73+
PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig pkg-config --cflags --libs yaml-0.1
3174
3275
- name: Set Up Build Environment and compile code for LE platform
3376
run: |
34-
3577
# Set Up Build Environment
36-
export PATH="$PWD/gcc-linaro-7.5.0-2019.12-i686_aarch64-linux-gnu/bin/:$PATH"
3778
export CC=aarch64-linux-gnu-gcc
3879
export CXX=aarch64-linux-gnu-g++
3980
export AS=aarch64-linux-gnu-as
4081
export LD=aarch64-linux-gnu-ld
4182
export RANLIB=aarch64-linux-gnu-ranlib
4283
export STRIP=aarch64-linux-gnu-strip
43-
84+
export PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig
85+
4486
# Compile the source code
4587
./gitcompile --host=aarch64-linux-gnu
4688

.github/workflows/build_linux_gnu.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,14 @@ jobs:
2020
- name: Git checkout
2121
uses: actions/checkout@v4
2222

23-
- name: Install auto tools
23+
- name: Install Autotools + dependencies
2424
run: |
25-
sudo apt-get install automake
25+
sudo apt-get update
26+
sudo apt-get install -y \
27+
build-essential \
28+
autoconf automake libtool pkg-config \
29+
libyaml-dev \
30+
tar gzip
2631
2732
- name: Compile code for LE platform
2833
run: |

.github/workflows/codeql.yml

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,50 @@ jobs:
3434
- name: Checkout repository
3535
uses: actions/checkout@v4
3636

37-
- name: Install auto tools
37+
- name: Configure APT for amd64 + arm64 (ports) and update
38+
shell: bash
3839
run: |
39-
sudo apt-get install automake
40-
41-
- name: Download Linaro tools and untar
40+
set -euxo pipefail
41+
42+
# Detect Ubuntu codename
43+
CODENAME="$(. /etc/os-release; echo "${VERSION_CODENAME}")"
44+
: "${CODENAME:?Failed to read VERSION_CODENAME from /etc/os-release}"
45+
echo "Detected Ubuntu codename: ${CODENAME}"
46+
47+
# 1) Enable arm64 multiarch
48+
sudo dpkg --add-architecture arm64
49+
50+
# 2) Overwrite main sources to be amd64-only (archive + security)
51+
sudo tee /etc/apt/sources.list > /dev/null <<EOF
52+
deb [arch=amd64] http://archive.ubuntu.com/ubuntu ${CODENAME} main restricted universe multiverse
53+
deb [arch=amd64] http://archive.ubuntu.com/ubuntu ${CODENAME}-updates main restricted universe multiverse
54+
deb [arch=amd64] http://archive.ubuntu.com/ubuntu ${CODENAME}-backports main restricted universe multiverse
55+
deb [arch=amd64] http://security.ubuntu.com/ubuntu ${CODENAME}-security main restricted universe multiverse
56+
EOF
57+
58+
# 3) Add Ubuntu Ports for arm64 only
59+
sudo tee /etc/apt/sources.list.d/arm64-ports.list > /dev/null <<EOF
60+
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${CODENAME} main restricted universe multiverse
61+
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${CODENAME}-updates main restricted universe multiverse
62+
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${CODENAME}-backports main restricted universe multiverse
63+
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${CODENAME}-security main restricted universe multiverse
64+
EOF
65+
66+
# 4) Remove deb822 sources that may still request arm64 from security.ubuntu.com
67+
sudo rm -f /etc/apt/sources.list.d/ubuntu.sources || true
68+
69+
# 5) Clean and update indices (amd64 from archive/security; arm64 from ports)
70+
sudo apt-get clean
71+
sudo apt-get update
72+
73+
- name: Install auto tools and dependencies
4274
run: |
43-
wget -c https://releases.linaro.org/components/toolchain/binaries/latest-7/aarch64-linux-gnu/gcc-linaro-7.5.0-2019.12-i686_aarch64-linux-gnu.tar.xz
44-
tar xf gcc-linaro-7.5.0-2019.12-i686_aarch64-linux-gnu.tar.xz
75+
set -euxo pipefail
76+
sudo apt-get install -y --no-install-recommends \
77+
automake autoconf libtool pkg-config \
78+
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu\
79+
libyaml-dev \
80+
libyaml-0-2:arm64 libyaml-dev:arm64
4581
4682
# Initializes the CodeQL tools for scanning.
4783
- name: Initialize CodeQL
@@ -55,13 +91,13 @@ jobs:
5591
name: Set Up Build Environment and compile code for LE platform
5692
run: |
5793
# Set Up Build Environment
58-
export PATH="$PWD/gcc-linaro-7.5.0-2019.12-i686_aarch64-linux-gnu/bin/:$PATH"
5994
export CC=aarch64-linux-gnu-gcc
6095
export CXX=aarch64-linux-gnu-g++
6196
export AS=aarch64-linux-gnu-as
6297
export LD=aarch64-linux-gnu-ld
6398
export RANLIB=aarch64-linux-gnu-ranlib
6499
export STRIP=aarch64-linux-gnu-strip
100+
export PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig
65101
66102
# Compile the source code
67103
chmod 777 gitcompile

Docs/conf_guideline.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
📄 **YAML Configuration Usage Guide**
2+
3+
---
4+
5+
### 🔧 **Purpose**
6+
The YAML configuration file enables **fastrpc** to set machine-specific configurations at runtime. Each machine entry corresponds to a specific hardware platform.
7+
8+
- fastrpc supports reading YAML configuration files from a particular directory. Users should ensure all configuration files are stored in that same directory.
9+
- For Linux platforms: `/usr/share/qcom/conf.d/`
10+
- In case of multiple configuration files defining path for a single machine, the directory is parsed in lexicographical order and the latest one carrying the
11+
machine path is picked.
12+
- **Machine Name**: Obtain the machine name for your platform from:
13+
```
14+
/sys/firmware/devicetree/base/model
15+
```
16+
(fastrpc uses same path for matching machine names)
17+
---
18+
### 📄 **Current Properties**
19+
- **DSP_LIBRARY_PATH**: Specifies the path to DSP binaries and resources for the Machine.
20+
---
21+
22+
### 📁 **Format Guidelines**
23+
The configuration uses YAML format with the following structure:
24+
```
25+
machines:
26+
"Machine Name":
27+
DSP_LIBRARY_PATH: "/relative/path/to/dsp/binaries/"
28+
```
29+
30+
**Key Points:**
31+
- The root element is `machines:`
32+
- Each machine name is a quoted string key under `machines:`
33+
- Properties are indented under each machine name
34+
- Use proper YAML indentation
35+
- Paths should be quoted strings
36+
37+
---
38+
39+
### **Example Configuration**
40+
```
41+
machines:
42+
"Qualcomm Technologies, Inc. DB820c":
43+
DSP_LIBRARY_PATH: "/apq8096/Qualcomm/db820c/"
44+
"Thundercomm Dragonboard 845c":
45+
DSP_LIBRARY_PATH: "/sdm845/Thundercomm/db845c/"
46+
```
47+
48+
---
49+
50+
### ⚠️ **Important Notes**
51+
- Do **not** modify machine names unless adding a new supported Machine.
52+
- Ensure `DSP_LIBRARY_PATH` values:
53+
- Are enclosed in double quotes (`"..."`).
54+
- Are **relative to `/usr/share/qcom/`**.
55+
- Follow YAML syntax rules:
56+
- Use consistent indentation.
57+
- Ensure proper spacing after colons (`: `).
58+
- Quote strings containing special characters or spaces.
59+
- Avoid tabs (use spaces only).
60+
- Maintain:
61+
- Proper YAML structure and hierarchy.
62+
- Consistent formatting across entries.
63+
- When adding new properties:
64+
- Document their purpose **here**.
65+
- Follow the same indentation pattern.
66+
- Do **not** create duplicate Machine entries.
67+
- Validate YAML syntax before deployment to avoid parsing errors.
68+
69+
---
70+
71+
### **Adding New Platforms**
72+
To add a new Machine, follow the existing YAML format:
73+
```
74+
machines:
75+
"New Machine Name":
76+
DSP_LIBRARY_PATH: "/new_machine/path/"
77+
```
78+
79+
Ensure the new entry is properly indented under the `machines:` root element and follows YAML syntax conventions.
80+
81+
---
82+
83+
### 📝 **File Naming**
84+
Configuration files should use the `.yaml` or `.yml` extension and be placed in the designated configuration directory (`/usr/share/qcom/conf.d/` on Linux platforms).
85+
86+
### ✅ Schema Validation
87+
To ensure the configuration file adheres to the required structure, validate it against the schema provided.
88+
89+
Schema File Location:
90+
<ROOT>/Docs/schemas/fastrpc-config-schema.yaml
91+
92+
Validation Command:
93+
Use Yamale for schema validation:
94+
yamale -s fastrpc-config-schema.yaml <yaml file>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
machines: map(key=str(), value=map(DSP_LIBRARY_PATH=regex('^/.+/')))

configure.ac

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,26 @@ AM_PROG_CC_C_O
4343

4444
# Checks for library functions.
4545

46+
# Enable pkg-config
47+
PKG_PROG_PKG_CONFIG
48+
49+
# Check for libyaml only if not Android
50+
AS_IF([test "$compile_for_android" = no], [
51+
PKG_CHECK_MODULES([YAML], [yaml-0.1], [],
52+
[AC_MSG_ERROR([libyaml (yaml-0.1) is required but not found.])])
53+
AC_SUBST(YAML_CFLAGS)
54+
AC_SUBST(YAML_LIBS)
55+
])
56+
57+
# Configure config base path option (--with-config-base-dir)
58+
AC_ARG_WITH([config-base-dir],
59+
[AS_HELP_STRING([--with-config-base-dir=PATH],
60+
[Base directory for config files (default: /usr/share/qcom)])],
61+
[config_base_dir="$withval"],
62+
[config_base_dir="/usr/share/qcom/"])
63+
AC_MSG_NOTICE([Config base path: $config_base_dir])
64+
AC_SUBST([CONFIG_BASE_DIR], ["$config_base_dir"])
65+
4666
AC_CONFIG_FILES([
4767
Makefile
4868
inc/Makefile

inc/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ noinst_HEADERS = \
4040
fastrpc_cap.h \
4141
fastrpc_common.h \
4242
fastrpc_config.h \
43+
fastrpc_config_parser.h \
4344
fastrpc_context.h \
4445
fastrpc_hash_table.h \
4546
fastrpc_internal.h \

0 commit comments

Comments
 (0)