From d5454dc3f2b04e211c3e1cc420a5b3b6eced8104 Mon Sep 17 00:00:00 2001 From: Emily Trau Date: Sun, 8 Oct 2023 21:42:55 -0700 Subject: [PATCH] minimal-bootstrap.linux-headers: 4.14.67 -> 6.5.6, build from source --- .../linux/minimal-bootstrap/default.nix | 6 ++- .../linux-headers/default.nix | 49 ++++++++++++------- 2 files changed, 35 insertions(+), 20 deletions(-) diff --git a/pkgs/os-specific/linux/minimal-bootstrap/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/default.nix index 6994d980b51a..70c374e96a3f 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/default.nix @@ -205,7 +205,11 @@ lib.makeScope heirloom-devtools = callPackage ./heirloom-devtools { tinycc = tinycc-mes; }; - linux-headers = callPackage ./linux-headers { bash = bash_2_05; }; + linux-headers = callPackage ./linux-headers { + gcc = gcc-latest; + gnumake = gnumake-musl; + gnutar = gnutar-latest; + }; ln-boot = callPackage ./ln-boot { }; diff --git a/pkgs/os-specific/linux/minimal-bootstrap/linux-headers/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/linux-headers/default.nix index 255e6c1ee62a..7fa036e53b2c 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/linux-headers/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/linux-headers/default.nix @@ -2,26 +2,25 @@ lib, fetchurl, bash, + gcc, + musl, + binutils, + gnumake, + gnused, + gnugrep, + gawk, + diffutils, + findutils, gnutar, xz, }: let - # WARNING: You probably don't want to use this package outside minimal-bootstrap - # - # We need some set of Linux kernel headers to build our bootstrap packages - # (gcc/binutils/glibc etc.) against. As long as it compiles it is "good enough". - # Therefore the requirement for correctness, completeness, platform-specific - # features, and being up-to-date, are very loose. - # - # Rebuilding the Linux headers from source correctly is something we can defer - # till we have access to gcc/binutils/perl. For now we can use Guix's assembled - # kernel header distribution and assume it's good enough. pname = "linux-headers"; - version = "4.14.67"; + version = "6.5.6"; src = fetchurl { - url = "mirror://gnu/gnu/guix/bootstrap/i686-linux/20190815/linux-libre-headers-stripped-4.14.67-i686-linux.tar.xz"; - sha256 = "0sm2z9x4wk45bh6qfs94p0w1d6hsy6dqx9sw38qsqbvxwa1qzk8s"; + url = "mirror://kernel/linux/kernel/v${lib.versions.major version}.x/linux-${version}.tar.xz"; + hash = "sha256-eONtQhRUcFHCTfIUD0zglCjWxRWtmnGziyjoCUqV0vY="; }; in bash.runCommand "${pname}-${version}" @@ -29,6 +28,15 @@ bash.runCommand "${pname}-${version}" inherit pname version; nativeBuildInputs = [ + gcc + musl + binutils + gnumake + gnused + gnugrep + gawk + diffutils + findutils gnutar xz ]; @@ -36,17 +44,20 @@ bash.runCommand "${pname}-${version}" meta = { description = "Header files and scripts for Linux kernel"; license = lib.licenses.gpl2Only; - teams = [ lib.teams.minimal-bootstrap ]; platforms = lib.platforms.linux; + teams = [ lib.teams.minimal-bootstrap ]; }; } '' # Unpack - cp ${src} linux-headers.tar.xz - unxz linux-headers.tar.xz - tar xf linux-headers.tar + tar xf ${src} + cd linux-${version} + + # Build + make -j $NIX_BUILD_CORES CC=musl-gcc HOSTCC=musl-gcc ARCH=x86 headers # Install - mkdir $out - cp -r include $out + find usr/include -name '.*' -exec rm {} + + mkdir -p $out + cp -rv usr/include $out/ ''