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
mnt/reform: init #191
mnt/reform: init #191
Conversation
6e85800
to
37d1eff
Compare
{ buildUBoot, fetchgit }: | ||
|
||
buildUBoot rec { | ||
pname = "uboot-reform2-imx8mq"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move the packages to nixpkgs, we cannot test/build in nixos-hardware. The module itself can remain here. If you post the PR url, I will have a look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depending on your motivation you can also add support here: https://github.com/Mic92/nixos-aarch64-images
This allows people without aarch64 to remaster our official aarch64 image with the custom u-boot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @samueldr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a complete reversal to my opinions about the kernel, U-Boot is "self-sustaining", since it's part of U-Boot mainline. Adding a build for a particular device is basically free.
We might want to stray away from including extraConfig. Sure, that means it'll have the default 3s boot delay, but that's how we build our U-Boots for now: stock as mainline does.
It's also quite cheap to build a custom U-Boot if needed by the end-user. That means it's not a huge deal if they need to customize it.
Except for: see my other comments about the patches.
Ugh, I suck didn't read carefully. There's an src
here. (Leaving this comment up, but it is not relevant anymore.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we want to introduce a non-mainline U-Boot into Nixpkgs. I went as far as making myself honest, by removing the last non-mainline U-Boot from Nixpkgs.
A bit like for kernels, the main reasoning behind isn't about configuration or device-specificity, but about maintainership. Adding U-Boot defconfigs for a mainline board is trivial, and pretty much free.
I guess this would be answered the same way the "extra" kernels would.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW the U-Boot maintainer knows about these patches and wants this board fixed in U-Boot upstream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depending on your motivation you can also add support here: https://github.com/Mic92/nixos-aarch64-images This allows people with aarch64 to remaster our official aarch64 image with the custom u-boot.
Ok, I can do that when I have a working SD image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ehmry you basically only need to know the offsets where the chip expects uboot to be: https://github.com/Mic92/nixos-aarch64-images/blob/main/images/rockchip.nix#L19
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mic92, be careful, that's not necessarily a given that an SoC will boot like Allwinners and Rockchips, by looking at a particular offset on the storage.
Though, here it looks like it may be, when configured appropriately.
name = "MNT-Reform-imx8mq-config"; | ||
patch = null; | ||
extraConfig = builtins.readFile ./kernel-config; | ||
}]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samueldr what should we do with the kernel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still an open question about everything kernel related and "those kind" of platforms, where patches or outright complete kernel trees are needed.
I think we need to "sit down" and discuss that with the relevant key people: can we provide kernel builds in a useful manner, without making them part of Nixpkgs outright?
I'm thinking about a strategy similar to Mobile NixOS' own for reducing churn in Hydra, instead of tracking Nixpkgs, track channel updates. It means that it lags behind slightly, but doesn't needlessly queue builds... (Though that last part is not really an issue for kernels, few changes trigger rebuilds.)
I guess Flakes would help in this current situation, but adding a strict dependency on flakes is not great either.
Though one of the main important things about that is that managing non-mainline kernels through Nixpkgs is bound to become untenable. I already want to move the Raspberry Pi foundation kernels outside whenever possible, in addition to the few misc. probably-unused kernels still present.
Ugh, sorry to drop all that in a PR review request :/.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, additionally linux_5_7
is bound to disappear. It's already marked EOL at kernel.org.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually would not those packages to hydra and the official binary cache but have github repositories in nix-community. We have a diverse community and only a few people with access to the nixos core infrastructure. In nix community there is a 1TB cachix cache and a hydra, which would allow to upload custom kernel builds and the whole process is a lot less bureaucratic. I think making every non-standard kernel its own flake might be actually the way to go solve this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, sorry to drop all that in a PR review request :/.
Not a problem, the hardware hasn't shipped en masse, so we have time to do this right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a level of trust around "just using a cachix repo", that I highly dislike. That's the main reason I don't publish anything for the Pinebook Pro WIP stuff, I don't want to have people either not realise they rely on an implicit trust on me, or have them trust what I do.
If the Nix community builder is transparent enough for that, it'd help, we'd probably be able to handle that for all NixOS on ARM things. I really want to move all the things in a centralized location with builds. @Mic92 care to open an issue and start the discussion about that at the right place (and tagging me in)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samueldr I just realized that we don't have aarch64 builds in nix-community. Apart from that adding declarative jobs is supported https://github.com/nix-community/infra/blob/0374f082455b9cce0a369bdc53cc4fa2ca9c87a0/build01/hydra-declarative-projects.nix#L5 So the only other alternative I see is to have a jobset on the official hydra. There might be also aarch64 support on travis. I don't know if this is enough to build kernel, but if it is than this is actually the better solution because than everyone can customize their built. Trust-wise it does not make a big difference if I have to trust your repo/cache or a couple of admins maintaining nix-community. Realistically most people won't understand the source code in your repository anyway and have to trust it.
Not pertinent to reviewing the PR per se, but more about being a good citizen in the "NixOS on ARM" stuff. I see you're patching environment variables here: Am I to understand that this ends up making that ~2018 era U-Boot use the Generic Distro Configuration Concept? Well, I figure it must. Too bad about the lack of graphics in U-Boot :/. |
name = "MNT-Reform-imx8mq-config"; | ||
patch = null; | ||
extraConfig = builtins.readFile ./kernel-config; | ||
}]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, additionally linux_5_7
is bound to disappear. It's already marked EOL at kernel.org.
mnt/reform2-nitrogen8m/kernel-config
Outdated
@@ -0,0 +1,2180 @@ | |||
6LOWPAN n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this original work?
If it isn't, where can we get the updated recommended options to enable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is semi-original, I took the config of the stock MNT kernel, diffconfig'ed and trimed it a bit. Some stuff is disabled to reduce the compile time. MNT uses their patches against a 5.7 kernel, so I chose the same.
06a8c86
to
13e0bd7
Compare
I've rebased the initial commit and pushed a second commit that adds an installer module. Not sure the best way to make it discoverable. |
FWIW I've been building the SD image by adding a nixpkgs input to the flake and a package + packages.aarch64-linux.reform2-nitrogen8m-sd-installer = let
+ installer = nixpkgs.lib.nixosSystem {
+ system = "aarch64-linux";
+ modules = [ ./mnt/reform2-nitrogen8m/installer.nix ];
+ };
+ in installer.config.system.build.sdImage;
+ |
Update the DTS patch to disable the non-battery-backed RTC.
I made a seprate repository here: https://github.com/nix-community/hardware-mnt-reform This laptop needs a pinned nixpkgs to build its kernel, so I don't think its appropriate to keep here. |
Add support for the MNT Reform laptop with the initial i.MX8 CPU board - https://mntre.com/
I've used this configuration to bootstrap NixOS from the Debian SD card that comes with this laptop, but I am still working on an SD installer image.