Lab 5: i.MX6ULL Boot-Strap Decoder, AAPCS32/.bss Guard & VFS Panic Triage Engine

60 minfree previewLinux 6.12C11glibc 2.39← module 5

Calculate 115200 8N1 UART bit timing, eliminate RTS/CTS flow-control console deadlocks, decode i.MX6ULL BOOT_MODE/BOOT_CFG straps and UUU SDP-to-Fastboot provisioning, and triage bare-metal AAPCS32/.bss, U-Boot PHY/bootargs, and kernel VFS rootfs faults.

Prerequisites in this module

What ./check.sh verifies

  • Builds libcore.a and lab_cli cleanly with -std=c11 -Wall -Wextra -Werror.
  • Fix compiler warnings or errors in files/core.c.
  • Archives core.o into libcore.a and links independent TAP verifier.
  • Preserve public declarations in files/core.h so tests.c links.
step 1/15

step 1/15 · inspect starter files and specification

Early board bring-up failures rarely print polite stack traces: wrong BOOT_MODE switches produce total silence, 0x80200004 stacks crash only inside 64-bit printf, and missing rootwait panics VFS 40 ms before eMMC probes.

In this studio, you implement a deterministic C11 bring-up diagnostic engine that decodes hardware strap registers, validates AAPCS32/.bss/IVT invariants, and classifies VFS boot panics.

learner@ksa: ~/gl-e00/lab-m05
learner@ksa:~/gl-e00/lab-m05ls -lastarter/Makefilestarter/cli.cstarter/core.cstarter/core.hlearner@ksa:~/gl-e00/lab-m05
starter: starter/Makefile
learner@ksa: ~/gl-e00/lab-m05
learner@ksa:~/gl-e00/lab-m05$ bat starter/Makefile File: starter/Makefile    CC_BIN = gcc    AR = ar    CFLAGS_ALL = -std=c11 -Wall -Wextra -Werror -O2     LDLIBS =         all: libcore.a lab_cli        libcore.a: core.o    	$(AR) rcs $@ $^        lab_cli: cli.o libcore.a    	$(CC_BIN) $(CFLAGS_ALL) cli.o libcore.a $(LDLIBS) -o $@        %.o: %.c core.h    	$(CC_BIN) $(CFLAGS_ALL) -c $< -o $@        .PHONY: all clean    clean:    	rm -f core.o cli.o libcore.a lab_cli
starter: starter/cli.c
learner@ksa: ~/gl-e00/lab-m05
learner@ksa:~/gl-e00/lab-m05$ bat starter/cli.c File: starter/cli.c    #define _POSIX_C_SOURCE 200809L    #include "core.h"        #include <stdint.h>    #include <stdio.h>    #include <stdlib.h>    #include <string.h>    #include <time.h>        static int cmp_u64(const void *a, const void *b)    {    	uint64_t va = *(const uint64_t *)a;    	uint64_t vb = *(const uint64_t *)b;    	return (va > vb) - (va < vb);    }        static int run_bench(void)    {    	uint64_t samples[40];    	volatile uint32_t sink = 0U;        	for (int w = 0; w < 5; w++) {    		struct boot_strap_report rep;    		decode_boot_straps(0x00000860U, 0x02000000U, true, false, &rep);    		sink ^= (uint32_t)rep.target ^ validate_startup_abi(0x80200000U, 0x80010000U, 0x80014000U, 0x400U);    	}        	for (int s = 0; s < 40; s++) {    		struct timespec t0, t1;    		clock_gettime(CLOCK_MONOTONIC, &t0);    		for (int iter = 0; iter < 500; iter++) {    			struct boot_strap_report r1, r2;    			decode_boot_straps(0x00000860U, 0x02000000U, true, true, &r1);    			decode_boot_straps(0x00000080U, 0x01000000U, true, false, &r2);    			sink ^= validate_startup_abi(0x80200004U, 0x80010000U, 0x80014002U, 0x400U);    			sink ^= (uint32_t)triage_vfs_boot_panic("console=ttymxc0,115200 root=/dev/mmcblk1p2 rw", 512U, 179U);    			sink ^= (uint32_t)r1.target + (uint32_t)r2.target;    		}    		clock_gettime(CLOCK_MONOTONIC, &t1);    		samples[s] = (uint64_t)(t1.tv_sec - t0.tv_sec) * 1000000000ULL +    		             (uint64_t)(t1.tv_nsec - t0.tv_nsec);    	}    	qsort(samples, 40U, sizeof(samples[0]), cmp_u64);    	printf("BENCH lab_m05_boot_fault_triage clock=CLOCK_MONOTONIC batches=40x500 "    	       "p50_ns=%llu p95_ns=%llu p99_ns=%llu sink=%u\n",    	       (unsigned long long)samples[20],    	       (unsigned long long)samples[38],    	       (unsigned long long)samples[39],    	       sink);    	return 0;    }        int main(int argc, char **argv)    {    	if (argc > 1 && strcmp(argv[1], "--bench") == 0)    		return run_bench();        	struct boot_strap_report emmc_rep, sdp_rep;    	decode_boot_straps(0x00000860U, 0x02000000U, true, true, &emmc_rep);    	decode_boot_straps(0x00000860U, 0x01000000U, true, false, &sdp_rep);        	uint32_t abi_ok = validate_startup_abi(0x80200000U, 0x80008000U, 0x80009000U, 0x400U);    	uint32_t abi_bad = validate_startup_abi(0x80200004U, 0x80008000U, 0x80009002U, 0x000U);    	enum vfs_fault_kind vfs_mmc = triage_vfs_boot_panic(    		"console=ttymxc0,115200 root=/dev/mmcblk1p2 rw", 512U, 179U);        	printf("STRAPS emmc_target=%d tx_deadlocked=%d sdp_override_target=%d\n",    	       (int)emmc_rep.target, emmc_rep.console_tx_deadlocked ? 1 : 0, (int)sdp_rep.target);    	printf("CRT0_ABI clean_flags=0x%x broken_flags=0x%x\n", abi_ok, abi_bad);    	printf("VFS_PANIC mmc_no_rootwait_kind=%d\n", (int)vfs_mmc);    	return 0;    }
starter: starter/core.c
learner@ksa: ~/gl-e00/lab-m05
learner@ksa:~/gl-e00/lab-m05$ bat starter/core.c File: starter/core.c    #include "core.h"        #include <string.h>        void decode_boot_straps(uint32_t sbmr1, uint32_t sbmr2, bool three_wire_uart,                            bool crtscts_enabled, struct boot_strap_report *out)    {    	uint32_t bmod = (sbmr2 >> 16U) & 0x3U; /* BUG: wrong SBMR2 shift for BMOD[25:24]! */    	uint32_t cfg1_hi = (sbmr1 >> 4U) & 0xFU;    	uint32_t usdhc_port = (sbmr1 >> 11U) & 0x1U;        	if (!out)    		return;        	out->console_tx_deadlocked = three_wire_uart && crtscts_enabled;        	if (bmod == 0x1U) {    		out->target = BOOT_TARGET_USB_SDP;    		return;    	}    	if (bmod == 0x0U) {    		out->target = BOOT_TARGET_FUSE;    		return;    	}    	if (bmod != 0x2U) {    		out->target = BOOT_TARGET_UNKNOWN;    		return;    	}    	if ((cfg1_hi & 0x8U) != 0U)    		out->target = BOOT_TARGET_GPMI_NAND;    	else if ((cfg1_hi == 0x4U || cfg1_hi == 0x5U) && usdhc_port == 0U)    		out->target = BOOT_TARGET_USDHC1_SD;    	else if ((cfg1_hi == 0x6U || cfg1_hi == 0x7U) && usdhc_port == 1U)    		out->target = BOOT_TARGET_USDHC2_EMMC;    	else    		out->target = BOOT_TARGET_UNKNOWN;    }        uint32_t validate_startup_abi(uint32_t sp_init, uint32_t bss_start,                                  uint32_t bss_end, uint32_t ivt_offset)    {    	uint32_t errs = STARTUP_OK;        	if ((sp_init & 0x3U) != 0U) /* BUG: checks 4-byte instead of 8-byte AAPCS32 alignment! */    		errs |= STARTUP_ERR_SP_ALIGN8;    	if (bss_end < bss_start)    		errs |= STARTUP_ERR_BSS_ORDER;    	if (((bss_start | bss_end) & 0x3U) != 0U)    		errs |= STARTUP_ERR_BSS_ALIGN4;    	if (ivt_offset != 0x400U)    		errs |= STARTUP_ERR_IVT_OFFSET;    	return errs;    }        enum vfs_fault_kind triage_vfs_boot_panic(const char *bootargs, size_t cbsize_limit,                                              uint32_t root_major)    {    	size_t len;        	if (!bootargs || cbsize_limit == 0U)    		return VFS_FAULT_MISSING_ROOT_ARG;        	len = strlen(bootargs);    	if (len >= cbsize_limit - 1U)    		return VFS_FAULT_CMDLINE_TRUNCATED;    	if (strstr(bootargs, "root=") == NULL)    		return VFS_FAULT_MISSING_ROOT_ARG;    	if (strstr(bootargs, "root=/dev/nfs") != NULL &&    	    (root_major == 0U && strstr(bootargs, "ip=") == NULL))    		return VFS_FAULT_NFS_CONFIG_OR_IP;    	if ((root_major == 179U || strstr(bootargs, "root=/dev/mmcblk") != NULL) &&    	    false /* BUG: forgets to flag missing rootwait on async mmcblk mount! */)    		return VFS_FAULT_MMC_MISSING_ROOTWAIT;    	return VFS_FAULT_NONE;    }
starter: starter/core.h
learner@ksa: ~/gl-e00/lab-m05
learner@ksa:~/gl-e00/lab-m05$ bat starter/core.h File: starter/core.h    #ifndef KSA_LAB_M05_BOOT_FAULT_TRIAGE_H    #define KSA_LAB_M05_BOOT_FAULT_TRIAGE_H        #include <stdbool.h>    #include <stddef.h>    #include <stdint.h>        enum imx_boot_target {    	BOOT_TARGET_FUSE = 0,    	BOOT_TARGET_USB_SDP,    	BOOT_TARGET_USDHC1_SD,    	BOOT_TARGET_USDHC2_EMMC,    	BOOT_TARGET_GPMI_NAND,    	BOOT_TARGET_UNKNOWN,    };        enum startup_err_flags {    	STARTUP_OK                = 0U,    	STARTUP_ERR_SP_ALIGN8     = 1U << 0,    	STARTUP_ERR_BSS_ORDER     = 1U << 1,    	STARTUP_ERR_BSS_ALIGN4    = 1U << 2,    	STARTUP_ERR_IVT_OFFSET    = 1U << 3,    };        enum vfs_fault_kind {    	VFS_FAULT_NONE = 0,    	VFS_FAULT_CMDLINE_TRUNCATED,    	VFS_FAULT_MISSING_ROOT_ARG,    	VFS_FAULT_MMC_MISSING_ROOTWAIT,    	VFS_FAULT_NFS_CONFIG_OR_IP,    };        struct boot_strap_report {    	enum imx_boot_target target;    	bool console_tx_deadlocked;    };        void decode_boot_straps(uint32_t sbmr1, uint32_t sbmr2, bool three_wire_uart,                            bool crtscts_enabled, struct boot_strap_report *out);    uint32_t validate_startup_abi(uint32_t sp_init, uint32_t bss_start,                                  uint32_t bss_end, uint32_t ivt_offset);    enum vfs_fault_kind triage_vfs_boot_panic(const char *bootargs, size_t cbsize_limit,                                              uint32_t root_major);        #endif /* KSA_LAB_M05_BOOT_FAULT_TRIAGE_H */

step 2/15 · 2. learning objectives

  • Extract SRC_SBMR2[25:24] (BMOD) and SRC_SBMR1 (BOOT_CFG1/BOOT_CFG2) bitfields alongside 3-wire CRTSCTS console deadlock detection.
  • Enforce 8-byte AAPCS32 stack alignment (sp & 7 == 0), 4-byte .bss section bounds, and 0x400 SD/eMMC IVT placement.
  • Classify U-Boot CONFIG_SYS_CBSIZE truncation, NFS ip= omissions, and major 179 (mmcblk) missing-rootwait VFS panics.

step 3/15 · 3. environment requirements

All automated verification steps run in unprivileged user space on a POSIX Linux host using gcc -std=c11 -Wall -Wextra -Werror and clock_gettime(CLOCK_MONOTONIC). Recorded transcripts in captures.json were generated on x86_64 running kernel 7.0.0-42-generic and prove protocol, state-machine, and memory invariants only. Physical bus timing, DMA cache coherency, and board peripheral behavior require target validation on Linux kernel 6.12 LTS (ARMv7-A Cortex-A7).

step 4/15 · 4. required software and hardware

  • Host workstation: gcc (-std=c11 -Wall -Wextra -Werror), GNU make, ar (binutils), and POSIX /bin/sh.
  • Target environment (optional hardware step, Section 13): i.MX6ULL ARMv7-A board (SRC_SBMR1 0x020D8004, SRC_SBMR2 0x020D801C) running U-Boot 2025.x and Linux kernel 6.12.

step 5/15 · 5. complete executable commands

learner@ksa: ~/gl-e00/lab-m05
learner@ksa:~/gl-e00/lab-m05$ bat script.sh File: script.sh    make -B -C files    ./files/lab_cli    ./files/lab_cli --bench    sh check.sh

step 6/15 · 6. annotated source code

files/core.c enforces the production invariants that starter/core.c breaks:

learner@ksa: ~/gl-e00/lab-m05
learner@ksa:~/gl-e00/lab-m05$ bat example.c File: example.c    if ((sp_init & 0x7U) != 0U)    	errs |= STARTUP_ERR_SP_ALIGN8;    if (((bss_start | bss_end) & 0x3U) != 0U)    	errs |= STARTUP_ERR_BSS_ALIGN4;    if (ivt_offset != 0x400U)    	errs |= STARTUP_ERR_IVT_OFFSET;

starter/core.c shifts sbmr2 by 16 instead of 24 (BMOD[25:24]), masks sp_init with 0x3U (4-byte alignment) instead of 0x7U (8-byte AAPCS32 alignment), and disables the missing-rootwait detector on major 179.

step 7/15 · 7. expected output

Passing files/ run (sh check.sh, exit code 0):

learner@ksa: ~/gl-e00/lab-m05
learner@ksa:~/gl-e00/lab-m05$ bat listing.txt File: listing.txt    TAP version 13    1..5    ok 1 - builds libcore.a and lab_cli cleanly with -std=c11 -Wall -Wextra -Werror    ok 2 - archives core.o into libcore.a and links independent TAP verifier    ok 3 - decodes SRC_SBMR2[25:24] BMOD and SRC_SBMR1 BOOT_CFG1 straps plus 3-wire CRTSCTS deadlock    ok 4 - enforces ARMv7-A AAPCS32 8-byte SP alignment (sp & 0x7 == 0), 4-byte .bss bounds, and 0x400 IVT offset    ok 5 - classifies truncated bootargs, missing NFS ip= config, and missing rootwait on major 179 mmcblk panics    # pass 5/5

CLI verification output (./files/lab_cli):

learner@ksa: ~/gl-e00/lab-m05
learner@ksa:~/gl-e00/lab-m05$ bat listing.txt File: listing.txt    STRAPS emmc_target=3 tx_deadlocked=1 sdp_override_target=1    CRT0_ABI clean_flags=0x0 broken_flags=0xd    VFS_PANIC mmc_no_rootwait_kind=3

Defective starter/ run (exit code 1): emits FAIL: diagnostics on the broken contract assertions.

step 8/15 · 8. explanation of observed behavior

Restoring (sbmr2 >> 24U) & 0x3U aligns with the i.MX6ULL System Reset Controller register map, (sp_init & 0x7U) != 0U rejects 0x80200004 odd-word stacks before LDRD faults occur, and checking strstr(bootargs, "rootwait") catches asynchronous USDHC boot races.

step 9/15 · 9. experiment variations

  • Near transfer: Add QuadSPI NOR (BOOT_CFG1[7:4] == 0x1) and ECSPI NOR (0x3 with BOOT_CFG4) decoding to decode_boot_straps().
  • Far transfer: Extend triage_vfs_boot_panic() to validate ubi.mtd= + rootfstype=ubifs pairing for raw GPMI SLC NAND boots.

step 10/15 · 10. performance measurements

Recorded host benchmark (./files/lab_cli --bench, CLOCK_MONOTONIC, warmup=5, N=40 batches):

learner@ksa: ~/gl-e00/lab-m05
learner@ksa:~/gl-e00/lab-m05$ bat listing.txt File: listing.txt    BENCH lab_m05_boot_fault_triage clock=CLOCK_MONOTONIC batches=40x500 p50_ns=12696 p95_ns=27228 p99_ns=52499 sink=3

./files/lab_cli --bench measures in-memory C11 bitmask and bootargs classification speed using CLOCK_MONOTONIC (40 x 500 iterations); physical POR_B, MDIO PHY reset (>= 10 ms), and USDHC probe timings must be measured on target hardware.

step 11/15 · 11. troubleshooting

SymptomRoot causeFix
Check 3 fails with sd=0 or sdp=5sbmr2 is shifted by 16 instead of 24, reading reserved zeroes instead of BMOD[25:24].Extract (sbmr2 >> 24U) & 0x3U in decode_boot_straps().
Check 4 fails with sp4=0x00x80200004 & 0x3U evaluates to 0, missing the 8-byte AAPCS32 alignment violation.Test (sp_init & 0x7U) != 0U so any non-multiple of 8 sets STARTUP_ERR_SP_ALIGN8.
Check 5 fails with wait=0The rootwait check on root_major == 179U was stubbed out.Restore strstr(bootargs, "rootwait") == NULL returning VFS_FAULT_MMC_MISSING_ROOTWAIT.

step 12/15 · 12. guided questions

  1. Why does decode_boot_straps() check bmod (SRC_SBMR2[25:24]) BEFORE inspecting cfg1_hi (SRC_SBMR1[7:4])?
  • *Hint 1:* What happens on physical hardware when BOOT_CFG switches stay set to eMMC while you flip BOOT_MODE to 01 for UUU flashing?
  • *Hint 2:* BOOT_MODE = 01 (Serial Downloader) and 00 (Fuses) override external BOOT_CFG pins completely in the mask Boot ROM.
  1. Why does triage_vfs_boot_panic() check strlen(bootargs) >= cbsize_limit - 1U before checking strstr(bootargs, "root=")?
  • *Hint 1:* Suppose a 1024-byte bootargs line had root=/dev/mmcblk1p2 at byte 1015, chopped off to root=/de by CONFIG_SYS_CBSIZE.
  • *Hint 2:* Checking buffer-limit truncation first identifies why trailing arguments (root= or rootwait) vanished instead of reporting a misleading syntax error.

step 13/15 · 13. independent challenges

Implement check_bootz_regions(uint32_t zimg_start, uint32_t zimg_size, uint32_t dtb_start, uint32_t dtb_size) accounting for ARM zImage's ~4x in-place self-decompression expansion so .dtb placement too close above zImage (< 32 MiB gap) is flagged before Kernel_decompress overwrites the FDT!

step 14/15 · 14. solutions and explanations

files/core.c decodes SRC_SBMR2[25:24] prior to SRC_SBMR1, enforces 8-byte SP (0x7U mask) + 4-byte .bss + 0x400 IVT invariants, and classifies CBSIZE truncation, NFS, and mmcblk rootwait panics across all 5/5 TAP checks.

step 15/15 · run verification and inspect output

Run the verification command and confirm the output matches the expected contract.

learner@ksa: ~/gl-e00/lab-m05
learner@ksa:~/gl-e00/lab-m05./files/lab_clilearner@ksa:~/gl-e00/lab-m05
expected output
STRAPS emmc_target=3 tx_deadlocked=1 sdp_override_target=1CRT0_ABI clean_flags=0x0 broken_flags=0xdVFS_PANIC mmc_no_rootwait_kind=3

Progressive hints & solution

hint 1

Compare starter/Makefile against the module lessons. Focus first on: Builds libcore.a and lab_cli cleanly with -std=c11 -Wall -Wextra -Werror.

hint 2

Compile with -std=c11 -Wall -Wextra -Werror, check every system-call return value before touching output buffers, and verify cleanup on error paths.

solution

Run the check

From labs/lab_m05_boot_fault_triage/, run ./check.sh. A complete solution emits TAP version 13 with every test point marked ok and exits 0:

./check.sh — lab m05
learner@ksa:~/gl-e00/lab-m05./check.shTAP version 131..5ok 1 - builds libcore.a and lab_cli cleanly with -std=c11 -Wall -Wextra -Werrorok 2 - archives core.o into libcore.a and links independent TAP verifierok 3 - decodes SRC_SBMR2[25:24] BMOD and SRC_SBMR1 BOOT_CFG1 straps plus 3-wire CRTSCTS deadlockok 4 - enforces ARMv7-A AAPCS32 8-byte SP alignment (sp & 0x7 == 0), 4-byte .bss bounds, and 0x400 IVT offsetok 5 - classifies truncated bootargs, missing NFS ip= config, and missing rootwait on major 179 mmcblk panics# pass 5/5

On an incomplete starter tree, ./check.sh exits non-zero and marks the unmet assertion not ok with an indented YAML diagnostic block:

./check.sh — lab m05 (starter)
learner@ksa:~/gl-e00/lab-m05./check.shTAP version 131..5ok 1 - builds libcore.a and lab_cli cleanly with -std=c11 -Wall -Wextra -Werrorok 2 - archives core.o into libcore.a and links independent TAP verifiernot ok 3 - decodes SRC_SBMR2[25:24] BMOD and SRC_SBMR1 BOOT_CFG1 straps plus 3-wire CRTSCTS deadlockFAIL: extract BMOD from (sbmr2 >> 24U) & 0x3U and flag console_tx_deadlocked when three_wire_uart && crtscts_enabled  ---  message: 'got strap decode mismatch: sd=0 emmc=0(lock=1) nand=0 sdp=0'  hint: 'extract BMOD from (sbmr2 >> 24U) & 0x3U and flag console_tx_deadlocked when three_wire_uart && crtscts_enabled'  ...not ok 4 - enforces ARMv7-A AAPCS32 8-byte SP alignment (sp & 0x7 == 0), 4-byte .bss bounds, and 0x400 IVT offsetFAIL: mask sp_init with 0x7U (not 0x3U!) in validate_startup_abi to reject odd-word 0x80200004 stacks  ---  message: 'got startup ABI mismatch: ok=0x0 sp4=0x0 bss2=0xc'  hint: 'mask sp_init with 0x7U (not 0x3U!) in validate_startup_abi to reject odd-word 0x80200004 stacks'  ...not ok 5 - classifies truncated bootargs, missing NFS ip= config, and missing rootwait on major 179 mmcblk panicsFAIL: return VFS_FAULT_MMC_MISSING_ROOTWAIT when major==179 or root=/dev/mmcblk lacks rootwait  ---  message: 'got vfs triage mismatch: ok=0 wait=0 trunc=1 nfs=4'  hint: 'return VFS_FAULT_MMC_MISSING_ROOTWAIT when major==179 or root=/dev/mmcblk lacks rootwait'  ...# pass 2/5

note: How to read TAP diagnostics: 1..N states the total test plan; each ok k confirms a passed check; not ok k pinpoints the failing check alongside message: (what went wrong) and hint: (where to look next) between --- and ....

inspect harness: check.sh
learner@ksa: ~/gl-e00/lab-m05
learner@ksa:~/gl-e00/lab-m05$ bat check.sh File: check.sh    #!/bin/sh    set -u    cd "$(dirname "$0")" || exit 1    PASS=0    WORK=$(mktemp -d "${TMPDIR:-/tmp}/ksa_lab.XXXXXX") || exit 1    trap 'rm -rf "$WORK"' EXIT HUP INT TERM    cp -R files "$WORK/files"        printf 'TAP version 13\n1..5\n'    if make -B -C "$WORK/files" >"$WORK/build.log" 2>&1; then        printf 'ok 1 - builds libcore.a and lab_cli cleanly with -std=c11 -Wall -Wextra -Werror\n'        PASS=$((PASS + 1))    else        printf 'not ok 1 - builds libcore.a and lab_cli cleanly with -std=c11 -Wall -Wextra -Werror\n'        printf 'FAIL: fix compiler warnings or errors in files/core.c\n'    fi        if [ -f "$WORK/files/libcore.a" ] && gcc -std=c11 -Wall -Wextra -Werror -O2  -I"$WORK/files" tests.c "$WORK/files/libcore.a"  -o "$WORK/verify" >>"$WORK/build.log" 2>&1; then        printf 'ok 2 - archives core.o into libcore.a and links independent TAP verifier\n'        PASS=$((PASS + 1))    else        printf 'not ok 2 - archives core.o into libcore.a and links independent TAP verifier\n'        printf 'FAIL: preserve public declarations in files/core.h so tests.c links\n'    fi        if [ -x "$WORK/verify" ] && OUT=$("$WORK/verify" 1 2>&1); then        printf 'ok 3 - decodes SRC_SBMR2[25:24] BMOD and SRC_SBMR1 BOOT_CFG1 straps plus 3-wire CRTSCTS deadlock\n'        PASS=$((PASS + 1))    else        printf 'not ok 3 - decodes SRC_SBMR2[25:24] BMOD and SRC_SBMR1 BOOT_CFG1 straps plus 3-wire CRTSCTS deadlock\n'        printf 'FAIL: extract BMOD from (sbmr2 >> 24U) & 0x3U and flag console_tx_deadlocked when three_wire_uart && crtscts_enabled\n'        printf "  ---\n  message: 'got %s'\n  hint: 'extract BMOD from (sbmr2 >> 24U) & 0x3U and flag console_tx_deadlocked when three_wire_uart && crtscts_enabled'\n  ...\n" "${OUT:-build_failed}"    fi        if [ -x "$WORK/verify" ] && OUT=$("$WORK/verify" 2 2>&1); then        printf 'ok 4 - enforces ARMv7-A AAPCS32 8-byte SP alignment (sp & 0x7 == 0), 4-byte .bss bounds, and 0x400 IVT offset\n'        PASS=$((PASS + 1))    else        printf 'not ok 4 - enforces ARMv7-A AAPCS32 8-byte SP alignment (sp & 0x7 == 0), 4-byte .bss bounds, and 0x400 IVT offset\n'        printf 'FAIL: mask sp_init with 0x7U (not 0x3U!) in validate_startup_abi to reject odd-word 0x80200004 stacks\n'        printf "  ---\n  message: 'got %s'\n  hint: 'mask sp_init with 0x7U (not 0x3U!) in validate_startup_abi to reject odd-word 0x80200004 stacks'\n  ...\n" "${OUT:-build_failed}"    fi        if [ -x "$WORK/verify" ] && OUT=$("$WORK/verify" 3 2>&1); then        printf 'ok 5 - classifies truncated bootargs, missing NFS ip= config, and missing rootwait on major 179 mmcblk panics\n'        PASS=$((PASS + 1))    else        printf 'not ok 5 - classifies truncated bootargs, missing NFS ip= config, and missing rootwait on major 179 mmcblk panics\n'        printf 'FAIL: return VFS_FAULT_MMC_MISSING_ROOTWAIT when major==179 or root=/dev/mmcblk lacks rootwait\n'        printf "  ---\n  message: 'got %s'\n  hint: 'return VFS_FAULT_MMC_MISSING_ROOTWAIT when major==179 or root=/dev/mmcblk lacks rootwait'\n  ...\n" "${OUT:-build_failed}"    fi    printf '# pass %d/5\n' "$PASS"    [ "$PASS" -eq 5 ]

Definition of done

Verification checklist

status: 0/3 checks verified

Troubleshooting

Compiler fails under -Werror on sign conversion or unused args

Use exact POSIX return types (ssize_t for read()/write(), size_t for byte counts) rather than relaxing flags.

./check.sh reports missing files in files/

Invoke ./check.sh from inside labs/lab_m05_boot_fault_triage/ so relative paths to files/ resolve directly.

Progress is saved on this device.

search — fzf

0/0 ───────────────────────────────────────────

keyboard shortcuts — less

/
search
f
focus mode
[
previous
]
next
?
help
Esc
close

figure