NixOS on ARM: Difference between revisions

imported>Samueldr
imported>Samueldr
m Fix U-Boot casing
Line 454: Line 454:
=== The easiest way ===
=== The easiest way ===


Assuming upstream u-boot supports the board through a defconfig, it is possible possible to build u-boot using the cross-compiling architecture from an x86_64 host. Here's a sample use.
Assuming upstream U-Boot supports the board through a defconfig, it is possible possible to build U-Boot using the cross-compiling architecture from an x86_64 host. Here's a sample use.


<syntaxhighlight>
<syntaxhighlight>
Line 465: Line 465:
For armv7 and armv6 <code>pkgsCross.arm-embedded</code> should work, this is available in the unstable channel (19.03 and following) by setting <code>-I "nixpkgs=/path/to/new-nixpkgs-checkout</code>.
For armv7 and armv6 <code>pkgsCross.arm-embedded</code> should work, this is available in the unstable channel (19.03 and following) by setting <code>-I "nixpkgs=/path/to/new-nixpkgs-checkout</code>.


This should build whatever is needed for, and then build u-boot for the desired defconfig, then open a shell with the build in <code>$buildInputs</code>. Do note that this particular invocation may need more changes than only the defconfig if built for other than allwinner boards.
This should build whatever is needed for, and then build U-Boot for the desired defconfig, then open a shell with the build in <code>$buildInputs</code>. Do note that this particular invocation may need more changes than only the defconfig if built for other than allwinner boards.


Here's an example command, for allwinner boards, on how to write to an SD card.
Here's an example command, for allwinner boards, on how to write to an SD card.
Line 482: Line 482:
* Otherwise, you can get the boot information (path to kernel zImage, initrd, DTB, command line arguments) by extracting <code>extlinux.conf</code> from the boot partition of the image, and then attempt to boot it via the U-Boot shell, or some other mechanism that your board's distro uses (e.g. <code>uEnv.txt</code>).
* Otherwise, you can get the boot information (path to kernel zImage, initrd, DTB, command line arguments) by extracting <code>extlinux.conf</code> from the boot partition of the image, and then attempt to boot it via the U-Boot shell, or some other mechanism that your board's distro uses (e.g. <code>uEnv.txt</code>).


==== Building u-boot from your NixOS PC ====
==== Building U-Boot from your NixOS PC ====


Assuming
Assuming


* Your board is supported upstream by u-boot or there is a recent enough fork with <code>extlinux.conf</code> support.
* Your board is supported upstream by U-Boot or there is a recent enough fork with <code>extlinux.conf</code> support.
* You do not have nix setup on an ARM device
* You do not have nix setup on an ARM device
* Your nix isn't setup for cross-compilation
* Your nix isn't setup for cross-compilation


It is still possible to build u-boot using tools provided by NixOS.
It is still possible to build U-Boot using tools provided by NixOS.


In the following terminal session, replace <code>orangepi_pc_defconfig</code> with the appropriate board [http://git.denx.de/?p=u-boot.git;a=tree;f=configs;hb=HEAD from the configs folder] of u-boot.
In the following terminal session, replace <code>orangepi_pc_defconfig</code> with the appropriate board [http://git.denx.de/?p=u-boot.git;a=tree;f=configs;hb=HEAD from the configs folder] of U-Boot.


{{Commands|<nowiki>
{{Commands|<nowiki>