Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux-hardkernel: Init at 4.14.47-139 #41782

Merged
merged 2 commits into from Jun 19, 2018
Merged

Conversation

qolii
Copy link
Contributor

@qolii qolii commented Jun 10, 2018

Motivation for this change

This introduces a build for the hardkernel vendor kernel tree, to support hardkernel hardware (e.g. the odroid series of SBCs).

Things done

I have built and tested this kernel on my Odroid HC1, using kernelPackages = pkgs.linuxPackages_hardkernel_latest. No problems encountered, but no further devices tested.

I just looked at existing linux kernel instances and duplicated the simplest I saw with the minimum novelty I could think of. I might definitely have missed something. Design advice is welcome.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@andrew-d
Copy link
Contributor

If you're interested, I had a similar-ish config that also automatically splits version numbers:

  # modDirVersion needs to be x.y.z.
  modDirVersion = head (stdenv.lib.splitString "-" version);

  # branchVersion needs to be x.y.
  extraMeta.branch = with stdenv.lib; concatStrings (intersperse "." (take 2 (splitString "." modDirVersion)));

And, thanks for submitting this PR! I've also been running NixOS on a ODROID HC2 for a couple months now with no trouble, but never got around to submitting a PR for kernel support - much appreciated 😀

@qolii
Copy link
Contributor Author

qolii commented Jun 11, 2018

@andrew-d, no problem! :)

I saw there are such tricks in the other kernel .nix files as well. But, is it a little bit overkill? It doesn't really provide much useful abstracting power in this case, and I think it does make something simple harder to read. But I guess it's only small. I'm happy to change it if feelings are strong.

@andrew-d
Copy link
Contributor

I'm happy to change it if feelings are strong.

No strong feelings, no - just mentioning it if you were interested! 👍

@qolii
Copy link
Contributor Author

qolii commented Jun 11, 2018

Awesome, thanks!

@qolii
Copy link
Contributor Author

qolii commented Jun 11, 2018

Cc: @dezgeg, possibly.

@@ -13603,6 +13603,13 @@ with pkgs;
];
};

linux_hardkernel_4_14 = callPackages ../os-specific/linux/kernel/linux-hardkernel-4.14.nix {
Copy link
Contributor

Choose a reason for hiding this comment

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

Another thing I just noticed; do you want callPackages here, or callPackage (no s) like the other kernels?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ugh, you're totally right. Thanks! Fixed.

# branchVersion needs to be x.y.
extraMeta.branch = "4.14";

src = fetchurl {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should use fetchFromGitHub to avoid possibly nondeterministic GitHub tarballs.

Looks good otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ugh, is nothing sacred!! I assumed GitHub's tarballs at least would be deterministic.

Will fix. Thanks for looking!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Uhh, sorry about this, can you help me? I've changed it to

  src = fetchFromGitHub {
    owner = "hardkernel";
    repo = "linux";
    rev = version;
    sha256 = "1nxgd29y9wmifm11pjcdpd2y293p0dgi0x5ycis55miy97n0f5zy";
  };

which, as far as I can tell, is roughly the right way to do things. (The hash is wrong, but I was going to try to build it and then fix up the hash when it complained about it.)

However, I get the result that, when I run nixos-rebuild, I get:

these derivations will be built:
  /nix/store/5jcd3rxy9xmql16vvrx8vspinibqxmn2-source.drv
  /nix/store/hq0l73vjjy7py4g7cwrbd79mzzfnqvva-linux-config-4.14.47-139.drv
  /nix/store/kxwdk2f2lks3cannzqsw1iv634c75b8f-linux-4.14.47-139.drv
  /nix/store/phx3p9afjlkr1sl3pd194m4iq9j5n3q1-kernel-modules.drv
  /nix/store/sas9zlmpw0msri87mzx9qg1x9mh4vb3w-firmware.drv
  /nix/store/fa9dm9bbilinl9zkpw83yshvgrpsh7sz-kernel-modules-shrunk.drv
  /nix/store/02360f07416jlzgpkfqbn76zmrpl63z0-stage-1-init.sh.drv
  /nix/store/gigx079yqhiam6m9w7mxqkk1imwy2zwg-etc-nixos.conf.drv
  /nix/store/ic84x39phcwxxk439awdns9bymfyi05w-etc.drv
  /nix/store/lp5hwcwfks7f7iv5mfnjb9dhkswzl6kf-initrd.drv
  /nix/store/kaibkzq676y6alxs2nxwwmiwd3d9nncb-nixos-system-gospel-18.09.git.d6422c6.drv
building '/nix/store/5jcd3rxy9xmql16vvrx8vspinibqxmn2-source.drv'...

trying https://github.com/hardkernel/linux/archive/4.14.47-139.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   129    0   129    0     0    390      0 --:--:-- --:--:-- --:--:--   390

at which point, it hangs forever. No error. That tar.gz path itself is fine:

# wget https://github.com/hardkernel/linux/archive/4.14.47-139.tar.gz
[successful noises]

works fine. However, I'm not sure if this is relevant, but:

# curl https://github.com/hardkernel/linux/archive/4.14.47-139.tar.gz
<html><body>You are being <a href="https://codeload.github.com/hardkernel/linux/tar.gz/4.14.47-139">redirected</a>.</body></html>

Anyway, I expect am making an obvious mistake! Any idea?

@qolii
Copy link
Contributor Author

qolii commented Jun 18, 2018

Alright, done. It wasn't hanging after all, just taking ages.

Seems to work for me.

@dezgeg dezgeg merged commit 07e8402 into NixOS:master Jun 19, 2018
@Mic92
Copy link
Member

Mic92 commented Aug 5, 2018

Please restrict the build to aarch64. It breaks my nix-review for kernel modules, because nix is trying to build it on x86_64.

@qolii
Copy link
Contributor Author

qolii commented Aug 13, 2018

@Mic92, sorry for the delay here. What is the most appropriate way to do this?

I see other kernel expressions using extraMeta.hydraPlatforms = [ ]; and extraMeta.hydraPlatforms = [ "armv7l-linux" ];. Would one of these do the trick?

@Mic92
Copy link
Member

Mic92 commented Aug 16, 2018

I assume:

extraMeta.hydraPlatforms = [ "armv7l-linux" ];

would do the trick then.

@Mic92
Copy link
Member

Mic92 commented Aug 16, 2018

Also something like extraMeta.platforms would be better because then also nix-review does not attempt to build it.

@Mic92
Copy link
Member

Mic92 commented Aug 16, 2018

done in 995d005

andrew-d pushed a commit to andrew-d/nixpkgs that referenced this pull request Sep 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants