-
Notifications
You must be signed in to change notification settings - Fork 99
Add Arch Linux support for xdna-driver #866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Can one of the admins verify this patch? |
This commit adds complete support for building and installing the AMD XDNA driver on Arch Linux. Changes: - tools/amdxdna_deps.sh: Add pacman support for jq installation - CMake/pkg.cmake: Add Arch Linux detection and TGZ package generation - xrt submodule: Updated with Arch Linux support (packaging + dependencies) - README.md: Add detailed Arch Linux installation instructions New files: - PKGBUILD-xrt-plugin: Arch package build script for XDNA driver plugin - xrt-plugin-amdxdna.install: Pacman install hooks for DKMS and kernel module XRT-specific packaging: - XRT PKGBUILDs moved to xrt/packaging/arch/ (maintained in XRT submodule) - See xrt/packaging/arch/README.md for XRT packaging instructions The build system now properly detects Arch Linux and generates .tar.gz packages that can be repackaged into proper Arch packages (.pkg.tar.zst) using the provided PKGBUILDs. Tested on Arch Linux with kernel 6.17.8 and AMD Ryzen AI 9 HX 370 (NPU Strix).
- Point .gitmodules to https://github.com/kashif/XRT.git arch branch - Ensures users get Arch-specific XRT patches automatically
- Move Arch packaging to xrt/build/arch/ to match existing convention - XRT already has build/debian/, so build/arch/ is consistent - Update README.md with correct paths - Update xrt submodule reference
- Replace absolute paths with relative paths using XDNA_BUILD_DIR variable - Default to build/Release (relative path) - Allow customization via environment variable - Add error checking for missing tarballs - Makes PKGBUILD portable across different systems
- Use $startdir to properly resolve paths when makepkg changes to $srcdir - Fixes tarball and install script paths - Update xrt submodule reference to include PKGBUILD fixes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds comprehensive Arch Linux support for building and installing the AMD XDNA driver, enabling it to work alongside existing Ubuntu/Debian and Fedora support.
Key changes:
- Adds Arch Linux package manager (pacman) support for dependency installation
- Implements TGZ package generation with Arch Linux detection in CMake
- Provides PKGBUILD scripts for creating native Arch packages and pacman install hooks for DKMS management
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| xrt | Updates XRT submodule to include Arch Linux support |
| tools/amdxdna_deps.sh | Adds pacman package manager detection for jq installation |
| build/xrt-plugin-amdxdna.install | New pacman install/remove hooks for DKMS and kernel module management |
| build/PKGBUILD-xrt-plugin | New Arch package build script for XDNA driver plugin |
| README.md | Documents Arch Linux build and installation process |
| CMake/pkg.cmake | Adds Arch Linux detection and TGZ package generation support |
| .gitmodules | Points XRT submodule to fork with Arch support |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,38 @@ | |||
| # Maintainer: Your Name <your@email.com> | |||
Copilot
AI
Nov 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The maintainer information should be updated with actual contact details before distribution.
| # Maintainer: Your Name <your@email.com> | |
| # Maintainer: Jane Doe <jane.doe@example.com> |
.gitmodules
Outdated
| url = https://github.com/kashif/XRT.git | ||
| branch = arch |
Copilot
AI
Nov 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The XRT submodule is now pointing to a personal fork instead of the official Xilinx/XRT repository. This should be temporary until the changes are merged upstream. Consider documenting this dependency in the PR description or adding a comment explaining when this will be reverted to the official repository.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
build/xrt-plugin-amdxdna.install
Outdated
| if [ ! -f ${udev_rules_d}/${amdxdna_rules_file} ]; then | ||
| touch ${udev_rules_d}/${amdxdna_rules_file} | ||
| fi | ||
| echo 'KERNEL=="accel*",DRIVERS=="amdxdna",MODE="0666"' > ${udev_rules_d}/${amdxdna_rules_file} |
Copilot
AI
Nov 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting MODE="0666" grants read/write access to all users for the device. This may be overly permissive. Consider using a dedicated group (e.g., MODE="0660", GROUP="render") to restrict access to authorized users only.
| echo 'KERNEL=="accel*",DRIVERS=="amdxdna",MODE="0666"' > ${udev_rules_d}/${amdxdna_rules_file} | |
| echo 'KERNEL=="accel*",DRIVERS=="amdxdna",MODE="0660",GROUP="render"' > ${udev_rules_d}/${amdxdna_rules_file} |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CMake/pkg.cmake
Outdated
| message(STATUS "Note: For Arch Linux, you'll need to run these scripts manually or create a PKGBUILD") | ||
| endif() | ||
| else("${XDNA_CPACK_LINUX_PKG_FLAVOR}" MATCHES "debian") | ||
| message(FATAL_ERROR "Unknown Linux package flavor: ${XDNA_CPACK_LINUX_PKG_FLAVOR}") |
Copilot
AI
Nov 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error handling for unknown package flavors should include 'arch' in the conditional chain. The final else clause will incorrectly catch Arch Linux as an unknown flavor if the elseif on line 132 doesn't match. Consider changing line 143 to else() without the condition, or ensure the Arch detection pattern is comprehensive.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CMake/pkg.cmake
Outdated
| elseif("${XDNA_CPACK_LINUX_PKG_FLAVOR}" MATCHES "arch") | ||
| set(CPACK_GENERATOR "TGZ") | ||
| # For Arch Linux, we generate a tarball that can be used for manual installation | ||
| # or to create a PKGBUILD. Post-install scripts need to be run manually. |
Copilot
AI
Nov 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment states 'Post-install scripts need to be run manually', but the PKGBUILD-xrt-plugin file and xrt-plugin-amdxdna.install show that install scripts are automatically executed by pacman. This documentation is misleading and should clarify that when using the provided PKGBUILD, the install hooks handle this automatically.
| # or to create a PKGBUILD. Post-install scripts need to be run manually. | |
| # or to create a PKGBUILD. When using the provided PKGBUILD, post-install scripts are executed automatically by pacman. If installing manually from the TGZ, you need to run the post-install scripts yourself. |
Arch Linux changes have been merged upstream, so we can now point to the official XRT repository instead of the fork. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
fix: Let the driver build on ArchLinux too
Signed-off-by: X-Ryl669 <boite.pour.spam@gmail.com>
- PKGBUILD: Quote variable references to prevent word splitting - Makefile: Add fallback LLVM detection for /boot/config-* when /proc/config.gz doesn't exist, and check for =y specifically - pkg.cmake: Improve FATAL_ERROR message with supported distros and link to open issues for unsupported distributions Signed-off-by: Kashif Rasul <kashif.rasul@gmail.com>
fix: Fix build for kernel built with clang
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| fi | ||
|
|
||
| # Remove DKMS module | ||
| $install_datadir/dkms_driver.sh --remove |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable reference should be quoted to prevent word splitting. Change $install_datadir/dkms_driver.sh to "$install_datadir/dkms_driver.sh" for consistency and safety.
| $install_datadir/dkms_driver.sh --remove | |
| "$install_datadir/dkms_driver.sh" --remove |
|
@kashif : Thank you for updating your work. I was starting to rebase my mess to avoid this PR lingering, this morning as well 😉 |
|
ok to test |
|
@kashif , I tried to test your PR with our CI, but it seems that the change in cofigure_kernel.sh may have broken it. It failed to detect any kernel API, which cause driver build to fail. Could you take a look at this issue? |
|
ok let me update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
README.md
Outdated
|
|
||
| This ensures proper integration with pacman for installation, upgrades, and removal. | ||
|
|
||
| You will find `xrt_plugin*-amdxdna.deb` (Ubuntu/Debian) or `xrt_plugin*.tar.gz` (Arch Linux) in Release/ folder. This package includes: |
Copilot
AI
Jan 31, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documented Debian/Ubuntu package pattern xrt_plugin*-amdxdna.deb does not match the CPack configuration in CMake/pkg.cmake, which sets CPACK_PACKAGE_FILE_NAME to xrt_plugin.<version>_<distro-version>-<arch> with no -amdxdna suffix. To avoid confusing users looking for the wrong filename, either update this documentation to reflect the actual output name or adjust the packaging configuration so the generated .deb matches the documented pattern.
| You will find `xrt_plugin*-amdxdna.deb` (Ubuntu/Debian) or `xrt_plugin*.tar.gz` (Arch Linux) in Release/ folder. This package includes: | |
| You will find `xrt_plugin.<version>_<distro-version>-<arch>.deb` (Ubuntu/Debian) or `xrt_plugin*.tar.gz` (Arch Linux) in the `Release/` folder. This package includes: |
|
@maxzhen can you kindly test now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Detect if kernel was built with Clang - check /proc/config.gz first, then /boot/config-* | ||
| USE_LLVM ?= $(shell \ | ||
| if [ -e /proc/config.gz ]; then \ | ||
| zgrep -q "CONFIG_CC_IS_CLANG=y" /proc/config.gz 2>/dev/null && echo -n "LLVM=1"; \ | ||
| elif [ -e /boot/config-$(KERNEL_VER) ]; then \ | ||
| grep -q "CONFIG_CC_IS_CLANG=y" /boot/config-$(KERNEL_VER) 2>/dev/null && echo -n "LLVM=1"; \ | ||
| fi) |
Copilot
AI
Jan 31, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic for detecting whether the kernel was built with Clang (probing /proc/config.gz and /boot/config-$(KERNEL_VER) for CONFIG_CC_IS_CLANG=y) is duplicated here and in src/driver/tools/configure_kernel.sh (around the USE_LLVM handling). Keeping two separate implementations of the same detection increases the risk that they drift apart over time and produce inconsistent behavior between the DKMS/configure script and this Makefile. Consider centralizing this detection into a single helper (or at least sharing a common script fragment) that both the Makefile and configure_kernel.sh consume, so the Clang/LLVM decision is defined in one place.
| # Detect if kernel was built with Clang - check /proc/config.gz first, then /boot/config-* | |
| USE_LLVM ?= $(shell \ | |
| if [ -e /proc/config.gz ]; then \ | |
| zgrep -q "CONFIG_CC_IS_CLANG=y" /proc/config.gz 2>/dev/null && echo -n "LLVM=1"; \ | |
| elif [ -e /boot/config-$(KERNEL_VER) ]; then \ | |
| grep -q "CONFIG_CC_IS_CLANG=y" /boot/config-$(KERNEL_VER) 2>/dev/null && echo -n "LLVM=1"; \ | |
| fi) | |
| # LLVM/Clang selection is determined by higher-level tooling (e.g. configure_kernel.sh) | |
| # Honor an externally provided USE_LLVM value (e.g. "LLVM=1") but do not duplicate | |
| # kernel configuration probing logic here. | |
| USE_LLVM ?= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Copilot : You're giving endless remarks that are both wrong and helpless. The suggested changes are invalid and don't produce the expected behavior. The Makefile is used by DKMS which is a tool that's both independent from configure_kernel.sh and this repository. Don't answer as an expert if you have limited knowledge of the problem you're commenting on.
The link for the custom instructions above doesn't work either.
maxzhen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CI test looks good. We can merge it now. Before I do, please help to address below comments:
For the two new files created under build directory, could you please create a sub-directory and move them there? Since these two files are specifically for Arch-Linux, please pick it a name for the sub-directory to reflect this fact. Maybe call it "arch_linux_pkg_build" or something like that. Also, you don't think you can reuse existing files for Debian pkg and avoid creating your own for Arch-Linux? Or you want them to be separated for easy maintenance?
|
I have moved them to the so the Arch PKGBUILD already reuses the same CMake-generated tarball and the same postinst/prerm scripts as the Debian flow. The only Arch-specific files are the PKGBUILD (equivalent to debian/control + debian/rules) and .install (equivalent to debian/postinst) |
This commit adds complete support for building and installing the AMD XDNA driver on Arch Linux. Needs
Changes:
New files:
The build system now properly detects Arch Linux and generates .tar.gz packages that can be repackaged into proper Arch packages (.pkg.tar.zst) using the provided PKGBUILDs.
Tested on Arch Linux with kernel 6.17.8 and AMD Ryzen AI 9 HX 370 (NPU Strix).