Difference between revisions of "NixOS on ARM/PINE A64-LTS"

From NixOS Wiki
Jump to: navigation, search
m (Inits section about SPI NOR Flash with t)
m (rollback unauthorized mass edits)
Tag: Rollback
 
(22 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{ARM/breadcrumb}}
+
This page has been moved to the official NixOS Wiki:
<div class="infobox">
 
{|class="table"
 
!colspan="2" class="title"|PINE A64-LTS
 
|-
 
|colspan="2"|[[File:Pine-a64-lts.jpg|frameless|256px|A PINE A64-LTS with eMMC.]]
 
|-
 
!Manufacturer
 
|PINE64 (Pine Microsystems Inc.)
 
|-
 
!Architecture
 
|AArch64
 
|-
 
!Bootloader
 
|Upstream u-boot<ref>https://github.com/NixOS/nixpkgs/pull/32553#issuecomment-373915787</ref>
 
|-
 
!Maintainer
 
|[[User:samueldr|samueldr]]
 
|}
 
</div>
 
{{note|While made by the same manufacturer and using an Allwinner SOC, the <em>[[NixOS on ARM/PINE A64|PINE A64]]</em> (non LTS) does not use the same bootloader.}}
 
  
The PINE A64-LTS is an affordable "Long Time Supply" single board computer built around the Allwinner R18 SOC.
+
    ⇒ '''[https://wiki.nixos.org/wiki/NixOS_on_ARM/PINE_A64-LTS NixOS_on_ARM/PINE_A64-LTS]'''
  
It can boot from SD or from an eMMC.
+
''— samueldr, Lead of NixOS on ARM.''
 
 
The [https://www.pine64.org/?page_id=1491 SOPINE board] from the same manufacturer, using the Baseboard "Model A" should be 100% compatible with the A64-LTS; the A64-LTS support is built using the device tree of the Baseboard "Model A". Though untested, this should mean that the Baseboard "Model A" will work with NixOS<sup>[testing needed]</sup>.
 
 
 
== Status ==
 
 
 
Upstream NixOS AArch64 image will boot on the PINE A64-LTS, using the proper upstream u-boot.
 
 
 
U-boot support [https://github.com/NixOS/nixpkgs/pull/32553#issuecomment-373915787 has been added 2018-03-18]. The bootloader with SPL can be downloaded from this location:
 
 
 
{{note|The location will be updated once it has been built through the usual automation by Dezgeg.}}
 
 
 
* [http://cs.helsinki.fi/u/tmtynkky/sopine-u-boot-sunxi-with-spl.bin <code>sopine-u-boot-sunxi-with-spl.bin</code> built by Dezgeg.]
 
 
 
== Board-specific installation notes ==
 
 
 
First follow the [[NixOS_on_ARM#Installation|generic installation steps]] to get the installer image on an SD card or the eMMC. A compatible eMMC to SD may be required to flash the eMMC. If you do not have one available, it is possible to boot another operating system on the A64-LTS and from there <code>dd</code> to the eMMC.
 
 
 
U-Boot needs to be copied to specific sectors on the microSD card with <code>dd</code>. Download u-boot for the board (<code>sopine-u-boot-sunxi-with-spl.bin</code>), and copy it to the correct location with (again, replace <code>/dev/sdX</code> with the correct path to the SD card device):
 
 
 
<syntaxhighlight lang="bash">sudo dd if=sopine-u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8</syntaxhighlight>
 
 
 
Then, install using the [[NixOS_on_ARM#NixOS_installation_.26_configuration|installation and configuration steps]].
 
 
 
== Serial console==
 
 
 
{{expansion|This needs to be documented and tested.}}
 
 
 
== Compatibility notes ==
 
 
 
* Using the upstream kernel at 4.15, neither ethernet seems to have troubles. The interface is detected but seems to not work right.
 
* HDMI support is untested.
 
 
 
== SPI NOR flash ==
 
 
 
The Pine A64-LTS is equipe with a 4MB SPI NOR flash chip. The CPU will read the bootloader from it, after trying the SD card and the eMMC.
 
 
 
Flashing u-boot to the SPI NOR flash will allow booting the <code>sd-image-aarch64.img</code> based images without further manipulating the image or the boot device (e.g. without embedding u-boot to the usb drive). It may also allow booting UEFI compliant AArch64 images, though this is unverified.
 
 
 
The author did not find ways to flash the NOR flash from a running Linux system using the mainline kernel.
 
 
 
=== Flashing from FEL ===
 
 
 
The easiest method to trigger [http://linux-sunxi.org/FEL FEL mode] is to not have previously flashed the SPI NOR flash with a valid bootloader, and to remove all storage devices used to boot. The Pine A64-LTS will fallback to FEL mode.
 
 
 
To connect the Pine A64-LTS to the computer in FEL mode, you will need a USB A-to-A (male to male) cable, and plug to the uppser USB receptacle<ref>http://linux-sunxi.org/Pine64#FEL_mode</ref>
 
 
 
Once started in FEL mode, the computer should see the following device.
 
 
 
<pre>
 
Bus ___ Device ___: ID 1f3a:efe8 Onda (unverified) V972 tablet in flashing mode
 
</pre>
 
 
 
It is, then, possible to use <code>sunxi-fel</code> from <code>sunxi-tools</code> to flash the a bootloader to the SPI NOR flash.
 
 
 
{{note|As of 2018-11-24, the <code>sunxi-tools</code> package is not up-to-date enough, and does not have the required <code>spiflash-write</code> sub-command.}}
 
 
 
<pre>
 
$ nix-shell -p sunxi-tools
 
[nix-shell:~]$ sudo sunxi-fel -l
 
USB device ___:___  Allwinner A64    ________:________:________:________
 
[nix-shell:~]$ sudo sunxi-fel -p spiflash-write 0 u-boot-sunxi-with-spl.bin
 
100% [================================================]  575 kB,  96.9 kB/s
 
</pre>
 
 
 
Once complete, unplug the power from the Pine A64-LTS, unplug the Pine A64-LTS from the host computer, and try booting without storage devices, but either serial or HDMI. When successful, u-boot will start, and eventually try to network boot.
 
 
 
{{note|Once a valid bootloader is on the SPI NOR flash, FEL mode will not be entered automatically. [http://linux-sunxi.org/FEL Follow instructions of the FEL page of the linux-sunxi wiki] for alternative ways to enter FEL mode.}}
 
 
 
== Flashing from u-boot ==
 
 
 
It is possible, through using a u-boot bootloader built from the u-boot-sunxi tree, to write to the SPI NOR flash. The [https://github.com/ayufan-pine64/bootloader-build ayufan-pine64/bootloader-build] has such a build. Using the released <code>.img</code> files, it is possible to write their custom build or erase their custom build. From their custom build, it is possible to write to the SPI NOR flash using the <code>sf</code> command<ref>https://github.com/ayufan-pine64/bootloader-build/blob/d7e891cbee8a559ea50cf25ee18aa9d7b4ea9d58/blobs/flash-spi.cmd#L11-L13</ref>.
 
 
 
<pre>
 
# Detect the SPI NOR flash
 
=> sf probe
 
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
 
# Sanity checks
 
=> ls mmc 0:1
 
  558296  u-boot.bin
 
1 file(s), 0 dir(s)
 
# Loading the bootloader from an SD card
 
=> load mmc 0:1 ${kernel_addr_r} /u-boot.bin
 
reading /u-boot.bin
 
558296 bytes read in 79 ms (6.7 MiB/s)
 
# Erasing the SPI NOR flash
 
=> sf erase 0 3e8000
 
SF: 4096000 bytes @ 0x0 Erased: OK
 
# Writing to the SPI NOR flash
 
=> sf write ${kernel_addr_r} 0 3e8000
 
device 0 offset 0x0, size 0x3e8000
 
SF: 4096000 bytes @ 0x0 Written: OK
 
</pre>
 
 
 
== Resources ==
 
 
 
* [https://www.pine64.org/?page_id=46823 Official product page]
 
* [https://linux-sunxi.org/Xunlong_Orange_Pi_PC linux-sunxi wiki page]
 

Latest revision as of 10:56, 6 April 2024

This page has been moved to the official NixOS Wiki:

    ⇒ NixOS_on_ARM/PINE_A64-LTS

— samueldr, Lead of NixOS on ARM.