From 9ef11e4c4d18f124d88e5e63932de1182e4946e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Sat, 19 Dec 2009 12:12:24 +0000 Subject: [PATCH] Made the linux kernel expressions support 'platform' again (thinking on reusing most of the kernel expressions for the sheevaplug). I still have not added anything in the kernels about cross compilation. I moved the platform definitions out of all-packages. I have not written good platform definitions for the sheevaplug - only for the PC. Only the linux-2.6.32 expression uses the platforms kernelConfig. The linux-2.6.31 was broken, and I left it broken. svn path=/nixpkgs/branches/stdenv-updates/; revision=19046 --- pkgs/os-specific/linux/kernel/builder.sh | 3 ++ pkgs/os-specific/linux/kernel/generic.nix | 5 +-- .../os-specific/linux/kernel/linux-2.6.32.nix | 16 +++------- pkgs/top-level/all-packages.nix | 20 +++--------- pkgs/top-level/platforms.nix | 31 +++++++++++++++++++ 5 files changed, 45 insertions(+), 30 deletions(-) create mode 100644 pkgs/top-level/platforms.nix diff --git a/pkgs/os-specific/linux/kernel/builder.sh b/pkgs/os-specific/linux/kernel/builder.sh index 4ea4d2856ad..f756c140c49 100644 --- a/pkgs/os-specific/linux/kernel/builder.sh +++ b/pkgs/os-specific/linux/kernel/builder.sh @@ -24,6 +24,9 @@ configurePhase() { # generate-config.pl can answer them. sed -e '/fflush(stdout);/i\printf("###");' -i scripts/kconfig/conf.c + # Get a basic config file for later refinement with $generateConfig + make $kernelBaseConfig ARCH=$arch + # Create the config file. echo "generating kernel configuration..." echo "$kernelConfig" > kernel-config diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix index 6cc3ddc1228..2d9af1b4bd8 100644 --- a/pkgs/os-specific/linux/kernel/generic.nix +++ b/pkgs/os-specific/linux/kernel/generic.nix @@ -33,7 +33,7 @@ , preConfigure ? "" , extraMeta ? {} -, platform ? { name = "pc"; uboot = null; } +, platform ? { name = "pc"; uboot = null; kernelBaseConfig = "defconfig"; } , ... }: @@ -80,13 +80,14 @@ stdenv.mkDerivation { ++ lib.optional (platform.uboot != null) [platform.uboot]; platformName = platform.name; + kernelBaseConfig = platform.kernelBaseConfig; arch = if xen then "xen" else if userModeLinux then "um" else + if platform ? kernelArch then platform.kernelArch else if stdenv.system == "i686-linux" then "i386" else if stdenv.system == "x86_64-linux" then "x86_64" else - if stdenv.system == "armv5tel-linux" then "arm" else abort "Platform ${stdenv.system} is not supported."; meta = { diff --git a/pkgs/os-specific/linux/kernel/linux-2.6.32.nix b/pkgs/os-specific/linux/kernel/linux-2.6.32.nix index f6f8104e662..3242df1f26f 100644 --- a/pkgs/os-specific/linux/kernel/linux-2.6.32.nix +++ b/pkgs/os-specific/linux/kernel/linux-2.6.32.nix @@ -1,4 +1,5 @@ -args @ { stdenv, fetchurl, userModeLinux ? false, extraConfig ? "", ... }: +args @ { stdenv, fetchurl, platform, userModeLinux ? false, extraConfig ? "" +, ... }: import ./generic.nix ( @@ -11,7 +12,7 @@ import ./generic.nix ( }; features.iwlwifi = true; - + config = '' # Don't include any debug features. @@ -26,16 +27,6 @@ import ./generic.nix ( # Optimize with -O2, not -Os. CC_OPTIMIZE_FOR_SIZE n - # Virtualisation (KVM, Xen...). - PARAVIRT_GUEST y - KVM_CLOCK y - KVM_GUEST y - XEN y - KSM y - - # We need 64 GB (PAE) support for Xen guest support. - HIGHMEM64G? y - # Enable the kernel's built-in memory tester. MEMTEST y @@ -207,6 +198,7 @@ import ./generic.nix ( X86_CHECK_BIOS_CORRUPTION y X86_MCE y + ${if platform ? kernelExtraConfig then platform.kernelExtraConfig else ""} ${extraConfig} ''; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 629cd019630..122cd9c6f78 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -310,23 +310,11 @@ let inherit pkgs lib; }; - - platformPC = assert system == "i686-linux" || system == "x86_64-linux"; { - name = "pc"; - uboot = null; + platforms = import ./platforms.nix { + inherit system pkgs; }; - platformSheevaplug = assert system == "armv5tel-linux"; { - name = "sheevaplug"; - inherit uboot; - }; - - platformVersatileARM = assert system == "armv5tel-linux"; { - name = "versatileARM"; - uboot = null; - }; - - platform = platformPC; + platform = platforms.pc; ### TOOLS @@ -5579,7 +5567,7 @@ let kernel_2_6_31_zen_bfs = kernel_2_6_31_zen7_bfs; kernel_2_6_32 = makeOverridable (import ../os-specific/linux/kernel/linux-2.6.32.nix) { - inherit fetchurl stdenv perl mktemp module_init_tools; + inherit fetchurl stdenv perl mktemp module_init_tools platform; kernelPatches = [ kernelPatches.fbcondecor_2_6_31 kernelPatches.sec_perm_2_6_24 diff --git a/pkgs/top-level/platforms.nix b/pkgs/top-level/platforms.nix new file mode 100644 index 00000000000..539b83a7657 --- /dev/null +++ b/pkgs/top-level/platforms.nix @@ -0,0 +1,31 @@ +{ system, pkgs}: +with pkgs; +{ + pc = assert system == "i686-linux" || system == "x86_64-linux"; { + name = "pc"; + uboot = null; + kernelBaseConfig = "defconfig"; + kernelExtraConfig = + '' + # Virtualisation (KVM, Xen...). + PARAVIRT_GUEST y + KVM_CLOCK y + KVM_GUEST y + XEN y + KSM y + + # We need 64 GB (PAE) support for Xen guest support. + HIGHMEM64G? y + ''; + }; + + sheevaplug = assert system == "armv5tel-linux"; { + name = "sheevaplug"; + inherit uboot; + }; + + platformVersatileARM = assert system == "armv5tel-linux"; { + name = "versatileARM"; + uboot = null; + }; +}