chore: bump libs & fix libcamera, fix upstream nixpkgs

This commit is contained in:
adminy 2024-06-18 23:58:46 +01:00
parent 6045de5f79
commit c2388c307b
8 changed files with 171 additions and 142 deletions

72
flake.lock generated
View file

@ -3,16 +3,16 @@
"libcamera-apps-src": {
"flake": false,
"locked": {
"lastModified": 1713431793,
"narHash": "sha256-uoewZMGf3vsBoRDfRz8KBKl+J6st/J44SHvNRMBdaUI=",
"lastModified": 1717081637,
"narHash": "sha256-s4zJh6r3VhiquO54KWZ78dVCH1BmlphY9zEB9BidNyo=",
"owner": "raspberrypi",
"repo": "libcamera-apps",
"rev": "414a7383464b98f21f5e5381a16cc73ae0350ba6",
"rev": "49344f2a8d1817558d4e6463032fcf11be618b38",
"type": "github"
},
"original": {
"owner": "raspberrypi",
"ref": "v1.4.4",
"ref": "v1.5.0",
"repo": "libcamera-apps",
"type": "github"
}
@ -20,50 +20,50 @@
"libcamera-src": {
"flake": false,
"locked": {
"lastModified": 1713446223,
"narHash": "sha256-p0/inkHPRUkxSIsTmj7VI7sIaX7OXdqjMGZ31W7cnt4=",
"lastModified": 1718617480,
"narHash": "sha256-qqEMJzMotybf1nJp1dsz3zc910Qj0TmqCm1CwuSb1VY=",
"owner": "raspberrypi",
"repo": "libcamera",
"rev": "eb00c13d7c9f937732305d47af5b8ccf895e700f",
"rev": "6ddd79b5bdbedc1f61007aed35391f1559f9e29a",
"type": "github"
},
"original": {
"owner": "raspberrypi",
"ref": "v0.3.0+rpt20240617",
"repo": "libcamera",
"rev": "eb00c13d7c9f937732305d47af5b8ccf895e700f",
"type": "github"
}
},
"libpisp-src": {
"flake": false,
"locked": {
"lastModified": 1713362873,
"narHash": "sha256-CHd44CH5dBcZuK+5fZtONZ8HE/lwGKwK5U0BYUK8gG4=",
"lastModified": 1718613892,
"narHash": "sha256-V/d4RrXoq8HNc8r/Kr1gH3E7YTZzfIdgbaJtq/Xi7uQ=",
"owner": "raspberrypi",
"repo": "libpisp",
"rev": "999da5acb4f40cb8e93d22ec16e28edd55ec9414",
"rev": "b567f04556801ca350331ed21a1ae3eef4675c23",
"type": "github"
},
"original": {
"owner": "raspberrypi",
"ref": "v1.0.5",
"ref": "v1.0.6",
"repo": "libpisp",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1715218190,
"narHash": "sha256-R98WOBHkk8wIi103JUVQF3ei3oui4HvoZcz9tYOAwlk=",
"lastModified": 1718732645,
"narHash": "sha256-Zv8FapPPVVP5sqty4DWxSaL4p8sFuoAEglelBtSIhm0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9a9960b98418f8c385f52de3b09a63f9c561427a",
"rev": "9be7393d7204ba14ead6ec4f0381cc91bfb2aa24",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9a9960b98418f8c385f52de3b09a63f9c561427a",
"rev": "9be7393d7204ba14ead6ec4f0381cc91bfb2aa24",
"type": "github"
}
},
@ -83,50 +83,50 @@
"rpi-bluez-firmware-src": {
"flake": false,
"locked": {
"lastModified": 1698157837,
"narHash": "sha256-CjbZ3t3TW/iJ3+t9QKEtM9NdQU7SwcUCDYuTmFEwvhU=",
"lastModified": 1708969706,
"narHash": "sha256-KakKnOBeWxh0exu44beZ7cbr5ni4RA9vkWYb9sGMb8Q=",
"owner": "RPi-Distro",
"repo": "bluez-firmware",
"rev": "d9d4741caba7314d6500f588b1eaa5ab387a4ff5",
"rev": "78d6a07730e2d20c035899521ab67726dc028e1c",
"type": "github"
},
"original": {
"owner": "RPi-Distro",
"repo": "bluez-firmware",
"rev": "d9d4741caba7314d6500f588b1eaa5ab387a4ff5",
"rev": "78d6a07730e2d20c035899521ab67726dc028e1c",
"type": "github"
}
},
"rpi-firmware-nonfree-src": {
"flake": false,
"locked": {
"lastModified": 1700058854,
"narHash": "sha256-Yynww79LPPkau4YDSLI6IMOjH64nMpHUdGjnCfIR2+M=",
"lastModified": 1708967191,
"narHash": "sha256-BGq0+cr+xBRwQM/LqiQuRWuZpQsKM5jfcrNCqWMuVzM=",
"owner": "RPi-Distro",
"repo": "firmware-nonfree",
"rev": "88aa085bfa1a4650e1ccd88896f8343c22a24055",
"rev": "223ccf3a3ddb11b3ea829749fbbba4d65b380897",
"type": "github"
},
"original": {
"owner": "RPi-Distro",
"repo": "firmware-nonfree",
"rev": "88aa085bfa1a4650e1ccd88896f8343c22a24055",
"rev": "223ccf3a3ddb11b3ea829749fbbba4d65b380897",
"type": "github"
}
},
"rpi-firmware-src": {
"flake": false,
"locked": {
"lastModified": 1713970515,
"narHash": "sha256-X5OinkLh/+mx34DM8mCk4tqOGuJdYxkvygv3gA77NJI=",
"lastModified": 1716978780,
"narHash": "sha256-KsCo7ZG6vKstxRyFljZtbQvnDSqiAPdUza32xTY/tlA=",
"owner": "raspberrypi",
"repo": "firmware",
"rev": "969420b4121b522ab33c5001074cc4c2547dafaf",
"rev": "3590de0c181d433af368a95f15bc480bdaff8b47",
"type": "github"
},
"original": {
"owner": "raspberrypi",
"ref": "1.20240424",
"ref": "1.20240529",
"repo": "firmware",
"type": "github"
}
@ -134,31 +134,31 @@
"rpi-linux-6_6-src": {
"flake": false,
"locked": {
"lastModified": 1713516936,
"narHash": "sha256-mlsDuVczu0e57BlD/iq7IEEluOIgqbZ+W4Ju30E/zhw=",
"lastModified": 1718722155,
"narHash": "sha256-WKlxHAAvDRN10M9pBmF3rNmXKd3uT2hv2/uxASa1LnQ=",
"owner": "raspberrypi",
"repo": "linux",
"rev": "0c341f47adc3578cd5f817aa20ee2b7f9ae6b23e",
"rev": "da87f91ad8450ccc5274cd7b6ba8d823b396c96f",
"type": "github"
},
"original": {
"owner": "raspberrypi",
"ref": "stable_20240423",
"repo": "linux",
"rev": "da87f91ad8450ccc5274cd7b6ba8d823b396c96f",
"type": "github"
}
},
"u-boot-src": {
"flake": false,
"locked": {
"lastModified": 1712055538,
"narHash": "sha256-IlaDdjKq/Pq2orzcU959h93WXRZfvKBGDO/MFw9mZMg=",
"lastModified": 1717461299,
"narHash": "sha256-vcq+lR3Bw/Nreu8Muywvec4jUvZvodjk/E+8XkkKvZg=",
"type": "tarball",
"url": "https://ftp.denx.de/pub/u-boot/u-boot-2024.04.tar.bz2"
"url": "https://ftp.denx.de/pub/u-boot/u-boot-2024.07-rc4.tar.bz2"
},
"original": {
"type": "tarball",
"url": "https://ftp.denx.de/pub/u-boot/u-boot-2024.04.tar.bz2"
"url": "https://ftp.denx.de/pub/u-boot/u-boot-2024.07-rc4.tar.bz2"
}
}
},

View file

@ -2,38 +2,38 @@
description = "raspberry-pi nixos configuration";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/9a9960b98418f8c385f52de3b09a63f9c561427a";
nixpkgs.url = "github:NixOS/nixpkgs/9be7393d7204ba14ead6ec4f0381cc91bfb2aa24"; # 2024-06-18
u-boot-src = {
flake = false;
url = "https://ftp.denx.de/pub/u-boot/u-boot-2024.04.tar.bz2";
url = "https://ftp.denx.de/pub/u-boot/u-boot-2024.07-rc4.tar.bz2";
};
rpi-linux-6_6-src = {
flake = false;
url = "github:raspberrypi/linux/stable_20240423";
url = "github:raspberrypi/linux/da87f91ad8450ccc5274cd7b6ba8d823b396c96f"; # 2024-06-17
};
rpi-firmware-src = {
flake = false;
url = "github:raspberrypi/firmware/1.20240424";
url = "github:raspberrypi/firmware/1.20240529";
};
rpi-firmware-nonfree-src = {
flake = false;
url = "github:RPi-Distro/firmware-nonfree/88aa085bfa1a4650e1ccd88896f8343c22a24055";
url = "github:RPi-Distro/firmware-nonfree/223ccf3a3ddb11b3ea829749fbbba4d65b380897"; # 1:20230625-2+rpt2
};
rpi-bluez-firmware-src = {
flake = false;
url = "github:RPi-Distro/bluez-firmware/d9d4741caba7314d6500f588b1eaa5ab387a4ff5";
url = "github:RPi-Distro/bluez-firmware/78d6a07730e2d20c035899521ab67726dc028e1c"; # 1.2-9+rpt3
};
libcamera-apps-src = {
flake = false;
url = "github:raspberrypi/libcamera-apps/v1.4.4";
url = "github:raspberrypi/libcamera-apps/v1.5.0";
};
libcamera-src = {
flake = false;
url = "github:raspberrypi/libcamera/eb00c13d7c9f937732305d47af5b8ccf895e700f"; # v0.2.0+rpt20240418
url = "github:raspberrypi/libcamera/v0.3.0+rpt20240617";
};
libpisp-src = {
flake = false;
url = "github:raspberrypi/libpisp/v1.0.5";
url = "github:raspberrypi/libpisp/v1.0.6";
};
};
@ -55,7 +55,8 @@
libcamera-overlay = self.overlays.libcamera;
};
packages.aarch64-linux = {
linux = pinned.rpi-kernels.latest.kernel;
linux_2711 = pinned.rpi-kernels.latest_bcm2711.kernel;
linux_2712 = pinned.rpi-kernels.latest_bcm2712.kernel;
firmware = pinned.rpi-kernels.latest.firmware;
wireless-firmware = pinned.rpi-kernels.latest.wireless-firmware;
uboot-rpi-arm64 = pinned.uboot-rpi-arm64;

View file

@ -7,70 +7,12 @@
}:
final: prev:
let
# The version to stick at `pkgs.rpi-kernels.latest'
latest = "v6_6_28";
# The version to stick at `pkgs.rpi-kernels.latest_bcm271x'
latest = "v6_6_34";
# Helpers for building the `pkgs.rpi-kernels' map.
rpi-kernel = { kernel, version, fw, wireless-fw, argsOverride ? null }:
let
new-kernel = prev.linux_rpi4.override {
argsOverride = {
src = kernel;
inherit version;
modDirVersion = version;
} // (if builtins.isNull argsOverride then { } else argsOverride);
};
new-fw = prev.raspberrypifw.overrideAttrs (oldfw: { src = fw; });
new-wireless-fw = final.callPackage wireless-fw { };
version-slug = builtins.replaceStrings [ "." ] [ "_" ] version;
in
{
"v${version-slug}" = {
kernel = new-kernel;
firmware = new-fw;
wireless-firmware = new-wireless-fw;
};
};
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;
compressFirmwareZstd = x: x;
# provide generic rpi arm64 u-boot
uboot_rpi_arm64 = prev.buildUBoot rec {
defconfig = "rpi_arm64_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
filesToInstall = [ "u-boot.bin" ];
version = "2024.04";
patches = [ ];
makeFlags = [ ];
src = u-boot-src;
# In raspberry pi sbcs the firmware manipulates the device tree in
# a variety of ways before handing it off to the linux kernel. [1]
# Since we have installed u-boot in place of a linux kernel we may
# pass the device tree passed by the firmware onto the kernel, or
# we may provide the kernel with a device tree of our own. This
# configuration uses the device tree provided by firmware so that
# we don't have to be aware of all manipulation done by the
# firmware and attempt to mimic it.
#
# 1. https://forums.raspberrypi.com/viewtopic.php?t=329799#p1974233
};
# default to latest firmware
raspberrypiWirelessFirmware = final.rpi-kernels.latest.wireless-firmware;
raspberrypifw = final.rpi-kernels.latest.firmware;
} // {
# rpi kernels and firmware are available at
# `pkgs.rpi-kernels.<VERSION>.{kernel,firmware,wireless-firmware}'.
#
# For example: `pkgs.rpi-kernels.v5_15_87.kernel'
rpi-kernels = rpi-kernels [{
version = "6.6.28";
kernel-config = board: {
inherit board;
version = builtins.replaceStrings ["v" "_"] ["" "."] latest;
kernel = rpi-linux-6_6-src;
fw = rpi-firmware-src;
wireless-fw = import ./raspberrypi-wireless-firmware.nix {
@ -100,7 +42,72 @@ in
GPIO_PWM = no;
};
};
}] // {
latest = final.rpi-kernels."${latest}";
};
# Helpers for building the `pkgs.rpi-kernels' map.
rpi-kernel = { kernel, version, fw, wireless-fw, argsOverride ? null, board }:
let
new-kernel = prev.linux_rpi4.override {
argsOverride = {
src = kernel;
inherit version;
modDirVersion = version;
kernelPatches = [];
defconfig = "${board}_defconfig";
postFixup = "";
} // (if builtins.isNull argsOverride then { } else argsOverride);
};
new-fw = prev.raspberrypifw.overrideAttrs (oldfw: { src = fw; });
new-wireless-fw = final.callPackage wireless-fw { };
version-slug = builtins.replaceStrings [ "." ] [ "_" ] version;
in
{
"latest_${board}" = {
kernel = new-kernel;
firmware = new-fw;
wireless-firmware = new-wireless-fw;
};
};
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;
compressFirmwareZstd = x: x;
# provide generic rpi arm64 u-boot
uboot_rpi_arm64 = prev.buildUBoot rec {
defconfig = "rpi_arm64_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
filesToInstall = [ "u-boot.bin" ];
version = "2024.07-rc4";
patches = [ ];
makeFlags = [ ];
src = u-boot-src;
# In raspberry pi sbcs the firmware manipulates the device tree in
# a variety of ways before handing it off to the linux kernel. [1]
# Since we have installed u-boot in place of a linux kernel we may
# pass the device tree passed by the firmware onto the kernel, or
# we may provide the kernel with a device tree of our own. This
# configuration uses the device tree provided by firmware so that
# we don't have to be aware of all manipulation done by the
# firmware and attempt to mimic it.
#
# 1. https://forums.raspberrypi.com/viewtopic.php?t=329799#p1974233
};
# default to latest firmware
raspberrypiWirelessFirmware = final.rpi-kernels.latest_bcm2712.wireless-firmware;
raspberrypifw = final.rpi-kernels.latest_bcm2712.firmware;
} // {
# rpi kernels and firmware are available at
# `pkgs.rpi-kernels.<VERSION>_<BOARD>.{kernel,firmware,wireless-firmware}'.
#
# For example: `pkgs.rpi-kernels.latest_bcm2712.kernel'
rpi-kernels = rpi-kernels [
(kernel-config "bcm2711")
(kernel-config "bcm2712")
];
}

View file

@ -1,28 +1,12 @@
{ libcamera-apps-src
, lib
, stdenv
, fetchFromGitHub
, fetchpatch
, meson
, pkg-config
, libjpeg
, libtiff
, libpng
, libcamera
, libepoxy
, boost
, libexif
, ninja
}:
{ libcamera-apps-src, lib, pkgs, stdenv }:
stdenv.mkDerivation rec {
pname = "libcamera-apps";
version = "v1.4.1";
version = "v1.5.0";
src = libcamera-apps-src;
nativeBuildInputs = [ meson pkg-config ];
buildInputs = [ libjpeg libtiff libcamera libepoxy boost libexif libpng ninja ];
nativeBuildInputs = with pkgs; [ meson pkg-config ];
buildInputs = with pkgs; [ libjpeg libtiff libcamera libepoxy boost libexif libpng ninja ];
mesonFlags = [
"-Denable_qt=false"
"-Denable_opencv=false"

View file

@ -11,7 +11,7 @@ final: prev:
libpisp = final.stdenv.mkDerivation {
name = "libpisp";
version = "1.0.3";
version = "1.0.5";
src = libpisp-src;
nativeBuildInputs = with final; [ pkg-config meson ninja ];
buildInputs = with final; [ nlohmann_json boost ];
@ -22,9 +22,30 @@ final: prev:
};
libcamera = prev.libcamera.overrideAttrs (old: {
version = "0.1.0";
version = "0.2.0";
src = libcamera-src;
buildInputs = old.buildInputs ++ (with final; [ libpisp ]);
buildInputs = old.buildInputs ++ (with final; [
libpisp openssl libtiff
(python3.withPackages (ps: with ps; [
python3-gnutls pybind11 pyyaml ply
]))
libglibutil gst_all_1.gst-plugins-base
]);
patches = [ ];
mesonFlags = [
"--buildtype=release"
"-Dpipelines=rpi/vc4,rpi/pisp"
"-Dipas=rpi/vc4,rpi/pisp"
"-Dv4l2=true"
"-Dgstreamer=enabled"
"-Dtest=false"
"-Dlc-compliance=disabled"
"-Dcam=disabled"
"-Dqcam=disabled"
"-Ddocumentation=enabled"
"-Dpycamera=enabled"
];
});
}

View file

@ -1,9 +1,9 @@
{ bluez-firmware, firmware-nonfree }:
{ lib, stdenvNoCC, fetchFromGitHub }:
{ lib, stdenvNoCC }:
stdenvNoCC.mkDerivation {
pname = "raspberrypi-wireless-firmware";
version = "2023-11-15";
version = "2024-02-26";
srcs = [ ];

View file

@ -3,12 +3,23 @@
let
cfg = config.raspberry-pi-nix;
board = cfg.board;
kernel = pkgs.rpi-kernels."latest_${board}".kernel;
in
{
imports = [ ../sd-image ./config.nix ./i2c.nix ];
options = with lib; {
raspberry-pi-nix = {
board = mkOption {
default = "bcm2712";
type = types.str;
description = ''
The kernel board version to build.
Examples at: https://github.com/NixOS/nixpkgs/blob/5c8e2fb3c690e8be1d92cda8d2bf0562cd67ce47/pkgs/os-specific/linux/kernel/linux-rpi.nix#L20-L25
without the _defconfig part.
'';
};
pin-inputs = {
enable = mkOption {
default = true;
@ -97,7 +108,7 @@ in
TARGET_OVERLAYS_DIR="$TARGET_FIRMWARE_DIR/overlays"
TMPFILE="$TARGET_FIRMWARE_DIR/tmp"
UBOOT="${pkgs.uboot_rpi_arm64}/u-boot.bin"
KERNEL="${pkgs.rpi-kernels.latest.kernel}/Image"
KERNEL="${kernel}/Image"
SHOULD_UBOOT=${if cfg.uboot.enable then "1" else "0"}
SRC_FIRMWARE_DIR="${pkgs.raspberrypifw}/share/raspberrypi/boot"
STARTFILES=("$SRC_FIRMWARE_DIR"/start*.elf)
@ -125,7 +136,7 @@ in
cp "$KERNEL" "$TMPFILE"
mv -T "$TMPFILE" "$TARGET_FIRMWARE_DIR/kernel.img"
echo "${
builtins.toString pkgs.rpi-kernels.latest.kernel
builtins.toString kernel
}" > "$STATE_DIRECTORY/kernel-version"
rm "$STATE_DIRECTORY/kernel-migration-in-progress"
}
@ -181,7 +192,7 @@ in
fi
if [[ "$SHOULD_UBOOT" -ne 1 ]] && [[ ! -f "$STATE_DIRECTORY/kernel-version" || $(< "$STATE_DIRECTORY/kernel-version") != ${
builtins.toString pkgs.rpi-kernels.latest.kernel
builtins.toString kernel
} ]]; then
migrate_kernel
fi
@ -301,9 +312,12 @@ in
"reset-raspberrypi" # required for vl805 firmware to load
];
# This pin is not necessary, it would be fine to replace it with
# `pkgs.rpi-kernels.latest.kernel`. It is helpful to ensure
# `kernel`. It is helpful to ensure
# cache hits for kernel builds though.
kernelPackages = pkgs.linuxPackagesFor pkgs.rpi-kernels.latest.kernel;
kernelPackages = pkgs.linuxPackagesFor (kernel.override {
# Some patches cannot be applied because they are already upstream.
ignoreConfigErrors = true;
});
loader = {
grub.enable = lib.mkDefault false;

View file

@ -19,13 +19,15 @@
${lib.strings.concatStringsSep " " config.boot.kernelParams}
'';
};
board = config.raspberry-pi-nix.board;
kernel = pkgs.rpi-kernels."latest_${board}".kernel;
populate-kernel =
if config.raspberry-pi-nix.uboot.enable
then ''
cp ${pkgs.uboot_rpi_arm64}/u-boot.bin firmware/u-boot-rpi-arm64.bin
''
else ''
cp "${pkgs.rpi-kernels.latest.kernel}/Image" firmware/kernel.img
cp "${kernel}/Image" firmware/kernel.img
cp "${kernel-params}" firmware/cmdline.txt
'';
in