Skip to content
Snippets Groups Projects
Commit 657aa149 authored by Zygmunt Krynicki's avatar Zygmunt Krynicki
Browse files

ota/raucadapter: fix handling of pristine boot configuration


Instead of ignoring the requests entirely, assume slot A is active
and _carry out_ the requests. This fixes updates.

Tested-By: default avatarZygmunt Krynicki <zygmunt.krynicki@huawei.com>
Signed-off-by: default avatarZygmunt Krynicki <zygmunt.krynicki@huawei.com>
parent e4511386
No related branches found
No related tags found
No related merge requests found
......@@ -94,12 +94,11 @@ func (adapter *Adapter) SetPrimarySlot(slot boot.Slot) error {
activeSlot, err := adapter.proto.QueryActive()
if err != nil {
if errors.Is(err, boot.ErrPristineBootConfig) && adapter.bootModeHolder.BootMode() == boot.Normal {
fmt.Printf("Ignoring RAUC set-primary %s while in pristine boot configuration\n", slot)
return nil
fmt.Printf("System is in pristine boot configuration mode, pretending slot A is active\n")
activeSlot = boot.SlotA
} else {
return err
}
return err
}
switch adapter.bootModeHolder.BootMode() {
......@@ -149,21 +148,12 @@ func (adapter *Adapter) SlotState(slot boot.Slot) (boot.SlotState, error) {
active, err := adapter.proto.QueryActive()
if err != nil {
if errors.Is(err, boot.ErrPristineBootConfig) {
fmt.Printf("Forging RAUC get-state %s while in pristine boot configuration\n", slot)
if slot == boot.SlotA {
return boot.GoodSlot, nil
}
return boot.BadSlot, nil
if errors.Is(err, boot.ErrPristineBootConfig) && adapter.bootModeHolder.BootMode() == boot.Normal {
fmt.Printf("System is in pristine boot configuration mode, pretending slot A is active\n")
active = boot.SlotA
} else {
return boot.InvalidSlotState, err
}
return boot.InvalidSlotState, err
}
if err != nil {
return boot.InvalidSlotState, err
}
if slot == active {
......@@ -210,14 +200,11 @@ func (adapter *Adapter) SetSlotState(slot boot.Slot, state boot.SlotState) error
active, err := adapter.proto.QueryActive()
if err != nil {
if errors.Is(err, boot.ErrPristineBootConfig) && adapter.bootModeHolder.BootMode() == boot.Normal {
if (slot == boot.SlotA && state == boot.GoodSlot) || (slot == boot.SlotB && state == boot.BadSlot) {
fmt.Printf("Ignoring RAUC set-state %s %s while in pristine boot configuration\n", slot, state)
return nil
}
fmt.Printf("System is in pristine boot configuration mode, pretending slot A is active\n")
active = boot.SlotA
} else {
return err
}
return err
}
inactive := boot.SynthesizeInactiveSlot(active)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment