Skip to content

WIP hal/imx6ull: prepare kernel for secure boot#802

Draft
jmaksymowicz wants to merge 3 commits into
masterfrom
jmaksymowicz/imx6ull-hab
Draft

WIP hal/imx6ull: prepare kernel for secure boot#802
jmaksymowicz wants to merge 3 commits into
masterfrom
jmaksymowicz/imx6ull-hab

Conversation

@jmaksymowicz

Copy link
Copy Markdown
Contributor

Description

Remove the plugin, so that the whole image can be loaded and verified at once by the BootROM.
Fix problem with DCD data so that plugin is no longer necessary for correct initialization of DDR memory.
Add header containing definitions of HAB functions and values.
Map peripherals and memories required by HAB into the address space of the kernel.

TODO: create kernel API for calling HAB functions - it will require:

  • switching into kernel memory map so that addresses below 0xc00000000 are as expected
  • saving the r9 register before the HAB API call and restoring it afterwards
  • adding platformctl or another mechanism to make these functions available to userspace

Due to changes in kernel image structure it cannot be booted using existing SDP scripts and requires additional fixup after image creation:

  • It's necessary to store the size of the whole image after syspage programs have been appended to it into the size field of boot_data
  • For SDP boot it's necessary to zero out the dcd field in the IVT

Motivation and Context

Allow image to be used with secure boot and allow use of HAB functions within the kernel.

YT: MSH-42

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (refactoring, style fixes, git/CI config, submodule management, no code logic changes)

How Has This Been Tested?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: armv7a7-imx6ull

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

  • This PR needs additional PRs to work (list the PRs, preferably in merge-order).
  • I will merge this PR by myself when appropriate.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the i.MX 6ULL initialization code by replacing absolute jumps with relative branches, streamlining DCD configuration with a new macro, and adding 1:1 memory mappings for the HAB ROM API. It also introduces the hab_rvt.h header defining the HAB ROM Vector Table interface. Feedback on these changes highlights a syntax error in the assembly file due to an incorrect # prefix in ldr pseudo-instructions, and recommends defining hab_hdr_t as a structure rather than a single byte to align with the HABv4 specification.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread hal/armv7a/imx6ull/_init.S Outdated
Comment thread hal/armv7a/imx6ull/hab_rvt.h Outdated
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown

Unit Test Results

10 890 tests  ±0   10 220 ✅ ±0   53m 31s ⏱️ + 1m 1s
   680 suites ±0      670 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit fc74efd. ± Comparison against base commit 4b8784b.

♻️ This comment has been updated with latest results.

Change vector table to be PC-relative
Remove mapping for vector table at 0xffff0000 (now unused)
Explicitly state offset used by SDP scripts as origin

YT: MSH-42
This change breaks existing SDP scripts and requires a script to
finalize kernel image.

Move DDR initialization to DCD script.
Reset DDR modules to avoid having to skip part of initialization in case
of a warm reset.
Move watchdog initialization to kernel.

YT: MSH-42
@jmaksymowicz
jmaksymowicz force-pushed the jmaksymowicz/imx6ull-hab branch from 31259f6 to a8cab5b Compare July 10, 2026 15:40
Comment thread hal/armv7a/imx6ull/hab_api.h Outdated

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

C/C++test found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@jmaksymowicz
jmaksymowicz force-pushed the jmaksymowicz/imx6ull-hab branch from a8cab5b to cba1eb0 Compare July 10, 2026 15:56
Comment thread hal/armv7a/imx6ull/hab_api.c Fixed
Comment thread hal/armv7a/imx6ull/hab_api.c Fixed
Comment thread hal/armv7a/imx6ull/hab_api.c Fixed
Comment thread hal/armv7a/imx6ull/hab_api.c Fixed
@jmaksymowicz
jmaksymowicz force-pushed the jmaksymowicz/imx6ull-hab branch from cba1eb0 to 4a13e5e Compare July 10, 2026 16:09
@jmaksymowicz
jmaksymowicz force-pushed the jmaksymowicz/imx6ull-hab branch from 4a13e5e to fc74efd Compare July 13, 2026 13:41
for (i = 0; i < size; i += SIZE_PAGE) {
/* TODO: this could be optimized for contiguous blocks of physical memory */
pa = pmap_resolve(pmapp, (void *)(srcStart + i));
if (pa == 0) {
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