Skip to content

fix: Let the driver build on ArchLinux too#902

Merged
maxzhen merged 3 commits intoamd:mainfrom
X-Ryl669:fix-arch-build
Feb 8, 2026
Merged

fix: Let the driver build on ArchLinux too#902
maxzhen merged 3 commits intoamd:mainfrom
X-Ryl669:fix-arch-build

Conversation

@X-Ryl669
Copy link
Copy Markdown
Contributor

@X-Ryl669 X-Ryl669 commented Dec 7, 2025

The current main branch doesn't build on Arch linux (and all other derived distributions).
Please notice that Arch linux is very barebone, so this PR is also useful for any linux from scratch distributions.

The required changes are small, but painful to apply as a patch since it implies ever evolving submodule hashes for xrt.
It would a be a lot easier if these changes were merged in.

Description of the changes:

  1. Set the CPACK package type to TGZ if it detects an Arch based distribution. This create a simple archive with all build files. The distribution's package will bootstrap from this archive instead of hacky unpacking the debian package (which doesn't contains all the required files)
  2. Optionally allow to build the driver with Clang, since it's what being used in some Arch distributions.
  3. Fix the issue in the code when building with Clang (missing C23 extension that was used to declare a variable in a case branch)

@AMDGithubSCIMAdmin
Copy link
Copy Markdown

Can one of the admins verify this patch?

@X-Ryl669
Copy link
Copy Markdown
Contributor Author

X-Ryl669 commented Dec 7, 2025

I've just noticed PR #866, and a part of this PR will be useless if #866 is merged. However, the part that builds with Clang isn't in #866 so it's still required. I'll update this PR once #866 is merged, please don't merge meanwhile to avoid double work.

@X-Ryl669 X-Ryl669 marked this pull request as draft December 7, 2025 13:46
@kashif
Copy link
Copy Markdown
Contributor

kashif commented Feb 6, 2026

@X-Ryl669 apologies about the merge conflicts, want me to fix?

Signed-off-by: X-Ryl669 <boite.pour.spam@gmail.com>
Signed-off-by: X-Ryl669 <boite.pour.spam@gmail.com>
…be modified by user system, not a build script

Signed-off-by: X-Ryl669 <boite.pour.spam@gmail.com>
@X-Ryl669
Copy link
Copy Markdown
Contributor Author

X-Ryl669 commented Feb 8, 2026

Thank you for your offer. I've tried to build the latest version, but I've add many issues, so it was better for me to work out how to solve them practically.

I think it's OK now. There are many things to fix in XRT repository, but it's not xdna-driver business so it's for another day. I've managed to avoid changing xrt submodule, so it can be merged in this repository.

@X-Ryl669 X-Ryl669 marked this pull request as ready for review February 8, 2026 10:49
struct pci_dev *pdev = to_pci_dev(xdna->ddev.dev);
void __iomem *tbl[PCI_NUM_RESOURCES] = {0};
const struct firmware *npufw, *certfw;
const struct firmware *npufw = NULL, *certfw = NULL;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, npufw can be used uninitialized later on in the function in the error handling code and clang errors out and refuse to build.

Comment thread src/driver/CMakeLists.txt
)

set(MAKE_DRV "cd driver/${XDNA_DRV_DIR}; make ${XDNA_DRV_BLD_FLAGS_DKMS} KERNEL_SRC=\${kernel_source_dir}; cd ../..")
set(CLEAN_DRV "cd driver/${XDNA_DRV_DIR}; make clean KERNEL_SRC=\${kernel_source_dir}; cd ../..")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a constant error in Xilinx's code with dealing with PWD in DKMS build configuration. The dkms.conf MAKE and CLEAN directives aren't shell command, and they are run in their own subshell, so the PWD doesn't leak to the top subshell.

In addition, on Clang built kernel, DKMS appends USE_LLVM=1 to the given MAKE command so it must be a make command not a shell script.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same is true for all XRT dkms.conf.in files that all present the same issue. Hopefully, they aren't used in this repository for this driver so it's hidden under the rug.

@maxzhen
Copy link
Copy Markdown
Collaborator

maxzhen commented Feb 8, 2026

ok to test

@maxzhen maxzhen merged commit 20875d1 into amd:main Feb 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants