Jump to content

NixOS on ARM/Teres-I

From NixOS Wiki
Revision as of 17:28, 2 June 2021 by imported>Thra11 (Created first draft of page for Olimex Teres I DIY laptop kit)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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

☶︎
This article or section needs to be expanded. Further information may be found in the related discussion page. Please consult the pedia article metapage for guidelines on contributing.

Serial console

Details about the pinout for the headphone jack are available [1]. Serial output is enabled by writing 1 to GPIO 361.

☶︎
This article or section needs to be expanded. Further information may be found in the related discussion page. Please consult the pedia article metapage for guidelines on contributing.

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:

❄︎ 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

  • The keyboard firmware does not initialise in time to provide input to u-boot. An external USB keyboard can be used to change u-boot settings or choose which NixOS generation to boot.
☶︎
This article or section needs to be expanded. Further information may be found in the related discussion page. Please consult the pedia article metapage for guidelines on contributing.

Resources