1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-17 04:51:31 +03:00
Commit Graph

56 Commits

Author SHA1 Message Date
Samuel Dionne-Riel
fd0a9856bd boot/init: publish desire for recovery mode 2020-11-22 16:53:03 -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
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
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
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
6692f6d6f4 boot/init: Use the new error reporting applet 2020-03-09 19:45:49 -04:00
Samuel Dionne-Riel
95016e1250 boot/init: Add autoResize support 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
462a3ae2e7 boot/init: System.write for hard reboot 2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
4f83d41d33 boot/init: Add System.write alias
This does the same thing as `File.write`, but with debug logging.
2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
c868bcea46 boot/init: Add network interface dependencies 2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
711a521f54 boot/init: Allows dependencies as an OR 2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
e41e35a84b boot/init: Fix mounting special filesystems with devices 2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
6354a156dd boot/init: Add Dir.children monkey patch 2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
cd74c94fde boot/init: De-hardcode /mnt 2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
7dff001d75 boot/init: Prefer running UX tasks first
This ensures graphical progress is shown ASAP when dependencies are
equally likely to run.

Otherwise, when the graphical step was ready, and switchroot about to
run, the shell step could run before the splash. This means that, in
practice, a long running task like e2fsck could have prevented the
splash to show. It doesn't make sense to make the other tasks depend on
a splash task!

There is no intention to implement any other special-cased ordering. If
there is the need to, it might mean that there is a deficiency in the
design.
2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
a3c8cd78e8 boot/init: Sort tasks before running them
This is partly to reduce the amount of loops it needs to run, but mainly
to control the order rather than rely on the order they were added in.

The control of order seems weird in a dependency-based system, but it'll
be used mainly for one thing in the next commit...
2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
bdee7cf0e0 boot/init: Removes SingletonTask special dependency
Instead, rely on targets.

Additionally removes the "Boot" special dependency which only made sense
when it was expected that having no dependency was an error.
2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
046dcdc8ea boot/init: Register singleton tasks only once 2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
62b7b47117 boot/init: Add System.spawn porcelain 2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
a81afccbb8 cleanup: Move initrd-fail settings in boot/init 2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
01e298eafc boot/init: Make failure to splash not fatal
That is, some devices, notable google-walleye, fail to show the splash
for yet unknown reasons.
2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
30dd9259af boot/init: Fixup bug with System,pretty_command change
The prettified command ended up missing from the debug log.
2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
75454e4ba5 boot/init: Add System.exec and System.which 2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
3c9b5057c0 boot/init: Handles generic mounting
This implements reading the configuration to know about mount points.
2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
b804ca6c5f boot/init: Adds graphical failure
Though, not sure I exactly like the way it's done here.
2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
7eb1f81b3e boot/init: Allow passing options to System.mount 2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
741b3f3fa7 boot/init: Minor logging rewording 2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
8b4ae5b2fc boot/init: Logger is configurable 2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
971a7241f6 boot/init: fulfilled -> fulfilled? 2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
555548d3f4 boot/init: Review how configuration is loaded and used
This way it can be used at any time, regardless of execution state, as
long as the Configuration module has been parsed.
2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
a6bb2aa3a7 boot/init: Fix printing debug info for unfulfilled Files 2020-02-03 16:19:10 -05:00
Samuel Dionne-Riel
5208741f3c boot/init: Fix pretty printing shelled out commands 2020-02-03 16:19:10 -05:00