返回资讯中心
外部精选
软件工程
#开发者实时流

Haswell Native Raminit (NRI) + FSP Cross-Reference

A read-only reverse-engineering study of Intel Haswell (4th Gen

Hacker News 最新peter_d_sherman2026/11/10 · 7 天前30 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

A read-only reverse-engineering study of Intel Haswell (4th Gen Core) firmware that delivers a 6-patch NRI (Native Raminit) series for the in-tree coreboot, plus a 16-layer verification harness proving it correct.

This project is GPLv2-licensed (see LICENSE). The closed firmware binaries (FSP, mrc.bin) are not included and are not redistributable.

The story in one sentence: coreboot's Haswell port uses a closed mrc.bin blob for memory init. This project contributes 6 patches that make the in-tree GPL Haswell NRI (Native Raminit) work for DDR3-1600 and S3 resume — replacing mrc.bin entirely. The cross-referenced FSP 1.0 RE is bonus material that documents what the closed mrc.bin blob does internally.

Naming: libre-fsp = "libre" (FSF-aligned freedom) + "FSP" (the closed Intel firmware being opened). The "libre" prefix emphasizes that this is a freedom-respecting alternative to Intel's proprietary FSP — not just "open source" but the full four freedoms (use, study, modify, redistribute).

For new agents and contributors: see AGENTS.md for the complete reproducibility guide.

For the executive summary: see STATUS.md.

What is firmware and why is it special?

Firmware is the first software that runs when a computer powers on. It initializes the CPU, memory, storage, and peripherals before the operating system takes over. Because it has full hardware access and runs before any security boundaries are established, firmware is one of the most security-sensitive layers in any computer.

On x86 systems, firmware has traditionally been:

Both BIOS and UEFI implementations from PC vendors (Lenovo, Dell, HP, etc.) are typically:

Open source firmware isn't just an ideological preference. It addresses concrete technical problems:

Security. Closed firmware has been the entry point for multiple high-impact vulnerabilities:

Longevity. Vendor firmware support ends with the product lifecycle. Once a laptop is 3-5 years old, the vendor stops issuing firmware updates. New CPU vulnerabilities (Spectre, Meltdown, Downfall, etc.) require microcode updates, which ship through firmware. Without firmware updates, old hardware becomes a security liability even when the OS is up to date.

User control. Closed firmware means the user cannot:

Supply chain. Closed firmware is a supply chain risk because the binary is unverifiable. Open source firmware allows reproducible builds and signed binaries.

coreboot (formerly LinuxBIOS) is the open-source firmware project that this work builds on. Founded in 1999, it is:

coreboot's architecture is intentionally minimal: it does the minimum hardware init needed, then hands off to a payload that boots the OS. This keeps the trusted code base small (typically <100K LoC for the core init).

For modern Intel chipsets, Intel provides closed-source firmware blobs. The exact form has changed over the years:

For Haswell specifically, coreboot uses a closed mrc.bin blob (190KB, just the memory reference code) for the src/northbridge/intel/haswell/haswell_mrc/ path. The FSP 1.0 binary (512KB, includes silicon init) is a related but separate binary distributed by Intel. This project RE's the FSP 1.0 to inform the NRI development, but the patches in haswell-patchset/ actually replace mrc.bin, not FSP.

For Skylake and later, FSP 2.0/2.2 is mandatory and does much more work (memory, silicon init, early init, security extension). Replacing FSP 2.x is a much larger effort than replacing mrc.bin for Haswell. This project focuses on Haswell because that's where the closed blob is small and tractable.

The FSP-encoded body is obfuscated with the FSPD 0x87654321 magic at the entry, and the entire code section is XOR'd. The encoding can only be undone by running the FSP, which is prohibited by its EULA.

This creates a paradox for open source firmware on modern hardware:

This project addresses that paradox for Haswell specifically, by completing the in-tree NRI (Native Raminit) to the point where it can replace mrc.bin for memory init, and giving the coreboot community a tested, verified alternative.

The path to fully open source firmware on modern Intel hardware requires replacing each closed blob with GPL-licensed equivalents. The work falls into several major areas:

Native Raminit (NRI) is the focus of this project. NRI is coreboot's GPL re-implementation of the memory reference code (MRC) for a specific chipset. For Haswell, the NRI is at coreboot/src/northbridge/intel/haswell/native_raminit/ (9,600 LoC, 28 files). It implements:

The 6-patch series in this project (haswell-patchset/) adds DDR3-1600 support and S3 resume to the Haswell NRI. These patches are chipset-level (Haswell), not mainboard-level — they apply to all Haswell hardware using the in-tree NRI, including:

The T440p was chosen as the test case because it has DDR3-1600 SO-DIMMs and the most active community of users who wanted open source firmware on it. But the patches are not T440p-specific — any board using the in-tree Haswell NRI will benefit.

This project is one step in the multi-year effort to fully open-source Haswell firmware. Specifically:

6-patch NRI series (chipset-level, not mainboard-specific): enables DDR3-1600 and S3 resume on the in-tree Haswell NRI. Applies to any Haswell hardware using the NRI (T440p, T440, NUC, etc.). Two features the open-source firmware community has long requested.

FSP 1.0 RE docs (9 documents): structural analysis of the related FSP 1.0 binary, with the public ABI extracted and the ~22 MRC tasks catalogued from string anchors. Useful for understanding what mrc.bin does internally (since they implement the same MRC algorithm), and as a reference for extending the NRI to newer chipsets.

16-layer verification harness: proves the patches are correct, the NRI produces the same MCHBAR programming as the FSP mrc.bin (91 demo writes, 89 NRI match, 81 NRI==FSP, 0 mismatches), and the NRI source compiles and runs under Unicorn 1.0.3 with bitfield-accurate struct assignments.

NRI-Unicorn compile-check harness: the only known way to run real NRI C code under a CPU emulator, by stubbing the dependencies and capturing MCHBAR writes through a shadow region at 0x90000000. Caught a real bitfield bug (RX_TRAIN_RANK encoding).

Reproducibility infrastructure: environment setup, dependency management, AGENTS.md, CONTRIBUTING.md, so that the work can be reproduced and extended by others.

The project also serves as a case study in how to reverse-engineer a closed firmware blob legally and ethically, and how to incrementally replace closed components with open-source equivalents.

Component What Where

6-patch NRI series Chipset-level: DDR3-1600 + S3 resume + A0/LPDDR3/ECC guards for the in-tree Haswell NRI haswell-patchset/

NRI-Unicorn harness Emulates the NRI's MCHBAR programming under Unicorn 1.0.3 unicorn_harness/

Verification harness 16 layers of offline checks (no real hardware needed) verify/

FSP 1.0 RE docs 9 docs covering the related FSP 1.0 binary (same MRC algorithm as mrc.bin) re-docs/

FSP RE artifacts 1,601 FSP strings, MRC task list, FSP_INFO_HEADER parsed raw/

FSP RE scripts FV/FFS/FSPH parser, string extractor, API entry wrapper scripts/

Verify docs 4 docs covering the harness, xref, compile-check verify-docs/

Headline findings

The FSP is FSP 1.0 (3 API entries: TempRamInit, FspInit, NotifyPhase) — a more limited API than FSP 1.1+ that coreboot's fsp1_1 driver assumes.

The whole FSP image is a single UEFI PI Firmware Volume (FV) with one FFS file (the FSP file GUID 912740BE-2284-4734-b971-84b027353f0c) of type RAW. The FSP_INFO_HEADER is at file offset 0x94, image-relative.

The FSP image is loaded by the bootloader at the preferred base 0xfff60000 (top-of-32-bit memory) and runs from there.

The FSP image contains a complete PEI core (PeiCore, PeiDispatcher, PeiServices, PeiInstallPeiMemory, PeiCreateHob) plus an MRC (memory reference code) and a silicon init module.

The FSP body is FSP-encoded x86-64 (an instruction-level obfuscation keyed on the 4-byte magic 0x87654321 aka "FSPD" at the FSP base). The plaintext region is only the 3 API entry stubs, the common dispatch helper, the metadata (FV/FFS/RAW/FSPH/VPD/UPD), and the embedded VBT/VBIOS. The encoded section cannot be decoded without running the FSP, which the legal posture forbids.

The default UPD region (the template the BCT can patch) has a 'HSWLPT-U' signature at image-relative offset 0x79d0 and a 0x55AA terminator 0x310 bytes later. It contains 42 PCDs covering SPD SMBus addresses, TSEG, IGD, audio, SATA, XHCI, EHCI, SMBus, board type, and FastBoot.

The FSP supports HSW B0/C0 steppings and Lynx Point PCH B0 stepping. ULT stepping is not supported (the ULT stepping A0 silicon is rejected).

The FSP produces the standard FSP HOBs: FSP_BOOTLOADER_TEMPORARY_MEMORY_HOB_GUID, FSP_NON_VOLATILE_STORAGE_HOB_GUID, and resource descriptor HOBs with the 3 FSP owner GUIDs.

coreboot's open-source 9,600-line Haswell NRI implements ~75% of the FSP-M task list by file count; the missing ~25% maps cleanly to the strings "GDXC", "MemoryTrace", "ChannelHash", "RMT" — features the FSP includes that the in-tree NRI does not.

The FSP also embeds the VBT ($VBT HASWELL) and a full Haswell PCI SVGA Option ROM ("1215Intel(R) HSW Mobile/Desktop PCI Accelerated SVGA BIOS") in the Si-init code path.

The NRI-Unicorn compile-check caught a real bitfield bug in the original demo: RX_TRAIN_RANK was hardcoded as 0x00010420 with a wrong rcven=64<<10 comment, but the actual NRI bitfield layout (rcven:9 bits 0-8, dqs_p:6 bits 14-9, dqs_n:6 bits 25:20) produces 0x02004040. Only the C struct compiler catches this kind of error.

16/16 verification layers pass

91 demo MCHBAR captures (Layer 13), 89 NRI match, 81 NRI==FSP

47 compile-check captures (Layer 14), 47/47 bitfield-verified

0 mismatches across all 89 documented NRI values

6 T440p patches apply cleanly to coreboot

Documents

File Contents

README.md this file — project entry point

AGENTS.md complete reproducibility guide for agents

STATUS.md executive summary with all numbers

CHANGELOG.md release notes

CONTRIBUTING.md how to contribute

LICENSE GPLv2

re-docs/00-source-inventory.md provenance, legal posture, scope

re-docs/01-binary-structural-analysis.md FV/FFS/FSPH walk, encoded section

re-docs/02-task-map.md 60+ MRC task map from string anchors

re-docs/03-fsp-contract.md public FSP 1.0 contract

re-docs/04-divergence-from-hsw-nri.md what FSP does that NRI doesn't

re-docs/05-references.md EAS PDFs, datasheets, public sources

re-docs/06-mrc-verification-depth.md mrc.bin L1-L5 Unicorn ladder

re-docs/07-mrc-ghidra-re.md MRC body RE

re-docs/08-haswell-port-audit.md T440p port audit

verify-docs/09-unicorn-emulation-survey.md Phase 1 NRI MMIO surface

verify-docs/10-unicorn-emulation-harness.md MCHBAR shadow capture

verify-docs/11-mchbar-crossref.md NRI vs FSP mrc.bin xref (91 writes)

verify-docs/12-nri-compile-check.md compile-check (47 writes)

raw/ 1,601 FSP strings, MRC task list, FSP_INFO_HEADER

scripts/ FV/FFS/FSPH parser, string extractor

Methodology

For every claim, the document cites the source — whether the binary, a public header, a public datasheet, or the GPL coreboot code. The "Legal posture" section of re-docs/00-source-inventory.md is the controlling document for what was and was not done.

The FSP binary was not executed. The FSP binary was loaded into a RE tool (Ghidra, IDA-class) as a raw binary at the FSP preferred base 0xfff60000 and disassembled at the three plaintext API entry points only. The FSP-encoded section was identified by structural signature but not decoded (would require running the FSP, which the legal posture forbids).

This is not a redistributable copy of the FSP binary or mrc.bin. The closed blobs are not in this package.

This is not a complete re-implementation of the FSP. The 6 NRI patches replace mrc.bin for memory init, not the FSP for silicon init. Silicon init is partially in coreboot and partially in the

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →