aboutsummaryrefslogtreecommitdiffstats
path: root/meta-rcar-gen3/README.rauc.md
blob: 8a187480ce6e1f50fda6b47d79c99dd7398b6a9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# Software/Firmware update over-the-air using RAUC

This layer provides OTA update feature using RAUC.

## **Dependency**

This feature depends on:

```
    Layer: meta-rauc
    URL: git://github.com/rauc/meta-rauc
    Branch: master
```

## **Basic usage**

### **1. How to build**

The target which installs RAUC packages must have a configuration file called `system.conf` and a keyring file called `ca.cert.pem` for bundle authentication.

A sample `system.conf` can be found in `recipes-core/rauc/rauc/system.conf`. This assumes that the rootfs uses 2 ext4 partitions on eMMC to perform symmetric (or A/B) update and the bootloader is in eMMC boot partition (`/dev/mmcblk0bootX`).

The development keyring and bundle private key and certificate can be generated using a script in `meta-rauc/scripts/openssl-ca.sh` (see https://github.com/rauc/meta-rauc/blob/master/scripts/README for detail)

To enable RAUC and its related packages in the target image build, add to `local.conf`:

```bash
IMAGE_INSTALL_append = " rauc-packagegroup"
```

### **2. Update bundle**

This layer contains sample bundle recipes for agl-demo-platform and agl-image-minimal in `recipes-core/bundles/`.
To build the bundle, please add RAUC packages as **1. How to build** and run Bitbake command:

```shell
$ bitbake agl-demo-bundle
```

The built bundle has the extension .raucb. To install it in the target device, use rauc command as following:

```shell
$ rauc install /path/to/agl-demo-bundle.raucb
```

Then reboot to switch to the new updated rootfs.

To create a bundle recipe for a custom image. Please follow the guideline in: https://rauc.readthedocs.io/en/latest/integration.html

### **3. RAUC-hawkBit support**

This also supports hawkBit as an OTA update server. The guideline to install a hawkBit server can be found in: https://github.com/eclipse/hawkbit

There is a sample RAUC-hawkBit client program which support polling, downloading, installing the bundle from hawkBit server. Enable it by adding to `local.conf`:

```bash
IMAGE_INSTALL_append = " rauc-hawkbit"
```

The client must first be configured with the device, server address, authentication token in `recipes-support/rauc-hawkbit/rauc-hawkbit/config.cfg` (see how to configure at: https://github.com/rauc/rauc-hawkbit)

To enable network connection with a static IP, add to `local.conf`:

```bash
STATIC_IP = "<your_ip_addr>"
```

To configure and run `rauc-hawkbit-client` automatically after booting up board, add the following variables to `local.conf`:

```bash
HAWKBIT_SERVER = "<The Hawkbit Server IP>"
HAWKBIT_TARGET = "<The target_name is defined in Hawkbit Server>"
HAWKBIT_TOKEN  = "<The auth_token of target>"
HAWKBIT_MAC    = "<The MAC address of target board>"
HAWKBIT_DL     = "<The bundle download location in target board>"
```

**Note:** The above variables are mandatory, the setup will be skipped if any empty variables, wrong IP format or MAC address.

### **4. Performing system roll-back**

If the updated rootfs failed to boot, system will return back to the previous success rootfs after 3 times booting failure.

There is a sample bundle in this layer to demonstrate the failure by removing the `/sbin/init` which causes the rootfs cannot be initialized.

To build this bundle, add this to `local.conf`:

```bash
DISTRO_FEATURES_append = " bad-bundle"
```

Then run:

```shell
$ bitbake bad-agl-demo-bundle
```

### **5. Firmware update for U-Boot**

The sample `system.conf` contains a slot configuration for bootloader in eMMC device, in this case U-Boot is in `/dev/mmcblk0p1` partition:

```ini
[slot.bootloader.0]
device=/dev/mmcblk0
type=boot-emmc
img_block=1024
```

Where `img_block` is the size which RAUC will clean before updating new U-Boot image (1 block = 1KB). This size should be greater than the U-Boot image file and not reach the area where U-Boot environment variables are stored.

If `img_block=0` or not set, the whole parition will be cleared.

There is a sample bundle recipe for U-Boot: `recipes-core/bundles/u-boot-bundle.bb`

Build it by:

```shell
$ bitbake u-boot-bundle
```

## **Note**

To use eMMC for bootloader, Arm Trusted Firmware needs to be built with `RCAR_SA6_TYPE=1`. Enable it by adding to `local.conf`:

```bash
DISTRO_FEATURES_append = " emmc-boot"
```

## **Reference**

RAUC documentation: https://rauc.readthedocs.io/en/latest

hawkBit on Github: https://github.com/eclipse/hawkbit