Lab 1: U-Boot 2025.01 Environment CRC, Block Bounds & Handoff Policy

40 minfree previewLinux 6.12C11← module 1

Implement, compile, and verify lab_m01_uboot_env_bootcmd against ./check.sh.

Prerequisites in this module

What ./check.sh verifies

  • Strict C11 module build --- message: compiler rejected module sources hint: inspect Makefile and warnings ...
  • Environment positive and negative invariants --- message: computed result or rejection assertion failed hint: repair the environment invariant, not the expected transcript ...
  • Media positive and negative invariants --- message: computed result or rejection assertion failed hint: repair the media invariant, not the expected transcript ...
  • Handoff positive and negative invariants --- message: computed result or rejection assertion failed hint: repair the handoff invariant, not the expected transcript ...
step 1/15

step 1/15 · inspect starter files and specification

Early bring-up teams routinely lose hours chasing phantom kernel crashes caused two stages earlier in U-Boot: a corrupted persistent environment block, an mmc read count treated as bytes instead of 512 B sectors, or a failed load followed by ; bootz into stale DRAM. Converting those three contracts into a deterministic host C11 verifier turns silent boot corruption into an immediate assertion failure before anyone touches board flash.

learner@ksa: ~/gl-e03/lab-m01
learner@ksa:~/gl-e03/lab-m01ls -lastarter/Makefilestarter/contracts.hstarter/environment.cstarter/handoff.cstarter/main.cstarter/media.cstarter/target/board.itsstarter/target/build-and-inspect.shstarter/target/inspect-media.cmdlearner@ksa:~/gl-e03/lab-m01
starter: starter/Makefile
learner@ksa: ~/gl-e03/lab-m01
learner@ksa:~/gl-e03/lab-m01$ bat starter/Makefile File: starter/Makefile    CC = gcc    CFLAGS = -std=c11 -Wall -Wextra -Werror -O2    all: boot-contract    boot-contract: main.c environment.c media.c handoff.c contracts.h    	$(CC) $(CFLAGS) main.c environment.c media.c handoff.c -o $@    clean:    	rm -f boot-contract    .PHONY: all clean
starter: starter/contracts.h
learner@ksa: ~/gl-e03/lab-m01
learner@ksa:~/gl-e03/lab-m01$ bat starter/contracts.h File: starter/contracts.h    #ifndef KSA_CONTRACTS_H    #define KSA_CONTRACTS_H    int verify_environment(void);    int verify_media(void);    int verify_handoff(void);    #endif
starter: starter/environment.c
learner@ksa: ~/gl-e03/lab-m01
learner@ksa:~/gl-e03/lab-m01$ bat starter/environment.c File: starter/environment.c    #include <assert.h>    #include <inttypes.h>    #include <stddef.h>    #include <stdint.h>    #include <stdio.h>    #include <string.h>    _Static_assert(sizeof(uint32_t) == 4, "32-bit format words required");    static uint32_t env_crc(const unsigned char *p, size_t n)    {        uint32_t c = UINT32_MAX;        for (size_t i = 0; i < n; ++i) {            c ^= p[i];            for (unsigned b = 0; b < 8U; ++b)                c = (c >> 1) ^ (0x04C11DB7U & (0U - (c & 1U)));        }        return ~c;    }    int verify_environment(void)    {        const unsigned char known[] = "123456789";        unsigned char data[64] = "bootdelay=3\0bootcmd=run mmcboot\0";        assert(env_crc(known, 9U) == 0xCBF43926U);        uint32_t stored = env_crc(data, sizeof data);        data[63] ^= 1U;        assert(env_crc(data, sizeof data) != stored);        data[63] ^= 1U;        assert(env_crc(data, sizeof data) == stored);        printf("known_crc=%08" PRIX32 " data_bytes=%zu\n",               env_crc(known, 9U), sizeof data);        puts("padding_corruption=rejected restored_environment=accepted");        return 0;    }
starter: starter/handoff.c
learner@ksa: ~/gl-e03/lab-m01
learner@ksa:~/gl-e03/lab-m01$ bat starter/handoff.c File: starter/handoff.c    #include <assert.h>    #include <inttypes.h>    #include <stddef.h>    #include <stdint.h>    #include <stdio.h>    #include <string.h>    _Static_assert(sizeof(uint32_t) == 4, "32-bit format words required");    enum action { REJECT, LOCAL, RECOVERY };    static enum action choose_boot(int kernel_loaded, int fdt_loaded,                                   int signature_valid, int recovery_allowed)    {        if (!signature_valid)            return REJECT;        if (kernel_loaded && fdt_loaded)            return LOCAL;        return recovery_allowed ? RECOVERY : REJECT;    }    static int arguments(char *dst, size_t n)    {        int written = snprintf(dst, n,            "console=ttymxc0,115200 root=PARTUUID=demo rootwait");        return written >= 0 && (size_t)written < n;    }    int verify_handoff(void)    {        char complete[128], truncated[128];        volatile size_t short_capacity = 16U;        assert(choose_boot(1, 1, 1, 1) == LOCAL);        assert(choose_boot(0, 1, 1, 1) == RECOVERY);        assert(choose_boot(1, 1, 0, 1) == REJECT);        assert(choose_boot(1, 0, 1, 0) == REJECT);        assert(arguments(complete, sizeof complete));        assert(!arguments(truncated, short_capacity));        printf("bootargs=%s\n", complete);        puts("stale_load=blocked invalid_signature=rejected truncation=rejected");        return 0;    }
starter: starter/main.c
learner@ksa: ~/gl-e03/lab-m01
learner@ksa:~/gl-e03/lab-m01$ bat starter/main.c File: starter/main.c    #include "contracts.h"    #include <stdio.h>    #include <string.h>    int main(int argc, char **argv)    {        if (argc == 2) {        if (strcmp(argv[1], "environment") == 0) return verify_environment();        if (strcmp(argv[1], "media") == 0) return verify_media();        if (strcmp(argv[1], "handoff") == 0) return verify_handoff();        }        fputs("FAIL: choose a documented verification scenario\n", stderr);        return 2;    }
starter: starter/media.c
learner@ksa: ~/gl-e03/lab-m01
learner@ksa:~/gl-e03/lab-m01$ bat starter/media.c File: starter/media.c    #include <assert.h>    #include <inttypes.h>    #include <stddef.h>    #include <stdint.h>    #include <stdio.h>    #include <string.h>    _Static_assert(sizeof(uint32_t) == 4, "32-bit format words required");    static int ram_fits(uint32_t start, uint32_t n, uint32_t end)    {        return n != 0U && start <= end && n <= end - start;    }    static int read_fits(uint32_t lba, uint32_t count, uint32_t blocks,                         uint32_t dst, uint32_t ram_end)    {        if (count == 0U || lba > blocks || count > blocks - lba)            return 0;        uint64_t bytes = (uint64_t)count * 512U;        return bytes <= UINT32_MAX &&               ram_fits(dst, (uint32_t)bytes, ram_end);    }    int verify_media(void)    {        assert(read_fits(2048U, 2048U, 8192U, 0x82000000U, 0x84000000U));        assert(read_fits(8191U, 1U, 8192U, 0x82000000U, 0x84000000U));        assert(!read_fits(8192U, 1U, 8192U, 0x82000000U, 0x84000000U));        assert(!ram_fits(0xFFFFFFF0U, 64U, UINT32_MAX));        assert(!read_fits(0U, UINT32_MAX, UINT32_MAX, 0U, UINT32_MAX));        printf("blocks=2048 bytes=%" PRIu64 "\n", (uint64_t)2048U * 512U);        puts("last_block=accepted partition_overrun=rejected wrap=rejected");        return 0;    }
starter: starter/target/board.its
learner@ksa: ~/gl-e03/lab-m01
learner@ksa:~/gl-e03/lab-m01$ bat starter/target/board.its File: starter/target/board.its    /dts-v1/;    / {        description = "ARMv7-A lab kernel and board tree";        #address-cells = <1>;        images {            kernel {                data = /incbin/("zImage");                type = "kernel"; arch = "arm"; os = "linux";                compression = "none";                load = <0x82000000>; entry = <0x82000000>;                hash-1 { algo = "sha256"; };            };            fdt {                data = /incbin/("imx6ull-ksa-lab.dtb");                type = "flat_dt"; arch = "arm"; compression = "none";                hash-1 { algo = "sha256"; };            };        };        configurations {            default = "conf-ksa";            conf-ksa { kernel = "kernel"; fdt = "fdt"; };        };    };    /* Boot command shape, at the target:     * if load mmc 0:1 ${kernel_addr_r} zImage &&     *    load mmc 0:1 ${fdt_addr_r} imx6ull-ksa-lab.dtb; then     *     setenv bootargs console=ttymxc0,115200 root=PARTUUID=REVIEWED rootwait     *     bootz ${kernel_addr_r} - ${fdt_addr_r}     * fi     */
starter: starter/target/build-and-inspect.sh
learner@ksa: ~/gl-e03/lab-m01
learner@ksa:~/gl-e03/lab-m01$ bat starter/target/build-and-inspect.sh File: starter/target/build-and-inspect.sh    make O=out/ksa ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- \        imx6ull_14x14_evk_defconfig    make O=out/ksa ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j8    sha256sum out/ksa/u-boot.imx    # At the target console, before any persistent write:    version    bdinfo    printenv bootcmd bootargs    env info    setenv ksa_probe one    printenv ksa_probe    # Only on reviewed storage:    # saveenv    # reset    # printenv ksa_probe
starter: starter/target/inspect-media.cmd
learner@ksa: ~/gl-e03/lab-m01
learner@ksa:~/gl-e03/lab-m01$ bat starter/target/inspect-media.cmd File: starter/target/inspect-media.cmd    bdinfo    mmc list    mmc dev 0 0    mmc part    fatls mmc 0:1 /    ext4ls mmc 0:2 /    # Example RAM addresses require a reviewed free-memory map.    fatload mmc 0:1 0x82000000 zImage    setenv kernel_size ${filesize}    md.b 0x82000000 0x40    setenv autoload no    dhcp    ping ${serverip}    tftpboot 0x84000000 zImage    cmp.b 0x82000000 0x84000000 ${kernel_size}    # Alternative transport, not a kernel root mount:    # nfs 0x84000000 ${serverip}:/srv/boot/zImage

step 2/15 · 2. learning objectives

  • Compute reflected CRC-32 (0xEDB88320) across the entire fixed-size 64 B serialized environment buffer, including NUL-padded tail bytes, in environment.c.
  • Validate 512 B LBA partition intervals and 32-bit half-open RAM windows [dst, ram_end) without unsigned addition wraparound in media.c.
  • Enforce fail-closed bootz / FIT handoff selection and snprintf() bootargs truncation rejection in handoff.c.
  • Diagnose and repair the seeded polynomial defect in starter/environment.c from TAP failure diagnostics without altering expected transcripts.

step 3/15 · 3. environment requirements

Execute all graded commands from course_creator/courses/imx6ull-uboot-kernel-rootfs/labs/lab_m01_uboot_env_bootcmd on a Linux workstation (7.0.0-42-generic in the recorded capture) with a POSIX /bin/sh shell, GNU Make, and a C11 compiler. No physical board, USB serial cable, or block device is accessed during host verification; keep build artifacts inside this directory and never pass /dev/sdX or /dev/mmcblkX to host commands.

step 4/15 · 4. required software and hardware

Host software: gcc supporting -std=c11 -Wall -Wextra -Werror -O2, make, and /bin/sh to run check.sh. Host source tree: contracts.h, main.c, environment.c, media.c, handoff.c, and Makefile under both starter/ and files/, plus target reference listings files/target/board.its and files/target/build-and-inspect.sh. Hardware: none for graded TAP verification; an ARMv7-A Cortex-A7 lab board running U-Boot 2025.01 is optional for the ungraded read-only serial inspection in files/target/build-and-inspect.sh.

step 5/15 · 5. complete executable commands

Inspect the seeded starter failure in an isolated scratch copy first, then build and verify the reference implementation:

learner@ksa: ~/gl-e03/lab-m01
learner@ksa:~/gl-e03/lab-m01$ bat script.sh File: script.sh    rm -rf .work && mkdir -p .work    cp -R starter .work/files && cp check.sh .work/    (cd .work && sh ./check.sh)          # Expected: not ok 2 + FAIL: on stderr (exit 1)    make -C files                        # Compile warning-clean reference binary    ./files/boot-contract environment    # Verify CRC-32 vector and padding mutation check    ./files/boot-contract media          # Verify LBA*512 and [0x82000000, 0x84000000) bounds    ./files/boot-contract handoff        # Verify signature/load policy and bootargs capacity    ./check.sh                           # Run full 5-test TAP version 13 suite (exit 0)    rm -rf .work

check.sh copies files/ into a temporary .verify.XXXXXX sandbox so compiling never pollutes tracked sources. Repair your copy of starter/environment.c inside .work/files/ and rerun (cd .work && sh ./check.sh) until all five TAP checks pass.

step 6/15 · 6. annotated source code

Scenario verbSource file & entry pointVerified positive outputVerified negative rejections
environmentenvironment.c -> verify_environment()known_crc=CBF43926 data_bytes=64padding_corruption=rejected
mediamedia.c -> verify_media()blocks=2048 bytes=1048576, last_block=acceptedpartition_overrun=rejected, wrap=rejected
handoffhandoff.c -> verify_handoff()bootargs=console=ttymxc0,115200 root=PARTUUID=demo rootwaitstale_load=blocked, invalid_signature=rejected, truncation=rejected

Inspect the core checksum loop in files/environment.c alongside the seeded bug in starter/environment.c:

learner@ksa: ~/gl-e03/lab-m01
learner@ksa:~/gl-e03/lab-m01$ bat example.c File: example.c    static uint32_t env_crc(const unsigned char *p, size_t n)    {        uint32_t c = UINT32_MAX;          /* Pre-invert initial CRC state */        for (size_t i = 0; i < n; ++i) {  /* Cover all n == sizeof data bytes, including pad */            c ^= p[i];            for (unsigned b = 0; b < 8U; ++b)                c = (c >> 1) ^ (0xEDB88320U & (0U - (c & 1U))); /* starter bug: 0x04C11DB7U */        }        return ~c;                        /* Post-invert final remainder */    }
  • media.c: read_fits() guards count == 0U || lba > blocks || count > blocks - lba, widens bytes = (uint64_t)count * 512U before checking bytes <= UINT32_MAX, and calls ram_fits(dst, (uint32_t)bytes, ram_end) using subtraction n <= end - start.
  • handoff.c: choose_boot() rejects invalid signatures unconditionally (!signature_valid -> REJECT) even when recovery_allowed == 1, and arguments() checks written >= 0 && (size_t)written < n so a 16 B destination refuses a 50 B bootargs string.
  • files/target/: board.its illustrates FIT sha256 component nodes and &&-chained bootz ${kernel_addr_r} - ${fdt_addr_r} syntax; build-and-inspect.sh lists read-only version, bdinfo, and env info commands prior to any saveenv.

step 7/15 · 7. expected output

Unmodified starter/ fails check 2 in captures.json with exit code 1:

learner@ksa: ~/gl-e03/lab-m01
learner@ksa:~/gl-e03/lab-m01$ bat listing.txt File: listing.txt    not ok 2 - environment positive and negative invariants      ---      message: computed result or rejection assertion failed      hint: repair the environment invariant, not the expected transcript      ...    # pass 4/5    FAIL: repair the failed engineering contract

Running ./check.sh against the reference files/ tree (or a repaired starter/ copy) produces this host TAP transcript (exit 0):

learner@ksa: ~/gl-e03/lab-m01
learner@ksa:~/gl-e03/lab-m01$ bat listing.txt File: listing.txt    TAP version 13    1..5    ok 1 - strict C11 module build    ok 2 - environment positive and negative invariants    ok 3 - media positive and negative invariants    ok 4 - handoff positive and negative invariants    ok 5 - unsupported scenario refused    # pass 5/5

These transcripts establish host C11 model behavior only, not physical MMC persistence or board boot execution.

step 8/15 · 8. explanation of observed behavior

Test 2 aborts on starter/environment.c because right-shifting bit-first CRC-32 requires the bit-reversed generator 0xEDB88320U; pairing (c >> 1) with left-shift polynomial 0x04C11DB7U scrambles bit significance and fails env_crc("123456789", 9U) == 0xCBF43926U before reaching the data[63] ^= 1U padding test. Once repaired, flipping byte 63 (far past "bootdelay=3\0bootcmd=run mmcboot\0") proves that U-Boot checksums all sizeof data bytes rather than stopping at strlen(). Tests 3, 4, and 5 confirm boundary block 8191 acceptance, 8192 overrun rejection, 0xFFFFFFF0U + 64U wrap rejection, stale-buffer blocking, and exit code 2 on unknown CLI verbs.

step 9/15 · 9. experiment variations

  1. Boundary LBA shift: in a scratch copy of media.c, test read_fits(6144U, 2048U, 8192U, ...) (exact end 8192) versus read_fits(6145U, 2048U, 8192U, ...) (1 block past partition end) and verify the first passes while the second returns 0.
  2. Naive strlen bug reproduction: temporarily pass strlen((const char *)data) instead of sizeof data to env_crc() and observe that data[63] ^= 1U silently passes, reproducing a provisioning-tool mismatch bug.
  3. Far-transfer policy check: extend choose_boot() in your scratch copy with an env_authenticated parameter that blocks mutable bootargs overrides when secure boot is active, stating how that differs from an unlocked lab board.

step 10/15 · 10. performance measurements

The functional checker runs in single-digit milliseconds without claiming target storage throughput. To benchmark env_crc() throughput over realistic 8 KiB (8188 B) environment payloads on your host, wrap env_crc(buf, 8188U) in a standalone C11 harness timed with clock_gettime(CLOCK_MONOTONIC): discard 5 warm-up runs, record N = 30 batches of 1000 checksums, and compute p50, p95, and p99 nanoseconds per 8 KiB buffer alongside compiler flags (-O2) and host CPU model. Never extrapolate x86_64 host CRC-32 timings to a 792 MHz Cortex-A7 or eMMC write latency.

step 11/15 · 11. troubleshooting

SymptomRoot causeCorrective action
./check.sh passes even before you edit starter/environment.c./check.sh validates ./files relative to its own directoryCopy starter to .work/files, copy check.sh to .work/, and run (cd .work && sh ./check.sh)
not ok 1 - strict C11 module buildSigned/unsigned comparison or unused variable tripped -Wall -Wextra -WerrorUse size_t / uint32_t with U suffixes (0xEDB88320U) and inspect make -C .work/files compiler output
not ok 5 - unsupported scenario refusedmain.c returned 1 instead of 2 for unrecognized CLI argumentsKeep return 2; after fputs("FAIL: ...", stderr) in main.c

step 12/15 · 12. guided questions

  1. Why does read_fits() multiply (uint64_t)count * 512U in 64-bit arithmetic before calling ram_fits()?
  • Hint 1: Evaluate count * 512U in uint32_t when count = 0x00800001U (8388609 blocks).
  • Hint 2: Notice (uint32_t)(0x00800001U * 512U) truncates mod 2^32 to 512U, which would falsely fit inside a 32 MiB RAM window if not widened first.
  1. In handoff.c, why does choose_boot(1, 1, 0, 1) return REJECT even though recovery_allowed is 1?
  • Hint 1: Compare an I/O read error on local flash against a failed cryptographic signature on a loaded image.
  • Hint 2: Falling back from a signature failure to an unauthenticated recovery path lets an attacker corrupt the primary signature to force unsigned code execution.

step 13/15 · 13. independent challenges

  1. Near-transfer: add a redundant-environment selector helper pick_redundant_env(int crc_a_ok, uint8_t flags_a, int crc_b_ok, uint8_t flags_b) in your scratch copy that handles wraparound from serial 255 (0xFF) to 0 (0x00) when both CRCs pass, and test all single-valid and wrap cases.
  2. Target acceptance plan: using files/target/build-and-inspect.sh and board.its as starting points, list the exact serial commands and cold-reset observations required on a Cortex-A7 board to prove (a) which hardware partition saveenv writes and (b) that bootz refuses to run when .dtb loading fails.

step 14/15 · 14. solutions and explanations

Compare your repaired .work/files/environment.c against files/environment.c line 14: restoring 0xEDB88320U inside c = (c >> 1) ^ (0xEDB88320U & (0U - (c & 1U))); aligns the right-shifting bit order with IEEE 802.3 reflected CRC-32, yielding known_crc=CBF43926 and restoring 5/5 TAP passes (exit 0). Host success proves the C11 checksum, interval, and policy predicates; physical eMMC partition safety, saveenv power-cut behavior, and signed FIT enforcement still require dedicated target serial verification.

step 15/15 · run verification and inspect output

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

learner@ksa: ~/gl-e03/lab-m01
learner@ksa:~/gl-e03/lab-m01./files/boot-contract environmentlearner@ksa:~/gl-e03/lab-m01
expected output
known_crc=CBF43926 data_bytes=64padding_corruption=rejected restored_environment=accepted

Progressive hints & solution

hint 1

Compare starter/Makefile against the module lessons. Focus first on: Strict C11 module build --- message: compiler rejected module sources hint: inspect Makefile and warnings ...

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_m01_uboot_env_bootcmd/, run ./check.sh. A complete solution emits TAP version 13 with every test point marked ok and exits 0:

./check.sh — lab m01
learner@ksa:~/gl-e03/lab-m01./check.shTAP version 131..5ok 1 - strict C11 module buildok 2 - environment positive and negative invariantsok 3 - media positive and negative invariantsok 4 - handoff positive and negative invariantsok 5 - unsupported scenario refused# 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 m01 (starter)
learner@ksa:~/gl-e03/lab-m01./check.shTAP version 131..5ok 1 - strict C11 module buildnot ok 2 - environment positive and negative invariants  ---  message: computed result or rejection assertion failed  hint: repair the environment invariant, not the expected transcript  ...ok 3 - media positive and negative invariantsok 4 - handoff positive and negative invariantsok 5 - unsupported scenario refused# pass 4/5AbortedFAIL: repair the failed engineering contract

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-e03/lab-m01
learner@ksa:~/gl-e03/lab-m01$ bat check.sh File: check.sh    #!/bin/sh    set -u    cd "$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"    work=$(mktemp -d "./.verify.XXXXXX") || exit 1    trap 'rm -rf "$work"' EXIT HUP INT TERM    pass=0    printf 'TAP version 13\n1..5\n'    cp -R files "$work/files"    if make -C "$work/files" >"$work/build.log" 2>&1; then      printf 'ok 1 - strict C11 module build\n'; pass=$((pass+1))    else printf 'not ok 1 - strict C11 module build\n  ---\n  message: compiler rejected module sources\n  hint: inspect Makefile and warnings\n  ...\n'; fi    bin="$work/files/boot-contract"    expected='known_crc=CBF43926 data_bytes=64    padding_corruption=rejected restored_environment=accepted'    if actual=$("$bin" environment 2>"$work/error.log") && [ "$actual" = "$expected" ]; then      printf 'ok 2 - environment positive and negative invariants\n'; pass=$((pass+1))    else printf 'not ok 2 - environment positive and negative invariants\n  ---\n  message: computed result or rejection assertion failed\n  hint: repair the environment invariant, not the expected transcript\n  ...\n'; fi    expected='blocks=2048 bytes=1048576    last_block=accepted partition_overrun=rejected wrap=rejected'    if actual=$("$bin" media 2>"$work/error.log") && [ "$actual" = "$expected" ]; then      printf 'ok 3 - media positive and negative invariants\n'; pass=$((pass+1))    else printf 'not ok 3 - media positive and negative invariants\n  ---\n  message: computed result or rejection assertion failed\n  hint: repair the media invariant, not the expected transcript\n  ...\n'; fi    expected='bootargs=console=ttymxc0,115200 root=PARTUUID=demo rootwait    stale_load=blocked invalid_signature=rejected truncation=rejected'    if actual=$("$bin" handoff 2>"$work/error.log") && [ "$actual" = "$expected" ]; then      printf 'ok 4 - handoff positive and negative invariants\n'; pass=$((pass+1))    else printf 'not ok 4 - handoff positive and negative invariants\n  ---\n  message: computed result or rejection assertion failed\n  hint: repair the handoff invariant, not the expected transcript\n  ...\n'; fi    rc=0    "$bin" undocumented >"$work/invalid.out" 2>&1 || rc=$?    if [ "$rc" -eq 2 ]; then      printf 'ok 5 - unsupported scenario refused\n'; pass=$((pass+1))    else printf 'not ok 5 - unsupported scenario refused\n  ---\n  message: unsupported input was accepted\n  hint: retain explicit CLI validation\n  ...\n'; fi    printf '# pass %s/5\n' "$pass"    [ "$pass" -eq 5 ] || { echo "FAIL: repair the failed engineering contract" >&2; exit 1; }

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_m01_uboot_env_bootcmd/ 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