I built my first rpi4 image and it is working great. NixOS is amazing.
The only problem is that when I connect serial via GPIO pins as I always do, and turn rpi4 on, I can get serial output:
...
mmc0 is current device
Scanning mmc 0:2...
Found /boot/extlinux/extlinux.conf
Retrieving file: /boot/extlinux/extlinux.conf
------------------------------------------------------------
1: NixOS - Default
Enter choice: 1: NixOS - Default
Retrieving file: /boot/extlinux/../nixos/qx2n5ahf5syck3gnzxd93k1wf99q20w5-initrd-linux-6.1.57-initrd
Retrieving file: /boot/extlinux/../nixos/74j767inpgxk1r4f81jsxpq5xbfzg1bg-linux-6.1.57-Image
append: init=/nix/store/jrxq6hi57ycgiygs5mcsy6d5a5d89axm-nixos-system-rpi-23.05.20231013.898cb20/init console=tty0 console=ttyS0,115200n8 consoleblank=0 systemd.show_status=1 nohibernate loglevel=7
Retrieving file: /boot/extlinux/../nixos/74j767inpgxk1r4f81jsxpq5xbfzg1bg-linux-6.1.57-dtbs/broadcom/bcm2711-rpi-4-b.dtb
Moving Image from 0x80000 to 0x200000, end=3a70000
...
Starting kernel ...
And then I loose serial - just VGA (over HDMI) from that point on.
You can see that my configuration has serial configured since in append: I have console=tty0 console=ttyS0,115200n8 which in my opinion should give me serial as the primary output and VGA as the secondary - exactly as I would like to have…
I would try adding all the variants to command line, like console=ttyS0,115200n8 console=ttyS1,115200n8 console=ttyAMA0,115200n8 console=ttyAMA1,115200n8 to see if it helps. If not you might need to fiddle with device tree overlays to disable Bluetooth (or use another UART / pins).
I would test it but I don’t have a Pi4 at hand currently (it will arrive with Pi5 during this or next month).
Yeah, already tried all options. I think the problem is that the config.boot.kernelParams tell the bootloader to output on serial but I’m missing something that tells the system when it is up and running also to output to serial…
boot.kernelParams are passed from generated extlinux configuration to Linux kernel. U-Boot starts first and enables a serial (or all of them I don’t know exactly tbh), then it loads /boot/extlinux/extlinux.conf which contains a kernel command line specified in boot.kernelParams - this is all that is typically needed to get serial output on console(s) and later a login prompt. (This is a simplified view of the boot sequence but the rest is not really relevant for us).
So you actually correctly instruct kernel (not bootloader) and this should “just” work, but…