Skip to content

feat: build with lilka-bootloader, install Retro-Go from .img - #151

Closed
black-ghost-off wants to merge 2 commits into
mainfrom
yboichuk/feat/lilka_bootloader
Closed

black-ghost-off wants to merge 2 commits into
mainfrom
yboichuk/feat/lilka_bootloader

Conversation

@black-ghost-off

@black-ghost-off black-ghost-off commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Summary

Keira for Lilka v2 is now built with the boot menu and partition table from lilka-bootloader. Keira and Retro-Go live on one flash and switch into each other. The web flasher installs this layout without any changes on its side.

Build and flashing

  • boot/lilka_v2/bootloader.bin and boot/lilka_v2/partitions.csv come from lilka-bootloader b070661. boot/README.md explains how to update them.
  • The new partition table: Keira app0 4 MB / app1 3 MB, Retro-Go apps (launcher, retro-core, …), SPIFFS 3.2 MB.
  • platformio.ini uses the new partition table. boot/bootloader.py (a pre-script) hands PlatformIO an absolute path to the custom bootloader, because custom_bootloader is resolved relative to the framework's variants dir. So pio run -t upload also writes the new bootloader.
  • CI puts our bootloader, the new partition table and a blank otadata (boot_app0.bin at 0xe000) into KeiraOS_merged*.bin. flasher.lilka.dev writes this file at 0x0 as before, and the board then starts Keira from app0.
  • CI: Python 3.11. Version 3.9 is no longer available on ubuntu-latest (Ubuntu 26.04), so setup-python failed.

Boot menu

Hold START on power-on or reset to get a menu:

  • Keira OS;
  • Retro-Go;
  • the last firmware from SD;
  • ESP32-S3 .bin files found on the SD card. One is written to app1 and runs once, like multiboot.

Retro-Go

  • New FlashImageApp: when a .bin/.img has a partition table at 0x8000, Keira copies its apps into the partitions with the same labels. It never touches the image's bootloader, its partition table, or Keira itself. Plain .bin files still go to multiboot.
  • .img files open from the file manager and the catalog (K_FT_BIN_HANDLER).
  • Applications → Retro-Go appears only when the launcher partition holds a valid app (esp_ota_get_partition_description).
  • The Retro-Go build for Lilka with return to Keira is make retro-go in lilka-bootloader. It produces retro-go_lilka.img.

Keira updates with more than 2 OTA apps

esp_ota_get_next_update_partition() from app1 returns Retro-Go's launcher:

  • Web OTA now writes to the other slot of app0/app1 (KeiraSystem::getUpdatePartition()).
  • KeiraUpdate (esp_https_ota in IDF 4.4 can't take a target partition) refuses the update instead of overwriting another app.
  • Multiboot gets the same fix in the SDK: fix: multiboot always uses the other Keira slot sdk#39.

WiFi

With SD and SPIFFS mounted, all 8 VFS slots of IDF 4.4 were taken:

  • console ×3, /dev/stdio, /spiffs, /sd, /tmp, root VFS;
  • WiFi.mode() → esp_vfs_lwip_sockets_register() → ESP_ERR_NO_MEM → abort(), so the board restarted in a loop.

The fix: lwip (esp_netif_init()) starts before any filesystem is mounted, and /tmp (the SPIRamVFS skeleton, nothing uses it yet) is no longer registered.

Migration

  • OTA updates replace only the app, so boards keep their old layout. The binary works there too: Retro-Go is hidden, and the installer reports "no apps for this partition table".
  • The new layout needs a one-time KeiraOS_merged*.bin over USB (flasher). SPIFFS sits at a different offset, so its old contents are lost.

Testing

On Lilka v2:

  • KeiraOS_merged.bin built with the same commands as CI and written at 0x0 without an erase, like the flasher does: the ROM loads lilka-bootloader, and Keira starts from app0 with SD and SPIFFS mounted.
  • With SPIFFS mounted, Keira no longer crashes at boot with WiFi enabled. Before, it aborted on every boot.
  • WiFi connection and catalog download with SPIFFS mounted.
  • Installing retro-go_lilka.img from the file manager; Keira ↔ Retro-Go switching.
  • Boot menu: SD firmware.
  • clang-format 20.1.8 is clean on the changed files; cppcheck reports nothing on the new code.

Depends on lilka-dev/sdk#39 for multiboot.

🤖 Generated with Claude Code

- Lilka v2 is built with the boot menu and partition table from
  lilka-dev/lilka-bootloader (boot/): Keira app0/app1, Retro-Go apps, SPIFFS.
  KeiraOS_merged*.bin carries them (plus blank otadata), so the web flasher
  writes the new layout at 0x0 as before
- FlashImageApp installs the apps of a full flash image (retro-go_lilka.img)
  into the partitions with the same labels; .bin/.img from the file manager
  and the catalog go there when the file has a partition table at 0x8000
- Applications -> Retro-Go when Retro-Go is installed
- Keira updates target the other app0/app1 slot: web OTA picks it explicitly,
  KeiraUpdate refuses when esp_https_ota would overwrite another app
- Init lwip before mounting filesystems and drop the /tmp VFS: IDF 4.4 has
  8 VFS slots and WiFi aborted with ESP_ERR_NO_MEM once SPIFFS was mounted
- CI: Python 3.11 (3.9 is gone from ubuntu-latest)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lilka_bootloader

# Conflicts:
#	.github/workflows/firmware.yml
@frostmorn

frostmorn commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

same as for sdk piece, I may not push that, since we loose freedom for no reason

I mean, it would be more difficult to "install"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants