Trading binaren flash-spiel28 comments
If you intend to prepare your platform for using RAUC as an update framework, this chapter will guide you through the required steps and show the different ways you can choose. The host application is needed for generating update bundles while the target application or service performs the core task of RAUC: In an update system, a lot of components have to play together and have to be configured appropriately to interact correctly.
In principle, these are:. The system configuration file is the central configuration in RAUC that abstracts the loosely coupled storage setup, partitioning and boot strategy of your board to a coherent redundancy setup world view for RAUC. For a full reference of the system. Similar to other configuration files used by RAUC, the system configuration uses a key-value syntax similar to those known from.
The most important step is to describe the slots that RAUC should use when performing updates. Which slots are required and what you have to take care of when designing your system will be covered in the chapter Scenarios. This section assumes that you have already decided on a setup and want to describe it for RAUC.
A slot is defined by a slot section. The naming of the section must follow a simple format: If you have two redundant slots used for the root file system, for example, you should name your sections according to this example:. RAUC does not have predefined class names. The only requirement is that the class names used in the system config match those you later use in the update manifests.
If multiple slots belong together in a way that they always have to be updated together with the respective other slots, you can ensure this by grouping slots. A group must always have a single bootable slot, then all other slots define a parent relationship to this bootable slot as follows:. The kernel used on the target device must support both loop block devices and the SquashFS file system to allow installing RAUC bundles.
RAUC requires and uses a set of target tools depending on the type of supported storage and used image type. Note that build systems may handle parts of these dependencies automatically, but also in this case you will have to select some of them manually as RAUC cannot fully know how you intend to use your system. You may either use GNU tar or Busybox tar.
If you intend to use Busybox tar, make sure format autodetection and also the compression formats you use are enabled:. RAUC provides support for interfacing with different types of bootloaders. If in doubt about choosing the right bootloader, we recommend to use Barebox as it provides a dedicated boot handling framework, called bootchooser.
To let RAUC handle a bootable slot, you have to mark it as bootable in your system. This is both done by setting the bootname property. The Barebox bootloader, which is available for many common embedded platforms, provides a dedicated boot source selection framework, called bootchooser , backed by an atomic and redundant storage backend, named state.
The Bootchooser framework maintains information about priority and remaining boot attemps while being configurable on how to deal with them for different strategies. As mentioned above, Barebox support requires you to have the bootchooser framework with barebox state backend enabled.
The barebox bootchooser framework allows you to specify a number of redundant boot targets that should be automatically selected by an algorithm, based on status information saved for each boot target.
The bootchooser itself can be used as a Barebox boot target. This is where we start by setting the barebox default boot target to bootchooser:. As a next step, we need to tell bootchooser which boot targets it should handle. These boot targets can have descriptive names which must not equal any of your existing boot targets, we will have a mapping for this later on.
In this example we call the virtual bootchooser boot targets system0 and system Now connect each of these virtual boot targets to a real Barebox boot target one of its automagical ones or custom boot scripts:. Beside this very basic configuration variables, you need to set up a set of other general and slot-specific variables.
It is highly recommended to read the full Barebox bootchooser documentation in order to know about the requirements and possibilities in fine-tuning the behavior according to your needs.
Also make sure to have these nv settings in your compiled-in environment, not in your device-local environment. For storing its status information, the botchooser framework requires a barebox,state instance to be set up with a set of variables matching the set of virtual boot targets defined.
To allow loading the state information in a well-defined format both from Barebox and from the kernel, we store the state data format definition in the Barebox devicetree. Barebox fixups the information into the Linux devicetree when loading the kernel. This assures having a consistent view on the variables in Barebox and Linux.
An example devicetree node for our simple redundant setup will have the following basic structure:. In the state node, we set the appropriate compatible to tell the barebox,state driver to care for it and define where and how we want to store our data.
This will look similar to this:. The devicetree only defines where and in which format the data will be stored. By default, no data will be stored in the deviectree itself! The rest of the variable set definition will be made in the bootstate subnode. As the example shows, you must also specify some useful default variables the state driver will load in case of uninitialized backend storage. Additionally one single variable for storing information about the last chosen boot target is required:.
This example shows only a highly condensed excerpt of setting up Barebox state for bootchooser. For a full documentation on how Barebox state works and how to properly integrate it into your platform see the official Barebox State Framework user documentation as well as the corresponding devicetree binding reference! You can verify your setup by calling devinfo state from Barebox, which would print this for example:. For this, you need to specify which virtual boot target belongs to which of the RAUC slots you defined.
You do this by assigning the virtual boot target name to the slots bootname property:. Make sure to have this tool integrated on your target platform. You can verify your setup by calling it manually:. This key has the virtual bootchooser boot target assigned. In our case, if the bootchooser logic decided to boot system0 the kernel commandline will contain:. If the kernel commandline of your booted system contains this line, you have successfully set up bootchooser to boot your slot:.
To enable handling of redundant booting in U-Boot, manual scripting is required. U-Boot allows storing and modifying variables in its Envionment. Properly configured it can be accessed both from U-Boot itself as well as from Linux userspace.
You must integrate your boot selection script into U-Boot. The script uses the names A and B as the bootname for the two different boot targets. See the corresponding HowTo section from the U-Boot documentation for more details on how to set up the environment config file for your device. For atomic updates of environment, U-Boot can use redundant environment storages that allow to write one copy while using the other as fallback if writing fails, e.
To enable reading and writing of the GRUB environment, you need to have the tool grub-editenv available on your target. As the GRUB shell only has limited support for scripting, this example uses only one try per enabled slot. To set up a system ready for pure EFI-based redundancy boot without any further bootloader or initramfs involved, you have to create an appropriate partition layout and matching boot EFI entries.
Make the first EFI partition a child of the first rootfs partition and the second EFI partition a child of the second rootfs partition to have valid slot groups. Set the rootfs slot bootnames to those we have defined with the --label argument in the efibootmgr call above:. It is planned to add support for a custom boot selection implementation that will allow you to use also non-conventional or yet unimplemented approaches for selecting your boot slot.
There are several ways to run the RAUC service on your target. When building RAUC, a default systemd rauc. It is a good idea to wait for the system to be fully started before marking it as succesfully booted. It could look similar to this:. In order to allow sending data, make sure the D-Bus config file de. In order to enable D-Bus activation, properly install the D-Bus service file de. Detecting system hangs during runtime requires to have a watchdog and to have the watchdog configured and handled properly.
Systemd provides a sophisticated watchdog multiplexing and handling allowing you to configure separate timeouts and handlings for each of your services. Yocto support for using RAUC is provided by the meta-rauc layer. The layer supports building RAUC both for the target as well as as a host tool.
This file must provide a system compatible string to identify your system type, as well as a definition of all slots in your system. Name it either ca. For a reference of allowed configuration options in system. For a more detailed instruction on how to write a system. Having RAUC available as a host tool is useful for debugging, testing or for creating bundles manually. For the preferred way of creating bundles automatically, see the chapter Bundle Generation.
In order to compile RAUC for your host system, simply run:. To test it, try:. Bundles can be created either manually by building and using RAUC as a native tool, or by using the bundle. First, create a bundle recipe in your BSP layer. To create the manifest file, you may either use the built-in class mechanism, or provide a custom manifest. A minimal bundle recipe, such as core-bundle-minimal.
You may set them either from your bundle recipe or any global configuration layer, site. You should use your local PKI infrastructure for generating valid certificates and keys for your target. For debugging and testing purpose, PTXdist provides a script that generates a set of example certificates.