CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
orangepi-xunlong

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: orangepi-xunlong/orangepi-build
Path: blob/next/external/patch/misc/0010-bootsplash.patch
Views: 3959
1
diff --git a/Documentation/ABI/testing/sysfs-platform-bootsplash b/Documentation/ABI/testing/sysfs-platform-bootsplash
2
new file mode 100644
3
index 000000000000..742c7b035ded
4
--- /dev/null
5
+++ b/Documentation/ABI/testing/sysfs-platform-bootsplash
6
@@ -0,0 +1,11 @@
7
+What: /sys/devices/platform/bootsplash.0/enabled
8
+Date: Oct 2017
9
+KernelVersion: 4.14
10
+Contact: Max Staudt <[email protected]>
11
+Description:
12
+ Can be set and read.
13
+
14
+ 0: Splash is disabled.
15
+ 1: Splash is shown whenever fbcon would show a text console
16
+ (i.e. no graphical application is running), and a splash
17
+ file is loaded.
18
diff --git a/Documentation/bootsplash.rst b/Documentation/bootsplash.rst
19
new file mode 100644
20
index 000000000000..611f0c558925
21
--- /dev/null
22
+++ b/Documentation/bootsplash.rst
23
@@ -0,0 +1,285 @@
24
+====================
25
+The Linux bootsplash
26
+====================
27
+
28
+:Date: November, 2017
29
+:Author: Max Staudt <[email protected]>
30
+
31
+
32
+The Linux bootsplash is a graphical replacement for the '``quiet``' boot
33
+option, typically showing a logo and a spinner animation as the system starts.
34
+
35
+Currently, it is a part of the Framebuffer Console support, and can be found
36
+as ``CONFIG_BOOTSPLASH`` in the kernel configuration. This means that as long
37
+as it is enabled, it hijacks fbcon's output and draws a splash screen instead.
38
+
39
+Purely compiling in the bootsplash will not render it functional - to actually
40
+render a splash, you will also need a splash theme file. See the example
41
+utility and script in ``tools/bootsplash`` for a live demo.
42
+
43
+
44
+
45
+Motivation
46
+==========
47
+
48
+- The '``quiet``' boot option only suppresses most messages during boot, but
49
+ errors are still shown.
50
+
51
+- A user space implementation can only show a logo once user space has been
52
+ initialized far enough to allow this. A kernel splash can display a splash
53
+ immediately as soon as fbcon can be displayed.
54
+
55
+- Implementing a splash screen in user space (e.g. Plymouth) is problematic
56
+ due to resource conflicts.
57
+
58
+ For example, if Plymouth is keeping ``/dev/fb0`` (provided via vesafb/efifb)
59
+ open, then most DRM drivers can't replace it because the address space is
60
+ still busy - thus leading to a VRAM reservation error.
61
+
62
+ See: https://bugzilla.opensuse.org/show_bug.cgi?id=980750
63
+
64
+
65
+
66
+Command line arguments
67
+======================
68
+
69
+``bootsplash.bootfile``
70
+ Which file in the initramfs to load.
71
+
72
+ The splash theme is loaded via request_firmware(), thus to load
73
+ ``/lib/firmware/bootsplash/mytheme`` pass the command line:
74
+
75
+ ``bootsplash.bootfile=bootsplash/mytheme``
76
+
77
+ Note: The splash file *has to be* in the initramfs, as it needs to be
78
+ available when the splash is initialized early on.
79
+
80
+ Default: none, i.e. a non-functional splash, falling back to showing text.
81
+
82
+
83
+
84
+sysfs run-time configuration
85
+============================
86
+
87
+``/sys/devices/platform/bootsplash.0/enabled``
88
+ Enable/disable the bootsplash.
89
+ The system boots with this set to 1, but will not show a splash unless
90
+ a splash theme file is also loaded.
91
+
92
+
93
+
94
+Kconfig
95
+=======
96
+
97
+``BOOTSPLASH``
98
+ Whether to compile in bootsplash support
99
+ (depends on fbcon compiled in, i.e. ``FRAMEBUFFER_CONSOLE=y``)
100
+
101
+
102
+
103
+Bootsplash file format
104
+======================
105
+
106
+A file specified in the kernel configuration as ``CONFIG_BOOTSPLASH_FILE``
107
+or specified on the command line as ``bootsplash.bootfile`` will be loaded
108
+and displayed as soon as fbcon is initialized.
109
+
110
+
111
+Main blocks
112
+-----------
113
+
114
+There are 3 main blocks in each file:
115
+
116
+ - one File header
117
+ - n Picture headers
118
+ - m (Blob header + payload) blocks
119
+
120
+
121
+Structures
122
+----------
123
+
124
+The on-disk structures are defined in
125
+``drivers/video/fbdev/core/bootsplash_file.h`` and represent these blocks:
126
+
127
+ - ``struct splash_file_header``
128
+
129
+ Represents the file header, with splash-wide information including:
130
+
131
+ - The magic string "``Linux bootsplash``" on big-endian platforms
132
+ (the reverse on little endian)
133
+ - The file format version (for incompatible updates, hopefully never)
134
+ - The background color
135
+ - Number of picture and blob blocks
136
+ - Animation speed (we only allow one delay for all animations)
137
+
138
+ The file header is followed by the first picture header.
139
+
140
+
141
+ - ``struct splash_picture_header``
142
+
143
+ Represents an object (picture) drawn on screen, including its immutable
144
+ properties:
145
+ - Width, height
146
+ - Positioning relative to screen corners or in the center
147
+ - Animation, if any
148
+ - Animation type
149
+ - Number of blobs
150
+
151
+ The picture header is followed by another picture header, up until n
152
+ picture headers (as defined in the file header) have been read. Then,
153
+ the (blob header, payload) pairs follow.
154
+
155
+
156
+ - ``struct splash_blob_header``
157
+ (followed by payload)
158
+
159
+ Represents one raw data stream. So far, only picture data is defined.
160
+
161
+ The blob header is followed by a payload, then padding to n*16 bytes,
162
+ then (if further blobs are defined in the file header) a further blob
163
+ header.
164
+
165
+
166
+Alignment
167
+---------
168
+
169
+The bootsplash file is designed to be loaded into memory as-is.
170
+
171
+All structures are a multiple of 16 bytes long, all elements therein are
172
+aligned to multiples of their length, and the payloads are always padded
173
+up to multiples of 16 bytes. This is to allow aligned accesses in all
174
+cases while still simply mapping the structures over an in-memory copy of
175
+the bootsplash file.
176
+
177
+
178
+Further information
179
+-------------------
180
+
181
+Please see ``drivers/video/fbdev/core/bootsplash_file.h`` for further
182
+details and possible values in the file.
183
+
184
+
185
+
186
+Hooks - how the bootsplash is integrated
187
+========================================
188
+
189
+``drivers/video/fbdev/core/fbcon.c``
190
+ ``fbcon_init()`` calls ``bootsplash_init()``, which loads the default
191
+ bootsplash file or the one specified on the kernel command line.
192
+
193
+ ``fbcon_switch()`` draws the bootsplash when it's active, and is also
194
+ one of the callers of ``set_blitting_type()``.
195
+
196
+ ``set_blitting_type()`` calls ``fbcon_set_dummyops()`` when the
197
+ bootsplash is active, overriding the text rendering functions.
198
+
199
+ ``fbcon_cursor()`` will call ``bootsplash_disable()`` when an oops is
200
+ being printed in order to make a kernel panic visible.
201
+
202
+``drivers/video/fbdev/core/dummyblit.c``
203
+ This contains the dummy text rendering functions used to suppress text
204
+ output while the bootsplash is shown.
205
+
206
+``drivers/tty/vt/keyboard.c``
207
+ ``kbd_keycode()`` can call ``bootsplash_disable()`` when the user
208
+ presses ESC or F1-F12 (changing VT). This is to provide a built-in way
209
+ of disabling the splash manually at any time.
210
+
211
+
212
+
213
+FAQ: Frequently Asked Questions
214
+===============================
215
+
216
+I want to see the log! How do I show the log?
217
+---------------------------------------------
218
+
219
+Press ESC while the splash is shown, or remove the ``bootsplash.bootfile``
220
+parameter from the kernel cmdline. Without that parameter, the bootsplash
221
+will boot disabled.
222
+
223
+
224
+Why use FB instead of modern DRM/KMS?
225
+-------------------------------------
226
+
227
+This is a semantic problem:
228
+ - What memory to draw the splash to?
229
+ - And what mode will the screen be set to?
230
+
231
+Using the fbdev emulation solves these issues.
232
+
233
+Let's start from a bare KMS system, without fbcon, and without fbdev
234
+emulation. In this case, as long as userspace doesn't open the KMS
235
+device, the state of the screen is undefined. No framebuffer is
236
+allocated in video RAM, and no particular mode is set.
237
+
238
+In this case, we'd have to allocate a framebuffer to show the splash,
239
+and set our mode ourselves. This either wastes a screenful of video RAM
240
+if the splash is to co-exist with the userspace program's own allocated
241
+framebuffer, or there is a flicker as we deactivate and delete the
242
+bootsplash's framebuffer and hand control over to userspace. Since we
243
+may set a different mode than userspace, we'd also have flicker due
244
+to mode switching.
245
+
246
+This logic is already contained in every KMS driver that performs fbdev
247
+emulation. So we might as well use that. And the correct API to do so is
248
+fbdev. Plus, we get compatibility with old, pure fbdev drivers for free.
249
+With the fbdev emulation, there is *always* a well-defined framebuffer
250
+to draw on. And the selection of mode has already been done by the
251
+graphics driver, so we don't need to reinvent that wheel, either.
252
+Finally, if userspace decides to use /dev/fbX, we don't have to worry
253
+about wasting video RAM, either.
254
+
255
+
256
+Why is the bootsplash integrated in fbcon?
257
+------------------------------------------
258
+
259
+Right now, the bootsplash is drawn from within fbcon, as this allows us
260
+to easily know *when* to draw - i.e. when we're safe from fbcon and
261
+userspace drawing all over our beautiful splash logo.
262
+
263
+Separating them is not easy - see the to-do list below.
264
+
265
+
266
+
267
+TO DO list for future development
268
+=================================
269
+
270
+Second enable/disable switch for the system
271
+-------------------------------------------
272
+
273
+It may be helpful to differentiate between the system and the user
274
+switching off the bootsplash. Thus, the system may make it disappear and
275
+reappear e.g. for a password prompt, yet once the user has pressed ESC,
276
+it could stay gone.
277
+
278
+
279
+Fix buggy DRM/KMS drivers
280
+-------------------------
281
+
282
+Currently, the splash code manually checks for fbdev emulation provided by
283
+the ast, cirrus, and mgag200 DRM/KMS drivers.
284
+These drivers use a manual mechanism similar to deferred I/O for their FB
285
+emulation, and thus need to be manually flushed onto the screen in the same
286
+way.
287
+
288
+This may be improved upon in several ways:
289
+
290
+1. Changing these drivers to expose the fbdev BO's memory directly, like
291
+ bochsdrmfb does.
292
+2. Creating a new fb_ops->fb_flush() API to allow the kernel to flush the
293
+ framebuffer once the bootsplash has been drawn into it.
294
+
295
+
296
+Separating from fbcon
297
+---------------------
298
+
299
+Separating these two components would yield independence from fbcon being
300
+compiled into the kernel, and thus lowering code size in embedded
301
+applications.
302
+
303
+To do this cleanly will involve a clean separation of users of an FB device
304
+within the kernel, i.e. fbcon, bootsplash, and userspace. Right now, the
305
+legacy fbcon code and VT code co-operate to switch between fbcon and
306
+userspace (by setting the VT into KD_GRAPHICS mode). Installing a muxer
307
+between these components ensues refactoring of old code and checking for
308
+correct locking.
309
diff --git a/MAINTAINERS b/MAINTAINERS
310
index 5c237445761e..7ffac272434e 100644
311
--- a/MAINTAINERS
312
+++ b/MAINTAINERS
313
@@ -2709,6 +2709,8 @@ BOOTSPLASH
314
M: Max Staudt <[email protected]>
315
L: [email protected]
316
S: Maintained
317
+F: Documentation/ABI/testing/sysfs-platform-bootsplash
318
+F: Documentation/bootsplash.rst
319
F: drivers/video/fbdev/core/bootsplash*.*
320
F: drivers/video/fbdev/core/dummycon.c
321
F: include/linux/bootsplash.h
322
323