From: Jan Kiszka <
jan.k...@siemens.com>
Remove some trailing whitespace, rewrap the README.md, reformat comment
style in two headers.
No functional changes.
Signed-off-by: Jan Kiszka <
jan.k...@siemens.com>
---
README.md | 53 +++++++++++++++++++++++++++++++-------------
include/ebgdefs.h | 4 ++--
swupdate-adapter/ebgenv.h | 28 +++++++++++------------
swupdate-adapter/swupdate.md | 8 +++----
tools/bg_utils.c | 2 +-
tools/tests/Makefile | 4 ++--
6 files changed, 61 insertions(+), 38 deletions(-)
diff --git a/README.md b/README.md
index 9286d2b..95292e8 100644
--- a/README.md
+++ b/README.md
@@ -108,7 +108,7 @@ configuration to `0`.
| | testing: 0 | | testing: 1 |
| | boot_once: 0 | | boot_once: 1 |
| +--------------+ +-------------------+
- | boots |
+ | boots |
+----- latest' = latest-1 +--------------------------------+
@@ -117,7 +117,11 @@ configuration to `0`.
In the `tools` directory, there is a utility named `bg_setenv`/`bg_printenv`.
With this, the user can display the configuration data or update as needed.
-**NOTE**: The environment tools only work, if the correct number of config partitions is detected. This also means that the stored configuration data has a valid checksum. If this is not the case, environments must be repaired first. To do so, follow the initial setup step explained below in the `Installation` section.
+**NOTE**: The environment tools only work, if the correct number of config
+partitions is detected. This also means that the stored configuration data has a
+valid checksum. If this is not the case, environments must be repaired first. To
+do so, follow the initial setup step explained below in the `Installation`
+section.
To access configuration data on FAT partitions, the partition must either
already be mounted, with access rights for the user using the tool, or the tool
@@ -125,7 +129,8 @@ can mount the partition by itself, provided that it has the `CAP_SYS_ADMIN`
capability. This is the case if the user is granted `root` privileges or the
corresponding capability is set in the filesystem.
-*NOTE*: `CHAR16` environment variables are limited to 255 characters as stated in `include/envdata.h`.
+*NOTE*: `CHAR16` environment variables are limited to 255 characters as stated
+in `include/envdata.h`.
### Creating a new configuration ###
@@ -156,13 +161,19 @@ make DEBUG=1
#### Kernel Location ####
-To load the kernel from a different FAT partition than `efibootguard`, there are two possible mechanisms. One directly uses the label of the FAT partition, created with `dosfslabel`:
+To load the kernel from a different FAT partition than `efibootguard`, there are
+two possible mechanisms. One directly uses the label of the FAT partition,
+created with `dosfslabel`:
```
./bg_setenv -u --kernel="L:FATLABEL:kernelfile"
```
-where `FATLABEL` is the label of the FAT partition. On some older UEFI implementations, the label is not supported properly and a user defined label can be created instead, which is a file named `EFILABEL` in the root directory of the corresponding FAT partition. This file contains an UTF-16le encoded partition name and can be used as follows:
+where `FATLABEL` is the label of the FAT partition. On some older UEFI
+implementations, the label is not supported properly and a user defined label
+can be created instead, which is a file named `EFILABEL` in the root directory
+of the corresponding FAT partition. This file contains an UTF-16le encoded
+partition name and can be used as follows:
```
./bg_setenv -u --kernel="C:USERLABEL:kernelfile"
@@ -170,13 +181,16 @@ where `FATLABEL` is the label of the FAT partition. On some older UEFI implement
### Interface API ###
-The library `libebgenv.a` provides an API to access the environment from a user program.
+The library `libebgenv.a` provides an API to access the environment from a user
+program.
The header file with the prototypes and a short description is `ebgenv.h`.
-Documentation and further examples can be found in `swupdate-adapter/swupdate.md`.
+Documentation and further examples can be found in
+`swupdate-adapter/swupdate.md`.
-The following example program opens the current environment and modifies the kernel file name:
+The following example program opens the current environment and modifies the
+kernel file name:
```c
#include <stdbool.h>
@@ -191,8 +205,8 @@ int main(void)
}
```
-The following example program creates a new environment with the latest revision and sets it to
-the testing state:
+The following example program creates a new environment with the latest revision
+and sets it to the testing state:
```c
#include <stdbool.h>
@@ -209,7 +223,8 @@ int main(void)
}
```
-*Note*: If no watchdog timeout value is specified, a default of 30 seconds is set.
+*Note*: If no watchdog timeout value is specified, a default of 30 seconds is
+set.
## Required libraries and headers for compilation ##
@@ -229,15 +244,21 @@ apt-get install gnu-efi libparted-dev libpci-dev
### Environment setup ###
-Create the needed number of FAT16 partitions as defined by `CONFIG_PARTITION_COUNT` in `include/envdata.h`. Create a new `BGENV.DAT` configuration file with the `bg_setenv` tool and the `-f` option and copy the files to the FAT16 partitions.
+Create the needed number of FAT16 partitions as defined by
+`CONFIG_PARTITION_COUNT` in `include/envdata.h`. Create a new `BGENV.DAT`
+configuration file with the `bg_setenv` tool and the `-f` option and copy the
+files to the FAT16 partitions.
-*NOTE*: Currently, FAT partitions must neither be `FAT12`, `FAT32` nor `FAT32e`. During detection of config partitions, all non-FAT16 partitions are ignored and do not count to the valid number of config partitions.
+*NOTE*: Currently, FAT partitions must neither be `FAT12`, `FAT32` nor `FAT32e`.
+During detection of config partitions, all non-FAT16 partitions are ignored and
+do not count to the valid number of config partitions.
### Bootloader installation ###
Copy `efibootguard.efi` to `EFI/boot/` and rename it to bootx64.efi.
-If the system does not select this file for booting automatically, boot into `UEFI shell` and use the `bcfg` command:
+If the system does not select this file for booting automatically, boot into
+`UEFI shell` and use the `bcfg` command.
Issue the following command to list the currently configured boot sequence:
```
@@ -259,4 +280,6 @@ Exit efi shell with the `reset` command.
## Future work ##
-* The number of valid config partitions expected by the bootloader and the tools is currently fixed to the number defined by `CONFIG_PARTITION_COUNT` in `include/envdata.h`. This value should be made configurable by a config flag.
+* The number of valid config partitions expected by the bootloader and the tools
+ is currently fixed to the number defined by `CONFIG_PARTITION_COUNT` in
+ `include/envdata.h`. This value should be made configurable by a config flag.
diff --git a/include/ebgdefs.h b/include/ebgdefs.h
index 8b29873..4327d45 100644
--- a/include/ebgdefs.h
+++ b/include/ebgdefs.h
@@ -1,5 +1,5 @@
/** @file
-
+ *
* EFI Boot Guard
*
* Copyright (c) Siemens AG, 2017
@@ -10,7 +10,7 @@
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
*
-*/
+ */
#ifndef __EFI_BOOT_GUARD_DEFS_H__
#define __EFI_BOOT_GUARD_DEFS_H__
diff --git a/swupdate-adapter/ebgenv.h b/swupdate-adapter/ebgenv.h
index 2a3b391..97c23db 100644
--- a/swupdate-adapter/ebgenv.h
+++ b/swupdate-adapter/ebgenv.h
@@ -1,5 +1,5 @@
/** @file
-
+ *
* EFI Boot Guard
*
* Copyright (c) Siemens AG, 2017
@@ -10,7 +10,7 @@
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
*
-*/
+ */
#ifndef __EBGENV_H__
#define __EBGENV_H__
@@ -18,7 +18,7 @@
#include <errno.h>
/** @brief Tell the library to output information for the user.
-*/
+ */
void ebg_beverbose(bool v);
/** @brief Initialize environment library and open environment. The first
@@ -26,12 +26,12 @@ void ebg_beverbose(bool v);
* highest revision number for update purposes. Every next time it will
* just open the environment with the highest revision number.
* @return 0 on success, errno on failure
-*/
+ */
int ebg_env_create_new(void);
/** @brief Initialize environment library and open current environment.
* @return 0 on success, errno on failure
-*/
+ */
int ebg_env_open_current(void);
/** @brief Retrieve variable content
@@ -40,51 +40,51 @@ int ebg_env_open_current(void);
* NULL on failure. The returned pointer must not be freed and is freed
* automatically on closing the environment. If NULL is returned, errno is
* set.
-*/
+ */
char *ebg_env_get(char *key);
/** @brief Store new content into variable
* @param key name of the environment variable to set
* @param value a string to be stored into the variable
* @return 0 on success, errno on failure
-*/
+ */
int ebg_env_set(char *key, char *value);
/** @brief Check if last update was successful
* @return true if successful, false if not
-*/
+ */
bool ebg_env_isupdatesuccessful(void);
/** @brief Reset all stored failure states
* @return 0 if successful, errno on failure
-*/
+ */
int ebg_env_clearerrorstate(void);
/** @brief Check if active env is clean
* @return true if yes, errno set on failure
-*/
+ */
bool ebg_env_isokay(void);
/** @brief Check if active env has state 'installed'
* @return true if yes, errno set on failure
-*/
+ */
bool ebg_env_isinstalled(void);
/** @brief Check if active env is in testing state
* @return true if yes, errno set on failure
-*/
+ */
bool ebg_env_istesting(void);
/** @brief Confirm environment after update - sets testing and boot_once
* both to 0
* @return 0 if successful, errno on failure
-*/
+ */
int ebg_env_confirmupdate(void);
/** @brief Closes environment and finalize library. Changes are written
* before closing.
* @return 0 on success, errno on failure
-*/
+ */
int ebg_env_close(void);
#endif //__EBGENV_H__
diff --git a/swupdate-adapter/swupdate.md b/swupdate-adapter/swupdate.md
index 8e34d10..334aa5f 100644
--- a/swupdate-adapter/swupdate.md
+++ b/swupdate-adapter/swupdate.md
@@ -30,7 +30,7 @@ boot once flag: not set
Used sw-description:
```
-software =
+software =
{
version = "0.1.0";
bootenv: (
@@ -153,7 +153,7 @@ revision: 16
kernel: L:CONFIG1:vmlinuz-linux
kernelargs: root=/dev/sda4 rw initrd=initramfs-linux.img nomodeset
watchdog timeout: 30 seconds
-test flag: disabled
+test flag: disabled
boot once flag: not set
```
@@ -184,7 +184,7 @@ revision: 0
kernel: L:CONFIG1:vmlinuz-linux
kernelargs: root=/dev/sda4 rw initrd=initramfs-linux.img nomodeset
watchdog timeout: 30 seconds
-test flag: enabled
+test flag: enabled
boot once flag: set
```
@@ -218,7 +218,7 @@ revision: 16
kernel: L:CONFIG1:vmlinuz-linux
kernelargs: root=/dev/sda4 rw initrd=initramfs-linux.img nomodeset
watchdog timeout: 30 seconds
-test flag: disabled
+test flag: disabled
boot once flag: not set
```
diff --git a/tools/bg_utils.c b/tools/bg_utils.c
index 5d7a73a..b23b361 100644
--- a/tools/bg_utils.c
+++ b/tools/bg_utils.c
@@ -450,7 +450,7 @@ bool bgenv_write(BGENV *env)
part = (CONFIG_PART *)env->desc;
if (!part) {
VERBOSE(stderr, "Invalid config partition to store environment.\n");
- return false;
+ return false;
}
if (!write_env(part, env->data)) {
VERBOSE(stderr, "Could not write to %s\n", part->devpath);
diff --git a/tools/tests/Makefile b/tools/tests/Makefile
index a4c87d1..68c1495 100644
--- a/tools/tests/Makefile
+++ b/tools/tests/Makefile
@@ -45,7 +45,7 @@ LIBS = -L.. \
-lebgenv \
-lz
-# Test recipes shall run everytime independent of already built files.
+# Test recipes shall run everytime independent of already built files.
# A simple way to achieve this is to depend on files that don't exist
# by changing their extension with Makefile's string functions.
# All capital O's get replaced by lower-case o's within the target
@@ -71,7 +71,7 @@ TEST_TARGETS = test_partitions.target test_environment.target test_api.target
define WEAKEN_SYMBOL =
objcopy --weaken-symbol $(1) $(2)
-
+
endef
define WEAKEN_SYMBOLS =
--
2.12.3