1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-17 21:11:34 +03:00
Commit Graph

107 Commits

Author SHA1 Message Date
Samuel Dionne-Riel
b82492a565 boot/init: Use kexec only in stage-0. 2020-12-27 17:50:30 -05:00
Samuel Dionne-Riel
eed796865e boot/init: Use configurable stage value 2020-12-27 17:50:30 -05:00
Samuel Dionne-Riel
6ad92214da boot/init: switch_root can and will kexec
This is partly complete; we need to handle the situation where **only**
stage-0 should kexec into the next system.

This is yet to be implemented, but will be done through a configuration
that transforms the current bootloader-launched stage-1 into a stage-0,
while keeping the on-disk stage-1 stage-1.
2020-12-27 17:50:30 -05:00
Samuel Dionne-Riel
812b02dd32 boot/init: Fix partial teardown for splash
`#quit` would leave the `@pid` variable around, which in turn meant that
calling `#kill` after would fail since the process was already gone.
2020-12-27 17:50:30 -05:00
Samuel Dionne-Riel
2ab969db37 boot: LUKS errors are "controlled"
This means that we shouldn't raise an exception, but rather fail
outright. The background being black means that things *failed
successfully*, as expected.
2020-11-30 20:45:03 -05:00
Samuel Dionne-Riel
fd0a9856bd boot/init: publish desire for recovery mode 2020-11-22 16:53:03 -05:00
Samuel Dionne-Riel
67957f4972 boot/init: Move recovery detection to an abstraction layer 2020-11-22 16:53:03 -05:00
Samuel Dionne-Riel
841b835b05 boot/init: update comments in switch_root
It better describes the reasoning for the keys than the previous
"off-the-cuff" comment I left myself.
2020-11-22 16:48:32 -05:00
Samuel Dionne-Riel
0037614821 boot/init: Use the new evdev library
It still uses evdev internally, but first let's change the interface,
*then* change the implementation details.
2020-11-22 16:48:32 -05:00
Samuel Dionne-Riel
dbfbdf385b boot/init: Add error title in addition to code 2020-11-12 23:13:20 -05:00
Samuel Dionne-Riel
03022f2745 boot/init: Pass structured data through a file to crash handler
The command-line arguments are not great for structured data.
2020-11-12 23:13:20 -05:00
Samuel Dionne-Riel
aa1c2f3744 boot/init: Harmonized failure methods
- Code is now more of a title
 - Only one code path exists to the applet
2020-11-12 23:13:20 -05:00
Samuel Dionne-Riel
00f81fa95c boot/init: Handle hung tasks
The way we're handling them is to have a global timer that is reset at
any point a task is ran.

This gives a maximum amount of chances to any task to have its
dependencies resolve.

A minimum of 60s is given, but in reality the chances are the conditions
for trying to resolve were already present before the timeout started
counting towards that particular dependency.

Note that a long running task, when successfully ran, does not cause the
timeout to be reached.

E.g. at 10s of timeout a task is started, the loop is not executed until
the task exits. When it exits the branch followed is for a task that
ran, which means that even if the task took 70s total (which gives us 80
seconds) a timeout of 60s wouldn't apply here.

Though, please, don't make your tasks take that much time to run!
2020-11-07 20:13:31 -05:00
Samuel Dionne-Riel
d41c454514 boot/init: Add Devices dependency type
It's a Files dependency, but with just a bit more user friendliness when
used in an error message.
2020-11-07 20:13:31 -05:00
Samuel Dionne-Riel
31f45c5baa boot/init: Add user-friendlier names to dependencies 2020-11-07 20:13:31 -05:00
Samuel Dionne-Riel
a819a8930e boot/init: Cleanup failure
- exit after everything happened, just in case
 - exit the progress display
 - allow a custom delay to be set
2020-11-07 20:13:31 -05:00
Samuel Dionne-Riel
36aa305f27 boot/init: Add LUKS device support 2020-11-07 19:22:33 -05:00
Samuel Dionne-Riel
f45b5b301c boot/init: Implement asking user 2020-11-07 19:22:33 -05:00
Samuel Dionne-Riel
eaf8fa9dde boot/init: Long running tasks can export a label
With the same tooling we will be able to ask for a throbber or some
other kind of work indicator.
2020-11-07 19:22:33 -05:00
Samuel Dionne-Riel
c80476a047 boot/init: Rework Progress into a "state stash"
This way we really only update the current state bit we want to affect.
2020-11-07 19:22:33 -05:00
Samuel Dionne-Riel
e891e2f752 boot/init: Minimal changes required to continue working
These changes implement the different protocol changes.
2020-11-07 19:22:33 -05:00
Samuel Dionne-Riel
d929d798fe boot/init: auto-resize task shows a message 2020-11-06 16:30:22 -05:00
Samuel Dionne-Riel
bd030cbe73 boot/init: Add required plumbing to control the forked process 2020-11-06 16:30:22 -05:00
Samuel Dionne-Riel
9b85943be1 boot/init: Add progress tracking 2020-11-06 16:30:22 -05:00
Samuel Dionne-Riel
ef436a64b1 boot/init: More verbose tasks loop in DEBUG 2020-10-27 15:23:40 -04:00
Samuel Dionne-Riel
99a7671769 boot/init: Ensure graphics setup is also a UX priority 2020-10-27 15:23:40 -04:00
Samuel Dionne-Riel
0365079e1f boot/init: Tasks restart the queue
This is to ensure "UX-friendly" tasks gets run ASAP.

Quickly explained, this makes sure that the top tasks (e.g. Splash) gets
ran as soon as possible.

Given the list:

 - Splash
 - Graphics
 - AAA
 - BBB
 - CCC

If `Graphics` ends up running, and AAA, BBB and CCC can too, Splash will
have to wait until all those tasks got ran once!

Not ideal for UX, if e.g. BBB takes time to *run* and we can't show the
progress to users!

The added cost of restarting the queue is minimal with tests I ran. It
was not more than a tenth of a second, and could even be rounding
errors.
2020-10-27 15:23:40 -04:00
Samuel Dionne-Riel
2542487348 boot/init: Improve Task#to_s for better inspection 2020-10-27 15:23:40 -04:00
Samuel Dionne-Riel
cf84880e87 boot/init: clean-up logger initialization 2020-10-27 15:23:40 -04:00
Samuel Dionne-Riel
1cee1c681b boot/init: Log offset from logger init
This gives us a better idea, relatively, when things happen to be
logged.
2020-10-27 15:23:40 -04:00
Samuel Dionne-Riel
cf49659fe3 boot/init: Add CLOCK_MONOTONIC output at boot 2020-10-27 15:23:40 -04:00
Samuel Dionne-Riel
b38caeec1a boot/init: Fixup for $PROGRAM_NAME now pointing to the applet
We know that the loader is at "/loader" in our initrd. Use that
knowledge.
2020-05-31 18:54:07 -04:00
Samuel Dionne-Riel
ba9a9852af boot/init: Remove unused variable 2020-05-23 01:43:12 -04:00
Samuel Dionne-Riel
6692f6d6f4 boot/init: Use the new error reporting applet 2020-03-09 19:45:49 -04:00
Samuel Dionne-Riel
c35116cdcd boot/init: Use the new boot/splash applet 2020-03-09 17:34:31 -04:00
Samuel Dionne-Riel
12c9d29f58 boot/init: Use the newly split script-loader 2020-03-01 23:27:56 -05:00
Samuel Dionne-Riel
11897bcdb6 boot/script-loader: Split into its distinct package 2020-03-01 22:21:31 -05:00
Samuel Dionne-Riel
20f2cbcc56 init: Interrupt boot when some keys are held. 2020-02-29 16:10:00 -05:00
Samuel Dionne-Riel
d79466747d boot/init: Launch boot GUI when asked 2020-02-29 16:10:00 -05:00
Samuel Dionne-Riel
3b9d04d3bd stage-1: workaround issue with e2fsck successfully failing 2020-02-28 23:14:09 -05:00
Samuel Dionne-Riel
26b4215547 boot/init: Add newly required dependencies 2020-02-28 23:14:09 -05:00
Samuel Dionne-Riel
68e4c2b7f3 boot/init: Split interpreter from script
This needs the following commits where the init script will now tell the
loader to load init.mrb
2020-02-28 23:14:09 -05:00
Samuel Dionne-Riel
95016e1250 boot/init: Add autoResize support 2020-02-03 21:58:22 -05:00
Samuel Dionne-Riel
7e9a7875ac boot/init: Mark as 0.1 2020-02-03 21:58:22 -05:00
Samuel Dionne-Riel
c4f76db65f boot/init: Handle remounting existing mounts
This is used to ensure mount points are mounted with the right options,
if for some reason they were already mounted.

Reasons they could be mounted? They could have been required for things
like logging the boot.
2020-02-03 21:58:21 -05:00
Samuel Dionne-Riel
8962b595f5 boot/init: brown sad phone on main failure 2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
d349e66554 boot/init: Use System#shell if available on failure
When it is available, it is assumed it is okay to use.
2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
67f907c952 initrd: System.write for login environment tasks 2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
75020873c8 initrd: System.write for graphics tasks 2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
462a3ae2e7 boot/init: System.write for hard reboot 2020-02-03 16:19:10 -05:00