raspberry-pi/1: Add Raspberry Pi 1 support

The Raspberry Pi SD installer remains in nixpkgs, but its
sd-image-raspberrypi.nix configuration still selects
linuxKernel.packages.linux_rpi1. Commit b1c58b82b98f ("linux-rpi*: remove")
removed that kernel from nixpkgs, leaving the installer unable to
evaluate. Move the Pi 1 image configuration to nixos-hardware alongside
the vendor kernel.

The shared vendor kernel builder accepts rpiVersion = 1, but there is no
corresponding board profile. Add an ARMv6 profile with 32-bit U-Boot and
the shared firmware installer. Use the legacy boot and initrd settings
without the graphics defaults for newer boards. Provide SD-image and
installer modules adapted from the nixpkgs image, and exclude the
profile from checks without ARMv6 coverage.

The image has been cross-compiled but has not been tested on a board, as
no Pi 1 hardware was available.

Link: https://github.com/NixOS/nixpkgs/blob/b1c58b82b98ff287751c78ee2b96dc5c4384e3b3/nixos/modules/installer/sd-card/sd-image-raspberrypi.nix#L20
Link: https://github.com/NixOS/nixpkgs/commit/b1c58b82b98ff287751c78ee2b96dc5c4384e3b3
Signed-off-by: Cryolitia PukNgae <cryolitia@mercallure.com>
This commit is contained in:
Cryolitia PukNgae committed 2026-10-19 16:01:58 +08:00
1 parent 9d17af9966
commit 11cefffd51
7 files changed
+95 -5

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
{ lib, pkgs, ... }:
{
# Preserve the legacy ARMv6 boot configuration rather than opting into the
# graphics and camera defaults used by the newer Raspberry Pi profiles.
imports = [
../common/config-txt.nix
../common/firmware.nix
];
nixpkgs.hostPlatform = lib.mkDefault "armv6l-linux";
boot = {
consoleLogLevel = lib.mkDefault 7;
kernelPackages = lib.mkDefault (
pkgs.linuxPackagesFor (pkgs.callPackage ../common/kernel.nix { rpiVersion = 1; })
);
# The vendor defconfig does not provide the generic PCI storage drivers.
initrd = {
includeDefaultModules = lib.mkDefault false;
systemd.tpm2.enable = lib.mkDefault false;
availableKernelModules = {
mmc_block = true;
usb_storage = true;
usbhid = true;
# EFI variable access is not needed for the U-Boot boot path.
efivarfs = lib.mkForce false;
};
};
loader = {
grub.enable = lib.mkDefault false;
generic-extlinux-compatible.enable = lib.mkDefault true;
};
};
hardware.raspberry-pi = {
configtxt.settings.all = {
enable_uart = lib.mkDefault true;
avoid_warnings = lib.mkDefault 1;
};
firmware.uboot = {
enable = lib.mkDefault true;
package = lib.mkDefault pkgs.ubootRaspberryPi;
};
};
}
+11
View File
@@ -0,0 +1,11 @@
{ modulesPath, ... }:
{
imports = [
"${modulesPath}/profiles/installation-device.nix"
./sd-image.nix
];
# The installation media is also the installation target.
installer.cloneConfig = false;
}
+28
View File
@@ -0,0 +1,28 @@
# Adapted from nixpkgs' installer/sd-card/sd-image-raspberrypi.nix.
{
config,
lib,
modulesPath,
...
}:
{
imports = [
# The generic installer utilities include EFI tools broken on 32-bit ARM.
"${modulesPath}/profiles/minimal.nix"
"${modulesPath}/installer/sd-card/sd-image.nix"
./default.nix
];
# This image targets the Pi 1, whose vendor kernel lacks generic PCI drivers.
hardware.enableAllHardware = lib.mkForce false;
sdImage = {
# The shared firmware installer also copies the device-tree overlays.
firmwareSize = lib.mkDefault 128;
populateRootCommands = ''
mkdir -p ./files/boot
${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
'';
};
}