NixOS on ARM/OLIMEX Teres-A64: Difference between revisions

imported>KREYREN
Add instructions for serial console
m Compatibility notes: Dark mode support
 
(10 intermediate revisions by one other user not shown)
Line 29: Line 29:
== Status ==
== Status ==


Work In Progress..
Stable, production-ready and suitable for mission critical environment


The system is bootable and seems to work, but audio is broken and has rare graphical issues that are currently being investigated, note known issues below for building on Linux 6.0~6.1 resulting in broken display.
For U-Boot use armbian's distribution as currently the nixos's version is outdated and broken
 
U-boot support [https://github.com/NixOS/nixpkgs/pull/240827 has been submitted on 2023-06-30, but not yet merged].


== Installation instructions ==
== Installation instructions ==


{{ARM/installation allwinner|variant=aarch64}}
=== UEFI (recommended) ===


=== Partitioning ===
{{note|This method assumes that you have your bootloader flashed in eMMC or SPI}}


All Allwinner SoCs will try to find a boot image at sector 16 (8KB) of an SD card, connected to the first MMC controller.[3]  
Refer to the nixos.org download page and download the installer to your preference, then proceed to follow instructions in the [https://nixos.org/manual/nixos/stable/ NixOS manual on how to flash the installer] on e.g. USB drive


{{expansion|Details yet to be written..}}
=== EXTLINUX (legacy) ===


==== MBR partition scheme ====
{{ARM/installation allwinner|variant=aarch64}}
 
{{expansion|Installation instructions need to be written up to keep space for embedding the bootloader to the SPL.}}
 
==== GPT partition scheme ====
 
The [[NixOS_on_ARM/Allwinner_GPT_Installation|Allwinner GPT Installation]] instruction explains how to create a GPT partition table while allowing the isntallation of u-boot at the required offset.


== Serial console==
== Serial console==
Line 57: Line 49:
Serial console can be accessed by default on BAUM 115200 using the [https://www.olimex.com/Products/DIY-Laptop/KITS/TERES-USB-DEBUG/ TERES-USB-DEBUG] cable (or make one it's 3 pole jack with pl2303 converter, can be made work off of single board computer, etc..) in headphone jack port and accessed through:
Serial console can be accessed by default on BAUM 115200 using the [https://www.olimex.com/Products/DIY-Laptop/KITS/TERES-USB-DEBUG/ TERES-USB-DEBUG] cable (or make one it's 3 pole jack with pl2303 converter, can be made work off of single board computer, etc..) in headphone jack port and accessed through:


<pre>
    $ picocom -b BAUD /dev/SERIAL-DEVICE # Often set as /dev/ttyUSB0 @ baud of 115200
$ picocom -b BAUM /dev/SERIAL-DEVICE # Often set as /dev/ttyUSB0
</pre>


Currently the sdcard has set this by fault, but if you use custom configuration and want to maintain the serial console functionality then you need to append it to the kernel CLI through:
Currently the sdcard has set this by fault, but if you use custom configuration and want to maintain the serial console functionality then you need to append it to the kernel CLI through:


<pre>
    boot.kernelParams = ["console=ttyS0,115200n8"];
boot.kernelParams = [
    "console=ttyS0,115200n8"
    "console=ttyAMA0,115200n8"
    "console=tty0"
  ];
</pre>


== Compatibility notes ==
== Compatibility notes ==


{| class="table arm-compatibility"
{| class="table arm-compatibility"
!colspan="2" style="background: #fafafa"| Mainline kernel on NixOS
!colspan="2" style="background: var(--color-inverted)"| Mainline kernel on NixOS
|-
|-
! HDMI
! HDMI
|
|
* Hasn't been tested.
* Works
|-
|-
! Display
! Display
|
|
* Works outside of Linux 6.0~6.1
* Expected to work without issues with exceptions, see sunxi wiki
|-
|-
! WiFi/Bluetooth
! WiFi/Bluetooth
|
|
* Work, Requires non-libre firmware for RTL8723BS
* Works, currently requires non-libre firmware for RTL8723BS which is projected to be mitigated
|-
|-
! Audio (reproductors)
! Audio (reproductors)
|
|
* Broken, investigating..
* Unknown
|-
|-
! Audio (audio jack)
! Audio (audio jack)
Line 118: Line 102:
! FOSS Bootloader
! FOSS Bootloader
|
|
* Works - U-Boot
* Works - U-Boot/TowBoot
|}
|}


=== Downstream kernel ===
=== Kernels ===
 
==== Downstream Kernel ====


{{note|Keep in mind that using non-upstream forks of the kernel always incurs some risk as far as security goes.}}
{{note|Keep in mind that using non-upstream forks of the kernel always incurs some risk as far as security goes.}}
Line 127: Line 113:
{{expansion|Find and document use of a kernel with the added capabilities.}}
{{expansion|Find and document use of a kernel with the added capabilities.}}


== USB booting with u-boot ==
== USB booting with U-Boot ==


You will need to either have mainline U-Boot installed to the eMMC or to an SD card.
You will need to either have mainline U-Boot installed to the eMMC or to an SD card.
Line 141: Line 127:
This sets the boot order for this boot only. U-Boot can boot (among others) either of the NixOS sd-image or EFI iso from USB.
This sets the boot order for this boot only. U-Boot can boot (among others) either of the NixOS sd-image or EFI iso from USB.


== Known issues ==
== Notes ==


Building the bootloader and the configuration on linux 6.0~6.1 will result in broken display rendering due to  "''DRM_IOCTL_MODE_CREATE_DUMB failed: Cannot allocate memory''' caused by insufficient Quality Assurance at mesa upstream tracked on https://gitlab.freedesktop.org/mesa/mesa/-/issues/8198.
Refer to the device's sunxi-linux wiki page for more details: https://linux-sunxi.org/Olimex_Teres-A64


The fix has been merged in https://gitlab.freedesktop.org/mesa/mesa/-/commit/c426e5677f36c3b0b8e8ea199ed4f2c7fad06d47 and is part of Linux 6.2 so as long as you build ""and use"" this kernel the display should work without an issue.
For u-boot installation refer to the u-boot documentation for AllWinner devices: https://docs.u-boot.org/en/stable/board/allwinner/sunxi.html#installing-on-a-micro-sd-card


Note that if you boot and build on broken kernel then you can use serial console on BAUM 115200 to fix the issue.
For TowBoot installation refer to the TowBoot wiki:


As of 03/07/2023-EU NixOS 23.05 is shipped with LTS kernel which is 6.1 to get non-broken kernel you can use the following configuration:
== Resources ==
 
<pre>
# configuration.nix
boot.kernelPackages = pkgs.linuxPackages_6_3;
</pre>


Please let me know if you encounter this issue outside of known broken linux release. -- KREYREN
0. [https://linux-sunxi.org/Olimex_Teres-A64 The Sunxi Linux Wiki Page for the device]
 
== Resources ==


1. [https://www.olimex.com/Products/DIY-Laptop/ Official product page]
1. [https://www.olimex.com/Products/DIY-Laptop/ Official product page]
Line 167: Line 146:


4. [https://www.armbian.com/olimex-teres-a64 Armbian product page for Teres]
4. [https://www.armbian.com/olimex-teres-a64 Armbian product page for Teres]
5. [https://www.olimex.com/forum/index.php?board=39.0 Teres-A64 section on the OLIMEX forum]