2023-11-12 18:15:58 +01:00
|
|
|
{
|
2022-09-20 00:51:38 +02:00
|
|
|
system = {
|
|
|
|
crossSystem = {
|
|
|
|
config = "mips-unknown-linux-musl";
|
|
|
|
gcc = {
|
|
|
|
abi = "32";
|
2023-06-20 21:11:25 +02:00
|
|
|
arch = "24kc"; # maybe mips_24kc-
|
2022-09-20 00:51:38 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2022-10-15 19:55:33 +02:00
|
|
|
|
2023-02-19 17:43:45 +01:00
|
|
|
description = ''
|
2023-09-29 00:19:32 +02:00
|
|
|
GL.iNet GL-AR750
|
2023-09-28 13:17:30 +02:00
|
|
|
****************
|
|
|
|
|
2023-11-12 18:15:58 +01:00
|
|
|
Hardware summary
|
|
|
|
================
|
|
|
|
|
2023-09-28 13:17:30 +02:00
|
|
|
The GL-AR750 "Creta" travel router features:
|
|
|
|
|
2023-02-19 17:43:45 +01:00
|
|
|
- QCA9531 @650Mhz SoC
|
|
|
|
- dual band wireless: IEEE 802.11a/b/g/n/ac
|
|
|
|
- two 10/100Mbps LAN ports and one WAN
|
2023-09-28 13:17:30 +02:00
|
|
|
- 128MB DDR2 RAM
|
|
|
|
- 16MB NOR Flash
|
|
|
|
- supported in OpenWrt by the "ath79" SoC family
|
|
|
|
|
2023-02-19 17:43:45 +01:00
|
|
|
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
|
2023-11-12 18:15:58 +01:00
|
|
|
host via `AHB <https://en.wikipedia.org/wiki/Advanced_Microcontroller_Bus_Architecture>`_ and it is
|
|
|
|
supported in Linux using the ath9k driver. 5GHz wifi
|
|
|
|
is provided by a QCA9887 PCIe (PCI embedded) WLAN chip,
|
2023-02-19 17:43:45 +01:00
|
|
|
supported by the ath10k driver.
|
2023-09-28 13:17:30 +02:00
|
|
|
|
2023-11-12 18:15:58 +01:00
|
|
|
Installation
|
|
|
|
============
|
|
|
|
|
|
|
|
As with many GL.iNet devices, the stock vendor firmware
|
|
|
|
is a fork of OpenWrt, meaning that the binary created by
|
2023-12-11 20:02:30 +01:00
|
|
|
:ref:`system-outputs-mtdimage` can be flashed using the
|
2023-11-12 18:15:58 +01:00
|
|
|
vendor web UI or the U-Boot emergency "unbrick" routine.
|
|
|
|
|
|
|
|
For flashing from an existing Liminix system (we believe that) it
|
|
|
|
is necessary to first boot into a :ref:`system-outputs-kexecboot`
|
|
|
|
system, otherwise you'll be overwriting flash partitions while
|
|
|
|
they're in use - and that might not end well.
|
|
|
|
|
2023-09-28 13:17:30 +02:00
|
|
|
Vendor web page: https://www.gl-inet.com/products/gl-ar750/
|
|
|
|
|
|
|
|
OpenWrt web page: https://openwrt.org/toh/gl.inet/gl-ar750
|
|
|
|
|
2023-02-19 17:43:45 +01:00
|
|
|
'';
|
|
|
|
|
2023-11-12 19:25:38 +01:00
|
|
|
module = {pkgs, config, lim, ... }:
|
2022-10-16 16:15:18 +02:00
|
|
|
let
|
2023-03-18 20:17:58 +01:00
|
|
|
openwrt = pkgs.openwrt;
|
2023-02-22 20:17:47 +01:00
|
|
|
firmwareBlobs = pkgs.pkgsBuildBuild.fetchFromGitHub {
|
|
|
|
owner = "kvalo";
|
|
|
|
repo = "ath10k-firmware";
|
|
|
|
rev = "5d63529ffc6e24974bc7c45b28fd1c34573126eb";
|
|
|
|
sha256 = "1bwpifrwl5mvsmbmc81k8l22hmkwk05v7xs8dxag7fgv2kd6lv2r";
|
|
|
|
};
|
|
|
|
firmware = pkgs.stdenv.mkDerivation {
|
2023-03-01 22:08:47 +01:00
|
|
|
name = "wlan-firmware";
|
2023-02-22 20:17:47 +01:00
|
|
|
phases = ["installPhase"];
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/ath10k/QCA9887/hw1.0/
|
|
|
|
blobdir=${firmwareBlobs}/QCA9887/hw1.0
|
|
|
|
cp $blobdir/10.2.4-1.0/firmware-5.bin_10.2.4-1.0-00047 $out/ath10k/QCA9887/hw1.0/firmware-5.bin
|
|
|
|
cp $blobdir/board.bin $out/ath10k/QCA9887/hw1.0/
|
|
|
|
'';
|
|
|
|
};
|
2023-03-01 23:24:58 +01:00
|
|
|
mac80211 = pkgs.mac80211.override {
|
|
|
|
drivers = ["ath9k" "ath10k_pci"];
|
2023-07-13 20:24:59 +02:00
|
|
|
klibBuild = config.system.outputs.kernel.modulesupport;
|
2023-03-01 23:24:58 +01:00
|
|
|
};
|
2023-03-01 22:08:47 +01:00
|
|
|
ath10k_cal_data =
|
|
|
|
let
|
2023-11-12 19:25:38 +01:00
|
|
|
offset = lim.parseInt "0x5000";
|
|
|
|
size = lim.parseInt "0x844";
|
2023-03-01 22:08:47 +01:00
|
|
|
in pkgs.liminix.services.oneshot rec {
|
|
|
|
name = "ath10k_cal_data";
|
|
|
|
up = ''
|
|
|
|
part=$(basename $(dirname $(grep -l art /sys/class/mtd/*/name)))
|
|
|
|
echo ART partition is ''${part-unset}
|
|
|
|
test -n "$part" || exit 1
|
2023-03-04 00:06:18 +01:00
|
|
|
(in_outputs ${name}
|
2023-03-01 22:08:47 +01:00
|
|
|
dd if=/dev/$part of=data iflag=skip_bytes,fullblock bs=${toString size} skip=${toString offset} count=1
|
|
|
|
)
|
|
|
|
'';
|
|
|
|
};
|
2023-02-22 20:17:47 +01:00
|
|
|
inherit (pkgs.pseudofile) dir symlink;
|
2023-03-01 23:24:58 +01:00
|
|
|
inherit (pkgs.liminix.networking) interface;
|
2022-10-15 19:55:33 +02:00
|
|
|
in {
|
2023-09-20 18:27:04 +02:00
|
|
|
imports = [
|
|
|
|
../../modules/network
|
|
|
|
../../modules/arch/mipseb.nix
|
2023-12-10 17:38:53 +01:00
|
|
|
../../modules/outputs/tftpboot.nix
|
2023-12-11 20:02:30 +01:00
|
|
|
../../modules/outputs/mtdimage.nix
|
2023-12-10 17:38:53 +01:00
|
|
|
../../modules/outputs/jffs2.nix
|
2023-09-20 18:27:04 +02:00
|
|
|
];
|
2023-08-28 00:45:27 +02:00
|
|
|
|
2023-05-30 19:20:42 +02:00
|
|
|
programs.busybox.options = {
|
|
|
|
FEATURE_DD_IBS_OBS = "y"; # ath10k_cal_data needs skip_bytes,fullblock
|
|
|
|
};
|
2023-03-03 23:52:33 +01:00
|
|
|
hardware = {
|
2023-12-11 20:02:30 +01:00
|
|
|
defaultOutput = "mtdimage";
|
2023-11-12 19:47:31 +01:00
|
|
|
loadAddress = lim.parseInt "0x80060000";
|
2023-11-12 19:50:47 +01:00
|
|
|
entryPoint = lim.parseInt "0x80060000";
|
2023-03-03 00:01:26 +01:00
|
|
|
flash = {
|
2023-11-12 21:39:06 +01:00
|
|
|
address = lim.parseInt "0x9F060000";
|
|
|
|
size = lim.parseInt "0xfa0000";
|
|
|
|
eraseBlockSize = 65536;
|
2023-03-03 00:01:26 +01:00
|
|
|
};
|
2023-04-26 23:16:15 +02:00
|
|
|
rootDevice = "/dev/mtdblock5";
|
2023-03-03 23:52:33 +01:00
|
|
|
dts = {
|
2023-03-18 20:17:58 +01:00
|
|
|
src = "${openwrt.src}/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts";
|
2023-03-03 23:52:33 +01:00
|
|
|
includes = [
|
2023-03-18 20:17:58 +01:00
|
|
|
"${openwrt.src}/target/linux/ath79/dts"
|
2023-03-03 23:52:33 +01:00
|
|
|
];
|
|
|
|
};
|
2023-03-03 00:01:26 +01:00
|
|
|
|
2023-08-28 00:45:27 +02:00
|
|
|
networkInterfaces =
|
|
|
|
let inherit (config.system.service.network) link;
|
|
|
|
in {
|
|
|
|
lan = link.build { ifname = "eth0"; };
|
|
|
|
wan = link.build { ifname = "eth1"; };
|
2023-10-07 23:23:44 +02:00
|
|
|
wlan = link.build {
|
2023-08-28 00:45:27 +02:00
|
|
|
ifname = "wlan0";
|
|
|
|
dependencies = [ mac80211 ];
|
|
|
|
};
|
2023-10-07 23:23:44 +02:00
|
|
|
wlan5 = link.build {
|
2023-08-28 00:45:27 +02:00
|
|
|
ifname = "wlan1";
|
|
|
|
dependencies = [ mac80211 ath10k_cal_data ];
|
|
|
|
};
|
2023-03-01 23:24:58 +01:00
|
|
|
};
|
2023-02-10 18:54:33 +01:00
|
|
|
};
|
2023-03-01 22:08:47 +01:00
|
|
|
filesystem = dir {
|
|
|
|
lib = dir {
|
|
|
|
firmware = dir {
|
|
|
|
ath10k = dir {
|
|
|
|
QCA9887 = symlink "${firmware}/ath10k/QCA9887";
|
|
|
|
"cal-pci-0000:00:00.0.bin" = symlink "${ath10k_cal_data}/.outputs/data";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-02-11 14:10:38 +01:00
|
|
|
boot.tftp = {
|
2023-11-12 19:37:33 +01:00
|
|
|
loadAddress = lim.parseInt "0x00A00000";
|
2023-02-11 14:10:38 +01:00
|
|
|
};
|
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
|
|
|
};
|
2023-11-12 18:15:58 +01: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-10-19 18:34:22 +02:00
|
|
|
extraPatchPhase = ''
|
2023-03-18 20:17:58 +01:00
|
|
|
${openwrt.applyPatches.ath79}
|
2022-10-19 18:34:22 +02:00
|
|
|
'';
|
2023-11-12 18:15:58 +01:00
|
|
|
|
2023-02-10 18:54:33 +01:00
|
|
|
config = {
|
|
|
|
ATH79 = "y";
|
2023-02-22 20:17:47 +01:00
|
|
|
PCI = "y";
|
2023-03-01 22:08:47 +01:00
|
|
|
PCI_AR724X = "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
|
|
|
NET = "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";
|
2023-04-10 21:39:26 +02:00
|
|
|
|
2023-02-19 19:10:43 +01:00
|
|
|
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";
|
2023-04-10 21:39:26 +02:00
|
|
|
|
2023-03-17 12:42:01 +01:00
|
|
|
GPIO_ATH79 = "y";
|
|
|
|
GPIOLIB = "y";
|
|
|
|
EXPERT="y";
|
|
|
|
GPIO_SYSFS = "y"; # required by patches-5.15/0004-phy-add-ath79-usb-phys.patch
|
|
|
|
OF_GPIO = "y";
|
|
|
|
SYSFS = "y";
|
2023-02-19 19:10:43 +01:00
|
|
|
SPI = "y";
|
2023-02-10 18:54:33 +01:00
|
|
|
MTD = "y";
|
|
|
|
MTD_BLOCK = "y"; # fix undefined ref to register_mtd_blktrans_devs
|
2023-03-23 13:48:10 +01:00
|
|
|
|
|
|
|
WATCHDOG = "y";
|
|
|
|
ATH79_WDT = "y"; # watchdog timer
|
|
|
|
|
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-22 19:28:48 +01:00
|
|
|
EARLY_PRINTK = "y";
|
2022-10-05 22:58:39 +02:00
|
|
|
|
2023-02-22 19:28:48 +01:00
|
|
|
PRINTK_TIME = "y";
|
2023-02-10 18:54:33 +01:00
|
|
|
};
|
|
|
|
};
|
2022-10-03 23:28:15 +02:00
|
|
|
};
|
2022-09-20 00:51:38 +02:00
|
|
|
}
|