2022-10-03 23:28:15 +02:00
|
|
|
|
|
|
|
# I like GL.iNet devices because they're relatively accessible to
|
|
|
|
# DIY users: the serial port connections have headers preinstalled
|
|
|
|
# and don't need soldering
|
|
|
|
|
2022-10-16 16:15:18 +02:00
|
|
|
# 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
|
|
|
|
|
2022-09-20 00:51:38 +02:00
|
|
|
{
|
|
|
|
system = {
|
|
|
|
crossSystem = {
|
|
|
|
config = "mips-unknown-linux-musl";
|
|
|
|
gcc = {
|
|
|
|
abi = "32";
|
|
|
|
arch = "mips32"; # maybe mips_24kc-
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2022-10-15 19:55:33 +02:00
|
|
|
|
2023-02-19 17:43:45 +01:00
|
|
|
description = ''
|
|
|
|
GL.INet GL-AR750 "Creta" travel router
|
|
|
|
- QCA9531 @650Mhz SoC
|
|
|
|
- dual band wireless: IEEE 802.11a/b/g/n/ac
|
|
|
|
- two 10/100Mbps LAN ports and one WAN
|
|
|
|
- 128MB DDR2 RAM / 16MB NOR Flash
|
|
|
|
- "ath79" soc family
|
|
|
|
https://www.gl-inet.com/products/gl-ar750/
|
|
|
|
|
|
|
|
The GL-AR750 has two distinct sets of wifi hardware. The 2.4GHz
|
|
|
|
radio is part of the QCA9531 SoC, i.e. it's on the same silicon as
|
|
|
|
the CPU, the Ethernet, the USB etc. The device is connected to the
|
|
|
|
host via AHB, the "Advanced High-Performance Bus" and it is
|
|
|
|
supported in Linux using the ath9k driver. The 5GHz support, on the
|
|
|
|
other hand, is provided by a QCA9887 PCIe (PCI embedded) WLAN chip:
|
|
|
|
I haven't looked closely at the router innards to see if this is
|
|
|
|
actually physically a separate board that could be unplugged, but
|
|
|
|
as far as the Linux is concerned it behaves as one. This is
|
|
|
|
supported by the ath10k driver.
|
|
|
|
'';
|
|
|
|
|
2023-02-10 18:54:33 +01:00
|
|
|
module = {pkgs, ... }:
|
2022-10-16 16:15:18 +02:00
|
|
|
let
|
2023-02-10 18:54:33 +01:00
|
|
|
openwrt = pkgs.pkgsBuildBuild.fetchFromGitHub {
|
2022-10-16 16:15:18 +02:00
|
|
|
name = "openwrt-source";
|
|
|
|
repo = "openwrt";
|
|
|
|
owner = "openwrt";
|
|
|
|
rev = "a5265497a4f6da158e95d6a450cb2cb6dc085cab";
|
|
|
|
hash = "sha256-YYi4gkpLjbOK7bM2MGQjAyEBuXJ9JNXoz/JEmYf8xE8=";
|
|
|
|
};
|
2022-10-15 19:55:33 +02:00
|
|
|
in {
|
2023-02-10 19:20:01 +01:00
|
|
|
device = {
|
2023-02-11 14:10:38 +01:00
|
|
|
defaultOutput = "tftproot";
|
2023-02-10 18:54:33 +01:00
|
|
|
loadAddress = "0x80060000";
|
|
|
|
entryPoint = "0x80060000";
|
|
|
|
};
|
2023-02-11 14:10:38 +01:00
|
|
|
boot.tftp = {
|
|
|
|
loadAddress = "0x00A00000";
|
|
|
|
};
|
2023-02-18 16:13:19 +01:00
|
|
|
boot.dts = {
|
|
|
|
src = "${openwrt}/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts";
|
|
|
|
includes = [
|
|
|
|
"${openwrt}/target/linux/ath79/dts"
|
|
|
|
];
|
|
|
|
};
|
2023-02-10 18:54:33 +01:00
|
|
|
kernel = {
|
|
|
|
src = pkgs.pkgsBuildBuild.fetchurl {
|
2022-10-19 18:34:22 +02:00
|
|
|
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=";
|
2022-10-15 19:55:33 +02:00
|
|
|
};
|
2022-10-19 18:34:22 +02:00
|
|
|
extraPatchPhase = ''
|
|
|
|
cp -av ${openwrt}/target/linux/generic/files/* .
|
|
|
|
chmod -R u+w .
|
|
|
|
cp -av ${openwrt}/target/linux/ath79/files/* .
|
|
|
|
chmod -R u+w .
|
|
|
|
patches() {
|
|
|
|
for i in $* ; do patch --batch --forward -p1 < $i ;done
|
|
|
|
}
|
|
|
|
patches ${openwrt}/target/linux/generic/backport-5.15/*.patch
|
|
|
|
patches ${openwrt}/target/linux/generic/pending-5.15/*.patch
|
|
|
|
patches ${openwrt}/target/linux/generic/hack-5.15/*.patch
|
|
|
|
patches ${openwrt}/target/linux/ath79/patches-5.15/*.patch
|
|
|
|
'';
|
2023-02-10 18:54:33 +01:00
|
|
|
config = {
|
|
|
|
MIPS_ELF_APPENDED_DTB = "y";
|
|
|
|
OF = "y";
|
|
|
|
USE_OF = "y";
|
|
|
|
ATH79 = "y";
|
2022-10-16 16:31:10 +02:00
|
|
|
|
2023-02-10 18:54:33 +01:00
|
|
|
SERIAL_8250_CONSOLE = "y";
|
|
|
|
SERIAL_8250 = "y";
|
|
|
|
SERIAL_CORE_CONSOLE = "y";
|
2022-10-08 00:24:36 +02:00
|
|
|
|
2023-02-10 18:54:33 +01:00
|
|
|
# need this to open console device at boot. dmesg goes from
|
|
|
|
# [ 0.272934] Warning: unable to open an initial console.
|
|
|
|
# to
|
|
|
|
# [ 0.247413] printk: console [ttyS0] disabled
|
|
|
|
# [ 0.25200] 18020000.uart: ttyS0 at MMIO 0x1802000 (irq = 10, base_baud = 1562500) is a 16550A
|
|
|
|
SERIAL_OF_PLATFORM = "y";
|
2022-10-08 00:24:36 +02:00
|
|
|
|
2023-02-10 18:54:33 +01:00
|
|
|
CONSOLE_LOGLEVEL_DEFAULT = "8";
|
|
|
|
CONSOLE_LOGLEVEL_QUIET = "4";
|
2022-10-07 01:26:32 +02:00
|
|
|
|
2023-02-10 18:54:33 +01:00
|
|
|
# "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";
|
2022-10-16 16:15:18 +02:00
|
|
|
|
2023-02-10 18:54:33 +01:00
|
|
|
NET = "y";
|
|
|
|
NETDEVICES = "y";
|
|
|
|
ETHERNET = "y";
|
|
|
|
NET_VENDOR_ATHEROS = "y";
|
|
|
|
AG71XX = "y"; # ethernet (qca,qca9530-eth)
|
|
|
|
MFD_SYSCON = "y"; # ethernet (compatible "syscon")
|
|
|
|
AR8216_PHY = "y"; # eth1 is behind a switch
|
2022-10-19 18:34:22 +02:00
|
|
|
|
2023-02-19 19:10:43 +01:00
|
|
|
MTD_SPI_NOR = "y";
|
|
|
|
SPI_ATH79 = "y"; # these are copied from OpenWrt.
|
|
|
|
SPI_MASTER= "y"; # At least one of them is necessary
|
|
|
|
SPI_MEM= "y";
|
|
|
|
SPI_AR934X= "y";
|
|
|
|
SPI_BITBANG= "y";
|
|
|
|
SPI_GPIO= "y";
|
|
|
|
|
|
|
|
SPI = "y";
|
2023-02-10 18:54:33 +01:00
|
|
|
MTD = "y";
|
|
|
|
MTD_CMDLINE_PARTS = "y";
|
|
|
|
MTD_BLOCK = "y"; # fix undefined ref to register_mtd_blktrans_devs
|
|
|
|
CPU_BIG_ENDIAN= "y";
|
2022-10-05 22:58:39 +02:00
|
|
|
|
2023-02-10 18:54:33 +01:00
|
|
|
# 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 ...
|
2022-10-05 22:58:39 +02:00
|
|
|
|
2023-02-10 18:54:33 +01:00
|
|
|
"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";
|
2022-10-05 22:58:39 +02:00
|
|
|
|
2023-02-10 18:54:33 +01:00
|
|
|
"MODULE_SIG" = "y";
|
2022-10-19 18:34:22 +02:00
|
|
|
|
2023-02-10 18:54:33 +01:00
|
|
|
"PARTITION_ADVANCED" = "y";
|
|
|
|
"PRINTK_TIME" = "y";
|
|
|
|
"SQUASHFS" = "y";
|
|
|
|
"SQUASHFS_XZ" = "y";
|
|
|
|
};
|
|
|
|
};
|
2022-10-03 23:28:15 +02:00
|
|
|
};
|
2022-09-20 00:51:38 +02:00
|
|
|
}
|