-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfwup-revert.conf
163 lines (149 loc) · 5.23 KB
/
fwup-revert.conf
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
require-fwup-version="1.4.0" # For the GPT support
include("${NERVES_SDK_IMAGES:-.}/fwup_include/fwup-common.conf")
gpt gpt-a {
guid = ${NERVES_SYSTEM_DISK_UUID}
partition 0 {
block-offset = ${SPL1_PART_OFFSET}
block-count = ${SPL1_PART_COUNT}
guid = ${NERVES_SYSTEM_SPL_PART_UUID}
type = ${LINUX_FILESYSTEM_DATA_TYPE}
name = "fsbl1"
}
partition 1 {
block-offset = ${SPL2_PART_OFFSET}
block-count = ${SPL2_PART_COUNT}
guid = ${NERVES_SYSTEM_SPL_PART_UUID}
type = ${LINUX_FILESYSTEM_DATA_TYPE}
name = "fsbl2"
}
partition 2 {
block-offset = ${UBOOT_PART_OFFSET}
block-count = ${UBOOT_PART_COUNT}
guid = ${NERVES_SYSETM_UBOOT_PART_UUID}
type = ${LINUX_FILESYSTEM_DATA_TYPE}
name = "ssbl"
}
partition 3 {
block-offset = ${EFI_A_PART_OFFSET}
block-count = ${EFI_A_PART_COUNT}
guid = ${NERVES_SYSTEM_EFI_PART_UUID}
type = ${EFI_TYPE}
name = "boot"
}
partition 4 {
block-offset = ${ROOTFS_A_PART_OFFSET}
block-count = ${ROOTFS_A_PART_COUNT}
guid = ${NERVES_SYSTEM_ROOTFS_PART_UUID}
name = "rootfs"
type = ${LINUX_FILESYSTEM_DATA_TYPE}
flags = 0x4
}
partition 5 {
block-offset = ${APP_PART_OFFSET}
block-count = ${APP_PART_COUNT}
guid = ${NERVES_SYSTEM_APP_PART_UUID}
type = ${LINUX_FILESYSTEM_DATA_TYPE}
expand = true
}
}
gpt gpt-b {
guid = ${NERVES_SYSTEM_DISK_UUID}
partition 0 {
block-offset = ${SPL1_PART_OFFSET}
block-count = ${SPL1_PART_COUNT}
guid = ${NERVES_SYSTEM_SPL_PART_UUID}
type = ${LINUX_FILESYSTEM_DATA_TYPE}
name = "fsbl1"
}
partition 1 {
block-offset = ${SPL2_PART_OFFSET}
block-count = ${SPL2_PART_COUNT}
guid = ${NERVES_SYSTEM_SPL_PART_UUID}
type = ${LINUX_FILESYSTEM_DATA_TYPE}
name = "fsbl2"
}
partition 2 {
block-offset = ${UBOOT_PART_OFFSET}
block-count = ${UBOOT_PART_COUNT}
guid = ${NERVES_SYSETM_UBOOT_PART_UUID}
type = ${LINUX_FILESYSTEM_DATA_TYPE}
name = "ssbl"
}
partition 3 {
block-offset = ${EFI_B_PART_OFFSET}
block-count = ${EFI_B_PART_COUNT}
guid = ${NERVES_SYSTEM_EFI_PART_UUID}
type = ${EFI_TYPE}
name = "boot"
}
partition 4 {
block-offset = ${ROOTFS_B_PART_OFFSET}
block-count = ${ROOTFS_B_PART_COUNT}
guid = ${NERVES_SYSTEM_ROOTFS_PART_UUID}
name = "rootfs"
type = ${LINUX_FILESYSTEM_DATA_TYPE}
flags = 0x4
}
partition 5 {
block-offset = ${APP_PART_OFFSET}
block-count = ${APP_PART_COUNT}
guid = ${NERVES_SYSTEM_APP_PART_UUID}
type = ${LINUX_FILESYSTEM_DATA_TYPE}
expand = true
}
}
# Location where installed firmware information is stored.
# While this is called "u-boot", u-boot isn't involved in this
# setup. It just provides a convenient key/value store format.
uboot-environment uboot-env {
block-offset = ${UBOOT_ENV_OFFSET}
block-count = ${UBOOT_ENV_COUNT}
}
task revert.a {
# This task reverts to the A partition, so check that we're running on B
require-uboot-variable(uboot-env, "nerves_fw_active", "b")
# Verify that partition A has the expected platform/architecture
require-uboot-variable(uboot-env, "a.nerves_fw_platform", "${NERVES_FW_PLATFORM}")
require-uboot-variable(uboot-env, "a.nerves_fw_architecture", "${NERVES_FW_ARCHITECTURE}")
on-finish {
info("Reverting to partition A")
uboot_setenv(uboot-env, "nerves_fw_active", "a")
uboot_setenv(uboot-env, "nerves_fw_validated", "1")
gpt_write(gpt-a)
}
}
task revert.b {
# This task reverts to the B partition, so check that we're running on A
require-uboot-variable(uboot-env, "nerves_fw_active", "a")
# Verify that partition B has the expected platform/architecture
require-uboot-variable(uboot-env, "b.nerves_fw_platform", "${NERVES_FW_PLATFORM}")
require-uboot-variable(uboot-env, "b.nerves_fw_architecture", "${NERVES_FW_ARCHITECTURE}")
on-finish {
info("Reverting to partition B")
# Switch over
uboot_setenv(uboot-env, "nerves_fw_active", "b")
uboot_setenv(uboot-env, "nerves_fw_validated", "1")
gpt_write(gpt-b)
}
}
task revert.unexpected.a {
require-uboot-variable(uboot-env, "a.nerves_fw_platform", "${NERVES_FW_PLATFORM}")
require-uboot-variable(uboot-env, "a.nerves_fw_architecture", "${NERVES_FW_ARCHITECTURE}")
on-init {
# Case where A is good, and the desire is to go to B.
error("It doesn't look like there's anything to revert to in partition B.")
}
}
task revert.unexpected.b {
require-uboot-variable(uboot-env, "b.nerves_fw_platform", "${NERVES_FW_PLATFORM}")
require-uboot-variable(uboot-env, "b.nerves_fw_architecture", "${NERVES_FW_ARCHITECTURE}")
on-init {
# Case where B is good, and the desire is to go to A.
error("It doesn't look like there's anything to revert to in partition A.")
}
}
task revert.wrongplatform {
on-init {
error("Expecting platform=${NERVES_FW_PLATFORM} and architecture=${NERVES_FW_ARCHITECTURE}")
}
}