ASELSANMicrokernel
S66 · SOURCE-BOUND GATE EVIDENCE

G8e UART10 capture helper ve salt-okunur fiziksel preflight doğrulandı

Operations komutu/kapı ailesi → gerçek repository yürütme sözleşmesi Bu sayfa yalnız S66 kapısına aittir; komşu kapıların kaynakları bu kabulün içine katılmaz.

S66Komut / fiziksel sözleşmeOperations id exactsource SHA exact

operation: rpi5-g8e-uart10-capture-preflight

script/Makefile/config · Operations · 2 exact excerpt

sequence-bound=true · implementation-bound=false
01 · Yürütme sözleşmesi

Gerçek script / Makefile / config kaynağı

tam dosyaL1–L240
scripts/capture-rpi5-g8e-uart10.c::capture-rpi5-g8e-uart10.c
#include <errno.h>
#include <fcntl.h>
#include <poll.h>
#include <signal.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <termios.h>
#include <time.h>
#include <unistd.h>

static volatile sig_atomic_t stop_requested = 0;

static void request_stop(int signo) {
    (void)signo;
    stop_requested = 1;
}

static double monotonic_seconds(void) {
    struct timespec ts;
    if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
        perror("clock_gettime");
        exit(2);
    }
    return (double)ts.tv_sec + (double)ts.tv_nsec / 1000000000.0;
}

static void write_all(int fd, const uint8_t *buf, size_t len) {
    while (len != 0) {
        ssize_t written = write(fd, buf, len);
        if (written < 0) {
            if (errno == EINTR) {
                continue;
            }
            perror("write raw capture");
            exit(2);
        }
        buf += (size_t)written;
        len -= (size_t)written;
    }
}

int main(int argc, char **argv) {
    if (argc != 3) {
        fprintf(stderr, "usage: %s DEVICE OUTPUT\n", argv[0]);
        return 2;
    }

    const char *device = argv[1];
    const char *output = argv[2];
    const char terminal_marker[] = "ASELSAN/BOOT8E ";
    const size_t marker_len = sizeof(terminal_marker) - 1;
    size_t marker_progress = 0;
    bool terminal_seen = false;
    double terminal_seen_at = 0.0;

    signal(SIGINT, request_stop);
    signal(SIGTERM, request_stop);

    int serial_fd = open(device, O_RDWR | O_NOCTTY | O_NONBLOCK);
    if (serial_fd < 0) {
        perror("open serial device");
        return 2;
    }

    struct termios settings;
    if (tcgetattr(serial_fd, &settings) != 0) {
        perror("tcgetattr before configure");
        close(serial_fd);
        return 2;
    }

    cfmakeraw(&settings);
    settings.c_cflag &= (tcflag_t)~(PARENB | CSTOPB | CSIZE);
    settings.c_cflag |= CS8 | CLOCAL | CREAD;
#ifdef CRTSCTS
    settings.c_cflag &= (tcflag_t)~CRTSCTS;
#endif
    settings.c_iflag &= (tcflag_t)~(IXON | IXOFF | IXANY);
    settings.c_cc[VMIN] = 0;
    settings.c_cc[VTIME] = 0;
    if (cfsetispeed(&settings, B115200) != 0 ||
        cfsetospeed(&settings, B115200) != 0) {
        perror("cfset speed");
        close(serial_fd);
        return 2;
    }
    if (tcsetattr(serial_fd, TCSANOW, &settings) != 0) {
        perror("tcsetattr");
        close(serial_fd);
        return 2;
    }

    struct termios effective;
    if (tcgetattr(serial_fd, &effective) != 0) {
        perror("tcgetattr after configure");
        close(serial_fd);
        return 2;
    }

    bool raw_ok = (effective.c_lflag & (ICANON | ECHO | ISIG | IEXTEN)) == 0 &&
                  (effective.c_oflag & OPOST) == 0;
    bool bits_ok = (effective.c_cflag & CSIZE) == CS8 &&
                   (effective.c_cflag & (PARENB | CSTOPB)) == 0;
    bool flow_ok = (effective.c_iflag & (IXON | IXOFF | IXANY)) == 0;
#ifdef CRTSCTS
    flow_ok = flow_ok && (effective.c_cflag & CRTSCTS) == 0;
#endif
    bool speed_ok = cfgetispeed(&effective) == B115200 &&
                    cfgetospeed(&effective) == B115200;
    if (!raw_ok || !bits_ok || !flow_ok || !speed_ok) {
        fprintf(stderr,
                "effective termios mismatch raw=%s bits8n1=%s flow_off=%s speed=%s\n",
                raw_ok ? "true" : "false",
                bits_ok ? "true" : "false",
                flow_ok ? "true" : "false",
                speed_ok ? "true" : "false");
        close(serial_fd);
        return 2;
    }

    if (tcflush(serial_fd, TCIFLUSH) != 0) {
        perror("tcflush TCIFLUSH");
        close(serial_fd);
        return 2;
    }

    int output_fd = open(output, O_WRONLY | O_CREAT | O_EXCL, 0600);
    if (output_fd < 0) {
        perror("open raw output");
        close(serial_fd);
        return 2;
    }

    printf("device=%s\n", device);
    printf("same_descriptor=true fd=%d\n", serial_fd);
    printf("effective_baud_115200=true ispeed=%lu ospeed=%lu\n",
           (unsigned long)cfgetispeed(&effective),
           (unsigned long)cfgetospeed(&effective));
    printf("format=8N1 raw=true flow_control=false\n");
    printf("input_flushed=true method=TCIFLUSH\n");
    printf("capture_path=%s\n", output);
    printf("capture_armed=YES\n");
    fflush(stdout);

    const double started_at = monotonic_seconds();
    uint64_t total_bytes = 0;
    uint8_t buffer[4096];
    int result = 0;

    while (!stop_requested) {
        double now = monotonic_seconds();
        if (terminal_seen && now - terminal_seen_at >= 3.0) {
            printf("terminal_grace_complete=true\n");
            break;
        }
        if (now - started_at >= 3600.0) {
            fprintf(stderr, "capture_timeout=YES elapsed_seconds=3600\n");
            result = 3;
            break;
        }

        struct pollfd pfd = {.fd = serial_fd, .events = POLLIN, .revents = 0};
        int polled = poll(&pfd, 1, 250);
        if (polled < 0) {
            if (errno == EINTR) {
                continue;
            }
            perror("poll serial");
            result = 2;
            break;
        }
        if (polled == 0) {
            continue;
        }
        if ((pfd.revents & (POLLERR | POLLNVAL)) != 0) {
            fprintf(stderr, "serial poll failure revents=0x%x\n", pfd.revents);
            result = 2;
            break;
        }

        for (;;) {
            ssize_t got = read(serial_fd, buffer, sizeof(buffer));
            if (got < 0) {
                if (errno == EINTR) {
                    continue;
                }
                if (errno == EAGAIN || errno == EWOULDBLOCK) {
                    break;
                }
                perror("read serial");
                result = 2;
                stop_requested = 1;
                break;
            }
            if (got == 0) {
                break;
            }

            write_all(output_fd, buffer, (size_t)got);
            total_bytes += (uint64_t)got;
            for (ssize_t i = 0; i < got && !terminal_seen; ++i) {
                uint8_t byte = buffer[i];
                if (byte == (uint8_t)terminal_marker[marker_progress]) {
                    marker_progress++;
                    if (marker_progress == marker_len) {
                        terminal_seen = true;
                        terminal_seen_at = monotonic_seconds();
                        printf("terminal_marker_seen=ASELSAN/BOOT8E bytes=%llu\n",
                               (unsigned long long)total_bytes);
                        fflush(stdout);
                    }
                } else {
                    marker_progress = byte == (uint8_t)terminal_marker[0] ? 1 : 0;
                }
            }
        }
    }

    if (fsync(output_fd) != 0) {
        perror("fsync raw output");
        result = 2;
    }
    if (fchmod(output_fd, 0444) != 0) {
        perror("fchmod raw output");
        result = 2;
    }
    close(output_fd);
    close(serial_fd);
    printf("capture_closed=true terminal_seen=%s exact_bytes=%llu mode=0444\n",
           terminal_seen ? "true" : "false",
           (unsigned long long)total_bytes);
    fflush(stdout);
    return result;
}
snippet sha256: 1c2abec9497ffile sha256: 1c2abec9497f
02 · Kapı kimlik kaydı

Operations sıra, kimlik ve başlık bağı

tam Operations kaydıL30990–L31083
website/src/lib/operations.ts::rpi5-g8e-uart10-capture-preflight
  {
    id: "rpi5-g8e-uart10-capture-preflight",
    date: "2026-08-21",
    sequence: 66,
    status: "verified",
    title:
      "G8e UART10 capture helper ve salt-okunur fiziksel preflight doğrulandı",
    summary:
      "G8e fiziksel koşusundan önce same-descriptor UART10 capture helper ayrı source ve arm64 Mach-O olarak Werror ile doğrulandı. Immutable G8d helper'a göre yalnız terminal marker ve rapor satırındaki iki BOOT8D→BOOT8E değişikliği var; normalize edilmiş kaynak birebir eşleşiyor. Gerçek UART kullanmayan PTY koşusu 34 stale byte'ın TCIFLUSH ile atıldığını, effective 115200/8N1/raw/flow-off ayarını, offset 4090'da başlayıp 4096 read sınırını aşan BOOT8E marker'ını, 4.119 exact byte'ı, 3,032 saniye grace'i ve fsync→fchmod 0444→close kapanışını doğruladı. Salt-okunur gerçek preflight cu/tty usbmodem214402 çiftini holder-free ve aynı IOSerialBSD pair olarak buldu; cihaz açılmadı, flush/capture arm edilmedi. External physical disk ve ASELSANBOOT mount yok; görünen 18,1 GB disk image/APFS açıkça hedef değildir. Pi kapalı ve kart Pi içindedir; SD write, gerçek UART capture veya boot yapılmadı.",
    evidence: [
      "scripts/capture-rpi5-g8e-uart10.c exact 7.244 bayt ve SHA-256 1c2abec9497f5507f9ddc5900b9e568b9a1de9cd57515d863f0172d0f6733214 olarak doğrulandı.",
      "cc -Wall -Wextra -Werror -O2 build'i PASS verdi; build/tools/capture-rpi5-g8e-uart10 arm64 Mach-O exact 35.112 bayt ve SHA-256 638b1fec90352bca9df027cf889d2631206be166cf6ba9f4c70c4ea710ae9e8f oldu. Aynı basename ile yeniden derlenen binary byte-for-byte eşleşti.",
      "Immutable G8d archive helper source'u 7.244 bayt/d608c6ff6c933187620d53dd08e34aca47d4a05d1d47edeaf1842de34eb28af5 ve binary'si 35.104 bayt/6fe9d67554144b7ec29524bbcec1d27b11527b9449e1a1000027134a7568c16c olarak değişmedi.",
      "G8d→G8e source diff'i yalnız terminal_marker ve terminal_marker_seen raporundaki iki BOOT8D→BOOT8E satırıdır; BOOT8E tekrar BOOT8D'ye normalize edildiğinde cmp PASS verdi.",
      "Gerçek UART kullanmayan PTY adversarial koşusu helper başlamadan yazılan 34 stale byte'ı TCIFLUSH ile attı; capture çıktısına stale prefix geçmedi.",
      "PTY effective termios read-back'i baud=115200, format=8N1, raw=true ve software/hardware flow-control=false koşullarının tamamını doğruladı.",
      "ASELSAN/BOOT8E marker'ı offset 4090'da başlatılıp 4096 baytlık read buffer sınırının ötesine bölündü; streaming matcher yine terminal marker'ı buldu ve raw exact 4.119 baytta kapandı.",
      "PTY terminal grace ölçümü 3,032 saniye oldu; kapanış fsync, fchmod(0444) ve fd close sırasını tamamladı, final dosya mode 0444 ve BOOT8E seen olarak PASS verdi.",
      "Salt-okunur gerçek keşifte /dev/cu.usbmodem214402 ve /dev/tty.usbmodem214402 mevcut, lsof holder-free ve IOSerialBSDClient aynı usbmodem214402 callout/dial-in pair'ini bildirdi.",
      "diskutil list external physical boş döndü ve /Volumes/ASELSANBOOT yoktu. /dev/disk4 yalnız 18,1 GB disk image, /dev/disk5 onun synthesized APFS container'ıdır; ikisi de fail-closed biçimde SD hedefi olarak reddedildi.",
    ],
    terminalSessionsNote:
      "Compile/diff ve PTY sonuçları helper'ın host preflight kanıtıdır. Son oturum yalnız salt-okunur cihaz/disk keşfidir; gerçek serial descriptor açılmadı ve hiçbir block device'a yazılmadı.",
    terminalSessions: [
      {
        id: "g8e-uart10-helper-build-and-diff",
        title:
          "Werror helper build'i, artifact hashleri ve immutable G8d diff'i",
        commandLines: [
          "cc -Wall -Wextra -Werror -O2 -o build/tools/capture-rpi5-g8e-uart10 scripts/capture-rpi5-g8e-uart10.c",
          "wc -c + shasum -a 256 G8e helper source/binary and immutable G8d archive source/binary",
          "diff -u immutable-G8d/capture_uart10.c scripts/capture-rpi5-g8e-uart10.c",
          "sed 's/BOOT8E/BOOT8D/g' scripts/capture-rpi5-g8e-uart10.c | cmp - immutable-G8d/capture_uart10.c",
        ],
        outputLines: [
          "Werror compile=PASS · output=Mach-O 64-bit executable arm64",
          "G8e source=7244 B · 1c2abec9497f5507f9ddc5900b9e568b9a1de9cd57515d863f0172d0f6733214",
          "G8e binary=35112 B · 638b1fec90352bca9df027cf889d2631206be166cf6ba9f4c70c4ea710ae9e8f",
          "immutable G8d source=d608c6ff…28af5 · binary=6fe9d675…c16c",
          "raw diff=2 BOOT8D→BOOT8E lines · normalized cmp=PASS",
        ],
        exitCode: 0,
        outputMode: "selected",
      },
      {
        id: "g8e-uart10-pty-boundary-preflight",
        title:
          "PTY stale-input, termios, split-marker ve immutable-close testi",
        commandLines: [
          "PTY harness injects 34 stale bytes before helper open",
          "run capture-rpi5-g8e-uart10 against PTY with BOOT8E at offset 4090 across the 4096-byte read boundary",
          "verify raw bytes, terminal grace, fsync, mode and close",
        ],
        outputLines: [
          "stale input=34 B · TCIFLUSH=PASS · stale bytes in raw=0",
          "effective=115200/8N1/raw/flow-off",
          "marker_offset=4090 · read_boundary=4096 · terminal_seen=BOOT8E",
          "exact_bytes=4119 · terminal_grace=3.032s",
          "fsync=PASS · fchmod=0444 · close=PASS",
        ],
        exitCode: 0,
        outputMode: "complete",
      },
      {
        id: "g8e-uart10-read-only-device-disk-preflight",
        title: "Gerçek serial pair ve yanlış-disk kapısının salt-okunur keşfi",
        commandLines: [
          "ls -l /dev/cu.usbmodem214402 /dev/tty.usbmodem214402",
          "lsof /dev/cu.usbmodem214402 /dev/tty.usbmodem214402",
          "ioreg -r -c IOSerialBSDClient -l",
          "diskutil list external physical",
          "test ! -e /Volumes/ASELSANBOOT",
          "diskutil list /dev/disk4 && diskutil list /dev/disk5",
        ],
        outputLines: [
          "callout=/dev/cu.usbmodem214402 · dialin=/dev/tty.usbmodem214402 · both present",
          "lsof holders=0 · IOSerialBSD same pair=PASS",
          "serial open/TCIFLUSH/capture arm=NOT RUN",
          "external physical disks=0 · ASELSANBOOT mount=absent",
          "disk4=18.1 GB disk image · disk5=synthesized APFS · target=REJECTED",
        ],
        exitCode: 0,
        outputMode: "complete",
      },
    ],
    limitations: [
      "PTY testi sentetiktir ve fiziksel UART kanıtı değildir; gerçek /dev/cu.usbmodem214402 descriptor'ı henüz açılmadı, TCIFLUSH uygulanmadı ve capture_armed=YES verilmedi.",
      "External physical SD görünmüyor ve ASELSANBOOT mount yoktur; disk4/disk5 virtual disk image/APFS olduğu için yazım hedefi değildir.",
      "microSD karta formatsız write, manifest/read-back cmp, sync ve eject yapılmadı; Pi kapalı ve kart güçsüz Pi içindedir.",
      "Gerçek UART raw, strict validator ve fiziksel G8E0/G8E1/G8E2/BOOT8E yoktur; bu kayıt yalnız capture preflight PASS'tir.",
      "Website yayını canonical custom domain üzerinden doğrulanır; bu ortamda reset veren pages.dev direct smoke için başarı iddia edilmez.",
      "Wrangler yayını dirty/untracked workspace'ten ve stale 47d22c9 source etiketiyle yapılır; canlı artifact hash'i doğrulansa da Git-provider provenance kurulmuş sayılmaz.",
    ],
  },
snippet sha256: 096045b920f0file sha256: 9726dbf00f84
Kayıtlı yürütme/kanıt komutu
cc -Wall -Wextra -Werror -O2 -o build/tools/capture-rpi5-g8e-uart10 scripts/capture-rpi5-g8e-uart10.c
Registry schema v5 · generator website/scripts/generate-code-gates.mjs · Tam SHA-256: 91d38c7b6222f0b4c117be786454853543da55a160e543d9b951057cc20dcc06