diff options
author | Matthieu Coudron <mattator@gmail.com> | 2018-01-29 03:50:18 +0900 |
---|---|---|
committer | Matthieu Coudron <mattator@gmail.com> | 2018-02-07 10:07:13 +0900 |
commit | f620b1b693ec25af1aadcb0508710dc22e92453a (patch) | |
tree | 9b5260147aed77ad4e3696e1b0c400fbe95734fc /pkgs/os-specific/linux/kernel/manual-config.nix | |
parent | d80057f245e65e5ef07ec7e488941ac3d4fc3ee3 (diff) | |
download | nixpkgs-f620b1b693ec25af1aadcb0508710dc22e92453a.tar nixpkgs-f620b1b693ec25af1aadcb0508710dc22e92453a.tar.gz nixpkgs-f620b1b693ec25af1aadcb0508710dc22e92453a.tar.bz2 nixpkgs-f620b1b693ec25af1aadcb0508710dc22e92453a.tar.lz nixpkgs-f620b1b693ec25af1aadcb0508710dc22e92453a.tar.xz nixpkgs-f620b1b693ec25af1aadcb0508710dc22e92453a.tar.zst nixpkgs-f620b1b693ec25af1aadcb0508710dc22e92453a.zip |
kernel: buildLinux replaces import ./generic.nix
- defined buildLinux as generic.nix instead of manual-config.nix. This makes kernel derivations a tad more similar to your typical derivations. - moved $buildRoot to within the source folder, this way it doesn't have to be created before the unpackPhase and make it easier to work on kernel source without running the unpackPhase
Diffstat (limited to 'pkgs/os-specific/linux/kernel/manual-config.nix')
-rw-r--r-- | pkgs/os-specific/linux/kernel/manual-config.nix | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/pkgs/os-specific/linux/kernel/manual-config.nix b/pkgs/os-specific/linux/kernel/manual-config.nix index 9a7e9609410..d0d90adb8b6 100644 --- a/pkgs/os-specific/linux/kernel/manual-config.nix +++ b/pkgs/os-specific/linux/kernel/manual-config.nix @@ -1,8 +1,8 @@ { buildPackages, runCommand, nettools, bc, perl, gmp, libmpc, mpfr, openssl +, ncurses ? null , libelf , utillinux , writeTextFile, ubootTools -, hostPlatform }: let @@ -34,7 +34,9 @@ in { # Use defaultMeta // extraMeta extraMeta ? {}, # Whether to utilize the controversial import-from-derivation feature to parse the config - allowImportFromDerivation ? false + allowImportFromDerivation ? false, + + hostPlatform }: let @@ -86,8 +88,6 @@ let inherit src; preUnpack = '' - mkdir build - export buildRoot="$(pwd)/build" ''; patches = map (p: p.patch) kernelPatches; @@ -102,7 +102,25 @@ let configurePhase = '' runHook preConfigure + + mkdir build + export buildRoot="$(pwd)/build" + + echo "manual-config configurePhase buildRoot=$buildRoot pwd=$PWD" + + if [[ -z "$buildRoot" || ! -d "$buildRoot" ]]; then + echo "set $buildRoot to the build folder please" + exit 1 + fi + + if [ -f "$buildRoot/.config" ]; then + echo "Could not link $buildRoot/.config : file exists" + exit 1 + fi ln -sv ${configfile} $buildRoot/.config + + # reads the existing .config file and prompts the user for options in + # the current kernel source that are not found in the file. make $makeFlags "''${makeFlagsArray[@]}" oldconfig runHook postConfigure @@ -115,6 +133,8 @@ let # Note: we can get rid of this once http://permalink.gmane.org/gmane.linux.kbuild.devel/13800 is merged. buildFlagsArray+=("KBUILD_BUILD_TIMESTAMP=$(date -u -d @$SOURCE_DATE_EPOCH)") + + cd $buildRoot ''; buildFlags = [ @@ -136,7 +156,7 @@ let postInstall = '' mkdir -p $dev - cp $buildRoot/vmlinux $dev/ + cp vmlinux $dev/ '' + (optionalString installsFirmware '' mkdir -p $out/lib/firmware '') + (if (platform ? kernelDTB && platform.kernelDTB) then '' @@ -151,7 +171,7 @@ let unlink $out/lib/modules/${modDirVersion}/source mkdir -p $dev/lib/modules/${modDirVersion}/build - cp -dpR ../$sourceRoot $dev/lib/modules/${modDirVersion}/source + cp -dpR .. $dev/lib/modules/${modDirVersion}/source cd $dev/lib/modules/${modDirVersion}/source cp $buildRoot/{.config,Module.symvers} $dev/lib/modules/${modDirVersion}/build @@ -170,7 +190,7 @@ let # from drivers/ in the future; it adds 50M to keep all of its # headers on 3.10 though. - chmod u+w -R ../source + chmod u+w -R .. arch=$(cd $dev/lib/modules/${modDirVersion}/build/arch; ls) # Remove unused arches |