Commit Graph

94 Commits (6870abfe83b25b846810dd4732623266d2bfa79f)

Author SHA1 Message Date
Daniel Barlow 67768004ee erase full flash, it seems to help with jffs2 2023-04-26 22:19:01 +01:00
Daniel Barlow 26c6eac937 delete config boot.tftp.enable as it doesn't enable anything 2023-04-26 22:18:23 +01:00
Daniel Barlow 4cfaed7303 specify root device as /dev/mtdblockn
the (openwrt?) magic that autodetects it based on mtd labels
won't work with a two-stage boot
2023-04-26 22:16:15 +01:00
Daniel Barlow 6d6dbe1cbb tftpboot: allow padding image with freeSpaceBytes
this is useful for writable filesystems so that there's more than
an erase block of space to write into
2023-04-26 22:15:19 +01:00
Daniel Barlow 2f3b108ef1 tftpboot: set phram erase block size to match hardware
this is needed for tftp boot with a jffs2 filesystem
2023-04-23 21:24:37 +01:00
Daniel Barlow 2c4f8b823e remove jffs2boot target
It's not needed now initramfs is compiled into the kernel.
2023-04-23 20:56:20 +01:00
Daniel Barlow 99af416e14 use /bin/sh for init scripts 2023-04-19 21:41:05 +01:00
Daniel Barlow 5dd0c6e3c0 rewrite preinit as very small C program
By using the kernel "nolibc" header to avoid requiring a C library, we
can bring the initramfs size to around 4k

This does involve a tiny bit of inline mips assembly which I'm not
sure about. gcc seems unwilling to generate the code to load $gp at
function entry of main(), so we do it by hand - but I'd rather find
out why gcc doesn't.
2023-04-15 18:27:39 +01:00
Daniel Barlow b1a89ae8c3 jffs2: squash uids, enable lzo compression 2023-04-15 17:23:58 +01:00
Daniel Barlow 1cc0b13b57 rewrite systemconfig in C and link statically
systemconfig (a.k.a "activate") is run from the initramfs. Converting
it from a shell script to an executable means it doesn't depend on
there being a shell in the initramfs
2023-04-15 17:21:27 +01:00
Brian McKenna fb796e61e0 pseudofile: allow setting uid and gid of files
Necessary for Dropbear to accept non-root authorized_keys files.
2023-04-14 23:12:52 +01:00
Daniel Barlow 9f3c80e774 make initramfs busybox (very slightly) smaller 2023-04-11 23:08:02 +01:00
Daniel Barlow 2566dc564c remove need for symlinks in initramfs busybox 2023-04-10 22:57:50 +01:00
Daniel Barlow 0ad7b0e48b don't hardcode mtd0 initramfs->second stage 2023-04-10 22:57:50 +01:00
Daniel Barlow 0a2881914b set erase block size to something that works for jffs2 2023-04-10 22:57:50 +01:00
Daniel Barlow 4638092d3d build initramfs into kernel
this doesn't matter for qemu, but there's no other way of
getting a hardware device to find it if the bootloader
won't co-operate
2023-04-10 22:57:50 +01:00
Daniel Barlow 633a4f8003 move BLK_DEV_INITRD to base.nix 2023-04-10 22:57:50 +01:00
Daniel Barlow 42725f56f9 make jffs2 module provide o.rootfs, conditionally
it's enabled if config.rootfsType == "jffs2"
2023-04-10 20:01:58 +01:00
Daniel Barlow 63a89f7d0d add config.boot.initramfs.enable 2023-04-10 19:07:27 +01:00
Daniel Barlow 07eb3d66da remove unused combined-image output 2023-04-10 18:15:48 +01:00
Daniel Barlow 0687ae7f5c rename flashable->flashimage, o.squashfs to rootfs
"rootfs" describes what it is for, "squashfs" merely says
how it's implemented

(also, rootfs-as-jffs2 will soon be added)
2023-04-10 18:13:27 +01:00
Daniel Barlow f5156425a2 correct jffs2 endian, remove unused bindings 2023-04-07 09:39:47 +01:00
Daniel Barlow 54a1ab3529 support jffs2, with initramfs
the jffs2 filesystem contains only /nix/store and a script which is
run in early init (initramfs) and is responsible for recreating
"traditional" directories (/bin /etc/**/* /var &c) based on the
configuration.

this is tested only in qemu so far and could use some cleanup
2023-04-04 23:35:49 +01:00
Daniel Barlow 25d9da967c remove support for sockets in pseudofiles
(1) we can't make them on a real filesystem except by running
something that calls socket()
(2) whyever would we want to?
2023-04-04 23:23:22 +01:00
Daniel Barlow f5a7b78679 rename kexec-tools-static
it doesn't build natively on x86-64 and I don't suppose we need it to
anyway
2023-03-24 20:51:46 +00:00
Daniel Barlow c831859513 add flashcp to allow flashing from a running system 2023-03-24 17:32:46 +00:00
Daniel Barlow 045f10e79b build kexec statically 2023-03-24 17:12:19 +00:00
Daniel Barlow a5cfa37ed3 unify kernel command line handling
We now use MIPS_CMDLINE_DTB_EXTEND for all boot varieties
(tftpboot, flash boot, kexec) with the addition of
MIPS_BOOTLOADER_CMDLINE_REQUIRE_COOKIE - local patch -
so that the bootloader args are ignored unless they
contain the string "liminix"
2023-03-23 22:24:44 +00:00
Daniel Barlow 8250d592ba don't hardcode root device, too confusing when adding phram 2023-03-19 20:27:05 +00:00
Daniel Barlow 4b19568f1b add kexecboot
This allows booting a new image from a running OS, creating a
phram mtd for the root squashfs

* enable CONFIG_KEXEC
* add modules/kexecboot
* patch kexec-tools to add --map-file option for the squashfs
* patch kernel kexec code to call new kernel with DTB
2023-03-19 20:25:43 +00:00
Daniel Barlow b85492c744 when flashing, only need to erase the space we're writing 2023-03-18 14:50:09 +00:00
Daniel Barlow 3c6ec354ce move root's home directory to /home/root
/ is a bad choice of home directory

/home/root instead of /root is to make it easier to write
ssh keys to the right place
2023-03-18 14:46:50 +00:00
Daniel Barlow e78d5212e6 move tftp config to base module
we need it for flashing from u-boot even when tftp booting
is not enabled
2023-03-18 14:45:51 +00:00
Daniel Barlow ce05f4e44c extract phram.mtd ramdisk support from tftpboot module
also rename tftproot output to tftpboot for consistency
2023-03-18 14:30:10 +00:00
Daniel Barlow 3efa9e0af2 restore missing applets 2023-03-10 23:14:13 +00:00
Daniel Barlow f2d1789ad7 add openssh authorized_keys 2023-03-10 23:13:32 +00:00
Daniel Barlow 225fc6fe51 configurable busybox
allows modules to add to the busybox applets and change config
2023-03-10 18:40:45 +00:00
Daniel Barlow 43f1fb230b remove unrecoginsed earlyprintk param from kernel commandline 2023-03-10 00:50:28 +00:00
Daniel Barlow d83bcc643e 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
2023-03-10 00:48:47 +00:00
Daniel Barlow 91c0147919 set hostname before dhcp client runs 2023-03-08 22:11:59 +00:00
Daniel Barlow f36d8ef1d0 make mt300a flash-ready 2023-03-08 20:35:41 +00:00
Daniel Barlow bfbbe00d58 describe role of flash config 2023-03-07 22:36:48 +00:00
Daniel Barlow fec77a44b5 DRY loopback interface, it's the same everywhere 2023-03-07 22:36:48 +00:00
Daniel Barlow e8d5e4c788 move regulatory.db to wlan module 2023-03-07 21:32:21 +00:00
Daniel Barlow 08bed15cf8 ssh service
- dropbear
- generate host keys on first use
- mount /dev/pts

It's not ideal having the host key disappear when the device is
reboot, but without persistent storage the alternative is generating
it at build time. Deferring this problem to another time
2023-03-04 12:10:06 +00:00
Daniel Barlow a3cdc32142 define structured options for config.users 2023-03-04 00:24:48 +00:00
Daniel Barlow e0ea576674 rename "device" config tree as "hardware"
we are also using "device" for "network device" (as in eth0,
wlan0 etc) so this makes it a bit less confusing perhaps
2023-03-03 22:52:33 +00:00
Daniel Barlow 263882cbe4 move dts config option from boot to device 2023-03-03 22:43:44 +00:00
Daniel Barlow bbd699d7b1 add module for device-specific config
in principle this module declares the config that's defined in
devices/foo/default.nix
2023-03-03 20:04:39 +00:00
Daniel Barlow 0cd1bd99e1 declare device.flash options in base.nix
because they're specified in devices/*/default.nix
2023-03-02 23:28:39 +00:00