build icon indicating copy to clipboard operation
build copied to clipboard

Genio: Deprecate EFI/Grub in favor of proper uboot flow

Open HeyMeco opened this issue 1 month ago • 5 comments

Description

This PR allows boards like the radxa-nio-12l to utilise a faster and more compact boot flow.

Since Grub cannot apply device tree overlays this also allows for that too. For example to make use of MIPI displays or set the ram configuration for the board (overlays for ram configuration will follow in a PR soon) as on the mediatek platform that is done in the device tree and the upstream device tree is set for 4gb on Nio-12L (while there are 8 / 16 GB variants as well).

Tests

  • [x] Boot Radxa-Nio-12L
    • [x] Enable Overlay in /boot/armbianEnv.txt and check that it works

Summary by CodeRabbit

Release Notes

  • Chores
    • Updated board-specific boot configurations and serial console settings for Radxa Nio 12L
    • Added new boot environment configuration with improved initialization parameters
    • Implemented enhanced boot process with improved device tree handling and boot parameter management

✏️ Tip: You can customize this high-level summary in your review settings.

HeyMeco avatar Dec 07 '25 21:12 HeyMeco

Walkthrough

Adds U-Boot bootscript and bootenv for Genio family, shifts family config from GRUB/UEFI to bootscript-based variables, and updates Radxa NIO‑12L board config to set a serial console and declare a global firmware install flag while removing GRUB-with-DTB enablement and two post-config functions.

Changes

Cohort / File(s) Summary
Radxa NIO‑12L board config
config/boards/radxa-nio-12l.conf
Removed enable_extension "grub-with-dtb"; declared global SERIALCON="ttyS0:921600" and BOARD_FIRMWARE_INSTALL="-full"; removed post_family_config__nio12l_vendor_setup and post_family_config__nio12l_collabora_setup.
Genio boot environment
config/bootenv/genio.txt
New boot environment template with verbosity=1, bootlogo=false, and console=both.
Genio U‑Boot bootscript
config/bootscripts/boot-genio.cmd
New U-Boot bootscript that initializes boot vars, detects PARTUUID (fallback to LABEL), imports armbianEnv.txt if present, constructs bootargs, loads kernel/initramfs/DTB, applies kernel and user DT overlays with error handling and DT restore/fixups, then boots.
Genio family config
config/sources/families/genio.conf
Removed GRUB/UEFI-related options; added BOOTSCRIPT referencing boot-genio.cmd and BOOTENV_FILE="genio.txt"; overall shift from GRUB to bootscript-driven configuration.

Sequence Diagram(s)

sequenceDiagram
    actor UBoot as U-Boot
    participant Storage as Boot Storage (MMC/USB)
    participant Env as armbianEnv.txt / Env
    participant Kernel as Kernel & Initramfs
    participant FDT as Device Tree / Overlays

    UBoot->>Env: set defaults (rootdev, verbosity, console, bootlogo, earlycon)
    UBoot->>Storage: probe boot device, read PARTUUID
    alt PARTUUID found
        UBoot->>Env: set rootdev=PARTUUID=...
    else
        UBoot->>Env: use LABEL rootdev
    end
    UBoot->>Storage: attempt load armbianEnv.txt
    alt env present
        UBoot->>Env: import overrides
    else
        UBoot->>Env: keep defaults
    end
    UBoot->>Kernel: load kernel image
    UBoot->>Kernel: load initramfs (if present)
    UBoot->>FDT: load base DTB
    UBoot->>FDT: apply kernel-provided overlays
    alt overlay application fails
        UBoot->>FDT: restore original DTB
    end
    UBoot->>FDT: apply user DT fixups (if any)
    UBoot->>UBoot: assemble bootargs (console, verbosity, earlycon, docker opts, quirks)
    UBoot->>Kernel: boot kernel with initramfs and final DTB

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Attention points:
    • config/bootscripts/boot-genio.cmd: control flow for PARTUUID detection, env import fallback, overlay error handling, DT restore/fixups.
    • Cross-check config/sources/families/genio.conf variable names (BOOTSCRIPT, BOOTENV_FILE) match bootscript and bootenv file.
    • config/boards/radxa-nio-12l.conf: globalizing BOARD_FIRMWARE_INSTALL and SERIALCON changes expected behavior across build paths; verify no unintended side effects from removed post-config functions.

Possibly related PRs

  • armbian/build#8272 — Overlaps on U-Boot bootscript and env handling (boot-genio.cmd-style logic and overlay application).
  • armbian/build#8006 — Changes to Genio family and Radxa NIO‑12L configurations (bootenv/bootscript and related variables).
  • armbian/build#8668 — Modifies board/family variables like BOARD_FIRMWARE_INSTALL and SERIALCON and GRUB enablement patterns.

Suggested labels

Framework

Suggested reviewers

  • rpardini
  • igorpecovnik

Poem

🐰 I hopped through scripts and DTBs bright,

PARTUUIDs found by moonlit night,
Envvars set, overlays applied,
From GRUB to U‑Boot I proudly glide,
Genio boots now — what a sight! 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the primary change: migrating from EFI/GRUB boot flow to U-Boot for Genio boards, matching the file changes and PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Dec 07 '25 21:12 coderabbitai[bot]

@djurny Can we make use of boot script templating here?

igorpecovnik avatar Dec 08 '25 06:12 igorpecovnik

@djurny Can we make use of boot script templating here?

Hi @igorpecovnik @HeyMeco , The current generic bootscript does not have the rootdev determination, which is a cool thing to have!

I'm currently trying to have Helios4 use the generic bootscript and found some adjustments are already needed. I'll add this detection to the generic bootscript as well.

The remainder of the bootscript seems to be something that the generic bootscript can handle.

In short, we cannot make use of the generic bootscript in this case yet.

Groetjes,

djurny avatar Dec 08 '25 08:12 djurny

While we're at it. I think we should add more logging / comments to the generic boot script. It took me quite a while to figure everything out as someone who hadn't looked into this aspect of u-boot prior.

HeyMeco avatar Dec 08 '25 08:12 HeyMeco

Please have a look at the inline comments.

Thanks for the extensive feedback. Will update this PR

HeyMeco avatar Dec 09 '25 12:12 HeyMeco

@djurny Would appreciate your feedback on the comment addressed variant now :)

✅ Functionality is validated on hardware therefore squash mergeable from my perspective

HeyMeco avatar Dec 11 '25 10:12 HeyMeco

@igorpecovnik this is ready to be approved for merge now

HeyMeco avatar Dec 11 '25 12:12 HeyMeco