liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

2410.nix (2439B)


      1 {
      2   fetchFromGitHub,
      3   pkgsBuildBuild,
      4   lib,
      5 }:
      6 let
      7   src = fetchFromGitHub {
      8     name = "openwrt-source";
      9     repo = "openwrt";
     10     owner = "openwrt";
     11     rev = "refs/tags/v24.10.0-rc4";
     12     hash = "sha256-7edkUCTfGnZeMWr/aXoQrP4I47iXhMi/gUxO2SR+Ylc=";
     13   };
     14   kernelVersion = "6.6.67";
     15   kernelSeries = lib.versions.majorMinor kernelVersion;
     16   doPatch = family: ''
     17     cp -av ${src}/target/linux/generic/files/* .
     18     chmod -R u+w .
     19     cp -av ${src}/target/linux/${family}/files/* .
     20     chmod -R u+w .
     21     test -d ${src}/target/linux/${family}/files-${kernelSeries}/ && cp -av ${src}/target/linux/${family}/files-${kernelSeries}/* .
     22     chmod -R u+w .
     23     patches() {
     24       for i in $* ; do patch --batch --forward -p1 < $i ;done
     25     }
     26     patches ${src}/target/linux/generic/backport-${kernelSeries}/*.patch
     27     patches ${src}/target/linux/generic/pending-${kernelSeries}/*.patch
     28     patches ${src}/target/linux/generic/hack-${kernelSeries}/*.patch
     29     patches ${src}/target/linux/${family}/patches-${kernelSeries}/*.patch
     30     patches \
     31       ${./make-mtdsplit-jffs2-endian-agnostic.patch} \
     32       ${./fix-mtk-wed-bm-desc-ptr.patch} 
     33   '';
     34 in
     35 {
     36   inherit src;
     37 
     38   # The kernel sources typically used with this version of openwrt
     39   # You can find this in `include/kernel-5.15` or similar in the
     40   # openwrt sources
     41   kernelSrc = pkgsBuildBuild.fetchurl {
     42     name = "linux.tar.gz";
     43     url = "https://cdn.kernel.org/pub/linux/kernel/v${lib.versions.major kernelVersion}.x/linux-${kernelVersion}.tar.gz";
     44     hash = "sha256-Vj6O6oa83xzAF3FPl6asQK2Zrl7PaBCVjcUDq93caL4=";
     45   };
     46   inherit kernelVersion;
     47 
     48   applyPatches.ath79 = doPatch "ath79";
     49   applyPatches.ramips = doPatch "ramips";
     50   applyPatches.mediatek = doPatch "mediatek"; # aarch64
     51   applyPatches.mvebu = doPatch "mvebu"; # arm
     52 
     53   applyPatches.rt2x00 = ''
     54     PATH=${pkgsBuildBuild.patchutils}/bin:$PATH
     55     for i in ${src}/package/kernel/mac80211/patches/rt2x00/6*.patch ; do
     56       fixed=$(basename $i).fixed
     57       sed '/depends on m/d'  < $i | sed 's/CPTCFG_/CONFIG_/g' | recountdiff | filterdiff -x '*/local-symbols' > $fixed
     58       case $fixed in
     59         606-*)
     60           ;;
     61         611-*)
     62           filterdiff -x '*/rt2x00.h' < $fixed | patch --forward -p1
     63           ;;
     64         601-*|607-*)
     65           filterdiff -x '*/rt2x00_platform.h' < $fixed | patch --forward -p1
     66           ;;
     67         *)
     68           cat $fixed | patch --forward -p1
     69           ;;
     70       esac
     71     done
     72   '';
     73 }