add wifi firmware, move things around in ram

* at the base address we were using, the filesystem was getting
corrupted presumably because the kernel unpacked into it

* leave a little more space between compressed kernel and
squashfs. this is probably ineffective but also harmless
module-based-network
Daniel Barlow 2023-03-10 00:48:47 +00:00
parent f50b0627a2
commit d83bcc643e
2 changed files with 17 additions and 2 deletions

View File

@ -15,6 +15,8 @@
let
inherit (pkgs.liminix.networking) interface;
inherit (pkgs.liminix.services) oneshot;
inherit (pkgs.pseudofile) dir symlink;
openwrt = pkgs.fetchFromGitHub {
name = "openwrt-source";
repo = "openwrt";
@ -26,7 +28,18 @@
drivers = ["mt7603e"];
klibBuild = config.outputs.kernel.modulesupport;
};
wlan_firmware = builtins.fetchurl {
url = "https://github.com/openwrt/mt76/raw/f24b56f935392ca1d35fae5fd6e56ef9deda4aad/firmware/mt7628_e2.bin";
sha256 = "sha256:1dkhfznmdz6s50kwc841x3wj0h6zg6icg5g2bim9pvg66as2vmh9";
};
in {
filesystem = dir {
lib = dir {
firmware = dir {
"mt7628_e2.bin" = symlink wlan_firmware;
};
};
};
hardware = {
defaultOutput = "tftproot";
loadAddress = "0x80000000";
@ -77,7 +90,9 @@
};
};
boot.tftp = {
loadAddress = "0x00A00000";
# 20MB seems to give enough room to uncompress the kernel
# without anything getting trodden on. 10MB was too small
loadAddress = "0x1400000";
};
kernel = {

View File

@ -62,7 +62,7 @@ in {
in
pkgs.buildPackages.runCommand "" {} ''
uimageSize=$(($(stat -L -c %s ${config.outputs.uimage}) + 0x1000 &(~0xfff)))
squashfsStart=0x$(printf %x $((${cfg.loadAddress} + $uimageSize)))
squashfsStart=0x$(printf %x $((${cfg.loadAddress} + 0x100000 + $uimageSize)))
squashfsBytes=$(($(stat -L -c %s ${config.outputs.squashfs}) + 0x100000 &(~0xfffff)))
squashfsMb=$(($squashfsBytes >> 20))
cmd="mtdparts=phram0:''${squashfsMb}M(nix) phram.phram=phram0,''${squashfsStart},''${squashfsMb}Mi memmap=''${squashfsMb}M\$''${squashfsStart} root=1f00";