`mke2fs` has a `-d` option that allows to populate the newly created filesystem without needing to temporarily mount it. That allows to use `parted` and `mkfs.ext3` on regular files without needing root access.
The Linux kernel won't autocreate /dev/shm inside devtmpfs.
Without it, semaphores won't work properly in Python.
Previously, /dev/shm was set up in populate_device_nodes, but we
no longer run that after booting into Linux.
The sysrq shutdown trigger takes some time to fully shut down the system,
during which init is expected to continue running. Since after.sh is the
last step in our init, if it quits before shutdown is complete, Linux will
panic with "Attempted to kill init".
Add an infinite loop after shutdown is issued via sysrq to prevent this.
This was removed as part of the simplify refactor, severely slowing
down qemu and bare-metal builds. Restoring it brings us back to the
same build times that we saw before the refactor.
Perform variable substitution at runtime, rather than at generation
time. This way, if bootstrap.cfg changes after update_env, the new
values there take effect immediately.
This adds a new flag, -i / --interactive, which enables opening a
Bash prompt whenever something goes wrong in the bootstrap. This is
highly useful when developing or debugging live-bootstrap, but it
needs to be off by default, for use in automated processes.
In the future, asking for variables at runtime could (and perhaps
should) also be gated behind this flag.
* Enable additional hardware drivers in Linux for better bare metal
display, network & input device compatibility
* Disable ATA-over-Ethernet support, because it spams the network
with unnecessary packets, is basically useless for bootstrapping,
and may even be a security risk
* Increase Fiwix initrd size to 1280MB to fit a larger Linux build
* Make the Fiwix kexec size configurable the same way as initrd
(and reduce from 280MB to 256MB which is sufficient in my testing)
* Use a more conservative memory map for Fiwix & Linux
* Boot Linux with consoleblank=0 on bare metal, so the build won't
go blind after 5 minutes
* Support kexec-fiwix with interrupts disabled (will be useful later
when builder-hex0 is updated)
* Use -S32 -H64 --force to trick sfdisk into allowing MiB-aligned
partitions on a drive that reports a CHS geometry
* Explicitly create partition at sector 2097152 (=1GiB)
* Force mkfs.ext4 to overwrite any existing filesystem it might find
* Wait up to 2 minutes for the disk to become readable (especially
USB drives often show up with a delay)
With this, finalize_fhs.sh can be rerun as needed, e.g. when rebooting.
Also, the preferred nameserver will persist after DHCP.
Thanks to devtmpfs, we no longer need to manage /dev once Linux is up.