1
0
Commit Graph

454 Commits

Author SHA1 Message Date
2f82e0dab8 hostapd set permissions on dir in /run/ 2024-08-14 22:57:02 +01:00
fc03965915 hostapd literal_or_output use an attrset for dispatch 2024-08-14 22:56:01 +01:00
d2d3af2587 outboard secrets: loop in service
if we just quit and expect s6 to restart us, the finish script
wipes our outputs and anything with an inotify watch gets confused
2024-08-14 22:41:56 +01:00
4fb8253e57 first pass at outboard secrets
- a module to fetch them with http(s)
- a service using templating to consume them
- update an example to use it

needs service restarts
needs other services to use the template mechanism
needs tidying up
2024-08-12 22:57:21 +01:00
5db9d7269e ppoe structured options are optional 2024-08-06 18:43:27 +01:00
c4d00e062a add health check service and example that uses it 2024-07-30 22:37:43 +01:00
39020607ad rename service-trigger rule to match service name 2024-07-28 22:35:37 +01:00
fe735408a1 v:address is nil if missing, but code expects an array 2024-07-27 17:40:32 +01:00
a9d1582b53 remove unused arg 2024-07-26 23:41:50 +01:00
28ca1e68ab wwan module needs mdevd 2024-07-23 09:31:34 +01:00
7f9cae9d5c generalise profile.gateway.wan so not just pppoe 2024-07-23 09:31:34 +01:00
7195cb10ce add structured config for common pppoe options 2024-07-23 09:31:34 +01:00
3899daee56 create a module for round-robin 2024-07-15 22:37:37 +01:00
b17f623d03 need insmod when we habve kmodloader 2024-07-15 22:35:26 +01:00
df395a4d5d finish moving pkgs.linimix.callService to config.system 2024-07-15 19:00:08 +01:00
725d8b608f huawei-cdc-ncm kernel driver -> module 2024-07-14 12:07:28 +01:00
73ae7788b9 rename wwan-related modules/services
we only currently support huawei e3372/cdc ncm so let's make that
explicit in the naming
2024-07-14 11:53:45 +01:00
3f8cc24dcc fix most doc warnings 2024-07-10 23:36:24 +01:00
ac551536da set cwd before exec xl2tpd 2024-07-08 21:56:26 +01:00
6f908156af fix dependency between modem-atz and modeswitch
for values of "fix" more than slightly reminiscent of "kludge"
2024-07-08 21:55:05 +01:00
07a6eb73cd set lcp-echo timeout in l2tp 2024-07-08 21:45:54 +01:00
159bfa3057 make xl2tpd quit when the connections close 2024-07-08 21:44:15 +01:00
143137cbc6 pppoe: set lcp echo failure timeout 2024-07-08 21:25:42 +01:00
8d228f2bef mess with redial 2024-07-08 21:24:44 +01:00
8b6aa2134e zyxel dual image; restore deleted params 2024-06-30 17:50:45 +01:00
3df1ec76ff cleanup whitespace and commas
* [] is now [ ]
* {} is now { }
* commas in arglists go at end of line not beginning

In short, I ran the whole thing through nixfmt-rfc-style but only
accepted about 30% of its changes. I might grow accustomed to more
of it over time
2024-06-30 17:16:28 +01:00
e94bf62ec1 remove dead code (run deadnix) 2024-06-29 22:59:27 +01:00
d4d8093f97 working l2tp-over-wwan stick example 2024-06-20 10:15:54 +01:00
7c9c801afc rename isTrigger to restart-on-upgrade
we're moving away from "trigger" services to "controller" services,
and "restart-on-upgrade" is the name used by s6-rc
2024-06-16 12:58:06 +01:00
06d28e9b08 dhcpc handle case when env vars are missing
the notify-script should continue and signal readiness even if one or
more of the outputs it writes are mssing in the environment
2024-06-15 15:34:49 +01:00
adc84108ad Revert "wwan gets address from ppp ipcp not dhcp"
This reverts commit be13ab23ca.
2024-06-15 15:04:33 +01:00
eae99051fa exec devout in service definition
makes little practical difference but saves a process slot
2024-06-15 15:01:57 +01:00
49d1703428 add s6-rc-up-tree: start reverse deps of controlled service
When s6-rc stops a service, it also stops everything that
depends on it. but when it starts a service it starts only
that service, so we have to go through the other services
depending on it and figure out if they should be started too.
2024-06-15 14:59:34 +01:00
f898e4dca2 remove debug 2024-06-12 13:03:26 +01:00
5121a8563d callService: dependencies are services not names 2024-06-12 12:58:57 +01:00
be13ab23ca wwan gets address from ppp ipcp not dhcp 2024-06-12 12:51:07 +01:00
b15542b668 start correct services at boot
- uncontrolled services that are not dependent on a controlled service
- controllers
- _not_ controlled services or any other service that depends on one
2024-06-11 14:04:14 +01:00
6daeaf29a0 flip controller/controlled relationship for wwan services 2024-06-11 14:02:48 +01:00
e6e4665a18 flip dependencies for triggered/controlled services
Instead of treating the trigger as the "main" service and the
triggered service as subsidary, now we treat the triggered
service as the service and the trigger as "subsidary". This
needs some special handling when we work out which services
go in the default bundle, but it works better for declaring
dependencies on triggered services because it means the
dependency runs after the triggered service comes up, not
just when the watcher-for-events starts
2024-06-09 22:37:45 +01:00
c8c79fd75a update all calls to uevent-watch 2024-06-02 20:42:09 +01:00
884d8d194e wrap uevent-watch in a service 2024-06-02 20:42:09 +01:00
37d7e20582 wwan use uevent-watch to find tty for AT commands 2024-06-01 23:47:20 +01:00
e0bd7aec1e wwan: hook usb-modeswitch to uevent 2024-05-26 18:03:32 +01:00
898958fa10 make a serviceDefn for wwan 2024-05-22 18:54:49 +01:00
fa0f262706 commentary 2024-05-22 18:54:49 +01:00
71aeb27b2f add hacky wwan service with hardcoding all over 2024-05-22 18:54:49 +01:00
530b4080c9 create cdc-ncm module 2024-05-22 18:54:49 +01:00
758c7ef657 exec xl2tpd
haven't fully worked out why, but without this s6 is unable to stop it.
2024-05-22 18:54:49 +01:00
73225a70b2 add rudimentary l2tp service module 2024-05-22 18:54:49 +01:00
782feaeafa set default for firewall extraRules 2024-05-03 16:28:53 +01:00
e249f48cff add deps on {ins,rm}mod and kconfig for firewall module 2024-05-01 23:06:12 +01:00
660ed5df8f vlan interface services depend on primary 2024-04-28 21:33:36 +01:00
7e4a05bbf8 separate kernel and base modules
this is needed for levitate
2024-04-28 12:44:27 +01:00
a4ba5c85e1 alphabetize list in all-modules 2024-04-28 12:42:47 +01:00
1b6a05aec5 make uevent-watch use devout instead of direct netlink 2024-04-27 21:07:25 +01:00
bf0cafffed start devout alongside mdevd
ensure it starts before mdevd-coldplug so it can populate
its database
2024-04-26 20:52:12 +01:00
cdb23b147c convert anoia.fs to use lualinux 2024-04-25 21:14:37 +01:00
771585546d import expect= where previously it was copy-pasted 2024-04-20 15:09:50 +01:00
19ad6cd278 watchdog: put s6 pkg on $PATH for s6-svstat 2024-04-17 13:01:10 +01:00
00076c7b81 mount service: use uevent-watch 2024-04-17 12:59:13 +01:00
b6a054c588 add mdevd as module
following the upstream example, it republishes uevent messages
using multicast group 4 instead of group 2 as used by udev.
2024-04-14 21:59:23 +01:00
5df5c822ea convert mount service to trigger
Good: this means it's not hanging holding the s6 dataase lock.

Bad: it's the ugliest implementation and doesn't deserve to be preserved

(tbf the ugliness is not new)
2024-04-03 23:17:36 +01:00
4795dd05b7 unconditionally restart trigger services on liminix-rebuild
We call s6-rc -u -p default to restart/start the base services
on a rebuild, otherwise services that are only in the new
configuration won't come up. However, this stops any service
started by a trigger. So, workaround is to restart the trigger
service and expect it to restart the services it manages if they're
needed
2024-04-03 23:07:56 +01:00
a192f08881 remove missing module 2024-03-29 17:34:10 +00:00
a873dc6608 Merge commit 'efcfdcc' 2024-03-28 23:47:04 +00:00
dca2e4def1 fix params to s6-rc-init
flags must precede scandir otherwise they're ignored
2024-03-28 21:56:28 +00:00
28a5dec7dd implement ifwait trigger service and use in bridge
should we convert all ifwait uses to this trigger too? seems
reasonable
2024-03-28 20:59:39 +00:00
fad0a47b75 add config.system.callService
this is like pkgs.callService except that it passes
config.system.service as a param so that the service
being defined can invoke other services

if this proves to be a good idea, all uses of
pkgs.callService should be changed to use it instead
2024-03-28 20:59:39 +00:00
1a314e55b7 firewall module: provide default rules and merge extraRules
a firewall with no configuration will get a relatively sane ruleset. a
firewall with `extraRules` will get them deep merged into the default
rules.  Specifying `rules` will override the defaults
2024-03-21 12:00:34 +00:00
9263b21faa create gateway profile by extracting from rotuer example 2024-03-21 10:04:42 +00:00
436eb03a7b tftpboot: use commandLineDtbNode
config.boot.commandLineDtbNode can be set from `bootargs` to
`bootargs-override` (used for boards where the u-boot on the board does
set `bootargs` on its own).

In that case, the code updating the cmdline for tftpboot purposes also
needs to update this node, not the `bootargs` node.

Otherwise the kernel won't find the phram device, as it never heard
about it, as it didn't get the necessary cmdline options.
2024-03-16 20:06:38 +02:00
9d6e50cbbc extract extneder example to a "profile"
this is a bit of an experiment to reduce the copy-paste in
examples by turning them into "application" modules.

planning to follow up with another module for "wifi router"
2024-02-27 23:13:12 +00:00
94dbc56595 fix doc 2024-02-27 20:08:30 +00:00
2cd7f932eb alignment may be null 2024-02-27 19:47:46 +00:00
Raito Bezarius
d6ffdd7be6 devices/zyxel-nwa50ax: expose primary and secondary images
To support A/B a bit better.

Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2024-02-19 02:57:34 +01:00
Raito Bezarius
422f3edab1 modules/zyxel-dual-image: init
This adds a simple boot blessing module, to be used, with the Zyxel NWA50AX.

There's a lot of elephant in the rooms: how do you upgrade kernel, etc.

Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2024-02-19 02:48:50 +01:00
Raito Bezarius
c14b2f6356 modules/busybox: add dhcprelay
This enables to run a DHCP relay from multiple interfaces.

Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2024-02-19 02:48:50 +01:00
Raito Bezarius
63007859c2 modules/outputs/zyxel-nwa-fit: init
Zyxel "firmware" format is just… a FIT with some metadata on the models.

This FIT is like this:

--------------------------
    uImage FIT header
--------------------------
    Linux kernel
--------------------------
    FDT DTB
--------------------------
    Padding so that
    this makes
    8192kb [1]
--------------------------
    UBI volume
    as a root filesystem
--------------------------

We just reproduce this in a very brutal and naive way.
In the future, this seems worth to generalize and modularize this idea
so that zyxel-nwa-fit is just an instance of a more general output.

[1]: https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/ramips/image/mt7621.mk;h=ab1b829ba0086cb9fc9ca8cbbf3cbc14735034d6;hb=refs/heads/main#l3097

Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2024-02-18 20:30:41 +01:00
Raito Bezarius
e9ab8d7183 modules/outputs/ubivolume: introduce ubinization
It creates an UBI image based on an UBI volume configuration.

For now, it creates only an empty rootfs.
2024-02-18 20:30:41 +01:00
Raito Bezarius
3dc58de0eb modules/outputs: expose commandLineDtbNode option
We allow `bootargs` and `bootargs-override` for now only.

Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2024-02-18 20:30:41 +01:00
Raito Bezarius
dde8386f75 builders/uimage: support aligning the FIT
This is necessary when writing to a MTD partition with a certain erasesize.
2024-02-18 20:30:41 +01:00
Raito Bezarius
c59364d623 modules/outputs/ubifs: expose rootubifs rather than rootfs
I believe there should be another module exposing `rootubifs` as `rootfs`
or let any other module just subsume that component like `zyxel-nwa-fit` output.

Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2024-02-18 20:30:41 +01:00
Raito Bezarius
b76c5b4abe modules/ubifs: revamp to offer directly access to the UBIfs partition
Adds the LEB and PEB option and let the user remove the boot image in case
where U-Boot does not support UBI boot.
2024-02-18 20:30:41 +01:00
4bcc3d5b28 dhcpc6 scripts: simplify (and improve correctness) 2024-02-16 18:47:12 +00:00
c373152673 make tftpboot work on devices with old u-boot
Some devices have a U-boot variant that does not accept a third
parameter on the "bootm" command, meaning we can't override the dtb
in the bootloader so have to smush it back into the kernel image

This doesn't work in QEMU but I think the problem is with the
U-Boot configuration for QEMU. It does work on at least one
hardware device so I'm pushing it anyway

Based on
https://gti.telent.net/raboof/liminix/src/branch/tftp-old-uboot

Co-authored-by:  Arnout Engelen <arnout@bzzt.net>
2024-02-15 23:44:47 +00:00
7e7171556f subdue dnsmasq logs
we need to find a better way of doing this. people might _want_
to have All The Logs from evey dns query
2024-02-15 23:43:54 +00:00
ffe0e9d26b use mkstate for dropbear keys 2024-02-13 22:12:26 +00:00
2b22c7aa91 dnsmasq: store dhcp lease file on /persist 2024-02-13 21:54:45 +00:00
3c950704e1 rename /run/service-state to /run/services/outputs 2024-02-13 21:41:43 +00:00
3851698d35 fix tftpboot compressed rootfs 2024-02-13 18:16:17 +00:00
f69ebbb6f5 fix doc CI target 2024-02-13 15:41:45 +00:00
16e4b05653 dhcp6c: set preferred and valid address lifetimes
also workaround a bug in rebinding/updates where we get an error
from "ip addr add" trying to add an address that's already present
2024-02-13 13:49:12 +00:00
65479e206b use regular kernel not backports for mac80211
the kernel on most devices is now newer than the version that the
backported drivers were backported from
2024-02-12 20:41:10 +00:00
b9c0d93670 build modules at same time as main kernel vmlinux
This changes the practice for building kernel modules: now we expect
that the appropriate Kconfig symbols are set to =m in
config.kernel.config, and then use pkgs.kmodloader to create
a service that loads and unloads all the modules depended on by
a particular requirement.

Note that modules won't be installed on the target device just by
virue of having been built: only the modules that are referenced by a
kmodloader package will be in the closure.

An example may make this clearer: see modules/firewall/default.nix
in this commit.

Why?

If you have a compiled Linux kernel source tree and you change some
symbol from "is not set" to m and then run make modules, you cannot in
general expect that newly compiled module to work. This is because
there are places in the build of the main kernel where it looks to see
which modules _may_ be defined and uses that information to
accommodate them.

For example in an in-kernel build of

  https://github.com/torvalds/linux/blob/master/net/netfilter/core.c#L689

some symbols are defined only if CONFIG_NF_CONNTRACK is set, meaning
this code won't work if we have it unset initially then try later to
enable it and build modules only. Or see

  https://github.com/torvalds/linux/blob/master/include/linux/netdevice.h#L160
2024-02-11 23:47:11 +00:00
dce983ec79 move kernel module to its own subdir 2024-02-11 18:15:55 +00:00
812f497660 add kernel.version param to allow for version-specific patches
default to 5.15.137 to avoid breaking the devices that don't declare it
2024-02-11 16:19:52 +00:00
dan
273c66b2d3 Merge pull request 'Add support for TP-Link Archer AX23' (#6) from raboof/liminix:add-archer-ax23-v1-bak into main
Reviewed-on: #6
2024-02-08 17:47:46 +00:00
6f1f9d6f20 firewall: fix module loading 2024-02-07 23:43:41 +00:00
34291292c0 fix dependency on kernel moduels in firewall service 2024-02-07 16:21:14 +00:00
Arnout Engelen
61494fdc0c
Add tplink module for creating 'safeloader' images 2024-02-06 17:59:38 +01:00
c8154a2db9 kernel: add "conditional" config
imagine: you are using a device that requires
CONFIG_MYDEVICE_FROBOZZ_DRIVER but only if CONFIG_FROBOZZ has been
specified elsewhere. Because we check that every requested config
symbol actually appears in .config then it can't be added
unconditionally or the build will fail if CONFIG_FROBOZZ wasn't asked
for.

I'm not 100% happy about this design but it's the best I've thought of
so far.
2024-02-04 18:12:15 +00:00
89c88dd472 specify type for rootDevice module option 2024-02-02 19:50:13 +00:00
c1ad139310 whitespace 2024-02-02 19:43:34 +00:00
9e199c6957 tftpboot: compute dtbSize *after* changing dtb
Adding the reserved-memory node to the dtb can cause it to grow
by enough that it needs an extra page - this will overlap the start
of the kernel image if we calculate offsets based on the original size

Reported-by: sinavir
Authored-by: sinavir
2024-01-26 22:51:58 +00:00
dd8ec18881 restore boot.tftp.freeSpaceBytes 2024-01-26 22:46:36 +00:00
c219350d7c add usb storage for turris omnia
ideally we would make this a module instead of compiling in
directly
2024-01-26 22:46:36 +00:00
c1101d3af5 make extlinux work with liminix-rebuild
add /boot to the systemConfiguration closure
2024-01-08 18:58:07 +00:00
228c0a1668 pass rootOptions config as rootflags= kernel cmdline opt 2024-01-08 18:54:49 +00:00
7bc9cb6c55 why is extlink hardcoding root device? 2024-01-07 20:30:23 +00:00
3c941b4ce2 partial btrfs support
doesn't actually know how to make the filesystem, just
kernel config and accept it as a valid option
2024-01-07 16:43:43 +00:00
2a93f24a58 add turris "schnapps" tool
in its current state this is useful for turris omnia only, but will
allow us to do installs and rollback to turris os if needed.
2024-01-05 00:07:01 +00:00
64898eada8 mount tmpfs on /tmp
too much stuff doesn't work without it and it's not
all worth patching
2024-01-04 23:22:02 +00:00
ff991508ae build kernel only once for multiple outputs
e.g. vmlinux + zImage
2024-01-02 19:40:57 +00:00
921b4f24af boot.scr: append ; not \n to lzmadec command
this is simply to make copy-paste slightly more convenient
2024-01-01 20:21:42 +00:00
ec1ff283da vmdisk output: allow extra params to run.sh 2023-12-29 18:12:57 +00:00
0bf98c5243 add output for u-boot 2023-12-29 17:07:47 +00:00
dbf1ecdcb7 swap zimage and dtb in ram
kernel uncompression code creates a stack directly
after the compressed payload, which was trashing the dtb
2023-12-23 15:38:32 +00:00
1042be912c turris omnia: switch to regular tftpboot output
now it does zimage and rootfs compression
2023-12-23 00:05:34 +00:00
c931d84828 tftproot: put command line in dtb 2023-12-23 00:05:34 +00:00
64a3f50248 tftpboot: support compressed root 2023-12-23 00:05:34 +00:00
c5e9fcecc7 uninit var 2023-12-23 00:05:34 +00:00
f25c41b4d2 tftpboot: move things around in memory
new layout has rootfs followed by kernel and dtb, so that we
know the rootfs start and size to embed them into the dtb instead
of having to use dummy values and fill them in afterwards
2023-12-23 00:05:34 +00:00
bfa68d9c55 remove unused variable 2023-12-23 00:05:34 +00:00
ff0ef825a6 tftpboot: add option for kernel image format 2023-12-23 00:05:34 +00:00
44a0cf364b remove boot-scr output, merge into tftpboot
(1) it creates two things (script and dtb); (2) it's a bit pointless
without the tftpboot output it depends on
2023-12-22 21:37:15 +00:00
c7b2733bea tftpbootlz: put command line in dtb
this makes boot.scr substantially shorter, in anticipation of using it
for first boot of the omnia and not wanting to embed an essay in
a setenv value
2023-12-22 20:09:44 +00:00
dfbc72dd51 tftpboot test: fix reserved-memory dt for aarch64 2023-12-22 17:37:53 +00:00
231c2cef03 make reserved-memory work on mips, and improve test 2023-12-21 22:21:20 +00:00
32c13c46bb support aarch64 in tftpboot test 2023-12-19 12:12:12 +00:00
9ca9723c9d make rootfs work with tftpbootlz 2023-12-17 19:39:26 +00:00
d1e2d525a4 tftpboot omnia using bootz not bootm
because kernel size is now beyond the u-boot size
limit for bootm
2023-12-16 23:40:55 +00:00
80528376a2 move o.systemConfiguration to initramfs module
as far as I can tell, we define it identically in every module
that uses initramfs
2023-12-11 21:47:15 +00:00
d707345891 rename rootfsFiles to rootdir, add bootablerootdir 2023-12-11 21:21:12 +00:00
601bb289ee rename diskimage to mbrimage 2023-12-11 19:09:19 +00:00
876bd7d8ce rename flashimage to mtdimage 2023-12-11 19:09:18 +00:00
4ddce6e926 fix the tests we broke 2023-12-10 17:12:57 +00:00
5eeb277564 move output module imports example -> device
The outputs available are a characteristic of the device, not
the example.
2023-12-10 16:38:53 +00:00
c81e7c4d35 move all output modules to subdirectory, trash standard.nix
standard.nix isn't, is the essence here. Not all devices
support flashimage as it is currently defined - some
have diskimage, some have neither
2023-12-10 15:23:12 +00:00
4229b42d82 make config.hardware.dts.src nullable
This is for QEMU where we won't have to provide a dtb because the
device tree is built by the platform according the (emulated) hardware
present.

Maybe in future there will be other hardware devices where we
don't need to provide a dtb.
2023-12-09 15:51:30 +00:00
03b17fa3ed add zImage output 2023-12-07 22:31:26 +00:00
a8891461aa use devtmpfs in initramfs
static device nodes don't work with virtio
2023-12-07 20:03:03 +00:00
5adfb0230f WIP generate bootable disk image with partition table 2023-12-05 23:54:09 +00:00
3f74fad966 don't double-json the command line 2023-12-05 17:32:18 +00:00
ed925588f7 extract common code to make root filesystem hierarchy
which is then used by the filesystem image creators (ubifs, ext4,
jffs2 etc)
2023-12-05 17:32:18 +00:00
98d3336926 rewrite run-liminix-vm as a fennel program
the effect of shell quoting/word splitting rules was reaching
completely unreasonable, insofar as I was unable to reason about it
2023-12-03 22:51:39 +00:00
bb335050fd derivation that produces /boot 2023-12-02 15:31:55 +00:00
e518ab667b make job control work in console shell 2023-11-29 19:49:51 +00:00
cc73a98419 support setting network device names
this means that net devices in devices/foo/default.nix can be
specified by their sysfs paths (instead of by "eth0" and "eth1" that
may change from one kernel version to the next) and given mnenomic
names that are helpful for the hardware. Like "wan" and "lan[1..4]"
2023-11-26 23:15:28 +00:00
27ce61ae4e add bootable config for Turris Omnia 2023-11-24 23:29:12 +00:00
3df34428d6 remove unneeded login and getty applets 2023-11-23 20:01:13 +00:00