NixOS on ARM/Teres-I

From NixOS Wiki
Revision as of 21:56, 2 June 2021 by Thra11 (talk | contribs) (Removed outdated bit about the keyboard in u-boot)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Teres I
Manufacturer OLIMEX
Architecture AArch64
Bootloader U-Boot
Boot order To be confirmed
Maintainer Thra11

The Teres I is a DIY laptop kit based on the Allwinner A64 SoC.

It can boot from SD or from the internal eMMC.

Status

Most functionality works in a generic aarch64 image using a recent kernel (tested 5.11 and 5.12).

Board-specific installation notes

Serial console

Details about the pinout for the headphone jack are available [1].

Bluetooth

Bluetooth support for the Teres I is not yet included in linux. However, it can be made to work with a few modifications:

1. Enable support for Realtek bluetooth controllers in your chosen kernel:

  nixpkgs.config.packageOverrides = pkgs: {
    linux_5_11 = pkgs.linux_5_11.override {
      extraConfig = ''
        BT_HCIUART_RTL y
      '';  
      kernelPatches = [ {
          name = "arm64-dts-allwinner-a64-Enable-Bluetooth-on-Teres-I";
          patch = ./0001-arm64-dts-allwinner-a64-Enable-Bluetooth-on-Teres-I.patch;
        }
      ];
    };
  };

2. Add a section to the teres devicetree, arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts, to indicate that it has a realtek rtl8723bs bluetooth chip attached to uart1. This can be done either by patching the kernel sources, or as a device tree overlay:

&uart1 {
   pinctrl-names = "default";
   pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
   uart-has-rtscts;
   status = "okay";

   bluetooth {
       compatible = "realtek,rtl8723bs-bt";
       device-wake-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */
       host-wake-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */
       enable-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
   };
};

3. The package firmware-linux-nonfreecontains a blob which is suitable, rtl8723bs_config-OBDA8723.bin but it is suffixed with the ACPI ID. Since we are using a devicetree instead, linux expects it to be available as rtl8723bs_config.bin. We can achieve this by creating a simple package containing a symlink to the firmware file, and adding it to hardware.firmware in our NixOS configuration:

Breeze-text-x-plain.png
teres-rtl8723bs-firmware/default.nix
{ runCommandNoCC, firmwareLinuxNonfree }:

runCommandNoCC "teres-rtl8723bs-firmware-${firmwareLinuxNonfree.version}" {} ''
  mkdir -p $out/lib/firmware/rtl_bt
  ln -s ${firmwareLinuxNonfree}/lib/firmware/rtl_bt/rtl8723bs_config-OBDA8723.bin \
    $out/lib/firmware/rtl_bt/rtl8723bs_config.bin
''


Known issues

Resources