NixOS on ARM/PINE A64-LTS: Difference between revisions

imported>Samueldr
m Updates Status section with location of hydra builds
imported>Samueldr
m u-boot → U-Boot
Line 13: Line 13:
|-
|-
!Bootloader
!Bootloader
|Upstream u-boot<ref>https://github.com/NixOS/nixpkgs/pull/32553#issuecomment-373915787</ref>
|Upstream U-Boot<ref>https://github.com/NixOS/nixpkgs/pull/32553#issuecomment-373915787</ref>
|-
|-
!Boot order
!Boot order
Line 32: Line 32:
== Status ==
== Status ==


Upstream NixOS AArch64 image boots on the PINE A64-LTS, using the proper upstream u-boot.
Upstream NixOS AArch64 image boots 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 these location:
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 these location:
Line 43: Line 43:
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.
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):
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>
<syntaxhighlight lang="bash">sudo dd if=sopine-u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8</syntaxhighlight>
Line 62: Line 62:
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.
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.
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.
The author did not find ways to flash the NOR flash from a running Linux system using the mainline kernel.
Line 90: Line 90:
</pre>
</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.
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.}}
{{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 ==
== 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>.  
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>
<pre>