U-Boot: Difference between revisions

Add notes about usage (or rather lack of notes about usage)
Rework example build
Line 15: Line 15:
You need to know two things:
You need to know two things:


# The target architecture
# The target ISA (''Instruction Set Architecture'')
# If you need to cross-compile
# If you need to cross-compile


The target architecture is the ''architecture'' of the target board. For example, the <code>LibreTechCC</code> board uses the <code>AArch64</code> ''architecture''.
The target ISA is the ISA of the ''target board''. This would be defined by the CPU used on the board.


You will need to cross-compile if you are not building on the same ''architecture'' as the target board. For example, if you are building on a standard <code>x86_64</code> laptop, you would need to cross-compile.
You will need to cross-compile if you are not building on the same ''architecture'' as the target board. For example, if you are building for an <code>AArch64</code> ''target board'' on a standard <code>x86_64</code> laptop, you would need to cross-compile.


With those facts known, you can build the appropriate attribute from a Nixpkgs checkout.
With those facts known, you can build the appropriate attribute from a Nixpkgs checkout.
Line 27: Line 27:
$ nix-build -A [pkgsCross.$cross_name.]$packageName
$ nix-build -A [pkgsCross.$cross_name.]$packageName
$ # Where the part in [brackets] is needed for cross-compilation.
$ # Where the part in [brackets] is needed for cross-compilation.
</syntaxhighlight>To build with cross-compilation, you will need to prefix with the correct cross-compilation package set:<syntaxhighlight lang="shell-session">
$ # Example running on x86_64.
$ uname -m
x86_64
$ nix-build -A pkgsCross.aarch64-multiplatform.ubootLibreTechCC
</syntaxhighlight>If, instead, you are building natively (same architecture) you can refer to the package attribute name directly:<syntaxhighlight lang="shell-session">
$ # Example output for an AArch64 system.
$ uname -m
aarch64
$ nix-build -A ubootLibreTechCC
</syntaxhighlight>
</syntaxhighlight>
=== <code>pkgsCross</code> Cheat sheet ===
{| class="wikitable"
{| class="wikitable"
|+
<code>pkgsCross</code> attribute name cheat sheet
!Architecture
!Architecture
!Package Set
!Package Set
Line 55: Line 43:
|<code>raspberryPi</code> ''[sic]''
|<code>raspberryPi</code> ''[sic]''
|}
|}
==== Example build ====
The following examples use the U-Boot package for a ''LibreTech CC ‘LePotato’'', which uses an ''S905X'' SoC. This SoC uses an <code>AArch64</code> ISA.
To build the package with cross-compilation, you need to prefix with the correct cross-compilation package set:<syntaxhighlight lang="shell-session">
$ # Example running on x86_64.
$ uname -m
x86_64
$ nix-build -A pkgsCross.aarch64-multiplatform.ubootLibreTechCC
</syntaxhighlight>If, instead, you are building natively (same architecture) you can refer to the package attribute name directly:<syntaxhighlight lang="shell-session">
$ # Example output for an AArch64 system.
$ uname -m
aarch64
$ nix-build -A ubootLibreTechCC
</syntaxhighlight>


=== Using U-Boot ===
=== Using U-Boot ===
You will need to consult either the [https://docs.u-boot.org/ Official U-Boot documentation], or a board-specific page to find out how to use the produced output.
You will need to consult either the [https://docs.u-boot.org/ Official U-Boot documentation], or a board-specific page to find out how to use the produced output.


The large variety of ecosystems supported by U-Boot makes it impossible to document succintly.
The large variety of ecosystems supported by U-Boot makes it impossible to document succinctly.


==== SBC and related projects in NixOS ====
==== SBC and related projects in NixOS ====
Line 76: Line 79:


== Other U-Boot distributions ==
== Other U-Boot distributions ==
There exists other prebuilt U-Boot distributions. As long as they follow the mainline U-Boot semantics, and are close enough in age to the current releases, they should work to boot NixOS.
There exists other pre-built U-Boot distributions. As long as they follow the mainline U-Boot semantics, and are close enough in age to the current releases, they should work to boot NixOS.


=== Tow-Boot ===
=== Tow-Boot ===