1
0
forked from dan/liminix

add pkgs.openwrt_24_10

is needed by Belkin RT3200 and might also be handy for OpenWrt One?

this is very copy-pastey, will tidy it up after it
stops being a moving target
This commit is contained in:
Daniel Barlow 2025-01-03 23:52:08 +00:00
parent 13cb8d3692
commit 350ddde260
4 changed files with 89 additions and 2 deletions

View File

@ -122,6 +122,7 @@
cp ${pkgs.linux-firmware}/lib/firmware/mediatek/{mt7915,mt7615,mt7622}* $out
'';
};
openwrt = pkgs.openwrt_24_10;
in {
imports = [
../../modules/arch/aarch64.nix
@ -131,8 +132,10 @@
config = {
kernel = {
extraPatchPhase = ''
${pkgs.openwrt.applyPatches.mediatek}
${openwrt.applyPatches.mediatek}
'';
src = openwrt.kernelSrc;
version = openwrt.kernelVersion;
config = {
PCI = "y";
ARCH_MEDIATEK = "y";
@ -241,7 +244,6 @@
hardware =
let
openwrt = pkgs.openwrt;
mac80211 = pkgs.kmodloader.override {
targets = ["mt7615e" "mt7915e"];
inherit (config.system.outputs) kernel;

View File

@ -100,6 +100,7 @@ in {
odhcp-script = callPackage ./odhcp-script { };
odhcp6c = callPackage ./odhcp6c { };
openwrt = callPackage ./openwrt { };
openwrt_24_10 = callPackage ./openwrt/2410.nix { };
output-template = callPackage ./output-template { };
ppp = callPackage ./ppp { };
pppoe = callPackage ./pppoe { };

68
pkgs/openwrt/2410.nix Normal file
View File

@ -0,0 +1,68 @@
{ fetchFromGitHub, pkgsBuildBuild, lib }:
let
src = fetchFromGitHub {
name = "openwrt-source";
repo = "openwrt";
owner = "openwrt";
rev = "refs/tags/v24.10.0-rc4";
hash = "sha256-7edkUCTfGnZeMWr/aXoQrP4I47iXhMi/gUxO2SR+Ylc=";
};
kernelVersion = "6.6.67";
kernelSeries = lib.versions.majorMinor kernelVersion;
doPatch = family: ''
cp -av ${src}/target/linux/generic/files/* .
chmod -R u+w .
cp -av ${src}/target/linux/${family}/files/* .
chmod -R u+w .
test -d ${src}/target/linux/${family}/files-${kernelSeries}/ && cp -av ${src}/target/linux/${family}/files-${kernelSeries}/* .
chmod -R u+w .
patches() {
for i in $* ; do patch --batch --forward -p1 < $i ;done
}
patches ${src}/target/linux/generic/backport-${kernelSeries}/*.patch
patches ${src}/target/linux/generic/pending-${kernelSeries}/*.patch
patches ${src}/target/linux/generic/hack-${kernelSeries}/*.patch
patches ${src}/target/linux/${family}/patches-${kernelSeries}/*.patch
patches \
${./make-mtdsplit-jffs2-endian-agnostic.patch} \
${./fix-mtk-wed-bm-desc-ptr.patch}
'';
in {
inherit src;
# The kernel sources typically used with this version of openwrt
# You can find this in `include/kernel-5.15` or similar in the
# openwrt sources
kernelSrc = pkgsBuildBuild.fetchurl {
name = "linux.tar.gz";
url = "https://cdn.kernel.org/pub/linux/kernel/v${lib.versions.major kernelVersion}.x/linux-${kernelVersion}.tar.gz";
hash = "sha256-Vj6O6oa83xzAF3FPl6asQK2Zrl7PaBCVjcUDq93caL4=";
};
inherit kernelVersion;
applyPatches.ath79 = doPatch "ath79";
applyPatches.ramips = doPatch "ramips";
applyPatches.mediatek = doPatch "mediatek"; # aarch64
applyPatches.mvebu = doPatch "mvebu"; # arm
applyPatches.rt2x00 = ''
PATH=${pkgsBuildBuild.patchutils}/bin:$PATH
for i in ${src}/package/kernel/mac80211/patches/rt2x00/6*.patch ; do
fixed=$(basename $i).fixed
sed '/depends on m/d' < $i | sed 's/CPTCFG_/CONFIG_/g' | recountdiff | filterdiff -x '*/local-symbols' > $fixed
case $fixed in
606-*)
;;
611-*)
filterdiff -x '*/rt2x00.h' < $fixed | patch --forward -p1
;;
601-*|607-*)
filterdiff -x '*/rt2x00_platform.h' < $fixed | patch --forward -p1
;;
*)
cat $fixed | patch --forward -p1
;;
esac
done
'';
}

View File

@ -0,0 +1,16 @@
From: Arnout Engelen <arnout@bzzt.net>
Date: Wed, 18 Dec 2024 14:17:46 +0100
Partial patch from https://gti.telent.net/raboof/liminix/commit/641409230051b82616c6feb35f2c0e730e46f614
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mmio.c 2024-12-18 11:08:00.598231122 +0100
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mmio.c 2024-12-18 11:08:29.845100034 +0100
@@ -625,7 +625,7 @@
static u32 mt7915_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size)
{
- struct mtk_rxbm_desc *desc = wed->rx_buf_ring.desc;
+ struct mtk_wed_bm_desc *desc = wed->rx_buf_ring.desc;
struct mt76_txwi_cache *t = NULL;
struct mt7915_dev *dev;
struct mt76_queue *q;