Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ jobs:
~/.platformio/.cache
./lib/lilka/.pio
key: ${{ runner.os }}-lilka
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
# 3.9 isn't available for the current ubuntu-latest image
python-version: '3.11'
- name: Install PlatformIO Core
run: pip install --upgrade platformio

Expand Down
13 changes: 11 additions & 2 deletions lib/lilka/src/lilka/multiboot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ MultiBoot::MultiBoot() :
ota_handle(0), current_partition(NULL), ota_partition(NULL), path(""), bytesTotal(0), bytesWritten(0), file(NULL) {
}

// The other one of app0/app1. With more apps sharing the flash (e.g. Retro-Go next to Keira)
// esp_ota_get_next_update_partition() may return a partition that belongs to them.
static const esp_partition_t* getGuestPartition(const esp_partition_t* current) {
const char* other = strcmp(current->label, "app0") == 0 ? "app1" : "app0";
const esp_partition_t* partition =
esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_ANY, other);
return partition ? partition : esp_ota_get_next_update_partition(current);
}

void MultiBoot::begin() {
// Get commandline args
bool verify_kcmd_loc = &kcmd == reinterpret_cast<KernelParams*>(MULTIBOOT_KCMD_DEFAULT_LOCATION);
Expand Down Expand Up @@ -86,7 +95,7 @@ void MultiBoot::begin() {
current_partition->subtype,
current_partition->size
);
ota_partition = esp_ota_get_next_update_partition(current_partition); // get ota1 (we're in ota0 now)
ota_partition = getGuestPartition(current_partition);
serial.log(
"OTA partition: %s, type: %d, subtype: %d, size: %d",
ota_partition->label,
Expand Down Expand Up @@ -183,7 +192,7 @@ int MultiBoot::start(String path) {
current_partition->subtype,
current_partition->size
);
ota_partition = esp_ota_get_next_update_partition(current_partition); // get ota1 (we're in ota0 now)
ota_partition = getGuestPartition(current_partition);
if (ota_partition == NULL) {
serial.err("Failed to get next OTA partition");
return -4;
Expand Down
Loading