This is the minimal viable configuration: vendor bootloader and NixOS image with vendor kernel but buildable with Nix.
To boot this configuration, you require a microSD card for uboot, and USB (or similar) storage for NixOS. This is required due to the write-enable line floating on the hardware which prevents writing to the microSD slot, and NixOS’s sdImage assuming the device it boots from is writeable.
# Build the sdImage
nix-build release.nix -A sdImage -o sdImage
# Write to storage
cat sdImage/sd-image/*.img > /dev/$usb
# Build the uboot image
nix-build release.nix -A ubootImage -o ubootImage
# Write to microSD storage
cat ubootImage/*.img > /dev/$microSD
The default memory speed is 3200mhz. If your memory is slower, you will need to specify a compatible speed with:
# Build the uboot image
nix-build release.nix -A ubootImage -o ubootImage --arg ddrSpeed 2600
Note that uboot from upstream has some issues and incompatibilities. These have been patched into the uboot configuration, so everything should work with no additional effort.
This causes ramdisk loading to fail. Set this explicitly via setenv
setenv ramdisk_addr_r 83900000
This allows the usage of FDTDIR
in extlinux.conf, and should be set via
setenv fdtfile freescale/fsl-lx2160a-cex7.dtb
This is very easy to overrun in NixOS, and results in the ethernet firmware failing to load. The vendor uboot configuration allows 4K, while the recomended value for this is 1MB.
setenv scriptaddr 0x83800000
This can be set to only scan the device you want to boot.
setenv boot_targets nvme0
setenv scriptaddr 0x83800000 setenv ramdisk_addr_r 83900000 setenv fdtfile freescale/fsl-lx2160a-cex7.dtb setenv boot_targets nvme0
Requires some dependencies:
nix-shell -E 'with (import <nixpkgs> {}); stdenv.mkDerivation { name = "fake"; nativeBuildInputs = [ ncurses pkgconfig bison flex ]; }'
export NIX_CFLAGS_LINK=$(pkg-config --libs ncurses)
Distributing disk images is strange, especialy when devices have
onboard emmc, sata, usb and nvme. A squashfs image would boot from
read-only media and allow nixos-install
onto their desired target.
It’s also much smaller.
The source repo has uefi build scripts, which were completely ignored.
Determine which of boot.kernelParams
are important and move them to
a module that can be included by installed systems.
Why is 2gb of memory allocated to huge pages?
This repo is a port of Solidrun/lx2160a_build, and has a copy of the patches from that repository, it is subject to the same conditions. Anything original to this repository is available under the same conditions as nixpkgs for ease of upstreaming.