!xmLtiCaAJxfhURjrXl:matrix.org

NixOS RISC-V

237 Members
NixOS on RISC-V https://wiki.nixos.org/wiki/RISC-V https://pad.lassul.us/NixOS-riscv64-linux https://github.com/orgs/NixOS/teams/risc-v69 Servers

Load older messages


SenderMessageTime
25 Mar 2024
@joerg:thalheim.ioMic92Ok. Does this mean I can include a DTB from a recent linux kernel build when flashing the firmware?20:27:08
@alex:tunstall.xyzAlexThat might fix issues that are caused by bugs in the DTB, but I assume the older kernel will ignore any devices it doesn't recognise (or functionality might be reduced if the DTB has a fallback driver).20:32:15
26 Mar 2024
@skeuchel:matrix.orgSteven Keuchel Mic92: I find that in the recent revisions of the 6.1, 6.6 and 6.8 branches of the pioneer you can simply use any of the dtbs with any of the kernels. 00:40:53
@skeuchel:matrix.orgSteven Keuchelin the past there have been incompatible updates, in particular for the serial console driver00:41:09
@skeuchel:matrix.orgSteven Keuchelthe dtb that was preflashed (at least on my board) is too outdated for recent kernels.00:42:14
@sorear:matrix.orgsorear how do flakes with packages (not overlays) work when you're building for a system that doesn't have a short name? e.g. { config = "riscv64-unknown-linux-gnu"; gcc = { arch = "rv64imac"; abi = "lp64"; }; } 23:34:30
27 Mar 2024
@sorear:matrix.orgsorearcross-compiled nixos using a mix of instructions from yesteday. built ubootQemuRiscv64SMode and used that with qemu to boot it. got halfway into stage 1 before failing to mount the root device. hacked extlinux.conf to add rdinit=/nix/store/.../bin/hush (do people care about the <100 bytes that adding a /bin/sh symlink to the initramfs would add?) allowed me to debug that, discovered that the pci_host_generic module was missing. added to boot.initrd.availableKernelModules. failed to log in. added a users block. success!02:22:02
@adam:robins.wtfadamcstephens 🐝 left the room.02:24:01
@dramforever:matrix.orgdramforever
In reply to @sorear:matrix.org
cross-compiled nixos using a mix of instructions from yesteday. built ubootQemuRiscv64SMode and used that with qemu to boot it. got halfway into stage 1 before failing to mount the root device.

hacked extlinux.conf to add rdinit=/nix/store/.../bin/hush (do people care about the <100 bytes that adding a /bin/sh symlink to the initramfs would add?) allowed me to debug that, discovered that the pci_host_generic module was missing.

added to boot.initrd.availableKernelModules. failed to log in.

added a users block. success!
oh nice that you figured most of this out, for future reference there are a bunch of options that the initrd script takes to help debug with problems https://nixos.org/manual/nixos/stable/#sec-boot-problems
11:38:50
@dramforever:matrix.orgdramforeverin particular boot.shell_on_fail is probably the one you were looking for11:39:08
@sorear:matrix.orgsorearmaybe18:12:07
@sorear:matrix.orgsorearstill thinking the symlink would be useful (it was surprising to me that there wasn't a symlink, given that nixos installs always have one); doesn't affect security since the shell path isn't secret18:17:29
28 Mar 2024
@hive:the-apothecary.clubDr. Wormok so as far as i understand it, ghc doesn't support cross-compilation, ( pending PR merge ), so you need to do an emulated build, but also as far as i can tell, flakes doesn't support doing an emulated build ??00:36:10
@hive:the-apothecary.clubDr. Worm* ok so as far as i understand it, ghc doesn't support cross-compilation, ( pending PR merge ), so you need to do an emulated build, but also as far as i can tell, flakes doesn't support doing an emulated build ?00:36:20
@alex:tunstall.xyzAlex
In reply to @hive:the-apothecary.club
ok so as far as i understand it, ghc doesn't support cross-compilation, ( pending PR merge ), so you need to do an emulated build, but also as far as i can tell, flakes doesn't support doing an emulated build ?

Flakes support binfmt emulation.

The issue is that Nixpkgs doesn't know how to bootstrap GHC on RISC-V, because it doesn't know where to get a binary for GHC.

00:36:58
@alex:tunstall.xyzAlex

Your options are either:

  1. Find a pre-compiled RISC-V binary for GHC somewhere (e.g. Debian might have one).
  2. Use the unmerged PR to cross-compile a suitable bootstrap binary for GHC.
00:38:13
@hive:the-apothecary.clubDr. Wormso even with an emulated build, it still doesn't bootstrap successfully ?00:39:25
@alex:tunstall.xyzAlex(As the creator of the PR, I'm sorry I haven't yet found the time to get the PR merged.)00:39:27
@hive:the-apothecary.clubDr. Wormi understand00:39:40
@alex:tunstall.xyzAlex
In reply to @hive:the-apothecary.club
so even with an emulated build, it still doesn't bootstrap successfully ?

Nixpkgs doesn't even evaluate, because it doesn't know where to find the RISC-V bootstrap binary.

See for yourself:

nix-shell -p '(import <nixpkgs> { system = "riscv64-linux"; }).ghc'
00:41:36
@hive:the-apothecary.clubDr. Wormah ok00:41:47
@alex:tunstall.xyzAlex

When building GHC from source, here's what Nixpkgs does:

  1. It fetches an appropriate GHC bindist from haskell.org (none exists for RISC-V).
  2. It uses the bindist to compile GHC.

(It is also possible to use the bindist directly, but AFAIK users rarely do that.)

00:43:52
@alex:tunstall.xyzAlexIf you need help getting GHC working on RISC-V or you want to improve on my GHC cross-compilation PR, feel free to ask.00:45:47
@hive:the-apothecary.clubDr. Wormi would love to help your PR get merged00:51:31
@hive:the-apothecary.clubDr. Worm changed their display name from Dagn Hive to tau.01:51:39
@fgaz:matrix.orgfgaz
In reply to @alex:tunstall.xyz

Flakes support binfmt emulation.

The issue is that Nixpkgs doesn't know how to bootstrap GHC on RISC-V, because it doesn't know where to get a binary for GHC.

I should ask the ghcup maintainer to produce one so we finally have a trusted haskell risc-v bootstrap path...
11:00:09
@skeuchel:matrix.orgSteven Keuchel
In reply to @alex:tunstall.xyz

When building GHC from source, here's what Nixpkgs does:

  1. It fetches an appropriate GHC bindist from haskell.org (none exists for RISC-V).
  2. It uses the bindist to compile GHC.

(It is also possible to use the bindist directly, but AFAIK users rarely do that.)

I tried using a self-compiled ghc963 bindist for rv64 directly to avoid recompiling ghc every now and then. Unfortunately a couple of packages fail to compile this way. also happens on amd64, try e.g. nixpkgs#haskell.packages.ghc963Binary.generics-sop.
11:45:24
@shalokshalom:kde.org@shalokshalom:kde.org joined the room.15:11:46
@alex:tunstall.xyzAlex
In reply to @skeuchel:matrix.org
I tried using a self-compiled ghc963 bindist for rv64 directly to avoid recompiling ghc every now and then. Unfortunately a couple of packages fail to compile this way. also happens on amd64, try e.g. nixpkgs#haskell.packages.ghc963Binary.generics-sop.

The bindists only need to work well enough to compile GHC, so I assume that in Nixpkgs they might not be tested well enough for everything to work like it does with the Nixpkgs-native builds.

This is still quite puzzling though, as those bindists generally work well in FHS-compatible distributions.

15:22:08
@alex:tunstall.xyzAlex
In reply to @skeuchel:matrix.org
I tried using a self-compiled ghc963 bindist for rv64 directly to avoid recompiling ghc every now and then. Unfortunately a couple of packages fail to compile this way. also happens on amd64, try e.g. nixpkgs#haskell.packages.ghc963Binary.generics-sop.

I tried building generics-sop with various compilers.

x86_64, ghc963Binary = fails
x86_64, ghc963 = ok
x86_64, ghc928 = ok
RV64GC, ghc928 (cross-compiled from x86_64) = fails on th-abstraction (relocation R_RISCV_HI20 against a local symbol' can not be used when making a shared object; recompile with -fPIC) RV64GC, ghc928` (native, booted with cross-compiled 8.10.7) = ok

All compilers except ghc963Binary were built using Nixpkgs (cross-compiled versions required a custom branch).

(Excuse the old RV64GC compiler versions. My dev board hasn't been updated in months and I don't have the patience to wait 15+ hours for a new GHC version to compile.)

16:36:12

Show newer messages


Back to Room ListRoom Version: 10