Skip to content

Commit 86b02a0

Browse files
macpijansbabic
authored andcommitted
doc: bootloader abstraction, GRUB support
Adjusted documentation according to bootloader abstraction and GRUB bootloader support. A few u-boot -> U-Boot in text Signed-off-by: Maciej Pijanowski <[email protected]>
1 parent 7df0a28 commit 86b02a0

File tree

6 files changed

+61
-44
lines changed

6 files changed

+61
-44
lines changed

doc/source/handlers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ In mainline there are the handlers for the most common cases. They include:
2424
- flash devices in raw mode (both NOR and NAND)
2525
- UBI volumes
2626
- raw devices, such as a SD Card partition
27-
- U-Boot environment
27+
- bootloader (U-Boot, GRUB) environment
2828
- LUA scripts
2929

3030
For example, if an image is marked to be updated into a UBI volume,

doc/source/overview.rst

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ is corrupted or cannot run.
233233
With U-Boot as boot loader, SWUpdate is able to manage U-Boot's environment
234234
setting variables to indicate the start and the end of a transaction and
235235
that the storage contains a valid software.
236+
Similar feature for GRUB environment block modification has been introduced
237+
into SWUpdate lately.
236238

237239
SWUpdate is mainly used in this configuration. The recipes for Yocto
238240
generate an initrd image containing the SWUpdate application, that is
@@ -245,8 +247,8 @@ Something went wrong ?
245247

246248
Many things can go wrong, and it must be guaranteed that the system
247249
is able to run again and maybe able to reload a new software to fix
248-
a damaged image. SWUpdate works together with the U-Boot boot loader to
249-
identify the possible causes of failures.
250+
a damaged image. SWUpdate works together with the boot loader to identify the
251+
possible causes of failures. Currently U-Boot and GRUB are supported.
250252

251253
We can at least group some of the common causes:
252254

@@ -261,10 +263,10 @@ We can at least group some of the common causes:
261263

262264
- power-failure
263265

264-
SWUpdate works as transaction process. The U-Boot variable "recovery_status" is
265-
set to signal U-Boot the update's status. Of course, further variables can be added
266-
to fine tuning and report error causes. recovery_status can have the values "progress",
267-
"failed", or it can be unset.
266+
SWUpdate works as transaction process. The boot loader environment variable
267+
"recovery_status" is set to signal the update's status to the boot loader. Of
268+
course, further variables can be added to fine tuning and report error causes.
269+
recovery_status can have the values "progress", "failed", or it can be unset.
268270

269271
When SWUpdate starts, it sets recovery_status to "progress". After an update is
270272
finished with success, the variable is erased. If the update ends with an
@@ -295,11 +297,12 @@ Generally, the behavior can be split according to the chosen scenario:
295297
To be completely safe, SWUpdate and the bootloader need to exchange some
296298
information. The bootloader must detect if an update was interrupted due
297299
to a power-off, and restart SWUpdate until an update is successful.
298-
SWUpdate supports the U-Boot bootloader. U-Boot has a power-safe environemnt,
299-
that SWUpdate is able to change to communicate with U-Boot.
300-
Setting / Clearing variables let SWUpdate and U-Boot to communicate.
300+
SWUpdate supports the U-Boot and GRUB bootloaders. U-Boot has a power-safe
301+
environment, that SWUpdate is able to change to communicate with U-Boot.
302+
In case of GRUB, fixed 1024-byte environment block file is used.
303+
Setting / Clearing variables lets SWUpdate and bootloader to communicate.
301304
SWUpdate sets a variable as flag when it starts to update the system, and
302-
resets the same variable after completion. U-Boot can detect this flag
305+
resets the same variable after completion. Bootloader can detect this flag
303306
to check if an update was running before a power-off.
304307

305308
.. image:: images/SoftwareUpdateU-Boot.png
@@ -324,9 +327,9 @@ upgraded image:
324327
What about upgrading the Boot loader ?
325328
--------------------------------------
326329

327-
Updating the boot loader is in most cases a one-way process. On most SOCs, there is no possibility
328-
to have multiple copies of the boot loader, and when U-Boot is broken,
329-
the board does not simply boot.
330+
Updating the boot loader is in most cases a one-way process. On most SOCs,
331+
there is no possibility to have multiple copies of the boot loader, and when
332+
boot loader is broken, the board does not simply boot.
330333

331334
Some SOCs allow to have multiple copies of the
332335
boot loader. But again, there is no general solution for this because it

doc/source/roadmap.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ backends to be mixed and matched at run-time.
111111
Filesystem-based Persistent Update Status Storage
112112
-------------------------------------------------
113113

114-
Currently, `U-Boot`_'s environment is used to persistently store the
115-
update status across reboots. On systems where U-Boot is not available
116-
or a different bootloader is used, a filesystem- or raw partition-based
117-
persistent storage should be made available to support other bootloaders
118-
such as, e.g., `grub`_.
114+
Originally, `U-Boot`_'s environment was used to persistently store the
115+
update status across reboots. Currently, `GRUB`_ environment block has been
116+
added. On systems where different bootloader is used, a filesystem- or raw
117+
partition-based persistent storage should be made available to support other
118+
bootloaders.
119119

120120
.. _grub: https://www.gnu.org/software/grub/
121121
.. _U-Boot: http://www.denx.de/wiki/U-Boot/

doc/source/suricatta.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ name suricatta (engl. meerkat) as it belongs to the mongoose family.
1111
Suricatta regularly polls a remote server for updates, downloads, and
1212
installs them. Thereafter, it reboots the system and reports the update
1313
status to the server, based on an update state variable currently stored
14-
in U-Boot's environment ensuring persistent storage across reboots. Some
14+
in bootloader's environment ensuring persistent storage across reboots. Some
1515
U-Boot script logics or U-Boot's ``bootcount`` feature may be utilized
1616
to alter this update state variable, e.g., by setting it to reflect
1717
failure in case booting the newly flashed root file system has failed

doc/source/sw-description.rst

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ The following example explains better the implemented tags:
6464
volume = "splash";
6565
},
6666
{
67-
filename = "uboot-env";
68-
type = "uboot";
67+
filename = "bootloader-env";
68+
type = "bootloader";
6969
},
7070
{
7171
filename = "uImage.bin";
@@ -97,7 +97,7 @@ The following example explains better the implemented tags:
9797
}
9898
);
9999

100-
uboot: (
100+
bootenv: (
101101
{
102102
name = "vram";
103103
value = "4M";
@@ -353,22 +353,25 @@ postinstall are shell scripts and called via system command.
353353
SWUpdate scans for all scripts and calls them after installing the images.
354354

355355

356-
uboot
357-
-----
356+
bootloader
357+
----------
358358

359-
There are two ways to update the bootloader (U-Boot) environment.
359+
There are two ways to update the bootloader (currently U-Boot, GRUB) environment.
360360
First way is to add a file with the list of variables to be changed
361-
and setting "uboot" as type of the image. This inform SWUpdate to
362-
call the U-Boot handler to manage the file.
361+
and setting "bootloader" as type of the image. This informs SWUpdate to
362+
call the bootloader handler to manage the file (requires enabling bootloader
363+
handler in configuration). There is one bootloader handler for all supported
364+
bootloaders. Appropriate bootloader must be chosen from bootloader selection
365+
menu in menuconfig.
363366

364367
::
365368

366369
{
367-
filename = "uboot-env";
368-
type = "uboot";
370+
filename = "bootloader-env";
371+
type = "bootloader";
369372
},
370373

371-
The format of the file is described in u-boot documentation. Each line
374+
The format of the file is described in U-boot documentation. Each line
372375
is in the format
373376

374377
::
@@ -377,21 +380,26 @@ is in the format
377380

378381
if value is missing, the variable is unset.
379382

383+
In current implementation we have inherited above file format for GRUB
384+
environment modification as well.
385+
380386
The second way is to define in a group setting the variables
381387
that must be changed:
382388

383389
::
384390

385-
uboot: (
391+
bootenv: (
386392
{
387393
name = <Variable name>;
388394
value = <Variable value>;
389395
},
390396
)
391397

392398
SWUpdate will internally generate a script that will be passed to the
393-
U-Boot handler for adjusting the environment.
399+
bootloader handler for adjusting the environment.
394400

401+
For backward compatibility with previously built .swu images, "uboot "group name
402+
is still relevant (as an alias).
395403

396404
Board specific settings
397405
-----------------------
@@ -412,23 +420,23 @@ and the following description::
412420
version = "0.1.0";
413421

414422
my-board = {
415-
uboot: (
423+
bootenv: (
416424
{
417425
name = "bootpart";
418426
value = "0:2";
419427
}
420428
);
421429
};
422430

423-
uboot: (
431+
bootenv: (
424432
{
425433
name = "bootpart";
426434
value = "0:1";
427435
}
428436
);
429437
}
430438

431-
SWUpdate will set `bootpart` to `0:2` in U-Boot's environment for this
439+
SWUpdate will set `bootpart` to `0:2` in bootloader's environment for this
432440
board. For all other boards, `bootpart` will be set to `0:1`. Board
433441
specific settings take precedence over default scoped settings.
434442

@@ -444,7 +452,7 @@ stable and unstable images within a single update file.
444452

445453
The mechanism uses a custom user-defined tags placed within `software`
446454
scope. The tag names must not be any of: `version`,
447-
`hardware-compatibility`, `uboot`, `files`, `scripts`, `partitions`,
455+
`hardware-compatibility`, `uboot`, `bootenv`, `files`, `scripts`, `partitions`,
448456
`images`
449457

450458
An example description file:
@@ -469,7 +477,7 @@ An example description file:
469477
}
470478
);
471479

472-
uboot: (
480+
bootenv: (
473481
{
474482
name = "bootpart";
475483
value = "0:2";
@@ -485,7 +493,7 @@ An example description file:
485493
}
486494
);
487495

488-
uboot: (
496+
bootenv: (
489497
{
490498
name = "bootpart";
491499
value = "0:1";
@@ -552,7 +560,8 @@ There are 4 main sections inside sw-description:
552560
single files.
553561
- scripts: all entries are treated as executables, and they will
554562
be run twice (as pre- and post- install scripts).
555-
- uboot: entries are pair with U-Boot variable name and its value.
563+
- bootenv: entries are pair with bootloader environment variable name and its
564+
value.
556565

557566
.. table::
558567

@@ -609,10 +618,11 @@ There are 4 main sections inside sw-description:
609618
| | | | temporary copy. Not all handlers |
610619
| | | | support streaming. |
611620
+-------------+----------+------------+---------------------------------------+
612-
| name | string | uboot | name of the U-Boot variable to be set.|
621+
| name | string | bootenv | name of the bootloader variable to be |
622+
| | | | set. |
613623
+-------------+----------+------------+---------------------------------------+
614-
| value | string | uboot | value to be assigned to the U-Boot |
615-
| | | | variable |
624+
| value | string | bootenv | value to be assigned to the |
625+
| | | | bootloader variable |
616626
+-------------+----------+------------+---------------------------------------+
617627
| name | string | images | name that identifies the sw-component |
618628
| | | files | it can be any string and it is |

doc/source/swupdate.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,10 @@ List of supported features
270270

271271
- Support for setting / erasing U-Boot variables
272272

273+
.. _GRUB: https://www.gnu.org/software/grub/manual/html_node/Environment-block.html
274+
275+
- Support for setting / erasing `GRUB`_ environment block variables
276+
273277
- Support for preinstall scripts. They run before updating the images
274278

275279
- Support for postinstall scripts. They run after updating the images.
@@ -491,7 +495,7 @@ A run of SWUpdate consists mainly of the following steps:
491495
- iterates through all images and call the corresponding
492496
handler for installing on target.
493497
- runs post-install scripts
494-
- update u-boot environment, if changes are specified
498+
- update bootloader environment, if changes are specified
495499
in sw-description.
496500
- reports the status to the operator (stdout)
497501

0 commit comments

Comments
 (0)