Skip to content

SM8250: add missing grub.cfg generation script#2496

Closed
aenertia wants to merge 1 commit intoROCKNIX:nextfrom
aenertia:fix/sm8250-grub-config
Closed

SM8250: add missing grub.cfg generation script#2496
aenertia wants to merge 1 commit intoROCKNIX:nextfrom
aenertia:fix/sm8250-grub-config

Conversation

@aenertia
Copy link
Copy Markdown
Contributor

Summary

  • What is the goal of this PR?

PR #2457 (1fcfc86) switched SM8250 from qcom-abl to arm-efi (GRUB)
but did not include a bootloader/grub script to generate grub.cfg.

Without this script, GRUB boots with no configuration. The kernel receives
no cmdline parameters, so the init script cannot resolve
boot=LABEL=ROCKNIX and the device shuts down with:

Unable to find volume labeled ROCKNIX

This adds the grub config generation script with menu entries for all
four SM8250 device variants (RP5, RPFlip2, RPMini, RPMiniV2).

Testing

  • How was this tested?

    • Root cause confirmed by comparing working arm-efi devices against
      SM8250 — all other arm-efi devices have a bootloader/grub script,
      SM8250 does not.
    • Verified that upstream nightly CICD images fail to boot on SM8250
      with the "Unable to find volume labeled ROCKNIX" error.
    • Traced the boot flow through busybox/scripts/init to confirm the
      failure occurs at mount_common() when $boot is empty (no cmdline).
    • Build tested targeting SM8250 aarch64.
  • Test results:

    • Without fix: Device reaches GRUB → kernel boots → init fails at
      volume label detection → shutdown.
    • With fix: grub.cfg is generated with correct boot=LABEL=ROCKNIX disk=LABEL=STORAGE cmdline and device-specific DTB references.

Additional Context

  • Every device using BOOTLOADER="arm-efi" requires a bootloader/grub
    script to generate grub.cfg. SM8250 was the only arm-efi device
    missing this script after the revert in PR SM8250: revert back to standard kernel setup #2457.
  • SM6115 also uses mkimage_options="abl,grub,dtb" — it may have a
    similar issue if its grub script is missing (not investigated here).

AI Usage

Did you use AI tools to help write this code? PARTIALLY

AI tools were used to trace the boot failure through the init script,
identify the missing grub config generation script by comparing device
bootloader configurations, and cross-reference recent upstream commits.
The fix itself follows the established pattern used by other arm-efi
devices in the project.

PR ROCKNIX#2457 switched SM8250 from qcom-abl to arm-efi but did not include
the bootloader/grub script needed to generate grub.cfg. Without it,
GRUB boots with no config, the kernel gets no cmdline, and init fails
with 'Unable to find volume labeled ROCKNIX'.

Adds grub config generation with entries for all SM8250 variants.
@github-actions github-actions bot added the ai-generated This PR was generated or assisted by AI tools label Mar 31, 2026
@aenertia aenertia marked this pull request as ready for review March 31, 2026 02:57
@spycat88
Copy link
Copy Markdown
Contributor

Sorry this is wrong we have a function to dynamically generate the grub.cfg

@aenertia
Copy link
Copy Markdown
Contributor Author

Yeah I wasn't sure; but something isn't firing since the revert making the CI nightlies broken

@aenertia aenertia marked this pull request as draft March 31, 2026 06:07
@spycat88
Copy link
Copy Markdown
Contributor

I have the following grub.cfg produced at ~/distribution/build.ROCKNIX-SM8250.aarch64/image/system/usr/share/bootloader/boot/grub/grub.cfg

insmod part_gpt
insmod part_msdos
load_env

if [ "${saved_entry}" ]; then
  set timeout=2
  set default="${saved_entry}"
else
  set timeout=-1
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi
export menuentry_id_option

function savedefault {
  saved_entry="${chosen}"
  save_env saved_entry
}

set timeout_style=menu
set lang=en_US
loadfont /boot/grub/dejavu-mono.pf2
set rotation=270
set gfxmode=auto
insmod efi_gop
insmod gfxterm
terminal_output gfxterm
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue

menuentry 'Retroid Pocket 5' $menuentry_id_option 'rp5' {
        savedefault
        search --set -f /KERNEL
        linux /KERNEL boot=LABEL=ROCKNIX disk=LABEL=STORAGE grub_portable quiet rootwait console=tty0
        devicetree /boot/grub/sm8250-retroidpocket-rp5.dtb
}
menuentry 'Retroid Pocket Flip2' $menuentry_id_option 'rpflip2' {
        savedefault
        search --set -f /KERNEL
        linux /KERNEL boot=LABEL=ROCKNIX disk=LABEL=STORAGE grub_portable quiet rootwait console=tty0
        devicetree /boot/grub/sm8250-retroidpocket-flip2.dtb
}
menuentry 'Retroid Pocket Mini' $menuentry_id_option 'rpmini' {
        savedefault
        search --set -f /KERNEL
        linux /KERNEL boot=LABEL=ROCKNIX disk=LABEL=STORAGE grub_portable quiet rootwait console=tty0
        devicetree /boot/grub/sm8250-retroidpocket-rpmini.dtb
}
menuentry 'Retroid Pocket Mini V2' $menuentry_id_option 'rpminiv2' {
        savedefault
        search --set -f /KERNEL
        linux /KERNEL boot=LABEL=ROCKNIX disk=LABEL=STORAGE grub_portable quiet rootwait console=tty0
        devicetree /boot/grub/sm8250-retroidpocket-rpminiv2.dtb
}
menuentry 'Retroid Pocket 5 RECOVERY' $menuentry_id_option 'rp5-recovery' {
        search --set -f /KERNEL
        linux /KERNEL boot=LABEL=ROCKNIX disk=LABEL=STORAGE grub_portable quiet rootwait console=tty0 recovery
        devicetree /boot/grub/sm8250-retroidpocket-rp5.dtb
}
menuentry 'Retroid Pocket Flip2 RECOVERY' $menuentry_id_option 'rpflip2-recovery' {
        search --set -f /KERNEL
        linux /KERNEL boot=LABEL=ROCKNIX disk=LABEL=STORAGE grub_portable quiet rootwait console=tty0 recovery
        devicetree /boot/grub/sm8250-retroidpocket-flip2.dtb
}
menuentry 'Retroid Pocket Mini RECOVERY' $menuentry_id_option 'rpmini-recovery' {
        search --set -f /KERNEL
        linux /KERNEL boot=LABEL=ROCKNIX disk=LABEL=STORAGE grub_portable quiet rootwait console=tty0 recovery
        devicetree /boot/grub/sm8250-retroidpocket-rpmini.dtb
}
menuentry 'Retroid Pocket Mini V2 RECOVERY' $menuentry_id_option 'rpminiv2-recovery' {
        search --set -f /KERNEL
        linux /KERNEL boot=LABEL=ROCKNIX disk=LABEL=STORAGE grub_portable quiet rootwait console=tty0 recovery
        devicetree /boot/grub/sm8250-retroidpocket-rpminiv2.dtb
}

Please check yours

@aenertia
Copy link
Copy Markdown
Contributor Author

Yup ; I'm getting the Grub entries on the nightly but am getting missing ROCKNIX label entry error from the stage1 boot. This is after a clean flash from the sm8250 img from the 30th. Hrm; I wonder if it's the card (512GB Evo A2 Samsung) I see there was a revert on the sm8650 for high speed modes being flakey, wonder if it's the same issue?

@aenertia
Copy link
Copy Markdown
Contributor Author

he card I was using was working just fine in the same device ; with custom / previous builds no issues. So something has changed. I didn't take note of the build on it prior to nightly flash - but it was one of my early rxnm integration builds so probably a month or so old.
I DID flash the abl prior to it appearing (was stock on that particular device).

@loki666
Copy link
Copy Markdown
Contributor

loki666 commented Mar 31, 2026

took me 5 min, to download the 20260330 image, flash it and check the content.
files are there

@loki666 loki666 closed this Mar 31, 2026
@aenertia
Copy link
Copy Markdown
Contributor Author

Yup ; it's not the generation like I first thought. It's something else that's different between ABL update and fresh Flash.

@aenertia
Copy link
Copy Markdown
Contributor Author

Apologies for the noise with the grub.cfg script — @spycat88 and @loki666 were
right that generate_grub_cfg_body() handles this correctly. I should have
traced that codepath more carefully before opening the PR.

That said, the boot failure I reported is real and reproducible. The same device
(RP5) and card (new 512GB Samsung Evo A2) were working without issues on
previous builds. The failure appeared after flashing ROCKNIX ABL v1.0.0 (from
stock) and booting the 20260330 nightly — the grub menu shows up fine, kernel
boots, but init fails at mount_part "LABEL=ROCKNIX" and the device shuts down.

I did some deeper analysis of the ABL and the boot chain that might be useful
context for anyone debugging SM8250 boot issues:

SM8250 boot flow with ROCKNIX ABL v1.0.0 (from binary analysis of the ELF):
ABL BootCFW ├─ LoadBootImg: scans for \KERNEL on FAT volumes │ → finds it, but rejects it (raw Image, no ANDROID-BOOT! header) │ (expected: arm-efi builds raw Image, not mkbootimg) └─ BootESP (fallback): loads \EFI\BOOT\BOOTAA64.EFI → GRUB └─ GRUB reads /boot/grub/grub.cfg (built with -p /boot/grub prefix) └─ Boots kernel with correct cmdline ✓

The grub.cfg and cmdline (boot=LABEL=ROCKNIX disk=LABEL=STORAGE) are correct.
The failure is downstream — the kernel can't mount the ROCKNIX-labelled FAT
partition within the 15-second retry window in init. This points to something at
the storage/MMC layer rather than the bootloader config.

Worth noting the SM8650 just had SD UHS-I disabled (83d384dcea) for stability
reasons. Could be something similar affecting SM8250 with certain cards after
the kernel config changes in PR #2457.

Will continue debugging on my end and open a proper issue if I can narrow it
down further.

@aenertia
Copy link
Copy Markdown
Contributor Author

So kioxera 16gb card works. But nice A2 Samsung Evoplus V30, doesn't with the ABL

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

Labels

ai-generated This PR was generated or assisted by AI tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants