NixOS on ARM/Clockworkpi A06 uConsole: Difference between revisions

From NixOS Wiki
imported>Tarinaky
No edit summary
imported>Tarinaky
No edit summary
Line 10: Line 10:


These patches can be applied using the following nix snippet:
These patches can be applied using the following nix snippet:
```
   boot.kernelPackages = pkgs.linuxPackages_6_5;
   boot.kernelPackages = pkgs.linuxPackages_6_5;
   boot.kernelPatches = [
   boot.kernelPatches = [
Line 46: Line 45:
     }   
     }   
   ];
   ];
```
 


=== Bootloader ===
=== Bootloader ===
At present I am not sure where the bootloader images used by the official/vendor supplied distro can be obtained. The easiest way to make any generated image bootable is to copy them from the official image available here: [[http://dl.clockworkpi.com/uConsole_A06_v1.1e.img.7z]]
At present I am not sure where the bootloader images used by the official/vendor supplied distro can be obtained. The easiest way to make any generated image bootable is to copy them from the official image available here: [[http://dl.clockworkpi.com/uConsole_A06_v1.1e.img.7z]]


```
$ sfdisk --dump uConsole_A06_v1.1e.img
<...>
uConsoleA06_v1.1e.img1 : start = 32768, size = 14942208, type=83
$ sfdisk --dump your_nixos_image.img
<...>
your_nixos_image.img1 : start = 16384, size = 61440, type = b
your_nixos_image.img2 : start = 77824, size = 15322384, type = 83, bootable


$ dd if=uConsole_A06_v1.1e.img of=nixos_a06.img count=32768
  $ sfdisk --dump uConsole_A06_v1.1e.img
$ dd if=your_nixos_image.img skip=32768 of=nixos_a06.img seek=77824
  <...>
```
  uConsoleA06_v1.1e.img1 : start = 32768, size = 14942208, type=83
 
  $ sfdisk --dump your_nixos_image.img
  <...>
  your_nixos_image.img1 : start = 16384, size = 61440, type = b
  your_nixos_image.img2 : start = 77824, size = 15322384, type = 83, bootable
 
  $ dd if=uConsole_A06_v1.1e.img of=nixos_a06.img count=32768
  $ dd if=your_nixos_image.img skip=32768 of=nixos_a06.img seek=77824


The partition table for the resulting image will then be wrong, but we can fix that with fdisk by deleting our partition, and then recreating it.
The partition table for the resulting image will then be wrong, but we can fix that with fdisk by deleting our partition, and then recreating it.
```
fdisk ./nixos_a06.img
d
n
p
1
32768
<Default should now be to end of file>
Do you want to remove the signature? No
w


$ sfdisk --dump nixos_a06.img
  fdisk ./nixos_a06.img
<...>
  d
nixos_a06.img1 start = 32768, size = 15322384, type=83
  n
````
  p
  1
  32768
  <Default should now be to end of file>
  Do you want to remove the signature? No
  w
 
  $ sfdisk --dump nixos_a06.img
  <...>
  nixos_a06.img1 start = 32768, size = 15322384, type=83


Your image should now be bootable.
Your image should now be bootable.

Revision as of 23:27, 1 February 2024

Status

Panel/Display works. Broadcom wifi works. System boots. All other features untested.

Modules / Drivers

I'm still figuring out the required module list, however the wifi chip uses a broadcom bcm43435, which is supported by brcmfmac.

Kernel

The device tree patches to make the panel/display work are currently only available as kernel patches. The official patches only support kernel 5.x, however there is a community patchset for kernel 6.5 available at [[1]]

These patches can be applied using the following nix snippet:

 boot.kernelPackages = pkgs.linuxPackages_6_5;
 boot.kernelPatches = [
   {
     name = "suspend";
     patch = fetchurl { url = https://raw.githubusercontent.com/Autianic/clockworkpi-linux-kernel/master/linux-clockworkpi-a06/00-rockchip-suspend.patch };
   }  
   {
     name = "a06";
     patch = fetchurl { url = https://raw.githubusercontent.com/Autianic/clockworkpi-linux-kernel/master/linux-clockworkpi-a06/01-clockworkpi-dts-a06.patch; };
   }  
   {
     name = "backlight";
     patch = fetchurl { url = https://raw.githubusercontent.com/Autianic/clockworkpi-linux-kernel/master/linux-clockworkpi-a06/02-backlight-ocp8178.patch; };
   }  
   {
     name = "cwd686";
     patch = fetchurl { url = https://raw.githubusercontent.com/Autianic/clockworkpi-linux-kernel/master/linux-clockworkpi-a06/02-panel-cwd686-driver.patch; };
   }  
   {
     name = "cwu50";
     patch = fetchurl { url = https://raw.githubusercontent.com/Autianic/clockworkpi-linux-kernel/master/linux-clockworkpi-a06/02-panel-cwu50-driver.patch; };
   }  
   {
     name = "uconsole";
     patch = fetchurl { url = https://raw.githubusercontent.com/Autianic/clockworkpi-linux-kernel/master/linux-clockworkpi-a06/03-clockworkpi-dts-uconsole.patch; };
   }  
   { 
     name = "power";
     patch = fetchurl { url = https://raw.githubusercontent.com/Autianic/clockworkpi-linux-kernel/master/linux-clockworkpi-a06/04-mfd-axp20x-add-clockworkpi-a06-power-support.patch; };
   }  
   {
     name = "extcart";
     patch = fetchurl { url = https://raw.githubusercontent.com/Autianic/clockworkpi-linux-kernel/master/linux-clockworkpi-a06/06-clockworkpi-a06-extcart.patch; };
   }  
 ];


Bootloader

At present I am not sure where the bootloader images used by the official/vendor supplied distro can be obtained. The easiest way to make any generated image bootable is to copy them from the official image available here: [[2]]


 $ sfdisk --dump uConsole_A06_v1.1e.img
 <...>
 uConsoleA06_v1.1e.img1 : start = 32768, size = 14942208, type=83
 
 $ sfdisk --dump your_nixos_image.img
 <...>
 your_nixos_image.img1 : start = 16384, size = 61440, type = b
 your_nixos_image.img2 : start = 77824, size = 15322384, type = 83, bootable
 
 $ dd if=uConsole_A06_v1.1e.img of=nixos_a06.img count=32768
 $ dd if=your_nixos_image.img skip=32768 of=nixos_a06.img seek=77824

The partition table for the resulting image will then be wrong, but we can fix that with fdisk by deleting our partition, and then recreating it.

 fdisk ./nixos_a06.img
 d
 n
 p
 1
 32768
 <Default should now be to end of file>
 Do you want to remove the signature? No
 w
 
 $ sfdisk --dump nixos_a06.img
 <...>
 nixos_a06.img1 start = 32768, size = 15322384, type=83

Your image should now be bootable.