U-Boot: Difference between revisions

From NixOS Wiki
Initial U-Boot page
 
m Fixups
Line 6: Line 6:
Mainline U-Boot is packaged in Nixpkgs.
Mainline U-Boot is packaged in Nixpkgs.


* {{Nixpkgs Link}}  
* {{Nixpkgs Link|pkgs/misc/uboot/default.nix}}  


Vendor forks of U-Boot is generally not part packaged in Nixpkgs, and generally unwelcome.
Vendor forks of U-Boot are generally not packaged in Nixpkgs, and generally unwelcome.


U-Boot may be patched for compatibility reasons mainly, and work should be taken to send them to mainline U-Boot.
U-Boot may be patched for compatibility reasons mainly, and work should be taken to send them to mainline U-Boot.

Revision as of 03:25, 7 April 2024

U-Boot is a common platform firmware implementation for embedded and embedded-like devices.

It may also be used as a bootloader, but with modern U-Boot, UEFI boot is generally possible too.

U-Boot in Nixpkgs

Mainline U-Boot is packaged in Nixpkgs.

Vendor forks of U-Boot are generally not packaged in Nixpkgs, and generally unwelcome.

U-Boot may be patched for compatibility reasons mainly, and work should be taken to send them to mainline U-Boot.

Building a packaged U-Boot

You need to know two things:

  1. The target architecture
  2. If you need to cross-compile

The target architecture is the architecture of the target board. For example, the LibreTechCC board uses the AArch64 architecture.

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 x86_64 laptop, you would need to cross-compile.

With those facts known, you can build the appropriate attribute from a Nixpkgs checkout.

The general format is:

$ nix-build -A [pkgsCross.$cross_name.]$packageName
$ # Where the part in [brackets] is needed for cross-compilation.

To build with cross-compilation, you will need to prefix with the correct cross-compilation package set:

$ # Example running on x86_64.
$ uname -m 
x86_64

$ nix-build -A pkgsCross.aarch64-multiplatform.ubootLibreTechCC

If, instead, you are building natively (same architecture) you can refer to the package attribute name directly:

$ # Example output for an AArch64 system.
$ uname -m 
aarch64

$ nix-build -A ubootLibreTechCC
pkgsCross Cheat sheet
Architecture Package Set
aarch64 aarch64-multiplatform
armv7l armv7l-hf-multiplatform
armv6l raspberryPi [sic]