Commit graph

244 commits

Author SHA1 Message Date
Robert Hensing
3e83fe9aa5 kernel: Make lazier (fix infinite recursion) 2024-04-25 16:34:57 +02:00
Samuel Dionne-Riel
1504f79fdf linuxManualConfig: Sometimes depend on ubootTools
This issue was (understandably) introduced with #262677.
2024-04-13 15:07:30 +03:00
Yureka
8a5f6594da
linux_latest: optionally build Linux 6.7 and onwards with rust support
With the current patching situation around enabling Linux to build
with whatever rustc/bindgen version we have in nixpkgs, it feels like
supporting a Rust-by-default build at this time is not fully
justified.

Co-authored-by: Julian Stecklina <julian.stecklina@cyberus-technology.de>
2024-01-12 20:28:46 +01:00
Artturi
3039676d8a
Merge pull request #262677 from Artturin/repick2
linuxManualConfig: always depend on ubootTools
2023-10-22 10:57:38 +03:00
Alyssa Ross
52a1b0c077 linuxManualConfig: always depend on ubootTools
Since 41f788b121 ("linuxManualConfig: use the default make target"),
we don't know ahead of time whether the kernel build will attempt to
produce a uImage in addition to whatever we're expecting it to build.
ubootTools is not a big dependency, so let's just always include it.
2023-10-22 09:09:11 +03:00
Alyssa Ross
96fe81f17c linux: remove hack for old kernels
The oldest kernel supported in Nixpkgs is now 4.19 LTS, so we don't
need this any more.
2023-10-21 19:13:50 +00:00
github-actions[bot]
81871f4c87
Merge staging-next into staging 2023-10-08 12:01:52 +00:00
Artturi
45e88c4cb4
Merge pull request #245968 from amjoseph-nixpkgs/pr/linux/kernel/repick4
linuxManualConfig: fix inaccurate FIXME comment
2023-09-30 10:48:00 +03:00
Kiskae
fc37c2d524 linuxManualConfig: generalize depmod resolution 2023-09-12 12:51:54 +02:00
Kiskae
813e000742 linux_testing: 6.5-rc7 -> 6.6-rc1
rc1: https://lwn.net/Articles/944122/
2023-09-12 07:45:33 +00:00
Alyssa Ross
468f5b6890 linuxManualConfig: fix inaccurate FIXME comment
I read this comment, checked out 4.19, saw that it didn't have any
instances of /bin/pwd, and rejoiced, assuming that the removal must
have been backported to the affected kernels.  But actually, /bin/pwd
was just removed earlier, in 4.15, so kernels older than that are
still affected.

Fix the version number in the comment so I don't go through exactly
the same process again a few months from now next time I'm working on
this file.
2023-07-28 15:23:00 -07:00
Alyssa Ross
46383fc82b linuxManualConfig: set badPlatforms
Older kernels shouldn't be marked as supporting architectures that
were only added to the kernel later.
2023-07-28 15:10:21 -07:00
Adam Joseph
dbe0d20b57 Revert "linuxManualConfig: don't build inside source tree"
This reverts commit d75cff2ee3.
2023-07-28 12:32:03 -07:00
Adam Joseph
93021f12c3 Revert "linuxManualConfig: unpack directly into $dev"
This reverts commit 7de3f08ce3.
2023-07-28 12:32:03 -07:00
Adam Joseph
12a06dc2b8 Revert "linuxManualConfig: use the default make target"
This reverts commit 41f788b121.
2023-07-28 12:32:03 -07:00
Adam Joseph
3aff655361 Revert "linuxManualConfig: install GDB scripts"
This reverts commit d57568fcad.
2023-07-28 12:32:03 -07:00
Adam Joseph
37eb25a428 Revert "linuxManualConfig: get rid of drvAttrs"
This reverts commit f521f46133.
2023-07-28 12:32:03 -07:00
Adam Joseph
92f7beccb2 Revert "linuxManualConfig: fix inaccurate FIXME comment"
This reverts commit 4d15632caf.
2023-07-28 12:32:03 -07:00
Adam Joseph
479dd15b5f Revert "linux: manual-config: use a non-random path for $buildRoot"
This reverts commit a695425e46.
2023-07-28 12:32:02 -07:00
Adam Joseph
ddaa949afe Revert "linux: default stdenv.hostPlatform.linux-kernel"
This reverts commit febe477628.
2023-07-28 12:32:02 -07:00
Adam Joseph
06f20db451 Revert "linuxManualConfig: always depend on ubootTools"
This reverts commit e5e02f3214.
2023-07-28 12:32:02 -07:00
Adam Joseph
c801a96a0d Revert "linuxManualConfig: set badPlatforms"
This reverts commit 5c5e5e2f1f.
2023-07-28 12:32:02 -07:00
Adam Joseph
007f794167 Revert "lib/systems: strip kernel to avoid reference cycles"
This reverts commit 2458c94c9e.
2023-07-28 12:32:02 -07:00
Adam Joseph
17d25bf762 Revert "linuxManualConfig: restore functionality of isModular and buildDTBs"
This reverts commit 284d76ee3d.
2023-07-28 12:32:01 -07:00
Adam Joseph
c200f5e411 partial revert of f3719756b5 2023-07-28 12:32:01 -07:00
Felix Bühler
0a2745684e
Merge pull request #239624 from Stunkymonkey/use-optionalString-then
treewide: use optionalString instead of 'then ""'
2023-07-22 13:02:47 +02:00
Adam Joseph
284d76ee3d linuxManualConfig: restore functionality of isModular and buildDTBs
Since https://github.com/NixOS/nixpkgs/pull/221707 the `isModular`
and `buildDTBs` parameters no longer function properly -- they now
control only whether or not these elements are copied to the
outpath; they are build unconditionally in any case.

This commit reverts the part of #221707 which caused this behavior
change.
2023-07-06 11:32:05 -07:00
Adam Joseph
2458c94c9e lib/systems: strip kernel to avoid reference cycles
Since https://github.com/NixOS/nixpkgs/pull/221707 we must ensure
that the image resulting from a kernel build is stripped.  If we do
not do this, there will be circular dependencies among its outpaths.

This commit fixes the breakage on mips.

Closes #224694
2023-07-06 10:46:24 -07:00
Felix Buehler
f3719756b5 treewide: use optionalString instead of 'then ""' 2023-06-24 20:19:19 +02:00
Alyssa Ross
5c5e5e2f1f linuxManualConfig: set badPlatforms
Older kernels shouldn't be marked as supporting architectures that
were only added to the kernel later.
2023-06-22 12:27:46 +00:00
Alyssa Ross
e5e02f3214
linuxManualConfig: always depend on ubootTools
Since 41f788b121 ("linuxManualConfig: use the default make target"),
we don't know ahead of time whether the kernel build will attempt to
produce a uImage in addition to whatever we're expecting it to build.
ubootTools is not a big dependency, so let's just always include it.
2023-05-22 09:53:39 +00:00
Alyssa Ross
febe477628 linux: default stdenv.hostPlatform.linux-kernel
With this change, we can do a reasonable default build of Linux for
configurations that do not have a corresponding platforms.nix entry,
and where the user has not explicitly specified the linux-kernel
values.  This allows us to do best effort builds for obscure
architectures (I tested a build for s390x).

The platformName binding has not been used since
70cb7050f5 ("Trying to make the linux kernels also cross-build."),
so I removed it.
2023-05-22 08:44:17 +00:00
Pierre Bourdon
a695425e46 linux: manual-config: use a non-random path for $buildRoot
Fixes reproducibility issues with x86/amd64 VDSO ELFs Build-IDs.

The kernel build system tries pretty hard to not leak build file paths
in its output. However, the embedded VDSO ELF files are built using
slightly different build options that do not include the path mapping
options that protect the rest of the kernel against this issue.

This should be fixed upstream eventually, but a lot of this logic is
duplicated across architecture, so I don't expect it will be a trivial
fix. Instead, make our derivation use a fixed build root directory so
this does not impact the build reproducibility.

Fixes #227800.
2023-05-18 15:29:11 +00:00
Alyssa Ross
4d15632caf
linuxManualConfig: fix inaccurate FIXME comment
I read this comment, checked out 4.19, saw that it didn't have any
instances of /bin/pwd, and rejoiced, assuming that the removal must
have been backported to the affected kernels.  But actually, /bin/pwd
was just removed earlier, in 4.15, so kernels older than that are
still affected.

Fix the version number in the comment so I don't go through exactly
the same process again a few months from now next time I'm working on
this file.
2023-05-08 13:08:44 +00:00
Alyssa Ross
f521f46133 linuxManualConfig: get rid of drvAttrs
This is an attempt to make linuxManualConfig look a lot more like a
normal package.  Previously, about half the attributes passed to
mkDerivation come from calling a "drvAttrs" function, which just
served to alias some variables through function parameters.  There
wasn't really a system for which attributes came from drvAttrs, and
which did not.

I've also made a few other minor changes, like re-ordering attributes
to be more idiomatic, and using variables that were moved out of
drvAttrs in the definitions of attributes that weren't in drvAttrs
before.  I've limited my changes here to what I can confidently do
without causing any rebuilds.
2023-04-03 00:14:36 +00:00
Alyssa Ross
fedc983734 linuxManualConfig: add pahole to moduleBuildDependencies
This seems to be needed for out-of-tree module builds since d57568fcad.
We do not yet understand why, but this will unblock the channels while
we figure it out.

Fixes: d57568fcad ("linuxManualConfig: install GDB scripts")
2023-03-21 12:40:16 +00:00
Alyssa Ross
d57568fcad
linuxManualConfig: install GDB scripts
These are required to debug kernel modules.  Since we're now able to
do that, there's another reason besides BTF to enable DEBUG_INFO, so
I've done that for pre-BTF kernel modules as well here.

For GDB to get configured correctly, vmlinux-gdb.py has to be two
directories up from scripts/gdb, and vmlinux has to be next to
vmlinux-gdb.py.  The least invasive way to satisfy these constraints
is to make vmlinux a symlink, which GDB will resolve before looking
for vmlinux-gdb.py.

Tested both ways of getting the scripts into GDB that I know of:

gdb /nix/store/7n77ijlxkxr6d613h02lr707kvjx6j1k-linux-6.1.19-dev/vmlinux \
    -iex 'add-auto-load-safe-path /nix/store/7n77ijlxkxr6d613h02lr707kvjx6j1k-linux-6.1.19-dev/lib/modules/6.1.19/build/vmlinux-gdb.py' \
    -ex 'lx-version' \
    -ex 'q'
gdb /nix/store/7n77ijlxkxr6d613h02lr707kvjx6j1k-linux-6.1.19-dev/vmlinux \
    -ex 'source /nix/store/7n77ijlxkxr6d613h02lr707kvjx6j1k-linux-6.1.19-dev/lib/modules/6.1.19/build/vmlinux-gdb.py' \
    -ex 'lx-version' \
    -ex 'q'

Also tested that the strip changes don't result in meaningful output
size changes (there's some small variation due to BTF data not always
coming out the same size, which is unrelated), and built every kernel
I can on x86_64 to make sure I'm not relying on build system behaviour
specific to newer kernels.
2023-03-20 00:09:52 +00:00
Alyssa Ross
41f788b121
linuxManualConfig: use the default make target
We've basically been reimplementing this — by default it contains
vmlinux, dtbs (on applicable architectures), modules, and architecture
specific stuff like $(KBUILD_IMAGE) and a couple of other
miscellaneous files.
2023-03-19 23:55:12 +00:00
Alyssa Ross
7de3f08ce3
linuxManualConfig: unpack directly into $dev
linux is unusual in that we include its sources in an output.  There's
no point unpacking into /build when we're going to copy the sources
into $dev later.  Let's unpack directly into the final destination of
the code, and save copying a whole kernel source tree (often across
filesystems!).

This also means that Kbuild knows the location of the sources, which
will allow us to install the GDB scripts — some scripts are generated,
and some are not, so the generated ones end up in the build directory,
accompanied by symlinks to the non-generated ones in the source
directory.
2023-03-19 23:54:19 +00:00
Alyssa Ross
d75cff2ee3
linuxManualConfig: don't build inside source tree
We can avoid the need to explicitly exclude it later if we just put it
somewhere else to begin with.
2023-03-18 13:49:12 +00:00
Alyssa Ross
90904c440e linuxManualConfig: remove obsolete comments
Assuming the dead link refers to
https://lore.kernel.org/linux-kbuild/1443741332.2730.75.camel@decadent.org.uk/
at this point it's fairly safe to say it's not getting in, as it
hasn't been resubmitted since 2015, and nowadays the kernel
documentation just suggests setting KBUILD_BUILD_TIMESTAMP like we do
here.
2023-02-22 19:37:59 +00:00
Alyssa Ross
d1773f8f5d
linuxManualConfig: drop gen-kheaders-metadata.patch
All affected kernels are now EOL and no longer in Nixpkgs.
2023-02-22 00:02:06 +00:00
Alyssa Ross
916bb1088e
linuxManualConfig: remove obsolete firmware code
The versionOlder check will not evaluate to true for any kernel in
Nixpkgs.
2023-02-22 00:02:05 +00:00
Artturin
221ef67e1c kernel: add deterministic-uname to moduleBuildDependencies 2023-01-13 21:15:08 +02:00
Adam Joseph
88e32095e1 linux/kernel: backport symbol GPLification fix from 5.19
Linux has a few PowerPC-specific symbols which are marked as GPL exports; these
symbols wound up being exposed in Linux 5.12 and are needed by OpenZFS.  The
symbol licensing was fixed in mainline 5.19; this commit backports the fix to
all previous affected kernels.

This commit is required in order to build the NixOS ISO for PowerPC64.
2023-01-06 15:59:38 +01:00
Naïm Favier
6c563f30fe
linuxManualConfig: don't require lib and stdenv arguments
Reverts 7c7c83e233 which was
only needed for the minimal-kernel.nix test module and clutters the call site.

stdenv can still be overridden with `linuxManualConfig.override { stdenv = ...; }`.
2022-12-22 01:42:15 +01:00
Naïm Favier
fc346c5e62
linux: use lib.versions.pad for modDirVersion 2022-12-21 13:23:28 +01:00
Fabián Heredia Montiel
13f89aee64 linux: further cleanup config after drop of 4.9 2022-12-03 10:22:06 -06:00
Pierre Bourdon
8b31b52853
Merge pull request #197697 from delroth/linux-perf-cross
linuxPackages.perf: fix cross-compilation by providing HOSTLD
2022-10-30 16:06:50 +01:00
Pierre Bourdon
bd7c85ecad
linuxPackages.perf: fix cross-compilation by providing HOSTLD 2022-10-25 10:53:28 +02:00