From a589bfae17b66af41794dc3eca1245aa514d6cac Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sat, 4 Jan 2014 20:57:21 -0500 Subject: Update and fix kernel packages to new kernel build In most cases, this just meant changing kernelDev (now removed from linuxPackagesFor) to kernel.dev. Some packages needed more work (though whether that was because of my changes or because they were already broken, I'm not sure). Specifics: * psmouse-alps builds on 3.4 but not 3.10, as noted in the comments that were already there * blcr builds on 3.4 but not 3.10, as noted in comments that were already there * open-iscsi, ati-drivers, wis-go7007, and openafsClient don't build on 3.4 or 3.10 on this branch or on master, so they're marked broken * A version-specific kernelHeaders package was added The following packages were removed: * atheros/madwifi is superceded by official ath*k modules * aufs is no longer used by any of our kernels * broadcom-sta v6 (which was already packaged) replaces broadcom-sta * exmap has not been updated since 2011 and doesn't build * iscis-target has not been updated since 2010 and doesn't build * iwlwifi is part of mainline now and doesn't build * nivida-x11-legacy-96 hasn't been updated since 2008 and doesn't build Everything not specifically mentioned above builds successfully on 3.10. I haven't yet tested on 3.4, but will before opening a pull request. Signed-off-by: Shea Levy --- pkgs/os-specific/linux/klibc/default.nix | 78 ++++++++-------------- .../linux/klibc/no-reinstall-kernel-headers.patch | 11 +++ 2 files changed, 37 insertions(+), 52 deletions(-) create mode 100644 pkgs/os-specific/linux/klibc/no-reinstall-kernel-headers.patch (limited to 'pkgs/os-specific/linux/klibc') diff --git a/pkgs/os-specific/linux/klibc/default.nix b/pkgs/os-specific/linux/klibc/default.nix index 97bdd9ebacb2..df44cb68d8bd 100644 --- a/pkgs/os-specific/linux/klibc/default.nix +++ b/pkgs/os-specific/linux/klibc/default.nix @@ -1,74 +1,48 @@ -{ stdenv, fetchurl, perl, bison, mktemp, linuxHeaders, linuxHeadersCross, kernelDev ? null }: - -assert stdenv.isLinux; +{ stdenv, fetchurl, kernelHeaders, kernel, perl }: let - version = "1.5.24"; - baseMakeFlags = ["V=1" "prefix=$out" "SHLIBDIR=$out/lib"]; + version = "2.0.3"; + + commonMakeFlags = [ + "prefix=$(out)" + "SHLIBDIR=$(out)/lib" + ]; in stdenv.mkDerivation { - name = "klibc-${version}${stdenv.lib.optionalString (kernelDev != null) "-${kernelDev.version}"}"; + name = "klibc-${version}-${kernel.version}"; src = fetchurl { - url = "mirror://kernel/linux/libs/klibc/1.5/klibc-${version}.tar.bz2"; - sha256 = "18lm32dlj9k2ky9wwk274zmc3jndgrb41b6qm82g3lza6wlw3yki"; + url = "mirror://kernel/linux/libs/klibc/2.0/klibc-${version}.tar.xz"; + sha256 = "02035f2b230020de569d40605485121e0fe481ed33a93bdb8bf8c6ee2695fffa"; }; - # Trick to make this build on nix. It expects to have the kernel sources - # instead of only the linux kernel headers. - # So it cannot run the 'make headers_install' it wants to run. - # We don't install the headers, so klibc will not be useful as libc, but - # usually in nixpkgs we only use the userspace tools comming with klibc. - prePatch = stdenv.lib.optionalString (kernelDev == null) '' - sed -i -e /headers_install/d scripts/Kbuild.install - ''; - - makeFlags = baseMakeFlags; + patches = [ ./no-reinstall-kernel-headers.patch ]; - inherit linuxHeaders; + nativeBuildInputs = [ perl ]; - crossAttrs = { - makeFlags = baseMakeFlags ++ [ "CROSS_COMPILE=${stdenv.cross.config}-" - "KLIBCARCH=${stdenv.cross.arch}" ]; + makeFlags = commonMakeFlags ++ [ + "KLIBCARCH=${stdenv.platform.kernelArch}" + "KLIBCKERNELSRC=${kernelHeaders}" + ] ++ stdenv.lib.optional (stdenv.platform.kernelArch == "arm") "CONFIG_AEABI=y"; - patchPhase = '' - sed -i 's/-fno-pic -mno-abicalls/& -mabi=32/' usr/klibc/arch/mips/MCONFIG - sed -i /KLIBCKERNELSRC/d scripts/Kbuild.install - # Wrong check for __mips64 in klibc - sed -i s/__mips64__/__mips64/ usr/include/fcntl.h - ''; - - linuxHeaders = linuxHeadersCross; + crossAttrs = { + makeFlags = commonMakeFlags ++ [ + "KLIBCARCH=${stdenv.cross.platform.kernelArch}" + "KLIBCKERNELSRC=${kernelHeaders.crossDrv}" + "CROSS_COMPILE=${stdenv.cross.config}-" + ] ++ stdenv.lib.optional (stdenv.cross.platform.kernelArch == "arm") "CONFIG_AEABI=y"; }; - - # The AEABI option concerns only arm systems, and does not affect the build for - # other systems. - preBuild = '' - sed -i /CONFIG_AEABI/d defconfig - echo "CONFIG_AEABI=y" >> defconfig - makeFlags=$(eval "echo $makeFlags") - '' + (if kernelDev == null then '' - mkdir linux - cp -prsd $linuxHeaders/include linux/ - chmod -R u+w linux/include/ - '' else '' - tar xvf ${kernelDev.src} - mv linux* linux - cd linux - ln -sv ${kernelDev}/config .config - make prepare - cd .. - ''); - # Install static binaries as well. postInstall = '' dir=$out/lib/klibc/bin.static mkdir $dir cp $(find $(find . -name static) -type f ! -name "*.g" -a ! -name ".*") $dir/ cp usr/dash/sh $dir/ + + for file in ${kernelHeaders}/include/*; do + ln -sv $file $out/lib/klibc/include + done ''; - - nativeBuildInputs = [ perl bison mktemp ]; } diff --git a/pkgs/os-specific/linux/klibc/no-reinstall-kernel-headers.patch b/pkgs/os-specific/linux/klibc/no-reinstall-kernel-headers.patch new file mode 100644 index 000000000000..d3e55fc8731d --- /dev/null +++ b/pkgs/os-specific/linux/klibc/no-reinstall-kernel-headers.patch @@ -0,0 +1,11 @@ +diff -Naur klibc-2.0.3-orig/scripts/Kbuild.install klibc-2.0.3/scripts/Kbuild.install +--- klibc-2.0.3-orig/scripts/Kbuild.install 2013-12-03 13:53:46.000000000 -0500 ++++ klibc-2.0.3/scripts/Kbuild.install 2014-01-04 18:17:09.342609021 -0500 +@@ -95,7 +95,6 @@ + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin +- $(Q)$(MAKE) -C $(KLIBCKERNELSRC) ARCH=$(KLIBCARCH) INSTALL_HDR_PATH=$(INSTALLROOT)$(INSTALLDIR)/$(KCROSS) headers_install + $(Q)cp -rf usr/include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/. + $(Q)chmod -R a+rX $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include + $(Q)$(install-data) $(srctree)/klcc/klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1 -- cgit 1.4.1