forked from dan/liminix
Rebased and using openwrt 24.10-rc4
This commit is contained in:
parent
4d9a811f38
commit
b9c314981a
@ -50,13 +50,14 @@
|
||||
|
||||
module = {pkgs, config, lib, lim, ... }:
|
||||
let
|
||||
openwrt = pkgs.openwrt_24_10;
|
||||
mediatek-firmware = pkgs.stdenv.mkDerivation {
|
||||
name = "wlan-firmware";
|
||||
phases = ["installPhase"];
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
|
||||
cp ${pkgs.openwrt.linux-firmware}/lib/firmware/mediatek/{mt7915,mt7615,mt7986_eeprom_mt7976,mt7981}* $out
|
||||
cp ${pkgs.linux-firmware}/lib/firmware/mediatek/{mt7915,mt7615,mt7986_eeprom_mt7976,mt7981}* $out
|
||||
'';
|
||||
};
|
||||
airoha-firmware = pkgs.stdenv.mkDerivation {
|
||||
@ -65,7 +66,7 @@
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
|
||||
cp ${pkgs.openwrt.linux-firmware}/lib/firmware/airoha/* $out
|
||||
cp ${pkgs.linux-firmware}/lib/firmware/airoha/* $out
|
||||
'';
|
||||
};
|
||||
in {
|
||||
@ -75,8 +76,10 @@
|
||||
];
|
||||
config = {
|
||||
kernel = {
|
||||
src = openwrt.kernelSrc;
|
||||
version = openwrt.kernelVersion;
|
||||
extraPatchPhase = ''
|
||||
${pkgs.openwrt.applyPatches.mediatek}
|
||||
${openwrt.applyPatches.mediatek}
|
||||
'';
|
||||
config = {
|
||||
NET="y"; # unlock NET_XGRESS
|
||||
@ -593,7 +596,6 @@
|
||||
|
||||
hardware =
|
||||
let
|
||||
openwrt = pkgs.openwrt;
|
||||
phy = pkgs.kmodloader.override {
|
||||
targets = [
|
||||
"air_en8811h"
|
||||
@ -658,7 +660,9 @@
|
||||
defaultOutput = "uimage";
|
||||
loadAddress = lim.parseInt "0x44000000";
|
||||
entryPoint = lim.parseInt "0x44000000";
|
||||
alignment = 2048;
|
||||
# TODO AFAICT this should be 2048, but I got 'FIT: image rootfs-1 start not aligned to page boundaries' with that...
|
||||
#alignment = 2048;
|
||||
alignment = 4096;
|
||||
rootDevice = "/dev/fit0";
|
||||
dts = {
|
||||
src = "${openwrt.src}/target/linux/mediatek/dts/mt7981b-openwrt-one.dts";
|
||||
|
@ -89,6 +89,7 @@ in {
|
||||
};
|
||||
};
|
||||
_VARS
|
||||
echo mkimage -f mkimage.its -E ${lib.optionalString (alignment != null) "-B 0x${lib.toHexString alignment}"} kernel.uimage
|
||||
mkimage -f mkimage.its -E ${lib.optionalString (alignment != null) "-B 0x${lib.toHexString alignment}"} kernel.uimage
|
||||
mkimage -l kernel.uimage
|
||||
'';
|
||||
|
@ -1,55 +1,44 @@
|
||||
{ fetchFromGitHub, pkgsBuildBuild, linux-firmware, fetchzip }:
|
||||
{ fetchFromGitHub, pkgsBuildBuild }:
|
||||
let
|
||||
src = fetchFromGitHub {
|
||||
name = "openwrt-source";
|
||||
repo = "openwrt";
|
||||
owner = "openwrt";
|
||||
# snapshot my OpenWRT One came with
|
||||
rev = "3098b4bf0725509aee13fe1560ce5a9188ea2fc7";
|
||||
hash = "sha256-we61HQ+XppOOw1AhQjNZtmN4IJDsV+dmKT/d9341jJs=";
|
||||
rev = "refs/tags/v23.05.2";
|
||||
hash = "sha256-kP+cSOB6LiOMWs7g+ji7P7ehiDYDwRdmT4R5jSzw6K4=";
|
||||
};
|
||||
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-6.6/ && cp -av ${src}/target/linux/${family}/files-6.6/* .
|
||||
test -d ${src}/target/linux/${family}/files-5.15/ && cp -av ${src}/target/linux/${family}/files-5.15/* .
|
||||
chmod -R u+w .
|
||||
patches() {
|
||||
for i in $* ; do patch --batch --forward -p1 < $i || exit 1;done
|
||||
for i in $* ; do patch --batch --forward -p1 < $i ;done
|
||||
}
|
||||
patches ${src}/target/linux/generic/backport-6.6/*.patch
|
||||
# missing from backport-6.6/752-*?
|
||||
patch -p0 < ${./mtk_rename.patch}
|
||||
patches ${src}/target/linux/generic/pending-6.6/*.patch
|
||||
patches ${src}/target/linux/generic/backport-5.15/*.patch
|
||||
patches ${src}/target/linux/generic/pending-5.15/*.patch
|
||||
# This patch breaks passing the DTB to kexeced kernel, so let's
|
||||
# get rid of it. It's not needed anyway as we pass the cmdline
|
||||
# in the dtb
|
||||
patch --batch -p1 --reverse < ${src}/target/linux/generic/pending-6.6/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch
|
||||
patches ${src}/target/linux/generic/hack-6.6/*.patch
|
||||
patches ${src}/target/linux/${family}/patches-6.6/*.patch
|
||||
patch --batch -p1 --reverse < ${src}/target/linux/generic/pending-5.15/330-MIPS-kexec-Accept-command-line-parameters-from-users.patch
|
||||
patches ${src}/target/linux/generic/hack-5.15/*.patch
|
||||
patches ${src}/target/linux/${family}/patches-5.15/*.patch
|
||||
patches ${./make-mtdsplit-jffs2-endian-agnostic.patch}
|
||||
'';
|
||||
in {
|
||||
inherit src;
|
||||
|
||||
# The kernel sources typically used with this version of openwrt
|
||||
# You can find this in `include/kernel-6.6` or similar in the
|
||||
# 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/v6.x/linux-6.6.57.tar.gz";
|
||||
hash = "sha256-LP9tktb/HX5LPZt6m7FO9k38g31tyl714kqV0j4NTmc=";
|
||||
url = "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.137.tar.gz";
|
||||
hash = "sha256-PkdzUKZ0IpBiWe/RS70J76JKnBFzRblWcKlaIFNxnHQ=";
|
||||
};
|
||||
kernelVersion = "6.6.57";
|
||||
|
||||
# From package/firmware/linux-firmware/Makefile
|
||||
linux-firmware = linux-firmware.overrideAttrs(a: {
|
||||
src = fetchzip {
|
||||
url = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/snapshot/linux-firmware-20241017.tar.gz";
|
||||
hash = "sha256-q4StJdoLCHQThFTzhxETDYlQP/ywmb3vwCr13xtrQzc=";
|
||||
};
|
||||
});
|
||||
kernelVersion = "5.15.137";
|
||||
|
||||
applyPatches.ath79 = doPatch "ath79";
|
||||
applyPatches.ramips = doPatch "ramips";
|
||||
|
@ -1,11 +0,0 @@
|
||||
--- drivers/net/wireless/mediatek/mt76/mt7915/mmio.c 2024-12-18 11:08:00.598231122 +0100
|
||||
+++ 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;
|
Loading…
Reference in New Issue
Block a user