Compare commits
12 Commits
c70d556f44
...
423cf4cbee
Author | SHA1 | Date | |
---|---|---|---|
423cf4cbee | |||
5feda1a1e6 | |||
e78028e58f | |||
58c287ef6a | |||
af79e1e9e9 | |||
1bd35a1edd | |||
67c21e51d7 | |||
309bb0db2d | |||
4c2e460042 | |||
9cbffdab50 | |||
2f3072d7d5 | |||
8da5a88e07 |
44
default.nix
44
default.nix
@ -1,28 +1,38 @@
|
||||
{ device ? (import devices/gl-ar750.nix)
|
||||
{
|
||||
device ? (import devices/gl-ar750.nix)
|
||||
, phram ? false
|
||||
}:
|
||||
|
||||
let
|
||||
overlay = import ./overlay.nix;
|
||||
nixpkgs = import <nixpkgs> ( device.system // {overlays = [overlay]; });
|
||||
inherit (nixpkgs.pkgs) callPackage writeText liminix;
|
||||
inherit (nixpkgs.lib) concatStringsSep;
|
||||
config = (import ./merge-modules.nix) [
|
||||
./modules/base.nix
|
||||
({ lib, ... } : { config = { inherit (device) kernel; }; })
|
||||
<liminix-config>
|
||||
./modules/s6
|
||||
./modules/users.nix
|
||||
(if phram then ./modules/phram.nix else (args: {}))
|
||||
] nixpkgs.pkgs;
|
||||
squashfs = liminix.builders.squashfs config.filesystem.contents;
|
||||
kernel = callPackage ./kernel {
|
||||
inherit (config.kernel) config checkedConfig;
|
||||
};
|
||||
|
||||
outputs = rec {
|
||||
inherit squashfs kernel;
|
||||
dtb = kernel.dtb {
|
||||
dts = "qca9531_glinet_gl-ar750.dts";
|
||||
|
||||
};
|
||||
uimage = kernel.uimage {
|
||||
commandLine = concatStringsSep " " config.boot.commandLine;
|
||||
inherit (device.boot) loadAddress entryPoint;
|
||||
inherit (kernel) vmlinux;
|
||||
inherit dtb;
|
||||
};
|
||||
|
||||
combined-image = nixpkgs.pkgs.runCommand "firmware.bin" {
|
||||
nativeBuildInputs = [ nixpkgs.buildPackages.ubootTools ];
|
||||
} ''
|
||||
@ -30,11 +40,31 @@ let
|
||||
dd if=${uimage} of=$out/firmware.bin bs=128k conv=sync
|
||||
dd if=${squashfs} of=$out/firmware.bin bs=128k conv=sync,nocreat,notrunc oflag=append
|
||||
'';
|
||||
directory = nixpkgs.pkgs.runCommand "both-kinds" {} ''
|
||||
mkdir $out
|
||||
cd $out
|
||||
ln -s ${squashfs} squashfs
|
||||
ln -s ${kernel.vmlinux} vmlinux
|
||||
boot-scr =
|
||||
let
|
||||
inherit (nixpkgs.lib.trivial) toHexString;
|
||||
uimageStart = 10485760; # 0xa00000
|
||||
squashfsStart = uimageStart + 2 * 1024 * 1024;
|
||||
squashfsSize = 8;
|
||||
cmd = "mtdparts=phram0:${toString squashfsSize}M(nix) phram.phram=phram0,0x${toHexString squashfsStart},${toString squashfsSize}Mi memmap=${toString squashfsSize}M\$0x${toHexString squashfsStart} root=1f00";
|
||||
in
|
||||
nixpkgs.pkgs.buildPackages.writeScript "firmware.bin" ''
|
||||
setenv serverip 192.168.8.148
|
||||
setenv ipaddr 192.168.8.251
|
||||
setenv bootargs '${concatStringsSep " " config.boot.commandLine} ${cmd}'
|
||||
tftp 0x8${toHexString uimageStart} result/uimage ; tftp 0x8${toHexString squashfsStart} result/squashfs
|
||||
bootm 0x${toHexString uimageStart}
|
||||
'';
|
||||
|
||||
directory = nixpkgs.pkgs.runCommand "liminix" {} ''
|
||||
mkdir $out
|
||||
cd $out
|
||||
ln -s ${squashfs} squashfs
|
||||
ln -s ${kernel.vmlinux} vmlinux
|
||||
ln -s ${manifest} manifest
|
||||
ln -s ${uimage} uimage
|
||||
${if phram then "ln -s ${boot-scr} boot.scr" else ""}
|
||||
ln -s ${boot-scr} flash.scr
|
||||
'';
|
||||
# this exists so that you can run "nix-store -q --tree" on it and find
|
||||
# out what's in the image, which is nice if it's unexpectedly huge
|
||||
|
@ -10,12 +10,6 @@
|
||||
# DIY users: the serial port connections have headers preinstalled
|
||||
# and don't need soldering
|
||||
|
||||
# The default output is a combined image containing a kernel
|
||||
# packaged as a "uimage" and initrd filesystem. This can be
|
||||
# downloaded to the device using TFTP and then written into
|
||||
# flash, or if PHRAM suport is enabled (handy for development)
|
||||
# unpacked and run directly into RAM
|
||||
|
||||
{
|
||||
system = {
|
||||
crossSystem = {
|
||||
@ -26,53 +20,79 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
kernel = {
|
||||
kernel = rec {
|
||||
checkedConfig = {
|
||||
"MIPS_RAW_APPENDED_DTB" = "y";
|
||||
"MIPS_ELF_APPENDED_DTB" = "y";
|
||||
# possibly not all of these are needed, I just
|
||||
# copied them from qemu
|
||||
HW_CONSOLE = "y";
|
||||
VT_HW_CONSOLE_BINDING = "y";
|
||||
SERIAL_8250_CONSOLE = "y";
|
||||
SERIAL_8250 = "y";
|
||||
SERIAL_CORE_CONSOLE = "y";
|
||||
DUMMY_CONSOLE = "y";
|
||||
DUMMY_CONSOLE_COLUMNS = "80";
|
||||
DUMMY_CONSOLE_ROWS = "25";
|
||||
# FRAMEBUFFER_CONSOLE = "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";
|
||||
};
|
||||
config = {
|
||||
config = checkedConfig // {
|
||||
CPU_LITTLE_ENDIAN= "n";
|
||||
CPU_BIG_ENDIAN= "y";
|
||||
ATH79 = "y";
|
||||
MIPS_ELF_APPENDED_DTB = "y";
|
||||
|
||||
# INITRAMFS_SOURCE = "\"\"";
|
||||
|
||||
# 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 ...
|
||||
"BLK_DEV_INITRD" = "n";
|
||||
|
||||
"CMDLINE_PARTITION" = "y";
|
||||
"DEBUG_INFO" = "y";
|
||||
"DEVTMPFS" = "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";
|
||||
"IMAGE_CMDLINE_HACK" = "n";
|
||||
"IP_PNP" = "y";
|
||||
"JFFS2_FS" = "n";
|
||||
"MIPS_RAW_APPENDED_DTB" = "y";
|
||||
|
||||
# "IMAGE_CMDLINE_HACK" = "n";
|
||||
|
||||
"MODULE_SIG" = "y";
|
||||
"MTD_CMDLINE_PARTS" = "y";
|
||||
"MTD_SPLIT_FIRMWARE" = "y";
|
||||
# "MTD_SPLIT_FIRMWARE" = "y";
|
||||
"PARTITION_ADVANCED" = "y";
|
||||
"PRINTK_TIME" = "y";
|
||||
"SQUASHFS" = "y";
|
||||
"SQUASHFS_XZ" = "y";
|
||||
"ASN1" = "y";
|
||||
"ASYMMETRIC_KEY_TYPE" = "y";
|
||||
"ASYMMETRIC_PUBLIC_KEY_SUBTYPE" = "y";
|
||||
"CRC_CCITT" = "y";
|
||||
"CRYPTO" = "y";
|
||||
"CRYPTO_ARC4" = "y";
|
||||
"CRYPTO_CBC" = "y";
|
||||
"CRYPTO_CCM" = "y";
|
||||
"CRYPTO_CMAC" = "y";
|
||||
"CRYPTO_GCM" = "y";
|
||||
"CRYPTO_HASH_INFO" = "y";
|
||||
"CRYPTO_LIB_ARC4" = "y";
|
||||
"CRYPTO_RSA" = "y";
|
||||
"CRYPTO_SHA1" = "y";
|
||||
"ENCRYPTED_KEYS" = "y";
|
||||
"KEYS" = "y";
|
||||
# "ASN1" = "y";
|
||||
# "ASYMMETRIC_KEY_TYPE" = "y";
|
||||
# "ASYMMETRIC_PUBLIC_KEY_SUBTYPE" = "y";
|
||||
# "CRC_CCITT" = "y";
|
||||
# "CRYPTO" = "y";
|
||||
# "CRYPTO_ARC4" = "y";
|
||||
# "CRYPTO_CBC" = "y";
|
||||
# "CRYPTO_CCM" = "y";
|
||||
# "CRYPTO_CMAC" = "y";
|
||||
# "CRYPTO_GCM" = "y";
|
||||
# "CRYPTO_HASH_INFO" = "y";
|
||||
# "CRYPTO_LIB_ARC4" = "y";
|
||||
# "CRYPTO_RSA" = "y";
|
||||
# "CRYPTO_SHA1" = "y";
|
||||
# "ENCRYPTED_KEYS" = "y";
|
||||
# "KEYS" = "y";
|
||||
};
|
||||
};
|
||||
outputs.default = "combined-image";
|
||||
outputs.default = "directory";
|
||||
boot = {
|
||||
loadAddress = "0x80060000";
|
||||
entryPoint = "0x80060000";
|
||||
|
300
devices/qemu.nix
300
devices/qemu.nix
@ -13,9 +13,6 @@
|
||||
};
|
||||
};
|
||||
kernel = {
|
||||
checkedConfig = {
|
||||
"BINFMT_SCRIPT" = "y";
|
||||
};
|
||||
config = {
|
||||
SYSVIPC= "y";
|
||||
NO_HZ= "y";
|
||||
@ -29,16 +26,14 @@
|
||||
SLAB= "y";
|
||||
MIPS_MALTA= "y";
|
||||
CPU_LITTLE_ENDIAN= "n";
|
||||
CPU_BIG_ENDIAN= "n";
|
||||
CPU_BIG_ENDIAN= "y";
|
||||
CPU_MIPS32_R2= "y";
|
||||
PAGE_SIZE_16KB= "y";
|
||||
NR_CPUS= "1";
|
||||
HZ_100= "y";
|
||||
PCI= "y";
|
||||
VIRTUALIZATION= "y";
|
||||
KVM= "m";
|
||||
KVM_MIPS_DEBUG_COP0_COUNTERS= "y";
|
||||
VHOST_NET= "m";
|
||||
MODULES= "y";
|
||||
MODULE_UNLOAD= "y";
|
||||
MODVERSIONS= "y";
|
||||
@ -46,7 +41,6 @@
|
||||
NET= "y";
|
||||
PACKET= "y";
|
||||
UNIX= "y";
|
||||
XFRM_USER= "m";
|
||||
NET_KEY= "y";
|
||||
NET_KEY_MIGRATE= "y";
|
||||
INET= "y";
|
||||
@ -58,276 +52,58 @@
|
||||
IP_PNP= "y";
|
||||
IP_PNP_DHCP= "y";
|
||||
IP_PNP_BOOTP= "y";
|
||||
NET_IPIP= "m";
|
||||
IP_MROUTE= "y";
|
||||
IP_PIMSM_V1= "y";
|
||||
IP_PIMSM_V2= "y";
|
||||
SYN_COOKIES= "y";
|
||||
INET_AH= "m";
|
||||
INET_ESP= "m";
|
||||
INET_IPCOMP= "m";
|
||||
INET_XFRM_MODE_TRANSPORT= "m";
|
||||
INET_XFRM_MODE_TUNNEL= "m";
|
||||
TCP_MD5SIG= "y";
|
||||
IPV6_ROUTER_PREF= "y";
|
||||
IPV6_ROUTE_INFO= "y";
|
||||
IPV6_OPTIMISTIC_DAD= "y";
|
||||
INET6_AH= "m";
|
||||
INET6_ESP= "m";
|
||||
INET6_IPCOMP= "m";
|
||||
IPV6_TUNNEL= "m";
|
||||
IPV6_MROUTE= "y";
|
||||
IPV6_PIMSM_V2= "y";
|
||||
NETWORK_SECMARK= "y";
|
||||
NETFILTER= "y";
|
||||
NF_CONNTRACK= "m";
|
||||
NF_CONNTRACK_SECMARK= "y";
|
||||
NF_CONNTRACK_EVENTS= "y";
|
||||
NF_CONNTRACK_AMANDA= "m";
|
||||
NF_CONNTRACK_FTP= "m";
|
||||
NF_CONNTRACK_H323= "m";
|
||||
NF_CONNTRACK_IRC= "m";
|
||||
NF_CONNTRACK_PPTP= "m";
|
||||
NF_CONNTRACK_SANE= "m";
|
||||
NF_CONNTRACK_SIP= "m";
|
||||
NF_CONNTRACK_TFTP= "m";
|
||||
NF_CT_NETLINK= "m";
|
||||
NETFILTER_XT_TARGET_CLASSIFY= "m";
|
||||
NETFILTER_XT_TARGET_CONNMARK= "m";
|
||||
NETFILTER_XT_TARGET_MARK= "m";
|
||||
NETFILTER_XT_TARGET_NFLOG= "m";
|
||||
NETFILTER_XT_TARGET_NFQUEUE= "m";
|
||||
NETFILTER_XT_TARGET_TPROXY= "m";
|
||||
NETFILTER_XT_TARGET_TRACE= "m";
|
||||
NETFILTER_XT_TARGET_SECMARK= "m";
|
||||
NETFILTER_XT_TARGET_TCPMSS= "m";
|
||||
NETFILTER_XT_TARGET_TCPOPTSTRIP= "m";
|
||||
NETFILTER_XT_MATCH_COMMENT= "m";
|
||||
NETFILTER_XT_MATCH_CONNBYTES= "m";
|
||||
NETFILTER_XT_MATCH_CONNLIMIT= "m";
|
||||
NETFILTER_XT_MATCH_CONNMARK= "m";
|
||||
NETFILTER_XT_MATCH_CONNTRACK= "m";
|
||||
NETFILTER_XT_MATCH_DCCP= "m";
|
||||
NETFILTER_XT_MATCH_ESP= "m";
|
||||
NETFILTER_XT_MATCH_HASHLIMIT= "m";
|
||||
NETFILTER_XT_MATCH_HELPER= "m";
|
||||
NETFILTER_XT_MATCH_IPRANGE= "m";
|
||||
NETFILTER_XT_MATCH_LENGTH= "m";
|
||||
NETFILTER_XT_MATCH_LIMIT= "m";
|
||||
NETFILTER_XT_MATCH_MAC= "m";
|
||||
NETFILTER_XT_MATCH_MARK= "m";
|
||||
NETFILTER_XT_MATCH_MULTIPORT= "m";
|
||||
NETFILTER_XT_MATCH_OWNER= "m";
|
||||
NETFILTER_XT_MATCH_POLICY= "m";
|
||||
NETFILTER_XT_MATCH_PKTTYPE= "m";
|
||||
NETFILTER_XT_MATCH_QUOTA= "m";
|
||||
NETFILTER_XT_MATCH_RATEEST= "m";
|
||||
NETFILTER_XT_MATCH_REALM= "m";
|
||||
NETFILTER_XT_MATCH_RECENT= "m";
|
||||
NETFILTER_XT_MATCH_SOCKET= "m";
|
||||
NETFILTER_XT_MATCH_STATE= "m";
|
||||
NETFILTER_XT_MATCH_STATISTIC= "m";
|
||||
NETFILTER_XT_MATCH_STRING= "m";
|
||||
NETFILTER_XT_MATCH_TCPMSS= "m";
|
||||
NETFILTER_XT_MATCH_TIME= "m";
|
||||
NETFILTER_XT_MATCH_U32= "m";
|
||||
IP_VS= "m";
|
||||
IP_VS_IPV6= "y";
|
||||
IP_VS_PROTO_TCP= "y";
|
||||
IP_VS_PROTO_UDP= "y";
|
||||
IP_VS_PROTO_ESP= "y";
|
||||
IP_VS_PROTO_AH= "y";
|
||||
IP_VS_RR= "m";
|
||||
IP_VS_WRR= "m";
|
||||
IP_VS_LC= "m";
|
||||
IP_VS_WLC= "m";
|
||||
IP_VS_LBLC= "m";
|
||||
IP_VS_LBLCR= "m";
|
||||
IP_VS_DH= "m";
|
||||
IP_VS_SH= "m";
|
||||
IP_VS_SED= "m";
|
||||
IP_VS_NQ= "m";
|
||||
IP_NF_IPTABLES= "m";
|
||||
IP_NF_MATCH_AH= "m";
|
||||
IP_NF_MATCH_ECN= "m";
|
||||
IP_NF_MATCH_TTL= "m";
|
||||
IP_NF_FILTER= "m";
|
||||
IP_NF_TARGET_REJECT= "m";
|
||||
IP_NF_MANGLE= "m";
|
||||
IP_NF_TARGET_CLUSTERIP= "m";
|
||||
IP_NF_TARGET_ECN= "m";
|
||||
IP_NF_TARGET_TTL= "m";
|
||||
IP_NF_RAW= "m";
|
||||
IP_NF_ARPTABLES= "m";
|
||||
IP_NF_ARPFILTER= "m";
|
||||
IP_NF_ARP_MANGLE= "m";
|
||||
IP6_NF_MATCH_AH= "m";
|
||||
IP6_NF_MATCH_EUI64= "m";
|
||||
IP6_NF_MATCH_FRAG= "m";
|
||||
IP6_NF_MATCH_OPTS= "m";
|
||||
IP6_NF_MATCH_HL= "m";
|
||||
IP6_NF_MATCH_IPV6HEADER= "m";
|
||||
IP6_NF_MATCH_MH= "m";
|
||||
IP6_NF_MATCH_RT= "m";
|
||||
IP6_NF_TARGET_HL= "m";
|
||||
IP6_NF_FILTER= "m";
|
||||
IP6_NF_TARGET_REJECT= "m";
|
||||
IP6_NF_MANGLE= "m";
|
||||
IP6_NF_RAW= "m";
|
||||
BRIDGE_NF_EBTABLES= "m";
|
||||
BRIDGE_EBT_BROUTE= "m";
|
||||
BRIDGE_EBT_T_FILTER= "m";
|
||||
BRIDGE_EBT_T_NAT= "m";
|
||||
BRIDGE_EBT_802_3= "m";
|
||||
BRIDGE_EBT_AMONG= "m";
|
||||
BRIDGE_EBT_ARP= "m";
|
||||
BRIDGE_EBT_IP= "m";
|
||||
BRIDGE_EBT_IP6= "m";
|
||||
BRIDGE_EBT_LIMIT= "m";
|
||||
BRIDGE_EBT_MARK= "m";
|
||||
BRIDGE_EBT_PKTTYPE= "m";
|
||||
BRIDGE_EBT_STP= "m";
|
||||
BRIDGE_EBT_VLAN= "m";
|
||||
BRIDGE_EBT_ARPREPLY= "m";
|
||||
BRIDGE_EBT_DNAT= "m";
|
||||
BRIDGE_EBT_MARK_T= "m";
|
||||
BRIDGE_EBT_REDIRECT= "m";
|
||||
BRIDGE_EBT_SNAT= "m";
|
||||
BRIDGE_EBT_LOG= "m";
|
||||
BRIDGE_EBT_NFLOG= "m";
|
||||
IP_SCTP= "m";
|
||||
BRIDGE= "m";
|
||||
VLAN_8021Q= "m";
|
||||
VLAN_8021Q_GVRP= "y";
|
||||
ATALK= "m";
|
||||
DEV_APPLETALK= "m";
|
||||
IPDDP= "m";
|
||||
IPDDP_ENCAP= "y";
|
||||
PHONET= "m";
|
||||
NET_SCHED= "y";
|
||||
NET_SCH_CBQ= "m";
|
||||
NET_SCH_HTB= "m";
|
||||
NET_SCH_HFSC= "m";
|
||||
NET_SCH_PRIO= "m";
|
||||
NET_SCH_RED= "m";
|
||||
NET_SCH_SFQ= "m";
|
||||
NET_SCH_TEQL= "m";
|
||||
NET_SCH_TBF= "m";
|
||||
NET_SCH_GRED= "m";
|
||||
NET_SCH_DSMARK= "m";
|
||||
NET_SCH_NETEM= "m";
|
||||
NET_SCH_INGRESS= "m";
|
||||
NET_CLS_BASIC= "m";
|
||||
NET_CLS_TCINDEX= "m";
|
||||
NET_CLS_ROUTE4= "m";
|
||||
NET_CLS_FW= "m";
|
||||
NET_CLS_U32= "m";
|
||||
NET_CLS_RSVP= "m";
|
||||
NET_CLS_RSVP6= "m";
|
||||
NET_CLS_FLOW= "m";
|
||||
NET_CLS_ACT= "y";
|
||||
NET_ACT_POLICE= "y";
|
||||
NET_ACT_GACT= "m";
|
||||
GACT_PROB= "y";
|
||||
NET_ACT_MIRRED= "m";
|
||||
NET_ACT_IPT= "m";
|
||||
NET_ACT_NAT= "m";
|
||||
NET_ACT_PEDIT= "m";
|
||||
NET_ACT_SIMP= "m";
|
||||
NET_ACT_SKBEDIT= "m";
|
||||
DEVTMPFS= "y";
|
||||
CONNECTOR= "m";
|
||||
MTD= "y";
|
||||
MTD_BLOCK= "y";
|
||||
MTD_OOPS= "m";
|
||||
MTD_CFI= "y";
|
||||
MTD_CFI_INTELEXT= "y";
|
||||
MTD_CFI_AMDSTD= "y";
|
||||
MTD_CFI_STAA= "y";
|
||||
MTD_PHYSMAP_OF= "y";
|
||||
MTD_UBI= "m";
|
||||
MTD_UBI_GLUEBI= "m";
|
||||
BLK_DEV_FD= "m";
|
||||
BLK_DEV_LOOP= "m";
|
||||
BLK_DEV_CRYPTOLOOP= "m";
|
||||
BLK_DEV_NBD= "m";
|
||||
BLK_DEV_RAM= "y";
|
||||
CDROM_PKTCDVD= "m";
|
||||
ATA_OVER_ETH= "m";
|
||||
RAID_ATTRS= "m";
|
||||
BLK_DEV_SD= "y";
|
||||
CHR_DEV_ST= "m";
|
||||
CHR_DEV_OSST= "m";
|
||||
BLK_DEV_SR= "y";
|
||||
CHR_DEV_SG= "m";
|
||||
SCSI_CONSTANTS= "y";
|
||||
SCSI_LOGGING= "y";
|
||||
SCSI_SCAN_ASYNC= "y";
|
||||
SCSI_FC_ATTRS= "m";
|
||||
ISCSI_TCP= "m";
|
||||
BLK_DEV_3W_XXXX_RAID= "m";
|
||||
SCSI_3W_9XXX= "m";
|
||||
SCSI_ACARD= "m";
|
||||
SCSI_AACRAID= "m";
|
||||
SCSI_AIC7XXX= "m";
|
||||
AIC7XXX_RESET_DELAY_MS="15000";
|
||||
AIC7XXX_DEBUG_ENABLE= "n";
|
||||
ATA= "y";
|
||||
ATA_PIIX= "y";
|
||||
PATA_IT8213= "m";
|
||||
PATA_OLDPIIX= "y";
|
||||
PATA_MPIIX= "y";
|
||||
ATA_GENERIC= "y";
|
||||
PATA_LEGACY= "y";
|
||||
MD= "y";
|
||||
BLK_DEV_MD= "m";
|
||||
MD_LINEAR= "m";
|
||||
MD_RAID0= "m";
|
||||
MD_RAID1= "m";
|
||||
MD_RAID10= "m";
|
||||
MD_RAID456= "m";
|
||||
MD_MULTIPATH= "m";
|
||||
MD_FAULTY= "m";
|
||||
BLK_DEV_DM= "m";
|
||||
DM_CRYPT= "m";
|
||||
DM_SNAPSHOT= "m";
|
||||
DM_MIRROR= "m";
|
||||
DM_ZERO= "m";
|
||||
DM_MULTIPATH= "m";
|
||||
NETDEVICES= "y";
|
||||
BONDING= "m";
|
||||
DUMMY= "m";
|
||||
EQUALIZER= "m";
|
||||
IFB= "m";
|
||||
MACVLAN= "m";
|
||||
TUN= "m";
|
||||
VETH= "m";
|
||||
PCNET32= "y";
|
||||
CHELSIO_T3= "m";
|
||||
AX88796= "m";
|
||||
NETXEN_NIC= "m";
|
||||
TC35815= "m";
|
||||
BROADCOM_PHY= "m";
|
||||
CICADA_PHY= "m";
|
||||
DAVICOM_PHY= "m";
|
||||
ICPLUS_PHY= "m";
|
||||
LXT_PHY= "m";
|
||||
MARVELL_PHY= "m";
|
||||
QSEMI_PHY= "m";
|
||||
REALTEK_PHY= "m";
|
||||
SMSC_PHY= "m";
|
||||
VITESSE_PHY= "m";
|
||||
ATMEL= "m";
|
||||
PCI_ATMEL= "m";
|
||||
IPW2100= "m";
|
||||
IPW2100_MONITOR= "y";
|
||||
HOSTAP= "m";
|
||||
HOSTAP_FIRMWARE= "y";
|
||||
HOSTAP_FIRMWARE_NVRAM= "y";
|
||||
HOSTAP_PLX= "m";
|
||||
HOSTAP_PCI= "m";
|
||||
PRISM54= "m";
|
||||
LIBERTAS= "m";
|
||||
INPUT_MOUSEDEV= "y";
|
||||
SERIAL_8250= "y";
|
||||
SERIAL_8250_CONSOLE= "y";
|
||||
@ -339,101 +115,27 @@
|
||||
FB_CIRRUS= "y";
|
||||
VGA_CONSOLE= "n";
|
||||
FRAMEBUFFER_CONSOLE= "y";
|
||||
HID= "m";
|
||||
RTC_CLASS= "y";
|
||||
RTC_DRV_CMOS= "y";
|
||||
UIO= "m";
|
||||
UIO_CIF= "m";
|
||||
EXT2_FS= "y";
|
||||
EXT3_FS= "y";
|
||||
JFS_FS= "m";
|
||||
JFS_POSIX_ACL= "y";
|
||||
JFS_SECURITY= "y";
|
||||
QUOTA= "y";
|
||||
QFMT_V2= "y";
|
||||
FUSE_FS= "m";
|
||||
ISO9660_FS= "m";
|
||||
JOLIET= "y";
|
||||
ZISOFS= "y";
|
||||
UDF_FS= "m";
|
||||
MSDOS_FS= "m";
|
||||
VFAT_FS= "m";
|
||||
PROC_KCORE= "y";
|
||||
TMPFS= "y";
|
||||
CONFIGFS_FS= "y";
|
||||
BEFS_FS= "m";
|
||||
BFS_FS= "m";
|
||||
EFS_FS= "m";
|
||||
JFFS2_FS= "m";
|
||||
JFFS2_FS_XATTR= "y";
|
||||
JFFS2_COMPRESSION_OPTIONS= "y";
|
||||
JFFS2_RUBIN= "y";
|
||||
CRAMFS= "m";
|
||||
VXFS_FS= "m";
|
||||
MINIX_FS= "m";
|
||||
ROMFS_FS= "m";
|
||||
SYSV_FS= "m";
|
||||
UFS_FS= "m";
|
||||
# NFS_FS= "y";
|
||||
# ROOT_NFS= "y";
|
||||
# NFSD= "y";
|
||||
# NFSD_V3= "y";
|
||||
NLS_CODEPAGE_437= "m";
|
||||
NLS_CODEPAGE_737= "m";
|
||||
NLS_CODEPAGE_775= "m";
|
||||
NLS_CODEPAGE_850= "m";
|
||||
NLS_CODEPAGE_852= "m";
|
||||
NLS_CODEPAGE_855= "m";
|
||||
NLS_CODEPAGE_857= "m";
|
||||
NLS_CODEPAGE_860= "m";
|
||||
NLS_CODEPAGE_861= "m";
|
||||
NLS_CODEPAGE_862= "m";
|
||||
NLS_CODEPAGE_863= "m";
|
||||
NLS_CODEPAGE_864= "m";
|
||||
NLS_CODEPAGE_865= "m";
|
||||
NLS_CODEPAGE_866= "m";
|
||||
NLS_CODEPAGE_869= "m";
|
||||
NLS_CODEPAGE_936= "m";
|
||||
NLS_CODEPAGE_950= "m";
|
||||
NLS_CODEPAGE_932= "m";
|
||||
NLS_CODEPAGE_949= "m";
|
||||
NLS_CODEPAGE_874= "m";
|
||||
NLS_ISO8859_8= "m";
|
||||
NLS_CODEPAGE_1250= "m";
|
||||
NLS_CODEPAGE_1251= "m";
|
||||
NLS_ASCII= "m";
|
||||
NLS_ISO8859_1= "m";
|
||||
NLS_ISO8859_2= "m";
|
||||
NLS_ISO8859_3= "m";
|
||||
NLS_ISO8859_4= "m";
|
||||
NLS_ISO8859_5= "m";
|
||||
NLS_ISO8859_6= "m";
|
||||
NLS_ISO8859_7= "m";
|
||||
NLS_ISO8859_9= "m";
|
||||
NLS_ISO8859_13= "m";
|
||||
NLS_ISO8859_14= "m";
|
||||
NLS_ISO8859_15= "m";
|
||||
NLS_KOI8_R= "m";
|
||||
NLS_KOI8_U= "m";
|
||||
CRYPTO_CRYPTD= "m";
|
||||
CRYPTO_LRW= "m";
|
||||
CRYPTO_PCBC= "m";
|
||||
CRYPTO_HMAC= "y";
|
||||
CRYPTO_XCBC= "m";
|
||||
CRYPTO_MD4= "m";
|
||||
CRYPTO_SHA512= "m";
|
||||
CRYPTO_TGR192= "m";
|
||||
CRYPTO_WP512= "m";
|
||||
CRYPTO_ANUBIS= "m";
|
||||
CRYPTO_BLOWFISH= "m";
|
||||
CRYPTO_CAMELLIA= "m";
|
||||
CRYPTO_CAST5= "m";
|
||||
CRYPTO_CAST6= "m";
|
||||
CRYPTO_FCRYPT= "m";
|
||||
CRYPTO_KHAZAD= "m";
|
||||
CRYPTO_SERPENT= "m";
|
||||
CRYPTO_TEA= "m";
|
||||
CRYPTO_TWOFISH= "m";
|
||||
RCU_CPU_STALL_TIMEOUT = "60";
|
||||
ENABLE_DEFAULT_TRACERS = "y";
|
||||
|
||||
|
@ -34,9 +34,24 @@ let
|
||||
cp -a . $out
|
||||
'';
|
||||
};
|
||||
|
||||
openwrtSource = fetchFromGitHub {
|
||||
repo = "openwrt";
|
||||
owner = "openwrt";
|
||||
rev = "a5265497a4f6da158e95d6a450cb2cb6dc085cab";
|
||||
hash = "sha256-YYi4gkpLjbOK7bM2MGQjAyEBuXJ9JNXoz/JEmYf8xE8=";
|
||||
};
|
||||
|
||||
|
||||
in rec {
|
||||
vmlinux = callPackage ./vmlinux.nix {
|
||||
inherit tree config checkedConfig;
|
||||
};
|
||||
|
||||
uimage = callPackage ./uimage.nix { };
|
||||
|
||||
dtb = callPackage ./dtb.nix {
|
||||
openwrt = openwrtSource;
|
||||
kernel = tree;
|
||||
};
|
||||
}
|
||||
|
24
kernel/dtb.nix
Normal file
24
kernel/dtb.nix
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
stdenv
|
||||
, openwrt
|
||||
, dtc
|
||||
, kernel
|
||||
}:
|
||||
{ dts
|
||||
}:let
|
||||
includes = [
|
||||
"${openwrt}/target/linux/ath79/dts"
|
||||
"${kernel}/include"
|
||||
];
|
||||
cppDtSearchFlags = builtins.concatStringsSep " " (map (f: "-I${f}") includes);
|
||||
dtcSearchFlags = builtins.concatStringsSep " " (map (f: "-i${f}") includes);
|
||||
in stdenv.mkDerivation {
|
||||
name = "dtb";
|
||||
phases = [ "buildPhase" ];
|
||||
nativeBuildInputs = [ dtc ];
|
||||
buildPhase = ''
|
||||
${stdenv.cc.targetPrefix}cpp -nostdinc -x assembler-with-cpp ${cppDtSearchFlags} -undef -D__DTS__ -o dtb.tmp ${openwrt}/target/linux/ath79/dts/${dts}
|
||||
dtc ${dtcSearchFlags} -I dts -O dtb -o $out dtb.tmp
|
||||
test -e $out
|
||||
'';
|
||||
}
|
@ -2,41 +2,47 @@
|
||||
lzma
|
||||
, stdenv
|
||||
, ubootTools
|
||||
, dtc
|
||||
} :
|
||||
let
|
||||
objcopy = "${stdenv.cc.bintools.targetPrefix}objcopy";
|
||||
in {
|
||||
vmlinux
|
||||
# , commandLine
|
||||
# , fdt ? null
|
||||
, commandLine
|
||||
, entryPoint
|
||||
# , extraName ? "" # e.g. socFamily
|
||||
, extraName ? "" # e.g. socFamily
|
||||
, loadAddress
|
||||
, dtb ? null
|
||||
} :
|
||||
# patchDtbCommand = if (fdt != null) then ''
|
||||
# ( cat vmlinux.stripped ${fdt} > vmlinux.tmp ) && mv vmlinux.tmp vmlinux.stripped
|
||||
# '' else ''
|
||||
# echo patch-cmdline vmlinux.stripped '${commandLine}'
|
||||
# patch-cmdline vmlinux.stripped '${commandLine}'
|
||||
# echo
|
||||
# '';
|
||||
stdenv.mkDerivation {
|
||||
name = "kernel.image";
|
||||
phases = [ "buildPhase" "installPhase" ];
|
||||
phases = [
|
||||
"preparePhase"
|
||||
(if dtb != null then "dtbPhase" else ":")
|
||||
"buildPhase"
|
||||
"installPhase" ];
|
||||
nativeBuildInputs = [
|
||||
# patchImage
|
||||
lzma
|
||||
dtc
|
||||
stdenv.cc
|
||||
ubootTools
|
||||
];
|
||||
preparePhase = ''
|
||||
cp ${vmlinux} vmlinux.elf; chmod +w vmlinux.elf
|
||||
'';
|
||||
dtbPhase = ''
|
||||
dtc -I dtb -O dts -o tmp.dts ${dtb}
|
||||
echo '/{ chosen { bootargs = ${builtins.toJSON commandLine}; }; };' >> tmp.dts
|
||||
dtc -I dts -O dtb -o tmp.dtb tmp.dts
|
||||
${objcopy} --update-section .appended_dtb=tmp.dtb vmlinux.elf || ${objcopy} --add-section .appended_dtb=${dtb} vmlinux.elf
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
${objcopy} -O binary -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id -S ${vmlinux} vmlinux.stripped
|
||||
# {patchDtbCommand}
|
||||
rm -f vmlinux.stripped.lzma
|
||||
lzma -k -z vmlinux.stripped
|
||||
mkimage -A mips -O linux -T kernel -C lzma -a ${loadAddress} -e ${entryPoint} -n 'MIPS Liminix Linux ' -d vmlinux.stripped.lzma kernel.image
|
||||
${objcopy} -O binary -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id -S vmlinux.elf vmlinux.bin
|
||||
rm -f vmlinux.bin.lzma ; lzma -k -z vmlinux.bin
|
||||
mkimage -A mips -O linux -T kernel -C lzma -a ${loadAddress} -e ${entryPoint} -n 'MIPS Liminix Linux ${extraName}' -d vmlinux.bin.lzma kernel.uimage
|
||||
'';
|
||||
installPhase = ''
|
||||
cp kernel.image $out
|
||||
cp kernel.uimage $out
|
||||
'';
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ let writeConfig = name : config: writeText name
|
||||
(name: value: (if value == "n" then "# CONFIG_${name} is not set" else "CONFIG_${name}=${value}"))
|
||||
config
|
||||
));
|
||||
kconfigFile = writeConfig "kconfig" config;
|
||||
kconfigFile = writeConfig "kconfig" (config // checkedConfig);
|
||||
checkedConfigFile = writeConfig "checked_kconfig" checkedConfig ;
|
||||
inherit lib; in
|
||||
stdenv.mkDerivation rec {
|
||||
|
@ -34,6 +34,9 @@ in {
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
boot.commandLine = mkOption {
|
||||
type = types.listOf types.nonEmptyStr;
|
||||
};
|
||||
groups = mkOption {
|
||||
type = types.attrsOf types.anything;
|
||||
};
|
||||
@ -45,10 +48,19 @@ in {
|
||||
defaultProfile.packages = with pkgs;
|
||||
[ s6 s6-init-bin busybox execline s6-linux-init s6-rc ];
|
||||
|
||||
kernel.config = {
|
||||
"IKCONFIG_PROC" = "y";
|
||||
kernel = rec {
|
||||
config = {
|
||||
IKCONFIG = "y";
|
||||
IKCONFIG_PROC = "y";
|
||||
PROC_FS = "y";
|
||||
# s6-linux-init mounts this on /dev
|
||||
DEVTMPFS = "y";
|
||||
};
|
||||
checkedConfig = config;
|
||||
};
|
||||
|
||||
boot.commandLine = [
|
||||
"earlyprintk=serial,ttyS0 console=ttyS0,115200 panic=10 oops=panic init=/bin/init loglevel=8 rootfstype=squashfs"
|
||||
];
|
||||
users.root = {
|
||||
uid = 0; gid= 0; gecos = "Root of all evaluation";
|
||||
dir = "/";
|
||||
|
29
modules/phram.nix
Normal file
29
modules/phram.nix
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
config
|
||||
, ...
|
||||
}:
|
||||
{
|
||||
config = {
|
||||
kernel = {
|
||||
checkedConfig = {
|
||||
MTD = "y";
|
||||
MTD_PHRAM = "y";
|
||||
MTD_CMDLINE_PARTS = "y";
|
||||
|
||||
# one or more of the following is required to get from
|
||||
# VFS: Cannot open root device "1f00" or unknown-block(31,0): error -6
|
||||
# to
|
||||
# VFS: Mounted root (squashfs filesystem) readonly on device 31:0.
|
||||
MTD_OF_PARTS = "y";
|
||||
PARTITION_ADVANCED = "y";
|
||||
MSDOS_PARTITION = "y";
|
||||
EFI_PARTITION = "y";
|
||||
MTD_BLKDEVS = "y";
|
||||
MTD_BLOCK = "y";
|
||||
|
||||
# CONFIG_MTD_MTDRAM=m c'est quoi?
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
}
|
17
overlay.nix
17
overlay.nix
@ -56,4 +56,21 @@ final: prev: {
|
||||
'';
|
||||
postFixup = "";
|
||||
});
|
||||
|
||||
|
||||
# we need to build real lzma instead of using xz, because the lzma
|
||||
# decoder in u-boot doesn't understand streaming lzma archives
|
||||
# ("Stream with EOS marker is not supported") and xz can't create
|
||||
# non-streaming ones. See
|
||||
# https://sourceforge.net/p/squashfs/mailman/message/26599379/
|
||||
|
||||
lzma = final.stdenv.mkDerivation {
|
||||
pname = "lzma";
|
||||
version = "4.32.7";
|
||||
configureFlags = [ "--enable-static" "--disable-shared"];
|
||||
src = final.buildPackages.fetchurl {
|
||||
url = "https://tukaani.org/lzma/lzma-4.32.7.tar.gz";
|
||||
sha256 = "0b03bdvm388kwlcz97aflpr3ir1zpa3m0bq3s6cd3pp5a667lcwz";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ in rec {
|
||||
in address iface { family = "inet4"; address ="192.168.19.1"; prefixLength = 24;};
|
||||
|
||||
kernel.config = {
|
||||
"IKCONFIG_PROC" = "y";
|
||||
"PPP" = "y";
|
||||
"PPPOE" = "y";
|
||||
"PPPOL2TP" = "y";
|
||||
|
Loading…
Reference in New Issue
Block a user