Merge pull request #5 from tstat/kernel-6.1

Kernel 6.1
This commit is contained in:
Travis Staton 2023-06-12 10:48:34 -04:00 committed by GitHub
commit da5b77e661
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 141 additions and 133 deletions

54
flake.lock generated
View file

@ -3,16 +3,16 @@
"libcamera-apps-src": {
"flake": false,
"locked": {
"lastModified": 1674645888,
"narHash": "sha256-UBTDHN0lMj02enB8im4Q+f/MCm/G2mFPP3pLImrZc5A=",
"lastModified": 1677660281,
"narHash": "sha256-A6UriYk8bHRL6wp6ehXOnUnbJH2/mNDkxwGemD/UYpw=",
"owner": "raspberrypi",
"repo": "libcamera-apps",
"rev": "9f08463997b82c4bf60e12c4ea43577959a8ae15",
"rev": "54a781dffdd101954dcfa6acd0bd80006f67da83",
"type": "github"
},
"original": {
"owner": "raspberrypi",
"ref": "v1.1.1",
"ref": "v1.1.2",
"repo": "libcamera-apps",
"type": "github"
}
@ -22,9 +22,8 @@
"libcamera-apps-src": "libcamera-apps-src",
"rpi-bluez-firmware-src": "rpi-bluez-firmware-src",
"rpi-firmware-nonfree-src": "rpi-firmware-nonfree-src",
"rpi-firmware-stable-src": "rpi-firmware-stable-src",
"rpi-linux-5_15-src": "rpi-linux-5_15-src",
"rpi-linux-5_15_87-src": "rpi-linux-5_15_87-src",
"rpi-firmware-src": "rpi-firmware-src",
"rpi-linux-6_1-src": "rpi-linux-6_1-src",
"u-boot-src": "u-boot-src"
}
},
@ -47,11 +46,11 @@
"rpi-firmware-nonfree-src": {
"flake": false,
"locked": {
"lastModified": 1674638139,
"narHash": "sha256-54JKmwypD7PRQdd7k6IcF7wL8ifMavEM0UwZwmA24O4=",
"lastModified": 1683107406,
"narHash": "sha256-9UgB8f2AaxG7S5Px46jOP9wUeO1VXKB0uJiPWh32oDI=",
"owner": "RPi-Distro",
"repo": "firmware-nonfree",
"rev": "7f29411baead874b859eda53efdc2472345ea454",
"rev": "2b465a10b04555b7f45b3acb85959c594922a3ce",
"type": "github"
},
"original": {
@ -60,14 +59,14 @@
"type": "github"
}
},
"rpi-firmware-stable-src": {
"rpi-firmware-src": {
"flake": false,
"locked": {
"lastModified": 1673003776,
"narHash": "sha256-tdaH+zZwmILNFBge2gMqtzj/1Hydj9cxhPvhw+7jTrU=",
"lastModified": 1680694337,
"narHash": "sha256-UtUd1MbsrDFxd/1C3eOAMDKPZMx+kSMFYOJP+Kc6IU8=",
"owner": "raspberrypi",
"repo": "firmware",
"rev": "78852e166b4cf3ebb31d051e996d54792f0994b0",
"rev": "055e044d5359ded1aacc5a17a8e35365373d0b8b",
"type": "github"
},
"original": {
@ -77,40 +76,23 @@
"type": "github"
}
},
"rpi-linux-5_15-src": {
"rpi-linux-6_1-src": {
"flake": false,
"locked": {
"lastModified": 1675874870,
"narHash": "sha256-oy+VgoB4IdFZjGwkx88dDSpwWZj2D5t3PyXPIwDsY1Q=",
"lastModified": 1680464256,
"narHash": "sha256-ILwecHZ1BN6GhZAUB6/UwiN/rZ8gHndKON6DUhidtxI=",
"owner": "raspberrypi",
"repo": "linux",
"rev": "14b35093ca68bf2c81bbc90aace5007142b40b40",
"rev": "0afb5e98488aed7017b9bf321b575d0177feb7ed",
"type": "github"
},
"original": {
"owner": "raspberrypi",
"ref": "rpi-5.15.y",
"ref": "1.20230405",
"repo": "linux",
"type": "github"
}
},
"rpi-linux-5_15_87-src": {
"flake": false,
"locked": {
"lastModified": 1673628667,
"narHash": "sha256-hNLVfhalmRhhRfvu2mR/qDmmGl//Ic1eqR7N1HFj2CY=",
"owner": "raspberrypi",
"repo": "linux",
"rev": "da4c8e0ffe7a868b989211045657d600be3046a1",
"type": "github"
},
"original": {
"owner": "raspberrypi",
"repo": "linux",
"rev": "da4c8e0ffe7a868b989211045657d600be3046a1",
"type": "github"
}
},
"u-boot-src": {
"flake": false,
"locked": {

View file

@ -6,13 +6,13 @@
flake = false;
url = "https://ftp.denx.de/pub/u-boot/u-boot-2023.01.tar.bz2";
};
rpi-linux-5_15-src = {
rpi-linux-6_1-src = {
flake = false;
url = "github:raspberrypi/linux/rpi-5.15.y";
url = "github:raspberrypi/linux/1.20230405";
};
rpi-firmware-stable-src = {
rpi-firmware-src = {
flake = false;
url = "github:raspberrypi/firmware/stable";
url = "github:raspberrypi/firmware/1.20230405";
};
rpi-firmware-nonfree-src = {
flake = false;
@ -24,7 +24,7 @@
};
libcamera-apps-src = {
flake = false;
url = "github:raspberrypi/libcamera-apps/v1.1.1";
url = "github:raspberrypi/libcamera-apps/v1.1.2";
};
};

View file

@ -1,9 +1,14 @@
{ u-boot-src, rpi-linux-5_15-src, rpi-firmware-stable-src
, rpi-firmware-nonfree-src, rpi-bluez-firmware-src, libcamera-apps-src }:
{ u-boot-src
, rpi-linux-6_1-src
, rpi-firmware-src
, rpi-firmware-nonfree-src
, rpi-bluez-firmware-src
, libcamera-apps-src
}:
final: prev:
let
# The version to stick at `pkgs.rpi-kernels.latest'
latest = "v5_15_92";
latest = "v6_1_21";
# Helpers for building the `pkgs.rpi-kernels' map.
rpi-kernel = { kernel, version, fw, wireless-fw, argsOverride ? null }:
@ -18,7 +23,8 @@ let
new-fw = prev.raspberrypifw.overrideAttrs (oldfw: { src = fw; });
new-wireless-fw = final.callPackage wireless-fw { };
version-slug = builtins.replaceStrings [ "." ] [ "_" ] version;
in {
in
{
"v${version-slug}" = {
kernel = new-kernel;
firmware = new-fw;
@ -26,11 +32,8 @@ let
};
};
rpi-kernels = builtins.foldl' (b: a: b // rpi-kernel a) { };
in {
# disable firmware compression so that brcm firmware can be found at
# the path expected by raspberry pi firmware/device tree
compressFirmwareXz = x: x;
in
{
# A recent known working version of libcamera-apps
libcamera-apps =
@ -69,13 +72,35 @@ in {
#
# For example: `pkgs.rpi-kernels.v5_15_87.kernel'
rpi-kernels = rpi-kernels [{
version = "5.15.92";
kernel = rpi-linux-5_15-src;
fw = rpi-firmware-stable-src;
version = "6.1.21";
kernel = rpi-linux-6_1-src;
fw = rpi-firmware-src;
wireless-fw = import ./raspberrypi-wireless-firmware.nix {
bluez-firmware = rpi-bluez-firmware-src;
firmware-nonfree = rpi-firmware-nonfree-src;
};
argsOverride = {
structuredExtraConfig = with prev.lib.kernel; {
# The perl script to generate kernel options sets unspecified
# parameters to `m` if possible [1]. This results in the
# unspecified config option KUNIT [2] getting set to `m` which
# causes DRM_VC4_KUNIT_TEST [3] to get set to `y`.
#
# This vc4 unit test fails on boot due to a null pointer
# exception with the existing config. I'm not sure why, but in
# any case, the DRM_VC4_KUNIT_TEST config option itself states
# that it is only useful for kernel developers working on the
# vc4 driver. So, I feel no need to deviate from the standard
# rpi kernel and attempt to successfully enable this test and
# other unit tests because the nixos perl script has this
# sloppy "default to m" behavior. So, I set KUNIT to `n`.
#
# [1] https://github.com/NixOS/nixpkgs/blob/85bcb95aa83be667e562e781e9d186c57a07d757/pkgs/os-specific/linux/kernel/generate-config.pl#L1-L10
# [2] https://github.com/raspberrypi/linux/blob/1.20230405/lib/kunit/Kconfig#L5-L14
# [3] https://github.com/raspberrypi/linux/blob/bb63dc31e48948bc2649357758c7a152210109c4/drivers/gpu/drm/vc4/Kconfig#L38-L52
KUNIT = no;
};
};
}] // {
latest = final.rpi-kernels."${latest}";
};

View file

@ -3,7 +3,7 @@
stdenv.mkDerivation rec {
pname = "libcamera-apps";
version = "v1.1.0";
version = "v1.1.2";
src = libcamera-apps-src;

View file

@ -8,91 +8,92 @@
"raspberry-pi-firmware-migrate" = {
description = "update the firmware partition";
wantedBy = [ "multi-user.target" ];
serviceConfig = let firmware-path = "/boot/firmware";
in {
Type = "oneshot";
MountImages =
"/dev/disk/by-label/${config.sdImage.firmwarePartitionName}:${firmware-path}";
StateDirectory = "raspberrypi-firmware";
ExecStart = pkgs.writeShellScript "migrate-rpi-firmware" ''
shopt -s nullglob
serviceConfig =
let firmware-path = "/boot/firmware";
in {
Type = "oneshot";
MountImages =
"/dev/disk/by-label/${config.sdImage.firmwarePartitionName}:${firmware-path}";
StateDirectory = "raspberrypi-firmware";
ExecStart = pkgs.writeShellScript "migrate-rpi-firmware" ''
shopt -s nullglob
TARGET_FIRMWARE_DIR="${firmware-path}"
TARGET_OVERLAYS_DIR="$TARGET_FIRMWARE_DIR/overlays"
TMPFILE="$TARGET_FIRMWARE_DIR/tmp"
UBOOT="${pkgs.uboot_rpi_arm64}/u-boot.bin"
SRC_FIRMWARE_DIR="${pkgs.raspberrypifw}/share/raspberrypi/boot"
STARTFILES=("$SRC_FIRMWARE_DIR"/start*.elf)
DTBS=("$SRC_FIRMWARE_DIR"/*.dtb)
BOOTCODE="$SRC_FIRMWARE_DIR/bootcode.bin"
FIXUPS=("$SRC_FIRMWARE_DIR"/fixup*.dat)
SRC_OVERLAYS_DIR="$SRC_FIRMWARE_DIR/overlays"
SRC_OVERLAYS=("$SRC_OVERLAYS_DIR"/*)
CONFIG="${config.hardware.raspberry-pi.config-output}"
TARGET_FIRMWARE_DIR="${firmware-path}"
TARGET_OVERLAYS_DIR="$TARGET_FIRMWARE_DIR/overlays"
TMPFILE="$TARGET_FIRMWARE_DIR/tmp"
UBOOT="${pkgs.uboot_rpi_arm64}/u-boot.bin"
SRC_FIRMWARE_DIR="${pkgs.raspberrypifw}/share/raspberrypi/boot"
STARTFILES=("$SRC_FIRMWARE_DIR"/start*.elf)
DTBS=("$SRC_FIRMWARE_DIR"/*.dtb)
BOOTCODE="$SRC_FIRMWARE_DIR/bootcode.bin"
FIXUPS=("$SRC_FIRMWARE_DIR"/fixup*.dat)
SRC_OVERLAYS_DIR="$SRC_FIRMWARE_DIR/overlays"
SRC_OVERLAYS=("$SRC_OVERLAYS_DIR"/*)
CONFIG="${config.hardware.raspberry-pi.config-output}"
migrate_uboot() {
echo "migrating uboot"
touch "$STATE_DIRECTORY/uboot-migration-in-progress"
cp "$UBOOT" "$TMPFILE"
mv -T "$TMPFILE" "$TARGET_FIRMWARE_DIR/u-boot-rpi-arm64.bin"
echo "${
migrate_uboot() {
echo "migrating uboot"
touch "$STATE_DIRECTORY/uboot-migration-in-progress"
cp "$UBOOT" "$TMPFILE"
mv -T "$TMPFILE" "$TARGET_FIRMWARE_DIR/u-boot-rpi-arm64.bin"
echo "${
builtins.toString pkgs.uboot_rpi_arm64
}" > "$STATE_DIRECTORY/uboot-version"
rm "$STATE_DIRECTORY/uboot-migration-in-progress"
}
migrate_config() {
echo "migrating config.txt"
touch "$STATE_DIRECTORY/config-migration-in-progress"
cp "$CONFIG" "$TMPFILE"
mv -T "$TMPFILE" "$TARGET_FIRMWARE_DIR/config.txt"
echo "${config.hardware.raspberry-pi.config-output}" > "$STATE_DIRECTORY/config-version"
rm "$STATE_DIRECTORY/config-migration-in-progress"
}
migrate_firmware() {
echo "migrating raspberrypi firmware"
touch "$STATE_DIRECTORY/firmware-migration-in-progress"
for SRC in "''${STARTFILES[@]}" "''${DTBS[@]}" "$BOOTCODE" "''${FIXUPS[@]}"
do
cp "$SRC" "$TMPFILE"
mv -T "$TMPFILE" "$TARGET_FIRMWARE_DIR/$(basename "$SRC")"
done
if [[ ! -d "$TARGET_OVERLAYS_DIR" ]]; then
mkdir "$TARGET_OVERLAYS_DIR"
fi
for SRC in "''${SRC_OVERLAYS[@]}"
do
cp "$SRC" "$TMPFILE"
mv -T "$TMPFILE" "$TARGET_OVERLAYS_DIR/$(basename "$SRC")"
done
echo "${
builtins.toString pkgs.raspberrypifw
}" > "$STATE_DIRECTORY/firmware-version"
rm "$STATE_DIRECTORY/firmware-migration-in-progress"
}
if [[ -f "$STATE_DIRECTORY/uboot-migration-in-progress" || ! -f "$STATE_DIRECTORY/uboot-version" || $(< "$STATE_DIRECTORY/uboot-version") != ${
builtins.toString pkgs.uboot_rpi_arm64
}" > "$STATE_DIRECTORY/uboot-version"
rm "$STATE_DIRECTORY/uboot-migration-in-progress"
}
migrate_config() {
echo "migrating config.txt"
touch "$STATE_DIRECTORY/config-migration-in-progress"
cp "$CONFIG" "$TMPFILE"
mv -T "$TMPFILE" "$TARGET_FIRMWARE_DIR/config.txt"
echo "${config.hardware.raspberry-pi.config-output}" > "$STATE_DIRECTORY/config-version"
rm "$STATE_DIRECTORY/config-migration-in-progress"
}
migrate_firmware() {
echo "migrating raspberrypi firmware"
touch "$STATE_DIRECTORY/firmware-migration-in-progress"
for SRC in "''${STARTFILES[@]}" "''${DTBS[@]}" "$BOOTCODE" "''${FIXUPS[@]}"
do
cp "$SRC" "$TMPFILE"
mv -T "$TMPFILE" "$TARGET_FIRMWARE_DIR/$(basename "$SRC")"
done
if [[ ! -d "$TARGET_OVERLAYS_DIR" ]]; then
mkdir "$TARGET_OVERLAYS_DIR"
} ]]; then
migrate_uboot
fi
for SRC in "''${SRC_OVERLAYS[@]}"
do
cp "$SRC" "$TMPFILE"
mv -T "$TMPFILE" "$TARGET_OVERLAYS_DIR/$(basename "$SRC")"
done
echo "${
if [[ -f "$STATE_DIRECTORY/config-migration-in-progress" || ! -f "$STATE_DIRECTORY/config-version" || $(< "$STATE_DIRECTORY/config-version") != ${
builtins.toString config.hardware.raspberry-pi.config-output
} ]]; then
migrate_config
fi
if [[ -f "$STATE_DIRECTORY/firmware-migration-in-progress" || ! -f "$STATE_DIRECTORY/firmware-version" || $(< "$STATE_DIRECTORY/firmware-version") != ${
builtins.toString pkgs.raspberrypifw
}" > "$STATE_DIRECTORY/firmware-version"
rm "$STATE_DIRECTORY/firmware-migration-in-progress"
}
if [[ -f "$STATE_DIRECTORY/uboot-migration-in-progress" || ! -f "$STATE_DIRECTORY/uboot-version" || $(< "$STATE_DIRECTORY/uboot-version") != ${
builtins.toString pkgs.uboot_rpi_arm64
} ]]; then
migrate_uboot
fi
if [[ -f "$STATE_DIRECTORY/config-migration-in-progress" || ! -f "$STATE_DIRECTORY/config-version" || $(< "$STATE_DIRECTORY/config-version") != ${
builtins.toString config.hardware.raspberry-pi.config-output
} ]]; then
migrate_config
fi
if [[ -f "$STATE_DIRECTORY/firmware-migration-in-progress" || ! -f "$STATE_DIRECTORY/firmware-version" || $(< "$STATE_DIRECTORY/firmware-version") != ${
builtins.toString pkgs.raspberrypifw
} ]]; then
migrate_firmware
fi
'';
};
} ]]; then
migrate_firmware
fi
'';
};
};
};