forked from DGNum/liminix
convert devices from overlay to module
this makes it possible for devices to stash things in `config` (e.g. pathname to DTS) that can later be overwritten (even by the end user)
This commit is contained in:
parent
6be459b9ac
commit
8cead61740
8 changed files with 263 additions and 278 deletions
|
@ -11,15 +11,9 @@
|
|||
};
|
||||
};
|
||||
|
||||
# We need to be able to import default.nix before we import nixpkgs
|
||||
# because it has the system config to tell nixpkgs what arch to build for.
|
||||
# But we also need some way to do things like fetchFromGitHub in the
|
||||
# per-device config and we can only do that once we have a reference to
|
||||
# pkgs
|
||||
|
||||
overlay = final: prev:
|
||||
module = { pkgs, ...}:
|
||||
let
|
||||
openwrt = final.fetchFromGitHub {
|
||||
openwrt = pkgs.fetchFromGitHub {
|
||||
name = "openwrt-source";
|
||||
repo = "openwrt";
|
||||
owner = "openwrt";
|
||||
|
@ -27,8 +21,16 @@
|
|||
hash = "sha256-YYi4gkpLjbOK7bM2MGQjAyEBuXJ9JNXoz/JEmYf8xE8=";
|
||||
};
|
||||
in {
|
||||
kernel = prev.kernel.override {
|
||||
src = final.fetchurl {
|
||||
device = {
|
||||
defaultOutput = "directory";
|
||||
boot = {
|
||||
loadAddress = "0x80000000";
|
||||
entryPoint = "0x80000000";
|
||||
};
|
||||
};
|
||||
|
||||
kernel = {
|
||||
src = pkgs.fetchurl {
|
||||
name = "linux.tar.gz";
|
||||
url = "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.71.tar.gz";
|
||||
hash = "sha256-yhO2cXIeIgUxkSZf/4aAsF11uxyh+UUZu6D1h92vCD8=";
|
||||
|
@ -46,80 +48,73 @@
|
|||
patches ${openwrt}/target/linux/generic/hack-5.15/*.patch
|
||||
patches ${openwrt}/target/linux/ramips/patches-5.15/*.patch
|
||||
'';
|
||||
dts = "${openwrt}/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts";
|
||||
config = {
|
||||
MIPS_ELF_APPENDED_DTB = "y";
|
||||
OF = "y";
|
||||
USE_OF = "y";
|
||||
|
||||
RALINK = "y";
|
||||
SOC_MT7620 = "y";
|
||||
CPU_LITTLE_ENDIAN= "y";
|
||||
|
||||
SERIAL_8250_CONSOLE = "y";
|
||||
SERIAL_8250 = "y";
|
||||
SERIAL_CORE_CONSOLE = "y";
|
||||
SERIAL_OF_PLATFORM = "y";
|
||||
|
||||
CONSOLE_LOGLEVEL_DEFAULT = "8";
|
||||
CONSOLE_LOGLEVEL_QUIET = "4";
|
||||
|
||||
# "empty" initramfs source should create an initial
|
||||
# filesystem that has a /dev/console node and not much
|
||||
# else. Note that pid 1 is started *before* the root
|
||||
# filesystem is mounted and it expects /dev/console to
|
||||
# be present already
|
||||
BLK_DEV_INITRD = "n";
|
||||
|
||||
MTD = "y";
|
||||
MTD_CMDLINE_PARTS = "y";
|
||||
MTD_BLOCK = "y"; # fix undefined ref to register_mtd_blktrans_dev
|
||||
|
||||
REGULATOR = "y";
|
||||
REGULATOR_FIXED_VOLTAGE = "y";
|
||||
|
||||
NET = "y";
|
||||
NETDEVICES = "y";
|
||||
ETHERNET = "y";
|
||||
|
||||
PHYLIB = "y";
|
||||
AT803X_PHY="y";
|
||||
FIXED_PHY="y";
|
||||
GENERIC_PHY="y";
|
||||
NET_VENDOR_RALINK = "y";
|
||||
NET_RALINK_RT3050 = "y";
|
||||
NET_RALINK_SOC="y";
|
||||
|
||||
SWCONFIG = "y";
|
||||
|
||||
GPIOLIB="y";
|
||||
GPIO_MT7621 = "y";
|
||||
|
||||
# this is all copied from nixwrt ath79 config. Clearly not all
|
||||
# of it is device config, some of it is wifi config or
|
||||
# installation method config or ...
|
||||
|
||||
"CMDLINE_PARTITION" = "y";
|
||||
"EARLY_PRINTK" = "y";
|
||||
"FW_LOADER" = "y";
|
||||
# we don't have a user helper, so we get multiple 60s pauses
|
||||
# at boot time unless we disable trying to call it
|
||||
"FW_LOADER_USER_HELPER" = "n";
|
||||
|
||||
"MODULE_SIG" = "y";
|
||||
|
||||
"PARTITION_ADVANCED" = "y";
|
||||
"PRINTK_TIME" = "y";
|
||||
"SQUASHFS" = "y";
|
||||
"SQUASHFS_XZ" = "y";
|
||||
};
|
||||
};
|
||||
};
|
||||
kernel = rec {
|
||||
dts = { openwrt,... } : "${openwrt}/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts";
|
||||
config = {
|
||||
MIPS_ELF_APPENDED_DTB = "y";
|
||||
OF = "y";
|
||||
USE_OF = "y";
|
||||
|
||||
RALINK = "y";
|
||||
SOC_MT7620 = "y";
|
||||
CPU_LITTLE_ENDIAN= "y";
|
||||
|
||||
SERIAL_8250_CONSOLE = "y";
|
||||
SERIAL_8250 = "y";
|
||||
SERIAL_CORE_CONSOLE = "y";
|
||||
SERIAL_OF_PLATFORM = "y";
|
||||
|
||||
CONSOLE_LOGLEVEL_DEFAULT = "8";
|
||||
CONSOLE_LOGLEVEL_QUIET = "4";
|
||||
|
||||
# "empty" initramfs source should create an initial
|
||||
# filesystem that has a /dev/console node and not much
|
||||
# else. Note that pid 1 is started *before* the root
|
||||
# filesystem is mounted and it expects /dev/console to
|
||||
# be present already
|
||||
BLK_DEV_INITRD = "n";
|
||||
|
||||
MTD = "y";
|
||||
MTD_CMDLINE_PARTS = "y";
|
||||
MTD_BLOCK = "y"; # fix undefined ref to register_mtd_blktrans_dev
|
||||
|
||||
REGULATOR = "y";
|
||||
REGULATOR_FIXED_VOLTAGE = "y";
|
||||
|
||||
NET = "y";
|
||||
NETDEVICES = "y";
|
||||
ETHERNET = "y";
|
||||
|
||||
PHYLIB = "y";
|
||||
AT803X_PHY="y";
|
||||
FIXED_PHY="y";
|
||||
GENERIC_PHY="y";
|
||||
NET_VENDOR_RALINK = "y";
|
||||
NET_RALINK_RT3050 = "y";
|
||||
NET_RALINK_SOC="y";
|
||||
|
||||
SWCONFIG = "y";
|
||||
|
||||
GPIOLIB="y";
|
||||
GPIO_MT7621 = "y";
|
||||
|
||||
# this is all copied from nixwrt ath79 config. Clearly not all
|
||||
# of it is device config, some of it is wifi config or
|
||||
# installation method config or ...
|
||||
|
||||
"CMDLINE_PARTITION" = "y";
|
||||
"EARLY_PRINTK" = "y";
|
||||
"FW_LOADER" = "y";
|
||||
# we don't have a user helper, so we get multiple 60s pauses
|
||||
# at boot time unless we disable trying to call it
|
||||
"FW_LOADER_USER_HELPER" = "n";
|
||||
|
||||
"MODULE_SIG" = "y";
|
||||
|
||||
"PARTITION_ADVANCED" = "y";
|
||||
"PRINTK_TIME" = "y";
|
||||
"SQUASHFS" = "y";
|
||||
"SQUASHFS_XZ" = "y";
|
||||
};
|
||||
};
|
||||
outputs.default = "directory";
|
||||
boot = {
|
||||
loadAddress = "0x80000000";
|
||||
entryPoint = "0x80000000";
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue