Skip to content
This repository was archived by the owner on Mar 30, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions contrail-overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ let

lib = {
fetchCentosKernel = callPackage ./pkgs/fetch-centos-kernel {};
ubuntuKernelHeaders = callPackage ./pkgs/fetch-ubuntu-kernel {};
buildWebuiDeps = callPackage ./pkgs/build-webui-deps.nix {};

# we switch to gcc 4.9 because gcc 5 is not supported before kernel 3.18
Expand Down Expand Up @@ -191,6 +192,28 @@ let
};
in lself.lib.buildVrouter kernel;

vrouterModuleUbuntu_4_4_0_137_generic = let
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add in a command for which ubuntu release it is?

kernel = lself.lib.ubuntuKernelHeaders {
version = "4.4.0-137-generic";
amd64File = "linux-headers-4.4.0-137-generic_4.4.0-137.163_amd64.deb";
amd64Sha256 = "02c7m10a967kd2l84grzksyqdfzkvac0y5m3bd51cpw4wir6rz8s";
allFile = "linux-headers-4.4.0-137_4.4.0-137.163_all.deb";
allSha256 = "18qv1bkwciqynj5v7w1l46w0adypcafbhqwkfggkgbp629xm3y2s";
};
in lself.lib.buildVrouter kernel;

vrouterModuleUbuntu_4_4_0_119_generic = let
kernel = lself.lib.ubuntuKernelHeaders {
version = "4.4.0-119-generic";
amd64File = "linux-headers-4.4.0-119-generic_4.4.0-119.143_amd64.deb";
amd64Sha256 = "2e4729f8473014c6072b10ab98d5ca4973e03839cf77d94376f80d35c6465c2f";
allFile = "linux-headers-4.4.0-119_4.4.0-119.143_all.deb";
allSha256 = "cf9370237c6e8e4e8a9514cc389761658f3df19be9832cc3141e371907152866";
};
in lself.lib.buildVrouter kernel;



# config
apiServer = callPackage ./pkgs/api-server.nix { };
svcMonitor = callPackage ./pkgs/svc-monitor.nix { };
Expand Down
33 changes: 33 additions & 0 deletions pkgs/fetch-ubuntu-kernel/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{ stdenv, fetchurl, patchelf, dpkg, rsync }:

{ version, amd64File, amd64Sha256, allFile, allSha256 }:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think amd64File, allFile strings can be generated from the version. Also, I think we could find better name for these files. You can see what apt description of theses packages.


stdenv.mkDerivation rec {
inherit version amd64File amd64Sha256 allFile allSha256;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You only need to inherit version.

pname = "ubuntu-kernel-headers";
name = "${pname}-${version}";
srcs = [
(fetchurl {
url = "http://fr.archive.ubuntu.com/ubuntu/pool/main/l/linux/${amd64File}";
sha256 = "${amd64Sha256}";
})
(fetchurl {
url = "http://fr.archive.ubuntu.com/ubuntu/pool/main/l/linux/${allFile}";
sha256 = "${allSha256}";
})
];
phases = [ "unpackPhase" "installPhase" ];
buildInputs = [ dpkg ];
unpackCmd = "dpkg-deb --extract $curSrc tmp/";
installPhase = ''
mkdir -p $out
${rsync}/bin/rsync -rl * $out/
# We patch these scripts since they have been compiled for ubuntu
for i in recordmcount basic/fixdep mod/modpost; do
${patchelf}/bin/patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 $out/usr/src/linux-headers-${version}/scripts/$i
${patchelf}/bin/patchelf --set-rpath ${stdenv.glibc}/lib $out//usr/src/linux-headers-${version}/scripts/$i
done
ln -sfT $out/usr/src/linux-headers-${version} $out/lib/modules/${version}/build
'';
}