Skip to content
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

linuxManualConfig: keep *.dtsi in dev output #379794

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

qbisi
Copy link
Contributor

@qbisi qbisi commented Feb 6, 2025

I found it very hard compiling out-of-tree devicetree in nixpkgs (not the devicetree overlay blob) , since most of the third-part devicetree require the .dtsi include file under arch/"$arch"/boot/dts directory which will be deleted during cleanup phase.
So one have to download and extract the kernel source again (and maybe patch the souce again).

Currently, the standard way to support out-of-tree board is to patch the kernel source, including copying the devicetree source file, patching the makefile. Which is not a vanilla work.

With this patch, and also some modification on nixos/device-tree module , we can support out-of-tree boards with the given dts file easily.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@qbisi qbisi requested a review from K900 February 6, 2025 09:22
@github-actions github-actions bot added the 6.topic: kernel The Linux kernel label Feb 6, 2025
@qbisi qbisi requested a review from NickCao February 6, 2025 09:22
@K900
Copy link
Contributor

K900 commented Feb 12, 2025

It may be a better option to just use kernel.src for this?

@qbisi
Copy link
Contributor Author

qbisi commented Feb 12, 2025

the *.dtsi files can also be found under scripts/dtc/include-prefixes/ .So i will close this pr.

@qbisi qbisi closed this Feb 12, 2025
@qbisi qbisi deleted the kernel branch February 12, 2025 19:58
@qbisi qbisi restored the kernel branch February 13, 2025 08:53
@qbisi
Copy link
Contributor Author

qbisi commented Feb 13, 2025

the *.dtsi files can also be found under scripts/dtc/include-prefixes/ , but they are symlink to *.dtsi files under $buildRoot/arch/$linuxArch/boot/dts,
if the source is not kept, symlink will be deleted.

@qbisi qbisi reopened this Feb 13, 2025
@qbisi
Copy link
Contributor Author

qbisi commented Feb 13, 2025

@K900

Two reason for not using kernel.src.

  1. src may be either tarball or directory, if src is a tarball then ${kernel.src}/arch/$linuxArch/boot/dts is not a directory.
  2. kernel src are often patched, if patches including modifying *.dtsi files, then ${kernel.src} is not the correct source.

Finaly, we have to do unpack/patch/install jobs to make a source package including *.dtsi files.
Which is exactly what should the linux^dev package do.

@alyssais
Copy link
Member

Two reason for not using kernel.src.

1. src may be either tarball or directory, if src is a tarball then ${kernel.src}/arch/$linuxArch/boot/dts is not a directory.

2. kernel src are often patched, if patches including modifying *.dtsi files, then  ${kernel.src} is not the correct source.

lib.srcOnly exists to get you the unpacked, patched sources.

@qbisi
Copy link
Contributor Author

qbisi commented Feb 13, 2025

Directory scripts/dtc/include-prefixes take responsible for compiling out-of-tree dts.

Nixos have a device-tree module utilizing this directoy in linux^dev for compiling dtbo.

includePaths = ["${lib.getDev cfg.kernelPackage}/lib/modules/${cfg.kernelPackage.modDirVersion}/source/scripts/dtc/include-prefixes"] ++ cfg.dtboBuildExtraIncludePaths;

So why not keeping the *.dtsi file for compiling dtb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants