Skip to content

fastboot: add image profiles, rootfs_ref ramdisk resolution, and SpacemiT K3 support - #3285

Merged
nuclearcat merged 6 commits into
kernelci:mainfrom
Sutter099:main
Dec 2, 2026
Merged

nuclearcat merged 6 commits into
kernelci:mainfrom
Sutter099:main

Conversation

@Sutter099

Copy link
Copy Markdown

Summary

Modernize the fastboot LAVA path and add SpacemiT K3 support: image profiles, rootfs_ref-based ramdisk resolution, bounded ext4 images, a spacemit-k3 profile, shell quoting, and buildroot/Debian prompts.

Changes

  • runtime: add a shellquote Jinja filter backed by shlex.quote.
  • lava: use boot_deploy_timeout in the total job timeout, default 15.
  • fastboot: move image packaging into fastboot/profiles/*.jinja2; the default android profile keeps existing behaviour.
  • fastboot: resolve the ramdisk from node.artifacts.ramdisk, then params.ramdisk (rootfs_ref), then params.ramdiskroot + '/rootfs.cpio.gz', and fail explicitly otherwise. Rootfs URLs are supplied by the configuration layer.
  • fastboot: add bounded ext4 construction and the spacemit-k3 bootfs profile.
  • kselftest: add the opt-in kselftest_shallow_clone overlay setting.
  • boot prompts: accept / #, ~ # and root@[^:]+:~#.

Behaviour change

Fastboot jobs must supply a ramdisk through a node artifact or rootfs_ref; the template now fails explicitly instead of rendering an empty ramdisk URL. Node artifacts take precedence over rootfs_ref.

Dependencies

Required by the kernelci-pipeline K3 change; merge this first because the pipeline jobs depend on shellquote and the spacemit-k3 profile.

Copilot AI balanced review requested due to automatic review settings November 25, 2026 11:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.


{% macro prepare(kernel, dtb, ramdisk, firmware=none) -%}
{% set append_dtb = fastboot_boot_image_format|default('android-header-dtb') == 'appended-dtb' %}
{% set cmdline = fastboot_kernel_cmdline|default('console=ttyMSM0,115200n8 earlycon qcom_geni_serial.con_enabled=1 mem_sleep_default=s2idle mitigations=auto video=efifb:off') %}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @docularxu for fixing default cmdline! No behaviour change for existing android device now.

- {% set cmdline = fastboot_kernel_cmdline|default('console=ttyMSM0,115200n8 earlycon root=/dev/ram rw rootwait rdinit=/sbin/init ignore_loglevel clk_ignore_unused pd_ignore_unused fw_devlink=off no_console_suspend kernel.sched_pelt_multiplier=4 mem_sleep_default=s2idle mitigations=auto video=efifb:off') %}
+ {% set cmdline = fastboot_kernel_cmdline|default('console=ttyMSM0,115200n8 earlycon qcom_geni_serial.con_enabled=1 mem_sleep_default=s2idle mitigations=auto video=efifb:off') %}

@nuclearcat

Copy link
Copy Markdown
Member

The generated env_k3.txt sets ramdisk_addr, but K3 U-Boot’s loadramdisk command reads ramdisk_addr_r. The stock address happens to match 0x130000000, masking the typo.

Use the runtime Jinja environment in the fastboot test — runtime/init.py:133-133
test_fastboot_docker_image_is_optional constructs a plain Jinja Environment, so it never gets the shellquote filter registered here. Running python3 -m pytest tests/test_runtime.py -k fastboot on the PR head fails for both Docker settings with No filter named 'shellquote', before either deploy assertion runs. Load the template through the runtime helper so the test exercises the production filter setup

Group shlex with the standard-library imports. Blank line before shlex places it in third-party imports and will cause lint to fail.

Register a shellquote Jinja filter backed by shlex.quote so image profiles
can safely pass artifact filenames and command lines to shell commands.
Provide _get_jinja2_environment on Runtime so tests can exercise the
configured filter setup.

Signed-off-by: Yogesh Lal <yogesh.lal@oss.qualcomm.com>
Co-developed-by: Xinzheng Long <xinzheng.long@oss.qualcomm.com>
Signed-off-by: Xinzheng Long <xinzheng.long@oss.qualcomm.com>
Signed-off-by: Ze Huang <ze.huang@oss.qualcomm.com>
Add boot_deploy_timeout to the total job timeout while retaining the
existing 15-minute default. This allows K3 downloads and bootfs preparation
to receive a larger budget without changing other platforms.

Signed-off-by: Yogesh Lal <yogesh.lal@oss.qualcomm.com>
Co-developed-by: Xinzheng Long <xinzheng.long@oss.qualcomm.com>
Signed-off-by: Xinzheng Long <xinzheng.long@oss.qualcomm.com>
Signed-off-by: Ze Huang <ze.huang@oss.qualcomm.com>
Move image packaging and deploy labels into pluggable image profiles and
keep downloads, workload overlays, deploy and boot actions in the shared
template.

Resolve the ramdisk from the node artifact, the rootfs_ref-provided ramdisk
URL, or a rootfs root directory, and fail explicitly when none is set. Rootfs
URLs are supplied by the configuration layer, and kbuild nodes render without
a ramdisk artifact.

Keep modules optional, add the kselftest overlay only for kselftest
workloads, preserve the Qualcomm command line and timeout defaults in the
android profile, and accept both buildroot and Debian login prompts.

Signed-off-by: Yogesh Lal <yogesh.lal@oss.qualcomm.com>
Co-developed-by: Xinzheng Long <xinzheng.long@oss.qualcomm.com>
Signed-off-by: Xinzheng Long <xinzheng.long@oss.qualcomm.com>
Signed-off-by: Guodong Xu <guodong.xu@oss.qualcomm.com>
Signed-off-by: Ze Huang <ze.huang@oss.qualcomm.com>
Package a staged payload into an ext4 image with metadata headroom and
partition-capacity checks. Allow callers to select filesystem features
and verify the resulting image with e2fsck.

Signed-off-by: Yogesh Lal <yogesh.lal@oss.qualcomm.com>
Co-developed-by: Xinzheng Long <xinzheng.long@oss.qualcomm.com>
Signed-off-by: Xinzheng Long <xinzheng.long@oss.qualcomm.com>
Signed-off-by: Ze Huang <ze.huang@oss.qualcomm.com>
Package versioned kernel, initramfs, DTB and env_k3.txt files into bootfs.ext4.
Validate the initramfs entry point, partition capacity and firmware load
limits, relocating the DTB for large ramdisks.

Select bootfs flashing and host-side boot handling so the device dictionary
can run its bounded fastboot continue command. Keep firmware assumptions
and the K3 download/deploy timeouts within this profile.

Signed-off-by: Yogesh Lal <yogesh.lal@oss.qualcomm.com>
Co-developed-by: Xinzheng Long <xinzheng.long@oss.qualcomm.com>
Signed-off-by: Xinzheng Long <xinzheng.long@oss.qualcomm.com>
Signed-off-by: Ze Huang <ze.huang@oss.qualcomm.com>
Add the opt-in kselftest_shallow_clone setting to both LAVA selftest
templates. Select the master branch without a pinned revision and omit Git
history from the overlay. TESTPROG_URL is unchanged and already prefers the
xz archive with gzip fallback.

Signed-off-by: Yogesh Lal <yogesh.lal@oss.qualcomm.com>
Co-developed-by: Xinzheng Long <xinzheng.long@oss.qualcomm.com>
Signed-off-by: Xinzheng Long <xinzheng.long@oss.qualcomm.com>
Signed-off-by: Ze Huang <ze.huang@oss.qualcomm.com>
@Sutter099

Copy link
Copy Markdown
Author

Thanks @nuclearcat for the review :)

I have addressed the comments in the updated series:

  • Fixed the ramdisk_addr_r typo in the K3 fastboot profile.
  • Grouped shlex with standard library imports.
  • Exposed Runtime._get_jinja2_environment() and updated the fastboot testcase to use it.
  • Additionally, refactored steps in the fastboot templates to emit individual list items, preventing PyYAML from serializing
    multiline commands into escaped strings and greatly improving readability of the generated LAVA jobs:

Before:

        steps:
        - "\n\n\nKERNEL=Image.gz\nDTB=k3-pico-itx.dtb\n..."

After:

       steps:
       - KERNEL=Image.gz
       - DTB=k3-pico-itx.dtb
    

@nuclearcat
nuclearcat added this pull request to the merge queue Dec 2, 2026
Merged via the queue into kernelci:main with commit 0e739e8 Dec 2, 2026
3 checks passed
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.

4 participants