Compare commits
No commits in common. "6d191b73ae20d449c8daae8188b9474b84498011" and "adc198b3af57291c6d47f6585458dca6f0bc8de8" have entirely different histories.
6d191b73ae
...
adc198b3af
@ -91,12 +91,6 @@
|
|||||||
defaultOutput = "tftproot";
|
defaultOutput = "tftproot";
|
||||||
loadAddress = "0x80060000";
|
loadAddress = "0x80060000";
|
||||||
entryPoint = "0x80060000";
|
entryPoint = "0x80060000";
|
||||||
flash = {
|
|
||||||
address = "0x9F060000";
|
|
||||||
size ="0xfa0000";
|
|
||||||
};
|
|
||||||
rootDevice = "1f05";
|
|
||||||
|
|
||||||
networkInterfaces = {
|
networkInterfaces = {
|
||||||
lan = interface { device = "eth0"; };
|
lan = interface { device = "eth0"; };
|
||||||
wan = interface { device = "eth1"; };
|
wan = interface { device = "eth1"; };
|
||||||
|
@ -113,7 +113,7 @@ image instead of flashing. In your device configuration add
|
|||||||
.. code-block:: nix
|
.. code-block:: nix
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
./modules/tftpboot.nix
|
./modules/phram.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.tftp = {
|
boot.tftp = {
|
||||||
|
@ -1,22 +1,18 @@
|
|||||||
{
|
{
|
||||||
stdenv
|
stdenv
|
||||||
, dtc
|
, dtc
|
||||||
, lib
|
|
||||||
}:
|
}:
|
||||||
{ dts
|
{ dts
|
||||||
, includes
|
, includes
|
||||||
, commandLine
|
|
||||||
}:let
|
}:let
|
||||||
cppDtSearchFlags = builtins.concatStringsSep " " (map (f: "-I${f}") includes);
|
cppDtSearchFlags = builtins.concatStringsSep " " (map (f: "-I${f}") includes);
|
||||||
dtcSearchFlags = builtins.concatStringsSep " " (map (f: "-i${f}") includes);
|
dtcSearchFlags = builtins.concatStringsSep " " (map (f: "-i${f}") includes);
|
||||||
cmdline = lib.concatStringsSep " " commandLine;
|
|
||||||
in stdenv.mkDerivation {
|
in stdenv.mkDerivation {
|
||||||
name = "dtb";
|
name = "dtb";
|
||||||
phases = [ "buildPhase" ];
|
phases = [ "buildPhase" ];
|
||||||
nativeBuildInputs = [ dtc ];
|
nativeBuildInputs = [ dtc ];
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
${stdenv.cc.targetPrefix}cpp -nostdinc -x assembler-with-cpp ${cppDtSearchFlags} -undef -D__DTS__ -o dtb.tmp ${dts}
|
${stdenv.cc.targetPrefix}cpp -nostdinc -x assembler-with-cpp ${cppDtSearchFlags} -undef -D__DTS__ -o dtb.tmp ${dts}
|
||||||
echo '/{ chosen { bootargs = ${builtins.toJSON cmdline}; }; };' >> dtb.tmp
|
|
||||||
dtc ${dtcSearchFlags} -I dts -O dtb -o $out dtb.tmp
|
dtc ${dtcSearchFlags} -I dts -O dtb -o $out dtb.tmp
|
||||||
test -e $out
|
test -e $out
|
||||||
'';
|
'';
|
||||||
|
@ -75,7 +75,6 @@ in {
|
|||||||
default = [];
|
default = [];
|
||||||
example = ["ath9k" "ath10k"];
|
example = ["ath9k" "ath10k"];
|
||||||
};
|
};
|
||||||
rootDevice = mkOption { };
|
|
||||||
networkInterfaces = mkOption {
|
networkInterfaces = mkOption {
|
||||||
type = types.attrsOf types.anything;
|
type = types.attrsOf types.anything;
|
||||||
};
|
};
|
||||||
|
@ -1,71 +0,0 @@
|
|||||||
{
|
|
||||||
config
|
|
||||||
, pkgs
|
|
||||||
, lib
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
inherit (lib) mkOption types concatStringsSep;
|
|
||||||
inherit (config.boot) tftp;
|
|
||||||
in {
|
|
||||||
options = {
|
|
||||||
device.flash = {
|
|
||||||
address = mkOption { type = types.str; };
|
|
||||||
size = mkOption { type = types.str; };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
config = {
|
|
||||||
kernel = {
|
|
||||||
config = {
|
|
||||||
MTD_SPLIT_UIMAGE_FW = "y";
|
|
||||||
# ignore the commandline provided by U-Boot because it's most
|
|
||||||
# likely wrong
|
|
||||||
MIPS_CMDLINE_FROM_BOOTLOADER = lib.mkForce "n";
|
|
||||||
MIPS_CMDLINE_FROM_DTB = "y";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
boot.commandLine = [
|
|
||||||
"root=${config.device.rootDevice}"
|
|
||||||
];
|
|
||||||
outputs.firmware =
|
|
||||||
let o = config.outputs; in
|
|
||||||
pkgs.runCommand "firmware" {} ''
|
|
||||||
dd if=${o.uimage} of=$out bs=128k conv=sync
|
|
||||||
dd if=${o.squashfs} of=$out bs=128k conv=sync,nocreat,notrunc oflag=append
|
|
||||||
'';
|
|
||||||
outputs.flashable =
|
|
||||||
let o = config.outputs; in
|
|
||||||
pkgs.runCommand "flashable" {} ''
|
|
||||||
mkdir $out
|
|
||||||
cd $out
|
|
||||||
ln -s ${o.firmware} firmware.bin
|
|
||||||
ln -s ${o.squashfs} squashfs
|
|
||||||
ln -s ${o.kernel} vmlinux
|
|
||||||
ln -s ${o.manifest} manifest
|
|
||||||
ln -s ${o.kernel.headers} build
|
|
||||||
ln -s ${o.uimage} uimage
|
|
||||||
ln -s ${o.dtb} dtb
|
|
||||||
ln -s ${o.flash-scr} flash.scr
|
|
||||||
'';
|
|
||||||
|
|
||||||
outputs.flash-scr =
|
|
||||||
let
|
|
||||||
inherit (pkgs.lib.trivial) toHexString;
|
|
||||||
inherit (pkgs.lib.lists) concatStringsSep;
|
|
||||||
inherit (config.device) flash;
|
|
||||||
in
|
|
||||||
pkgs.buildPackages.runCommand "" {} ''
|
|
||||||
imageSize=$(stat -L -c %s ${config.outputs.firmware})
|
|
||||||
cat > $out << EOF
|
|
||||||
setenv serverip ${tftp.serverip}
|
|
||||||
setenv ipaddr ${tftp.ipaddr}
|
|
||||||
tftp 0x$(printf %x ${tftp.loadAddress}) result/firmware.bin
|
|
||||||
erase 0x$(printf %x ${flash.address}) +0x$(printf %x ${flash.size})
|
|
||||||
cp.b 0x$(printf %x ${tftp.loadAddress}) 0x$(printf %x ${flash.address}) \''${filesize}
|
|
||||||
echo command line was ${builtins.toJSON (concatStringsSep " " config.boot.commandLine)}
|
|
||||||
EOF
|
|
||||||
'';
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
@ -23,7 +23,6 @@ in
|
|||||||
inherit (config.kernel) config src extraPatchPhase;
|
inherit (config.kernel) config src extraPatchPhase;
|
||||||
};
|
};
|
||||||
dtb = (callPackage ../kernel/dtb.nix {}) {
|
dtb = (callPackage ../kernel/dtb.nix {}) {
|
||||||
inherit (config.boot) commandLine;
|
|
||||||
dts = config.boot.dts.src;
|
dts = config.boot.dts.src;
|
||||||
includes = config.boot.dts.includes ++ [
|
includes = config.boot.dts.includes ++ [
|
||||||
"${kernel.headers}/include"
|
"${kernel.headers}/include"
|
||||||
|
@ -26,7 +26,6 @@ in {
|
|||||||
MTD = "y";
|
MTD = "y";
|
||||||
MTD_PHRAM = "y";
|
MTD_PHRAM = "y";
|
||||||
MTD_CMDLINE_PARTS = "y";
|
MTD_CMDLINE_PARTS = "y";
|
||||||
MIPS_CMDLINE_FROM_BOOTLOADER = "y";
|
|
||||||
|
|
||||||
# one or more of the following is required to get from
|
# one or more of the following is required to get from
|
||||||
# VFS: Cannot open root device "1f00" or unknown-block(31,0): error -6
|
# VFS: Cannot open root device "1f00" or unknown-block(31,0): error -6
|
||||||
@ -53,7 +52,7 @@ in {
|
|||||||
ln -s ${o.manifest} manifest
|
ln -s ${o.manifest} manifest
|
||||||
ln -s ${o.kernel.headers} build
|
ln -s ${o.kernel.headers} build
|
||||||
ln -s ${o.uimage} uimage
|
ln -s ${o.uimage} uimage
|
||||||
ln -s ${o.boot-scr} boot.scr
|
ln -s ${o.boot-scr} flash.scr
|
||||||
'';
|
'';
|
||||||
|
|
||||||
outputs.boot-scr =
|
outputs.boot-scr =
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
wpa_passphrase = "colourless green ideas";
|
|
||||||
l2tp = {
|
|
||||||
name = "db432@a.1";
|
|
||||||
password = "PHEALRQ8RY74";
|
|
||||||
};
|
|
||||||
}
|
|
@ -43,8 +43,7 @@ in rec {
|
|||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
./modules/wlan.nix
|
./modules/wlan.nix
|
||||||
./modules/tftpboot.nix
|
./modules/phram.nix
|
||||||
./modules/flashable.nix
|
|
||||||
];
|
];
|
||||||
|
|
||||||
kernel = {
|
kernel = {
|
||||||
|
@ -4,7 +4,7 @@ let
|
|||||||
inherit (pkgs.liminix.services) oneshot longrun bundle target;
|
inherit (pkgs.liminix.services) oneshot longrun bundle target;
|
||||||
in rec {
|
in rec {
|
||||||
imports = [
|
imports = [
|
||||||
./modules/tftpboot.nix
|
./modules/phram.nix
|
||||||
./modules/wlan.nix
|
./modules/wlan.nix
|
||||||
];
|
];
|
||||||
services.loopback =
|
services.loopback =
|
||||||
|
Loading…
Reference in New Issue
Block a user