NixOS support for CM4

do you get audio out of the headphone jack? did you install the audio patch script for audio switching? which of these are installed gpio or pinctrl?

tomorrow I will port audio patch script to NixOS (also a pinctrl/gpio/raspi-gpio utilities - since they are not packaged yet). Unfortunately I did not get audio of the headphone jack - maybe it’s a next issue with the NixOS on CM4 ;/ (like a bluetooth one…)

I’ll post my findings here…

also I have to look deeper to fix the SPI issue (to upgrade the firmware on the CM4).

@Rex - thanks for your kernel repo - can I assume that I can use the patches for NixOS-based distribution?

BTW: temp_fan_daemon is for devterm?

It should for the most part, you can compare the the kernel configs and see if they applied anything different.

correct the fan and printer stuff is for the DevTerm.

(still not luck with the audio)

fixed: support for board revision (and iomem) to fix the wiringpi issue.

– cut –
gpio version: 3.6
Copyright (c) 2012-2024 Gordon Henderson and contributors
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Hardware details:
Type: CM4, Revision: 00, Memory: 8192MB, Maker: Sony

System details:

  • Device tree present.
    Model: Raspberry Pi Compute Module 4 Rev 1.1

– cut —

There’s a custom wiringpi package in my repo for clockwork devices.

1 Like

yes, I know, I need to look at the custom package ((-; maybe I will port the changes to the NixOS version of wiringpi…

and I got audio via headphones, and pin10 is working as requested (headphone on/off)

next step: rewrite audio-patch to get rid of python dependency ((-;
next step: cleanup code and commit to GitHub

next next step: 4G module patch (do not have one…)
next, next, next step: ClockworkPI themes

2 Likes

Hello,

just committed the preliminary version of my attend to bring NixOS to uC.

found small issue: sometimes screen do not turn on on the cold-power-on. fix: just ssh to the box and make a reboot.

  boot.loader.grub.enable = false;
  boot.loader.generic-extlinux-compatible.enable = true;

  boot.kernelParams = [
    "8250.nr_uarts=0"
    "console=tty1"
    "plymouth.ignore-serial-consoles"
    "snd_bcm2835.enable_hdmi=1"
    "snd_bcm2835.enable_headphones=1"
    "ipv6.disable=1"
    "psi=1"
    "iomem=relaxed"
  ];

  imports = [./oom-hardware/uconsole];

config.txt

disable_overscan=1

[pi4]
kernel=u-boot-rpi4.bin
enable_gic=1
armstub=armstub8-gic.bin

[all]
arm_64bit=1
enable_uart=1
avoid_warnings=1
gpio=8=op,pu,dl
gpio=9=op,pd,dh
gpio=10=ip,np
gpio=11=op
ignore_lcd=0
arm_boost=1
max_framebuffers=2
2 Likes

Hello,

Just a quick image for NixOS-uConsole (for the experienced users) with the custom kernel and some preinstalled tools (wireless, git, etc).

Quick HOWTO:

  1. Download, unpack, write to SD.
  2. remember to make your own config based on repo uconsole/sd-image-uConsole.nix

have fun!

4 Likes

cool. try it at the moment.
Whats the command chain to connect to wifi?

it’s a standard “linux” way to connect to wifi via cli. You can go with howto on the page:

if you want a permanent and pretty ((-; solutions - you have to make it “NixOS way”. (i.e. make your own configuration with the networking.wireless)

I committed the example configs: oom-hardware/uconsole/configs at main · robertjakub/oom-hardware · GitHub

PS. be aware, that this image is using a custom kernel and it takes time to rebuild the derivations… and it is a minimal console alpha-beta-whatever image…
if U want the GUI - you have to do it “NixOS way” ((-;

It’s been a while since I set up WiFi via terminal - but I manage to get it working :smiley:
Another question: at the moment I’m trying to build with my own configuration.nix based on the sd-image-uConsole.nix.

It didn’t work on the first try. My goal is to have NixOS on the uConsole so that I have my explicit configuration.nix (or several modules) and can activate everything via nixos-rebuild switch. Did I have to place your repo completely in /etc/nixos/ that every patch will be found? (sorry for the noob questions - still learning :innocent:)

wait a while for updated image or just copy the sample configuration from uconsole/configs dir from my GitHub to /etc/nixos.

I think, I will update a new image tomorrow morning… (with the sample configs already in fs, binary-cache configured, etc…)

2 Likes

Cool :blush: I will have a look to learn a bit and wait for tomorrow :grin: thanks for your and @voidcontext work to bring NixOS to the uConsole :purple_heart:

1 Like

@0x17 reflash with nixos-24.11pre-1029-uconsole-aarch64.img.zst - Google Drive

howto after boot:

  1. nix-channel --update
  2. review and change /etc/nixos/local.nix (and/or configure.nix)
  3. nixos-rebuild switch/boot
2 Likes

Cool. Thank you :smiling_face: I will try it tomorrow

keep in mind, that I added a custom binary cache (see the local.nix) - this hopefully allows you to bypass building the kernel when rebuilding the configuration.

also… for the tests I overclocked the CM4. to disable it just mount /boot/firmware (mount /boot/firmware) and remove / remark 3 lines:

over_voltage=6
arm_freq=2000
gpu_freq=750

2 Likes

works like a charm. Thanks for this!

2 Likes

How do you connect to wifi without wpa supplicant in base image?

I disabled wpa on my wifi acces point and got everything done! Thank you for your work @johndoe!

configure wifi “nix-way” and enable the wpa…definitely enable wpa ((-; or use usb-ethernet dongle for the initial config ((-;