forked from DGNum/liminix
use openwrt kernel for gl-ar750
This commit is contained in:
parent
77922c875b
commit
4b513cdb98
4 changed files with 59 additions and 46 deletions
|
@ -62,6 +62,7 @@ let
|
||||||
ln -s ${squashfs} squashfs
|
ln -s ${squashfs} squashfs
|
||||||
ln -s ${kernel.vmlinux} vmlinux
|
ln -s ${kernel.vmlinux} vmlinux
|
||||||
ln -s ${manifest} manifest
|
ln -s ${manifest} manifest
|
||||||
|
ln -s ${kernel.vmlinux.modulesupport} build
|
||||||
'' +
|
'' +
|
||||||
(if device ? boot then ''
|
(if device ? boot then ''
|
||||||
ln -s ${uimage} uimage
|
ln -s ${uimage} uimage
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
# DIY users: the serial port connections have headers preinstalled
|
# DIY users: the serial port connections have headers preinstalled
|
||||||
# and don't need soldering
|
# and don't need soldering
|
||||||
|
|
||||||
|
# Mainline linux 5.19 doesn't have device-tree support for this device
|
||||||
|
# or even for the SoC, so we use the extensive OpenWrt kernel patches
|
||||||
|
|
||||||
{
|
{
|
||||||
system = {
|
system = {
|
||||||
crossSystem = {
|
crossSystem = {
|
||||||
|
@ -28,9 +31,8 @@
|
||||||
# pkgs
|
# pkgs
|
||||||
|
|
||||||
overlay = final: prev:
|
overlay = final: prev:
|
||||||
let inherit (final) fetchFromGitHub;
|
let
|
||||||
in {
|
inherit (final) fetchFromGitHub fetchgit stdenvNoCC;
|
||||||
sources = {
|
|
||||||
openwrt = fetchFromGitHub {
|
openwrt = fetchFromGitHub {
|
||||||
name = "openwrt-source";
|
name = "openwrt-source";
|
||||||
repo = "openwrt";
|
repo = "openwrt";
|
||||||
|
@ -38,23 +40,48 @@
|
||||||
rev = "a5265497a4f6da158e95d6a450cb2cb6dc085cab";
|
rev = "a5265497a4f6da158e95d6a450cb2cb6dc085cab";
|
||||||
hash = "sha256-YYi4gkpLjbOK7bM2MGQjAyEBuXJ9JNXoz/JEmYf8xE8=";
|
hash = "sha256-YYi4gkpLjbOK7bM2MGQjAyEBuXJ9JNXoz/JEmYf8xE8=";
|
||||||
};
|
};
|
||||||
kernel = fetchFromGitHub {
|
mainline = fetchFromGitHub {
|
||||||
name = "kernel-source";
|
name = "kernel-source";
|
||||||
owner = "torvalds";
|
owner = "torvalds";
|
||||||
repo = "linux";
|
repo = "linux";
|
||||||
rev = "3d7cb6b04c3f3115719235cc6866b10326de34cd"; # v5.19
|
rev = "90c7e9b400c751dbd73885f494f421f90ca69721";
|
||||||
hash = "sha256-OVsIRScAnrPleW1vbczRAj5L/SGGht2+GnvZJClMUu4=";
|
hash = "sha256-pq6QNa0PJVeheaZkuvAPD0rLuEeKrViKk65dz+y4kqo=";
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
sources = {
|
||||||
|
inherit openwrt;
|
||||||
|
kernel = stdenvNoCC.mkDerivation {
|
||||||
|
name = "spindled-kernel-tree";
|
||||||
|
src = mainline;
|
||||||
|
phases = [
|
||||||
|
"unpackPhase" "patchPhase" "openWrtPatchPhase"
|
||||||
|
"patchScripts" "installPhase"
|
||||||
|
];
|
||||||
|
patches = [ ../../kernel/random.patch ];
|
||||||
|
patchScripts = ''
|
||||||
|
patchShebangs scripts/
|
||||||
|
'';
|
||||||
|
openWrtPatchPhase = ''
|
||||||
|
cp -av ${openwrt}/target/linux/generic/files/* .
|
||||||
|
chmod -R u+w .
|
||||||
|
cp -av ${openwrt}/target/linux/ath79/files/* .
|
||||||
|
chmod -R u+w .
|
||||||
|
for i in ${openwrt}/target/linux/ath79/patches-5.15/* ; do patch --batch --forward -p1 < $i ;done
|
||||||
|
'';
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out
|
||||||
|
cp -a . $out
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
kernel = rec {
|
kernel = rec {
|
||||||
checkedConfig = {
|
checkedConfig = {
|
||||||
"MIPS_ELF_APPENDED_DTB" = "y";
|
"MIPS_ELF_APPENDED_DTB" = "y";
|
||||||
OF = "y";
|
OF = "y";
|
||||||
USE_OF = "y";
|
USE_OF = "y";
|
||||||
ATH79 = "y";
|
ATH79 = "y";
|
||||||
SOC_QCA955X = "y"; # actually QCA9531, is this even right?
|
# SOC_QCA955X = "y"; # actually QCA9531, is this even right?
|
||||||
LIMINIX = "y";
|
LIMINIX = "y";
|
||||||
SERIAL_8250_CONSOLE = "y";
|
SERIAL_8250_CONSOLE = "y";
|
||||||
SERIAL_8250 = "y";
|
SERIAL_8250 = "y";
|
||||||
|
@ -76,6 +103,15 @@
|
||||||
# filesystem is mounted and it expects /dev/console to
|
# filesystem is mounted and it expects /dev/console to
|
||||||
# be present already
|
# be present already
|
||||||
BLK_DEV_INITRD = "n";
|
BLK_DEV_INITRD = "n";
|
||||||
|
|
||||||
|
NET = "y";
|
||||||
|
NETDEVICES = "y";
|
||||||
|
ETHERNET = "y";
|
||||||
|
NET_VENDOR_ATHEROS = "y";
|
||||||
|
AG71XX = "y"; # ethernet (qca,qca9530-eth)
|
||||||
|
|
||||||
|
MFD_SYSCON = "y"; # ethernet (compatible "syscon")
|
||||||
|
|
||||||
};
|
};
|
||||||
config = {
|
config = {
|
||||||
CPU_LITTLE_ENDIAN= "n";
|
CPU_LITTLE_ENDIAN= "n";
|
||||||
|
|
|
@ -1,44 +1,19 @@
|
||||||
{
|
{
|
||||||
callPackage
|
callPackage
|
||||||
, buildPackages
|
|
||||||
, stdenvNoCC
|
|
||||||
, fetchFromGitHub
|
|
||||||
|
|
||||||
, config
|
, config
|
||||||
, checkedConfig
|
, checkedConfig
|
||||||
, sources
|
, sources
|
||||||
}:
|
}:
|
||||||
let
|
{
|
||||||
# The kernel is huge and takes a long time just to
|
|
||||||
# download and unpack. This derivation creates
|
|
||||||
# a source tree in a suitable shape to build from -
|
|
||||||
# today it just patches some scripts but as we add
|
|
||||||
# support for boards/SoCs we expect the scope of
|
|
||||||
# "pre-treatment" to grow
|
|
||||||
|
|
||||||
tree = stdenvNoCC.mkDerivation {
|
|
||||||
name = "spindled-kernel-tree";
|
|
||||||
src = sources.kernel;
|
|
||||||
phases = [ "unpackPhase" "patchPhase" "patchScripts" "installPhase" ];
|
|
||||||
patches = [ ./random.patch ];
|
|
||||||
patchScripts = ''
|
|
||||||
patchShebangs scripts/
|
|
||||||
'';
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out
|
|
||||||
cp -a . $out
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
in rec {
|
|
||||||
vmlinux = callPackage ./vmlinux.nix {
|
vmlinux = callPackage ./vmlinux.nix {
|
||||||
inherit tree config checkedConfig;
|
tree = sources.kernel;
|
||||||
|
inherit config checkedConfig;
|
||||||
};
|
};
|
||||||
|
|
||||||
uimage = callPackage ./uimage.nix { };
|
uimage = callPackage ./uimage.nix { };
|
||||||
|
|
||||||
dtb = callPackage ./dtb.nix {
|
dtb = callPackage ./dtb.nix {
|
||||||
openwrt = sources.openwrt;
|
inherit (sources) openwrt kernel;
|
||||||
kernel = tree;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,8 +92,9 @@ stdenv.mkDerivation rec {
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
${CROSS_COMPILE}strip -d vmlinux
|
${CROSS_COMPILE}strip -d vmlinux
|
||||||
cp vmlinux $out
|
cp vmlinux $out
|
||||||
make clean
|
|
||||||
mkdir -p $modulesupport
|
mkdir -p $modulesupport
|
||||||
|
cp .config $modulesupport/config
|
||||||
|
make clean
|
||||||
cp -a . $modulesupport
|
cp -a . $modulesupport
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue