From 0d0d18c654a5ffc1991ca05e7189974b35a9e75e Mon Sep 17 00:00:00 2001 From: MaybeSobi?! <261196905+MaybeSobi@users.noreply.github.com> Date: Wed, 18 Nov 2026 20:56:21 +0330 Subject: [PATCH 1/5] rebuild: establish Debian-based TermOS v0.3.0 foundation --- .github/ISSUE_TEMPLATE/bug_report.yml | 41 + .github/ISSUE_TEMPLATE/feature_request.yml | 23 + .github/PULL_REQUEST_TEMPLATE.md | 28 + .github/dependabot.yml | 10 + .github/workflows/build-iso.yml | 36 + .github/workflows/ci.yml | 40 + .github/workflows/publish-source-bundle.yml | 58 - .github/workflows/termos-iso.yml | 264 -- .gitignore | 57 +- CONTRIBUTING.md | 30 + Makefile | 24 + README.md | 224 +- SECURITY.md | 18 + auto/config | 16 + backend/rust/README.md | 7 + board/termos/grub-efi.cfg | 2 - board/termos/grub-iso.cfg | 12 - board/termos/linux.config | 3958 ----------------- board/termos/rootfs-overlay/etc/inittab | 41 - .../etc/profile.d/termos-dashboard.sh | 10 - .../termos/rootfs-overlay/etc/termos-release | 4 - .../etc/termos/repository-ed25519.pub | 3 - .../rootfs-overlay/opt/termos/dashboard.py | 211 - .../opt/termos/python/tpm/__init__.py | 1 - .../opt/termos/python/tpm/__main__.py | 3 - .../opt/termos/python/tpm/cli.py | 257 -- .../opt/termos/python/tpm/database.py | 188 - .../opt/termos/python/tpm/dependencies.py | 266 -- .../opt/termos/python/tpm/installer.py | 265 -- .../opt/termos/python/tpm/manager.py | 46 - .../opt/termos/python/tpm/package.py | 224 - .../opt/termos/python/tpm/repository.py | 399 -- .../opt/termos/python/tpm/security.py | 34 - .../opt/termos/python/tpm/uninstaller.py | 236 - .../opt/termos/python/tpm/upgrade.py | 407 -- board/termos/rootfs-overlay/usr/bin/tpm | 192 - .../usr/share/termos/tests/tpm-smoke.sh | 56 - .../termos/tests/tpm-system-root-test.sh | 34 - board/termos/vm-compat.fragment | 23 - config/includes.chroot/etc/termos-release | 4 + config/package-lists/termos-base.list.chroot | 20 + configs/termos_defconfig | 30 - docs/ARCHITECTURE.md | 78 + docs/BUILDING.md | 61 + docs/INSTALLATION.md | 24 + docs/MIGRATION_FROM_BUILDROOT.md | 47 + docs/RELEASE_PROCESS.md | 31 + docs/ROADMAP.md | 83 + docs/TPK_FORMAT.md | 79 - docs/archive/v0.1.0/README.md | 5 + .../{ => archive/v0.1.0}/RELEASE_CHECKLIST.md | 0 .../v0.2.0/COMPLIANCE_CHECKLIST.md} | 0 docs/archive/v0.2.0/README.md | 6 + .../v0.2.0/RELEASE_CHECKLIST.md} | 0 .../v0.2.0/THIRD_PARTY_COMPONENTS.csv} | 0 .../v0.2.0/THIRD_PARTY_LICENSE_REVIEW.md} | 0 .../v0.2.0}/THIRD_PARTY_NOTICES.md | 0 docs/decisions/0001-debian-stable.md | 19 + docs/decisions/0002-live-build.md | 19 + docs/decisions/0003-desktop-profiles.md | 18 + docs/decisions/0004-python-rust-boundary.md | 21 + docs/decisions/0005-retire-tpm.md | 20 + keys/termos-repo-public.pem | 3 - profiles/developer/profile.yaml | 12 + profiles/kde/profile.yaml | 9 + profiles/minimal/profile.yaml | 8 + profiles/xfce/profile.yaml | 9 + pyproject.toml | 22 + scripts/assemble-source-bundle.sh | 187 - scripts/build-iso.sh | 30 + scripts/build.sh | 70 - scripts/clean-build.sh | 16 + scripts/generate-legal-review.py | 199 - scripts/package-tpm-release.sh | 27 - scripts/prepare-tpm-system-test-repo.sh | 39 - scripts/run-qemu.sh | 38 - scripts/test-tpm-guest.sh | 56 - scripts/test-tpm-system-root.sh | 34 - scripts/verify-iso.sh | 13 + src/termos/__init__.py | 3 + src/termos/__main__.py | 4 + src/termos/cli.py | 51 + tests/test_cli.py | 22 + tests/test_dashboard.py | 66 - tpm/README.md | 72 - tpm/VERSION | 1 - tpm/pyproject.toml | 28 - tpm/tests/__init__.py | 1 - tpm/tests/conftest.py | 93 - tpm/tests/test_dependencies.py | 292 -- tpm/tests/test_repository.py | 102 - tpm/tests/test_rollback.py | 164 - tpm/tests/test_system_root_guard.py | 23 - tpm/tests/test_upgrade.py | 243 - tpm/tpm/__init__.py | 1 - tpm/tpm/__main__.py | 3 - tpm/tpm/cli.py | 257 -- tpm/tpm/database.py | 188 - tpm/tpm/dependencies.py | 266 -- tpm/tpm/installer.py | 265 -- tpm/tpm/manager.py | 46 - tpm/tpm/package.py | 224 - tpm/tpm/repository.py | 399 -- tpm/tpm/security.py | 34 - tpm/tpm/uninstaller.py | 236 - tpm/tpm/upgrade.py | 407 -- 106 files changed, 1017 insertions(+), 11559 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/build-iso.yml create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/publish-source-bundle.yml delete mode 100644 .github/workflows/termos-iso.yml create mode 100644 CONTRIBUTING.md create mode 100644 Makefile create mode 100644 SECURITY.md create mode 100755 auto/config create mode 100644 backend/rust/README.md delete mode 100644 board/termos/grub-efi.cfg delete mode 100644 board/termos/grub-iso.cfg delete mode 100644 board/termos/linux.config delete mode 100644 board/termos/rootfs-overlay/etc/inittab delete mode 100644 board/termos/rootfs-overlay/etc/profile.d/termos-dashboard.sh delete mode 100644 board/termos/rootfs-overlay/etc/termos-release delete mode 100644 board/termos/rootfs-overlay/etc/termos/repository-ed25519.pub delete mode 100644 board/termos/rootfs-overlay/opt/termos/dashboard.py delete mode 100644 board/termos/rootfs-overlay/opt/termos/python/tpm/__init__.py delete mode 100644 board/termos/rootfs-overlay/opt/termos/python/tpm/__main__.py delete mode 100644 board/termos/rootfs-overlay/opt/termos/python/tpm/cli.py delete mode 100644 board/termos/rootfs-overlay/opt/termos/python/tpm/database.py delete mode 100644 board/termos/rootfs-overlay/opt/termos/python/tpm/dependencies.py delete mode 100644 board/termos/rootfs-overlay/opt/termos/python/tpm/installer.py delete mode 100644 board/termos/rootfs-overlay/opt/termos/python/tpm/manager.py delete mode 100644 board/termos/rootfs-overlay/opt/termos/python/tpm/package.py delete mode 100644 board/termos/rootfs-overlay/opt/termos/python/tpm/repository.py delete mode 100644 board/termos/rootfs-overlay/opt/termos/python/tpm/security.py delete mode 100644 board/termos/rootfs-overlay/opt/termos/python/tpm/uninstaller.py delete mode 100644 board/termos/rootfs-overlay/opt/termos/python/tpm/upgrade.py delete mode 100755 board/termos/rootfs-overlay/usr/bin/tpm delete mode 100755 board/termos/rootfs-overlay/usr/share/termos/tests/tpm-smoke.sh delete mode 100755 board/termos/rootfs-overlay/usr/share/termos/tests/tpm-system-root-test.sh delete mode 100644 board/termos/vm-compat.fragment create mode 100644 config/includes.chroot/etc/termos-release create mode 100644 config/package-lists/termos-base.list.chroot delete mode 100644 configs/termos_defconfig create mode 100644 docs/ARCHITECTURE.md create mode 100644 docs/BUILDING.md create mode 100644 docs/INSTALLATION.md create mode 100644 docs/MIGRATION_FROM_BUILDROOT.md create mode 100644 docs/RELEASE_PROCESS.md create mode 100644 docs/ROADMAP.md delete mode 100644 docs/TPK_FORMAT.md create mode 100644 docs/archive/v0.1.0/README.md rename docs/{ => archive/v0.1.0}/RELEASE_CHECKLIST.md (100%) rename docs/{COMPLIANCE_CHECKLIST_0.2.0.md => archive/v0.2.0/COMPLIANCE_CHECKLIST.md} (100%) create mode 100644 docs/archive/v0.2.0/README.md rename docs/{RELEASE_CHECKLIST_0.2.0.md => archive/v0.2.0/RELEASE_CHECKLIST.md} (100%) rename docs/{THIRD_PARTY_COMPONENTS_0.2.0.csv => archive/v0.2.0/THIRD_PARTY_COMPONENTS.csv} (100%) rename docs/{THIRD_PARTY_LICENSE_REVIEW_0.2.0.md => archive/v0.2.0/THIRD_PARTY_LICENSE_REVIEW.md} (100%) rename docs/{ => archive/v0.2.0}/THIRD_PARTY_NOTICES.md (100%) create mode 100644 docs/decisions/0001-debian-stable.md create mode 100644 docs/decisions/0002-live-build.md create mode 100644 docs/decisions/0003-desktop-profiles.md create mode 100644 docs/decisions/0004-python-rust-boundary.md create mode 100644 docs/decisions/0005-retire-tpm.md delete mode 100644 keys/termos-repo-public.pem create mode 100644 profiles/developer/profile.yaml create mode 100644 profiles/kde/profile.yaml create mode 100644 profiles/minimal/profile.yaml create mode 100644 profiles/xfce/profile.yaml create mode 100644 pyproject.toml delete mode 100644 scripts/assemble-source-bundle.sh create mode 100755 scripts/build-iso.sh delete mode 100755 scripts/build.sh create mode 100755 scripts/clean-build.sh delete mode 100644 scripts/generate-legal-review.py delete mode 100755 scripts/package-tpm-release.sh delete mode 100755 scripts/prepare-tpm-system-test-repo.sh delete mode 100755 scripts/run-qemu.sh delete mode 100755 scripts/test-tpm-guest.sh delete mode 100755 scripts/test-tpm-system-root.sh create mode 100755 scripts/verify-iso.sh create mode 100644 src/termos/__init__.py create mode 100644 src/termos/__main__.py create mode 100644 src/termos/cli.py create mode 100644 tests/test_cli.py delete mode 100644 tests/test_dashboard.py delete mode 100644 tpm/README.md delete mode 100644 tpm/VERSION delete mode 100644 tpm/pyproject.toml delete mode 100644 tpm/tests/__init__.py delete mode 100644 tpm/tests/conftest.py delete mode 100644 tpm/tests/test_dependencies.py delete mode 100644 tpm/tests/test_repository.py delete mode 100644 tpm/tests/test_rollback.py delete mode 100644 tpm/tests/test_system_root_guard.py delete mode 100644 tpm/tests/test_upgrade.py delete mode 100644 tpm/tpm/__init__.py delete mode 100644 tpm/tpm/__main__.py delete mode 100644 tpm/tpm/cli.py delete mode 100644 tpm/tpm/database.py delete mode 100644 tpm/tpm/dependencies.py delete mode 100644 tpm/tpm/installer.py delete mode 100644 tpm/tpm/manager.py delete mode 100644 tpm/tpm/package.py delete mode 100644 tpm/tpm/repository.py delete mode 100644 tpm/tpm/security.py delete mode 100644 tpm/tpm/uninstaller.py delete mode 100644 tpm/tpm/upgrade.py diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..3fe5dd5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,41 @@ +name: Bug report +description: Report a reproducible TermOS problem +title: "[Bug]: " +labels: ["bug"] +body: + - type: markdown + attributes: + value: "Remove passwords, tokens, personal data, and private system identifiers from logs." + - type: input + id: version + attributes: + label: TermOS version or commit + placeholder: "v0.3.0-dev / commit SHA" + validations: + required: true + - type: input + id: environment + attributes: + label: Environment + description: Debian suite, architecture, VM or physical hardware + validations: + required: true + - type: textarea + id: expected + attributes: + label: Expected behavior + validations: + required: true + - type: textarea + id: actual + attributes: + label: Actual behavior + validations: + required: true + - type: textarea + id: reproduce + attributes: + label: Steps to reproduce and logs + render: shell + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..3177c15 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,23 @@ +name: Feature request +description: Propose a TermOS capability or improvement +title: "[Feature]: " +labels: ["enhancement"] +body: + - type: textarea + id: problem + attributes: + label: Problem or user need + description: What are you trying to accomplish? + validations: + required: true + - type: textarea + id: proposal + attributes: + label: Proposed behavior + validations: + required: true + - type: textarea + id: impact + attributes: + label: Architecture, security, and package impact + description: Does this affect Debian packages, privileged operations, boot, disks, or profiles? diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..768ca03 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,28 @@ +## Summary + +Describe what this change does and why. + +## Scope + +- [ ] Documentation +- [ ] Python application +- [ ] Rust backend +- [ ] live-build / ISO +- [ ] Installer +- [ ] Profiles +- [ ] CI / release engineering + +## Validation + +- [ ] Unit tests pass +- [ ] Shell scripts pass syntax checks +- [ ] Documentation updated +- [ ] Relevant VM / ISO tests performed (describe below) + +## Safety and compatibility + +Does this change affect privileged operations, disks, package ownership, boot, or user data? + +## Evidence + +Include commands, logs, screenshots, or test notes. Remove secrets and personal data. diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..abd2e58 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + - package-ecosystem: pip + directory: / + schedule: + interval: weekly diff --git a/.github/workflows/build-iso.yml b/.github/workflows/build-iso.yml new file mode 100644 index 0000000..cdd8b98 --- /dev/null +++ b/.github/workflows/build-iso.yml @@ -0,0 +1,36 @@ +name: Build TermOS live ISO + +on: + workflow_dispatch: + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-24.04 + timeout-minutes: 90 + steps: + - name: Check out source + uses: actions/checkout@v4 + + - name: Install live-build dependencies + run: | + sudo apt-get update + sudo apt-get install -y live-build debootstrap xorriso squashfs-tools qemu-system-x86 ovmf file rsync + + - name: Build ISO + run: sudo ./scripts/build-iso.sh + + - name: Verify ISO + run: ./scripts/verify-iso.sh + + - name: Upload ISO artifact + uses: actions/upload-artifact@v4 + with: + name: TermOS-v0.3.0-development-amd64 + path: | + live-image-amd64.hybrid.iso + live-image-amd64.hybrid.iso.sha256 + if-no-files-found: error + retention-days: 14 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d888a3f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: TermOS CI + +on: + push: + branches: [main, "rebuild/**"] + pull_request: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + +jobs: + validate: + name: Validate source and project metadata + runs-on: ubuntu-24.04 + steps: + - name: Check out source + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Validate Python source + run: | + python -m compileall -q src tests + PYTHONPATH=src python -m unittest discover -s tests -v + + - name: Validate shell scripts + run: | + sh -n auto/config + bash -n scripts/*.sh + + - name: Validate Python package metadata + run: | + python -m pip install --no-deps --no-build-isolation . + termos --version + termos info diff --git a/.github/workflows/publish-source-bundle.yml b/.github/workflows/publish-source-bundle.yml deleted file mode 100644 index b442738..0000000 --- a/.github/workflows/publish-source-bundle.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Publish TermOS v0.2.0 corresponding source - -on: - workflow_run: - workflows: - - Build and validate TermOS ISO - types: - - completed - -permissions: - actions: read - contents: write - -jobs: - publish-source: - if: >- - ${{ github.event.workflow_run.conclusion == 'success' && - github.event.workflow_run.head_branch == 'main' && - contains(github.event.workflow_run.head_commit.message, - 'docs: refresh v0.2.0 licensing and compliance review') || - contains(github.event.workflow_run.head_commit.message, - 'fix: run source bundle assembler through bash') }} - runs-on: ubuntu-24.04 - timeout-minutes: 30 - steps: - - name: Check out TermOS source-bundle tooling - uses: actions/checkout@v4 - with: - ref: main - fetch-depth: 0 - - - name: Download exact v0.2.0 CI legal-info artifact - uses: actions/download-artifact@v4 - with: - name: TermOS-CI-x86_64 - repository: ${{ github.repository }} - run-id: ${{ github.event.workflow_run.id }} - github-token: ${{ secrets.GITHUB_TOKEN }} - path: ci-artifact - - - name: Assemble corresponding-source archive - run: | - set -euo pipefail - bash ./scripts/assemble-source-bundle.sh ci-artifact dist - test -s dist/TermOS-Corresponding-Source-v0.2.0.tar.gz - test -s dist/TermOS-Corresponding-Source-v0.2.0.tar.gz.sha256 - - - name: Publish source archive and checksum to the existing release - uses: softprops/action-gh-release@v2 - with: - tag_name: v0.2.0 - files: | - dist/TermOS-Corresponding-Source-v0.2.0.tar.gz - dist/TermOS-Corresponding-Source-v0.2.0.tar.gz.sha256 - overwrite_files: true - fail_on_unmatched_files: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/termos-iso.yml b/.github/workflows/termos-iso.yml deleted file mode 100644 index 499bf6d..0000000 --- a/.github/workflows/termos-iso.yml +++ /dev/null @@ -1,264 +0,0 @@ -name: Build and validate TermOS ISO - -on: - push: - branches: [main] - paths: - - ".github/workflows/termos-iso.yml" - - ".github/workflows/publish-source-bundle.yml" - - "board/termos/**" - - "configs/termos_defconfig" - - "scripts/build.sh" - - "scripts/generate-legal-review.py" - - "scripts/assemble-source-bundle.sh" - - "scripts/run-qemu.sh" - - "tests/**" - - "tpm/**" - - "docs/**" - - "README.md" - - "LICENSE" - pull_request: - branches: [main] - paths: - - ".github/workflows/termos-iso.yml" - - ".github/workflows/publish-source-bundle.yml" - - "board/termos/**" - - "configs/termos_defconfig" - - "scripts/build.sh" - - "scripts/generate-legal-review.py" - - "scripts/assemble-source-bundle.sh" - - "scripts/run-qemu.sh" - - "tests/**" - - "tpm/**" - - "docs/**" - - "README.md" - - "LICENSE" - workflow_dispatch: - -concurrency: - group: termos-iso-${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -permissions: - contents: read - -jobs: - build-and-boot: - runs-on: ubuntu-24.04 - timeout-minutes: 180 - steps: - - name: Check out TermOS - uses: actions/checkout@v4 - - - name: Install build and VM test dependencies - run: | - sudo apt-get update - sudo apt-get install -y \ - build-essential bc bison flex gawk git patch perl python3 rsync \ - file cpio unzip wget curl xz-utils libncurses-dev libssl-dev \ - libelf-dev qemu-system-x86 ovmf xorriso python3-pytest - - # Cache source downloads independently from the complete Buildroot output. - # The output cache must include build/target as well as build stamps: restoring - # build stamps without the target filesystem makes incremental builds invalid. - - name: Cache Buildroot downloads and sources - uses: actions/cache@v4 - with: - path: | - downloads/ - src/buildroot-2025.02.19/ - key: termos-sources-${{ runner.os }}-buildroot-2025.02.19 - restore-keys: | - termos-sources-${{ runner.os }}-buildroot-2025.02.19 - - - name: Cache complete Buildroot output - uses: actions/cache@v4 - with: - path: build/ - key: termos-output-v2-${{ runner.os }}-buildroot-2025.02.19-${{ hashFiles('configs/termos_defconfig', 'board/termos/linux.config', 'board/termos/vm-compat.fragment', 'board/termos/rootfs-overlay/**') }} - - - name: Validate project scripts and dashboard - run: | - set -euo pipefail - bash -n scripts/build.sh scripts/run-qemu.sh scripts/assemble-source-bundle.sh - PYTHONPYCACHEPREFIX=/tmp/termos-pycache \ - python3 -m py_compile board/termos/rootfs-overlay/opt/termos/dashboard.py - python3 -m unittest discover -s tests -v - python3 -m pytest -q tpm/tests - python3 -m py_compile scripts/generate-legal-review.py - - - name: Build ISO - env: - JOBS: "2" - run: ./scripts/build.sh - - # Produce Buildroot's license/source inventory for human review before - # publishing or redistributing the ISO. This is evidence, not legal approval. - - name: Generate Buildroot legal information - run: | - set -euo pipefail - make -C src/buildroot-2025.02.19 O="$PWD/build" legal-info - test -s build/legal-info/README - test -s build/legal-info/manifest.csv - - - # Keep a compact, inspectable legal review artifact separate from the - # full source archive bundle, which may be too large for convenient review. - - name: Generate compact third-party review bundle - run: | - set -euo pipefail - mkdir -p artifact - python3 scripts/generate-legal-review.py \ - --legal-info build/legal-info \ - --output artifact/legal-review - tar -czf artifact/TermOS-legal-review-v0.2.0.tar.gz \ - -C artifact/legal-review . - - # Keep the exact small evidence in the run log as text too, so the - # package inventory can be reviewed without unpacking the large source archive. - - name: Emit legal review inputs for audit - run: | - set -euo pipefail - echo "===== TERMOS LEGAL README BEGIN =====" - cat build/legal-info/README - echo "===== TERMOS LEGAL README END =====" - echo "===== TERMOS TARGET MANIFEST BEGIN =====" - cat build/legal-info/manifest.csv - echo "===== TERMOS TARGET MANIFEST END =====" - echo "===== TERMOS HOST MANIFEST BEGIN =====" - cat build/legal-info/host-manifest.csv - echo "===== TERMOS HOST MANIFEST END =====" - echo "===== TERMOS COLLECTED LICENSE TEXTS BEGIN =====" - for base in build/legal-info/licenses build/legal-info/host-licenses; do - if [ -d "$base" ]; then - while IFS= read -r -d '' file; do - printf '\\n===== LICENSE FILE: %s =====\\n' "$file" - cat "$file" - done < <(find "$base" -type f -print0 | sort -z) - fi - done - echo "===== TERMOS COLLECTED LICENSE TEXTS END =====" - - - name: Generate CycloneDX SBOM - working-directory: src/buildroot-2025.02.19 - run: | - set -euo pipefail - mkdir -p "$GITHUB_WORKSPACE/artifact" - make O="$GITHUB_WORKSPACE/build" show-info \ - > "$GITHUB_WORKSPACE/artifact/buildroot-show-info.json" - test -s "$GITHUB_WORKSPACE/artifact/buildroot-show-info.json" - python3 -m json.tool "$GITHUB_WORKSPACE/artifact/buildroot-show-info.json" >/dev/null - python3 utils/generate-cyclonedx \ - --in-file "$GITHUB_WORKSPACE/artifact/buildroot-show-info.json" \ - --out-file "$GITHUB_WORKSPACE/artifact/TermOS-v0.2.0.cdx.json" - python3 -m json.tool "$GITHUB_WORKSPACE/artifact/TermOS-v0.2.0.cdx.json" >/dev/null - rm "$GITHUB_WORKSPACE/artifact/buildroot-show-info.json" - - - name: Check ISO format, checksum, and required kernel drivers - shell: bash - run: | - set -euo pipefail - ISO=build/images/rootfs.iso9660 - KERNEL_CONFIG=build/build/linux-6.12.27/.config - - file "$ISO" - test -s "$ISO" - sha256sum "$ISO" | tee build/images/SHA256SUMS - test -s "$KERNEL_CONFIG" - - for setting in \ - CONFIG_EFI=y \ - CONFIG_EFI_STUB=y \ - CONFIG_FB=y \ - CONFIG_FB_EFI=y \ - CONFIG_FRAMEBUFFER_CONSOLE=y \ - CONFIG_DRM=y \ - CONFIG_DRM_SIMPLEDRM=y \ - CONFIG_DRM_VMWGFX=y \ - CONFIG_DRM_VIRTIO_GPU=y \ - CONFIG_SERIAL_8250_CONSOLE=y \ - CONFIG_E1000=y \ - CONFIG_E1000E=y \ - CONFIG_VMXNET3=y \ - CONFIG_VIRTIO_NET=y; do - if ! grep -Fqx "$setting" "$KERNEL_CONFIG"; then - echo "ERROR: required kernel setting missing from built config: $setting" >&2 - exit 1 - fi - done - - - name: Boot ISO in QEMU with UEFI and VirtIO networking - shell: bash - run: | - set -euo pipefail - CODE=/usr/share/OVMF/OVMF_CODE_4M.fd - VARS_TEMPLATE=/usr/share/OVMF/OVMF_VARS_4M.fd - SERIAL_LOG=/tmp/termos-serial.log - test -f "$CODE" - test -f "$VARS_TEMPLATE" - cp "$VARS_TEMPLATE" /tmp/termos-OVMF_VARS.fd - rm -f "$SERIAL_LOG" - - qemu-system-x86_64 \ - -machine q35 -m 1024 -smp 2 \ - -drive "if=pflash,format=raw,unit=0,readonly=on,file=$CODE" \ - -drive "if=pflash,format=raw,unit=1,file=/tmp/termos-OVMF_VARS.fd" \ - -cdrom build/images/rootfs.iso9660 -boot order=d \ - -nic user,model=virtio-net-pci \ - -display none -serial "file:$SERIAL_LOG" -monitor none \ - -no-reboot & - QEMU_PID=$! - cleanup() { - kill "$QEMU_PID" 2>/dev/null || true - wait "$QEMU_PID" 2>/dev/null || true - } - trap cleanup EXIT - - BOOT_REACHED_INIT=0 - for _ in $(seq 1 45); do - if grep -Eq 'Run /init as init process|Run /sbin/init as init process' "$SERIAL_LOG" 2>/dev/null; then - BOOT_REACHED_INIT=1 - break - fi - sleep 1 - done - - echo "----- QEMU UEFI serial log -----" - cat "$SERIAL_LOG" || true - if [[ "$BOOT_REACHED_INIT" != 1 ]]; then - echo "ERROR: ISO did not reach the init process within 45 seconds." >&2 - exit 1 - fi - - - name: Package ISO, boot log, and legal information - if: always() - run: | - mkdir -p artifact - if [ -s build/images/rootfs.iso9660 ]; then - cp build/images/rootfs.iso9660 artifact/TermOS-CI-x86_64.iso - sha256sum artifact/TermOS-CI-x86_64.iso > artifact/SHA256SUMS - fi - if [ -f /tmp/termos-serial.log ]; then - cp /tmp/termos-serial.log artifact/qemu-uefi-serial.log - fi - if [ -d build/legal-info ]; then - tar -czf artifact/TermOS-legal-info.tar.gz -C build legal-info - fi - - - name: Upload ISO and legal review artifacts - if: always() && hashFiles('artifact/TermOS-CI-x86_64.iso') != '' - uses: actions/upload-artifact@v4 - with: - name: TermOS-CI-x86_64 - path: artifact/ - if-no-files-found: error - retention-days: 90 - - - name: Upload compact legal review evidence - if: always() && hashFiles('artifact/TermOS-legal-review-v0.2.0.tar.gz') != '' - uses: actions/upload-artifact@v4 - with: - name: TermOS-legal-review-v0.2.0 - path: artifact/TermOS-legal-review-v0.2.0.tar.gz - if-no-files-found: error - retention-days: 14 diff --git a/.gitignore b/.gitignore index 1987ea5..669df0a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,33 +1,40 @@ -# Buildroot source and generated output +# live-build generated state /build/ -/src/ -/buildroot -/downloads/ -/backups/ +/cache/ +/chroot/ +/binary/ +/*.iso +/*.iso.sha256 +/auto/config.old +/config/bootstrap +/config/binary +/config/chroot +/config/common +/config/source -# Build artifacts and local VM state -*.iso -*.img +# Python +__pycache__/ +*.py[cod] +.pytest_cache/ +.mypy_cache/ +.ruff_cache/ +.venv/ +venv/ +dist/ +*.egg-info/ + +# Rust +/target/ +**/target/ + +# VM and logs *.qcow2 +*.img *.log -*.tmp OVMF_VARS*.fd -# Editor and Python caches -__pycache__/ -*.py[cod] +# Editors and OS .vscode/ .idea/ - -# TPM repository signing keys: never commit private key material. -/keys/*private*.pem -/keys/*private*.key -/dist/ - -# Local TPM test and release artifacts -/packages/ -*.tpk -/*.tar.gz -/*.tar.gz.sha256 -*.bak -.pytest_cache/ +.DS_Store +Thumbs.db diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..d41dc80 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,30 @@ +# Contributing to TermOS + +Thanks for your interest in TermOS. + +## Before opening an issue + +Search existing issues and describe the problem, expected behavior, actual behavior, and environment. For system bugs, include the TermOS version or commit, Debian suite, architecture, VM or physical-hardware context, and relevant logs. Remove secrets and personal data from logs. + +## Pull requests + +- Keep changes focused and explain the user-facing or architectural reason. +- Update documentation when behavior or accepted architecture changes. +- Add tests for new logic. +- Do not add unreviewed privileged shell execution. +- Do not add a second package manager or write into dpkg-owned paths. +- Keep the CLI usable without the TUI. +- Mark planned, experimental, and implemented functionality accurately. + +## Development checks + +~~~bash +make test +sh -n auto/config +bash -n scripts/*.sh +python3 -m compileall -q src tests +~~~ + +For ISO work, follow docs/BUILDING.md. Installer changes must be tested with disposable virtual disks. + +Use concise commit prefixes where practical: docs:, feat:, fix:, test:, and ci:. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..fff77e5 --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ +.PHONY: help test build clean verify vm + +help: + @printf '%s\n' 'TermOS development targets:' \ + ' make test Run Python unit tests' \ + ' make build Build the live ISO (requires root/sudo)' \ + ' make clean Clean live-build generated state' \ + ' make verify Inspect and checksum the generated ISO' \ + ' make vm Boot the ISO in QEMU with UEFI' + +test: + PYTHONPATH=src python3 -m unittest discover -s tests -v + +build: + ./scripts/build-iso.sh + +clean: + ./scripts/clean-build.sh + +verify: + ./scripts/verify-iso.sh + +vm: + ./scripts/run-qemu.sh diff --git a/README.md b/README.md index d283328..76a2892 100644 --- a/README.md +++ b/README.md @@ -2,200 +2,90 @@
-**A terminal-first Linux distribution experiment.** +**A modular, CLI-first Linux system built on Debian.** -A small x86_64 Linux system built with Buildroot, featuring a Python terminal dashboard, an interactive shell, networking, and the experimental TermOS Package Manager (TPM). +A system for people who want to understand, manage, and control their Linux environment. -[![Latest release](https://img.shields.io/github/v/release/MaybeSobi/TermOS?label=release)](https://github.com/MaybeSobi/TermOS/releases/tag/v0.2.0) -![Architecture](https://img.shields.io/badge/architecture-x86__64-blue) -![Boot](https://img.shields.io/badge/boot-UEFI-informational) -![TermOS-authored files](https://img.shields.io/badge/TermOS-authored%20files-MIT-green) +[![Development](https://img.shields.io/badge/status-active%20development-blue)](https://github.com/MaybeSobi/TermOS) +[![Base](https://img.shields.io/badge/base-Debian%20Stable-A81D33)](https://www.debian.org/) -[Download TermOS 0.2.0](https://github.com/MaybeSobi/TermOS/releases/tag/v0.2.0) · [Build from source](#build-from-source) · [Release checklist](docs/COMPLIANCE_CHECKLIST_0.2.0.md) +**Easy to Install. Powerful to Control. Modular by Design.**
> [!WARNING] -> **TermOS is an experimental preview, not a production operating system.** The v0.2.0 ISO passed the automated UEFI/QEMU boot workflow, was manually boot-tested in VMware Workstation Pro 17 using UEFI firmware, and has also been reported to boot successfully on one physical computer. This is a single-machine smoke test; broad hardware compatibility and physical USB boot are not yet verified. +> The Debian-based v0.3.0 generation is under development. No v0.3.0 ISO or installer is currently released. Do not use this development branch as an installable operating system. -> [!IMPORTANT] -> The v0.2.0 release is an experimental preview. Its exact Buildroot manifests contain 10 target and 38 host/build-tool entries. CI collected 86 declared license files and reported successful SHA-256 checks for all 86. The package inventory and multi-license review are documented, but this technical evidence is **not a legal-compliance certification**. The corresponding-source publishing workflow is configured; treat the source package as published only after its assets appear on the [release page](https://github.com/MaybeSobi/TermOS/releases/tag/v0.2.0). See the [component inventory](docs/THIRD_PARTY_COMPONENTS_0.2.0.csv), [license review](docs/THIRD_PARTY_LICENSE_REVIEW_0.2.0.md), and [compliance checklist](docs/COMPLIANCE_CHECKLIST_0.2.0.md). +> [!NOTE] +> TermOS v0.2.0 is the last published Buildroot generation. Its source and release artifacts remain available in the v0.2.0 release. The Debian generation is a rebuild, not an in-place upgrade. -## At a glance +## Project direction -| Item | Details | -| --- | --- | -| Latest preview | [v0.2.0 — Experimental Preview](https://github.com/MaybeSobi/TermOS/releases/tag/v0.2.0) | -| Architecture | x86_64 | -| Boot mode | UEFI | -| Virtualization testing | QEMU (automated CI) and VMware Workstation Pro 17 (manual boot test) | -| Physical hardware test | One successful boot reported on a physical computer (single-machine smoke test) | -| Build system | Buildroot 2025.02.19 | -| Linux kernel | 6.12.27 | -| Userspace | BusyBox and Python 3 | -| Interface | Terminal, shell, and Python dashboard | -| Package management | Experimental TPM with signed repository metadata | - -## What's working - -- Automated ISO build in GitHub Actions -- UEFI boot reaching the init process in QEMU -- VirtIO networking in the CI QEMU environment -- Python dashboard and interactive shell -- TPM unit tests in the required ISO workflow -- TPM package metadata signature verification and guarded system-root operations (experimental) - -### Virtual machine testing - -The v0.2.0 ISO has been tested in both environments: - -- **QEMU:** automated UEFI boot validation in GitHub Actions. -- **VMware Workstation Pro 17:** manual UEFI boot test using a newly created virtual machine. - -The VMware result is a manual smoke test, not an automated compatibility guarantee. When testing in VMware, attach the ISO as a virtual CD/DVD device and use UEFI firmware. - -### Physical hardware testing - -A successful boot has been reported on one physical computer. This is an initial, single-machine smoke test only and does not establish general compatibility with all physical hardware. - -### Known limitations - -- Physical USB boot has **not** been verified. -- Broad compatibility with physical hardware has **not** been established; only the single older-PC boot described above has been reported. -- QEMU networking does not guarantee support for every physical network adapter. -- TPM is experimental; system-root package operations should only be tested in a disposable environment. -- The system is a proof of concept and is not intended for production use. - -## Download TermOS 0.2.0 - -Open the [**TermOS v0.2.0 release page**](https://github.com/MaybeSobi/TermOS/releases/tag/v0.2.0) and download: - -- `TermOS-CI-x86_64.iso` -- `SHA256SUMS` - -Verify the downloaded ISO on Linux: - -```bash -sha256sum --check SHA256SUMS -``` - -The expected SHA-256 for `TermOS-CI-x86_64.iso` is: - -```text -4b09ad178f3eaf202ab4e26a1c6b60c83eb4d869074de4352e1be92ba56da565 -``` - -Always verify the checksum after downloading. A matching checksum confirms file integrity against the published checksum; it does not establish that the image is safe, production-ready, or legally cleared for redistribution. - -### USB note - -Physical USB boot has not been verified. Writing an image to a USB drive can erase existing data. Use a spare drive and verify its identity before writing; do not use a drive containing files you need. - -## Build from source - -### Host requirements +TermOS does not try to hide Linux. It aims to make Linux complexity accessible, manageable, and under the user's control. -On Debian-based Linux systems, install the build and QEMU test dependencies: +- **CLI first, not CLI only:** the shell remains a first-class interface. +- **Transparent over magical:** explain system changes and show what a management action does. +- **One system, multiple interfaces:** CLI, TUI, installer, and future graphical tools share the same system interfaces. +- **Modular by design:** the base system does not force a desktop environment. +- **User control with understandable defaults:** guided workflows do not remove access to the underlying system. -```bash -sudo apt update -sudo apt install -y \ - build-essential bc bison flex gawk git patch perl python3 python3-pytest \ - rsync file cpio unzip wget curl xz-utils libncurses-dev libssl-dev \ - libelf-dev qemu-system-x86 ovmf xorriso -``` +## Architecture decisions -### Build - -From the TermOS project directory: - -```bash -./scripts/build.sh -``` - -The generated ISO should be at: - -```text -build/images/rootfs.iso9660 -``` - -To limit parallel compilation: - -```bash -JOBS=2 ./scripts/build.sh -``` - -The build script downloads Buildroot 2025.02.19 and uses the checked-in TermOS configuration and board files. Review the Buildroot version and configuration before relying on a build for release purposes. - -### Run in QEMU - -```bash -./scripts/run-qemu.sh -``` - -The runner uses Q35, OVMF UEFI firmware, 1 GiB RAM, and a VirtIO network adapter with QEMU user-mode networking. QEMU and OVMF must be installed. Firmware paths can be overridden with the `OVMF_CODE` and `OVMF_VARS_TEMPLATE` environment variables. - -## Licensing, notices, and source availability - -The repository's MIT `LICENSE` applies to TermOS-authored project files only, subject to the rights of the relevant contributors. It does **not** relicense Linux, Buildroot, BusyBox, GRUB, OpenSSL, Python, or any other third-party component. Each third-party component keeps its own license and redistribution conditions. - -Buildroot's legal information is generated in CI for the release build. To reproduce it, run the following from the Buildroot source directory, using the same output directory as the TermOS build: - -```bash -cd ~/TermOS/src/buildroot-2025.02.19 -make O="$HOME/TermOS/build" legal-info -``` - -Review the generated material under `build/legal-info/`: - -- `README` — warnings and notes about material Buildroot could not produce -- `manifest.csv` — target packages and their declared license metadata -- `host-manifest.csv` — host/build-time packages and their declared license metadata -- `licenses/` and `host-licenses/` — license texts collected by Buildroot -- `sources/` and `host-sources/` — source archives collected by Buildroot, where available -- `buildroot.config` — the configuration used for the build +| Area | Direction | +| --- | --- | +| Base system | Debian Stable | +| ISO construction | Debian Live Build (live-build) | +| Default environment | Minimal CLI; no desktop by default | +| Optional desktop profiles | XFCE and KDE Plasma | +| Installer | Custom TermOS installer (planned) | +| First management interface | TUI Control Center | +| Core implementation | Python application layer + Rust system backend | +| System packages | APT / dpkg | +| TermOS Package Manager (TPM) | Retired from the Debian generation | -A compact review bundle is generated by `scripts/generate-legal-review.py` in CI. It preserves the manifests, README, configuration, collected license texts, and a source-archive index. CI also generates a CycloneDX SBOM from Buildroot's `show-info` output. The corresponding-source workflow is configured to package the exact TermOS v0.2.0 source snapshot, the complete legal-info archive, Buildroot 2025.02.19 source and detached signature, the SBOM, compliance documents, and SHA-256 checksums. +APT and dpkg remain the authoritative package-management system. TermOS will not introduce a competing package manager. -**Important:** Buildroot states that `legal-info` is based on package recipe metadata, may be incomplete or inaccurate, and does not determine exactly what must be published. Buildroot also documents that its own source and some toolchain material may need to be collected separately. Human review of the exact package versions, license texts, patches, source archives, and applicable obligations remains necessary. See: +## Development status -- [Third-party license review — v0.2.0](docs/THIRD_PARTY_LICENSE_REVIEW_0.2.0.md) -- [Compliance and release checklist — v0.2.0](docs/COMPLIANCE_CHECKLIST_0.2.0.md) -- [Third-party notices index](docs/THIRD_PARTY_NOTICES.md) -- [Buildroot manual — legal notice and licensing](https://buildroot.org/downloads/manual/manual.html#legal-notice-and-licensing) +The first Debian-generation milestone is **v0.3.0 — Debian Foundation**. -Do not treat the generated inventory as a legal certification. Any formal legal sign-off must come from a qualified reviewer. +Its initial scope is deliberately small: +- A Debian Stable-based amd64 live ISO built with live-build. +- UEFI boot validation in QEMU. +- A minimal TermOS Python CLI with truthful system information. +- Build instructions, tests, and CI scaffolding. -## TermOS Package Manager (TPM) +The custom installer, full Control Center, Rust privileged backend, and optional desktop profiles are later milestones. Their presence in the architecture or repository does not mean they are implemented. -TermOS includes an experimental Python package manager with `.tpk` packages, local dependency resolution, signed repository indexes (Ed25519), and guarded system-root mode. +See [Architecture](docs/ARCHITECTURE.md), [Roadmap](docs/ROADMAP.md), [Building](docs/BUILDING.md), [Installation status](docs/INSTALLATION.md), [Migration policy](docs/MIGRATION_FROM_BUILDROOT.md), and [Release process](docs/RELEASE_PROCESS.md). -See [TPM documentation](tpm/README.md) and the [TPK format](docs/TPK_FORMAT.md). +## Quick start for contributors -Run the guest smoke test inside a disposable QEMU or VMware TermOS instance: +Use a Debian Stable development environment. See docs/BUILDING.md for dependencies and commands. -```sh -/usr/share/termos/tests/tpm-smoke.sh -``` +~~~bash +git clone https://github.com/MaybeSobi/TermOS.git +cd TermOS +python3 -m venv .venv +. .venv/bin/activate +python -m pip install --editable . +termos --version +~~~ -To prepare a signed, harmless data-only test package pair on the host, run `./scripts/prepare-tpm-system-test-repo.sh`, copy the printed repository folder into a disposable VM, and then run: +The ISO build requires root privileges because live-build creates a chroot and filesystem image: -```sh -/usr/share/termos/tests/tpm-system-root-test.sh /path/to/tpm-system-root-repo -``` +~~~bash +make build +~~~ -The script requests confirmation for live-root install, upgrade, and removal, and checks that the test package is removed at the end. +## Previous generation -System-root package operations are root-only, require a signed repository and explicit confirmation, and may not persist across reboot in live-ISO mode. +- TermOS v0.2.0 — Buildroot experimental release +- TermOS v0.1.0 — experimental preview +- Archived v0.2.0 compliance and component records: docs/archive/v0.2.0/ ## Contributing -Issues and pull requests are welcome. Please include reproduction steps, relevant logs, and the exact TermOS release or commit you tested. +Read CONTRIBUTING.md before opening a pull request. Feature proposals should include the user problem, intended behavior, testing plan, and any security or package-ownership implications. ---- - -
- -**TermOS is an experiment. Test carefully, verify downloads, and share feedback through GitHub issues.** - -
+TermOS is experimental software. Hardware compatibility, installation safety, and release readiness must be established through documented tests rather than assumptions. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..ba6b71b --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,18 @@ +# Security Policy + +TermOS is experimental software and is not recommended for production or sensitive workloads. + +## Reporting a vulnerability + +Do not publish exploit details or sensitive logs in a public issue. Use GitHub's private vulnerability reporting feature if enabled for this repository. If private reporting is unavailable, contact the repository maintainer through the contact method listed on the GitHub profile and provide only the minimum information needed to coordinate a report. + +## Security boundaries + +- Do not run development installer code on a disk containing important data. +- Do not expose a general-purpose privileged command API. +- Validate inputs at the system-backend boundary. +- Use Debian package ownership and update mechanisms. +- Never execute remote profile scripts as root without a reviewed, explicit design. +- Keep test environments disposable when evaluating disk, boot, or privileged operations. + +Security support commitments for public releases will be stated in each release. Historical Buildroot releases are not assumed to receive ongoing security updates. diff --git a/auto/config b/auto/config new file mode 100755 index 0000000..71c89bd --- /dev/null +++ b/auto/config @@ -0,0 +1,16 @@ +#!/bin/sh +set -eu + +lb config noauto \ + --mode debian \ + --distribution stable \ + --architectures amd64 \ + --binary-images iso-hybrid \ + --archive-areas "main contrib non-free-firmware" \ + --debian-installer false \ + --bootappend-live "boot=live components hostname=termos username=termos" \ + --iso-application "TermOS" \ + --iso-publisher "TermOS Project" \ + --iso-volume "TERMOS_0_3_0" \ + --debootstrap-options "--variant=minbase" \ + "$@" diff --git a/backend/rust/README.md b/backend/rust/README.md new file mode 100644 index 0000000..6f02e92 --- /dev/null +++ b/backend/rust/README.md @@ -0,0 +1,7 @@ +# Rust System Backend + +This directory is reserved for the future TermOS privileged system backend. + +The Rust service is not implemented in v0.3.0 scaffolding. Do not add a broad root-command execution endpoint. Future operations must be narrow, documented, validated, authorized through system policy, and testable independently from the TUI. + +See docs/ARCHITECTURE.md and ADR 0004. diff --git a/board/termos/grub-efi.cfg b/board/termos/grub-efi.cfg deleted file mode 100644 index 960e8c8..0000000 --- a/board/termos/grub-efi.cfg +++ /dev/null @@ -1,2 +0,0 @@ -set root=(cd0) -configfile /boot/grub/grub.cfg diff --git a/board/termos/grub-iso.cfg b/board/termos/grub-iso.cfg deleted file mode 100644 index 8b376e1..0000000 --- a/board/termos/grub-iso.cfg +++ /dev/null @@ -1,12 +0,0 @@ -set default="0" -set timeout="5" - -menuentry "TermOS 0.2.0 - Live" { - linux /boot/bzImage rdinit=/init console=ttyS0,115200n8 console=tty0 loglevel=7 - initrd /boot/initrd -} - -menuentry "TermOS 0.2.0 - Serial Debug" { - linux /boot/bzImage rdinit=/init console=ttyS0,115200n8 earlycon=uart,io,0x3f8,115200 loglevel=7 - initrd /boot/initrd -} diff --git a/board/termos/linux.config b/board/termos/linux.config deleted file mode 100644 index a312ba3..0000000 --- a/board/termos/linux.config +++ /dev/null @@ -1,3958 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# Linux/x86_64 6.12.27 Kernel Configuration -# -CONFIG_CC_VERSION_TEXT="x86_64-buildroot-linux-gnu-gcc.br_real (Buildroot 2025.02.19) 13.4.0" -CONFIG_CC_IS_GCC=y -CONFIG_GCC_VERSION=130400 -CONFIG_CLANG_VERSION=0 -CONFIG_AS_IS_GNU=y -CONFIG_AS_VERSION=24301 -CONFIG_LD_IS_BFD=y -CONFIG_LD_VERSION=24301 -CONFIG_LLD_VERSION=0 -CONFIG_RUSTC_VERSION=0 -CONFIG_RUSTC_LLVM_VERSION=0 -CONFIG_CC_CAN_LINK=y -CONFIG_CC_CAN_LINK_STATIC=y -CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y -CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT=y -CONFIG_TOOLS_SUPPORT_RELR=y -CONFIG_CC_HAS_ASM_INLINE=y -CONFIG_CC_HAS_NO_PROFILE_FN_ATTR=y -CONFIG_LD_CAN_USE_KEEP_IN_OVERLAY=y -CONFIG_PAHOLE_VERSION=0 -CONFIG_IRQ_WORK=y -CONFIG_BUILDTIME_TABLE_SORT=y -CONFIG_THREAD_INFO_IN_TASK=y - -# -# General setup -# -CONFIG_INIT_ENV_ARG_LIMIT=32 -# CONFIG_COMPILE_TEST is not set -# CONFIG_WERROR is not set -CONFIG_LOCALVERSION="" -CONFIG_LOCALVERSION_AUTO=y -CONFIG_BUILD_SALT="" -CONFIG_HAVE_KERNEL_GZIP=y -CONFIG_HAVE_KERNEL_BZIP2=y -CONFIG_HAVE_KERNEL_LZMA=y -CONFIG_HAVE_KERNEL_XZ=y -CONFIG_HAVE_KERNEL_LZO=y -CONFIG_HAVE_KERNEL_LZ4=y -CONFIG_HAVE_KERNEL_ZSTD=y -CONFIG_KERNEL_GZIP=y -# CONFIG_KERNEL_BZIP2 is not set -# CONFIG_KERNEL_LZMA is not set -# CONFIG_KERNEL_XZ is not set -# CONFIG_KERNEL_LZO is not set -# CONFIG_KERNEL_LZ4 is not set -# CONFIG_KERNEL_ZSTD is not set -CONFIG_DEFAULT_INIT="" -CONFIG_DEFAULT_HOSTNAME="(none)" -CONFIG_SYSVIPC=y -CONFIG_SYSVIPC_SYSCTL=y -# CONFIG_POSIX_MQUEUE is not set -# CONFIG_WATCH_QUEUE is not set -CONFIG_CROSS_MEMORY_ATTACH=y -# CONFIG_USELIB is not set -# CONFIG_AUDIT is not set -CONFIG_HAVE_ARCH_AUDITSYSCALL=y - -# -# IRQ subsystem -# -CONFIG_GENERIC_IRQ_PROBE=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y -CONFIG_GENERIC_PENDING_IRQ=y -CONFIG_GENERIC_IRQ_MIGRATION=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_DOMAIN_HIERARCHY=y -CONFIG_IRQ_MSI_IOMMU=y -CONFIG_GENERIC_IRQ_MATRIX_ALLOCATOR=y -CONFIG_GENERIC_IRQ_RESERVATION_MODE=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_SPARSE_IRQ=y -# end of IRQ subsystem - -CONFIG_CLOCKSOURCE_WATCHDOG=y -CONFIG_ARCH_CLOCKSOURCE_INIT=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST_IDLE=y -CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y -CONFIG_GENERIC_CMOS_UPDATE=y -CONFIG_HAVE_POSIX_CPU_TIMERS_TASK_WORK=y -CONFIG_POSIX_CPU_TIMERS_TASK_WORK=y -CONFIG_CONTEXT_TRACKING=y -CONFIG_CONTEXT_TRACKING_IDLE=y - -# -# Timers subsystem -# -CONFIG_HZ_PERIODIC=y -# CONFIG_NO_HZ_IDLE is not set -# CONFIG_NO_HZ_FULL is not set -# CONFIG_NO_HZ is not set -# CONFIG_HIGH_RES_TIMERS is not set -CONFIG_CLOCKSOURCE_WATCHDOG_MAX_SKEW_US=125 -# end of Timers subsystem - -CONFIG_BPF=y -CONFIG_HAVE_EBPF_JIT=y -CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y - -# -# BPF subsystem -# -# CONFIG_BPF_SYSCALL is not set -# CONFIG_BPF_JIT is not set -# end of BPF subsystem - -CONFIG_PREEMPT_BUILD=y -CONFIG_PREEMPT_NONE=y -# CONFIG_PREEMPT_VOLUNTARY is not set -# CONFIG_PREEMPT is not set -CONFIG_PREEMPT_COUNT=y -CONFIG_PREEMPTION=y -CONFIG_PREEMPT_DYNAMIC=y -# CONFIG_SCHED_CORE is not set - -# -# CPU/Task time and stats accounting -# -CONFIG_TICK_CPU_ACCOUNTING=y -# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set -# CONFIG_IRQ_TIME_ACCOUNTING is not set -# CONFIG_BSD_PROCESS_ACCT is not set -# CONFIG_TASKSTATS is not set -# CONFIG_PSI is not set -# end of CPU/Task time and stats accounting - -CONFIG_CPU_ISOLATION=y - -# -# RCU Subsystem -# -CONFIG_TREE_RCU=y -CONFIG_PREEMPT_RCU=y -# CONFIG_RCU_EXPERT is not set -CONFIG_TREE_SRCU=y -CONFIG_RCU_STALL_COMMON=y -CONFIG_RCU_NEED_SEGCBLIST=y -# end of RCU Subsystem - -# CONFIG_IKCONFIG is not set -# CONFIG_IKHEADERS is not set -CONFIG_LOG_BUF_SHIFT=17 -CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 -CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y - -# -# Scheduler features -# -# CONFIG_UCLAMP_TASK is not set -# end of Scheduler features - -CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y -CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH=y -CONFIG_CC_HAS_INT128=y -CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" -CONFIG_GCC10_NO_ARRAY_BOUNDS=y -CONFIG_CC_NO_ARRAY_BOUNDS=y -CONFIG_GCC_NO_STRINGOP_OVERFLOW=y -CONFIG_CC_NO_STRINGOP_OVERFLOW=y -CONFIG_ARCH_SUPPORTS_INT128=y -CONFIG_CGROUPS=y -# CONFIG_CGROUP_FAVOR_DYNMODS is not set -# CONFIG_MEMCG is not set -# CONFIG_BLK_CGROUP is not set -# CONFIG_CGROUP_SCHED is not set -CONFIG_SCHED_MM_CID=y -# CONFIG_CGROUP_PIDS is not set -# CONFIG_CGROUP_RDMA is not set -# CONFIG_CGROUP_FREEZER is not set -# CONFIG_CPUSETS is not set -# CONFIG_CGROUP_DEVICE is not set -# CONFIG_CGROUP_CPUACCT is not set -# CONFIG_CGROUP_PERF is not set -# CONFIG_CGROUP_MISC is not set -CONFIG_NAMESPACES=y -CONFIG_UTS_NS=y -CONFIG_TIME_NS=y -CONFIG_IPC_NS=y -# CONFIG_USER_NS is not set -CONFIG_PID_NS=y -CONFIG_NET_NS=y -# CONFIG_CHECKPOINT_RESTORE is not set -# CONFIG_SCHED_AUTOGROUP is not set -# CONFIG_RELAY is not set -CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_RD_GZIP=y -CONFIG_RD_BZIP2=y -CONFIG_RD_LZMA=y -CONFIG_RD_XZ=y -CONFIG_RD_LZO=y -CONFIG_RD_LZ4=y -CONFIG_RD_ZSTD=y -# CONFIG_BOOT_CONFIG is not set -CONFIG_INITRAMFS_PRESERVE_MTIME=y -CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_LD_ORPHAN_WARN=y -CONFIG_LD_ORPHAN_WARN_LEVEL="warn" -CONFIG_SYSCTL=y -CONFIG_SYSCTL_EXCEPTION_TRACE=y -CONFIG_HAVE_PCSPKR_PLATFORM=y -# CONFIG_EXPERT is not set -CONFIG_MULTIUSER=y -CONFIG_SGETMASK_SYSCALL=y -CONFIG_SYSFS_SYSCALL=y -CONFIG_FHANDLE=y -CONFIG_POSIX_TIMERS=y -CONFIG_PRINTK=y -CONFIG_BUG=y -CONFIG_ELF_CORE=y -CONFIG_PCSPKR_PLATFORM=y -CONFIG_FUTEX=y -CONFIG_FUTEX_PI=y -CONFIG_EPOLL=y -CONFIG_SIGNALFD=y -CONFIG_TIMERFD=y -CONFIG_EVENTFD=y -CONFIG_SHMEM=y -CONFIG_AIO=y -CONFIG_IO_URING=y -CONFIG_ADVISE_SYSCALLS=y -CONFIG_MEMBARRIER=y -CONFIG_KCMP=y -CONFIG_RSEQ=y -CONFIG_CACHESTAT_SYSCALL=y -CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_SELFTEST is not set -CONFIG_KALLSYMS_ABSOLUTE_PERCPU=y -CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y -CONFIG_HAVE_PERF_EVENTS=y - -# -# Kernel Performance Events And Counters -# -CONFIG_PERF_EVENTS=y -# end of Kernel Performance Events And Counters - -# CONFIG_PROFILING is not set - -# -# Kexec and crash features -# -# CONFIG_KEXEC is not set -# CONFIG_KEXEC_FILE is not set -# end of Kexec and crash features -# end of General setup - -CONFIG_64BIT=y -CONFIG_X86_64=y -CONFIG_X86=y -CONFIG_INSTRUCTION_DECODER=y -CONFIG_OUTPUT_FORMAT="elf64-x86-64" -CONFIG_LOCKDEP_SUPPORT=y -CONFIG_STACKTRACE_SUPPORT=y -CONFIG_MMU=y -CONFIG_ARCH_MMAP_RND_BITS_MIN=28 -CONFIG_ARCH_MMAP_RND_BITS_MAX=32 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 -CONFIG_GENERIC_ISA_DMA=y -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y -CONFIG_ARCH_MAY_HAVE_PC_FDC=y -CONFIG_GENERIC_CALIBRATE_DELAY=y -CONFIG_ARCH_HAS_CPU_RELAX=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_AUDIT_ARCH=y -CONFIG_X86_64_SMP=y -CONFIG_ARCH_SUPPORTS_UPROBES=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_PGTABLE_LEVELS=5 -CONFIG_CC_HAS_SANE_STACKPROTECTOR=y - -# -# Processor type and features -# -CONFIG_SMP=y -# CONFIG_X86_X2APIC is not set -CONFIG_X86_MPPARSE=y -# CONFIG_X86_CPU_RESCTRL is not set -# CONFIG_X86_FRED is not set -CONFIG_X86_EXTENDED_PLATFORM=y -# CONFIG_X86_VSMP is not set -# CONFIG_X86_GOLDFISH is not set -# CONFIG_X86_INTEL_MID is not set -# CONFIG_X86_INTEL_LPSS is not set -# CONFIG_X86_AMD_PLATFORM_DEVICE is not set -# CONFIG_IOSF_MBI is not set -CONFIG_X86_SUPPORTS_MEMORY_FAILURE=y -CONFIG_SCHED_OMIT_FRAME_POINTER=y -CONFIG_HYPERVISOR_GUEST=y -CONFIG_PARAVIRT=y -# CONFIG_PARAVIRT_SPINLOCKS is not set -CONFIG_X86_HV_CALLBACK_VECTOR=y -# CONFIG_XEN is not set -CONFIG_KVM_GUEST=y -CONFIG_ARCH_CPUIDLE_HALTPOLL=y -# CONFIG_PVH is not set -# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set -CONFIG_PARAVIRT_CLOCK=y -# CONFIG_JAILHOUSE_GUEST is not set -# CONFIG_ACRN_GUEST is not set -# CONFIG_MK8 is not set -# CONFIG_MPSC is not set -# CONFIG_MCORE2 is not set -# CONFIG_MATOM is not set -CONFIG_GENERIC_CPU=y -CONFIG_X86_INTERNODE_CACHE_SHIFT=6 -CONFIG_X86_L1_CACHE_SHIFT=6 -CONFIG_X86_TSC=y -CONFIG_X86_HAVE_PAE=y -CONFIG_X86_CMPXCHG64=y -CONFIG_X86_CMOV=y -CONFIG_X86_MINIMUM_CPU_FAMILY=64 -CONFIG_X86_DEBUGCTLMSR=y -CONFIG_IA32_FEAT_CTL=y -CONFIG_X86_VMX_FEATURE_NAMES=y -CONFIG_CPU_SUP_INTEL=y -CONFIG_CPU_SUP_AMD=y -CONFIG_CPU_SUP_HYGON=y -CONFIG_CPU_SUP_CENTAUR=y -CONFIG_CPU_SUP_ZHAOXIN=y -CONFIG_HPET_TIMER=y -CONFIG_DMI=y -# CONFIG_GART_IOMMU is not set -CONFIG_NR_CPUS_RANGE_BEGIN=2 -CONFIG_NR_CPUS_RANGE_END=512 -CONFIG_NR_CPUS_DEFAULT=64 -CONFIG_NR_CPUS=64 -CONFIG_SCHED_CLUSTER=y -CONFIG_SCHED_SMT=y -CONFIG_SCHED_MC=y -CONFIG_SCHED_MC_PRIO=y -CONFIG_X86_LOCAL_APIC=y -CONFIG_ACPI_MADT_WAKEUP=y -CONFIG_X86_IO_APIC=y -# CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS is not set -CONFIG_X86_MCE=y -# CONFIG_X86_MCELOG_LEGACY is not set -CONFIG_X86_MCE_INTEL=y -CONFIG_X86_MCE_AMD=y -CONFIG_X86_MCE_THRESHOLD=y - -# -# Performance monitoring -# -CONFIG_PERF_EVENTS_INTEL_UNCORE=y -CONFIG_PERF_EVENTS_INTEL_RAPL=y -CONFIG_PERF_EVENTS_INTEL_CSTATE=y -# CONFIG_PERF_EVENTS_AMD_POWER is not set -CONFIG_PERF_EVENTS_AMD_UNCORE=y -# CONFIG_PERF_EVENTS_AMD_BRS is not set -# end of Performance monitoring - -CONFIG_X86_16BIT=y -CONFIG_X86_ESPFIX64=y -CONFIG_X86_VSYSCALL_EMULATION=y -CONFIG_X86_IOPL_IOPERM=y -CONFIG_MICROCODE=y -# CONFIG_MICROCODE_LATE_LOADING is not set -# CONFIG_X86_MSR is not set -# CONFIG_X86_CPUID is not set -CONFIG_X86_5LEVEL=y -CONFIG_X86_DIRECT_GBPAGES=y -# CONFIG_NUMA is not set -CONFIG_ARCH_SPARSEMEM_ENABLE=y -CONFIG_ARCH_SPARSEMEM_DEFAULT=y -CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 -# CONFIG_X86_PMEM_LEGACY is not set -# CONFIG_X86_CHECK_BIOS_CORRUPTION is not set -CONFIG_MTRR=y -CONFIG_MTRR_SANITIZER=y -CONFIG_MTRR_SANITIZER_ENABLE_DEFAULT=0 -CONFIG_MTRR_SANITIZER_SPARE_REG_NR_DEFAULT=1 -CONFIG_X86_PAT=y -CONFIG_X86_UMIP=y -CONFIG_CC_HAS_IBT=y -CONFIG_X86_CET=y -CONFIG_X86_KERNEL_IBT=y -CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS=y -CONFIG_ARCH_PKEY_BITS=4 -CONFIG_X86_INTEL_TSX_MODE_OFF=y -# CONFIG_X86_INTEL_TSX_MODE_ON is not set -# CONFIG_X86_INTEL_TSX_MODE_AUTO is not set -# CONFIG_X86_USER_SHADOW_STACK is not set -# CONFIG_EFI is not set -# CONFIG_HZ_100 is not set -CONFIG_HZ_250=y -# CONFIG_HZ_300 is not set -# CONFIG_HZ_1000 is not set -CONFIG_HZ=250 -CONFIG_ARCH_SUPPORTS_KEXEC=y -CONFIG_ARCH_SUPPORTS_KEXEC_FILE=y -CONFIG_ARCH_SUPPORTS_KEXEC_PURGATORY=y -CONFIG_ARCH_SUPPORTS_KEXEC_SIG=y -CONFIG_ARCH_SUPPORTS_KEXEC_SIG_FORCE=y -CONFIG_ARCH_SUPPORTS_KEXEC_BZIMAGE_VERIFY_SIG=y -CONFIG_ARCH_SUPPORTS_KEXEC_JUMP=y -CONFIG_ARCH_SUPPORTS_CRASH_DUMP=y -CONFIG_ARCH_DEFAULT_CRASH_DUMP=y -CONFIG_ARCH_SUPPORTS_CRASH_HOTPLUG=y -CONFIG_PHYSICAL_START=0x1000000 -CONFIG_RELOCATABLE=y -CONFIG_RANDOMIZE_BASE=y -CONFIG_X86_NEED_RELOCS=y -CONFIG_PHYSICAL_ALIGN=0x200000 -CONFIG_DYNAMIC_MEMORY_LAYOUT=y -CONFIG_RANDOMIZE_MEMORY=y -CONFIG_RANDOMIZE_MEMORY_PHYSICAL_PADDING=0x0 -CONFIG_HOTPLUG_CPU=y -CONFIG_LEGACY_VSYSCALL_XONLY=y -# CONFIG_LEGACY_VSYSCALL_NONE is not set -# CONFIG_CMDLINE_BOOL is not set -CONFIG_MODIFY_LDT_SYSCALL=y -# CONFIG_STRICT_SIGALTSTACK_SIZE is not set -CONFIG_HAVE_LIVEPATCH=y -# end of Processor type and features - -CONFIG_CC_HAS_NAMED_AS=y -CONFIG_CC_HAS_NAMED_AS_FIXED_SANITIZERS=y -CONFIG_USE_X86_SEG_SUPPORT=y -CONFIG_CC_HAS_SLS=y -CONFIG_CC_HAS_RETURN_THUNK=y -CONFIG_CC_HAS_ENTRY_PADDING=y -CONFIG_FUNCTION_PADDING_CFI=11 -CONFIG_FUNCTION_PADDING_BYTES=16 -CONFIG_CALL_PADDING=y -CONFIG_HAVE_CALL_THUNKS=y -CONFIG_CALL_THUNKS=y -CONFIG_PREFIX_SYMBOLS=y -CONFIG_CPU_MITIGATIONS=y -CONFIG_MITIGATION_PAGE_TABLE_ISOLATION=y -CONFIG_MITIGATION_RETPOLINE=y -CONFIG_MITIGATION_RETHUNK=y -CONFIG_MITIGATION_UNRET_ENTRY=y -CONFIG_MITIGATION_CALL_DEPTH_TRACKING=y -# CONFIG_CALL_THUNKS_DEBUG is not set -CONFIG_MITIGATION_IBPB_ENTRY=y -CONFIG_MITIGATION_IBRS_ENTRY=y -CONFIG_MITIGATION_SRSO=y -# CONFIG_MITIGATION_SLS is not set -CONFIG_MITIGATION_GDS=y -CONFIG_MITIGATION_RFDS=y -CONFIG_MITIGATION_SPECTRE_BHI=y -CONFIG_MITIGATION_MDS=y -CONFIG_MITIGATION_TAA=y -CONFIG_MITIGATION_MMIO_STALE_DATA=y -CONFIG_MITIGATION_L1TF=y -CONFIG_MITIGATION_RETBLEED=y -CONFIG_MITIGATION_SPECTRE_V1=y -CONFIG_MITIGATION_SPECTRE_V2=y -CONFIG_MITIGATION_SRBDS=y -CONFIG_MITIGATION_SSB=y -CONFIG_ARCH_HAS_ADD_PAGES=y - -# -# Power management and ACPI options -# -CONFIG_SUSPEND=y -CONFIG_SUSPEND_FREEZER=y -# CONFIG_HIBERNATION is not set -CONFIG_PM_SLEEP=y -CONFIG_PM_SLEEP_SMP=y -# CONFIG_PM_AUTOSLEEP is not set -# CONFIG_PM_USERSPACE_AUTOSLEEP is not set -# CONFIG_PM_WAKELOCKS is not set -CONFIG_PM=y -# CONFIG_PM_DEBUG is not set -# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set -# CONFIG_ENERGY_MODEL is not set -CONFIG_ARCH_SUPPORTS_ACPI=y -CONFIG_ACPI=y -CONFIG_ACPI_LEGACY_TABLES_LOOKUP=y -CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC=y -CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT=y -CONFIG_ACPI_THERMAL_LIB=y -# CONFIG_ACPI_DEBUGGER is not set -CONFIG_ACPI_SPCR_TABLE=y -# CONFIG_ACPI_FPDT is not set -CONFIG_ACPI_LPIT=y -CONFIG_ACPI_SLEEP=y -CONFIG_ACPI_REV_OVERRIDE_POSSIBLE=y -# CONFIG_ACPI_EC_DEBUGFS is not set -CONFIG_ACPI_AC=y -CONFIG_ACPI_BATTERY=y -CONFIG_ACPI_BUTTON=y -CONFIG_ACPI_FAN=y -# CONFIG_ACPI_TAD is not set -# CONFIG_ACPI_DOCK is not set -CONFIG_ACPI_CPU_FREQ_PSS=y -CONFIG_ACPI_PROCESSOR_CSTATE=y -CONFIG_ACPI_PROCESSOR_IDLE=y -CONFIG_ACPI_CPPC_LIB=y -CONFIG_ACPI_PROCESSOR=y -CONFIG_ACPI_HOTPLUG_CPU=y -# CONFIG_ACPI_PROCESSOR_AGGREGATOR is not set -CONFIG_ACPI_THERMAL=y -CONFIG_ARCH_HAS_ACPI_TABLE_UPGRADE=y -CONFIG_ACPI_TABLE_UPGRADE=y -# CONFIG_ACPI_DEBUG is not set -# CONFIG_ACPI_PCI_SLOT is not set -CONFIG_ACPI_CONTAINER=y -CONFIG_ACPI_HOTPLUG_IOAPIC=y -# CONFIG_ACPI_SBS is not set -# CONFIG_ACPI_HED is not set -CONFIG_ACPI_NHLT=y -# CONFIG_ACPI_NFIT is not set -CONFIG_HAVE_ACPI_APEI=y -CONFIG_HAVE_ACPI_APEI_NMI=y -# CONFIG_ACPI_APEI is not set -# CONFIG_ACPI_DPTF is not set -# CONFIG_ACPI_CONFIGFS is not set -# CONFIG_ACPI_PFRUT is not set -CONFIG_ACPI_PCC=y -# CONFIG_ACPI_FFH is not set -# CONFIG_PMIC_OPREGION is not set -CONFIG_X86_PM_TIMER=y - -# -# CPU Frequency scaling -# -CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_GOV_ATTR_SET=y -# CONFIG_CPU_FREQ_STAT is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL=y -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_GOV_USERSPACE is not set -# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set -# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set -CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y - -# -# CPU frequency scaling drivers -# -CONFIG_X86_INTEL_PSTATE=y -# CONFIG_X86_PCC_CPUFREQ is not set -CONFIG_X86_AMD_PSTATE=y -CONFIG_X86_AMD_PSTATE_DEFAULT_MODE=3 -# CONFIG_X86_AMD_PSTATE_UT is not set -# CONFIG_X86_ACPI_CPUFREQ is not set -# CONFIG_X86_SPEEDSTEP_CENTRINO is not set -# CONFIG_X86_P4_CLOCKMOD is not set - -# -# shared options -# -# end of CPU Frequency scaling - -# -# CPU Idle -# -CONFIG_CPU_IDLE=y -CONFIG_CPU_IDLE_GOV_LADDER=y -# CONFIG_CPU_IDLE_GOV_MENU is not set -# CONFIG_CPU_IDLE_GOV_TEO is not set -CONFIG_CPU_IDLE_GOV_HALTPOLL=y -CONFIG_HALTPOLL_CPUIDLE=y -# end of CPU Idle - -# CONFIG_INTEL_IDLE is not set -# end of Power management and ACPI options - -# -# Bus options (PCI etc.) -# -CONFIG_PCI_DIRECT=y -CONFIG_PCI_MMCONFIG=y -CONFIG_MMCONF_FAM10H=y -CONFIG_ISA_DMA_API=y -CONFIG_AMD_NB=y -# end of Bus options (PCI etc.) - -# -# Binary Emulations -# -# CONFIG_IA32_EMULATION is not set -# CONFIG_X86_X32_ABI is not set -# end of Binary Emulations - -CONFIG_VIRTUALIZATION=y -# CONFIG_KVM is not set -CONFIG_AS_AVX512=y -CONFIG_AS_SHA1_NI=y -CONFIG_AS_SHA256_NI=y -CONFIG_AS_TPAUSE=y -CONFIG_AS_GFNI=y -CONFIG_AS_VAES=y -CONFIG_AS_VPCLMULQDQ=y -CONFIG_AS_WRUSS=y -CONFIG_ARCH_CONFIGURES_CPU_MITIGATIONS=y - -# -# General architecture-dependent options -# -CONFIG_HOTPLUG_SMT=y -CONFIG_HOTPLUG_CORE_SYNC=y -CONFIG_HOTPLUG_CORE_SYNC_DEAD=y -CONFIG_HOTPLUG_CORE_SYNC_FULL=y -CONFIG_HOTPLUG_SPLIT_STARTUP=y -CONFIG_HOTPLUG_PARALLEL=y -CONFIG_GENERIC_ENTRY=y -# CONFIG_KPROBES is not set -# CONFIG_JUMP_LABEL is not set -# CONFIG_STATIC_CALL_SELFTEST is not set -CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y -CONFIG_ARCH_USE_BUILTIN_BSWAP=y -CONFIG_HAVE_IOREMAP_PROT=y -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_OPTPROBES=y -CONFIG_HAVE_KPROBES_ON_FTRACE=y -CONFIG_ARCH_CORRECT_STACKTRACE_ON_KRETPROBE=y -CONFIG_HAVE_FUNCTION_ERROR_INJECTION=y -CONFIG_HAVE_NMI=y -CONFIG_TRACE_IRQFLAGS_SUPPORT=y -CONFIG_TRACE_IRQFLAGS_NMI_SUPPORT=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_ARCH_HAS_FORTIFY_SOURCE=y -CONFIG_ARCH_HAS_SET_MEMORY=y -CONFIG_ARCH_HAS_SET_DIRECT_MAP=y -CONFIG_ARCH_HAS_CPU_FINALIZE_INIT=y -CONFIG_HAVE_ARCH_THREAD_STRUCT_WHITELIST=y -CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT=y -CONFIG_ARCH_WANTS_NO_INSTR=y -CONFIG_HAVE_ASM_MODVERSIONS=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -CONFIG_HAVE_RSEQ=y -CONFIG_HAVE_RUST=y -CONFIG_HAVE_FUNCTION_ARG_ACCESS_API=y -CONFIG_HAVE_HW_BREAKPOINT=y -CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y -CONFIG_HAVE_USER_RETURN_NOTIFIER=y -CONFIG_HAVE_PERF_EVENTS_NMI=y -CONFIG_HAVE_HARDLOCKUP_DETECTOR_PERF=y -CONFIG_HAVE_PERF_REGS=y -CONFIG_HAVE_PERF_USER_STACK_DUMP=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_HAVE_ARCH_JUMP_LABEL_RELATIVE=y -CONFIG_MMU_GATHER_TABLE_FREE=y -CONFIG_MMU_GATHER_RCU_TABLE_FREE=y -CONFIG_MMU_GATHER_MERGE_VMAS=y -CONFIG_MMU_LAZY_TLB_REFCOUNT=y -CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y -CONFIG_ARCH_HAVE_EXTRA_ELF_NOTES=y -CONFIG_ARCH_HAS_NMI_SAFE_THIS_CPU_OPS=y -CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y -CONFIG_HAVE_CMPXCHG_LOCAL=y -CONFIG_HAVE_CMPXCHG_DOUBLE=y -CONFIG_HAVE_ARCH_SECCOMP=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_SECCOMP=y -CONFIG_SECCOMP_FILTER=y -# CONFIG_SECCOMP_CACHE_DEBUG is not set -CONFIG_HAVE_ARCH_STACKLEAK=y -CONFIG_HAVE_STACKPROTECTOR=y -CONFIG_STACKPROTECTOR=y -CONFIG_STACKPROTECTOR_STRONG=y -CONFIG_ARCH_SUPPORTS_LTO_CLANG=y -CONFIG_ARCH_SUPPORTS_LTO_CLANG_THIN=y -CONFIG_LTO_NONE=y -CONFIG_ARCH_SUPPORTS_CFI_CLANG=y -CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES=y -CONFIG_HAVE_CONTEXT_TRACKING_USER=y -CONFIG_HAVE_CONTEXT_TRACKING_USER_OFFSTACK=y -CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_MOVE_PUD=y -CONFIG_HAVE_MOVE_PMD=y -CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y -CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD=y -CONFIG_HAVE_ARCH_HUGE_VMAP=y -CONFIG_HAVE_ARCH_HUGE_VMALLOC=y -CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y -CONFIG_HAVE_ARCH_SOFT_DIRTY=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_MODULES_USE_ELF_RELA=y -CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y -CONFIG_HAVE_SOFTIRQ_ON_OWN_STACK=y -CONFIG_SOFTIRQ_ON_OWN_STACK=y -CONFIG_ARCH_HAS_ELF_RANDOMIZE=y -CONFIG_HAVE_ARCH_MMAP_RND_BITS=y -CONFIG_HAVE_EXIT_THREAD=y -CONFIG_ARCH_MMAP_RND_BITS=28 -CONFIG_HAVE_PAGE_SIZE_4KB=y -CONFIG_PAGE_SIZE_4KB=y -CONFIG_PAGE_SIZE_LESS_THAN_64KB=y -CONFIG_PAGE_SIZE_LESS_THAN_256KB=y -CONFIG_PAGE_SHIFT=12 -CONFIG_HAVE_OBJTOOL=y -CONFIG_HAVE_JUMP_LABEL_HACK=y -CONFIG_HAVE_NOINSTR_HACK=y -CONFIG_HAVE_NOINSTR_VALIDATION=y -CONFIG_HAVE_UACCESS_VALIDATION=y -CONFIG_HAVE_STACK_VALIDATION=y -# CONFIG_COMPAT_32BIT_TIME is not set -CONFIG_ARCH_SUPPORTS_RT=y -CONFIG_HAVE_ARCH_VMAP_STACK=y -CONFIG_VMAP_STACK=y -CONFIG_HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET=y -CONFIG_RANDOMIZE_KSTACK_OFFSET=y -# CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT is not set -CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y -CONFIG_STRICT_KERNEL_RWX=y -CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y -CONFIG_STRICT_MODULE_RWX=y -CONFIG_HAVE_ARCH_PREL32_RELOCATIONS=y -CONFIG_ARCH_HAS_MEM_ENCRYPT=y -CONFIG_HAVE_STATIC_CALL=y -CONFIG_HAVE_STATIC_CALL_INLINE=y -CONFIG_HAVE_PREEMPT_DYNAMIC=y -CONFIG_HAVE_PREEMPT_DYNAMIC_CALL=y -CONFIG_ARCH_WANT_LD_ORPHAN_WARN=y -CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y -CONFIG_ARCH_SUPPORTS_PAGE_TABLE_CHECK=y -CONFIG_ARCH_HAS_ELFCORE_COMPAT=y -CONFIG_ARCH_HAS_PARANOID_L1D_FLUSH=y -CONFIG_DYNAMIC_SIGFRAME=y -CONFIG_ARCH_HAS_HW_PTE_YOUNG=y -CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG=y -CONFIG_ARCH_HAS_KERNEL_FPU_SUPPORT=y - -# -# GCOV-based kernel profiling -# -CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y -# end of GCOV-based kernel profiling - -CONFIG_HAVE_GCC_PLUGINS=y -# CONFIG_GCC_PLUGINS is not set -CONFIG_FUNCTION_ALIGNMENT_4B=y -CONFIG_FUNCTION_ALIGNMENT_16B=y -CONFIG_FUNCTION_ALIGNMENT=16 -# end of General architecture-dependent options - -CONFIG_RT_MUTEXES=y -CONFIG_MODULES=y -# CONFIG_MODULE_FORCE_LOAD is not set -CONFIG_MODULE_UNLOAD=y -# CONFIG_MODULE_FORCE_UNLOAD is not set -# CONFIG_MODULE_UNLOAD_TAINT_TRACKING is not set -# CONFIG_MODVERSIONS is not set -# CONFIG_MODULE_SRCVERSION_ALL is not set -# CONFIG_MODULE_SIG is not set -# CONFIG_MODULE_COMPRESS is not set -# CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS is not set -CONFIG_MODPROBE_PATH="/sbin/modprobe" -# CONFIG_TRIM_UNUSED_KSYMS is not set -CONFIG_MODULES_TREE_LOOKUP=y -CONFIG_BLOCK=y -CONFIG_BLOCK_LEGACY_AUTOLOAD=y -CONFIG_BLK_DEV_BSG_COMMON=y -# CONFIG_BLK_DEV_BSGLIB is not set -# CONFIG_BLK_DEV_INTEGRITY is not set -CONFIG_BLK_DEV_WRITE_MOUNTED=y -# CONFIG_BLK_DEV_ZONED is not set -# CONFIG_BLK_WBT is not set -# CONFIG_BLK_INLINE_ENCRYPTION is not set - -# -# Partition Types -# -# CONFIG_PARTITION_ADVANCED is not set -CONFIG_MSDOS_PARTITION=y -CONFIG_EFI_PARTITION=y -# end of Partition Types - -CONFIG_BLK_MQ_PCI=y -CONFIG_BLK_MQ_VIRTIO=y -CONFIG_BLK_PM=y - -# -# IO Schedulers -# -CONFIG_MQ_IOSCHED_DEADLINE=y -CONFIG_MQ_IOSCHED_KYBER=y -# CONFIG_IOSCHED_BFQ is not set -# end of IO Schedulers - -CONFIG_UNINLINE_SPIN_UNLOCK=y -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_MUTEX_SPIN_ON_OWNER=y -CONFIG_RWSEM_SPIN_ON_OWNER=y -CONFIG_LOCK_SPIN_ON_OWNER=y -CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y -CONFIG_QUEUED_SPINLOCKS=y -CONFIG_ARCH_USE_QUEUED_RWLOCKS=y -CONFIG_QUEUED_RWLOCKS=y -CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE=y -CONFIG_ARCH_HAS_SYNC_CORE_BEFORE_USERMODE=y -CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y -CONFIG_FREEZER=y - -# -# Executable file formats -# -CONFIG_BINFMT_ELF=y -CONFIG_ELFCORE=y -CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y -CONFIG_BINFMT_SCRIPT=y -# CONFIG_BINFMT_MISC is not set -CONFIG_COREDUMP=y -# end of Executable file formats - -# -# Memory Management options -# -CONFIG_SWAP=y -# CONFIG_ZSWAP is not set - -# -# Slab allocator options -# -CONFIG_SLUB=y -CONFIG_SLAB_MERGE_DEFAULT=y -# CONFIG_SLAB_FREELIST_RANDOM is not set -# CONFIG_SLAB_FREELIST_HARDENED is not set -# CONFIG_SLAB_BUCKETS is not set -# CONFIG_SLUB_STATS is not set -CONFIG_SLUB_CPU_PARTIAL=y -# CONFIG_RANDOM_KMALLOC_CACHES is not set -# end of Slab allocator options - -# CONFIG_SHUFFLE_PAGE_ALLOCATOR is not set -CONFIG_COMPAT_BRK=y -CONFIG_SPARSEMEM=y -CONFIG_SPARSEMEM_EXTREME=y -CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y -CONFIG_SPARSEMEM_VMEMMAP=y -CONFIG_ARCH_WANT_OPTIMIZE_DAX_VMEMMAP=y -CONFIG_ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP=y -CONFIG_HAVE_GUP_FAST=y -CONFIG_EXCLUSIVE_SYSTEM_RAM=y -CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y -# CONFIG_MEMORY_HOTPLUG is not set -CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y -CONFIG_SPLIT_PTE_PTLOCKS=y -CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK=y -CONFIG_SPLIT_PMD_PTLOCKS=y -CONFIG_MEMORY_BALLOON=y -CONFIG_BALLOON_COMPACTION=y -CONFIG_COMPACTION=y -CONFIG_COMPACT_UNEVICTABLE_DEFAULT=1 -CONFIG_PAGE_REPORTING=y -CONFIG_MIGRATION=y -CONFIG_PCP_BATCH_SCALE_MAX=5 -CONFIG_PHYS_ADDR_T_64BIT=y -# CONFIG_KSM is not set -CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 -CONFIG_ARCH_SUPPORTS_MEMORY_FAILURE=y -# CONFIG_MEMORY_FAILURE is not set -CONFIG_ARCH_WANT_GENERAL_HUGETLB=y -CONFIG_ARCH_WANTS_THP_SWAP=y -# CONFIG_TRANSPARENT_HUGEPAGE is not set -CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y -CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y -CONFIG_HAVE_SETUP_PER_CPU_AREA=y -# CONFIG_CMA is not set -CONFIG_GENERIC_EARLY_IOREMAP=y -# CONFIG_DEFERRED_STRUCT_PAGE_INIT is not set -# CONFIG_IDLE_PAGE_TRACKING is not set -CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y -CONFIG_ARCH_HAS_CURRENT_STACK_POINTER=y -CONFIG_ARCH_HAS_PTE_DEVMAP=y -CONFIG_ZONE_DMA=y -CONFIG_ZONE_DMA32=y -CONFIG_ARCH_USES_HIGH_VMA_FLAGS=y -CONFIG_ARCH_HAS_PKEYS=y -CONFIG_ARCH_USES_PG_ARCH_2=y -CONFIG_VM_EVENT_COUNTERS=y -# CONFIG_PERCPU_STATS is not set - -# -# GUP_TEST needs to have DEBUG_FS enabled -# -# CONFIG_DMAPOOL_TEST is not set -CONFIG_ARCH_HAS_PTE_SPECIAL=y -CONFIG_MEMFD_CREATE=y -CONFIG_SECRETMEM=y -# CONFIG_ANON_VMA_NAME is not set -# CONFIG_USERFAULTFD is not set -# CONFIG_LRU_GEN is not set -CONFIG_ARCH_SUPPORTS_PER_VMA_LOCK=y -CONFIG_PER_VMA_LOCK=y -CONFIG_LOCK_MM_AND_FIND_VMA=y -CONFIG_EXECMEM=y - -# -# Data Access Monitoring -# -# CONFIG_DAMON is not set -# end of Data Access Monitoring -# end of Memory Management options - -CONFIG_NET=y - -# -# Networking options -# -CONFIG_PACKET=y -# CONFIG_PACKET_DIAG is not set -CONFIG_UNIX=y -CONFIG_AF_UNIX_OOB=y -# CONFIG_UNIX_DIAG is not set -# CONFIG_TLS is not set -# CONFIG_XFRM_USER is not set -# CONFIG_NET_KEY is not set -CONFIG_INET=y -# CONFIG_IP_MULTICAST is not set -# CONFIG_IP_ADVANCED_ROUTER is not set -# CONFIG_IP_PNP is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPGRE_DEMUX is not set -CONFIG_NET_IP_TUNNEL=y -# CONFIG_SYN_COOKIES is not set -# CONFIG_NET_IPVTI is not set -# CONFIG_NET_FOU is not set -# CONFIG_NET_FOU_IP_TUNNELS is not set -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -CONFIG_INET_TABLE_PERTURB_ORDER=16 -CONFIG_INET_TUNNEL=y -CONFIG_INET_DIAG=y -CONFIG_INET_TCP_DIAG=y -# CONFIG_INET_UDP_DIAG is not set -# CONFIG_INET_RAW_DIAG is not set -# CONFIG_INET_DIAG_DESTROY is not set -# CONFIG_TCP_CONG_ADVANCED is not set -CONFIG_TCP_CONG_CUBIC=y -CONFIG_DEFAULT_TCP_CONG="cubic" -# CONFIG_TCP_AO is not set -# CONFIG_TCP_MD5SIG is not set -CONFIG_IPV6=y -# CONFIG_IPV6_ROUTER_PREF is not set -# CONFIG_IPV6_OPTIMISTIC_DAD is not set -# CONFIG_INET6_AH is not set -# CONFIG_INET6_ESP is not set -# CONFIG_INET6_IPCOMP is not set -# CONFIG_IPV6_MIP6 is not set -# CONFIG_IPV6_VTI is not set -CONFIG_IPV6_SIT=y -# CONFIG_IPV6_SIT_6RD is not set -CONFIG_IPV6_NDISC_NODETYPE=y -# CONFIG_IPV6_TUNNEL is not set -# CONFIG_IPV6_MULTIPLE_TABLES is not set -# CONFIG_IPV6_MROUTE is not set -# CONFIG_IPV6_SEG6_LWTUNNEL is not set -# CONFIG_IPV6_SEG6_HMAC is not set -# CONFIG_IPV6_RPL_LWTUNNEL is not set -# CONFIG_IPV6_IOAM6_LWTUNNEL is not set -# CONFIG_MPTCP is not set -# CONFIG_NETWORK_SECMARK is not set -CONFIG_NET_PTP_CLASSIFY=y -# CONFIG_NETWORK_PHY_TIMESTAMPING is not set -# CONFIG_NETFILTER is not set -# CONFIG_IP_DCCP is not set -# CONFIG_IP_SCTP is not set -# CONFIG_RDS is not set -# CONFIG_TIPC is not set -# CONFIG_ATM is not set -# CONFIG_L2TP is not set -# CONFIG_BRIDGE is not set -# CONFIG_NET_DSA is not set -# CONFIG_VLAN_8021Q is not set -# CONFIG_LLC2 is not set -# CONFIG_ATALK is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_PHONET is not set -# CONFIG_6LOWPAN is not set -# CONFIG_IEEE802154 is not set -# CONFIG_NET_SCHED is not set -# CONFIG_DCB is not set -# CONFIG_BATMAN_ADV is not set -# CONFIG_OPENVSWITCH is not set -# CONFIG_VSOCKETS is not set -# CONFIG_NETLINK_DIAG is not set -# CONFIG_MPLS is not set -# CONFIG_NET_NSH is not set -# CONFIG_HSR is not set -# CONFIG_NET_SWITCHDEV is not set -# CONFIG_NET_L3_MASTER_DEV is not set -# CONFIG_QRTR is not set -# CONFIG_NET_NCSI is not set -CONFIG_PCPU_DEV_REFCNT=y -CONFIG_MAX_SKB_FRAGS=17 -CONFIG_RPS=y -CONFIG_RFS_ACCEL=y -CONFIG_SOCK_RX_QUEUE_MAPPING=y -CONFIG_XPS=y -# CONFIG_CGROUP_NET_PRIO is not set -# CONFIG_CGROUP_NET_CLASSID is not set -CONFIG_NET_RX_BUSY_POLL=y -CONFIG_BQL=y -CONFIG_NET_FLOW_LIMIT=y - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -# end of Network testing -# end of Networking options - -# CONFIG_HAMRADIO is not set -# CONFIG_CAN is not set -# CONFIG_BT is not set -# CONFIG_AF_RXRPC is not set -# CONFIG_AF_KCM is not set -# CONFIG_MCTP is not set -# CONFIG_WIRELESS is not set -# CONFIG_RFKILL is not set -# CONFIG_NET_9P is not set -# CONFIG_CAIF is not set -# CONFIG_CEPH_LIB is not set -# CONFIG_NFC is not set -# CONFIG_PSAMPLE is not set -# CONFIG_NET_IFE is not set -# CONFIG_LWTUNNEL is not set -CONFIG_DST_CACHE=y -CONFIG_GRO_CELLS=y -CONFIG_FAILOVER=y -CONFIG_ETHTOOL_NETLINK=y - -# -# Device Drivers -# -CONFIG_HAVE_PCI=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_PCI=y -CONFIG_PCI_DOMAINS=y -# CONFIG_PCIEPORTBUS is not set -CONFIG_PCIEASPM=y -CONFIG_PCIEASPM_DEFAULT=y -# CONFIG_PCIEASPM_POWERSAVE is not set -# CONFIG_PCIEASPM_POWER_SUPERSAVE is not set -# CONFIG_PCIEASPM_PERFORMANCE is not set -# CONFIG_PCIE_PTM is not set -# CONFIG_PCI_MSI is not set -CONFIG_PCI_QUIRKS=y -# CONFIG_PCI_STUB is not set -CONFIG_PCI_LOCKLESS_CONFIG=y -# CONFIG_PCI_IOV is not set -# CONFIG_PCI_PRI is not set -# CONFIG_PCI_PASID is not set -CONFIG_PCI_LABEL=y -CONFIG_VGA_ARB=y -CONFIG_VGA_ARB_MAX_GPUS=16 -# CONFIG_HOTPLUG_PCI is not set - -# -# PCI controller drivers -# - -# -# Cadence-based PCIe controllers -# -# end of Cadence-based PCIe controllers - -# -# DesignWare-based PCIe controllers -# -# end of DesignWare-based PCIe controllers - -# -# Mobiveil-based PCIe controllers -# -# end of Mobiveil-based PCIe controllers - -# -# PLDA-based PCIe controllers -# -# end of PLDA-based PCIe controllers -# end of PCI controller drivers - -# -# PCI Endpoint -# -# CONFIG_PCI_ENDPOINT is not set -# end of PCI Endpoint - -# -# PCI switch controller drivers -# -# CONFIG_PCI_SW_SWITCHTEC is not set -# end of PCI switch controller drivers - -# CONFIG_CXL_BUS is not set -# CONFIG_PCCARD is not set -# CONFIG_RAPIDIO is not set - -# -# Generic Driver Options -# -# CONFIG_UEVENT_HELPER is not set -CONFIG_DEVTMPFS=y -CONFIG_DEVTMPFS_MOUNT=y -# CONFIG_DEVTMPFS_SAFE is not set -CONFIG_STANDALONE=y -CONFIG_PREVENT_FIRMWARE_BUILD=y - -# -# Firmware loader -# -CONFIG_FW_LOADER=y -CONFIG_EXTRA_FIRMWARE="" -# CONFIG_FW_LOADER_USER_HELPER is not set -# CONFIG_FW_LOADER_COMPRESS is not set -CONFIG_FW_CACHE=y -# CONFIG_FW_UPLOAD is not set -# end of Firmware loader - -CONFIG_ALLOW_DEV_COREDUMP=y -# CONFIG_TEST_ASYNC_DRIVER_PROBE is not set -CONFIG_GENERIC_CPU_DEVICES=y -CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_GENERIC_CPU_VULNERABILITIES=y -CONFIG_REGMAP=y -CONFIG_DMA_SHARED_BUFFER=y -# CONFIG_DMA_FENCE_TRACE is not set -# CONFIG_FW_DEVLINK_SYNC_STATE_TIMEOUT is not set -# end of Generic Driver Options - -# -# Bus devices -# -# CONFIG_MHI_BUS is not set -# CONFIG_MHI_BUS_EP is not set -# end of Bus devices - -# -# Cache Drivers -# -# end of Cache Drivers - -# CONFIG_CONNECTOR is not set - -# -# Firmware Drivers -# - -# -# ARM System Control and Management Interface Protocol -# -# end of ARM System Control and Management Interface Protocol - -# CONFIG_EDD is not set -CONFIG_FIRMWARE_MEMMAP=y -CONFIG_DMIID=y -# CONFIG_DMI_SYSFS is not set -CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y -# CONFIG_ISCSI_IBFT is not set -# CONFIG_FW_CFG_SYSFS is not set -# CONFIG_SYSFB_SIMPLEFB is not set -# CONFIG_GOOGLE_FIRMWARE is not set - -# -# Qualcomm firmware drivers -# -# end of Qualcomm firmware drivers - -# -# Tegra firmware driver -# -# end of Tegra firmware driver -# end of Firmware Drivers - -# CONFIG_GNSS is not set -# CONFIG_MTD is not set -# CONFIG_OF is not set -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -# CONFIG_PARPORT is not set -CONFIG_PNP=y -CONFIG_PNP_DEBUG_MESSAGES=y - -# -# Protocols -# -CONFIG_PNPACPI=y -CONFIG_BLK_DEV=y -# CONFIG_BLK_DEV_NULL_BLK is not set -# CONFIG_BLK_DEV_FD is not set -# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set -# CONFIG_ZRAM is not set -# CONFIG_BLK_DEV_LOOP is not set -# CONFIG_BLK_DEV_DRBD is not set -# CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_RAM is not set -# CONFIG_CDROM_PKTCDVD is not set -# CONFIG_ATA_OVER_ETH is not set -CONFIG_VIRTIO_BLK=y -# CONFIG_BLK_DEV_RBD is not set -# CONFIG_BLK_DEV_UBLK is not set - -# -# NVME Support -# -# CONFIG_BLK_DEV_NVME is not set -# CONFIG_NVME_FC is not set -# CONFIG_NVME_TCP is not set -# end of NVME Support - -# -# Misc devices -# -# CONFIG_AD525X_DPOT is not set -# CONFIG_DUMMY_IRQ is not set -# CONFIG_IBM_ASM is not set -# CONFIG_PHANTOM is not set -# CONFIG_TIFM_CORE is not set -# CONFIG_ICS932S401 is not set -# CONFIG_ENCLOSURE_SERVICES is not set -# CONFIG_HP_ILO is not set -# CONFIG_APDS9802ALS is not set -# CONFIG_ISL29003 is not set -# CONFIG_ISL29020 is not set -# CONFIG_SENSORS_TSL2550 is not set -# CONFIG_SENSORS_BH1770 is not set -# CONFIG_SENSORS_APDS990X is not set -# CONFIG_HMC6352 is not set -# CONFIG_DS1682 is not set -# CONFIG_SRAM is not set -# CONFIG_DW_XDATA_PCIE is not set -# CONFIG_PCI_ENDPOINT_TEST is not set -# CONFIG_XILINX_SDFEC is not set -# CONFIG_NSM is not set -# CONFIG_C2PORT is not set - -# -# EEPROM support -# -# CONFIG_EEPROM_AT24 is not set -# CONFIG_EEPROM_MAX6875 is not set -# CONFIG_EEPROM_93CX6 is not set -# CONFIG_EEPROM_IDT_89HPESX is not set -# CONFIG_EEPROM_EE1004 is not set -# end of EEPROM support - -# CONFIG_CB710_CORE is not set - -# -# Texas Instruments shared transport line discipline -# -# end of Texas Instruments shared transport line discipline - -# CONFIG_SENSORS_LIS3_I2C is not set -# CONFIG_ALTERA_STAPL is not set -CONFIG_INTEL_MEI=y -CONFIG_INTEL_MEI_ME=y -# CONFIG_INTEL_MEI_TXE is not set -# CONFIG_VMWARE_VMCI is not set -# CONFIG_GENWQE is not set -# CONFIG_ECHO is not set -# CONFIG_MISC_ALCOR_PCI is not set -# CONFIG_MISC_RTSX_PCI is not set -# CONFIG_MISC_RTSX_USB is not set -# CONFIG_UACCE is not set -# CONFIG_PVPANIC is not set -# CONFIG_KEBA_CP500 is not set -# end of Misc devices - -# -# SCSI device support -# -CONFIG_SCSI_MOD=y -# CONFIG_RAID_ATTRS is not set -CONFIG_SCSI_COMMON=y -CONFIG_SCSI=y -CONFIG_SCSI_DMA=y -CONFIG_SCSI_PROC_FS=y - -# -# SCSI support type (disk, tape, CD-ROM) -# -CONFIG_BLK_DEV_SD=y -# CONFIG_CHR_DEV_ST is not set -# CONFIG_BLK_DEV_SR is not set -# CONFIG_CHR_DEV_SG is not set -CONFIG_BLK_DEV_BSG=y -# CONFIG_CHR_DEV_SCH is not set -# CONFIG_SCSI_CONSTANTS is not set -# CONFIG_SCSI_LOGGING is not set -# CONFIG_SCSI_SCAN_ASYNC is not set - -# -# SCSI Transports -# -# CONFIG_SCSI_SPI_ATTRS is not set -# CONFIG_SCSI_FC_ATTRS is not set -# CONFIG_SCSI_ISCSI_ATTRS is not set -# CONFIG_SCSI_SAS_ATTRS is not set -# CONFIG_SCSI_SAS_LIBSAS is not set -# CONFIG_SCSI_SRP_ATTRS is not set -# end of SCSI Transports - -CONFIG_SCSI_LOWLEVEL=y -# CONFIG_ISCSI_TCP is not set -# CONFIG_ISCSI_BOOT_SYSFS is not set -# CONFIG_SCSI_CXGB3_ISCSI is not set -# CONFIG_SCSI_CXGB4_ISCSI is not set -# CONFIG_SCSI_BNX2_ISCSI is not set -# CONFIG_BE2ISCSI is not set -# CONFIG_BLK_DEV_3W_XXXX_RAID is not set -# CONFIG_SCSI_HPSA is not set -# CONFIG_SCSI_3W_9XXX is not set -# CONFIG_SCSI_3W_SAS is not set -# CONFIG_SCSI_ACARD is not set -# CONFIG_SCSI_AACRAID is not set -# CONFIG_SCSI_AIC7XXX is not set -# CONFIG_SCSI_AIC79XX is not set -# CONFIG_SCSI_AIC94XX is not set -# CONFIG_SCSI_MVSAS is not set -# CONFIG_SCSI_MVUMI is not set -# CONFIG_SCSI_ADVANSYS is not set -# CONFIG_SCSI_ARCMSR is not set -# CONFIG_SCSI_ESAS2R is not set -# CONFIG_MEGARAID_NEWGEN is not set -# CONFIG_MEGARAID_LEGACY is not set -# CONFIG_MEGARAID_SAS is not set -# CONFIG_SCSI_MPT3SAS is not set -# CONFIG_SCSI_MPT2SAS is not set -# CONFIG_SCSI_MPI3MR is not set -# CONFIG_SCSI_SMARTPQI is not set -# CONFIG_SCSI_HPTIOP is not set -# CONFIG_SCSI_BUSLOGIC is not set -# CONFIG_SCSI_MYRB is not set -# CONFIG_SCSI_MYRS is not set -# CONFIG_VMWARE_PVSCSI is not set -# CONFIG_SCSI_SNIC is not set -# CONFIG_SCSI_DMX3191D is not set -# CONFIG_SCSI_FDOMAIN_PCI is not set -# CONFIG_SCSI_ISCI is not set -# CONFIG_SCSI_IPS is not set -# CONFIG_SCSI_INITIO is not set -# CONFIG_SCSI_INIA100 is not set -# CONFIG_SCSI_STEX is not set -# CONFIG_SCSI_SYM53C8XX_2 is not set -# CONFIG_SCSI_IPR is not set -# CONFIG_SCSI_QLOGIC_1280 is not set -# CONFIG_SCSI_QLA_ISCSI is not set -# CONFIG_SCSI_DC395x is not set -# CONFIG_SCSI_AM53C974 is not set -# CONFIG_SCSI_WD719X is not set -# CONFIG_SCSI_DEBUG is not set -# CONFIG_SCSI_PMCRAID is not set -# CONFIG_SCSI_PM8001 is not set -CONFIG_SCSI_VIRTIO=y -# CONFIG_SCSI_DH is not set -# end of SCSI device support - -CONFIG_ATA=y -CONFIG_SATA_HOST=y -CONFIG_PATA_TIMINGS=y -CONFIG_ATA_VERBOSE_ERROR=y -CONFIG_ATA_FORCE=y -CONFIG_ATA_ACPI=y -# CONFIG_SATA_ZPODD is not set -CONFIG_SATA_PMP=y - -# -# Controllers with non-SFF native interface -# -# CONFIG_SATA_AHCI is not set -# CONFIG_SATA_AHCI_PLATFORM is not set -# CONFIG_AHCI_DWC is not set -# CONFIG_SATA_INIC162X is not set -# CONFIG_SATA_ACARD_AHCI is not set -# CONFIG_SATA_SIL24 is not set -CONFIG_ATA_SFF=y - -# -# SFF controllers with custom DMA interface -# -# CONFIG_PDC_ADMA is not set -# CONFIG_SATA_QSTOR is not set -# CONFIG_SATA_SX4 is not set -CONFIG_ATA_BMDMA=y - -# -# SATA SFF controllers with BMDMA -# -CONFIG_ATA_PIIX=y -# CONFIG_SATA_MV is not set -# CONFIG_SATA_NV is not set -# CONFIG_SATA_PROMISE is not set -# CONFIG_SATA_SIL is not set -# CONFIG_SATA_SIS is not set -# CONFIG_SATA_SVW is not set -# CONFIG_SATA_ULI is not set -# CONFIG_SATA_VIA is not set -# CONFIG_SATA_VITESSE is not set - -# -# PATA SFF controllers with BMDMA -# -# CONFIG_PATA_ALI is not set -# CONFIG_PATA_AMD is not set -# CONFIG_PATA_ARTOP is not set -# CONFIG_PATA_ATIIXP is not set -# CONFIG_PATA_ATP867X is not set -# CONFIG_PATA_CMD64X is not set -# CONFIG_PATA_CYPRESS is not set -# CONFIG_PATA_EFAR is not set -# CONFIG_PATA_HPT366 is not set -# CONFIG_PATA_HPT37X is not set -# CONFIG_PATA_HPT3X2N is not set -# CONFIG_PATA_HPT3X3 is not set -# CONFIG_PATA_IT8213 is not set -# CONFIG_PATA_IT821X is not set -# CONFIG_PATA_JMICRON is not set -# CONFIG_PATA_MARVELL is not set -# CONFIG_PATA_NETCELL is not set -# CONFIG_PATA_NINJA32 is not set -# CONFIG_PATA_NS87415 is not set -# CONFIG_PATA_OLDPIIX is not set -# CONFIG_PATA_OPTIDMA is not set -# CONFIG_PATA_PDC2027X is not set -# CONFIG_PATA_PDC_OLD is not set -# CONFIG_PATA_RADISYS is not set -# CONFIG_PATA_RDC is not set -# CONFIG_PATA_SCH is not set -# CONFIG_PATA_SERVERWORKS is not set -# CONFIG_PATA_SIL680 is not set -# CONFIG_PATA_SIS is not set -# CONFIG_PATA_TOSHIBA is not set -# CONFIG_PATA_TRIFLEX is not set -# CONFIG_PATA_VIA is not set -# CONFIG_PATA_WINBOND is not set - -# -# PIO-only SFF controllers -# -# CONFIG_PATA_CMD640_PCI is not set -# CONFIG_PATA_MPIIX is not set -# CONFIG_PATA_NS87410 is not set -# CONFIG_PATA_OPTI is not set -# CONFIG_PATA_RZ1000 is not set - -# -# Generic fallback / legacy drivers -# -# CONFIG_PATA_ACPI is not set -# CONFIG_ATA_GENERIC is not set -# CONFIG_PATA_LEGACY is not set -# CONFIG_MD is not set -# CONFIG_TARGET_CORE is not set -# CONFIG_FUSION is not set - -# -# IEEE 1394 (FireWire) support -# -# CONFIG_FIREWIRE is not set -# CONFIG_FIREWIRE_NOSY is not set -# end of IEEE 1394 (FireWire) support - -# CONFIG_MACINTOSH_DRIVERS is not set -CONFIG_NETDEVICES=y -CONFIG_MII=y -CONFIG_NET_CORE=y -# CONFIG_BONDING is not set -# CONFIG_DUMMY is not set -# CONFIG_WIREGUARD is not set -# CONFIG_EQUALIZER is not set -# CONFIG_NET_FC is not set -# CONFIG_NET_TEAM is not set -# CONFIG_MACVLAN is not set -# CONFIG_IPVLAN is not set -# CONFIG_VXLAN is not set -# CONFIG_GENEVE is not set -# CONFIG_BAREUDP is not set -# CONFIG_GTP is not set -# CONFIG_PFCP is not set -# CONFIG_MACSEC is not set -# CONFIG_NETCONSOLE is not set -# CONFIG_TUN is not set -# CONFIG_TUN_VNET_CROSS_LE is not set -# CONFIG_VETH is not set -CONFIG_VIRTIO_NET=y -# CONFIG_NLMON is not set -# CONFIG_ARCNET is not set -CONFIG_ETHERNET=y -CONFIG_NET_VENDOR_3COM=y -# CONFIG_VORTEX is not set -# CONFIG_TYPHOON is not set -CONFIG_NET_VENDOR_ADAPTEC=y -# CONFIG_ADAPTEC_STARFIRE is not set -CONFIG_NET_VENDOR_AGERE=y -# CONFIG_ET131X is not set -CONFIG_NET_VENDOR_ALACRITECH=y -# CONFIG_SLICOSS is not set -CONFIG_NET_VENDOR_ALTEON=y -# CONFIG_ACENIC is not set -# CONFIG_ALTERA_TSE is not set -CONFIG_NET_VENDOR_AMAZON=y -CONFIG_NET_VENDOR_AMD=y -# CONFIG_AMD8111_ETH is not set -# CONFIG_PCNET32 is not set -# CONFIG_AMD_XGBE is not set -# CONFIG_PDS_CORE is not set -CONFIG_NET_VENDOR_AQUANTIA=y -# CONFIG_AQTION is not set -CONFIG_NET_VENDOR_ARC=y -CONFIG_NET_VENDOR_ASIX=y -CONFIG_NET_VENDOR_ATHEROS=y -# CONFIG_ATL2 is not set -# CONFIG_ATL1 is not set -# CONFIG_ATL1E is not set -# CONFIG_ATL1C is not set -# CONFIG_ALX is not set -# CONFIG_CX_ECAT is not set -CONFIG_NET_VENDOR_BROADCOM=y -# CONFIG_B44 is not set -# CONFIG_BCMGENET is not set -# CONFIG_BNX2 is not set -# CONFIG_CNIC is not set -# CONFIG_TIGON3 is not set -# CONFIG_BNX2X is not set -# CONFIG_SYSTEMPORT is not set -# CONFIG_BNXT is not set -CONFIG_NET_VENDOR_CADENCE=y -CONFIG_NET_VENDOR_CAVIUM=y -# CONFIG_THUNDER_NIC_PF is not set -# CONFIG_THUNDER_NIC_VF is not set -# CONFIG_THUNDER_NIC_BGX is not set -# CONFIG_THUNDER_NIC_RGX is not set -# CONFIG_CAVIUM_PTP is not set -# CONFIG_LIQUIDIO is not set -CONFIG_NET_VENDOR_CHELSIO=y -# CONFIG_CHELSIO_T1 is not set -# CONFIG_CHELSIO_T3 is not set -# CONFIG_CHELSIO_T4 is not set -# CONFIG_CHELSIO_T4VF is not set -CONFIG_NET_VENDOR_CISCO=y -# CONFIG_ENIC is not set -CONFIG_NET_VENDOR_CORTINA=y -CONFIG_NET_VENDOR_DAVICOM=y -# CONFIG_DNET is not set -CONFIG_NET_VENDOR_DEC=y -# CONFIG_NET_TULIP is not set -CONFIG_NET_VENDOR_DLINK=y -# CONFIG_DL2K is not set -# CONFIG_SUNDANCE is not set -CONFIG_NET_VENDOR_EMULEX=y -# CONFIG_BE2NET is not set -CONFIG_NET_VENDOR_ENGLEDER=y -# CONFIG_TSNEP is not set -CONFIG_NET_VENDOR_EZCHIP=y -CONFIG_NET_VENDOR_FUNGIBLE=y -CONFIG_NET_VENDOR_GOOGLE=y -CONFIG_NET_VENDOR_HUAWEI=y -CONFIG_NET_VENDOR_I825XX=y -CONFIG_NET_VENDOR_INTEL=y -# CONFIG_E100 is not set -# CONFIG_E1000 is not set -# CONFIG_E1000E is not set -# CONFIG_IGB is not set -# CONFIG_IGBVF is not set -# CONFIG_IXGBE is not set -# CONFIG_I40E is not set -# CONFIG_IGC is not set -# CONFIG_JME is not set -CONFIG_NET_VENDOR_LITEX=y -CONFIG_NET_VENDOR_MARVELL=y -# CONFIG_MVMDIO is not set -# CONFIG_SKGE is not set -# CONFIG_SKY2 is not set -# CONFIG_OCTEON_EP is not set -# CONFIG_OCTEON_EP_VF is not set -CONFIG_NET_VENDOR_MELLANOX=y -# CONFIG_MLX4_EN is not set -# CONFIG_MLX5_CORE is not set -# CONFIG_MLXSW_CORE is not set -# CONFIG_MLXFW is not set -CONFIG_NET_VENDOR_META=y -CONFIG_NET_VENDOR_MICREL=y -# CONFIG_KS8851_MLL is not set -# CONFIG_KSZ884X_PCI is not set -CONFIG_NET_VENDOR_MICROCHIP=y -# CONFIG_LAN743X is not set -# CONFIG_VCAP is not set -CONFIG_NET_VENDOR_MICROSEMI=y -CONFIG_NET_VENDOR_MICROSOFT=y -CONFIG_NET_VENDOR_MYRI=y -# CONFIG_MYRI10GE is not set -# CONFIG_FEALNX is not set -CONFIG_NET_VENDOR_NI=y -# CONFIG_NI_XGE_MANAGEMENT_ENET is not set -CONFIG_NET_VENDOR_NATSEMI=y -# CONFIG_NATSEMI is not set -# CONFIG_NS83820 is not set -CONFIG_NET_VENDOR_NETERION=y -# CONFIG_S2IO is not set -CONFIG_NET_VENDOR_NETRONOME=y -CONFIG_NET_VENDOR_8390=y -CONFIG_NE2K_PCI=y -CONFIG_NET_VENDOR_NVIDIA=y -# CONFIG_FORCEDETH is not set -CONFIG_NET_VENDOR_OKI=y -# CONFIG_ETHOC is not set -CONFIG_NET_VENDOR_PACKET_ENGINES=y -# CONFIG_HAMACHI is not set -# CONFIG_YELLOWFIN is not set -CONFIG_NET_VENDOR_PENSANDO=y -# CONFIG_IONIC is not set -CONFIG_NET_VENDOR_QLOGIC=y -# CONFIG_QLA3XXX is not set -# CONFIG_QLCNIC is not set -# CONFIG_NETXEN_NIC is not set -# CONFIG_QED is not set -CONFIG_NET_VENDOR_BROCADE=y -# CONFIG_BNA is not set -CONFIG_NET_VENDOR_QUALCOMM=y -# CONFIG_QCOM_EMAC is not set -# CONFIG_RMNET is not set -CONFIG_NET_VENDOR_RDC=y -# CONFIG_R6040 is not set -CONFIG_NET_VENDOR_REALTEK=y -CONFIG_8139CP=y -# CONFIG_8139TOO is not set -# CONFIG_R8169 is not set -# CONFIG_RTASE is not set -CONFIG_NET_VENDOR_RENESAS=y -CONFIG_NET_VENDOR_ROCKER=y -CONFIG_NET_VENDOR_SAMSUNG=y -# CONFIG_SXGBE_ETH is not set -CONFIG_NET_VENDOR_SEEQ=y -CONFIG_NET_VENDOR_SILAN=y -# CONFIG_SC92031 is not set -CONFIG_NET_VENDOR_SIS=y -# CONFIG_SIS900 is not set -# CONFIG_SIS190 is not set -CONFIG_NET_VENDOR_SOLARFLARE=y -# CONFIG_SFC is not set -# CONFIG_SFC_FALCON is not set -# CONFIG_SFC_SIENA is not set -CONFIG_NET_VENDOR_SMSC=y -# CONFIG_EPIC100 is not set -# CONFIG_SMSC911X is not set -# CONFIG_SMSC9420 is not set -CONFIG_NET_VENDOR_SOCIONEXT=y -CONFIG_NET_VENDOR_STMICRO=y -# CONFIG_STMMAC_ETH is not set -CONFIG_NET_VENDOR_SUN=y -# CONFIG_HAPPYMEAL is not set -# CONFIG_SUNGEM is not set -# CONFIG_CASSINI is not set -# CONFIG_NIU is not set -CONFIG_NET_VENDOR_SYNOPSYS=y -# CONFIG_DWC_XLGMAC is not set -CONFIG_NET_VENDOR_TEHUTI=y -# CONFIG_TEHUTI is not set -# CONFIG_TEHUTI_TN40 is not set -CONFIG_NET_VENDOR_TI=y -# CONFIG_TI_CPSW_PHY_SEL is not set -# CONFIG_TLAN is not set -CONFIG_NET_VENDOR_VERTEXCOM=y -CONFIG_NET_VENDOR_VIA=y -# CONFIG_VIA_RHINE is not set -# CONFIG_VIA_VELOCITY is not set -CONFIG_NET_VENDOR_WANGXUN=y -# CONFIG_NGBE is not set -CONFIG_NET_VENDOR_WIZNET=y -# CONFIG_WIZNET_W5100 is not set -# CONFIG_WIZNET_W5300 is not set -CONFIG_NET_VENDOR_XILINX=y -# CONFIG_XILINX_EMACLITE is not set -# CONFIG_XILINX_LL_TEMAC is not set -# CONFIG_FDDI is not set -# CONFIG_HIPPI is not set -# CONFIG_PHYLIB is not set -# CONFIG_MDIO_DEVICE is not set - -# -# PCS device drivers -# -# CONFIG_PCS_XPCS is not set -# end of PCS device drivers - -# CONFIG_PPP is not set -# CONFIG_SLIP is not set -CONFIG_USB_NET_DRIVERS=y -# CONFIG_USB_CATC is not set -# CONFIG_USB_KAWETH is not set -# CONFIG_USB_PEGASUS is not set -# CONFIG_USB_RTL8150 is not set -# CONFIG_USB_RTL8152 is not set -# CONFIG_USB_LAN78XX is not set -# CONFIG_USB_USBNET is not set -# CONFIG_USB_IPHETH is not set -# CONFIG_WLAN is not set -# CONFIG_WAN is not set - -# -# Wireless WAN -# -# CONFIG_WWAN is not set -# end of Wireless WAN - -# CONFIG_VMXNET3 is not set -# CONFIG_FUJITSU_ES is not set -CONFIG_NET_FAILOVER=y -# CONFIG_ISDN is not set - -# -# Input device support -# -CONFIG_INPUT=y -CONFIG_INPUT_FF_MEMLESS=y -# CONFIG_INPUT_SPARSEKMAP is not set -# CONFIG_INPUT_MATRIXKMAP is not set -CONFIG_INPUT_VIVALDIFMAP=y - -# -# Userland interfaces -# -# CONFIG_INPUT_MOUSEDEV is not set -# CONFIG_INPUT_JOYDEV is not set -CONFIG_INPUT_EVDEV=y -# CONFIG_INPUT_EVBUG is not set - -# -# Input Device Drivers -# -CONFIG_INPUT_KEYBOARD=y -# CONFIG_KEYBOARD_ADP5588 is not set -# CONFIG_KEYBOARD_ADP5589 is not set -CONFIG_KEYBOARD_ATKBD=y -# CONFIG_KEYBOARD_QT1050 is not set -# CONFIG_KEYBOARD_QT1070 is not set -# CONFIG_KEYBOARD_QT2160 is not set -# CONFIG_KEYBOARD_DLINK_DIR685 is not set -# CONFIG_KEYBOARD_LKKBD is not set -# CONFIG_KEYBOARD_TCA6416 is not set -# CONFIG_KEYBOARD_TCA8418 is not set -# CONFIG_KEYBOARD_LM8333 is not set -# CONFIG_KEYBOARD_MAX7359 is not set -# CONFIG_KEYBOARD_MPR121 is not set -# CONFIG_KEYBOARD_NEWTON is not set -# CONFIG_KEYBOARD_OPENCORES is not set -# CONFIG_KEYBOARD_STOWAWAY is not set -# CONFIG_KEYBOARD_SUNKBD is not set -# CONFIG_KEYBOARD_XTKBD is not set -# CONFIG_KEYBOARD_CYPRESS_SF is not set -CONFIG_INPUT_MOUSE=y -CONFIG_MOUSE_PS2=y -CONFIG_MOUSE_PS2_ALPS=y -CONFIG_MOUSE_PS2_BYD=y -CONFIG_MOUSE_PS2_LOGIPS2PP=y -CONFIG_MOUSE_PS2_SYNAPTICS=y -CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS=y -CONFIG_MOUSE_PS2_CYPRESS=y -CONFIG_MOUSE_PS2_LIFEBOOK=y -CONFIG_MOUSE_PS2_TRACKPOINT=y -# CONFIG_MOUSE_PS2_ELANTECH is not set -# CONFIG_MOUSE_PS2_SENTELIC is not set -# CONFIG_MOUSE_PS2_TOUCHKIT is not set -CONFIG_MOUSE_PS2_FOCALTECH=y -# CONFIG_MOUSE_PS2_VMMOUSE is not set -CONFIG_MOUSE_PS2_SMBUS=y -# CONFIG_MOUSE_SERIAL is not set -# CONFIG_MOUSE_APPLETOUCH is not set -# CONFIG_MOUSE_BCM5974 is not set -# CONFIG_MOUSE_CYAPA is not set -# CONFIG_MOUSE_ELAN_I2C is not set -# CONFIG_MOUSE_VSXXXAA is not set -# CONFIG_MOUSE_SYNAPTICS_I2C is not set -# CONFIG_MOUSE_SYNAPTICS_USB is not set -# CONFIG_INPUT_JOYSTICK is not set -# CONFIG_INPUT_TABLET is not set -# CONFIG_INPUT_TOUCHSCREEN is not set -# CONFIG_INPUT_MISC is not set -# CONFIG_RMI4_CORE is not set - -# -# Hardware I/O ports -# -CONFIG_SERIO=y -CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y -CONFIG_SERIO_I8042=y -CONFIG_SERIO_SERPORT=y -# CONFIG_SERIO_CT82C710 is not set -# CONFIG_SERIO_PCIPS2 is not set -CONFIG_SERIO_LIBPS2=y -# CONFIG_SERIO_RAW is not set -# CONFIG_SERIO_ALTERA_PS2 is not set -# CONFIG_SERIO_PS2MULT is not set -# CONFIG_SERIO_ARC_PS2 is not set -# CONFIG_USERIO is not set -# CONFIG_GAMEPORT is not set -# end of Hardware I/O ports -# end of Input device support - -# -# Character devices -# -CONFIG_TTY=y -CONFIG_VT=y -CONFIG_CONSOLE_TRANSLATIONS=y -CONFIG_VT_CONSOLE=y -CONFIG_VT_CONSOLE_SLEEP=y -CONFIG_VT_HW_CONSOLE_BINDING=y -CONFIG_UNIX98_PTYS=y -CONFIG_LEGACY_PTYS=y -CONFIG_LEGACY_PTY_COUNT=256 -CONFIG_LEGACY_TIOCSTI=y -CONFIG_LDISC_AUTOLOAD=y - -# -# Serial drivers -# -CONFIG_SERIAL_EARLYCON=y -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y -CONFIG_SERIAL_8250_PNP=y -# CONFIG_SERIAL_8250_16550A_VARIANTS is not set -# CONFIG_SERIAL_8250_FINTEK is not set -CONFIG_SERIAL_8250_CONSOLE=y -CONFIG_SERIAL_8250_PCILIB=y -CONFIG_SERIAL_8250_PCI=y -CONFIG_SERIAL_8250_EXAR=y -CONFIG_SERIAL_8250_NR_UARTS=4 -CONFIG_SERIAL_8250_RUNTIME_UARTS=4 -# CONFIG_SERIAL_8250_EXTENDED is not set -# CONFIG_SERIAL_8250_PCI1XXXX is not set -CONFIG_SERIAL_8250_DWLIB=y -# CONFIG_SERIAL_8250_DW is not set -# CONFIG_SERIAL_8250_RT288X is not set -CONFIG_SERIAL_8250_LPSS=y -CONFIG_SERIAL_8250_MID=y -CONFIG_SERIAL_8250_PERICOM=y - -# -# Non-8250 serial port support -# -# CONFIG_SERIAL_UARTLITE is not set -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -# CONFIG_SERIAL_JSM is not set -# CONFIG_SERIAL_LANTIQ is not set -# CONFIG_SERIAL_SCCNXP is not set -# CONFIG_SERIAL_SC16IS7XX is not set -# CONFIG_SERIAL_ALTERA_JTAGUART is not set -# CONFIG_SERIAL_ALTERA_UART is not set -# CONFIG_SERIAL_ARC is not set -# CONFIG_SERIAL_RP2 is not set -# CONFIG_SERIAL_FSL_LPUART is not set -# CONFIG_SERIAL_FSL_LINFLEXUART is not set -# end of Serial drivers - -# CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_N_GSM is not set -# CONFIG_NOZOMI is not set -# CONFIG_NULL_TTY is not set -CONFIG_HVC_DRIVER=y -# CONFIG_SERIAL_DEV_BUS is not set -CONFIG_VIRTIO_CONSOLE=y -# CONFIG_IPMI_HANDLER is not set -CONFIG_HW_RANDOM=m -# CONFIG_HW_RANDOM_TIMERIOMEM is not set -CONFIG_HW_RANDOM_INTEL=m -CONFIG_HW_RANDOM_AMD=m -# CONFIG_HW_RANDOM_BA431 is not set -CONFIG_HW_RANDOM_VIA=m -CONFIG_HW_RANDOM_VIRTIO=m -# CONFIG_HW_RANDOM_XIPHERA is not set -# CONFIG_APPLICOM is not set -# CONFIG_MWAVE is not set -CONFIG_DEVMEM=y -# CONFIG_NVRAM is not set -CONFIG_DEVPORT=y -# CONFIG_HPET is not set -# CONFIG_HANGCHECK_TIMER is not set -# CONFIG_TCG_TPM is not set -# CONFIG_TELCLOCK is not set -# CONFIG_XILLYBUS is not set -# CONFIG_XILLYUSB is not set -# end of Character devices - -# -# I2C support -# -CONFIG_I2C=y -CONFIG_ACPI_I2C_OPREGION=y -CONFIG_I2C_BOARDINFO=y -# CONFIG_I2C_CHARDEV is not set -# CONFIG_I2C_MUX is not set -CONFIG_I2C_HELPER_AUTO=y - -# -# I2C Hardware Bus support -# - -# -# PC SMBus host controller drivers -# -# CONFIG_I2C_ALI1535 is not set -# CONFIG_I2C_ALI1563 is not set -# CONFIG_I2C_ALI15X3 is not set -# CONFIG_I2C_AMD756 is not set -# CONFIG_I2C_AMD8111 is not set -# CONFIG_I2C_AMD_MP2 is not set -# CONFIG_I2C_I801 is not set -# CONFIG_I2C_ISCH is not set -# CONFIG_I2C_ISMT is not set -# CONFIG_I2C_PIIX4 is not set -# CONFIG_I2C_NFORCE2 is not set -# CONFIG_I2C_NVIDIA_GPU is not set -# CONFIG_I2C_SIS5595 is not set -# CONFIG_I2C_SIS630 is not set -# CONFIG_I2C_SIS96X is not set -# CONFIG_I2C_VIA is not set -# CONFIG_I2C_VIAPRO is not set -# CONFIG_I2C_ZHAOXIN is not set - -# -# ACPI drivers -# -# CONFIG_I2C_SCMI is not set - -# -# I2C system bus drivers (mostly embedded / system-on-chip) -# -# CONFIG_I2C_DESIGNWARE_CORE is not set -# CONFIG_I2C_OCORES is not set -# CONFIG_I2C_PCA_PLATFORM is not set -# CONFIG_I2C_SIMTEC is not set -# CONFIG_I2C_XILINX is not set - -# -# External I2C/SMBus adapter drivers -# -# CONFIG_I2C_DIOLAN_U2C is not set -# CONFIG_I2C_CP2615 is not set -# CONFIG_I2C_PCI1XXXX is not set -# CONFIG_I2C_ROBOTFUZZ_OSIF is not set -# CONFIG_I2C_TAOS_EVM is not set -# CONFIG_I2C_TINY_USB is not set - -# -# Other I2C/SMBus bus drivers -# -# CONFIG_I2C_MLXCPLD is not set -# CONFIG_I2C_VIRTIO is not set -# end of I2C Hardware Bus support - -# CONFIG_I2C_STUB is not set -# CONFIG_I2C_SLAVE is not set -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -# end of I2C support - -# CONFIG_I3C is not set -# CONFIG_SPI is not set -# CONFIG_SPMI is not set -# CONFIG_HSI is not set -CONFIG_PPS=y -# CONFIG_PPS_DEBUG is not set -# CONFIG_NTP_PPS is not set - -# -# PPS clients support -# -# CONFIG_PPS_CLIENT_KTIMER is not set -# CONFIG_PPS_CLIENT_LDISC is not set -# CONFIG_PPS_CLIENT_GPIO is not set - -# -# PPS generators support -# - -# -# PTP clock support -# -CONFIG_PTP_1588_CLOCK=y -CONFIG_PTP_1588_CLOCK_OPTIONAL=y - -# -# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. -# -CONFIG_PTP_1588_CLOCK_KVM=y -# CONFIG_PTP_1588_CLOCK_IDT82P33 is not set -# CONFIG_PTP_1588_CLOCK_IDTCM is not set -# CONFIG_PTP_1588_CLOCK_FC3W is not set -# CONFIG_PTP_1588_CLOCK_MOCK is not set -# CONFIG_PTP_1588_CLOCK_VMW is not set -# end of PTP clock support - -# CONFIG_PINCTRL is not set -# CONFIG_GPIOLIB is not set -# CONFIG_W1 is not set -# CONFIG_POWER_RESET is not set -# CONFIG_POWER_SEQUENCING is not set -CONFIG_POWER_SUPPLY=y -# CONFIG_POWER_SUPPLY_DEBUG is not set -CONFIG_POWER_SUPPLY_HWMON=y -# CONFIG_IP5XXX_POWER is not set -# CONFIG_TEST_POWER is not set -# CONFIG_CHARGER_ADP5061 is not set -# CONFIG_BATTERY_CW2015 is not set -# CONFIG_BATTERY_DS2780 is not set -# CONFIG_BATTERY_DS2781 is not set -# CONFIG_BATTERY_DS2782 is not set -# CONFIG_BATTERY_SAMSUNG_SDI is not set -# CONFIG_BATTERY_SBS is not set -# CONFIG_CHARGER_SBS is not set -# CONFIG_BATTERY_BQ27XXX is not set -# CONFIG_BATTERY_MAX17042 is not set -# CONFIG_BATTERY_MAX1720X is not set -# CONFIG_CHARGER_MAX8903 is not set -# CONFIG_CHARGER_LP8727 is not set -# CONFIG_CHARGER_LTC4162L is not set -# CONFIG_CHARGER_MAX77976 is not set -# CONFIG_CHARGER_BQ2415X is not set -# CONFIG_BATTERY_GAUGE_LTC2941 is not set -# CONFIG_BATTERY_GOLDFISH is not set -# CONFIG_BATTERY_RT5033 is not set -# CONFIG_CHARGER_BD99954 is not set -# CONFIG_BATTERY_UG3105 is not set -# CONFIG_FUEL_GAUGE_MM8013 is not set -CONFIG_HWMON=y -# CONFIG_HWMON_DEBUG_CHIP is not set - -# -# Native drivers -# -# CONFIG_SENSORS_ABITUGURU is not set -# CONFIG_SENSORS_ABITUGURU3 is not set -# CONFIG_SENSORS_AD7414 is not set -# CONFIG_SENSORS_AD7418 is not set -# CONFIG_SENSORS_ADM1025 is not set -# CONFIG_SENSORS_ADM1026 is not set -# CONFIG_SENSORS_ADM1029 is not set -# CONFIG_SENSORS_ADM1031 is not set -# CONFIG_SENSORS_ADM1177 is not set -# CONFIG_SENSORS_ADM9240 is not set -# CONFIG_SENSORS_ADT7410 is not set -# CONFIG_SENSORS_ADT7411 is not set -# CONFIG_SENSORS_ADT7462 is not set -# CONFIG_SENSORS_ADT7470 is not set -# CONFIG_SENSORS_ADT7475 is not set -# CONFIG_SENSORS_AHT10 is not set -# CONFIG_SENSORS_AQUACOMPUTER_D5NEXT is not set -# CONFIG_SENSORS_AS370 is not set -# CONFIG_SENSORS_ASC7621 is not set -# CONFIG_SENSORS_ASUS_ROG_RYUJIN is not set -# CONFIG_SENSORS_AXI_FAN_CONTROL is not set -# CONFIG_SENSORS_K8TEMP is not set -# CONFIG_SENSORS_K10TEMP is not set -# CONFIG_SENSORS_FAM15H_POWER is not set -# CONFIG_SENSORS_APPLESMC is not set -# CONFIG_SENSORS_ASB100 is not set -# CONFIG_SENSORS_ATXP1 is not set -# CONFIG_SENSORS_CHIPCAP2 is not set -# CONFIG_SENSORS_CORSAIR_CPRO is not set -# CONFIG_SENSORS_CORSAIR_PSU is not set -# CONFIG_SENSORS_DRIVETEMP is not set -# CONFIG_SENSORS_DS620 is not set -# CONFIG_SENSORS_DS1621 is not set -# CONFIG_SENSORS_I5K_AMB is not set -# CONFIG_SENSORS_F71805F is not set -# CONFIG_SENSORS_F71882FG is not set -# CONFIG_SENSORS_F75375S is not set -# CONFIG_SENSORS_FSCHMD is not set -# CONFIG_SENSORS_GIGABYTE_WATERFORCE is not set -# CONFIG_SENSORS_GL518SM is not set -# CONFIG_SENSORS_GL520SM is not set -# CONFIG_SENSORS_G760A is not set -# CONFIG_SENSORS_G762 is not set -# CONFIG_SENSORS_HIH6130 is not set -# CONFIG_SENSORS_HS3001 is not set -# CONFIG_SENSORS_I5500 is not set -# CONFIG_SENSORS_CORETEMP is not set -# CONFIG_SENSORS_IT87 is not set -# CONFIG_SENSORS_JC42 is not set -# CONFIG_SENSORS_POWERZ is not set -# CONFIG_SENSORS_POWR1220 is not set -# CONFIG_SENSORS_LENOVO_EC is not set -# CONFIG_SENSORS_LINEAGE is not set -# CONFIG_SENSORS_LTC2945 is not set -# CONFIG_SENSORS_LTC2947_I2C is not set -# CONFIG_SENSORS_LTC2990 is not set -# CONFIG_SENSORS_LTC2991 is not set -# CONFIG_SENSORS_LTC4151 is not set -# CONFIG_SENSORS_LTC4215 is not set -# CONFIG_SENSORS_LTC4222 is not set -# CONFIG_SENSORS_LTC4245 is not set -# CONFIG_SENSORS_LTC4260 is not set -# CONFIG_SENSORS_LTC4261 is not set -# CONFIG_SENSORS_LTC4282 is not set -# CONFIG_SENSORS_MAX127 is not set -# CONFIG_SENSORS_MAX16065 is not set -# CONFIG_SENSORS_MAX1619 is not set -# CONFIG_SENSORS_MAX1668 is not set -# CONFIG_SENSORS_MAX197 is not set -# CONFIG_SENSORS_MAX31730 is not set -# CONFIG_SENSORS_MAX31760 is not set -# CONFIG_MAX31827 is not set -# CONFIG_SENSORS_MAX6620 is not set -# CONFIG_SENSORS_MAX6621 is not set -# CONFIG_SENSORS_MAX6639 is not set -# CONFIG_SENSORS_MAX6650 is not set -# CONFIG_SENSORS_MAX6697 is not set -# CONFIG_SENSORS_MAX31790 is not set -# CONFIG_SENSORS_MC34VR500 is not set -# CONFIG_SENSORS_MCP3021 is not set -# CONFIG_SENSORS_TC654 is not set -# CONFIG_SENSORS_TPS23861 is not set -# CONFIG_SENSORS_MR75203 is not set -# CONFIG_SENSORS_LM63 is not set -# CONFIG_SENSORS_LM73 is not set -# CONFIG_SENSORS_LM75 is not set -# CONFIG_SENSORS_LM77 is not set -# CONFIG_SENSORS_LM78 is not set -# CONFIG_SENSORS_LM80 is not set -# CONFIG_SENSORS_LM83 is not set -# CONFIG_SENSORS_LM85 is not set -# CONFIG_SENSORS_LM87 is not set -# CONFIG_SENSORS_LM90 is not set -# CONFIG_SENSORS_LM92 is not set -# CONFIG_SENSORS_LM93 is not set -# CONFIG_SENSORS_LM95234 is not set -# CONFIG_SENSORS_LM95241 is not set -# CONFIG_SENSORS_LM95245 is not set -# CONFIG_SENSORS_PC87360 is not set -# CONFIG_SENSORS_PC87427 is not set -# CONFIG_SENSORS_NCT6683 is not set -# CONFIG_SENSORS_NCT6775 is not set -# CONFIG_SENSORS_NCT6775_I2C is not set -# CONFIG_SENSORS_NCT7802 is not set -# CONFIG_SENSORS_NPCM7XX is not set -# CONFIG_SENSORS_NZXT_KRAKEN2 is not set -# CONFIG_SENSORS_NZXT_KRAKEN3 is not set -# CONFIG_SENSORS_NZXT_SMART2 is not set -# CONFIG_SENSORS_OCC_P8_I2C is not set -# CONFIG_SENSORS_OXP is not set -# CONFIG_SENSORS_PCF8591 is not set -# CONFIG_PMBUS is not set -# CONFIG_SENSORS_PT5161L is not set -# CONFIG_SENSORS_SBTSI is not set -# CONFIG_SENSORS_SBRMI is not set -# CONFIG_SENSORS_SHT21 is not set -# CONFIG_SENSORS_SHT3x is not set -# CONFIG_SENSORS_SHT4x is not set -# CONFIG_SENSORS_SHTC1 is not set -# CONFIG_SENSORS_SIS5595 is not set -# CONFIG_SENSORS_DME1737 is not set -# CONFIG_SENSORS_EMC1403 is not set -# CONFIG_SENSORS_EMC2103 is not set -# CONFIG_SENSORS_EMC2305 is not set -# CONFIG_SENSORS_EMC6W201 is not set -# CONFIG_SENSORS_SMSC47M1 is not set -# CONFIG_SENSORS_SMSC47M192 is not set -# CONFIG_SENSORS_SMSC47B397 is not set -# CONFIG_SENSORS_STTS751 is not set -# CONFIG_SENSORS_ADC128D818 is not set -# CONFIG_SENSORS_ADS7828 is not set -# CONFIG_SENSORS_AMC6821 is not set -# CONFIG_SENSORS_INA209 is not set -# CONFIG_SENSORS_INA2XX is not set -# CONFIG_SENSORS_INA238 is not set -# CONFIG_SENSORS_INA3221 is not set -# CONFIG_SENSORS_SPD5118 is not set -# CONFIG_SENSORS_TC74 is not set -# CONFIG_SENSORS_THMC50 is not set -# CONFIG_SENSORS_TMP102 is not set -# CONFIG_SENSORS_TMP103 is not set -# CONFIG_SENSORS_TMP108 is not set -# CONFIG_SENSORS_TMP401 is not set -# CONFIG_SENSORS_TMP421 is not set -# CONFIG_SENSORS_TMP464 is not set -# CONFIG_SENSORS_TMP513 is not set -# CONFIG_SENSORS_VIA_CPUTEMP is not set -# CONFIG_SENSORS_VIA686A is not set -# CONFIG_SENSORS_VT1211 is not set -# CONFIG_SENSORS_VT8231 is not set -# CONFIG_SENSORS_W83773G is not set -# CONFIG_SENSORS_W83781D is not set -# CONFIG_SENSORS_W83791D is not set -# CONFIG_SENSORS_W83792D is not set -# CONFIG_SENSORS_W83793 is not set -# CONFIG_SENSORS_W83795 is not set -# CONFIG_SENSORS_W83L785TS is not set -# CONFIG_SENSORS_W83L786NG is not set -# CONFIG_SENSORS_W83627HF is not set -# CONFIG_SENSORS_W83627EHF is not set -# CONFIG_SENSORS_XGENE is not set - -# -# ACPI drivers -# -# CONFIG_SENSORS_ACPI_POWER is not set -# CONFIG_SENSORS_ATK0110 is not set -# CONFIG_SENSORS_ASUS_EC is not set -CONFIG_THERMAL=y -# CONFIG_THERMAL_NETLINK is not set -# CONFIG_THERMAL_STATISTICS is not set -CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 -CONFIG_THERMAL_HWMON=y -CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y -# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set -# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set -# CONFIG_THERMAL_GOV_FAIR_SHARE is not set -CONFIG_THERMAL_GOV_STEP_WISE=y -# CONFIG_THERMAL_GOV_BANG_BANG is not set -CONFIG_THERMAL_GOV_USER_SPACE=y -# CONFIG_THERMAL_EMULATION is not set - -# -# Intel thermal drivers -# -# CONFIG_INTEL_POWERCLAMP is not set -CONFIG_X86_THERMAL_VECTOR=y -CONFIG_INTEL_TCC=y -CONFIG_X86_PKG_TEMP_THERMAL=m -# CONFIG_INTEL_SOC_DTS_THERMAL is not set - -# -# ACPI INT340X thermal drivers -# -# CONFIG_INT340X_THERMAL is not set -# end of ACPI INT340X thermal drivers - -# CONFIG_INTEL_PCH_THERMAL is not set -# CONFIG_INTEL_TCC_COOLING is not set -# CONFIG_INTEL_HFI_THERMAL is not set -# end of Intel thermal drivers - -# CONFIG_WATCHDOG is not set -CONFIG_SSB_POSSIBLE=y -# CONFIG_SSB is not set -CONFIG_BCMA_POSSIBLE=y -# CONFIG_BCMA is not set - -# -# Multifunction device drivers -# -# CONFIG_MFD_AS3711 is not set -# CONFIG_MFD_SMPRO is not set -# CONFIG_PMIC_ADP5520 is not set -# CONFIG_MFD_BCM590XX is not set -# CONFIG_MFD_BD9571MWV is not set -# CONFIG_MFD_AXP20X_I2C is not set -# CONFIG_MFD_CS42L43_I2C is not set -# CONFIG_MFD_MADERA is not set -# CONFIG_PMIC_DA903X is not set -# CONFIG_MFD_DA9052_I2C is not set -# CONFIG_MFD_DA9055 is not set -# CONFIG_MFD_DA9062 is not set -# CONFIG_MFD_DA9063 is not set -# CONFIG_MFD_DA9150 is not set -# CONFIG_MFD_DLN2 is not set -# CONFIG_MFD_MC13XXX_I2C is not set -# CONFIG_MFD_MP2629 is not set -# CONFIG_LPC_ICH is not set -# CONFIG_LPC_SCH is not set -# CONFIG_MFD_INTEL_LPSS_ACPI is not set -# CONFIG_MFD_INTEL_LPSS_PCI is not set -# CONFIG_MFD_INTEL_PMC_BXT is not set -# CONFIG_MFD_IQS62X is not set -# CONFIG_MFD_JANZ_CMODIO is not set -# CONFIG_MFD_KEMPLD is not set -# CONFIG_MFD_88PM800 is not set -# CONFIG_MFD_88PM805 is not set -# CONFIG_MFD_88PM860X is not set -# CONFIG_MFD_MAX14577 is not set -# CONFIG_MFD_MAX77541 is not set -# CONFIG_MFD_MAX77693 is not set -# CONFIG_MFD_MAX77843 is not set -# CONFIG_MFD_MAX8907 is not set -# CONFIG_MFD_MAX8925 is not set -# CONFIG_MFD_MAX8997 is not set -# CONFIG_MFD_MAX8998 is not set -# CONFIG_MFD_MT6360 is not set -# CONFIG_MFD_MT6370 is not set -# CONFIG_MFD_MT6397 is not set -# CONFIG_MFD_MENF21BMC is not set -# CONFIG_MFD_VIPERBOARD is not set -# CONFIG_MFD_RETU is not set -# CONFIG_MFD_PCF50633 is not set -# CONFIG_MFD_SY7636A is not set -# CONFIG_MFD_RDC321X is not set -# CONFIG_MFD_RT4831 is not set -# CONFIG_MFD_RT5033 is not set -# CONFIG_MFD_RT5120 is not set -# CONFIG_MFD_RC5T583 is not set -# CONFIG_MFD_SI476X_CORE is not set -# CONFIG_MFD_SM501 is not set -# CONFIG_MFD_SKY81452 is not set -# CONFIG_MFD_SYSCON is not set -# CONFIG_MFD_LP3943 is not set -# CONFIG_MFD_LP8788 is not set -# CONFIG_MFD_TI_LMU is not set -# CONFIG_MFD_PALMAS is not set -# CONFIG_TPS6105X is not set -# CONFIG_TPS6507X is not set -# CONFIG_MFD_TPS65086 is not set -# CONFIG_MFD_TPS65090 is not set -# CONFIG_MFD_TI_LP873X is not set -# CONFIG_MFD_TPS6586X is not set -# CONFIG_MFD_TPS65912_I2C is not set -# CONFIG_MFD_TPS6594_I2C is not set -# CONFIG_TWL4030_CORE is not set -# CONFIG_TWL6040_CORE is not set -# CONFIG_MFD_WL1273_CORE is not set -# CONFIG_MFD_LM3533 is not set -# CONFIG_MFD_TQMX86 is not set -# CONFIG_MFD_VX855 is not set -# CONFIG_MFD_ARIZONA_I2C is not set -# CONFIG_MFD_WM8400 is not set -# CONFIG_MFD_WM831X_I2C is not set -# CONFIG_MFD_WM8350_I2C is not set -# CONFIG_MFD_WM8994 is not set -# CONFIG_MFD_ATC260X_I2C is not set -# CONFIG_MFD_CS40L50_I2C is not set -# end of Multifunction device drivers - -# CONFIG_REGULATOR is not set -# CONFIG_RC_CORE is not set - -# -# CEC support -# -# CONFIG_MEDIA_CEC_SUPPORT is not set -# end of CEC support - -# CONFIG_MEDIA_SUPPORT is not set - -# -# Graphics support -# -CONFIG_APERTURE_HELPERS=y -CONFIG_VIDEO=y -# CONFIG_AUXDISPLAY is not set -# CONFIG_AGP is not set -# CONFIG_VGA_SWITCHEROO is not set -CONFIG_DRM=y -# CONFIG_DRM_DEBUG_MM is not set -CONFIG_DRM_KMS_HELPER=y -# CONFIG_DRM_PANIC is not set -CONFIG_DRM_FBDEV_EMULATION=y -CONFIG_DRM_FBDEV_OVERALLOC=100 -# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set -CONFIG_DRM_TTM=y -CONFIG_DRM_VRAM_HELPER=y -CONFIG_DRM_TTM_HELPER=y -CONFIG_DRM_GEM_SHMEM_HELPER=y - -# -# I2C encoder or helper chips -# -# CONFIG_DRM_I2C_CH7006 is not set -# CONFIG_DRM_I2C_SIL164 is not set -# CONFIG_DRM_I2C_NXP_TDA998X is not set -# CONFIG_DRM_I2C_NXP_TDA9950 is not set -# end of I2C encoder or helper chips - -# -# ARM devices -# -# end of ARM devices - -# CONFIG_DRM_RADEON is not set -# CONFIG_DRM_AMDGPU is not set -# CONFIG_DRM_NOUVEAU is not set -# CONFIG_DRM_I915 is not set -# CONFIG_DRM_XE is not set -# CONFIG_DRM_VGEM is not set -# CONFIG_DRM_VKMS is not set -# CONFIG_DRM_VMWGFX is not set -# CONFIG_DRM_GMA500 is not set -# CONFIG_DRM_UDL is not set -# CONFIG_DRM_AST is not set -# CONFIG_DRM_MGAG200 is not set -CONFIG_DRM_QXL=y -CONFIG_DRM_VIRTIO_GPU=y -CONFIG_DRM_VIRTIO_GPU_KMS=y -CONFIG_DRM_PANEL=y - -# -# Display Panels -# -# end of Display Panels - -CONFIG_DRM_BRIDGE=y -CONFIG_DRM_PANEL_BRIDGE=y - -# -# Display Interface Bridges -# -# CONFIG_DRM_ANALOGIX_ANX78XX is not set -# end of Display Interface Bridges - -# CONFIG_DRM_ETNAVIV is not set -CONFIG_DRM_BOCHS=y -# CONFIG_DRM_CIRRUS_QEMU is not set -# CONFIG_DRM_GM12U320 is not set -# CONFIG_DRM_SIMPLEDRM is not set -# CONFIG_DRM_VBOXVIDEO is not set -# CONFIG_DRM_GUD is not set -# CONFIG_DRM_SSD130X is not set -CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y - -# -# Frame buffer Devices -# -CONFIG_FB=y -# CONFIG_FB_CIRRUS is not set -# CONFIG_FB_PM2 is not set -# CONFIG_FB_CYBER2000 is not set -# CONFIG_FB_ARC is not set -# CONFIG_FB_ASILIANT is not set -# CONFIG_FB_IMSTT is not set -# CONFIG_FB_VGA16 is not set -# CONFIG_FB_VESA is not set -# CONFIG_FB_N411 is not set -# CONFIG_FB_HGA is not set -# CONFIG_FB_OPENCORES is not set -# CONFIG_FB_S1D13XXX is not set -# CONFIG_FB_NVIDIA is not set -# CONFIG_FB_RIVA is not set -# CONFIG_FB_I740 is not set -# CONFIG_FB_MATROX is not set -# CONFIG_FB_RADEON is not set -# CONFIG_FB_ATY128 is not set -# CONFIG_FB_ATY is not set -# CONFIG_FB_S3 is not set -# CONFIG_FB_SAVAGE is not set -# CONFIG_FB_SIS is not set -# CONFIG_FB_NEOMAGIC is not set -# CONFIG_FB_KYRO is not set -# CONFIG_FB_3DFX is not set -# CONFIG_FB_VOODOO1 is not set -# CONFIG_FB_VT8623 is not set -# CONFIG_FB_TRIDENT is not set -# CONFIG_FB_ARK is not set -# CONFIG_FB_PM3 is not set -# CONFIG_FB_CARMINE is not set -# CONFIG_FB_SMSCUFX is not set -# CONFIG_FB_UDL is not set -# CONFIG_FB_IBM_GXT4500 is not set -# CONFIG_FB_VIRTUAL is not set -# CONFIG_FB_METRONOME is not set -# CONFIG_FB_MB862XX is not set -# CONFIG_FB_SIMPLE is not set -# CONFIG_FB_SM712 is not set -CONFIG_FB_CORE=y -CONFIG_FB_NOTIFY=y -# CONFIG_FIRMWARE_EDID is not set -CONFIG_FB_DEVICE=y -CONFIG_FB_SYS_FILLRECT=y -CONFIG_FB_SYS_COPYAREA=y -CONFIG_FB_SYS_IMAGEBLIT=y -# CONFIG_FB_FOREIGN_ENDIAN is not set -CONFIG_FB_SYSMEM_FOPS=y -CONFIG_FB_DEFERRED_IO=y -CONFIG_FB_SYSMEM_HELPERS=y -CONFIG_FB_SYSMEM_HELPERS_DEFERRED=y -# CONFIG_FB_MODE_HELPERS is not set -# CONFIG_FB_TILEBLITTING is not set -# end of Frame buffer Devices - -# -# Backlight & LCD device support -# -# CONFIG_LCD_CLASS_DEVICE is not set -# CONFIG_BACKLIGHT_CLASS_DEVICE is not set -# end of Backlight & LCD device support - -CONFIG_HDMI=y - -# -# Console display driver support -# -CONFIG_VGA_CONSOLE=y -CONFIG_DUMMY_CONSOLE=y -CONFIG_DUMMY_CONSOLE_COLUMNS=80 -CONFIG_DUMMY_CONSOLE_ROWS=25 -CONFIG_FRAMEBUFFER_CONSOLE=y -# CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION is not set -CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y -# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set -# CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER is not set -# end of Console display driver support - -# CONFIG_LOGO is not set -# end of Graphics support - -# CONFIG_DRM_ACCEL is not set -CONFIG_SOUND=y -CONFIG_SND=y -CONFIG_SND_TIMER=y -CONFIG_SND_PCM=y -CONFIG_SND_JACK=y -CONFIG_SND_JACK_INPUT_DEV=y -# CONFIG_SND_OSSEMUL is not set -CONFIG_SND_PCM_TIMER=y -# CONFIG_SND_DYNAMIC_MINORS is not set -CONFIG_SND_SUPPORT_OLD_API=y -CONFIG_SND_PROC_FS=y -CONFIG_SND_VERBOSE_PROCFS=y -CONFIG_SND_CTL_FAST_LOOKUP=y -# CONFIG_SND_DEBUG is not set -# CONFIG_SND_CTL_INPUT_VALIDATION is not set -# CONFIG_SND_UTIMER is not set -CONFIG_SND_VMASTER=y -CONFIG_SND_DMA_SGBUF=y -# CONFIG_SND_SEQUENCER is not set -CONFIG_SND_DRIVERS=y -# CONFIG_SND_DUMMY is not set -# CONFIG_SND_ALOOP is not set -# CONFIG_SND_MTPAV is not set -# CONFIG_SND_SERIAL_U16550 is not set -# CONFIG_SND_MPU401 is not set -CONFIG_SND_PCI=y -# CONFIG_SND_AD1889 is not set -# CONFIG_SND_ALS300 is not set -# CONFIG_SND_ALS4000 is not set -# CONFIG_SND_ALI5451 is not set -# CONFIG_SND_ASIHPI is not set -# CONFIG_SND_ATIIXP is not set -# CONFIG_SND_ATIIXP_MODEM is not set -# CONFIG_SND_AU8810 is not set -# CONFIG_SND_AU8820 is not set -# CONFIG_SND_AU8830 is not set -# CONFIG_SND_AW2 is not set -# CONFIG_SND_AZT3328 is not set -# CONFIG_SND_BT87X is not set -# CONFIG_SND_CA0106 is not set -# CONFIG_SND_CMIPCI is not set -# CONFIG_SND_OXYGEN is not set -# CONFIG_SND_CS4281 is not set -# CONFIG_SND_CS46XX is not set -# CONFIG_SND_CTXFI is not set -# CONFIG_SND_DARLA20 is not set -# CONFIG_SND_GINA20 is not set -# CONFIG_SND_LAYLA20 is not set -# CONFIG_SND_DARLA24 is not set -# CONFIG_SND_GINA24 is not set -# CONFIG_SND_LAYLA24 is not set -# CONFIG_SND_MONA is not set -# CONFIG_SND_MIA is not set -# CONFIG_SND_ECHO3G is not set -# CONFIG_SND_INDIGO is not set -# CONFIG_SND_INDIGOIO is not set -# CONFIG_SND_INDIGODJ is not set -# CONFIG_SND_INDIGOIOX is not set -# CONFIG_SND_INDIGODJX is not set -# CONFIG_SND_EMU10K1 is not set -# CONFIG_SND_EMU10K1X is not set -# CONFIG_SND_ENS1370 is not set -# CONFIG_SND_ENS1371 is not set -# CONFIG_SND_ES1938 is not set -# CONFIG_SND_ES1968 is not set -# CONFIG_SND_FM801 is not set -# CONFIG_SND_HDSP is not set -# CONFIG_SND_HDSPM is not set -# CONFIG_SND_ICE1712 is not set -# CONFIG_SND_ICE1724 is not set -# CONFIG_SND_INTEL8X0 is not set -# CONFIG_SND_INTEL8X0M is not set -# CONFIG_SND_KORG1212 is not set -# CONFIG_SND_LOLA is not set -# CONFIG_SND_LX6464ES is not set -# CONFIG_SND_MAESTRO3 is not set -# CONFIG_SND_MIXART is not set -# CONFIG_SND_NM256 is not set -# CONFIG_SND_PCXHR is not set -# CONFIG_SND_RIPTIDE is not set -# CONFIG_SND_RME32 is not set -# CONFIG_SND_RME96 is not set -# CONFIG_SND_RME9652 is not set -# CONFIG_SND_SE6X is not set -# CONFIG_SND_SONICVIBES is not set -# CONFIG_SND_TRIDENT is not set -# CONFIG_SND_VIA82XX is not set -# CONFIG_SND_VIA82XX_MODEM is not set -# CONFIG_SND_VIRTUOSO is not set -# CONFIG_SND_VX222 is not set -# CONFIG_SND_YMFPCI is not set - -# -# HD-Audio -# -CONFIG_SND_HDA=y -CONFIG_SND_HDA_INTEL=y -# CONFIG_SND_HDA_HWDEP is not set -# CONFIG_SND_HDA_RECONFIG is not set -# CONFIG_SND_HDA_INPUT_BEEP is not set -# CONFIG_SND_HDA_PATCH_LOADER is not set -# CONFIG_SND_HDA_CODEC_REALTEK is not set -# CONFIG_SND_HDA_CODEC_ANALOG is not set -# CONFIG_SND_HDA_CODEC_SIGMATEL is not set -# CONFIG_SND_HDA_CODEC_VIA is not set -# CONFIG_SND_HDA_CODEC_HDMI is not set -# CONFIG_SND_HDA_CODEC_CIRRUS is not set -# CONFIG_SND_HDA_CODEC_CS8409 is not set -# CONFIG_SND_HDA_CODEC_CONEXANT is not set -# CONFIG_SND_HDA_CODEC_SENARYTECH is not set -# CONFIG_SND_HDA_CODEC_CA0110 is not set -# CONFIG_SND_HDA_CODEC_CA0132 is not set -# CONFIG_SND_HDA_CODEC_CMEDIA is not set -# CONFIG_SND_HDA_CODEC_SI3054 is not set -CONFIG_SND_HDA_GENERIC=y -CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0 -# CONFIG_SND_HDA_INTEL_HDMI_SILENT_STREAM is not set -# CONFIG_SND_HDA_CTL_DEV_ID is not set -# end of HD-Audio - -CONFIG_SND_HDA_CORE=y -CONFIG_SND_HDA_PREALLOC_SIZE=0 -CONFIG_SND_INTEL_NHLT=y -CONFIG_SND_INTEL_DSP_CONFIG=y -CONFIG_SND_INTEL_SOUNDWIRE_ACPI=y -CONFIG_SND_USB=y -# CONFIG_SND_USB_AUDIO is not set -# CONFIG_SND_USB_UA101 is not set -# CONFIG_SND_USB_USX2Y is not set -# CONFIG_SND_USB_CAIAQ is not set -# CONFIG_SND_USB_US122L is not set -# CONFIG_SND_USB_6FIRE is not set -# CONFIG_SND_USB_HIFACE is not set -# CONFIG_SND_BCD2000 is not set -# CONFIG_SND_USB_POD is not set -# CONFIG_SND_USB_PODHD is not set -# CONFIG_SND_USB_TONEPORT is not set -# CONFIG_SND_USB_VARIAX is not set -# CONFIG_SND_SOC is not set -CONFIG_SND_X86=y -# CONFIG_SND_VIRTIO is not set -CONFIG_HID_SUPPORT=y -CONFIG_HID=y -# CONFIG_HID_BATTERY_STRENGTH is not set -# CONFIG_HIDRAW is not set -# CONFIG_UHID is not set -CONFIG_HID_GENERIC=y - -# -# Special HID drivers -# -CONFIG_HID_A4TECH=y -# CONFIG_HID_ACCUTOUCH is not set -# CONFIG_HID_ACRUX is not set -# CONFIG_HID_APPLEIR is not set -# CONFIG_HID_AUREAL is not set -CONFIG_HID_BELKIN=y -# CONFIG_HID_BETOP_FF is not set -CONFIG_HID_CHERRY=y -CONFIG_HID_CHICONY=y -# CONFIG_HID_COUGAR is not set -# CONFIG_HID_MACALLY is not set -# CONFIG_HID_PRODIKEYS is not set -# CONFIG_HID_CMEDIA is not set -# CONFIG_HID_CREATIVE_SB0540 is not set -CONFIG_HID_CYPRESS=y -# CONFIG_HID_DRAGONRISE is not set -# CONFIG_HID_EMS_FF is not set -# CONFIG_HID_ELECOM is not set -# CONFIG_HID_ELO is not set -# CONFIG_HID_EVISION is not set -CONFIG_HID_EZKEY=y -# CONFIG_HID_GEMBIRD is not set -# CONFIG_HID_GFRM is not set -# CONFIG_HID_GLORIOUS is not set -# CONFIG_HID_HOLTEK is not set -# CONFIG_HID_GOOGLE_STADIA_FF is not set -# CONFIG_HID_VIVALDI is not set -# CONFIG_HID_KEYTOUCH is not set -# CONFIG_HID_KYE is not set -# CONFIG_HID_UCLOGIC is not set -# CONFIG_HID_WALTOP is not set -# CONFIG_HID_VIEWSONIC is not set -# CONFIG_HID_VRC2 is not set -# CONFIG_HID_XIAOMI is not set -# CONFIG_HID_GYRATION is not set -# CONFIG_HID_ICADE is not set -CONFIG_HID_ITE=y -# CONFIG_HID_JABRA is not set -# CONFIG_HID_TWINHAN is not set -CONFIG_HID_KENSINGTON=y -# CONFIG_HID_LCPOWER is not set -# CONFIG_HID_LENOVO is not set -# CONFIG_HID_LETSKETCH is not set -# CONFIG_HID_MAGICMOUSE is not set -# CONFIG_HID_MALTRON is not set -# CONFIG_HID_MAYFLASH is not set -# CONFIG_HID_MEGAWORLD_FF is not set -CONFIG_HID_REDRAGON=y -CONFIG_HID_MICROSOFT=y -CONFIG_HID_MONTEREY=y -# CONFIG_HID_MULTITOUCH is not set -# CONFIG_HID_NTI is not set -# CONFIG_HID_NTRIG is not set -# CONFIG_HID_ORTEK is not set -# CONFIG_HID_PANTHERLORD is not set -# CONFIG_HID_PENMOUNT is not set -# CONFIG_HID_PETALYNX is not set -# CONFIG_HID_PICOLCD is not set -# CONFIG_HID_PLANTRONICS is not set -# CONFIG_HID_PXRC is not set -# CONFIG_HID_RAZER is not set -# CONFIG_HID_PRIMAX is not set -# CONFIG_HID_RETRODE is not set -# CONFIG_HID_ROCCAT is not set -# CONFIG_HID_SAITEK is not set -# CONFIG_HID_SAMSUNG is not set -# CONFIG_HID_SEMITEK is not set -# CONFIG_HID_SIGMAMICRO is not set -# CONFIG_HID_SPEEDLINK is not set -# CONFIG_HID_STEAM is not set -# CONFIG_HID_STEELSERIES is not set -# CONFIG_HID_SUNPLUS is not set -# CONFIG_HID_RMI is not set -# CONFIG_HID_GREENASIA is not set -# CONFIG_HID_SMARTJOYPLUS is not set -# CONFIG_HID_TIVO is not set -# CONFIG_HID_TOPSEED is not set -# CONFIG_HID_TOPRE is not set -# CONFIG_HID_THRUSTMASTER is not set -# CONFIG_HID_UDRAW_PS3 is not set -# CONFIG_HID_WACOM is not set -# CONFIG_HID_XINMO is not set -# CONFIG_HID_ZEROPLUS is not set -# CONFIG_HID_ZYDACRON is not set -# CONFIG_HID_SENSOR_HUB is not set -# CONFIG_HID_ALPS is not set -# CONFIG_HID_MCP2221 is not set -# end of Special HID drivers - -# -# HID-BPF support -# -# end of HID-BPF support - -# -# USB HID support -# -CONFIG_USB_HID=y -# CONFIG_HID_PID is not set -# CONFIG_USB_HIDDEV is not set -# end of USB HID support - -CONFIG_I2C_HID=y -# CONFIG_I2C_HID_ACPI is not set -# CONFIG_I2C_HID_OF is not set - -# -# Intel ISH HID support -# -# CONFIG_INTEL_ISH_HID is not set -# end of Intel ISH HID support - -# -# AMD SFH HID Support -# -# CONFIG_AMD_SFH_HID is not set -# end of AMD SFH HID Support - -CONFIG_USB_OHCI_LITTLE_ENDIAN=y -CONFIG_USB_SUPPORT=y -CONFIG_USB_COMMON=y -# CONFIG_USB_ULPI_BUS is not set -CONFIG_USB_ARCH_HAS_HCD=y -CONFIG_USB=y -CONFIG_USB_PCI=y -CONFIG_USB_PCI_AMD=y -# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set - -# -# Miscellaneous USB options -# -CONFIG_USB_DEFAULT_PERSIST=y -# CONFIG_USB_FEW_INIT_RETRIES is not set -# CONFIG_USB_DYNAMIC_MINORS is not set -# CONFIG_USB_OTG is not set -# CONFIG_USB_OTG_PRODUCTLIST is not set -CONFIG_USB_AUTOSUSPEND_DELAY=2 -CONFIG_USB_DEFAULT_AUTHORIZATION_MODE=1 -# CONFIG_USB_MON is not set - -# -# USB Host Controller Drivers -# -# CONFIG_USB_C67X00_HCD is not set -CONFIG_USB_XHCI_HCD=y -# CONFIG_USB_XHCI_DBGCAP is not set -CONFIG_USB_XHCI_PCI=y -# CONFIG_USB_XHCI_PCI_RENESAS is not set -# CONFIG_USB_XHCI_PLATFORM is not set -CONFIG_USB_EHCI_HCD=y -# CONFIG_USB_EHCI_ROOT_HUB_TT is not set -CONFIG_USB_EHCI_TT_NEWSCHED=y -CONFIG_USB_EHCI_PCI=y -# CONFIG_USB_EHCI_FSL is not set -# CONFIG_USB_EHCI_HCD_PLATFORM is not set -# CONFIG_USB_OXU210HP_HCD is not set -# CONFIG_USB_ISP116X_HCD is not set -# CONFIG_USB_OHCI_HCD is not set -CONFIG_USB_UHCI_HCD=y -# CONFIG_USB_SL811_HCD is not set -# CONFIG_USB_R8A66597_HCD is not set -# CONFIG_USB_HCD_TEST_MODE is not set - -# -# USB Device Class drivers -# -# CONFIG_USB_ACM is not set -# CONFIG_USB_PRINTER is not set -# CONFIG_USB_WDM is not set -# CONFIG_USB_TMC is not set - -# -# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may -# - -# -# also be needed; see USB_STORAGE Help for more info -# -CONFIG_USB_STORAGE=y -# CONFIG_USB_STORAGE_DEBUG is not set -# CONFIG_USB_STORAGE_REALTEK is not set -# CONFIG_USB_STORAGE_DATAFAB is not set -# CONFIG_USB_STORAGE_FREECOM is not set -# CONFIG_USB_STORAGE_ISD200 is not set -# CONFIG_USB_STORAGE_USBAT is not set -# CONFIG_USB_STORAGE_SDDR09 is not set -# CONFIG_USB_STORAGE_SDDR55 is not set -# CONFIG_USB_STORAGE_JUMPSHOT is not set -# CONFIG_USB_STORAGE_ALAUDA is not set -# CONFIG_USB_STORAGE_ONETOUCH is not set -# CONFIG_USB_STORAGE_KARMA is not set -# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set -# CONFIG_USB_STORAGE_ENE_UB6250 is not set -# CONFIG_USB_UAS is not set - -# -# USB Imaging devices -# -# CONFIG_USB_MDC800 is not set -# CONFIG_USB_MICROTEK is not set -# CONFIG_USBIP_CORE is not set - -# -# USB dual-mode controller drivers -# -# CONFIG_USB_CDNS_SUPPORT is not set -# CONFIG_USB_MUSB_HDRC is not set -# CONFIG_USB_DWC3 is not set -# CONFIG_USB_DWC2 is not set -# CONFIG_USB_CHIPIDEA is not set -# CONFIG_USB_ISP1760 is not set - -# -# USB port drivers -# -# CONFIG_USB_SERIAL is not set - -# -# USB Miscellaneous drivers -# -# CONFIG_USB_EMI62 is not set -# CONFIG_USB_EMI26 is not set -# CONFIG_USB_ADUTUX is not set -# CONFIG_USB_SEVSEG is not set -# CONFIG_USB_LEGOTOWER is not set -# CONFIG_USB_LCD is not set -# CONFIG_USB_CYPRESS_CY7C63 is not set -# CONFIG_USB_CYTHERM is not set -# CONFIG_USB_IDMOUSE is not set -# CONFIG_USB_APPLEDISPLAY is not set -# CONFIG_APPLE_MFI_FASTCHARGE is not set -# CONFIG_USB_LJCA is not set -# CONFIG_USB_SISUSBVGA is not set -# CONFIG_USB_LD is not set -# CONFIG_USB_TRANCEVIBRATOR is not set -# CONFIG_USB_IOWARRIOR is not set -# CONFIG_USB_TEST is not set -# CONFIG_USB_EHSET_TEST_FIXTURE is not set -# CONFIG_USB_ISIGHTFW is not set -# CONFIG_USB_YUREX is not set -# CONFIG_USB_EZUSB_FX2 is not set -# CONFIG_USB_HUB_USB251XB is not set -# CONFIG_USB_HSIC_USB3503 is not set -# CONFIG_USB_HSIC_USB4604 is not set -# CONFIG_USB_LINK_LAYER_TEST is not set -# CONFIG_USB_CHAOSKEY is not set - -# -# USB Physical Layer drivers -# -# CONFIG_NOP_USB_XCEIV is not set -# CONFIG_USB_ISP1301 is not set -# end of USB Physical Layer drivers - -# CONFIG_USB_GADGET is not set -# CONFIG_TYPEC is not set -# CONFIG_USB_ROLE_SWITCH is not set -# CONFIG_MMC is not set -# CONFIG_SCSI_UFSHCD is not set -# CONFIG_MEMSTICK is not set -# CONFIG_NEW_LEDS is not set -# CONFIG_ACCESSIBILITY is not set -# CONFIG_INFINIBAND is not set -CONFIG_EDAC_ATOMIC_SCRUB=y -CONFIG_EDAC_SUPPORT=y -CONFIG_RTC_LIB=y -CONFIG_RTC_MC146818_LIB=y -# CONFIG_RTC_CLASS is not set -# CONFIG_DMADEVICES is not set - -# -# DMABUF options -# -CONFIG_SYNC_FILE=y -# CONFIG_UDMABUF is not set -# CONFIG_DMABUF_MOVE_NOTIFY is not set -# CONFIG_DMABUF_DEBUG is not set -# CONFIG_DMABUF_SELFTESTS is not set -# CONFIG_DMABUF_HEAPS is not set -# CONFIG_DMABUF_SYSFS_STATS is not set -# end of DMABUF options - -# CONFIG_UIO is not set -# CONFIG_VFIO is not set -# CONFIG_VIRT_DRIVERS is not set -CONFIG_VIRTIO_ANCHOR=y -CONFIG_VIRTIO=y -CONFIG_VIRTIO_PCI_LIB=y -CONFIG_VIRTIO_PCI_LIB_LEGACY=y -CONFIG_VIRTIO_MENU=y -CONFIG_VIRTIO_PCI=y -CONFIG_VIRTIO_PCI_ADMIN_LEGACY=y -CONFIG_VIRTIO_PCI_LEGACY=y -CONFIG_VIRTIO_BALLOON=y -CONFIG_VIRTIO_INPUT=y -CONFIG_VIRTIO_MMIO=y -CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y -CONFIG_VIRTIO_DMA_SHARED_BUFFER=y -# CONFIG_VIRTIO_DEBUG is not set -# CONFIG_VDPA is not set -CONFIG_VHOST_MENU=y -# CONFIG_VHOST_NET is not set -# CONFIG_VHOST_CROSS_ENDIAN_LEGACY is not set - -# -# Microsoft Hyper-V guest support -# -# CONFIG_HYPERV is not set -# end of Microsoft Hyper-V guest support - -# CONFIG_GREYBUS is not set -# CONFIG_COMEDI is not set -# CONFIG_STAGING is not set -# CONFIG_GOLDFISH is not set -# CONFIG_CHROME_PLATFORMS is not set -# CONFIG_MELLANOX_PLATFORM is not set -CONFIG_SURFACE_PLATFORMS=y -# CONFIG_SURFACE_3_POWER_OPREGION is not set -# CONFIG_SURFACE_GPE is not set -# CONFIG_SURFACE_PRO3_BUTTON is not set -CONFIG_X86_PLATFORM_DEVICES=y -# CONFIG_ACPI_WMI is not set -# CONFIG_ACERHDF is not set -# CONFIG_ACER_WIRELESS is not set -# CONFIG_AMD_HSMP is not set -# CONFIG_AMD_WBRF is not set -# CONFIG_ADV_SWBUTTON is not set -# CONFIG_ASUS_WIRELESS is not set -# CONFIG_X86_PLATFORM_DRIVERS_DELL is not set -# CONFIG_FUJITSU_TABLET is not set -# CONFIG_GPD_POCKET_FAN is not set -# CONFIG_X86_PLATFORM_DRIVERS_HP is not set -# CONFIG_WIRELESS_HOTKEY is not set -# CONFIG_IBM_RTL is not set -# CONFIG_SENSORS_HDAPS is not set -# CONFIG_INTEL_IFS is not set -# CONFIG_INTEL_SAR_INT1092 is not set - -# -# Intel Speed Select Technology interface support -# -# CONFIG_INTEL_SPEED_SELECT_INTERFACE is not set -# end of Intel Speed Select Technology interface support - -# -# Intel Uncore Frequency Control -# -# CONFIG_INTEL_UNCORE_FREQ_CONTROL is not set -# end of Intel Uncore Frequency Control - -# CONFIG_INTEL_HID_EVENT is not set -# CONFIG_INTEL_VBTN is not set -# CONFIG_INTEL_PUNIT_IPC is not set -# CONFIG_INTEL_RST is not set -# CONFIG_INTEL_SMARTCONNECT is not set -# CONFIG_INTEL_TURBO_MAX_3 is not set -# CONFIG_INTEL_VSEC is not set -# CONFIG_ACPI_QUICKSTART is not set -# CONFIG_MSI_EC is not set -# CONFIG_SAMSUNG_Q10 is not set -# CONFIG_TOSHIBA_BT_RFKILL is not set -# CONFIG_TOSHIBA_HAPS is not set -# CONFIG_ACPI_CMPC is not set -# CONFIG_SYSTEM76_ACPI is not set -# CONFIG_TOPSTAR_LAPTOP is not set -# CONFIG_SERIAL_MULTI_INSTANTIATE is not set -# CONFIG_MLX_PLATFORM is not set -# CONFIG_INTEL_IPS is not set -# CONFIG_INTEL_SCU_PCI is not set -# CONFIG_INTEL_SCU_PLATFORM is not set -# CONFIG_SIEMENS_SIMATIC_IPC is not set -# CONFIG_WINMATE_FM07_KEYS is not set -# CONFIG_COMMON_CLK is not set -# CONFIG_HWSPINLOCK is not set - -# -# Clock Source drivers -# -CONFIG_CLKEVT_I8253=y -CONFIG_I8253_LOCK=y -CONFIG_CLKBLD_I8253=y -# end of Clock Source drivers - -CONFIG_MAILBOX=y -CONFIG_PCC=y -# CONFIG_ALTERA_MBOX is not set -CONFIG_IOMMU_IOVA=y -CONFIG_IOMMU_API=y -CONFIG_IOMMU_SUPPORT=y - -# -# Generic IOMMU Pagetable Support -# -# end of Generic IOMMU Pagetable Support - -# CONFIG_IOMMU_DEFAULT_DMA_STRICT is not set -CONFIG_IOMMU_DEFAULT_DMA_LAZY=y -# CONFIG_IOMMU_DEFAULT_PASSTHROUGH is not set -CONFIG_IOMMU_DMA=y -# CONFIG_AMD_IOMMU is not set -# CONFIG_IOMMUFD is not set -# CONFIG_VIRTIO_IOMMU is not set - -# -# Remoteproc drivers -# -# CONFIG_REMOTEPROC is not set -# end of Remoteproc drivers - -# -# Rpmsg drivers -# -# CONFIG_RPMSG_QCOM_GLINK_RPM is not set -# CONFIG_RPMSG_VIRTIO is not set -# end of Rpmsg drivers - -# CONFIG_SOUNDWIRE is not set - -# -# SOC (System On Chip) specific Drivers -# - -# -# Amlogic SoC drivers -# -# end of Amlogic SoC drivers - -# -# Broadcom SoC drivers -# -# end of Broadcom SoC drivers - -# -# NXP/Freescale QorIQ SoC drivers -# -# end of NXP/Freescale QorIQ SoC drivers - -# -# fujitsu SoC drivers -# -# end of fujitsu SoC drivers - -# -# i.MX SoC drivers -# -# end of i.MX SoC drivers - -# -# Enable LiteX SoC Builder specific drivers -# -# end of Enable LiteX SoC Builder specific drivers - -# CONFIG_WPCM450_SOC is not set - -# -# Qualcomm SoC drivers -# -# end of Qualcomm SoC drivers - -# CONFIG_SOC_TI is not set - -# -# Xilinx SoC drivers -# -# end of Xilinx SoC drivers -# end of SOC (System On Chip) specific Drivers - -# -# PM Domains -# - -# -# Amlogic PM Domains -# -# end of Amlogic PM Domains - -# -# Broadcom PM Domains -# -# end of Broadcom PM Domains - -# -# i.MX PM Domains -# -# end of i.MX PM Domains - -# -# Qualcomm PM Domains -# -# end of Qualcomm PM Domains -# end of PM Domains - -# CONFIG_PM_DEVFREQ is not set -# CONFIG_EXTCON is not set -# CONFIG_MEMORY is not set -# CONFIG_IIO is not set -# CONFIG_NTB is not set -# CONFIG_PWM is not set - -# -# IRQ chip support -# -# end of IRQ chip support - -# CONFIG_IPACK_BUS is not set -# CONFIG_RESET_CONTROLLER is not set - -# -# PHY Subsystem -# -# CONFIG_GENERIC_PHY is not set -# CONFIG_USB_LGM_PHY is not set -# CONFIG_PHY_CAN_TRANSCEIVER is not set - -# -# PHY drivers for Broadcom platforms -# -# CONFIG_BCM_KONA_USB2_PHY is not set -# end of PHY drivers for Broadcom platforms - -# CONFIG_PHY_PXA_28NM_HSIC is not set -# CONFIG_PHY_PXA_28NM_USB2 is not set -# CONFIG_PHY_INTEL_LGM_EMMC is not set -# end of PHY Subsystem - -# CONFIG_POWERCAP is not set -# CONFIG_MCB is not set - -# -# Performance monitor support -# -# CONFIG_DWC_PCIE_PMU is not set -# end of Performance monitor support - -# CONFIG_RAS is not set -# CONFIG_USB4 is not set - -# -# Android -# -# CONFIG_ANDROID_BINDER_IPC is not set -# end of Android - -# CONFIG_LIBNVDIMM is not set -# CONFIG_DAX is not set -# CONFIG_NVMEM is not set - -# -# HW tracing support -# -# CONFIG_STM is not set -# CONFIG_INTEL_TH is not set -# end of HW tracing support - -# CONFIG_FPGA is not set -# CONFIG_TEE is not set -# CONFIG_SIOX is not set -# CONFIG_SLIMBUS is not set -# CONFIG_INTERCONNECT is not set -# CONFIG_COUNTER is not set -# CONFIG_PECI is not set -# CONFIG_HTE is not set -# end of Device Drivers - -# -# File systems -# -CONFIG_DCACHE_WORD_ACCESS=y -# CONFIG_VALIDATE_FS_PARSER is not set -CONFIG_FS_IOMAP=y -CONFIG_BUFFER_HEAD=y -# CONFIG_EXT2_FS is not set -# CONFIG_EXT3_FS is not set -CONFIG_EXT4_FS=y -CONFIG_EXT4_USE_FOR_EXT2=y -# CONFIG_EXT4_FS_POSIX_ACL is not set -# CONFIG_EXT4_FS_SECURITY is not set -# CONFIG_EXT4_DEBUG is not set -CONFIG_JBD2=y -# CONFIG_JBD2_DEBUG is not set -CONFIG_FS_MBCACHE=y -# CONFIG_REISERFS_FS is not set -# CONFIG_JFS_FS is not set -# CONFIG_XFS_FS is not set -# CONFIG_GFS2_FS is not set -# CONFIG_BTRFS_FS is not set -# CONFIG_NILFS2_FS is not set -# CONFIG_F2FS_FS is not set -# CONFIG_BCACHEFS_FS is not set -CONFIG_FS_POSIX_ACL=y -CONFIG_EXPORTFS=y -# CONFIG_EXPORTFS_BLOCK_OPS is not set -CONFIG_FILE_LOCKING=y -# CONFIG_FS_ENCRYPTION is not set -# CONFIG_FS_VERITY is not set -CONFIG_FSNOTIFY=y -CONFIG_DNOTIFY=y -CONFIG_INOTIFY_USER=y -# CONFIG_FANOTIFY is not set -# CONFIG_QUOTA is not set -# CONFIG_AUTOFS_FS is not set -# CONFIG_FUSE_FS is not set -# CONFIG_OVERLAY_FS is not set - -# -# Caches -# -# end of Caches - -# -# CD-ROM/DVD Filesystems -# -# CONFIG_ISO9660_FS is not set -# CONFIG_UDF_FS is not set -# end of CD-ROM/DVD Filesystems - -# -# DOS/FAT/EXFAT/NT Filesystems -# -# CONFIG_MSDOS_FS is not set -# CONFIG_VFAT_FS is not set -# CONFIG_EXFAT_FS is not set -# CONFIG_NTFS3_FS is not set -# CONFIG_NTFS_FS is not set -# end of DOS/FAT/EXFAT/NT Filesystems - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -# CONFIG_PROC_KCORE is not set -CONFIG_PROC_SYSCTL=y -CONFIG_PROC_PAGE_MONITOR=y -# CONFIG_PROC_CHILDREN is not set -CONFIG_PROC_PID_ARCH_STATUS=y -CONFIG_KERNFS=y -CONFIG_SYSFS=y -CONFIG_TMPFS=y -CONFIG_TMPFS_POSIX_ACL=y -CONFIG_TMPFS_XATTR=y -# CONFIG_TMPFS_INODE64 is not set -# CONFIG_TMPFS_QUOTA is not set -# CONFIG_HUGETLBFS is not set -CONFIG_ARCH_HAS_GIGANTIC_PAGE=y -# CONFIG_CONFIGFS_FS is not set -# end of Pseudo filesystems - -CONFIG_MISC_FILESYSTEMS=y -# CONFIG_ORANGEFS_FS is not set -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -# CONFIG_HFS_FS is not set -# CONFIG_HFSPLUS_FS is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -# CONFIG_CRAMFS is not set -# CONFIG_SQUASHFS is not set -# CONFIG_VXFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_OMFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_QNX6FS_FS is not set -# CONFIG_ROMFS_FS is not set -# CONFIG_PSTORE is not set -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set -# CONFIG_EROFS_FS is not set -CONFIG_NETWORK_FILESYSTEMS=y -# CONFIG_NFS_FS is not set -# CONFIG_NFSD is not set -# CONFIG_CEPH_FS is not set -# CONFIG_CIFS is not set -# CONFIG_SMB_SERVER is not set -# CONFIG_CODA_FS is not set -# CONFIG_AFS_FS is not set -CONFIG_NLS=y -CONFIG_NLS_DEFAULT="iso8859-1" -# CONFIG_NLS_CODEPAGE_437 is not set -# CONFIG_NLS_CODEPAGE_737 is not set -# CONFIG_NLS_CODEPAGE_775 is not set -# CONFIG_NLS_CODEPAGE_850 is not set -# CONFIG_NLS_CODEPAGE_852 is not set -# CONFIG_NLS_CODEPAGE_855 is not set -# CONFIG_NLS_CODEPAGE_857 is not set -# CONFIG_NLS_CODEPAGE_860 is not set -# CONFIG_NLS_CODEPAGE_861 is not set -# CONFIG_NLS_CODEPAGE_862 is not set -# CONFIG_NLS_CODEPAGE_863 is not set -# CONFIG_NLS_CODEPAGE_864 is not set -# CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set -# CONFIG_NLS_CODEPAGE_869 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_874 is not set -# CONFIG_NLS_ISO8859_8 is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -# CONFIG_NLS_ASCII is not set -# CONFIG_NLS_ISO8859_1 is not set -# CONFIG_NLS_ISO8859_2 is not set -# CONFIG_NLS_ISO8859_3 is not set -# CONFIG_NLS_ISO8859_4 is not set -# CONFIG_NLS_ISO8859_5 is not set -# CONFIG_NLS_ISO8859_6 is not set -# CONFIG_NLS_ISO8859_7 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_ISO8859_13 is not set -# CONFIG_NLS_ISO8859_14 is not set -# CONFIG_NLS_ISO8859_15 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U is not set -# CONFIG_NLS_MAC_ROMAN is not set -# CONFIG_NLS_MAC_CELTIC is not set -# CONFIG_NLS_MAC_CENTEURO is not set -# CONFIG_NLS_MAC_CROATIAN is not set -# CONFIG_NLS_MAC_CYRILLIC is not set -# CONFIG_NLS_MAC_GAELIC is not set -# CONFIG_NLS_MAC_GREEK is not set -# CONFIG_NLS_MAC_ICELAND is not set -# CONFIG_NLS_MAC_INUIT is not set -# CONFIG_NLS_MAC_ROMANIAN is not set -# CONFIG_NLS_MAC_TURKISH is not set -# CONFIG_NLS_UTF8 is not set -# CONFIG_UNICODE is not set -CONFIG_IO_WQ=y -# end of File systems - -# -# Security options -# -# CONFIG_KEYS is not set -# CONFIG_SECURITY_DMESG_RESTRICT is not set -CONFIG_PROC_MEM_ALWAYS_FORCE=y -# CONFIG_PROC_MEM_FORCE_PTRACE is not set -# CONFIG_PROC_MEM_NO_FORCE is not set -# CONFIG_SECURITY is not set -# CONFIG_SECURITYFS is not set -# CONFIG_HARDENED_USERCOPY is not set -# CONFIG_FORTIFY_SOURCE is not set -# CONFIG_STATIC_USERMODEHELPER is not set -CONFIG_DEFAULT_SECURITY_DAC=y -CONFIG_LSM="landlock,lockdown,yama,loadpin,safesetid,ipe,bpf" - -# -# Kernel hardening options -# - -# -# Memory initialization -# -CONFIG_CC_HAS_AUTO_VAR_INIT_PATTERN=y -CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_BARE=y -CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO=y -# CONFIG_INIT_STACK_NONE is not set -# CONFIG_INIT_STACK_ALL_PATTERN is not set -CONFIG_INIT_STACK_ALL_ZERO=y -# CONFIG_INIT_ON_ALLOC_DEFAULT_ON is not set -# CONFIG_INIT_ON_FREE_DEFAULT_ON is not set -CONFIG_CC_HAS_ZERO_CALL_USED_REGS=y -# CONFIG_ZERO_CALL_USED_REGS is not set -# end of Memory initialization - -# -# Hardening of kernel data structures -# -# CONFIG_LIST_HARDENED is not set -# CONFIG_BUG_ON_DATA_CORRUPTION is not set -# end of Hardening of kernel data structures - -CONFIG_RANDSTRUCT_NONE=y -# end of Kernel hardening options -# end of Security options - -CONFIG_CRYPTO=y - -# -# Crypto core or helper -# -CONFIG_CRYPTO_ALGAPI=y -CONFIG_CRYPTO_ALGAPI2=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -# CONFIG_CRYPTO_MANAGER is not set -# CONFIG_CRYPTO_USER is not set -CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y -# CONFIG_CRYPTO_NULL is not set -# CONFIG_CRYPTO_PCRYPT is not set -# CONFIG_CRYPTO_CRYPTD is not set -# CONFIG_CRYPTO_AUTHENC is not set -# CONFIG_CRYPTO_TEST is not set -# end of Crypto core or helper - -# -# Public-key cryptography -# -# CONFIG_CRYPTO_RSA is not set -# CONFIG_CRYPTO_DH is not set -# CONFIG_CRYPTO_ECDH is not set -# CONFIG_CRYPTO_ECDSA is not set -# CONFIG_CRYPTO_ECRDSA is not set -# CONFIG_CRYPTO_CURVE25519 is not set -# end of Public-key cryptography - -# -# Block ciphers -# -# CONFIG_CRYPTO_AES is not set -# CONFIG_CRYPTO_AES_TI is not set -# CONFIG_CRYPTO_ARIA is not set -# CONFIG_CRYPTO_BLOWFISH is not set -# CONFIG_CRYPTO_CAMELLIA is not set -# CONFIG_CRYPTO_CAST5 is not set -# CONFIG_CRYPTO_CAST6 is not set -# CONFIG_CRYPTO_DES is not set -# CONFIG_CRYPTO_FCRYPT is not set -# CONFIG_CRYPTO_SERPENT is not set -# CONFIG_CRYPTO_SM4_GENERIC is not set -# CONFIG_CRYPTO_TWOFISH is not set -# end of Block ciphers - -# -# Length-preserving ciphers and modes -# -# CONFIG_CRYPTO_ADIANTUM is not set -# CONFIG_CRYPTO_CHACHA20 is not set -# CONFIG_CRYPTO_CBC is not set -# CONFIG_CRYPTO_CTR is not set -# CONFIG_CRYPTO_CTS is not set -# CONFIG_CRYPTO_ECB is not set -# CONFIG_CRYPTO_HCTR2 is not set -# CONFIG_CRYPTO_KEYWRAP is not set -# CONFIG_CRYPTO_LRW is not set -# CONFIG_CRYPTO_PCBC is not set -# CONFIG_CRYPTO_XTS is not set -# end of Length-preserving ciphers and modes - -# -# AEAD (authenticated encryption with associated data) ciphers -# -# CONFIG_CRYPTO_AEGIS128 is not set -# CONFIG_CRYPTO_CHACHA20POLY1305 is not set -# CONFIG_CRYPTO_CCM is not set -# CONFIG_CRYPTO_GCM is not set -# CONFIG_CRYPTO_SEQIV is not set -# CONFIG_CRYPTO_ECHAINIV is not set -# CONFIG_CRYPTO_ESSIV is not set -# end of AEAD (authenticated encryption with associated data) ciphers - -# -# Hashes, digests, and MACs -# -# CONFIG_CRYPTO_BLAKE2B is not set -# CONFIG_CRYPTO_CMAC is not set -# CONFIG_CRYPTO_GHASH is not set -# CONFIG_CRYPTO_HMAC is not set -# CONFIG_CRYPTO_MD4 is not set -# CONFIG_CRYPTO_MD5 is not set -# CONFIG_CRYPTO_MICHAEL_MIC is not set -# CONFIG_CRYPTO_POLY1305 is not set -# CONFIG_CRYPTO_RMD160 is not set -# CONFIG_CRYPTO_SHA1 is not set -# CONFIG_CRYPTO_SHA256 is not set -# CONFIG_CRYPTO_SHA512 is not set -# CONFIG_CRYPTO_SHA3 is not set -# CONFIG_CRYPTO_SM3_GENERIC is not set -# CONFIG_CRYPTO_STREEBOG is not set -# CONFIG_CRYPTO_VMAC is not set -# CONFIG_CRYPTO_WP512 is not set -# CONFIG_CRYPTO_XCBC is not set -# CONFIG_CRYPTO_XXHASH is not set -# end of Hashes, digests, and MACs - -# -# CRCs (cyclic redundancy checks) -# -CONFIG_CRYPTO_CRC32C=y -# CONFIG_CRYPTO_CRC32 is not set -# CONFIG_CRYPTO_CRCT10DIF is not set -# end of CRCs (cyclic redundancy checks) - -# -# Compression -# -# CONFIG_CRYPTO_DEFLATE is not set -# CONFIG_CRYPTO_LZO is not set -# CONFIG_CRYPTO_842 is not set -# CONFIG_CRYPTO_LZ4 is not set -# CONFIG_CRYPTO_LZ4HC is not set -# CONFIG_CRYPTO_ZSTD is not set -# end of Compression - -# -# Random number generation -# -# CONFIG_CRYPTO_ANSI_CPRNG is not set -# CONFIG_CRYPTO_DRBG_MENU is not set -# CONFIG_CRYPTO_JITTERENTROPY is not set -# end of Random number generation - -# -# Userspace interface -# -# CONFIG_CRYPTO_USER_API_HASH is not set -# CONFIG_CRYPTO_USER_API_SKCIPHER is not set -# CONFIG_CRYPTO_USER_API_RNG is not set -# CONFIG_CRYPTO_USER_API_AEAD is not set -# end of Userspace interface - -# -# Accelerated Cryptographic Algorithms for CPU (x86) -# -# CONFIG_CRYPTO_AES_NI_INTEL is not set -# CONFIG_CRYPTO_BLOWFISH_X86_64 is not set -# CONFIG_CRYPTO_CAMELLIA_X86_64 is not set -# CONFIG_CRYPTO_CAMELLIA_AESNI_AVX_X86_64 is not set -# CONFIG_CRYPTO_CAMELLIA_AESNI_AVX2_X86_64 is not set -# CONFIG_CRYPTO_CAST5_AVX_X86_64 is not set -# CONFIG_CRYPTO_CAST6_AVX_X86_64 is not set -# CONFIG_CRYPTO_DES3_EDE_X86_64 is not set -# CONFIG_CRYPTO_SERPENT_SSE2_X86_64 is not set -# CONFIG_CRYPTO_SERPENT_AVX_X86_64 is not set -# CONFIG_CRYPTO_SERPENT_AVX2_X86_64 is not set -# CONFIG_CRYPTO_SM4_AESNI_AVX_X86_64 is not set -# CONFIG_CRYPTO_SM4_AESNI_AVX2_X86_64 is not set -# CONFIG_CRYPTO_TWOFISH_X86_64 is not set -# CONFIG_CRYPTO_TWOFISH_X86_64_3WAY is not set -# CONFIG_CRYPTO_TWOFISH_AVX_X86_64 is not set -# CONFIG_CRYPTO_ARIA_AESNI_AVX_X86_64 is not set -# CONFIG_CRYPTO_ARIA_AESNI_AVX2_X86_64 is not set -# CONFIG_CRYPTO_ARIA_GFNI_AVX512_X86_64 is not set -# CONFIG_CRYPTO_AEGIS128_AESNI_SSE2 is not set -# CONFIG_CRYPTO_NHPOLY1305_SSE2 is not set -# CONFIG_CRYPTO_NHPOLY1305_AVX2 is not set -# CONFIG_CRYPTO_BLAKE2S_X86 is not set -# CONFIG_CRYPTO_POLYVAL_CLMUL_NI is not set -# CONFIG_CRYPTO_SHA1_SSSE3 is not set -# CONFIG_CRYPTO_SHA256_SSSE3 is not set -# CONFIG_CRYPTO_SHA512_SSSE3 is not set -# CONFIG_CRYPTO_SM3_AVX_X86_64 is not set -# CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL is not set -# CONFIG_CRYPTO_CRC32C_INTEL is not set -# CONFIG_CRYPTO_CRC32_PCLMUL is not set -# end of Accelerated Cryptographic Algorithms for CPU (x86) - -CONFIG_CRYPTO_HW=y -# CONFIG_CRYPTO_DEV_PADLOCK is not set -# CONFIG_CRYPTO_DEV_ATMEL_ECC is not set -# CONFIG_CRYPTO_DEV_ATMEL_SHA204A is not set -# CONFIG_CRYPTO_DEV_CCP is not set -# CONFIG_CRYPTO_DEV_QAT_DH895xCC is not set -# CONFIG_CRYPTO_DEV_QAT_C3XXX is not set -# CONFIG_CRYPTO_DEV_QAT_C62X is not set -# CONFIG_CRYPTO_DEV_QAT_4XXX is not set -# CONFIG_CRYPTO_DEV_QAT_420XX is not set -# CONFIG_CRYPTO_DEV_QAT_DH895xCCVF is not set -# CONFIG_CRYPTO_DEV_QAT_C3XXXVF is not set -# CONFIG_CRYPTO_DEV_QAT_C62XVF is not set -# CONFIG_CRYPTO_DEV_VIRTIO is not set -# CONFIG_CRYPTO_DEV_SAFEXCEL is not set -# CONFIG_CRYPTO_DEV_AMLOGIC_GXL is not set - -# -# Certificates for signature checking -# -# end of Certificates for signature checking - -# -# Library routines -# -# CONFIG_PACKING is not set -CONFIG_BITREVERSE=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GENERIC_NET_UTILS=y -# CONFIG_CORDIC is not set -# CONFIG_PRIME_NUMBERS is not set -CONFIG_RATIONAL=y -CONFIG_GENERIC_IOMAP=y -CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y -CONFIG_ARCH_HAS_FAST_MULTIPLIER=y -CONFIG_ARCH_USE_SYM_ANNOTATIONS=y - -# -# Crypto library routines -# -CONFIG_CRYPTO_LIB_UTILS=y -CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y -# CONFIG_CRYPTO_LIB_CHACHA is not set -# CONFIG_CRYPTO_LIB_CURVE25519 is not set -CONFIG_CRYPTO_LIB_POLY1305_RSIZE=11 -# CONFIG_CRYPTO_LIB_POLY1305 is not set -# CONFIG_CRYPTO_LIB_CHACHA20POLY1305 is not set -CONFIG_CRYPTO_LIB_SHA1=y -CONFIG_CRYPTO_LIB_SHA256=y -# end of Crypto library routines - -# CONFIG_CRC_CCITT is not set -CONFIG_CRC16=y -# CONFIG_CRC_T10DIF is not set -# CONFIG_CRC64_ROCKSOFT is not set -# CONFIG_CRC_ITU_T is not set -CONFIG_CRC32=y -# CONFIG_CRC32_SELFTEST is not set -CONFIG_CRC32_SLICEBY8=y -# CONFIG_CRC32_SLICEBY4 is not set -# CONFIG_CRC32_SARWATE is not set -# CONFIG_CRC32_BIT is not set -# CONFIG_CRC64 is not set -# CONFIG_CRC4 is not set -# CONFIG_CRC7 is not set -# CONFIG_LIBCRC32C is not set -# CONFIG_CRC8 is not set -CONFIG_XXHASH=y -# CONFIG_RANDOM32_SELFTEST is not set -CONFIG_ZLIB_INFLATE=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_LZ4_DECOMPRESS=y -CONFIG_ZSTD_COMMON=y -CONFIG_ZSTD_DECOMPRESS=y -CONFIG_XZ_DEC=y -CONFIG_XZ_DEC_X86=y -CONFIG_XZ_DEC_POWERPC=y -CONFIG_XZ_DEC_ARM=y -CONFIG_XZ_DEC_ARMTHUMB=y -CONFIG_XZ_DEC_ARM64=y -CONFIG_XZ_DEC_SPARC=y -CONFIG_XZ_DEC_RISCV=y -# CONFIG_XZ_DEC_MICROLZMA is not set -CONFIG_XZ_DEC_BCJ=y -# CONFIG_XZ_DEC_TEST is not set -CONFIG_DECOMPRESS_GZIP=y -CONFIG_DECOMPRESS_BZIP2=y -CONFIG_DECOMPRESS_LZMA=y -CONFIG_DECOMPRESS_XZ=y -CONFIG_DECOMPRESS_LZO=y -CONFIG_DECOMPRESS_LZ4=y -CONFIG_DECOMPRESS_ZSTD=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_XARRAY_MULTI=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT=y -CONFIG_HAS_IOPORT_MAP=y -CONFIG_HAS_DMA=y -CONFIG_DMA_OPS_HELPERS=y -CONFIG_NEED_SG_DMA_FLAGS=y -CONFIG_NEED_SG_DMA_LENGTH=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_ARCH_DMA_ADDR_T_64BIT=y -CONFIG_SWIOTLB=y -# CONFIG_SWIOTLB_DYNAMIC is not set -CONFIG_DMA_NEED_SYNC=y -# CONFIG_DMA_API_DEBUG is not set -CONFIG_CPU_RMAP=y -CONFIG_DQL=y -CONFIG_GLOB=y -# CONFIG_GLOB_SELFTEST is not set -CONFIG_NLATTR=y -# CONFIG_IRQ_POLL is not set -CONFIG_DIMLIB=y -CONFIG_HAVE_GENERIC_VDSO=y -CONFIG_GENERIC_GETTIMEOFDAY=y -CONFIG_GENERIC_VDSO_TIME_NS=y -CONFIG_GENERIC_VDSO_OVERFLOW_PROTECT=y -CONFIG_VDSO_GETRANDOM=y -CONFIG_FONT_SUPPORT=y -# CONFIG_FONTS is not set -CONFIG_FONT_8x8=y -CONFIG_FONT_8x16=y -CONFIG_SG_POOL=y -CONFIG_ARCH_HAS_PMEM_API=y -CONFIG_ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION=y -CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE=y -CONFIG_ARCH_HAS_COPY_MC=y -CONFIG_ARCH_STACKWALK=y -CONFIG_STACKDEPOT=y -CONFIG_STACKDEPOT_MAX_FRAMES=64 -CONFIG_SBITMAP=y -# CONFIG_LWQ_TEST is not set -# end of Library routines - -CONFIG_FIRMWARE_TABLE=y - -# -# Kernel hacking -# - -# -# printk and dmesg options -# -# CONFIG_PRINTK_TIME is not set -# CONFIG_PRINTK_CALLER is not set -# CONFIG_STACKTRACE_BUILD_ID is not set -CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7 -CONFIG_CONSOLE_LOGLEVEL_QUIET=4 -CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 -# CONFIG_DYNAMIC_DEBUG is not set -# CONFIG_DYNAMIC_DEBUG_CORE is not set -CONFIG_SYMBOLIC_ERRNAME=y -CONFIG_DEBUG_BUGVERBOSE=y -# end of printk and dmesg options - -# CONFIG_DEBUG_KERNEL is not set - -# -# Compile-time checks and compiler options -# -CONFIG_AS_HAS_NON_CONST_ULEB128=y -CONFIG_FRAME_WARN=2048 -# CONFIG_STRIP_ASM_SYMS is not set -# CONFIG_HEADERS_INSTALL is not set -# CONFIG_DEBUG_SECTION_MISMATCH is not set -CONFIG_SECTION_MISMATCH_WARN_ONLY=y -CONFIG_ARCH_WANT_FRAME_POINTERS=y -CONFIG_FRAME_POINTER=y -CONFIG_OBJTOOL=y -# CONFIG_STACK_VALIDATION is not set -# end of Compile-time checks and compiler options - -# -# Generic Kernel Debugging Instruments -# -# CONFIG_MAGIC_SYSRQ is not set -# CONFIG_DEBUG_FS is not set -CONFIG_HAVE_ARCH_KGDB=y -CONFIG_ARCH_HAS_UBSAN=y -# CONFIG_UBSAN is not set -CONFIG_HAVE_ARCH_KCSAN=y -CONFIG_HAVE_KCSAN_COMPILER=y -# end of Generic Kernel Debugging Instruments - -# -# Networking Debugging -# -# end of Networking Debugging - -# -# Memory Debugging -# -# CONFIG_PAGE_EXTENSION is not set -CONFIG_SLUB_DEBUG=y -# CONFIG_SLUB_DEBUG_ON is not set -# CONFIG_PAGE_TABLE_CHECK is not set -# CONFIG_PAGE_POISONING is not set -# CONFIG_DEBUG_RODATA_TEST is not set -CONFIG_ARCH_HAS_DEBUG_WX=y -# CONFIG_DEBUG_WX is not set -CONFIG_GENERIC_PTDUMP=y -CONFIG_HAVE_DEBUG_KMEMLEAK=y -# CONFIG_PER_VMA_LOCK_STATS is not set -CONFIG_ARCH_HAS_DEBUG_VM_PGTABLE=y -# CONFIG_DEBUG_VM_PGTABLE is not set -CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y -CONFIG_DEBUG_MEMORY_INIT=y -CONFIG_ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP=y -# CONFIG_MEM_ALLOC_PROFILING is not set -CONFIG_HAVE_ARCH_KASAN=y -CONFIG_HAVE_ARCH_KASAN_VMALLOC=y -CONFIG_CC_HAS_KASAN_GENERIC=y -CONFIG_CC_HAS_WORKING_NOSANITIZE_ADDRESS=y -# CONFIG_KASAN is not set -CONFIG_HAVE_ARCH_KFENCE=y -# CONFIG_KFENCE is not set -CONFIG_HAVE_ARCH_KMSAN=y -# end of Memory Debugging - -# -# Debug Oops, Lockups and Hangs -# -# CONFIG_PANIC_ON_OOPS is not set -CONFIG_PANIC_ON_OOPS_VALUE=0 -CONFIG_PANIC_TIMEOUT=0 -CONFIG_HAVE_HARDLOCKUP_DETECTOR_BUDDY=y -CONFIG_HARDLOCKUP_CHECK_TIMESTAMP=y -# CONFIG_TEST_LOCKUP is not set -# end of Debug Oops, Lockups and Hangs - -# -# Scheduler Debugging -# -# CONFIG_SCHEDSTATS is not set -# end of Scheduler Debugging - -# -# Lock Debugging (spinlocks, mutexes, etc...) -# -CONFIG_LOCK_DEBUGGING_SUPPORT=y -# CONFIG_WW_MUTEX_SELFTEST is not set -# end of Lock Debugging (spinlocks, mutexes, etc...) - -# CONFIG_DEBUG_IRQFLAGS is not set -CONFIG_STACKTRACE=y -# CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set - -# -# Debug kernel data structures -# -# end of Debug kernel data structures - -# -# RCU Debugging -# -CONFIG_RCU_CPU_STALL_TIMEOUT=21 -CONFIG_RCU_EXP_CPU_STALL_TIMEOUT=0 -# CONFIG_RCU_CPU_STALL_CPUTIME is not set -# end of RCU Debugging - -CONFIG_USER_STACKTRACE_SUPPORT=y -CONFIG_HAVE_RETHOOK=y -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y -CONFIG_HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS=y -CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS=y -CONFIG_HAVE_DYNAMIC_FTRACE_NO_PATCHABLE=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_FENTRY=y -CONFIG_HAVE_OBJTOOL_MCOUNT=y -CONFIG_HAVE_OBJTOOL_NOP_MCOUNT=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_HAVE_BUILDTIME_MCOUNT_SORT=y -CONFIG_TRACING_SUPPORT=y -# CONFIG_FTRACE is not set -# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set -# CONFIG_SAMPLES is not set -CONFIG_HAVE_SAMPLE_FTRACE_DIRECT=y -CONFIG_HAVE_SAMPLE_FTRACE_DIRECT_MULTI=y -CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y -CONFIG_STRICT_DEVMEM=y -# CONFIG_IO_STRICT_DEVMEM is not set - -# -# x86 Debugging -# -CONFIG_X86_VERBOSE_BOOTUP=y -CONFIG_EARLY_PRINTK=y -# CONFIG_EARLY_PRINTK_DBGP is not set -# CONFIG_EARLY_PRINTK_USB_XDBC is not set -CONFIG_HAVE_MMIOTRACE_SUPPORT=y -CONFIG_IO_DELAY_0X80=y -# CONFIG_IO_DELAY_0XED is not set -# CONFIG_IO_DELAY_UDELAY is not set -# CONFIG_IO_DELAY_NONE is not set -# CONFIG_PUNIT_ATOM_DEBUG is not set -# CONFIG_UNWINDER_ORC is not set -CONFIG_UNWINDER_FRAME_POINTER=y -# end of x86 Debugging - -# -# Kernel Testing and Coverage -# -# CONFIG_KUNIT is not set -CONFIG_ARCH_HAS_KCOV=y -CONFIG_CC_HAS_SANCOV_TRACE_PC=y -# CONFIG_KCOV is not set -CONFIG_RUNTIME_TESTING_MENU=y -# CONFIG_TEST_DHRY is not set -# CONFIG_TEST_MIN_HEAP is not set -# CONFIG_TEST_DIV64 is not set -# CONFIG_TEST_MULDIV64 is not set -# CONFIG_REED_SOLOMON_TEST is not set -# CONFIG_ATOMIC64_SELFTEST is not set -# CONFIG_TEST_HEXDUMP is not set -# CONFIG_TEST_KSTRTOX is not set -# CONFIG_TEST_PRINTF is not set -# CONFIG_TEST_SCANF is not set -# CONFIG_TEST_BITMAP is not set -# CONFIG_TEST_UUID is not set -# CONFIG_TEST_XARRAY is not set -# CONFIG_TEST_MAPLE_TREE is not set -# CONFIG_TEST_RHASHTABLE is not set -# CONFIG_TEST_IDA is not set -# CONFIG_TEST_LKM is not set -# CONFIG_TEST_BITOPS is not set -# CONFIG_TEST_VMALLOC is not set -# CONFIG_TEST_BPF is not set -# CONFIG_TEST_BLACKHOLE_DEV is not set -# CONFIG_FIND_BIT_BENCHMARK is not set -# CONFIG_TEST_FIRMWARE is not set -# CONFIG_TEST_SYSCTL is not set -# CONFIG_TEST_UDELAY is not set -# CONFIG_TEST_STATIC_KEYS is not set -# CONFIG_TEST_KMOD is not set -# CONFIG_TEST_MEMCAT_P is not set -# CONFIG_TEST_MEMINIT is not set -# CONFIG_TEST_FREE_PAGES is not set -# CONFIG_TEST_FPU is not set -# CONFIG_TEST_CLOCKSOURCE_WATCHDOG is not set -CONFIG_ARCH_USE_MEMTEST=y -# CONFIG_MEMTEST is not set -# end of Kernel Testing and Coverage - -# -# Rust hacking -# -# end of Rust hacking -# end of Kernel hacking diff --git a/board/termos/rootfs-overlay/etc/inittab b/board/termos/rootfs-overlay/etc/inittab deleted file mode 100644 index 5dc695d..0000000 --- a/board/termos/rootfs-overlay/etc/inittab +++ /dev/null @@ -1,41 +0,0 @@ -# /etc/inittab -# -# Copyright (C) 2001 Erik Andersen -# -# Note: BusyBox init doesn't support runlevels. The runlevels field is -# completely ignored by BusyBox init. If you want runlevels, use -# sysvinit. -# -# Format for each entry: ::: -# -# id == tty to run on, or empty for /dev/console -# runlevels == ignored -# action == one of sysinit, respawn, askfirst, wait, and once -# process == program to run - -# Startup the system -::sysinit:/bin/mount -t proc proc /proc -::sysinit:/bin/mount -o remount,rw / -::sysinit:/bin/mkdir -p /dev/pts /dev/shm -::sysinit:/bin/mount -a -::sysinit:/bin/mkdir -p /run/lock/subsys -::sysinit:/sbin/swapon -a -null::sysinit:/bin/ln -sf /proc/self/fd /dev/fd -null::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin -null::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout -null::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr -::sysinit:/bin/hostname -F /etc/hostname -# now run any rc scripts -::sysinit:/etc/init.d/rcS - -# Put a getty on the serial port -ttyS0::respawn:/sbin/getty -L ttyS0 0 vt100 # SERIAL_DEBUG -tty1::respawn:/sbin/getty -L tty1 0 vt100 # QEMU graphical window - -# Stuff to do for the 3-finger salute -#::ctrlaltdel:/sbin/reboot - -# Stuff to do before rebooting -::shutdown:/etc/init.d/rcK -::shutdown:/sbin/swapoff -a -::shutdown:/bin/umount -a -r diff --git a/board/termos/rootfs-overlay/etc/profile.d/termos-dashboard.sh b/board/termos/rootfs-overlay/etc/profile.d/termos-dashboard.sh deleted file mode 100644 index a463053..0000000 --- a/board/termos/rootfs-overlay/etc/profile.d/termos-dashboard.sh +++ /dev/null @@ -1,10 +0,0 @@ -# TermOS interactive dashboard autostart -if [ -n "${PS1:-}" ] && - [ -t 0 ] && - [ -t 1 ] && - [ -z "${TERMOS_DASHBOARD_STARTED:-}" ] && - [ -x /usr/bin/python3 ] && - [ -f /opt/termos/dashboard.py ]; then - export TERMOS_DASHBOARD_STARTED=1 - python3 /opt/termos/dashboard.py -fi diff --git a/board/termos/rootfs-overlay/etc/termos-release b/board/termos/rootfs-overlay/etc/termos-release deleted file mode 100644 index 4da569f..0000000 --- a/board/termos/rootfs-overlay/etc/termos-release +++ /dev/null @@ -1,4 +0,0 @@ -NAME=TermOS -ID=termos -VERSION_ID=0.2.0 -PRETTY_NAME="TermOS 0.2.0" diff --git a/board/termos/rootfs-overlay/etc/termos/repository-ed25519.pub b/board/termos/rootfs-overlay/etc/termos/repository-ed25519.pub deleted file mode 100644 index 35fed36..0000000 --- a/board/termos/rootfs-overlay/etc/termos/repository-ed25519.pub +++ /dev/null @@ -1,3 +0,0 @@ ------BEGIN PUBLIC KEY----- -MCowBQYDK2VwAyEAKk9pqTp633HGFJZTbJ+wP0b1rrv4yfm1GCe8KFdTwCo= ------END PUBLIC KEY----- diff --git a/board/termos/rootfs-overlay/opt/termos/dashboard.py b/board/termos/rootfs-overlay/opt/termos/dashboard.py deleted file mode 100644 index 615669b..0000000 --- a/board/termos/rootfs-overlay/opt/termos/dashboard.py +++ /dev/null @@ -1,211 +0,0 @@ -#!/usr/bin/env python3 - -import os -import platform -import shutil -import socket -import subprocess -from pathlib import Path - -VERSION = "0.2" - -# ANSI terminal colors -RESET = "\033[0m" -BOLD = "\033[1m" -CYAN = "\033[96m" -GREEN = "\033[92m" -YELLOW = "\033[93m" -RED = "\033[91m" -DIM = "\033[90m" -WHITE = "\033[97m" - - -def clear(): - print("\033[2J\033[H", end="") - - -def color(text, shade): - return f"{shade}{text}{RESET}" - - -def read_meminfo(): - data = {} - try: - for line in Path("/proc/meminfo").read_text().splitlines(): - key, value = line.split(":", 1) - data[key] = int(value.strip().split()[0]) * 1024 - except (OSError, ValueError, IndexError): - pass - return data - - -def format_bytes(value): - units = ("B", "KB", "MB", "GB", "TB") - value = float(value) - for unit in units: - if value < 1024 or unit == units[-1]: - return f"{value:.1f} {unit}" - value /= 1024 - - -def format_uptime(): - try: - seconds = int(float(Path("/proc/uptime").read_text().split()[0])) - days, seconds = divmod(seconds, 86400) - hours, seconds = divmod(seconds, 3600) - minutes = seconds // 60 - - if days: - return f"{days}d {hours}h {minutes}m" - return f"{hours}h {minutes}m" - except (OSError, ValueError, IndexError): - return "Unavailable" - - -def bar(percent, width=20): - percent = max(0, min(100, percent)) - filled = round(width * percent / 100) - shade = GREEN if percent < 70 else YELLOW if percent < 90 else RED - return color("#" * filled, shade) + color("-" * (width - filled), DIM) - - -def get_network_interfaces(): - interfaces = [] - try: - for entry in Path("/sys/class/net").iterdir(): - name = entry.name - try: - state = (entry / "operstate").read_text().strip() - except OSError: - state = "unknown" - interfaces.append((name, state)) - except OSError: - pass - return interfaces - - -def header(): - print(color(r""" - _____ ___ ____ -|_ _|__ _ __ _ __ ___/ _ \/ ___| - | |/ _ \ '__| '_ ` _ \ | | \___ \ - | | __/ | | | | | | | |_| |___) | - |_|\___|_| |_| |_| |_|\___/|____/ -""", CYAN + BOLD)) - print(color(" TERMOS DASHBOARD", WHITE + BOLD) - + color(f" v{VERSION}", DIM)) - print(color(" Your system. Your terminal.", DIM)) - print(color("=" * 58, CYAN)) - - -def system_panel(): - print(color("\n SYSTEM", CYAN + BOLD)) - print(f" Host : {socket.gethostname()}") - print(f" Kernel : {platform.release()}") - print(f" Architecture: {platform.machine()}") - print(f" Python : {platform.python_version()}") - print(f" Uptime : {format_uptime()}") - - print(color("\n MEMORY", CYAN + BOLD)) - mem = read_meminfo() - total = mem.get("MemTotal", 0) - available = mem.get("MemAvailable", mem.get("MemFree", 0)) - - if total: - used = total - available - percent = used * 100 / total - print(f" RAM {format_bytes(used)} / {format_bytes(total)}") - print(f" [{bar(percent)}] {percent:.1f}% used") - else: - print(" Memory information unavailable.") - - print(color("\n ROOT FILESYSTEM", CYAN + BOLD)) - try: - usage = shutil.disk_usage("/") - used = usage.total - usage.free - percent = used * 100 / usage.total if usage.total else 0 - print(f" Used {format_bytes(used)} / {format_bytes(usage.total)}") - print(f" [{bar(percent)}] {percent:.1f}% used") - except OSError as exc: - print(f" Unavailable: {exc}") - - -def network_panel(): - print(color("\n NETWORK INTERFACES", CYAN + BOLD)) - interfaces = get_network_interfaces() - - if not interfaces: - print(" No interfaces found.") - return - - for name, state in interfaces: - shade = GREEN if state == "up" else YELLOW - print(f" {name:<12} {color(state, shade)}") - - if shutil.which("ip"): - result = subprocess.run( - ["ip", "route"], - capture_output=True, - text=True, - check=False, - ) - if result.stdout.strip(): - print(color("\n ROUTES", CYAN + BOLD)) - for line in result.stdout.strip().splitlines()[:5]: - print(" " + line) - - -def pause(): - input(color("\n Press Enter to return...", DIM)) - - -def main(): - while True: - clear() - header() - system_panel() - network_panel() - - print(color("\n MENU", CYAN + BOLD)) - print(" [1] Refresh dashboard") - print(" [2] Detailed system information") - print(" [3] Open shell") - print(" [0] Exit dashboard") - - try: - choice = input(color("\n termos> ", GREEN + BOLD)).strip() - except EOFError: - print(color("\n\nDashboard input closed.", YELLOW)) - break - - if choice == "1": - continue - elif choice == "2": - clear() - header() - print(color("\n PLATFORM DETAILS", CYAN + BOLD)) - print(f" System : {platform.system()}") - print(f" Release : {platform.release()}") - print(f" Version : {platform.version()}") - print(f" Machine : {platform.machine()}") - print(f" Hostname : {socket.gethostname()}") - print(f" Python : {platform.python_version()}") - print(f" Current user : {os.getenv('USER', 'unknown')}") - pause() - elif choice == "3": - subprocess.call(["/bin/sh"]) - elif choice == "0": - clear() - print(color("TermOS Dashboard closed.", CYAN)) - break - else: - input(color("\n Invalid option. Press Enter...", YELLOW)) - - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - print(color("\n\nDashboard interrupted.", YELLOW)) - except EOFError: - print(color("\n\nDashboard input closed.", YELLOW)) diff --git a/board/termos/rootfs-overlay/opt/termos/python/tpm/__init__.py b/board/termos/rootfs-overlay/opt/termos/python/tpm/__init__.py deleted file mode 100644 index 8b13789..0000000 --- a/board/termos/rootfs-overlay/opt/termos/python/tpm/__init__.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/board/termos/rootfs-overlay/opt/termos/python/tpm/__main__.py b/board/termos/rootfs-overlay/opt/termos/python/tpm/__main__.py deleted file mode 100644 index eb53e2f..0000000 --- a/board/termos/rootfs-overlay/opt/termos/python/tpm/__main__.py +++ /dev/null @@ -1,3 +0,0 @@ -from .cli import main - -raise SystemExit(main()) diff --git a/board/termos/rootfs-overlay/opt/termos/python/tpm/cli.py b/board/termos/rootfs-overlay/opt/termos/python/tpm/cli.py deleted file mode 100644 index 57caf36..0000000 --- a/board/termos/rootfs-overlay/opt/termos/python/tpm/cli.py +++ /dev/null @@ -1,257 +0,0 @@ -import argparse -import json -import sys -from pathlib import Path - -from .database import DatabaseError, initialize_root -from .dependencies import DependencyError -from .manager import install_with_dependencies -from .installer import InstallError, install_package, list_installed, verify_installed -from .package import PackageError, build_package, package_info -from .uninstaller import UninstallError, remove_package -from .upgrade import UpgradeError, upgrade_package -from .repository import RepositoryError, build_index, generate_keypair, sign_index, verify_repository, search_packages - - -def main(): - parser = argparse.ArgumentParser( - prog="tpm", - description="TermOS Package Manager", - ) - commands = parser.add_subparsers(dest="command", required=True) - - build = commands.add_parser("build", help="Build a TPK package") - build.add_argument("source", type=Path) - build.add_argument("--name", required=True) - build.add_argument("--version", required=True) - build.add_argument("--arch", default="x86_64") - build.add_argument("--description", default="") - build.add_argument( - "--depends", action="append", default=[], metavar="SPEC", - help="Package dependency, e.g. libfoo>=1.2.0 (repeatable)", - ) - build.add_argument("-o", "--output", type=Path, required=True) - - info = commands.add_parser("info", help="Inspect and verify a TPK package") - info.add_argument("package", type=Path) - - init_root = commands.add_parser("init-root", help="Initialize a dedicated TPM sandbox") - init_root.add_argument("--root", type=Path, required=True) - - install = commands.add_parser("install", help="Install a package into a TPM sandbox") - install.add_argument("package", type=Path) - install.add_argument("--root", type=Path, required=True) - install.add_argument( - "--repo", type=Path, action="append", default=[], - help="Local directory containing dependency .tpk files (repeatable)", - ) - - listing = commands.add_parser("list", help="List installed packages") - listing.add_argument("--root", type=Path, required=True) - - verify = commands.add_parser("verify", help="Verify installed package files") - verify.add_argument("--root", type=Path, required=True) - verify.add_argument("name", nargs="?", help="Optional package name") - - remove = commands.add_parser("remove", help="Remove an installed package") - remove.add_argument("name", help="Installed package name") - remove.add_argument("--root", type=Path, required=True) - remove.add_argument( - "--keep-modified", - action="store_true", - help="Keep modified files instead of deleting them", - ) - - upgrade = commands.add_parser("upgrade", help="Upgrade an installed package") - upgrade.add_argument("package", type=Path, help="New .tpk package file") - upgrade.add_argument("--root", type=Path, required=True) - - install.add_argument("--repo-key", type=Path, action="append", default=[], help="Trusted public key for each signed --repo directory (one key may be reused)") - # TPM_STAGE7_8_REPOSITORY_PARSERS - repo_parser = commands.add_parser("repo", help="Build and secure a local package repository") - repo_actions = repo_parser.add_subparsers(dest="repo_action", required=True) - - repo_index = repo_actions.add_parser("index", help="Create or refresh repository.json") - repo_index.add_argument("directory", type=Path, help="Directory containing .tpk archives") - repo_index.add_argument("--name", default="TermOS", help="Repository display name") - repo_index.add_argument("--output", type=Path, help="Index output path") - - repo_keygen = repo_actions.add_parser("keygen", help="Generate an Ed25519 repository key pair") - repo_keygen.add_argument("--private-key", type=Path, required=True) - repo_keygen.add_argument("--public-key", type=Path, required=True) - repo_keygen.add_argument("--force", action="store_true", help="Replace existing key files") - - repo_sign = repo_actions.add_parser("sign", help="Sign a repository index with Ed25519") - repo_sign.add_argument("index", type=Path) - repo_sign.add_argument("--private-key", type=Path, required=True) - repo_sign.add_argument("--signature", type=Path) - - repo_verify = repo_actions.add_parser("verify", help="Verify index signature and package hashes") - repo_verify.add_argument("index", type=Path) - repo_verify.add_argument("--public-key", type=Path) - repo_verify.add_argument("--signature", type=Path) - repo_verify.add_argument("--allow-unsigned", action="store_true") - - search_parser = commands.add_parser("search", help="Search packages in a verified local repository") - search_parser.add_argument("query") - search_parser.add_argument("--repo", type=Path, required=True) - search_parser.add_argument("--index", default="repository.json") - search_parser.add_argument("--public-key", type=Path) - search_parser.add_argument("--signature", type=Path) - search_parser.add_argument("--allow-unsigned", action="store_true") - - args = parser.parse_args() - - try: - if args.command == "build": - manifest = build_package( - source=args.source, - output=args.output, - name=args.name, - version=args.version, - architecture=args.arch, - description=args.description, - depends=args.depends, - ) - print(f"Package created: {args.output}") - print(f"Files: {len(manifest['files'])}") - - elif args.command == "info": - manifest = package_info(args.package) - print(json.dumps(manifest, indent=2, ensure_ascii=False)) - print("\nPackage integrity: OK") - - elif args.command == "init-root": - root = initialize_root(args.root) - print(f"TPM sandbox initialized: {root}") - - elif args.command == "install": - # TPM_STAGE7_8_VERIFY_DEPENDENCY_REPOS - repo_paths = getattr(args, "repo", None) or [] - repo_keys = getattr(args, "repo_key", None) or [] - if repo_keys: - if not repo_paths: - raise RepositoryError("--repo-key requires at least one --repo directory") - if len(repo_keys) == 1: - repo_keys = repo_keys * len(repo_paths) - elif len(repo_keys) != len(repo_paths): - raise RepositoryError("Provide one --repo-key per --repo, or one key to reuse") - for repo_path, trusted_key in zip(repo_paths, repo_keys): - report = verify_repository(repo_path, public_key=trusted_key) - print(f"Verified dependency repository: {report['repository']} ({report['packages']} packages)") - else: - for repo_path in repo_paths: - if (Path(repo_path) / ("repository.json" + ".sig")).exists(): - raise RepositoryError("Signed dependency repository requires --repo-key") - print(f"warning: unsigned dependency repository: {repo_path}", file=sys.stderr) - - result = install_with_dependencies(args.package, args.root, args.repo) - manifest = result["manifest"] - print(f"Installed: {manifest['name']} {manifest['version']}") - print(f"Files installed: {len(manifest['files'])}") - if result["dependencies_installed"]: - print(f"Dependencies installed: {result['dependencies_installed']}") - - elif args.command == "list": - packages = list_installed(args.root) - if not packages: - print("No packages installed.") - else: - for name, data in sorted(packages.items()): - print( - f"{name} {data['version']} " - f"[{data['architecture']}] - {len(data['files'])} files" - ) - - elif args.command == "verify": - count, problems = verify_installed(args.root, args.name) - if problems: - for problem in problems: - print(f"[FAIL] {problem}", file=sys.stderr) - print(f"Verification failed: {len(problems)} problem(s)") - return 1 - print(f"Verified {count} package(s): OK") - - elif args.command == "remove": - result = remove_package(args.name, args.root, args.keep_modified) - print(f"Removed package registration: {result['name']}") - print(f"Files removed: {result['removed']}") - if result["missing"]: - print(f"Already missing: {len(result['missing'])} file(s)") - if result["modified_kept"]: - print( - f"Modified files kept: {len(result['modified_kept'])} " - "(now unmanaged by TPM)" - ) - for path in result["modified_kept"]: - print(f" kept: {path}") - if result["cleanup_warning"]: - print(f"warning: {result['cleanup_warning']}", file=sys.stderr) - - - elif args.command == "upgrade": - result = upgrade_package(args.package, args.root) - print( - f"Upgraded: {result['name']} " - f"{result['old_version']} -> {result['new_version']}" - ) - print( - f"Files: {result['added']} added, " - f"{result['updated']} updated, {result['removed']} removed" - ) - - - # TPM_STAGE7_8_REPOSITORY_HANDLERS - elif args.command == "repo": - if args.repo_action == "index": - destination, index_data = build_index(args.directory, args.output, args.name) - print(f"Repository index created: {destination}") - print(f"Packages indexed: {len(index_data['packages'])}") - elif args.repo_action == "keygen": - private_path, public_path = generate_keypair(args.private_key, args.public_key, args.force) - print(f"Private key: {private_path} (keep this secret)") - print(f"Public key: {public_path} (trusted verification key)") - elif args.repo_action == "sign": - signature = sign_index(args.index, args.private_key, args.signature) - print(f"Repository index signed: {signature}") - elif args.repo_action == "verify": - index_file = args.index.expanduser().resolve(strict=True) - result = verify_repository( - index_file.parent, index_name=index_file, public_key=args.public_key, - signature_path=args.signature, allow_unsigned=args.allow_unsigned, - ) - print(f"Repository: {result['repository']}") - print(f"Packages: {result['packages']}") - print(f"Package archives verified: {result['archives_verified']}") - print(f"Signature: {result['signature']}") - elif args.command == "search": - matches, verification = search_packages( - args.repo, args.query, index_name=args.index, public_key=args.public_key, - signature_path=args.signature, allow_unsigned=args.allow_unsigned, - ) - print(f"Repository: {verification['repository']} ({verification['signature']})") - if not matches: - print("No matching packages.") - else: - for item in matches: - print(f"{item['name']} {item['version']} [{item['architecture']}] - {item.get('description', '')}") - print(f" archive: {item['filename']} sha256: {item['sha256']}") - - except ( - PackageError, - DatabaseError, - InstallError, - UninstallError, - UpgradeError, - DependencyError, - OSError, - ValueError, - ) as exc: - print(f"tpm: error: {exc}", file=sys.stderr) - return 1 - - return 0 - - -if __name__ == "__main__": - raise SystemExit(main()) diff --git a/board/termos/rootfs-overlay/opt/termos/python/tpm/database.py b/board/termos/rootfs-overlay/opt/termos/python/tpm/database.py deleted file mode 100644 index 93fd5ce..0000000 --- a/board/termos/rootfs-overlay/opt/termos/python/tpm/database.py +++ /dev/null @@ -1,188 +0,0 @@ -import json -import os -import stat -import tempfile -from pathlib import Path - -MARKER_NAME = ".tpm-root" -MARKER_CONTENT = "TermOS TPM sandbox root v1\n" -DB_PARTS = ("var", "lib", "tpm", "installed.json") -DB_MAX_SIZE = 16 * 1024 * 1024 - - -class DatabaseError(Exception): - pass - - -def _check_root_argument(path): - raw = Path(path).expanduser() - if raw.is_symlink(): - raise DatabaseError("Root path itself cannot be a symlink") - raw.mkdir(parents=True, exist_ok=True) - root = raw.resolve(strict=True) - if root == Path("/"): - raise DatabaseError("Refusing to use / as a TPM sandbox root") - if not root.is_dir(): - raise DatabaseError("Root must be a directory") - return root - - -def initialize_root(path): - root = _check_root_argument(path) - marker = root / MARKER_NAME - - try: - info = marker.lstat() - except FileNotFoundError: - info = None - - if info is not None: - if not stat.S_ISREG(info.st_mode) or marker.is_symlink(): - raise DatabaseError("Invalid TPM root marker") - if marker.read_text(encoding="utf-8") != MARKER_CONTENT: - raise DatabaseError("TPM root marker has unexpected content") - return root - - if any(root.iterdir()): - raise DatabaseError("Refusing to initialize a non-empty directory") - - flags = os.O_WRONLY | os.O_CREAT | os.O_EXCL - if hasattr(os, "O_NOFOLLOW"): - flags |= os.O_NOFOLLOW - fd = os.open(marker, flags, 0o600) - with os.fdopen(fd, "w", encoding="utf-8") as stream: - stream.write(MARKER_CONTENT) - stream.flush() - os.fsync(stream.fileno()) - return root - - -def validate_root(path): - raw = Path(path).expanduser() - if raw.is_symlink(): - raise DatabaseError("Root path itself cannot be a symlink") - root = raw.resolve(strict=True) - if root == Path("/"): - # The live system root is intentionally unavailable to ordinary TPM - # operations. The installed /usr/bin/tpm launcher sets this opt-in only - # after checking root privileges, the TermOS release marker, and a - # typed confirmation for mutating commands. - if os.environ.get("TPM_ALLOW_SYSTEM_ROOT") != "1": - raise DatabaseError( - "Refusing the live system root. Use the installed 'tpm --system' " - "launcher on TermOS." - ) - if not hasattr(os, "geteuid") or os.geteuid() != 0: - raise DatabaseError("System-root operations require effective UID 0") - release_marker = root / "etc" / "termos-release" - try: - marker_info = release_marker.lstat() - marker_text = release_marker.read_text(encoding="utf-8") - except OSError as exc: - raise DatabaseError(f"Cannot validate TermOS system marker: {exc}") from exc - if not stat.S_ISREG(marker_info.st_mode) or stat.S_ISLNK(marker_info.st_mode): - raise DatabaseError("TermOS system marker is not a regular file") - if "ID=termos" not in marker_text.splitlines(): - raise DatabaseError("This root filesystem is not identified as TermOS") - return root - if not root.is_dir(): - raise DatabaseError("Invalid TPM sandbox root") - - marker = root / MARKER_NAME - try: - info = marker.lstat() - except FileNotFoundError as exc: - raise DatabaseError("Not a TPM sandbox. Run 'tpm init-root' first") from exc - if not stat.S_ISREG(info.st_mode) or marker.is_symlink(): - raise DatabaseError("Invalid TPM root marker") - if marker.read_text(encoding="utf-8") != MARKER_CONTENT: - raise DatabaseError("TPM root marker has unexpected content") - return root - - -def _safe_directory(root, parts, create=False): - current = root - for part in parts: - candidate = current / part - try: - info = candidate.lstat() - except FileNotFoundError: - if not create: - return None - try: - candidate.mkdir(mode=0o755) - except FileExistsError: - pass - try: - info = candidate.lstat() - except FileNotFoundError as exc: - raise DatabaseError(f"Directory disappeared: {candidate}") from exc - if stat.S_ISLNK(info.st_mode) or not stat.S_ISDIR(info.st_mode): - raise DatabaseError(f"Unsafe directory component: {candidate}") - current = candidate - return current - - -def empty_database(): - return {"format_version": 1, "packages": {}} - - -def load_database(root): - parent = _safe_directory(root, DB_PARTS[:-1], create=False) - if parent is None: - return empty_database() - - database_path = parent / DB_PARTS[-1] - try: - info = database_path.lstat() - except FileNotFoundError: - return empty_database() - - if stat.S_ISLNK(info.st_mode) or not stat.S_ISREG(info.st_mode): - raise DatabaseError("TPM database is not a regular file") - if info.st_size > DB_MAX_SIZE: - raise DatabaseError("TPM database is too large") - - try: - data = json.loads(database_path.read_text(encoding="utf-8")) - except (OSError, UnicodeError, json.JSONDecodeError) as exc: - raise DatabaseError(f"Cannot read TPM database: {exc}") from exc - - if ( - not isinstance(data, dict) - or data.get("format_version") != 1 - or not isinstance(data.get("packages"), dict) - ): - raise DatabaseError("Invalid TPM database structure") - return data - - -def save_database(root, data): - parent = _safe_directory(root, DB_PARTS[:-1], create=True) - database_path = parent / DB_PARTS[-1] - - try: - info = database_path.lstat() - except FileNotFoundError: - info = None - if info is not None and (stat.S_ISLNK(info.st_mode) or not stat.S_ISREG(info.st_mode)): - raise DatabaseError("Refusing to replace an unsafe TPM database file") - - payload = (json.dumps(data, indent=2, sort_keys=True) + "\n").encode("utf-8") - if len(payload) > DB_MAX_SIZE: - raise DatabaseError("TPM database would exceed size limit") - - fd, temporary_name = tempfile.mkstemp(prefix=".installed-", suffix=".tmp", dir=parent) - try: - with os.fdopen(fd, "wb") as stream: - os.fchmod(stream.fileno(), 0o600) - stream.write(payload) - stream.flush() - os.fsync(stream.fileno()) - os.replace(temporary_name, database_path) - except Exception: - try: - os.unlink(temporary_name) - except FileNotFoundError: - pass - raise diff --git a/board/termos/rootfs-overlay/opt/termos/python/tpm/dependencies.py b/board/termos/rootfs-overlay/opt/termos/python/tpm/dependencies.py deleted file mode 100644 index fca0f9d..0000000 --- a/board/termos/rootfs-overlay/opt/termos/python/tpm/dependencies.py +++ /dev/null @@ -1,266 +0,0 @@ -"""Dependency metadata, constraints, and local package resolution for TPM.""" - -import platform -import re -from pathlib import Path - -PACKAGE_NAME_RE = re.compile(r"^[a-z0-9][a-z0-9+_.-]{0,127}$") -DEPENDENCY_RE = re.compile( - r"^(?P[a-z0-9][a-z0-9+_.-]{0,127})" - r"(?:(?P>=|<=|==|>|<|=)(?P[0-9]+(?:\.[0-9]+){0,7}))?$" -) -MAX_DEPENDENCIES = 256 -MAX_REPOSITORY_PACKAGES = 2000 - - -class DependencyError(Exception): - """Raised when package dependencies cannot be satisfied safely.""" - - -def version_key(value): - """Convert a numeric dotted version into a comparable tuple.""" - if not isinstance(value, str) or len(value) > 128: - raise DependencyError(f"Invalid version: {value!r}") - if not re.fullmatch(r"[0-9]+(?:\.[0-9]+){0,7}", value): - raise DependencyError( - f"Unsupported version {value!r}; use numeric dotted versions such as 1.2.3" - ) - parts = [int(part) for part in value.split(".")] - if any(part > 2_147_483_647 for part in parts): - raise DependencyError("Version component is too large") - while len(parts) > 1 and parts[-1] == 0: - parts.pop() - return tuple(parts) - - -def parse_dependency(spec): - """Parse 'name', 'name>=1.2.0', 'name==1.2.0', etc.""" - if not isinstance(spec, str): - raise DependencyError("Dependency specifications must be strings") - match = DEPENDENCY_RE.fullmatch(spec) - if not match: - raise DependencyError( - f"Invalid dependency {spec!r}; examples: libfoo or libfoo>=1.2.0" - ) - name = match.group("name") - operator = match.group("operator") - version = match.group("version") - if operator == "=": - operator = "==" - if version is not None: - version_key(version) - return {"name": name, "operator": operator, "version": version} - - -def validate_dependencies(items, package_name=None): - """Validate and canonicalize dependency strings; missing means no dependencies.""" - if items is None: - return [] - if not isinstance(items, (list, tuple)): - raise DependencyError("Manifest 'depends' must be a list of dependency strings") - if len(items) > MAX_DEPENDENCIES: - raise DependencyError(f"A package may declare at most {MAX_DEPENDENCIES} dependencies") - - result = [] - seen = set() - for item in items: - parsed = parse_dependency(item) - if package_name and parsed["name"] == package_name: - raise DependencyError(f"Package cannot depend on itself: {package_name}") - canonical = ( - parsed["name"] - + (parsed["operator"] + parsed["version"] if parsed["operator"] else "") - ) - if canonical in seen: - raise DependencyError(f"Duplicate dependency: {canonical}") - seen.add(canonical) - result.append(canonical) - return result - - -def dependency_satisfied(spec, installed_version): - parsed = parse_dependency(spec) - if parsed["operator"] is None: - return True - try: - actual = version_key(installed_version) - required = version_key(parsed["version"]) - except DependencyError: - return False - - operator = parsed["operator"] - if operator == ">=": - return actual >= required - if operator == "<=": - return actual <= required - if operator == ">": - return actual > required - if operator == "<": - return actual < required - if operator == "==": - return actual == required - raise DependencyError(f"Unsupported dependency operator: {operator}") - - -def check_installed_dependencies(depends, installed_packages, package_name=None): - for spec in validate_dependencies(depends, package_name=package_name): - parsed = parse_dependency(spec) - record = installed_packages.get(parsed["name"]) - if record is None: - raise DependencyError( - f"Missing dependency: {spec}. Install it first or provide a local --repo." - ) - installed_version = record.get("version") - if not dependency_satisfied(spec, installed_version): - raise DependencyError( - f"Dependency version mismatch: {spec}; " - f"installed {parsed['name']} is {installed_version!r}" - ) - - -def find_dependents(package_name, installed_packages, exclude=None): - """Return installed package/spec pairs that declare a dependency on package_name.""" - blockers = [] - for other_name, record in installed_packages.items(): - if other_name == exclude or other_name == package_name: - continue - depends = validate_dependencies(record.get("depends", []), package_name=other_name) - for spec in depends: - if parse_dependency(spec)["name"] == package_name: - blockers.append((other_name, spec)) - return blockers - - -def check_reverse_dependencies(package_name, new_version, installed_packages): - """Prevent upgrading a package to a version that breaks installed dependents.""" - blockers = [ - (other_name, spec) - for other_name, spec in find_dependents( - package_name, installed_packages, exclude=package_name - ) - if not dependency_satisfied(spec, new_version) - ] - if blockers: - details = ", ".join(f"{name} requires {spec}" for name, spec in blockers) - raise DependencyError( - f"Upgrade to {new_version} would break installed dependents: {details}" - ) - - -def resolve_install_plan(package_path, repository_dirs, installed_packages): - """Resolve a package and its missing dependencies from local .tpk repositories. - - Returns a topologically ordered list of (archive_path, manifest) pairs. - Existing installed dependencies must already satisfy their constraints; this - first resolver does not silently replace or upgrade installed dependencies. - """ - from .package import validate_package - - root_archive = Path(package_path).expanduser() - if not root_archive.is_file() or root_archive.is_symlink(): - raise DependencyError(f"Package archive is missing or unsafe: {root_archive}") - root_archive = root_archive.resolve() - root_manifest = validate_package(root_archive) - root_name = root_manifest.get("name") - if root_name in installed_packages: - raise DependencyError(f"Package already installed: {root_name}") - - candidates = {} - seen_archives = set() - - def add_candidate(archive): - archive = Path(archive) - try: - if archive.is_symlink() or not archive.is_file(): - return - archive = archive.resolve() - if archive in seen_archives: - return - seen_archives.add(archive) - manifest = validate_package(archive) - name = manifest.get("name") - version = manifest.get("version") - architecture = manifest.get("architecture") - if not isinstance(name, str) or not PACKAGE_NAME_RE.fullmatch(name): - return - if architecture not in ("all", platform.machine()): - return - key = version_key(version) - candidates.setdefault(name, []).append((key, archive, manifest)) - except (OSError, DependencyError, ValueError): - return - except Exception: - # Invalid or unrelated repository archives are not candidates. - return - - add_candidate(root_archive) - archive_count = 0 - for repository in repository_dirs or []: - repository = Path(repository).expanduser() - if repository.is_symlink() or not repository.is_dir(): - raise DependencyError(f"Repository must be an existing non-symlink directory: {repository}") - for archive in sorted(repository.glob("*.tpk")): - archive_count += 1 - if archive_count > MAX_REPOSITORY_PACKAGES: - raise DependencyError( - f"Local repository exceeds {MAX_REPOSITORY_PACKAGES} package archives" - ) - add_candidate(archive) - - for values in candidates.values(): - values.sort(key=lambda item: (item[0], str(item[1])), reverse=True) - - visiting = [] - planned = {} - ordered = [] - - def visit(archive, manifest): - name = manifest["name"] - if name in planned: - return - if name in visiting: - cycle = " -> ".join(visiting + [name]) - raise DependencyError(f"Dependency cycle detected: {cycle}") - - visiting.append(name) - for spec in validate_dependencies(manifest.get("depends", []), package_name=name): - parsed = parse_dependency(spec) - dependency_name = parsed["name"] - - installed = installed_packages.get(dependency_name) - if installed is not None: - if dependency_satisfied(spec, installed.get("version")): - continue - raise DependencyError( - f"Installed dependency is incompatible: {spec}; " - f"{dependency_name} {installed.get('version')!r} is installed. " - "Upgrade it explicitly before installing this package." - ) - - already_planned = planned.get(dependency_name) - if already_planned is not None: - if not dependency_satisfied(spec, already_planned["manifest"]["version"]): - raise DependencyError( - f"Conflicting dependency constraints for {dependency_name}: {spec}" - ) - continue - - matching = [ - item for item in candidates.get(dependency_name, []) - if dependency_satisfied(spec, item[2]["version"]) - ] - if not matching: - raise DependencyError( - f"No compatible local package found for dependency {spec}. " - "Add its .tpk archive to a directory passed with --repo." - ) - - _, dependency_archive, dependency_manifest = matching[0] - visit(dependency_archive, dependency_manifest) - - visiting.pop() - planned[name] = {"archive": archive, "manifest": manifest} - ordered.append((archive, manifest)) - - visit(root_archive, root_manifest) - return ordered diff --git a/board/termos/rootfs-overlay/opt/termos/python/tpm/installer.py b/board/termos/rootfs-overlay/opt/termos/python/tpm/installer.py deleted file mode 100644 index 6dd3755..0000000 --- a/board/termos/rootfs-overlay/opt/termos/python/tpm/installer.py +++ /dev/null @@ -1,265 +0,0 @@ -import hashlib -import os -import platform -import re -import stat -import tarfile -from pathlib import Path - -from .dependencies import DependencyError, check_installed_dependencies -from .database import ( - DatabaseError, - load_database, - save_database, - validate_root, -) -from .package import PackageError, validate_package -from .security import normalize_package_path - - -class InstallError(Exception): - pass - - -def _check_existing_parent(root, parts): - current = root - for part in parts: - candidate = current / part - try: - info = candidate.lstat() - except FileNotFoundError: - return - if stat.S_ISLNK(info.st_mode) or not stat.S_ISDIR(info.st_mode): - raise InstallError(f"Unsafe destination directory: {candidate}") - current = candidate - - -def _create_parent(root, parts, created_directories): - current = root - for part in parts: - candidate = current / part - try: - info = candidate.lstat() - except FileNotFoundError: - try: - candidate.mkdir(mode=0o755) - created_directories.append(candidate) - except FileExistsError: - pass - try: - info = candidate.lstat() - except FileNotFoundError as exc: - raise InstallError(f"Directory disappeared: {candidate}") from exc - if stat.S_ISLNK(info.st_mode) or not stat.S_ISDIR(info.st_mode): - raise InstallError(f"Unsafe destination directory: {candidate}") - current = candidate - return current - - -def _validate_manifest_identity(manifest): - name = manifest.get("name") - version = manifest.get("version") - architecture = manifest.get("architecture") - - if not isinstance(name, str) or not re.fullmatch(r"[a-z0-9][a-z0-9+_.-]{0,127}", name): - raise InstallError("Invalid package name") - if not isinstance(version, str) or not version.strip() or len(version) > 128: - raise InstallError("Invalid package version") - if not isinstance(architecture, str) or not architecture.strip(): - raise InstallError("Invalid package architecture") - - host_arch = platform.machine() - if architecture not in ("all", host_arch): - raise InstallError( - f"Architecture mismatch: package={architecture}, host={host_arch}" - ) - - -def _manifest_paths(manifest): - result = [] - seen = set() - reserved = ".tpm-root" - - for entry in manifest["files"]: - path = normalize_package_path(entry["path"]) - if path == reserved or path.startswith(reserved + "/"): - raise InstallError("Package attempts to overwrite TPM root marker") - if path == "var/lib/tpm" or path.startswith("var/lib/tpm/"): - raise InstallError("Package attempts to overwrite TPM database area") - if path in seen: - raise InstallError(f"Duplicate package path: {path}") - seen.add(path) - result.append(path) - - # A regular file cannot also be the parent directory of another package file. - for path in result: - parts = path.split("/") - for index in range(1, len(parts)): - parent = "/".join(parts[:index]) - if parent in seen: - raise InstallError(f"Conflicting file paths: {parent} and {path}") - - return result - - -def install_package(package_path, root_path): - root = validate_root(root_path) - package_path = Path(package_path) - manifest = validate_package(package_path) - _validate_manifest_identity(manifest) - paths = _manifest_paths(manifest) - - database = load_database(root) - name = manifest["name"] - if name in database["packages"]: - raise InstallError(f"Package already installed: {name}") - try: - check_installed_dependencies( - manifest.get("depends", []), database["packages"], package_name=name - ) - except DependencyError as exc: - raise InstallError(str(exc)) from exc - - owned_paths = { - item["path"] - for package in database["packages"].values() - for item in package.get("files", []) - } - for path in paths: - if path in owned_paths: - raise InstallError(f"File is already owned by another package: {path}") - parts = path.split("/") - _check_existing_parent(root, parts[:-1]) - destination = root.joinpath(*parts) - if os.path.lexists(destination): - raise InstallError(f"Refusing to overwrite existing path: {path}") - - created_files = [] - created_directories = [] - - try: - with tarfile.open(package_path, mode="r:") as archive: - for entry, path in zip(manifest["files"], paths): - member = archive.getmember("payload/" + path) - source = archive.extractfile(member) - if source is None: - raise InstallError(f"Cannot read package file: {path}") - - parts = path.split("/") - parent = _create_parent(root, parts[:-1], created_directories) - destination = parent / parts[-1] - - flags = os.O_WRONLY | os.O_CREAT | os.O_EXCL - if hasattr(os, "O_NOFOLLOW"): - flags |= os.O_NOFOLLOW - fd = os.open(destination, flags, 0o600) - created_files.append(destination) - - digest = hashlib.sha256() - total = 0 - with os.fdopen(fd, "wb") as output, source: - while True: - chunk = source.read(1024 * 1024) - if not chunk: - break - output.write(chunk) - digest.update(chunk) - total += len(chunk) - output.flush() - os.fchmod(output.fileno(), entry["mode"]) - os.fsync(output.fileno()) - - if total != entry["size"]: - raise InstallError(f"Size changed while installing: {path}") - if digest.hexdigest() != entry["sha256"]: - raise InstallError(f"Checksum changed while installing: {path}") - - database["packages"][name] = { - "version": manifest["version"], - "architecture": manifest["architecture"], - "description": manifest.get("description", ""), - "depends": manifest.get("depends", []), - "files": [ - { - "path": entry["path"], - "sha256": entry["sha256"], - "size": entry["size"], - "mode": entry["mode"], - } - for entry in manifest["files"] - ], - } - save_database(root, database) - - except Exception: - for path in reversed(created_files): - try: - path.unlink(missing_ok=True) - except OSError: - pass - for directory in reversed(created_directories): - try: - directory.rmdir() - except OSError: - pass - raise - - return manifest - - -def list_installed(root_path): - root = validate_root(root_path) - return load_database(root)["packages"] - - -def verify_installed(root_path, package_name=None): - root = validate_root(root_path) - packages = load_database(root)["packages"] - - if package_name is not None and package_name not in packages: - raise InstallError(f"Package is not installed: {package_name}") - - selected = ( - {package_name: packages[package_name]} - if package_name is not None - else packages - ) - problems = [] - - for name, package in selected.items(): - try: - check_installed_dependencies( - package.get("depends", []), packages, package_name=name - ) - except DependencyError as exc: - problems.append(f"{name}: {exc}") - - for name, package in selected.items(): - for entry in package.get("files", []): - path = normalize_package_path(entry["path"]) - parts = path.split("/") - try: - _check_existing_parent(root, parts[:-1]) - file_path = root.joinpath(*parts) - info = file_path.lstat() - if stat.S_ISLNK(info.st_mode) or not stat.S_ISREG(info.st_mode): - raise InstallError("not a regular file") - flags = os.O_RDONLY - if hasattr(os, "O_NOFOLLOW"): - flags |= os.O_NOFOLLOW - fd = os.open(file_path, flags) - digest = hashlib.sha256() - total = 0 - with os.fdopen(fd, "rb") as stream: - while True: - chunk = stream.read(1024 * 1024) - if not chunk: - break - digest.update(chunk) - total += len(chunk) - if total != entry["size"] or digest.hexdigest() != entry["sha256"]: - raise InstallError("size or checksum mismatch") - except (OSError, InstallError, ValueError) as exc: - problems.append(f"{name}: {path}: {exc}") - - return len(selected), problems diff --git a/board/termos/rootfs-overlay/opt/termos/python/tpm/manager.py b/board/termos/rootfs-overlay/opt/termos/python/tpm/manager.py deleted file mode 100644 index d4c8051..0000000 --- a/board/termos/rootfs-overlay/opt/termos/python/tpm/manager.py +++ /dev/null @@ -1,46 +0,0 @@ -"""High-level package operations that coordinate dependency installation.""" - -from pathlib import Path - -from .database import load_database, validate_root -from .dependencies import DependencyError, resolve_install_plan -from .installer import install_package -from .uninstaller import remove_package - - -def install_with_dependencies(package_path, root_path, repository_dirs=None): - """Install a package plus missing local dependencies in dependency order. - - If a later package fails, packages installed by this operation are removed - in reverse order. Packages that were already present before the operation - are never touched. - """ - root = validate_root(root_path) - installed_before = load_database(root)["packages"] - plan = resolve_install_plan(package_path, repository_dirs or [], installed_before) - - installed_now = [] - try: - for archive, manifest in plan: - install_package(archive, root) - installed_now.append(manifest["name"]) - except Exception as exc: - rollback_errors = [] - for name in reversed(installed_now): - try: - remove_package(name, root) - except Exception as rollback_exc: - rollback_errors.append(f"{name}: {rollback_exc}") - if rollback_errors: - raise DependencyError( - f"Dependency installation failed ({exc}); rollback was incomplete: " - + "; ".join(rollback_errors) - ) from exc - raise - - root_manifest = plan[-1][1] - return { - "manifest": root_manifest, - "dependencies_installed": max(0, len(plan) - 1), - "installed": installed_now, - } diff --git a/board/termos/rootfs-overlay/opt/termos/python/tpm/package.py b/board/termos/rootfs-overlay/opt/termos/python/tpm/package.py deleted file mode 100644 index 6aefa63..0000000 --- a/board/termos/rootfs-overlay/opt/termos/python/tpm/package.py +++ /dev/null @@ -1,224 +0,0 @@ -import hashlib -import io -import json -import os -import stat -import tarfile - -from pathlib import Path, PurePosixPath - -from .dependencies import DependencyError, validate_dependencies -from .security import ( - PackageSecurityError, - normalize_package_path, -) - -FORMAT_VERSION = 1 -MAX_MANIFEST_SIZE = 4 * 1024 * 1024 -MAX_FILES = 100_000 - - -class PackageError(Exception): - pass - - -def build_package(source, output, name, version, architecture, description="", depends=None): - source = Path(source).resolve() - output = Path(output).resolve() - - if not source.is_dir(): - raise PackageError("Source directory does not exist") - - if not all(isinstance(v, str) and v.strip() for v in (name, version, architecture)): - raise PackageError("Name, version and architecture are required") - - try: - dependency_specs = validate_dependencies(depends or [], package_name=name) - except DependencyError as exc: - raise PackageError(f"Invalid dependencies: {exc}") from exc - - files = [] - - for current, directories, filenames in os.walk(source, followlinks=False): - current_path = Path(current) - - for directory in directories: - if (current_path / directory).is_symlink(): - raise PackageError("Symlink directories are forbidden") - - for filename in filenames: - file_path = current_path / filename - - if file_path.is_symlink() or not stat.S_ISREG(file_path.lstat().st_mode): - raise PackageError(f"Unsupported file: {file_path}") - - relative = file_path.relative_to(source).as_posix() - relative = normalize_package_path(relative) - - digest = hashlib.sha256(file_path.read_bytes()).hexdigest() - - files.append({ - "path": relative, - "sha256": digest, - "mode": stat.S_IMODE(file_path.stat().st_mode) & 0o777, - "size": file_path.stat().st_size, - }) - - if not files or len(files) > MAX_FILES: - raise PackageError("Invalid package file count") - - files.sort(key=lambda item: item["path"]) - - manifest = { - "format": "TPK", - "format_version": FORMAT_VERSION, - "name": name, - "version": version, - "architecture": architecture, - "description": description, - "depends": dependency_specs, - "files": files, - } - - manifest_data = json.dumps( - manifest, ensure_ascii=False, indent=2, sort_keys=True - ).encode("utf-8") - - output.parent.mkdir(parents=True, exist_ok=True) - - with tarfile.open(output, "w", format=tarfile.PAX_FORMAT) as archive: - info = tarfile.TarInfo("manifest.json") - info.size = len(manifest_data) - info.mode = 0o644 - info.mtime = 0 - archive.addfile(info, io.BytesIO(manifest_data)) - - for entry in files: - path = source.joinpath(*PurePosixPath(entry["path"]).parts) - info = tarfile.TarInfo("payload/" + entry["path"]) - info.size = entry["size"] - info.mode = entry["mode"] - info.mtime = 0 - - with path.open("rb") as file: - archive.addfile(info, file) - - return manifest - - -def validate_package(package_path): - try: - with tarfile.open(package_path, "r:") as archive: - members = archive.getmembers() - - if len(members) > MAX_FILES + 1: - raise PackageError("Too many archive entries") - - names = set() - - for member in members: - if member.name in names: - raise PackageError("Duplicate archive entry") - names.add(member.name) - - if not member.isfile(): - raise PackageError("Only regular files are supported") - - if member.name != "manifest.json": - if not member.name.startswith("payload/"): - raise PackageError("Unexpected archive entry") - normalize_package_path(member.name[len("payload/"):]) - - if "manifest.json" not in names: - raise PackageError("Manifest missing") - - manifest_member = archive.getmember("manifest.json") - - if manifest_member.size > MAX_MANIFEST_SIZE: - raise PackageError("Manifest too large") - - stream = archive.extractfile(manifest_member) - if stream is None: - raise PackageError("Cannot read manifest") - - manifest = json.loads(stream.read()) - if not isinstance(manifest, dict): - raise PackageError("Manifest must be a JSON object") - try: - manifest["depends"] = validate_dependencies( - manifest.get("depends", []), package_name=manifest.get("name") - ) - except DependencyError as exc: - raise PackageError(f"Invalid dependency metadata: {exc}") from exc - - if manifest.get("format") != "TPK": - raise PackageError("Invalid package format") - - if manifest.get("format_version") != FORMAT_VERSION: - raise PackageError("Unsupported format version") - - entries = manifest.get("files") - - if not isinstance(entries, list) or not entries or len(entries) > MAX_FILES: - raise PackageError("Invalid manifest file list") - - expected = set() - - for entry in entries: - path = normalize_package_path(entry["path"]) - - if path in expected: - raise PackageError("Duplicate manifest path") - expected.add(path) - - digest = entry["sha256"] - size = entry["size"] - mode = entry["mode"] - - if not isinstance(digest, str) or len(digest) != 64 or any(c not in "0123456789abcdef" for c in digest): - raise PackageError("Invalid SHA-256") - - if type(size) is not int or size < 0: - raise PackageError("Invalid file size") - - if type(mode) is not int or mode < 0 or mode > 0o777: - raise PackageError("Invalid file mode") - - member_name = "payload/" + path - - if member_name not in names: - raise PackageError("Missing payload: " + path) - - member = archive.getmember(member_name) - - if member.size != size: - raise PackageError("Size mismatch: " + path) - - stream = archive.extractfile(member) - if stream is None: - raise PackageError("Cannot read payload: " + path) - - actual = hashlib.sha256(stream.read()).hexdigest() - - if actual != digest: - raise PackageError("Checksum mismatch: " + path) - - actual = {n[8:] for n in names if n.startswith("payload/")} - - if actual != expected: - raise PackageError("Unexpected payload entries") - - return manifest - - except PackageError: - raise - except PackageSecurityError as exc: - raise PackageError( - f"Package security validation failed: {exc}" - ) from exc - except (tarfile.TarError, json.JSONDecodeError, KeyError, TypeError, OSError, UnicodeError) as exc: - raise PackageError(f"Invalid package: {exc}") from exc - - -def package_info(package_path): - return validate_package(package_path) diff --git a/board/termos/rootfs-overlay/opt/termos/python/tpm/repository.py b/board/termos/rootfs-overlay/opt/termos/python/tpm/repository.py deleted file mode 100644 index 2c03969..0000000 --- a/board/termos/rootfs-overlay/opt/termos/python/tpm/repository.py +++ /dev/null @@ -1,399 +0,0 @@ -"""Local TPM repository indexes and Ed25519 signatures. - -The repository index is canonicalized as UTF-8 JSON (sorted keys, compact -separators) before it is signed or verified. Signatures are detached OpenSSL -Ed25519 signatures; the public key must be supplied from a trusted location. -""" - -import hashlib -import json -import os -import shutil -import subprocess -import tempfile -from datetime import datetime, timezone -from pathlib import Path - -from .package import PackageError, validate_package - -INDEX_FORMAT = "TPM-REPOSITORY" -INDEX_VERSION = 1 -DEFAULT_INDEX = "repository.json" -MAX_INDEX_BYTES = 16 * 1024 * 1024 -MAX_PACKAGES = 50000 -_HEX = set("0123456789abcdef") - - -class RepositoryError(Exception): - """Raised for invalid repository data, files, or signatures.""" - - -def _require_regular_file(path: Path, label: str) -> Path: - path = Path(path).expanduser() - try: - path.lstat() - except OSError as exc: - raise RepositoryError(f"Cannot access {label}: {path}: {exc}") from exc - if path.is_symlink() or not path.is_file(): - raise RepositoryError(f"{label} must be a regular, non-symlink file: {path}") - return path - - -def _sha256_file(path: Path): - digest = hashlib.sha256() - size = 0 - with Path(path).open("rb") as stream: - while True: - chunk = stream.read(1024 * 1024) - if not chunk: - break - digest.update(chunk) - size += len(chunk) - return size, digest.hexdigest() - - -def _canonical_json(data) -> bytes: - return json.dumps( - data, - ensure_ascii=False, - sort_keys=True, - separators=(",", ":"), - allow_nan=False, - ).encode("utf-8") - - -def _atomic_write(path: Path, data: bytes, mode=0o644): - path = Path(path).expanduser() - parent = path.parent.resolve(strict=True) - path = parent / path.name - if path.is_symlink(): - raise RepositoryError(f"Refusing to replace symlink: {path}") - fd, temporary = tempfile.mkstemp(prefix=f".{path.name}.", suffix=".tmp", dir=parent) - try: - with os.fdopen(fd, "wb") as stream: - os.fchmod(stream.fileno(), mode) - stream.write(data) - stream.flush() - os.fsync(stream.fileno()) - os.replace(temporary, path) - try: - dir_fd = os.open(parent, os.O_RDONLY) - try: - os.fsync(dir_fd) - finally: - os.close(dir_fd) - except OSError: - pass - except Exception: - try: - os.unlink(temporary) - except FileNotFoundError: - pass - raise - return path - - -def _dependencies_from_manifest(manifest): - # Stage 6 metadata is normally stored under "dependencies". Accept "depends" - # as well for compatibility with early package archives. - value = manifest.get("dependencies", manifest.get("depends", [])) - if value is None: - return [] - if not isinstance(value, list): - raise RepositoryError(f"Invalid dependency metadata in {manifest.get('name', '?')}") - result = [] - for item in value: - if isinstance(item, str) and item.strip(): - result.append(item) - elif isinstance(item, dict): - if not isinstance(item.get("name"), str) or not item["name"].strip(): - raise RepositoryError("Invalid structured dependency in package manifest") - result.append(item) - else: - raise RepositoryError("Invalid dependency entry in package manifest") - return result - - -def build_index(repository_dir, output=None, repository_name="TermOS"): - """Validate top-level .tpk files and create repository.json.""" - repo = Path(repository_dir).expanduser() - if repo.is_symlink() or not repo.is_dir(): - raise RepositoryError(f"Repository path must be a real directory: {repo}") - repo = repo.resolve(strict=True) - if not isinstance(repository_name, str) or not repository_name.strip() or len(repository_name) > 128: - raise RepositoryError("Repository name must contain 1..128 characters") - - archives = sorted(repo.glob("*.tpk"), key=lambda p: p.name.casefold()) - if len(archives) > MAX_PACKAGES: - raise RepositoryError(f"Repository contains more than {MAX_PACKAGES} packages") - - packages = [] - identities = set() - filenames = set() - for archive in archives: - _require_regular_file(archive, "package archive") - try: - manifest = validate_package(archive) - except PackageError as exc: - raise RepositoryError(f"Invalid package {archive.name}: {exc}") from exc - - name = manifest.get("name") - version = manifest.get("version") - architecture = manifest.get("architecture") - description = manifest.get("description", "") - if not all(isinstance(v, str) and v.strip() for v in (name, version, architecture)): - raise RepositoryError(f"Invalid package identity in {archive.name}") - if not isinstance(description, str): - raise RepositoryError(f"Invalid package description in {archive.name}") - - identity = (name, version, architecture) - if identity in identities: - raise RepositoryError(f"Duplicate package identity: {name} {version} [{architecture}]") - if archive.name in filenames: - raise RepositoryError(f"Duplicate package filename: {archive.name}") - identities.add(identity) - filenames.add(archive.name) - - size, digest = _sha256_file(archive) - packages.append({ - "name": name, - "version": version, - "architecture": architecture, - "description": description, - "filename": archive.name, - "size": size, - "sha256": digest, - "dependencies": _dependencies_from_manifest(manifest), - }) - - index = { - "format": INDEX_FORMAT, - "format_version": INDEX_VERSION, - "repository": {"name": repository_name.strip()}, - "generated_at": datetime.now(timezone.utc).replace(microsecond=0).isoformat(), - "packages": packages, - } - destination = Path(output).expanduser() if output is not None else repo / DEFAULT_INDEX - if not destination.is_absolute(): - destination = Path.cwd() / destination - destination.parent.mkdir(parents=True, exist_ok=True) - data = (json.dumps(index, ensure_ascii=False, sort_keys=True, indent=2) + "\n").encode("utf-8") - _atomic_write(destination, data, 0o644) - return destination, index - - -def load_index(index_path): - path = _require_regular_file(Path(index_path), "repository index") - try: - if path.stat().st_size > MAX_INDEX_BYTES: - raise RepositoryError("Repository index is too large") - data = json.loads(path.read_text(encoding="utf-8")) - except RepositoryError: - raise - except (OSError, UnicodeError, json.JSONDecodeError) as exc: - raise RepositoryError(f"Cannot read repository index: {exc}") from exc - - if not isinstance(data, dict) or data.get("format") != INDEX_FORMAT: - raise RepositoryError("Invalid repository index format") - if data.get("format_version") != INDEX_VERSION: - raise RepositoryError("Unsupported repository index version") - repository = data.get("repository") - if not isinstance(repository, dict) or not isinstance(repository.get("name"), str): - raise RepositoryError("Invalid repository metadata") - packages = data.get("packages") - if not isinstance(packages, list) or len(packages) > MAX_PACKAGES: - raise RepositoryError("Invalid repository package list") - - seen_identities = set() - seen_files = set() - for item in packages: - if not isinstance(item, dict): - raise RepositoryError("Invalid package record in repository index") - name, version, arch = item.get("name"), item.get("version"), item.get("architecture") - filename, digest, size = item.get("filename"), item.get("sha256"), item.get("size") - description, dependencies = item.get("description", ""), item.get("dependencies", []) - if not all(isinstance(v, str) and v.strip() for v in (name, version, arch)): - raise RepositoryError("Package record has invalid identity fields") - if (not isinstance(filename, str) or not filename.endswith(".tpk") - or Path(filename).name != filename or filename in (".", "..") - or "/" in filename or "\\" in filename): - raise RepositoryError(f"Unsafe package filename: {filename!r}") - if type(size) is not int or size <= 0: - raise RepositoryError(f"Invalid package size for {name}") - if not isinstance(digest, str) or len(digest) != 64 or any(c not in _HEX for c in digest): - raise RepositoryError(f"Invalid SHA-256 for {name}") - if not isinstance(description, str) or not isinstance(dependencies, list): - raise RepositoryError(f"Invalid optional metadata for {name}") - identity = (name, version, arch) - if identity in seen_identities: - raise RepositoryError(f"Duplicate package identity in index: {identity}") - if filename in seen_files: - raise RepositoryError(f"Duplicate package filename in index: {filename}") - seen_identities.add(identity) - seen_files.add(filename) - return data - - -def _openssl(*args): - executable = shutil.which("openssl") - if not executable: - raise RepositoryError("OpenSSL CLI not found; Ed25519 signing requires openssl") - result = subprocess.run( - [executable, *map(str, args)], stdout=subprocess.PIPE, - stderr=subprocess.PIPE, text=True, check=False, - ) - if result.returncode != 0: - detail = (result.stderr or result.stdout).strip() - raise RepositoryError(f"OpenSSL operation failed: {detail or 'unknown error'}") - return result.stdout.strip() - - -def generate_keypair(private_key, public_key, force=False): - private_path, public_path = Path(private_key).expanduser(), Path(public_key).expanduser() - if private_path.absolute() == public_path.absolute(): - raise RepositoryError("Private and public key paths must be different") - for path in (private_path, public_path): - path.parent.mkdir(parents=True, exist_ok=True) - if path.exists() and not force: - raise RepositoryError(f"Key file already exists (use --force to replace): {path}") - if path.is_symlink(): - raise RepositoryError(f"Refusing to use symlink key path: {path}") - - private_fd, private_tmp = tempfile.mkstemp(prefix=".tpm-ed25519-private-", dir=private_path.parent) - os.close(private_fd) - public_fd, public_tmp = tempfile.mkstemp(prefix=".tpm-ed25519-public-", dir=public_path.parent) - os.close(public_fd) - try: - _openssl("genpkey", "-algorithm", "ED25519", "-out", private_tmp) - _openssl("pkey", "-in", private_tmp, "-pubout", "-out", public_tmp) - os.chmod(private_tmp, 0o600) - os.chmod(public_tmp, 0o644) - os.replace(private_tmp, private_path) - os.replace(public_tmp, public_path) - except Exception: - for temp in (private_tmp, public_tmp): - try: - os.unlink(temp) - except FileNotFoundError: - pass - raise - return private_path, public_path - - -def _canonical_index_file(index_path): - return _canonical_json(load_index(index_path)) - - -def _write_temp_bytes(directory, prefix, data): - fd, path = tempfile.mkstemp(prefix=prefix, dir=directory) - with os.fdopen(fd, "wb") as stream: - stream.write(data) - stream.flush() - os.fsync(stream.fileno()) - return path - - -def sign_index(index_path, private_key, signature_path=None): - index_path = _require_regular_file(Path(index_path), "repository index") - private_key = _require_regular_file(Path(private_key), "private key") - canonical = _canonical_index_file(index_path) - signature = Path(signature_path).expanduser() if signature_path else Path(str(index_path) + ".sig") - signature.parent.mkdir(parents=True, exist_ok=True) - if signature.is_symlink(): - raise RepositoryError("Refusing to replace a symlink signature file") - with tempfile.TemporaryDirectory(prefix="tpm-sign-") as temporary: - message_path = _write_temp_bytes(temporary, "index-", canonical) - signature_tmp = Path(temporary) / "index.sig" - _openssl("pkeyutl", "-sign", "-inkey", private_key, "-rawin", "-in", message_path, "-out", signature_tmp) - data = signature_tmp.read_bytes() - _atomic_write(signature, data, 0o644) - return signature - - -def verify_index_signature(index_path, public_key, signature_path=None): - index_path = _require_regular_file(Path(index_path), "repository index") - public_key = _require_regular_file(Path(public_key), "trusted public key") - signature = Path(signature_path).expanduser() if signature_path else Path(str(index_path) + ".sig") - signature = _require_regular_file(signature, "repository signature") - canonical = _canonical_index_file(index_path) - with tempfile.TemporaryDirectory(prefix="tpm-verify-") as temporary: - message_path = _write_temp_bytes(temporary, "index-", canonical) - _openssl("pkeyutl", "-verify", "-pubin", "-inkey", public_key, - "-rawin", "-in", message_path, "-sigfile", signature) - return True - - -def verify_repository(repository_dir, index_name=DEFAULT_INDEX, public_key=None, - signature_path=None, allow_unsigned=False, verify_archives=True): - repo = Path(repository_dir).expanduser() - if repo.is_symlink() or not repo.is_dir(): - raise RepositoryError(f"Repository path must be a real directory: {repo}") - repo = repo.resolve(strict=True) - index_path = Path(index_name).expanduser() - if not index_path.is_absolute(): - index_path = repo / index_path - index = load_index(index_path) - sig_path = Path(signature_path).expanduser() if signature_path else Path(str(index_path) + ".sig") - - if sig_path.exists(): - if public_key is None: - raise RepositoryError("Repository is signed but no trusted --public-key was supplied") - verify_index_signature(index_path, public_key, sig_path) - signature_status = "verified" - else: - if public_key is not None: - raise RepositoryError("A public key was supplied but the repository signature is missing") - if not allow_unsigned: - raise RepositoryError("Unsigned repository rejected; explicitly use --allow-unsigned only for local testing") - signature_status = "unsigned (explicitly allowed)" - - indexed_filenames = {item["filename"] for item in index["packages"]} - archive_paths = list(repo.glob("*.tpk")) - for archive_path in archive_paths: - _require_regular_file(archive_path, "repository package archive") - actual_filenames = {path.name for path in archive_paths} - if actual_filenames != indexed_filenames: - extra = sorted(actual_filenames - indexed_filenames) - missing = sorted(indexed_filenames - actual_filenames) - raise RepositoryError(f"Repository archive inventory differs from index; extra={extra}, missing={missing}") - - checked = 0 - if verify_archives: - for item in index["packages"]: - archive = repo / item["filename"] - _require_regular_file(archive, "indexed package archive") - size, digest = _sha256_file(archive) - if size != item["size"] or digest != item["sha256"]: - raise RepositoryError(f"Package archive does not match signed index: {item['filename']}") - checked += 1 - return { - "repository": index["repository"]["name"], - "packages": len(index["packages"]), - "archives_verified": checked, - "signature": signature_status, - "index_path": str(index_path), - } - - -def search_packages(repository_dir, query, index_name=DEFAULT_INDEX, public_key=None, - signature_path=None, allow_unsigned=False): - if not isinstance(query, str) or not query.strip(): - raise RepositoryError("Search query cannot be empty") - repo = Path(repository_dir).expanduser().resolve(strict=True) - verification = verify_repository( - repo, index_name=index_name, public_key=public_key, - signature_path=signature_path, allow_unsigned=allow_unsigned, - verify_archives=True, - ) - index_path = Path(index_name).expanduser() - if not index_path.is_absolute(): - index_path = repo / index_path - index = load_index(index_path) - terms = query.casefold().split() - matches = [] - for item in index["packages"]: - haystack = " ".join((item["name"], item["version"], item["architecture"], item.get("description", ""))).casefold() - if all(term in haystack for term in terms): - matches.append(item) - matches.sort(key=lambda item: (item["name"].casefold(), item["version"], item["architecture"])) - return matches, verification diff --git a/board/termos/rootfs-overlay/opt/termos/python/tpm/security.py b/board/termos/rootfs-overlay/opt/termos/python/tpm/security.py deleted file mode 100644 index fed0590..0000000 --- a/board/termos/rootfs-overlay/opt/termos/python/tpm/security.py +++ /dev/null @@ -1,34 +0,0 @@ -import hashlib -from pathlib import PurePosixPath - - -class PackageSecurityError(Exception): - """Raised when a package path violates security rules.""" - - -def normalize_package_path(value: str) -> str: - if not isinstance(value, str) or not value: - raise PackageSecurityError("Empty package path") - - if "\x00" in value or "\\" in value: - raise PackageSecurityError("Invalid characters in package path") - - path = PurePosixPath(value) - - if path.is_absolute(): - raise PackageSecurityError("Absolute paths are forbidden") - - if any(part in ("", ".", "..") for part in value.split("/")): - raise PackageSecurityError("Unsafe package path") - - return path.as_posix() - - -def sha256_file(file_path) -> str: - digest = hashlib.sha256() - - with open(file_path, "rb") as file: - for chunk in iter(lambda: file.read(1024 * 1024), b""): - digest.update(chunk) - - return digest.hexdigest() diff --git a/board/termos/rootfs-overlay/opt/termos/python/tpm/uninstaller.py b/board/termos/rootfs-overlay/opt/termos/python/tpm/uninstaller.py deleted file mode 100644 index 3c53ea2..0000000 --- a/board/termos/rootfs-overlay/opt/termos/python/tpm/uninstaller.py +++ /dev/null @@ -1,236 +0,0 @@ -import hashlib -import os -import re -import shutil -import stat -import tempfile -from pathlib import Path - -from .database import load_database, save_database, validate_root -from .dependencies import DependencyError, find_dependents -from .security import normalize_package_path - - -class UninstallError(Exception): - pass - - -def _ensure_internal_directory(root, parts): - current = root - for part in parts: - candidate = current / part - try: - info = candidate.lstat() - except FileNotFoundError: - try: - candidate.mkdir(mode=0o700) - except FileExistsError: - pass - try: - info = candidate.lstat() - except FileNotFoundError as exc: - raise UninstallError(f"Internal directory disappeared: {candidate}") from exc - if stat.S_ISLNK(info.st_mode) or not stat.S_ISDIR(info.st_mode): - raise UninstallError(f"Unsafe TPM internal directory: {candidate}") - current = candidate - return current - - -def _check_parent_directories(root, parts): - current = root - for part in parts: - current = current / part - try: - info = current.lstat() - except FileNotFoundError: - return False - if stat.S_ISLNK(info.st_mode) or not stat.S_ISDIR(info.st_mode): - raise UninstallError(f"Unsafe path component: {current}") - return True - - -def _hash_regular_file(path): - try: - info = path.lstat() - except FileNotFoundError: - return None - - if stat.S_ISLNK(info.st_mode) or not stat.S_ISREG(info.st_mode): - raise UninstallError(f"Refusing to remove a non-regular file: {path}") - - flags = os.O_RDONLY - if hasattr(os, "O_NOFOLLOW"): - flags |= os.O_NOFOLLOW - fd = os.open(path, flags) - digest = hashlib.sha256() - size = 0 - with os.fdopen(fd, "rb") as stream: - while True: - chunk = stream.read(1024 * 1024) - if not chunk: - break - digest.update(chunk) - size += len(chunk) - return size, digest.hexdigest() - - -def remove_package(package_name, root_path, keep_modified=False): - if not isinstance(package_name, str) or not re.fullmatch( - r"[a-z0-9][a-z0-9+_.-]{0,127}", package_name - ): - raise UninstallError("Invalid package name") - - root = validate_root(root_path) - database = load_database(root) - packages = database["packages"] - - if package_name not in packages: - raise UninstallError(f"Package is not installed: {package_name}") - try: - blockers = find_dependents(package_name, packages) - except DependencyError as exc: - raise UninstallError(f"Cannot safely check dependents: {exc}") from exc - if blockers: - details = ", ".join(f"{name} ({spec})" for name, spec in blockers) - raise UninstallError( - f"Cannot remove {package_name}; it is required by installed package(s): {details}" - ) - - package = packages[package_name] - entries = package.get("files") - if not isinstance(entries, list): - raise UninstallError("Invalid package record in TPM database") - - checked = [] - seen = set() - modified = [] - missing = [] - - # Complete preflight before moving or deleting anything. - for entry in entries: - if not isinstance(entry, dict): - raise UninstallError("Invalid file record in TPM database") - try: - relative = normalize_package_path(entry["path"]) - expected_size = entry["size"] - expected_hash = entry["sha256"] - except (KeyError, TypeError, ValueError) as exc: - raise UninstallError(f"Invalid file record: {exc}") from exc - - if relative in seen: - raise UninstallError(f"Duplicate file record: {relative}") - seen.add(relative) - - parts = relative.split("/") - if relative == ".tpm-root" or relative.startswith(".tpm-root/"): - raise UninstallError("Package record references reserved TPM marker") - if relative == "var/lib/tpm" or relative.startswith("var/lib/tpm/"): - raise UninstallError("Package record references reserved TPM database area") - if type(expected_size) is not int or expected_size < 0: - raise UninstallError(f"Invalid recorded size: {relative}") - if ( - not isinstance(expected_hash, str) - or len(expected_hash) != 64 - or any(char not in "0123456789abcdef" for char in expected_hash) - ): - raise UninstallError(f"Invalid recorded SHA-256: {relative}") - - if not _check_parent_directories(root, parts[:-1]): - missing.append(relative) - continue - - destination = root.joinpath(*parts) - actual = _hash_regular_file(destination) - if actual is None: - missing.append(relative) - continue - - if actual != (expected_size, expected_hash): - modified.append(relative) - else: - checked.append((relative, destination)) - - if modified and not keep_modified: - preview = ", ".join(modified[:5]) - if len(modified) > 5: - preview += f", and {len(modified) - 5} more" - raise UninstallError( - "Modified files detected; nothing was removed. " - f"Use --keep-modified to leave them in place: {preview}" - ) - - transaction_parent = _ensure_internal_directory( - root, ("var", "lib", "tpm", "transactions") - ) - transaction = Path( - tempfile.mkdtemp(prefix="remove-", dir=str(transaction_parent)) - ) - moved = [] - committed = False - - try: - for relative, source in checked: - parts = relative.split("/") - backup = transaction.joinpath(*parts) - backup.parent.mkdir(parents=True, exist_ok=True) - - # Re-check immediately before moving the file. - if not _check_parent_directories(root, parts[:-1]): - raise UninstallError(f"File parent disappeared: {relative}") - current = _hash_regular_file(source) - expected = next( - (item["size"], item["sha256"]) - for item in entries - if item["path"] == relative - ) - if current != expected: - raise UninstallError(f"File changed during removal: {relative}") - - os.replace(source, backup) - moved.append((source, backup)) - - del packages[package_name] - save_database(root, database) - committed = True - - except Exception as exc: - rollback_errors = [] - for original, backup in reversed(moved): - try: - relative_parts = original.relative_to(root).parts - if not _check_parent_directories(root, relative_parts[:-1]): - raise OSError("original parent directory is missing") - if os.path.lexists(original): - raise OSError("original path is occupied; refusing to overwrite") - os.replace(backup, original) - except OSError as rollback_exc: - rollback_errors.append(f"{original}: {rollback_exc}") - - if rollback_errors: - details = "; ".join(rollback_errors) - raise UninstallError( - f"Removal failed ({exc}); rollback was incomplete. " - f"Recovery files remain in {transaction}: {details}" - ) from exc - shutil.rmtree(transaction, ignore_errors=True) - if isinstance(exc, UninstallError): - raise - raise UninstallError(f"Removal failed; changes rolled back: {exc}") from exc - - cleanup_warning = None - if committed: - try: - shutil.rmtree(transaction) - except OSError as exc: - cleanup_warning = ( - f"Package was removed, but temporary backup data remains at " - f"{transaction}: {exc}" - ) - - return { - "name": package_name, - "removed": len(moved), - "modified_kept": modified if keep_modified else [], - "missing": missing, - "cleanup_warning": cleanup_warning, - } diff --git a/board/termos/rootfs-overlay/opt/termos/python/tpm/upgrade.py b/board/termos/rootfs-overlay/opt/termos/python/tpm/upgrade.py deleted file mode 100644 index fe9fdb2..0000000 --- a/board/termos/rootfs-overlay/opt/termos/python/tpm/upgrade.py +++ /dev/null @@ -1,407 +0,0 @@ -"""Transactional package upgrades for the TermOS Package Manager.""" - -import hashlib -import os -import re -import shutil -import stat -import tarfile -import tempfile -from pathlib import Path - -from .database import load_database, save_database, validate_root -from .dependencies import ( - DependencyError, - check_installed_dependencies, - check_reverse_dependencies, -) -from .installer import _manifest_paths, _validate_manifest_identity -from .package import PackageError, validate_package -from .security import normalize_package_path - - -class UpgradeError(Exception): - """Raised when a package upgrade cannot be completed safely.""" - - -def _version_key(value): - """Parse a numeric dotted version (for example 1.2.3) for safe ordering.""" - if not isinstance(value, str) or len(value) > 128: - raise UpgradeError("Upgrade requires numeric dotted versions such as 1.2.3") - if not re.fullmatch(r"[0-9]+(?:\.[0-9]+){0,7}", value): - raise UpgradeError( - f"Unsupported version format: {value!r}; use numeric dotted versions such as 1.2.3" - ) - parts = [int(part) for part in value.split(".")] - if any(part > 2_147_483_647 for part in parts): - raise UpgradeError("Version component is too large") - while len(parts) > 1 and parts[-1] == 0: - parts.pop() - return tuple(parts) - - -def _safe_hash(path): - """Return (size, sha256) for a regular, non-symlink file; None if absent.""" - try: - info = path.lstat() - except FileNotFoundError: - return None - if stat.S_ISLNK(info.st_mode) or not stat.S_ISREG(info.st_mode): - raise UpgradeError(f"Refusing to replace a non-regular file: {path}") - - flags = os.O_RDONLY - if hasattr(os, "O_NOFOLLOW"): - flags |= os.O_NOFOLLOW - fd = os.open(path, flags) - digest = hashlib.sha256() - size = 0 - with os.fdopen(fd, "rb") as stream: - while True: - chunk = stream.read(1024 * 1024) - if not chunk: - break - digest.update(chunk) - size += len(chunk) - return size, digest.hexdigest() - - -def _check_parent(root, parts): - current = root - for part in parts: - current = current / part - try: - info = current.lstat() - except FileNotFoundError: - return - if stat.S_ISLNK(info.st_mode) or not stat.S_ISDIR(info.st_mode): - raise UpgradeError(f"Unsafe destination directory: {current}") - - -def _create_parent(root, parts, created_directories): - current = root - for part in parts: - candidate = current / part - try: - info = candidate.lstat() - except FileNotFoundError: - try: - candidate.mkdir(mode=0o755) - created_directories.append(candidate) - except FileExistsError: - pass - try: - info = candidate.lstat() - except FileNotFoundError as exc: - raise UpgradeError(f"Directory disappeared: {candidate}") from exc - if stat.S_ISLNK(info.st_mode) or not stat.S_ISDIR(info.st_mode): - raise UpgradeError(f"Unsafe destination directory: {candidate}") - current = candidate - return current - - -def _transaction_parent(root): - """Create and validate the internal transaction directory.""" - current = root - created = [] - for part in ("var", "lib", "tpm", "transactions"): - candidate = current / part - try: - info = candidate.lstat() - except FileNotFoundError: - try: - candidate.mkdir(mode=0o700 if part == "transactions" else 0o755) - created.append(candidate) - except FileExistsError: - pass - try: - info = candidate.lstat() - except FileNotFoundError as exc: - raise UpgradeError(f"TPM transaction directory disappeared: {candidate}") from exc - if stat.S_ISLNK(info.st_mode) or not stat.S_ISDIR(info.st_mode): - raise UpgradeError(f"Unsafe TPM transaction directory: {candidate}") - current = candidate - return current, created - - -def _validate_installed_entries(entries): - if not isinstance(entries, list): - raise UpgradeError("Invalid installed package record: files must be a list") - - result = {} - reserved = (".tpm-root", "var/lib/tpm") - for entry in entries: - if not isinstance(entry, dict): - raise UpgradeError("Invalid installed package file record") - try: - path = normalize_package_path(entry["path"]) - size = entry["size"] - digest = entry["sha256"] - mode = entry["mode"] - except (KeyError, TypeError, ValueError) as exc: - raise UpgradeError(f"Invalid installed package file record: {exc}") from exc - - if any(path == item or path.startswith(item + "/") for item in reserved): - raise UpgradeError(f"Installed package record references reserved path: {path}") - if path in result: - raise UpgradeError(f"Duplicate installed package path: {path}") - if type(size) is not int or size < 0: - raise UpgradeError(f"Invalid recorded file size: {path}") - if ( - not isinstance(digest, str) - or len(digest) != 64 - or any(char not in "0123456789abcdef" for char in digest) - ): - raise UpgradeError(f"Invalid recorded SHA-256: {path}") - if type(mode) is not int or mode < 0 or mode > 0o777: - raise UpgradeError(f"Invalid recorded file mode: {path}") - result[path] = entry - - paths = set(result) - for path in paths: - parts = path.split("/") - for index in range(1, len(parts)): - parent = "/".join(parts[:index]) - if parent in paths: - raise UpgradeError(f"Conflicting installed file paths: {parent} and {path}") - return result - - -def _manifest_record(manifest): - return { - "version": manifest["version"], - "architecture": manifest["architecture"], - "description": manifest.get("description", ""), - "depends": manifest.get("depends", []), - "files": [ - { - "path": entry["path"], - "sha256": entry["sha256"], - "size": entry["size"], - "mode": entry["mode"], - } - for entry in manifest["files"] - ], - } - - -def upgrade_package(package_path, root_path): - """Upgrade one installed package, rolling files back if commit fails.""" - root = validate_root(root_path) - package_path = Path(package_path) - - try: - manifest = validate_package(package_path) - except PackageError: - raise - - _validate_manifest_identity(manifest) - new_paths = _manifest_paths(manifest) - name = manifest["name"] - new_version = manifest["version"] - - database = load_database(root) - packages = database["packages"] - if name not in packages: - raise UpgradeError(f"Package is not installed: {name}") - - old_record = packages[name] - old_version = old_record.get("version") - if _version_key(new_version) <= _version_key(old_version): - raise UpgradeError( - f"New version {new_version} must be greater than installed version {old_version}" - ) - - if old_record.get("architecture") != manifest["architecture"]: - raise UpgradeError("Package architecture cannot change during an upgrade") - try: - check_installed_dependencies( - manifest.get("depends", []), packages, package_name=name - ) - check_reverse_dependencies(name, new_version, packages) - except DependencyError as exc: - raise UpgradeError(str(exc)) from exc - - old_entries = _validate_installed_entries(old_record.get("files")) - new_entries = {entry["path"]: entry for entry in manifest["files"]} - old_paths = set(old_entries) - new_path_set = set(new_paths) - - other_owned = { - item.get("path") - for other_name, record in packages.items() - if other_name != name - for item in record.get("files", []) - if isinstance(item, dict) and isinstance(item.get("path"), str) - } - for path in new_path_set: - for owned in other_owned: - if path == owned or path.startswith(owned + "/") or owned.startswith(path + "/"): - raise UpgradeError(f"New package path conflicts with another package: {path}") - - # Preflight every old file before making any change. Modified files are never - # silently overwritten or removed by an upgrade. - old_present = set() - for relative, entry in old_entries.items(): - parts = relative.split("/") - _check_parent(root, parts[:-1]) - destination = root.joinpath(*parts) - actual = _safe_hash(destination) - if actual is None: - continue # A missing old file can be restored by the new package. - if actual != (entry["size"], entry["sha256"]): - raise UpgradeError( - f"Modified installed file detected; upgrade aborted: {relative}" - ) - old_present.add(relative) - - # New paths not owned by the current package must be genuinely unused. - for relative in new_path_set - old_paths: - parts = relative.split("/") - _check_parent(root, parts[:-1]) - destination = root.joinpath(*parts) - if os.path.lexists(destination): - raise UpgradeError(f"Refusing to overwrite an unowned path: {relative}") - - transaction_parent, created_internal_dirs = _transaction_parent(root) - transaction = Path(tempfile.mkdtemp(prefix="upgrade-", dir=str(transaction_parent))) - stage_root = transaction / "stage" - backup_root = transaction / "backup" - stage_root.mkdir(mode=0o700) - backup_root.mkdir(mode=0o700) - - created_files = [] - created_directories = [] - moved_old_files = [] - committed = False - - try: - # Extract into a private staging area first. Nothing in the installed root - # changes until all incoming files have been rechecked and staged. - with tarfile.open(package_path, mode="r:") as archive: - for relative in new_paths: - entry = new_entries[relative] - member = archive.getmember("payload/" + relative) - source = archive.extractfile(member) - if source is None: - raise UpgradeError(f"Cannot read package file: {relative}") - - staged = stage_root.joinpath(*relative.split("/")) - staged.parent.mkdir(parents=True, exist_ok=True) - digest = hashlib.sha256() - total = 0 - with staged.open("xb") as output, source: - while True: - chunk = source.read(1024 * 1024) - if not chunk: - break - output.write(chunk) - digest.update(chunk) - total += len(chunk) - output.flush() - os.fchmod(output.fileno(), entry["mode"]) - os.fsync(output.fileno()) - - if total != entry["size"] or digest.hexdigest() != entry["sha256"]: - raise UpgradeError(f"Package content changed while staging: {relative}") - - # Move every still-present old file into the transaction backup. This - # includes obsolete paths that are absent from the new version. - for relative in sorted(old_present): - parts = relative.split("/") - source = root.joinpath(*parts) - current = _safe_hash(source) - expected = old_entries[relative] - if current != (expected["size"], expected["sha256"]): - raise UpgradeError(f"Installed file changed during upgrade: {relative}") - backup = backup_root.joinpath(*parts) - backup.parent.mkdir(parents=True, exist_ok=True) - os.replace(source, backup) - moved_old_files.append((source, backup)) - - # Put the staged new version in place without following symlinks and - # without overwriting an unexpected file that appeared after preflight. - for relative in new_paths: - entry = new_entries[relative] - parts = relative.split("/") - parent = _create_parent(root, parts[:-1], created_directories) - destination = parent / parts[-1] - flags = os.O_WRONLY | os.O_CREAT | os.O_EXCL - if hasattr(os, "O_NOFOLLOW"): - flags |= os.O_NOFOLLOW - fd = os.open(destination, flags, 0o600) - created_files.append(destination) - staged = stage_root.joinpath(*parts) - with os.fdopen(fd, "wb") as output, staged.open("rb") as source: - while True: - chunk = source.read(1024 * 1024) - if not chunk: - break - output.write(chunk) - output.flush() - os.fchmod(output.fileno(), entry["mode"]) - os.fsync(output.fileno()) - - packages[name] = _manifest_record(manifest) - save_database(root, database) - committed = True - - except Exception as exc: - rollback_errors = [] - - for path in reversed(created_files): - try: - path.unlink(missing_ok=True) - except OSError as rollback_exc: - rollback_errors.append(f"remove {path}: {rollback_exc}") - - for original, backup in reversed(moved_old_files): - try: - if os.path.lexists(original): - raise OSError("original path is occupied; refusing to overwrite") - parent = _create_parent(root, original.relative_to(root).parts[:-1], created_directories) - os.replace(backup, parent / original.name) - except OSError as rollback_exc: - rollback_errors.append(f"restore {original}: {rollback_exc}") - except UpgradeError as rollback_exc: - rollback_errors.append(f"restore {original}: {rollback_exc}") - - if rollback_errors: - details = "; ".join(rollback_errors) - raise UpgradeError( - f"Upgrade failed ({exc}); rollback was incomplete. " - f"Recovery data remains in {transaction}: {details}" - ) from exc - - for directory in reversed(created_directories): - try: - directory.rmdir() - except OSError: - pass - - shutil.rmtree(transaction, ignore_errors=True) - for directory in reversed(created_internal_dirs): - try: - directory.rmdir() - except OSError: - pass - - if isinstance(exc, (UpgradeError, PackageError)): - raise - raise UpgradeError(f"Upgrade failed; previous version restored: {exc}") from exc - - if committed: - shutil.rmtree(transaction) - for directory in reversed(created_internal_dirs): - try: - directory.rmdir() - except OSError: - pass - - return { - "name": name, - "old_version": old_version, - "new_version": new_version, - "added": len(new_path_set - old_paths), - "updated": len(new_path_set & old_paths), - "removed": len(old_paths - new_path_set), - } diff --git a/board/termos/rootfs-overlay/usr/bin/tpm b/board/termos/rootfs-overlay/usr/bin/tpm deleted file mode 100755 index 2fb686a..0000000 --- a/board/termos/rootfs-overlay/usr/bin/tpm +++ /dev/null @@ -1,192 +0,0 @@ -#!/usr/bin/python3 -"""TermOS TPM launcher with a guarded live-system mode.""" -import hashlib -import json -import os -import re -import subprocess -import sys -import tarfile -from pathlib import Path - -PYTHON_ROOT = "/opt/termos/python" -PUBLIC_KEY_DEFAULT = "/etc/termos/repository-ed25519.pub" -PYTHON = "/usr/bin/python3" - - -def fail(message, code=2): - print(f"tpm: error: {message}", file=sys.stderr) - raise SystemExit(code) - - -def option_values(args, option): - values = [] - index = 0 - while index < len(args): - item = args[index] - if item == option: - if index + 1 >= len(args): - fail(f"{option} requires a value") - values.append(args[index + 1]) - index += 2 - continue - if item.startswith(option + "="): - values.append(item.split("=", 1)[1]) - index += 1 - return values - - -def remove_option_pairs(args, options): - result = [] - index = 0 - while index < len(args): - item = args[index] - matched = False - for option in options: - if item == option: - if index + 1 >= len(args): - fail(f"{option} requires a value") - index += 2 - matched = True - break - if item.startswith(option + "="): - index += 1 - matched = True - break - if not matched: - result.append(item) - index += 1 - return result - - -def read_package_identity(package_path): - path = Path(package_path).expanduser().resolve(strict=True) - if not path.is_file(): - fail(f"Package is not a regular file: {path}") - try: - with tarfile.open(path, mode="r:") as archive: - member = archive.getmember("manifest.json") - if not member.isfile() or member.size > 4 * 1024 * 1024: - fail("Package manifest is invalid or too large") - stream = archive.extractfile(member) - if stream is None: - fail("Cannot read package manifest") - manifest = json.loads(stream.read().decode("utf-8")) - except (OSError, tarfile.TarError, KeyError, UnicodeError, json.JSONDecodeError) as exc: - fail(f"Cannot inspect package: {exc}") - name = manifest.get("name") - version = manifest.get("version") - if not isinstance(name, str) or not isinstance(version, str): - fail("Package manifest has no valid name/version") - digest = hashlib.sha256() - with path.open("rb") as stream: - for chunk in iter(lambda: stream.read(1024 * 1024), b""): - digest.update(chunk) - return path, name, version, digest.hexdigest() - - -def verify_package_is_in_signed_repo(package_path, args, public_key): - repos = option_values(args, "--repo") - if not repos: - fail("System install/upgrade requires at least one signed --repo") - if not Path(public_key).is_file(): - fail(f"Trusted repository public key is missing: {public_key}") - path, name, version, digest = read_package_identity(package_path) - for repo in repos: - command = [PYTHON, "-m", "tpm", "search", name, - "--repo", repo, "--public-key", public_key] - result = subprocess.run( - command, - env=os.environ.copy(), - text=True, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - check=False, - ) - output = result.stdout or "" - identity_line = re.compile( - rf"(?m)^{re.escape(name)}\s+{re.escape(version)}\s+\[" - ) - archive_line = re.compile( - rf"(?m)^\s*archive:\s*{re.escape(path.name)}\s+sha256:\s*{re.escape(digest)}\s*$" - ) - if result.returncode == 0 and identity_line.search(output) and archive_line.search(output): - return path, name, version - fail( - f"Package {path.name} {version} is not present in any supplied, " - "signature-verified repository with the exact signed SHA-256" - ) - - -def main(): - args = list(sys.argv[1:]) - existing_pythonpath = os.environ.get("PYTHONPATH", "") - os.environ["PYTHONPATH"] = PYTHON_ROOT + ( - os.pathsep + existing_pythonpath if existing_pythonpath else "" - ) - env = os.environ.copy() - - if "--system" not in args: - os.execve(PYTHON, [PYTHON, "-m", "tpm", *args], env) - - args.remove("--system") - if not args: - fail("Usage: tpm ... --system") - - command = args[0] - allowed = {"install", "remove", "upgrade", "list", "verify"} - if command not in allowed: - fail("--system is supported only for install, remove, upgrade, list, and verify") - if any(item == "--root" or item.startswith("--root=") for item in args): - fail("Do not combine --system with --root") - if os.geteuid() != 0: - fail("System-root operations require root privileges") - - marker = Path("/etc/termos-release") - try: - marker_info = marker.lstat() - marker_lines = marker.read_text(encoding="utf-8").splitlines() - except OSError as exc: - fail(f"Cannot validate /etc/termos-release: {exc}") - import stat - if not stat.S_ISREG(marker_info.st_mode) or stat.S_ISLNK(marker_info.st_mode): - fail("/etc/termos-release must be a regular file") - if "ID=termos" not in marker_lines: - fail("This system is not identified as TermOS; refusing system-root operation") - - package_identity = None - if command in ("install", "upgrade"): - if len(args) < 2: - fail(f"Usage: tpm {command} PACKAGE --system --repo DIR") - public_keys = option_values(args, "--repo-key") - public_key = public_keys[0] if public_keys else PUBLIC_KEY_DEFAULT - package_path, package_name, package_version = verify_package_is_in_signed_repo( - args[1], args, public_key - ) - package_identity = f"{package_name}-{package_version}" - if command == "install" and not public_keys: - args.extend(["--repo-key", public_key]) - # The current upgrade subcommand accepts only package and --root; the - # signed repository has already been verified by the search operation. - if command == "upgrade": - args = [args[0], str(package_path), *remove_option_pairs(args[2:], ("--repo", "--repo-key"))] - - if command in ("install", "remove", "upgrade"): - target = package_identity or (args[1] if len(args) > 1 else "package") - phrase = f"CONFIRM {command.upper()} {target}" - print("WARNING: this modifies the active TermOS system root (/).") - print("On an ISO/live boot, filesystem changes may not survive reboot.") - try: - answer = input(f"Type exactly '{phrase}' to continue: ").strip() - except EOFError: - fail("No confirmation received") - if answer != phrase: - fail("Confirmation did not match; no system changes were made", 1) - - env["TPM_ALLOW_SYSTEM_ROOT"] = "1" - command_args = [*args, "--root", "/"] - os.execve(PYTHON, [PYTHON, "-m", "tpm", *command_args], env) - - -if __name__ == "__main__": - main() diff --git a/board/termos/rootfs-overlay/usr/share/termos/tests/tpm-smoke.sh b/board/termos/rootfs-overlay/usr/share/termos/tests/tpm-smoke.sh deleted file mode 100755 index 9694b43..0000000 --- a/board/termos/rootfs-overlay/usr/share/termos/tests/tpm-smoke.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -set -eu - -TPM="${TPM:-/usr/bin/tpm}" -WORK="$(mktemp -d /tmp/termos-tpm-smoke.XXXXXX)" -cleanup() { rm -rf "$WORK"; } -trap cleanup EXIT HUP INT TERM - -fail() { echo "[FAIL] $*" >&2; exit 1; } -echo "===== TERMOS TPM GUEST SMOKE TEST =====" - -"$TPM" --help >/dev/null || fail "TPM CLI did not start" -"$TPM" repo --help >/dev/null || fail "TPM repository CLI did not start" -command -v openssl >/dev/null 2>&1 || fail "OpenSSL CLI is missing" -openssl version -python3 -c 'import ssl, tarfile, hashlib, json; print("Python runtime modules: OK")' \ - || fail "Required Python runtime modules are missing" -[ -s /etc/termos/repository-ed25519.pub ] || fail "Trusted repository public key is missing" - -mkdir -p "$WORK/v1/usr/bin" "$WORK/v2/usr/bin" -cat > "$WORK/v1/usr/bin/tpm-guest-smoke" <<'EOF' -#!/bin/sh -echo "TPM guest package version 1" -EOF -cat > "$WORK/v2/usr/bin/tpm-guest-smoke" <<'EOF' -#!/bin/sh -echo "TPM guest package version 2" -EOF -chmod 0755 "$WORK/v1/usr/bin/tpm-guest-smoke" "$WORK/v2/usr/bin/tpm-guest-smoke" - -ARCH="$(uname -m)" -"$TPM" build "$WORK/v1" --name tpm-guest-smoke --version 1.0.0 \ - --arch "$ARCH" --description "TermOS VM smoke test" -o "$WORK/tpm-guest-smoke-1.0.0.tpk" -"$TPM" build "$WORK/v2" --name tpm-guest-smoke --version 1.1.0 \ - --arch "$ARCH" --description "TermOS VM smoke test" -o "$WORK/tpm-guest-smoke-1.1.0.tpk" - -ROOT="$WORK/root" -"$TPM" init-root --root "$ROOT" -"$TPM" install "$WORK/tpm-guest-smoke-1.0.0.tpk" --root "$ROOT" -[ "$("$ROOT/usr/bin/tpm-guest-smoke")" = "TPM guest package version 1" ] || fail "Initial package execution failed" -"$TPM" upgrade "$WORK/tpm-guest-smoke-1.1.0.tpk" --root "$ROOT" -"$TPM" verify --root "$ROOT" -[ "$("$ROOT/usr/bin/tpm-guest-smoke")" = "TPM guest package version 2" ] || fail "Upgraded package execution failed" -"$TPM" remove tpm-guest-smoke --root "$ROOT" -"$TPM" verify --root "$ROOT" -[ ! -e "$ROOT/usr/bin/tpm-guest-smoke" ] || fail "Package file remained after removal" - -echo "[PASS] Sandbox install, upgrade, verify, execution, and remove" -if [ "$(id -u)" = "0" ]; then - "$TPM" --system list >/dev/null || fail "TermOS system-root read-only check failed" - echo "[PASS] Guarded TermOS system-root read-only check" -else - echo "[SKIP] System-root check requires root; sandbox tests passed" -fi - -echo "TERMOS TPM GUEST SMOKE TEST PASSED" diff --git a/board/termos/rootfs-overlay/usr/share/termos/tests/tpm-system-root-test.sh b/board/termos/rootfs-overlay/usr/share/termos/tests/tpm-system-root-test.sh deleted file mode 100755 index fd76a43..0000000 --- a/board/termos/rootfs-overlay/usr/share/termos/tests/tpm-system-root-test.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -set -eu - -REPO_ROOT="${1:-}" -[ -n "$REPO_ROOT" ] || { echo "Usage: $0 /path/to/tpm-system-root-repo" >&2; exit 2; } -[ "$(id -u)" = "0" ] || { echo "Run this test as root inside the disposable TermOS VM." >&2; exit 1; } -[ -s /etc/termos-release ] || { echo "Not a TermOS system image." >&2; exit 1; } -[ -s /etc/termos/repository-ed25519.pub ] || { echo "Trusted repository public key missing." >&2; exit 1; } - -V1="$REPO_ROOT/v1" -V2="$REPO_ROOT/v2" -P1="$(find "$V1" -maxdepth 1 -type f -name '*.tpk' | head -n 1)" -P2="$(find "$V2" -maxdepth 1 -type f -name '*.tpk' | head -n 1)" -[ -n "$P1" ] && [ -s "$P1" ] || { echo "v1 package missing" >&2; exit 1; } -[ -n "$P2" ] && [ -s "$P2" ] || { echo "v2 package missing" >&2; exit 1; } - -TARGET="/usr/share/termos/tpm-system-root-smoke/installed.txt" -echo "This test writes only one disposable text file under /usr/share/termos." -echo "It installs v1, upgrades to v2, verifies, and then removes the test package." - -/usr/bin/tpm install "$P1" --system --repo "$V1" -/usr/bin/tpm verify tpm-system-root-smoke --system -[ -s "$TARGET" ] || { echo "Installed payload missing" >&2; exit 1; } -grep -q 'Version 1' "$TARGET" || { echo "Unexpected v1 payload" >&2; exit 1; } - -/usr/bin/tpm upgrade "$P2" --system --repo "$V2" -/usr/bin/tpm verify tpm-system-root-smoke --system -grep -q 'Version 2' "$TARGET" || { echo "Upgrade payload not present" >&2; exit 1; } - -/usr/bin/tpm remove tpm-system-root-smoke --system -[ ! -e "$TARGET" ] || { echo "Package payload remains after removal" >&2; exit 1; } -/usr/bin/tpm verify --system - -echo "TPM SYSTEM-ROOT INSTALL / UPGRADE / REMOVE TEST PASSED" diff --git a/board/termos/vm-compat.fragment b/board/termos/vm-compat.fragment deleted file mode 100644 index c7d749f..0000000 --- a/board/termos/vm-compat.fragment +++ /dev/null @@ -1,23 +0,0 @@ -# TermOS VM compatibility fragment -# Keep the EFI GOP framebuffer available during early boot, then enable -# common virtual display and network adapters used by VMware and QEMU. -CONFIG_EFI=y -CONFIG_EFI_STUB=y -CONFIG_FB=y -CONFIG_FB_EFI=y -CONFIG_FRAMEBUFFER_CONSOLE=y -CONFIG_VGA_CONSOLE=y -CONFIG_DRM=y -CONFIG_DRM_SIMPLEDRM=y -CONFIG_DRM_VMWGFX=y -CONFIG_DRM_VIRTIO_GPU=y -CONFIG_PCI=y -CONFIG_E1000=y -CONFIG_E1000E=y -CONFIG_VMXNET3=y -CONFIG_VIRTIO_NET=y - -# SATA optical drives and ISO9660 media in VMware/QEMU -CONFIG_SATA_AHCI=y -CONFIG_BLK_DEV_SR=y -CONFIG_ISO9660_FS=y diff --git a/config/includes.chroot/etc/termos-release b/config/includes.chroot/etc/termos-release new file mode 100644 index 0000000..12d1d24 --- /dev/null +++ b/config/includes.chroot/etc/termos-release @@ -0,0 +1,4 @@ +NAME=TermOS +VERSION=0.3.0 +GENERATION=debian +BASE=debian-stable diff --git a/config/package-lists/termos-base.list.chroot b/config/package-lists/termos-base.list.chroot new file mode 100644 index 0000000..ede1a40 --- /dev/null +++ b/config/package-lists/termos-base.list.chroot @@ -0,0 +1,20 @@ +live-boot +systemd-sysv +sudo +network-manager +dbus +ca-certificates +curl +git +less +nano +openssh-client +python3 +python3-venv +python3-pip +iproute2 +iputils-ping +pciutils +usbutils +procps +util-linux diff --git a/configs/termos_defconfig b/configs/termos_defconfig deleted file mode 100644 index 26cdd51..0000000 --- a/configs/termos_defconfig +++ /dev/null @@ -1,30 +0,0 @@ -BR2_x86_64=y -BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y -BR2_GLOBAL_PATCH_DIR="board/qemu/patches" -BR2_DOWNLOAD_FORCE_CHECK_HASHES=y -BR2_TARGET_GENERIC_HOSTNAME="TermOS" -BR2_TARGET_GENERIC_ISSUE="Welcome to TermOS 0.2!" -BR2_SYSTEM_DHCP="eth0" -BR2_ROOTFS_OVERLAY="../../board/termos/rootfs-overlay" -BR2_LINUX_KERNEL=y -BR2_LINUX_KERNEL_CUSTOM_VERSION=y -BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.27" -BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y -BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="../../board/termos/linux.config" -BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="../../board/termos/vm-compat.fragment" -BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y -BR2_PACKAGE_PYTHON3=y -BR2_TARGET_ROOTFS_EXT2=y -BR2_TARGET_ROOTFS_ISO9660=y -BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="../../board/termos/grub-iso.cfg" -# BR2_TARGET_ROOTFS_TAR is not set -BR2_TARGET_GRUB2=y -BR2_TARGET_GRUB2_X86_64_EFI=y -BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI="boot linux ext2 fat squash4 part_msdos part_gpt normal configfile efi_gop iso9660" -BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI="../../board/termos/grub-efi.cfg" - -# TPM Stage 8: Ed25519 repository signature verification -BR2_PACKAGE_OPENSSL=y -BR2_PACKAGE_LIBOPENSSL=y -BR2_PACKAGE_PYTHON3_SSL=y -BR2_PACKAGE_LIBOPENSSL_BIN=y diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md new file mode 100644 index 0000000..02a78c2 --- /dev/null +++ b/docs/ARCHITECTURE.md @@ -0,0 +1,78 @@ +# TermOS Architecture + +**Status:** Accepted direction for the Debian generation; implementation is incremental. +**Baseline:** v0.3.0 development line. + +## Product boundary + +TermOS is a Debian-based system integration and user-experience project. Debian supplies the operating-system base, kernel, package database, and standard services. TermOS supplies a coherent CLI-first experience, configuration conventions, profiles, installer, and management interfaces. + +## Accepted platform decisions + +| Area | Decision | +| --- | --- | +| Distribution base | Debian Stable | +| ISO construction | Debian Live Build (live-build) | +| Initial architecture | amd64 | +| Default session | Minimal CLI; no desktop environment | +| Optional desktop profiles | XFCE and KDE Plasma | +| Installer | Custom TermOS installer, planned | +| First management interface | TUI Control Center | +| Application layer | Python | +| System backend | Rust, introduced when privileged operations are implemented | +| Package ownership | APT / dpkg | +| TPM | Retired; no TPM code in the Debian generation | + +The configured stable suite tracks Debian Stable. Release engineering must record the resolved Debian codename and package snapshot used for every published ISO. + +## Logical layers + +1. **Interface layer:** CLI, TUI Control Center, custom installer, and optional desktop integrations. +2. **Application layer:** Python commands, presentation, profile definitions, and non-privileged orchestration. +3. **System backend:** Rust service for narrowly scoped privileged operations. This is a future component, not required for the first v0.3 ISO. +4. **Debian services:** systemd, D-Bus, Polkit, NetworkManager, APT/dpkg, and standard Linux interfaces. +5. **Hardware:** CPU, memory, storage, network, graphics, and peripherals. + +Interfaces must call shared application/system APIs. Do not duplicate privileged business logic in the TUI, CLI, or installer. + +## Python and Rust responsibilities + +Python owns user-facing orchestration and presentation: CLI, TUI, profile parsing, configuration workflows, and non-privileged system inspection. + +Rust is reserved for the system backend where a long-running service, strict input validation, and narrow privileged operations justify it. Do not add Rust merely to duplicate an existing Debian tool. + +The backend should expose a documented local interface, with D-Bus as the preferred integration mechanism when it fits the operation. Authorization should use system policy (for example, Polkit) rather than a permanently privileged UI process. + +## Package ownership + +- APT/dpkg exclusively own Debian packages and the files installed by them. +- TermOS profiles may declare Debian package dependencies and TermOS-owned configuration. +- TermOS must not install a second package database or overwrite dpkg-owned paths. +- The Control Center may provide a unified presentation, but it must disclose that APT/dpkg perform package operations. +- No TPM or replacement package manager is part of this generation. + +## Profiles + +Profiles are declarative descriptions of supported system compositions. They may reference Debian package names, optional services, and TermOS-owned configuration. Profile application must be idempotent, inspectable, and reversible where practical. + +Initial concepts: minimal (base CLI), developer (tools layered on another profile), xfce, and kde. The v0.3 milestone only establishes the base image and profile format. It does not claim that profile switching or desktop installation is implemented. + +## Security boundaries + +- Never run arbitrary profile-provided shell scripts as root. +- Validate all inputs at the backend boundary. +- Keep privileged operations narrow and auditable. +- Require explicit confirmation for destructive storage operations. +- Do not expose a general-purpose root command execution API to the UI. +- Report success only after the underlying operation confirms success. +- Log meaningful operation outcomes without recording secrets. + +## Build and image lifecycle + +live-build creates the live ISO. It is not the installer. The custom installer will be a separate program executed from the live environment and will install a Debian-based system to a target disk in a later milestone. + +The v0.3 base image has no default desktop. XFCE and KDE are future optional profiles and are not included in the initial minimal ISO. + +## Architecture evolution + +Implementation status is tracked in ROADMAP.md. Significant changes to accepted boundaries require a new Architecture Decision Record under docs/decisions/. diff --git a/docs/BUILDING.md b/docs/BUILDING.md new file mode 100644 index 0000000..77792f3 --- /dev/null +++ b/docs/BUILDING.md @@ -0,0 +1,61 @@ +# Building TermOS + +**Current target:** Debian Stable, amd64, live-build. +**Status:** Build configuration is being established for v0.3.0. This document is not evidence that an ISO has already been built or validated. + +## Recommended host + +Use a dedicated Debian Stable VM or development machine. Building live images requires root privileges and can create large temporary files. Do not run experimental installer code against disks containing important data. + +## Dependencies + +On a Debian Stable host: + +~~~bash +sudo apt update +sudo apt install -y live-build debootstrap git make python3 python3-venv python3-pip qemu-system-x86 ovmf xorriso squashfs-tools file rsync +~~~ + +## Python development + +~~~bash +python3 -m venv .venv +. .venv/bin/activate +python -m pip install --upgrade pip +python -m pip install --editable . +termos --version +termos info +~~~ + +## Build the live ISO + +From the repository root: + +~~~bash +make build +~~~ + +The build script invokes lb config and lb build with root privileges. The expected output is live-image-amd64.hybrid.iso in the repository root. + +## Verify and boot + +~~~bash +make verify +make vm +~~~ + +The QEMU runner expects OVMF firmware at /usr/share/OVMF/OVMF_CODE_4M.fd and /usr/share/OVMF/OVMF_VARS_4M.fd. Override these with OVMF_CODE and OVMF_VARS_TEMPLATE if your host uses different paths. + +## Clean generated state + +~~~bash +make clean +~~~ + +lb clean --purge removes generated live-build state. Do not run it while a build is active. + +## Reproducibility notes + +The live-build configuration currently requests the moving Debian stable suite. A release record must capture the resolved codename, package versions, build date, and checksums. For stronger reproducibility, a later release pipeline should pin a Debian snapshot or another immutable package source after the project validates that workflow. + +Do not claim reproducible builds until two independent builds from documented inputs have been compared. diff --git a/docs/INSTALLATION.md b/docs/INSTALLATION.md new file mode 100644 index 0000000..13f2ac8 --- /dev/null +++ b/docs/INSTALLATION.md @@ -0,0 +1,24 @@ +# Installation Status + +**Current status:** No custom installer is implemented in v0.3.0 development scaffolding. + +The first Debian-generation milestone targets a bootable live ISO. It does not yet install TermOS to a disk. + +## Planned installer + +The custom TermOS installer is a separate component from live-build. live-build constructs the live environment; it does not provide the final TermOS installation workflow. + +The installer is planned to support hardware and firmware checks, language and keyboard selection, timezone, explicit disk and partition selection, clear display of destructive changes, a separate final confirmation, user creation, base-system installation, bootloader setup, logs, and actionable failure messages. + +## Safety requirements + +- Never format or repartition a disk by default. +- Display the exact target disk and planned changes. +- Require explicit final confirmation for destructive operations. +- Stop when disk identity or partition intent is ambiguous. +- Test against disposable virtual disks before physical hardware. +- Never claim that existing user data or partitions will be preserved unless that behavior has passed dedicated tests. + +## Current development use + +For v0.3.0, use the live ISO only in QEMU or another disposable virtual machine. There is no supported installation path yet. diff --git a/docs/MIGRATION_FROM_BUILDROOT.md b/docs/MIGRATION_FROM_BUILDROOT.md new file mode 100644 index 0000000..9ceab17 --- /dev/null +++ b/docs/MIGRATION_FROM_BUILDROOT.md @@ -0,0 +1,47 @@ +# Rebuild Boundary: Buildroot Generation to Debian Generation + +**Status:** Accepted project policy +**Previous generation:** Buildroot-based TermOS v0.1.0 and v0.2.0 +**New development generation:** Debian-based TermOS v0.3.0 onward + +## Decision + +TermOS is rebuilding its development line on Debian Stable beginning with v0.3.0. The Buildroot-based v0.1.0 and v0.2.0 releases remain historical releases. There is no supported in-place conversion from an installed Buildroot system to the Debian generation. + +This is a development and architecture reset, not an operating-system upgrade. + +## What is preserved + +- Published release tags and release assets. +- Historical Buildroot configuration, source, and release evidence through their Git history and tags. +- Product principles and useful lessons from the first generation. +- Individual TermOS-authored ideas or code only when reviewed and deliberately reimplemented or ported. + +## What is not carried forward as active Debian architecture + +- Buildroot defconfigs, kernel fragments, root filesystem overlays, and image-generation scripts. +- BusyBox-specific assumptions and Buildroot boot integration. +- TPM (TermOS Package Manager), its .tpk format, repository database, and package ownership model. +- The old TPM repository signing key and package tests. +- Any claim that the old dashboard or scripts are already compatible with Debian. + +TPM is retired from the Debian generation. APT/dpkg are the authoritative package-management tools. + +## User data and installation + +No automatic migration of system files, package state, services, or configuration is promised. A future Debian installer must clearly identify target disks and require explicit confirmation before destructive operations. + +Users should back up personal data to separate storage before installing any future TermOS image. Do not assume that an installer preserves existing partitions until that exact behavior is implemented and tested. + +## Versioning + +- v0.1.0 and v0.2.0 remain Buildroot historical releases. +- v0.3.0 begins the Debian-based development line. +- v0.x milestones are capability-driven development releases. +- v1.0.0 is the intended first stable release, not the point at which Debian is introduced. + +## Repository policy + +The active development branch should contain only the current Debian-generation build and application architecture. Historical release documentation is retained under docs/archive/; old implementation code remains recoverable from the original release tags and Git history. + +No history rewrite or deletion of published tags is part of this rebuild. diff --git a/docs/RELEASE_PROCESS.md b/docs/RELEASE_PROCESS.md new file mode 100644 index 0000000..1e888a7 --- /dev/null +++ b/docs/RELEASE_PROCESS.md @@ -0,0 +1,31 @@ +# Release Process + +This document defines release discipline for the Debian generation. It does not certify that any current development build is ready for publication. + +## Before a release + +- Confirm the milestone acceptance criteria in ROADMAP.md. +- Build from a clean checkout using the documented environment. +- Record the Debian suite and resolved codename, package versions, build host, and build date. +- Run unit tests, shell syntax checks, and integration tests. +- Boot the ISO in UEFI QEMU; record the command and result. +- Perform manual VM and physical-hardware tests only when available, clearly separating them from automated tests. +- Generate SHA-256 checksums. +- Review third-party packages, licenses, notices, and corresponding-source obligations for the exact image. +- Publish known limitations and recovery guidance. +- Verify release assets after upload. + +## Release artifacts + +A public ISO release should include, as applicable: ISO image, SHA256SUMS, release notes, known limitations, exact source revision and build instructions, third-party notices and corresponding-source materials, test evidence, and supported hardware scope. + +## Version policy + +- Development package version: 0.3.0.devN until a release is approved. +- Milestone release tags use v0.3.0, v0.4.0, and so on. +- Do not retarget an already published tag. +- Buildroot v0.1.0 and v0.2.0 tags remain unchanged. + +## Publication rule + +Do not publish a generated ISO as a supported release merely because CI built it. Release readiness requires passing the milestone gate and a human review of the exact artifacts and their notices. diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md new file mode 100644 index 0000000..62dd47e --- /dev/null +++ b/docs/ROADMAP.md @@ -0,0 +1,83 @@ +# TermOS Roadmap + +> **Direction:** A modular, CLI-first Linux system built on Debian. +> **Guiding idea:** Easy to Install. Powerful to Control. Modular by Design. + +This roadmap describes intended milestones, not deadlines. A version is complete only when its acceptance criteria are met and implementation status is honestly documented. + +## Product principles + +1. **CLI First, Not CLI Only:** the shell is always a first-class interface. +2. **Scriptable by Design:** management actions have documented CLI equivalents or stable APIs. +3. **Transparent Over Magical:** explain operations and their effects before changes. +4. **One System, Multiple Interfaces:** CLI, TUI, installer, and future GUI share system logic. +5. **Modular by Design:** no mandatory desktop; profiles are composable. +6. **User Control With Understandable Defaults:** guided flows preserve meaningful choices. +7. **Accessible Without Hiding Linux:** help users learn without locking them away from the system. +8. **Honest About Capability:** implemented, planned, experimental, and unavailable features are clearly distinguished. + +## Platform baseline + +| Area | Decision | +| --- | --- | +| Base | Debian Stable | +| ISO builder | live-build | +| Architecture | amd64 initially | +| Default environment | Minimal CLI | +| Optional desktops | XFCE and KDE Plasma | +| Installer | Custom TermOS installer | +| First Control Center | TUI | +| Core languages | Python + Rust | +| Package management | APT / dpkg | +| TPM | Retired | + +## Milestones + +| Version | Focus | Exit criteria | +| --- | --- | --- | +| **v0.3.0** | Debian Foundation | Minimal amd64 live ISO, UEFI/QEMU boot validation, initial Python CLI, tests and build documentation. | +| **v0.4.0** | TermOS Core | Shared configuration model, profile manifest schema, system-information interfaces, initial TUI Control Center, and Rust backend prototype only where required. | +| **v0.5.0** | Custom Installer | Guided installer prototype with safe disk discovery, explicit target selection, final destructive-action confirmation, logs, and VM installation tests. | +| **v0.6.0** | Profiles | Declarative profile manager, Minimal and Developer profiles, and profile validation. | +| **v0.7.0** | Desktop Integration | Optional XFCE and KDE Plasma profiles, desktop session integration, and documented package ownership through APT/dpkg. | +| **v0.8.0** | Reliability | Upgrade/recovery design, broader VM and hardware testing, security review, diagnostics, and failure handling. | +| **v0.9.0** | Release Candidate | Feature freeze, reproducible build review, installation hardening, documentation completion, and RC validation. | +| **v1.0.0** | First Stable Release | Stable Debian-based TermOS with tested installer, CLI/TUI management, supported profiles, release documentation, and published limitations. | + +## v0.3.0 — Debian Foundation + +### In scope +- Debian Stable live image built with live-build. +- amd64 architecture. +- Minimal CLI environment; no desktop packages in the base image. +- UEFI boot validation in QEMU. +- Python package and termos command. +- Basic truthful system information command. +- Build, clean, verify, and QEMU helper scripts. +- GitHub Actions validation and manually triggered ISO build workflow. +- Architecture, build, migration, and installation-status documentation. + +### Explicitly out of scope +- Custom disk installer. +- Full TUI Control Center. +- Rust privileged system service. +- XFCE or KDE packages in the default ISO. +- Profile installation/switching. +- TPM or any parallel package manager. +- Claims of physical hardware compatibility before testing. + +### Acceptance criteria +- lb config and lb build complete in the documented Debian Stable environment. +- ISO artifact exists and has a recorded SHA-256. +- UEFI boot reaches the live environment in QEMU. +- termos --version and termos info work. +- Unit tests and shell syntax checks pass. +- Documentation accurately states that installer and desktop profiles are not yet implemented. + +## Release policy + +- Buildroot v0.1.0 and v0.2.0 remain historical releases and are not rewritten. +- v0.3.0 starts the Debian development generation. +- Buildroot-to-Debian is a rebuild boundary; no in-place conversion is supported. +- Milestones move when quality gates are not met. +- Experimental releases must not be described as production-ready. diff --git a/docs/TPK_FORMAT.md b/docs/TPK_FORMAT.md deleted file mode 100644 index 44ece0e..0000000 --- a/docs/TPK_FORMAT.md +++ /dev/null @@ -1,79 +0,0 @@ -# TPK package format — version 1 - -A `.tpk` file is an **uncompressed POSIX TAR archive**. It is not extracted with -`tar -x`; TPM reads individual regular-file members and validates their paths, -lengths, and SHA-256 digests before installation. - -## Archive layout - -```text -example-1.0.0-x86_64.tpk -├── manifest.json -└── payload/ - └── usr/ - └── bin/ - └── example -``` - -The archive contains one `manifest.json` member and one `payload/` -member for each file in the manifest. Version 1 supports regular files only; it -does not support symbolic links, hard links, device nodes, FIFOs, or compressed -TAR streams. - -## Manifest fields - -The version-1 manifest contains: - -- `format`: the literal string `TPK`. -- `format_version`: integer `1`. -- `name`: package identifier. -- `version`: package version. The current upgrade comparator accepts numeric, - dot-separated versions (for example `1.2.3`). -- `architecture`: target architecture, such as `x86_64`, or `all` where - supported by the installer. -- `description`: human-readable package description. -- `files`: array of file records. Each record contains `path`, `sha256`, `size`, - and `mode`. -- Dependency metadata: produced by the current `tpm build --depends SPEC` - interface and interpreted by TPM's dependency resolver. Use `tpm info FILE` - to inspect the exact manifest emitted by the installed TPM version; dependency - grammar and comparison operators are defined by that version's resolver. - -`path` is relative to the package root and must not be absolute, contain `..`, -backslashes, NUL bytes, or empty path components. `sha256` is a lowercase -64-character SHA-256 hex digest. `size` is a non-negative integer. `mode` is a -permission mode restricted to `0o777`. - -## Building and inspecting - -```sh -tpm build ./staging-root \ - --name example --version 1.0.0 --arch x86_64 \ - --description "Example package" \ - --depends 'libfoo>=1.2.0' \ - --output packages/example-1.0.0-x86_64.tpk - -tpm info packages/example-1.0.0-x86_64.tpk -``` - -The package builder records each file's size, mode, and SHA-256. The validator -checks archive membership, duplicate entries, path safety, manifest structure, -and every payload digest before TPM uses the package. - -## Repository integrity and authenticity - -A repository index records package metadata and the archive's byte size and -SHA-256. The index is signed separately using Ed25519; the detached signature -file is `repository.json.sig`. Clients must verify the signature with a public -key provisioned through a trusted channel and then verify archive hashes. - -SHA-256 alone detects accidental or malicious changes only when the expected -hash is trusted. The Ed25519 signature authenticates the index only when the -public key itself is trusted. Never distribute the repository private key in an -ISO, a package archive, or a public source release. - -## Compatibility policy - -The version-1 format is intentionally small and uncompressed to avoid requiring -Python compression extensions in the minimal TermOS image. Any incompatible -change to archive layout or manifest semantics requires a new `format_version`. diff --git a/docs/archive/v0.1.0/README.md b/docs/archive/v0.1.0/README.md new file mode 100644 index 0000000..cb4d4ad --- /dev/null +++ b/docs/archive/v0.1.0/README.md @@ -0,0 +1,5 @@ +# TermOS v0.1.0 historical records + +This folder contains release documentation for the Buildroot-based v0.1.0 preview. It is retained for historical reference and does not describe the Debian generation. + +The original source and release assets remain available through the v0.1.0 tag and GitHub release. \ No newline at end of file diff --git a/docs/RELEASE_CHECKLIST.md b/docs/archive/v0.1.0/RELEASE_CHECKLIST.md similarity index 100% rename from docs/RELEASE_CHECKLIST.md rename to docs/archive/v0.1.0/RELEASE_CHECKLIST.md diff --git a/docs/COMPLIANCE_CHECKLIST_0.2.0.md b/docs/archive/v0.2.0/COMPLIANCE_CHECKLIST.md similarity index 100% rename from docs/COMPLIANCE_CHECKLIST_0.2.0.md rename to docs/archive/v0.2.0/COMPLIANCE_CHECKLIST.md diff --git a/docs/archive/v0.2.0/README.md b/docs/archive/v0.2.0/README.md new file mode 100644 index 0000000..367dafc --- /dev/null +++ b/docs/archive/v0.2.0/README.md @@ -0,0 +1,6 @@ +# TermOS v0.2.0 historical records + +These files describe the Buildroot-based v0.2.0 release only. They are retained for historical and release-audit purposes and do not describe the Debian generation. + +The original source, configuration, TPM implementation, and build system remain recoverable from the v0.2.0 release tag: +https://github.com/MaybeSobi/TermOS/releases/tag/v0.2.0 diff --git a/docs/RELEASE_CHECKLIST_0.2.0.md b/docs/archive/v0.2.0/RELEASE_CHECKLIST.md similarity index 100% rename from docs/RELEASE_CHECKLIST_0.2.0.md rename to docs/archive/v0.2.0/RELEASE_CHECKLIST.md diff --git a/docs/THIRD_PARTY_COMPONENTS_0.2.0.csv b/docs/archive/v0.2.0/THIRD_PARTY_COMPONENTS.csv similarity index 100% rename from docs/THIRD_PARTY_COMPONENTS_0.2.0.csv rename to docs/archive/v0.2.0/THIRD_PARTY_COMPONENTS.csv diff --git a/docs/THIRD_PARTY_LICENSE_REVIEW_0.2.0.md b/docs/archive/v0.2.0/THIRD_PARTY_LICENSE_REVIEW.md similarity index 100% rename from docs/THIRD_PARTY_LICENSE_REVIEW_0.2.0.md rename to docs/archive/v0.2.0/THIRD_PARTY_LICENSE_REVIEW.md diff --git a/docs/THIRD_PARTY_NOTICES.md b/docs/archive/v0.2.0/THIRD_PARTY_NOTICES.md similarity index 100% rename from docs/THIRD_PARTY_NOTICES.md rename to docs/archive/v0.2.0/THIRD_PARTY_NOTICES.md diff --git a/docs/decisions/0001-debian-stable.md b/docs/decisions/0001-debian-stable.md new file mode 100644 index 0000000..ffee708 --- /dev/null +++ b/docs/decisions/0001-debian-stable.md @@ -0,0 +1,19 @@ +# ADR 0001: Debian Stable as the Base System + +- **Status:** Accepted +- **Date:** 2026-11-18 + +## Context + +The project is rebuilding the TermOS development line to provide a maintainable Linux base rather than continuing to grow a custom Buildroot system. + +## Decision + +Use Debian Stable as the base distribution for the Debian generation, beginning with v0.3.0. The live-build configuration uses the stable suite. Every release must record the resolved Debian codename and package state. + +## Consequences + +- APT/dpkg are the authoritative package-management system. +- Debian service and filesystem conventions are preferred. +- The project inherits Debian's package lifecycle and security-update model. +- The moving stable alias is convenient for development but is not, by itself, a reproducible release input. diff --git a/docs/decisions/0002-live-build.md b/docs/decisions/0002-live-build.md new file mode 100644 index 0000000..8757781 --- /dev/null +++ b/docs/decisions/0002-live-build.md @@ -0,0 +1,19 @@ +# ADR 0002: Use Debian Live Build for ISO Construction + +- **Status:** Accepted +- **Date:** 2026-11-18 + +## Context + +TermOS needs a repeatable way to assemble a Debian-based live ISO while keeping package selection and filesystem customization declarative. + +## Decision + +Use Debian Live Build (live-build) for the v0.3.0 image pipeline. Keep configuration under auto/ and config/. The custom TermOS disk installer remains a separate future component. + +## Consequences + +- live-build owns live-image assembly and bootable ISO generation. +- TermOS scripts wrap build, clean, verification, and VM launch tasks. +- The installer must not be conflated with the live-image builder. +- The exact live-build version and resolved Debian package set must be recorded for releases. diff --git a/docs/decisions/0003-desktop-profiles.md b/docs/decisions/0003-desktop-profiles.md new file mode 100644 index 0000000..83accab --- /dev/null +++ b/docs/decisions/0003-desktop-profiles.md @@ -0,0 +1,18 @@ +# ADR 0003: No Default Desktop; XFCE and KDE as Optional Profiles + +- **Status:** Accepted +- **Date:** 2026-11-18 + +## Context + +TermOS is CLI-first and should not impose a graphical desktop on every user. Optional desktop environments are part of the intended modular experience. + +## Decision + +The base installation has no default desktop environment. XFCE and KDE Plasma are the initial planned official desktop profiles. They are not included in the v0.3.0 minimal image and are not considered supported until end-to-end profile tests exist. + +## Consequences + +- The base ISO remains a minimal CLI environment. +- Desktop packages are installed only through an explicitly selected profile. +- Profile definitions must use APT/dpkg and must not create a second package database. diff --git a/docs/decisions/0004-python-rust-boundary.md b/docs/decisions/0004-python-rust-boundary.md new file mode 100644 index 0000000..4a65fea --- /dev/null +++ b/docs/decisions/0004-python-rust-boundary.md @@ -0,0 +1,21 @@ +# ADR 0004: Python Application Layer and Rust System Backend + +- **Status:** Accepted direction; implementation staged +- **Date:** 2026-11-18 + +## Context + +TermOS needs a maintainable user-facing application layer and a clear boundary for privileged system operations. + +## Decision + +Use Python for the CLI, TUI, profile/configuration workflows, and non-privileged orchestration. Introduce Rust for a narrowly scoped system backend when privileged operations and stable interfaces are implemented. + +Do not create a Rust daemon in v0.3.0 solely to satisfy the language choice. The first milestone can ship without a privileged backend. + +## Consequences + +- UI layers must not run as root by default. +- Privileged operations require narrow APIs, input validation, and system authorization. +- D-Bus and Polkit are candidates for integration; their final use must be validated. +- Python and Rust must not independently implement the same privileged operation. diff --git a/docs/decisions/0005-retire-tpm.md b/docs/decisions/0005-retire-tpm.md new file mode 100644 index 0000000..7665f54 --- /dev/null +++ b/docs/decisions/0005-retire-tpm.md @@ -0,0 +1,20 @@ +# ADR 0005: Retire TPM from the Debian Generation + +- **Status:** Accepted +- **Date:** 2026-11-18 + +## Context + +The Debian generation already has a mature package-management system. A second package manager would introduce overlapping package databases, file ownership, dependency resolution, and update behavior. + +## Decision + +Retire TPM (TermOS Package Manager) from the Debian generation. APT and dpkg are the sole system package-management authorities. TPM source, tests, package format, and signing key are not part of the active Debian architecture. + +The historical TPM implementation remains available in the Buildroot release tags and Git history. + +## Consequences + +- No .tpk package installation in the Debian generation. +- Profiles declare Debian package dependencies and TermOS-owned configuration only. +- The Control Center must disclose that APT/dpkg perform package operations. diff --git a/keys/termos-repo-public.pem b/keys/termos-repo-public.pem deleted file mode 100644 index 35fed36..0000000 --- a/keys/termos-repo-public.pem +++ /dev/null @@ -1,3 +0,0 @@ ------BEGIN PUBLIC KEY----- -MCowBQYDK2VwAyEAKk9pqTp633HGFJZTbJ+wP0b1rrv4yfm1GCe8KFdTwCo= ------END PUBLIC KEY----- diff --git a/profiles/developer/profile.yaml b/profiles/developer/profile.yaml new file mode 100644 index 0000000..b78ad7c --- /dev/null +++ b/profiles/developer/profile.yaml @@ -0,0 +1,12 @@ +id: developer +name: Developer +version: 1 +description: Development tools layered on top of another base profile. +desktop: inherit +packages: + - git + - build-essential + - python3 + - python3-venv +services: [] +status: planned diff --git a/profiles/kde/profile.yaml b/profiles/kde/profile.yaml new file mode 100644 index 0000000..012949b --- /dev/null +++ b/profiles/kde/profile.yaml @@ -0,0 +1,9 @@ +id: kde +name: KDE Plasma Desktop +version: 1 +description: Optional KDE Plasma desktop environment. +desktop: kde +packages: + - task-kde-desktop +services: [] +status: planned diff --git a/profiles/minimal/profile.yaml b/profiles/minimal/profile.yaml new file mode 100644 index 0000000..9fea5bd --- /dev/null +++ b/profiles/minimal/profile.yaml @@ -0,0 +1,8 @@ +id: minimal +name: Minimal CLI +version: 1 +description: Base TermOS command-line environment without a desktop. +desktop: none +packages: [] +services: [] +status: planned diff --git a/profiles/xfce/profile.yaml b/profiles/xfce/profile.yaml new file mode 100644 index 0000000..2cf39d6 --- /dev/null +++ b/profiles/xfce/profile.yaml @@ -0,0 +1,9 @@ +id: xfce +name: XFCE Desktop +version: 1 +description: Optional XFCE desktop environment. +desktop: xfce +packages: + - task-xfce-desktop +services: [] +status: planned diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..2e723b8 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,22 @@ +[build-system] +requires = ["setuptools>=68"] +build-backend = "setuptools.build_meta" + +[project] +name = "termos" +version = "0.3.0.dev0" +description = "A modular, CLI-first Linux system built on Debian" +readme = "README.md" +requires-python = ">=3.11" +license = { file = "LICENSE" } +authors = [{ name = "TermOS contributors" }] +dependencies = [] + +[project.scripts] +termos = "termos.cli:main" + +[tool.setuptools] +package-dir = {"" = "src"} + +[tool.setuptools.packages.find] +where = ["src"] diff --git a/scripts/assemble-source-bundle.sh b/scripts/assemble-source-bundle.sh deleted file mode 100644 index eb5e841..0000000 --- a/scripts/assemble-source-bundle.sh +++ /dev/null @@ -1,187 +0,0 @@ -#!/usr/bin/env bash -set -Eeuo pipefail - -ROOT_DIR="$(cd -- "$(dirname -- "$0")/.." && pwd)" -if [[ "$#" -ne 2 ]]; then - echo "ERROR: usage: assemble-source-bundle.sh " >&2 - exit 2 -fi -ARTIFACT_DIR="$1" -OUTPUT_DIR="$2" - -RELEASE_TAG="v0.2.0" -EXPECTED_COMMIT="14e0173e354a44b640723755b28180a1c819af05" -BUILDROOT_VERSION="2025.02.19" -BUILDROOT_BASE_URL="https://buildroot.org/downloads" -LEGAL_INFO_ARCHIVE="$ARTIFACT_DIR/TermOS-legal-info.tar.gz" -SBOM_FILE="$ARTIFACT_DIR/TermOS-v0.2.0.cdx.json" -BUNDLE_NAME="TermOS-v0.2.0-corresponding-source" - -mkdir -p "$OUTPUT_DIR" -WORK_DIR="$(mktemp -d)" -trap 'rm -rf "$WORK_DIR"' EXIT -BUNDLE_DIR="$WORK_DIR/$BUNDLE_NAME" -mkdir -p "$BUNDLE_DIR/compliance-docs" - -if [[ ! -s "$LEGAL_INFO_ARCHIVE" ]]; then - echo "ERROR: missing CI legal-info archive: $LEGAL_INFO_ARCHIVE" >&2 - exit 1 -fi -if [[ ! -s "$SBOM_FILE" ]]; then - echo "ERROR: missing CycloneDX SBOM from release CI: $SBOM_FILE" >&2 - exit 1 -fi -python3 - "$SBOM_FILE" <<'PY' -import json, sys -with open(sys.argv[1], encoding="utf-8") as stream: - bom = json.load(stream) -if bom.get("bomFormat") != "CycloneDX" or not isinstance(bom.get("components"), list): - raise SystemExit("Invalid CycloneDX BOM") -PY - -if ! git rev-parse --verify "$RELEASE_TAG^{commit}" >/dev/null 2>&1; then - git fetch --force origin "refs/tags/$RELEASE_TAG:refs/tags/$RELEASE_TAG" -fi -ACTUAL_COMMIT="$(git rev-parse "$RELEASE_TAG^{commit}")" -if [[ "$ACTUAL_COMMIT" != "$EXPECTED_COMMIT" ]]; then - echo "ERROR: $RELEASE_TAG resolves to $ACTUAL_COMMIT, expected $EXPECTED_COMMIT" >&2 - exit 1 -fi - -LEGAL_LIST="$WORK_DIR/legal-info-files.txt" -tar -tzf "$LEGAL_INFO_ARCHIVE" > "$LEGAL_LIST" -for required in \ - legal-info/README \ - legal-info/manifest.csv \ - legal-info/host-manifest.csv \ - legal-info/buildroot.config; do - if ! grep -Fxq "$required" "$LEGAL_LIST"; then - echo "ERROR: required legal-info entry missing: $required" >&2 - exit 1 - fi -done -for directory in legal-info/sources/ legal-info/host-sources/ legal-info/licenses/ legal-info/host-licenses/; do - if ! grep -Fq "$directory" "$LEGAL_LIST"; then - echo "ERROR: required legal-info directory missing: $directory" >&2 - exit 1 - fi -done - -cp "$LEGAL_INFO_ARCHIVE" "$BUNDLE_DIR/TermOS-legal-info.tar.gz" -cp "$SBOM_FILE" "$BUNDLE_DIR/TermOS-v0.2.0.cdx.json" - -BUILDROOT_ARCHIVE="buildroot-$BUILDROOT_VERSION.tar.xz" -curl --fail --location --retry 3 --retry-delay 2 \ - "$BUILDROOT_BASE_URL/$BUILDROOT_ARCHIVE" \ - --output "$BUNDLE_DIR/$BUILDROOT_ARCHIVE" -curl --fail --location --retry 3 --retry-delay 2 \ - "$BUILDROOT_BASE_URL/$BUILDROOT_ARCHIVE.sign" \ - --output "$BUNDLE_DIR/$BUILDROOT_ARCHIVE.sign" -xz --test "$BUNDLE_DIR/$BUILDROOT_ARCHIVE" -tar -tJf "$BUNDLE_DIR/$BUILDROOT_ARCHIVE" > "$WORK_DIR/buildroot-files.txt" -grep -Fq "buildroot-$BUILDROOT_VERSION/support/libtool/" "$WORK_DIR/buildroot-files.txt" - -git -C "$ROOT_DIR" archive --format=tar "$RELEASE_TAG" | - gzip -n > "$BUNDLE_DIR/TermOS-source-$RELEASE_TAG.tar.gz" - -for doc in \ - docs/THIRD_PARTY_NOTICES.md \ - docs/THIRD_PARTY_COMPONENTS_0.2.0.csv \ - docs/THIRD_PARTY_LICENSE_REVIEW_0.2.0.md \ - docs/COMPLIANCE_CHECKLIST_0.2.0.md; do - if [[ -f "$ROOT_DIR/$doc" ]]; then - cp "$ROOT_DIR/$doc" "$BUNDLE_DIR/compliance-docs/" - fi -done - -cat > "$BUNDLE_DIR/README.txt" < SHA256SUMS -) - -FINAL_ARCHIVE="$OUTPUT_DIR/TermOS-Corresponding-Source-$RELEASE_TAG.tar.gz" -tar -C "$WORK_DIR" -czf "$FINAL_ARCHIVE" "$BUNDLE_NAME" -( - cd "$OUTPUT_DIR" - sha256sum "$(basename "$FINAL_ARCHIVE")" > "$(basename "$FINAL_ARCHIVE").sha256" -) -echo "Created: $FINAL_ARCHIVE" -cat "$FINAL_ARCHIVE.sha256" diff --git a/scripts/build-iso.sh b/scripts/build-iso.sh new file mode 100755 index 0000000..bd19f0f --- /dev/null +++ b/scripts/build-iso.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$ROOT_DIR" + +if [[ "${EUID}" -ne 0 ]]; then + if ! command -v sudo >/dev/null 2>&1; then + echo "ERROR: live-build must run as root; install sudo or run as root." >&2 + exit 1 + fi + exec sudo -E "$0" "$@" +fi + +command -v lb >/dev/null 2>&1 || { + echo "ERROR: live-build is not installed. See docs/BUILDING.md." >&2 + exit 1 +} + +lb config +lb build + +ISO="$ROOT_DIR/live-image-amd64.hybrid.iso" +if [[ ! -s "$ISO" ]]; then + echo "ERROR: live-build completed but expected ISO was not found: $ISO" >&2 + exit 1 +fi + +sha256sum "$ISO" | tee "$ISO.sha256" +echo "Build completed: $ISO" diff --git a/scripts/build.sh b/scripts/build.sh deleted file mode 100755 index 191dac7..0000000 --- a/scripts/build.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env bash -set -Eeuo pipefail - -ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" - -# Prevent Git from detecting the parent TermOS repository as Buildroot. -export GIT_CEILING_DIRECTORIES="$ROOT_DIR" - -BR_VERSION="2025.02.19" -SRC_DIR="$ROOT_DIR/src" -BR_DIR="$SRC_DIR/buildroot-$BR_VERSION" -DOWNLOAD_DIR="$ROOT_DIR/downloads" -BUILD_DIR="$ROOT_DIR/build" - -ARCHIVE="$DOWNLOAD_DIR/buildroot-$BR_VERSION.tar.xz" -PARTIAL_ARCHIVE="$ARCHIVE.part" -URL="https://buildroot.org/downloads/buildroot-$BR_VERSION.tar.xz" - -JOBS_COUNT="${JOBS:-$(nproc)}" -if [[ ! "$JOBS_COUNT" =~ ^[1-9][0-9]*$ ]]; then - echo "ERROR: JOBS must be a positive integer; received: $JOBS_COUNT" >&2 - exit 2 -fi - -mkdir -p "$SRC_DIR" "$DOWNLOAD_DIR" "$BUILD_DIR" - -# A previous interrupted download must never be mistaken for a valid archive. -if [[ -f "$ARCHIVE" ]] && ! xz -t "$ARCHIVE" >/dev/null 2>&1; then - echo "WARNING: Existing Buildroot archive is corrupt; downloading it again." >&2 - rm -f "$ARCHIVE" -fi - -if [[ ! -f "$BR_DIR/Makefile" ]]; then - if [[ ! -f "$ARCHIVE" ]]; then - echo "Downloading Buildroot $BR_VERSION..." - rm -f "$PARTIAL_ARCHIVE" - curl --fail --location --retry 3 --retry-delay 2 --retry-all-errors \ - "$URL" --output "$PARTIAL_ARCHIVE" - xz -t "$PARTIAL_ARCHIVE" - mv -- "$PARTIAL_ARCHIVE" "$ARCHIVE" - fi - - echo "Extracting Buildroot $BR_VERSION..." - tar -xJf "$ARCHIVE" -C "$SRC_DIR" -fi - -if [[ ! -f "$BR_DIR/Makefile" ]]; then - echo "ERROR: Buildroot source not found at $BR_DIR" >&2 - exit 1 -fi - -cd "$BR_DIR" - -make O="$BUILD_DIR" \ - BR2_DEFCONFIG="$ROOT_DIR/configs/termos_defconfig" \ - defconfig - -make O="$BUILD_DIR" -j"$JOBS_COUNT" - -ISO="$BUILD_DIR/images/rootfs.iso9660" - -if [[ ! -s "$ISO" ]]; then - echo "ERROR: Build finished but ISO was not found." >&2 - exit 1 -fi - -echo -echo "Build completed successfully." -ls -lh "$ISO" -sha256sum "$ISO" diff --git a/scripts/clean-build.sh b/scripts/clean-build.sh new file mode 100755 index 0000000..2489864 --- /dev/null +++ b/scripts/clean-build.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$ROOT_DIR" + +if [[ "${EUID}" -ne 0 ]]; then + exec sudo -E "$0" "$@" +fi + +command -v lb >/dev/null 2>&1 || { + echo "ERROR: live-build is not installed." >&2 + exit 1 +} + +lb clean --purge diff --git a/scripts/generate-legal-review.py b/scripts/generate-legal-review.py deleted file mode 100644 index 9dffdcc..0000000 --- a/scripts/generate-legal-review.py +++ /dev/null @@ -1,199 +0,0 @@ -#!/usr/bin/env python3 -"""Create a compact Buildroot legal-info review bundle; this is not a legal opinion.""" -from __future__ import annotations - -import argparse -import csv -import json -import re -import shutil -from pathlib import Path - -REQUIRED_COLUMNS = ("package", "version", "license", "license files", "source archive") -COPY_FILES = ("README", "manifest.csv", "host-manifest.csv", "buildroot.config", "legal-info.sha256") - - -def normalized(value: object) -> str: - return re.sub(r"\s+", " ", str(value or "").strip()).lower() - - -def read_manifest(path: Path, scope: str, legal_info: Path) -> list[dict[str, str]]: - with path.open("r", encoding="utf-8-sig", newline="") as stream: - reader = csv.DictReader(stream) - if not reader.fieldnames: - raise ValueError(f"{path.name}: missing CSV header") - fields = {normalized(name): name for name in reader.fieldnames} - missing = [name for name in REQUIRED_COLUMNS if name not in fields] - if missing: - raise ValueError(f"{path.name}: missing required columns: {', '.join(missing)}") - - source_root = legal_info / ("host-sources" if scope == "host" else "sources") - rows: list[dict[str, str]] = [] - for raw in reader: - row = {key: str(raw.get(original) or "").strip() for key, original in fields.items()} - package = row["package"] - if not package: - continue - license_name = row["license"] - license_files = row["license files"] - source_archive = row["source archive"] - - license_review = ( - "manual-identification-required" - if normalized(license_name) in {"", "unknown", "n/a", "not defined"} - else "declared-license-requires-human-review" - ) - license_text_status = ( - "not-collected-or-not-declared" - if normalized(license_files) in {"", "not saved", "unknown"} - else "declared-in-manifest-check-bundle" - ) - if normalized(source_archive) in {"", "not saved", "unknown"}: - source_status = "not-saved-or-not-declared" - else: - basename = Path(source_archive).name - matches = list(source_root.rglob(basename)) if source_root.exists() else [] - source_status = "present-in-legal-info" if matches else "archive-not-found-by-name" - - rows.append({ - "scope": scope, - "package": package, - "version": row["version"], - "license": license_name, - "license_files": license_files, - "license_text_status": license_text_status, - "source_archive": source_archive, - "source_status": source_status, - "license_review": license_review, - }) - return rows - - -def write_components_csv(rows: list[dict[str, str]], output: Path) -> None: - columns = [ - "scope", "package", "version", "license", "license_files", - "license_text_status", "source_archive", "source_status", "license_review", - ] - with (output / "components.csv").open("w", encoding="utf-8", newline="") as stream: - writer = csv.DictWriter(stream, fieldnames=columns) - writer.writeheader() - writer.writerows(rows) - - -def markdown_table(rows: list[dict[str, str]]) -> str: - lines = [ - "| Package | Version | Buildroot-declared license | License files (manifest) | Source archive status |", - "|---|---|---|---|---|", - ] - for row in rows: - def cell(value: str) -> str: - return value.replace("|", r"\|").replace("\n", " ") - lines.append( - f"| {cell(row['package'])} | {cell(row['version'])} | " - f"{cell(row['license'])} | {cell(row['license_files'])} | " - f"{cell(row['source_status'])} |" - ) - return "\n".join(lines) - - -def main() -> int: - parser = argparse.ArgumentParser() - parser.add_argument("--legal-info", type=Path, required=True) - parser.add_argument("--output", type=Path, required=True) - args = parser.parse_args() - legal_info = args.legal_info.resolve() - output = args.output.resolve() - - for required in ("README", "manifest.csv", "host-manifest.csv", "buildroot.config"): - if not (legal_info / required).is_file(): - raise SystemExit(f"Missing required legal-info evidence: {required}") - - if output.exists(): - shutil.rmtree(output) - output.mkdir(parents=True) - - for name in COPY_FILES: - source = legal_info / name - if source.is_file(): - shutil.copy2(source, output / name) - for directory in ("licenses", "host-licenses"): - source = legal_info / directory - if source.is_dir(): - shutil.copytree(source, output / directory) - - target_rows = read_manifest(legal_info / "manifest.csv", "target", legal_info) - host_rows = read_manifest(legal_info / "host-manifest.csv", "host", legal_info) - all_rows = target_rows + host_rows - write_components_csv(all_rows, output) - - index_lines = [] - for scope, folder in (("target", "sources"), ("host", "host-sources")): - source_root = legal_info / folder - if source_root.exists(): - for path in sorted(source_root.rglob("*")): - if path.is_file(): - relative = path.relative_to(source_root).as_posix() - index_lines.append(f"{scope}/{relative}\t{path.stat().st_size} bytes") - (output / "source-archive-index.txt").write_text( - "\n".join(index_lines) + ("\n" if index_lines else ""), encoding="utf-8" - ) - - unknown = [r for r in all_rows if r["license_review"] == "manual-identification-required"] - missing_sources = [r for r in all_rows if r["source_status"] != "present-in-legal-info"] - missing_licenses = [r for r in all_rows if r["license_text_status"] == "not-collected-or-not-declared"] - - report = [ - "# TermOS 0.2.0 — Third-party notices and inventory", - "", - "> Generated from Buildroot legal-info metadata. Inventory and triage only; not a legal opinion or compliance certificate.", - "", - "## Scope", - "", - "- Target components: manifest.csv, as declared by Buildroot.", - "- Host components: host-manifest.csv; build-time tools are not automatically part of the target image.", - "- Collected license texts: licenses/ and host-licenses/.", - "- Source archive index: source-archive-index.txt.", - "", - "## Automated triage", - "", - f"- Target package entries: {len(target_rows)}", - f"- Host package entries: {len(host_rows)}", - f"- Entries with unknown/empty declared license: {len(unknown)}", - f"- Entries without a source archive located by manifest filename: {len(missing_sources)}", - f"- Entries whose license-file field is empty/unknown/not saved: {len(missing_licenses)}", - "", - "These counts are review flags. A source archive not saved is not automatically a violation for every license; a saved archive does not prove that all corresponding-source requirements are met.", - "", - "## Target components", - "", - markdown_table(target_rows), - "", - "## Host components", - "", - markdown_table(host_rows), - "", - "## Required human review", - "", - "1. Compare each declared license with the actual upstream license text for the exact version.", - "2. Determine obligations separately for target components and host-only build tools.", - "3. For copyleft components, verify complete corresponding source, applicable Buildroot patches, configuration, and build/installation scripts as required by the specific license.", - "4. Resolve every warning in the adjacent Buildroot README; inspect legal-info.sha256 when present.", - "5. Do not use this generated table as legal certification. Buildroot warns that package metadata may be inaccurate or incomplete and requires human review.", - "", - ] - (output / "THIRD_PARTY_NOTICES.md").write_text("\n".join(report), encoding="utf-8") - summary = { - "target_package_count": len(target_rows), - "host_package_count": len(host_rows), - "unknown_license_entries": len(unknown), - "source_archive_not_found_entries": len(missing_sources), - "license_file_field_missing_entries": len(missing_licenses), - "human_review_required": True, - } - (output / "summary.json").write_text(json.dumps(summary, indent=2) + "\n", encoding="utf-8") - print(json.dumps(summary, sort_keys=True)) - return 0 - - -if __name__ == "__main__": - raise SystemExit(main()) diff --git a/scripts/package-tpm-release.sh b/scripts/package-tpm-release.sh deleted file mode 100755 index 69a2546..0000000 --- a/scripts/package-tpm-release.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash -set -Eeuo pipefail -ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" -VERSION="$(tr -d '\r\n' < "$ROOT_DIR/tpm/VERSION")" -[[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "Invalid TPM version: $VERSION" >&2; exit 1; } -OUT="$ROOT_DIR/dist" -STAGE="$(mktemp -d)" -trap 'rm -rf "$STAGE"' EXIT -NAME="TermOS-TPM-$VERSION" -mkdir -p "$STAGE/$NAME/tpm" "$STAGE/$NAME/docs" -cp -a "$ROOT_DIR/tpm/tpm"/*.py "$STAGE/$NAME/tpm/" -cp -a "$ROOT_DIR/tpm/README.md" "$ROOT_DIR/tpm/pyproject.toml" "$ROOT_DIR/tpm/VERSION" "$STAGE/$NAME/" -cp -a "$ROOT_DIR/docs/TPK_FORMAT.md" "$STAGE/$NAME/docs/" - -mkdir -p "$STAGE/$NAME/tests" -find "$ROOT_DIR/tpm/tests" -maxdepth 1 -type f -name '*.py' \ - -exec cp -a {} "$STAGE/$NAME/tests/" \; - -cp -a "$ROOT_DIR/LICENSE" "$STAGE/$NAME/" -mkdir -p "$OUT" -tar -czf "$OUT/$NAME.tar.gz" -C "$STAGE" "$NAME" -( - cd "$OUT" - sha256sum "$NAME.tar.gz" > "$NAME.tar.gz.sha256" -) -echo "Created: $OUT/$NAME.tar.gz" -cat "$OUT/$NAME.tar.gz.sha256" diff --git a/scripts/prepare-tpm-system-test-repo.sh b/scripts/prepare-tpm-system-test-repo.sh deleted file mode 100755 index 7ceb233..0000000 --- a/scripts/prepare-tpm-system-test-repo.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env bash -set -Eeuo pipefail -ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" -PRIVATE_KEY="$ROOT_DIR/keys/termos-repo-private.pem" -[[ -s "$PRIVATE_KEY" ]] || { echo "Missing private repository signing key: $PRIVATE_KEY" >&2; exit 1; } -command -v openssl >/dev/null 2>&1 || { echo "Host openssl is required" >&2; exit 1; } -mkdir -p "$ROOT_DIR/dist" -REPO_ROOT="$(mktemp -d "$ROOT_DIR/dist/tpm-system-root-repo.XXXXXX")" -mkdir -p "$REPO_ROOT/v1" "$REPO_ROOT/v2" -ARCH="$(uname -m)" - -for spec in "1.0.0:Version 1" "1.1.0:Version 2"; do - version="${spec%%:*}" - label="${spec#*:}" - source="$(mktemp -d)" - mkdir -p "$source/usr/share/termos/tpm-system-root-smoke" - printf 'TermOS TPM system-root integration test: %s\n' "$label" \ - > "$source/usr/share/termos/tpm-system-root-smoke/installed.txt" - output="$REPO_ROOT/v${version%%.*}/tpm-system-root-smoke-${version}-${ARCH}.tpk" - # v1 and v2 are stored in separate signed indexes for an unambiguous upgrade test. - if [[ "$version" == "1.0.0" ]]; then output="$REPO_ROOT/v1/tpm-system-root-smoke-${version}-${ARCH}.tpk"; repo="$REPO_ROOT/v1"; - else output="$REPO_ROOT/v2/tpm-system-root-smoke-${version}-${ARCH}.tpk"; repo="$REPO_ROOT/v2"; fi - python3 -m tpm.tpm build "$source" \ - --name tpm-system-root-smoke --version "$version" --arch "$ARCH" \ - --description "Disposable TermOS system-root integration test" \ - --output "$output" - rm -rf "$source" - python3 -m tpm.tpm repo index "$repo" \ - --name "TermOS TPM System Root Test $version" - python3 -m tpm.tpm repo sign "$repo/repository.json" --private-key "$PRIVATE_KEY" - python3 -m tpm.tpm repo verify "$repo/repository.json" \ - --public-key "$ROOT_DIR/keys/termos-repo-public.pem" -done - -echo "Signed system-root test repositories created:" -echo " v1: $REPO_ROOT/v1" -echo " v2: $REPO_ROOT/v2" -echo "Copy the whole directory to a disposable TermOS QEMU/VMware guest." -echo "The private key was used on the host only and is not included in either repository." diff --git a/scripts/run-qemu.sh b/scripts/run-qemu.sh deleted file mode 100755 index 59cb7f6..0000000 --- a/scripts/run-qemu.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -TERMOS_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" -ISO="$TERMOS_DIR/build/images/rootfs.iso9660" - -OVMF_CODE="${OVMF_CODE:-/usr/share/OVMF/OVMF_CODE_4M.fd}" -OVMF_VARS_TEMPLATE="${OVMF_VARS_TEMPLATE:-/usr/share/OVMF/OVMF_VARS_4M.fd}" -OVMF_VARS="$TERMOS_DIR/build/OVMF_VARS_TermOS.fd" - -if [[ ! -f "$ISO" ]]; then - echo "ERROR: TermOS ISO not found: $ISO" >&2 - exit 1 -fi - -if [[ ! -f "$OVMF_CODE" ]]; then - echo "ERROR: OVMF firmware not found: $OVMF_CODE" >&2 - exit 1 -fi - -if [[ ! -f "$OVMF_VARS" ]]; then - if [[ ! -f "$OVMF_VARS_TEMPLATE" ]]; then - echo "ERROR: OVMF variables template not found: $OVMF_VARS_TEMPLATE" >&2 - exit 1 - fi - cp "$OVMF_VARS_TEMPLATE" "$OVMF_VARS" -fi - -exec qemu-system-x86_64 \ - -machine q35 \ - -m 1024 \ - -drive "if=pflash,format=raw,unit=0,readonly=on,file=$OVMF_CODE" \ - -drive "if=pflash,format=raw,unit=1,file=$OVMF_VARS" \ - -cdrom "$ISO" \ - -boot order=d,menu=on \ - -nic user,model=virtio-net-pci \ - -no-reboot \ - "$@" diff --git a/scripts/test-tpm-guest.sh b/scripts/test-tpm-guest.sh deleted file mode 100755 index 9694b43..0000000 --- a/scripts/test-tpm-guest.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -set -eu - -TPM="${TPM:-/usr/bin/tpm}" -WORK="$(mktemp -d /tmp/termos-tpm-smoke.XXXXXX)" -cleanup() { rm -rf "$WORK"; } -trap cleanup EXIT HUP INT TERM - -fail() { echo "[FAIL] $*" >&2; exit 1; } -echo "===== TERMOS TPM GUEST SMOKE TEST =====" - -"$TPM" --help >/dev/null || fail "TPM CLI did not start" -"$TPM" repo --help >/dev/null || fail "TPM repository CLI did not start" -command -v openssl >/dev/null 2>&1 || fail "OpenSSL CLI is missing" -openssl version -python3 -c 'import ssl, tarfile, hashlib, json; print("Python runtime modules: OK")' \ - || fail "Required Python runtime modules are missing" -[ -s /etc/termos/repository-ed25519.pub ] || fail "Trusted repository public key is missing" - -mkdir -p "$WORK/v1/usr/bin" "$WORK/v2/usr/bin" -cat > "$WORK/v1/usr/bin/tpm-guest-smoke" <<'EOF' -#!/bin/sh -echo "TPM guest package version 1" -EOF -cat > "$WORK/v2/usr/bin/tpm-guest-smoke" <<'EOF' -#!/bin/sh -echo "TPM guest package version 2" -EOF -chmod 0755 "$WORK/v1/usr/bin/tpm-guest-smoke" "$WORK/v2/usr/bin/tpm-guest-smoke" - -ARCH="$(uname -m)" -"$TPM" build "$WORK/v1" --name tpm-guest-smoke --version 1.0.0 \ - --arch "$ARCH" --description "TermOS VM smoke test" -o "$WORK/tpm-guest-smoke-1.0.0.tpk" -"$TPM" build "$WORK/v2" --name tpm-guest-smoke --version 1.1.0 \ - --arch "$ARCH" --description "TermOS VM smoke test" -o "$WORK/tpm-guest-smoke-1.1.0.tpk" - -ROOT="$WORK/root" -"$TPM" init-root --root "$ROOT" -"$TPM" install "$WORK/tpm-guest-smoke-1.0.0.tpk" --root "$ROOT" -[ "$("$ROOT/usr/bin/tpm-guest-smoke")" = "TPM guest package version 1" ] || fail "Initial package execution failed" -"$TPM" upgrade "$WORK/tpm-guest-smoke-1.1.0.tpk" --root "$ROOT" -"$TPM" verify --root "$ROOT" -[ "$("$ROOT/usr/bin/tpm-guest-smoke")" = "TPM guest package version 2" ] || fail "Upgraded package execution failed" -"$TPM" remove tpm-guest-smoke --root "$ROOT" -"$TPM" verify --root "$ROOT" -[ ! -e "$ROOT/usr/bin/tpm-guest-smoke" ] || fail "Package file remained after removal" - -echo "[PASS] Sandbox install, upgrade, verify, execution, and remove" -if [ "$(id -u)" = "0" ]; then - "$TPM" --system list >/dev/null || fail "TermOS system-root read-only check failed" - echo "[PASS] Guarded TermOS system-root read-only check" -else - echo "[SKIP] System-root check requires root; sandbox tests passed" -fi - -echo "TERMOS TPM GUEST SMOKE TEST PASSED" diff --git a/scripts/test-tpm-system-root.sh b/scripts/test-tpm-system-root.sh deleted file mode 100755 index fd76a43..0000000 --- a/scripts/test-tpm-system-root.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -set -eu - -REPO_ROOT="${1:-}" -[ -n "$REPO_ROOT" ] || { echo "Usage: $0 /path/to/tpm-system-root-repo" >&2; exit 2; } -[ "$(id -u)" = "0" ] || { echo "Run this test as root inside the disposable TermOS VM." >&2; exit 1; } -[ -s /etc/termos-release ] || { echo "Not a TermOS system image." >&2; exit 1; } -[ -s /etc/termos/repository-ed25519.pub ] || { echo "Trusted repository public key missing." >&2; exit 1; } - -V1="$REPO_ROOT/v1" -V2="$REPO_ROOT/v2" -P1="$(find "$V1" -maxdepth 1 -type f -name '*.tpk' | head -n 1)" -P2="$(find "$V2" -maxdepth 1 -type f -name '*.tpk' | head -n 1)" -[ -n "$P1" ] && [ -s "$P1" ] || { echo "v1 package missing" >&2; exit 1; } -[ -n "$P2" ] && [ -s "$P2" ] || { echo "v2 package missing" >&2; exit 1; } - -TARGET="/usr/share/termos/tpm-system-root-smoke/installed.txt" -echo "This test writes only one disposable text file under /usr/share/termos." -echo "It installs v1, upgrades to v2, verifies, and then removes the test package." - -/usr/bin/tpm install "$P1" --system --repo "$V1" -/usr/bin/tpm verify tpm-system-root-smoke --system -[ -s "$TARGET" ] || { echo "Installed payload missing" >&2; exit 1; } -grep -q 'Version 1' "$TARGET" || { echo "Unexpected v1 payload" >&2; exit 1; } - -/usr/bin/tpm upgrade "$P2" --system --repo "$V2" -/usr/bin/tpm verify tpm-system-root-smoke --system -grep -q 'Version 2' "$TARGET" || { echo "Upgrade payload not present" >&2; exit 1; } - -/usr/bin/tpm remove tpm-system-root-smoke --system -[ ! -e "$TARGET" ] || { echo "Package payload remains after removal" >&2; exit 1; } -/usr/bin/tpm verify --system - -echo "TPM SYSTEM-ROOT INSTALL / UPGRADE / REMOVE TEST PASSED" diff --git a/scripts/verify-iso.sh b/scripts/verify-iso.sh new file mode 100755 index 0000000..86c30fa --- /dev/null +++ b/scripts/verify-iso.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" +ISO="${1:-$ROOT_DIR/live-image-amd64.hybrid.iso}" + +if [[ ! -s "$ISO" ]]; then + echo "ERROR: ISO not found or empty: $ISO" >&2 + exit 1 +fi + +file "$ISO" +sha256sum "$ISO" diff --git a/src/termos/__init__.py b/src/termos/__init__.py new file mode 100644 index 0000000..d106be6 --- /dev/null +++ b/src/termos/__init__.py @@ -0,0 +1,3 @@ +"""TermOS Python application layer.""" + +__version__ = "0.3.0.dev0" diff --git a/src/termos/__main__.py b/src/termos/__main__.py new file mode 100644 index 0000000..bfdcd0c --- /dev/null +++ b/src/termos/__main__.py @@ -0,0 +1,4 @@ +from .cli import main + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/src/termos/cli.py b/src/termos/cli.py new file mode 100644 index 0000000..3e5dd3f --- /dev/null +++ b/src/termos/cli.py @@ -0,0 +1,51 @@ +"""Initial TermOS command-line entry point.""" + +from __future__ import annotations + +import argparse +import platform +from pathlib import Path + +from . import __version__ + + +def _read_os_release() -> dict[str, str]: + values: dict[str, str] = {} + try: + for line in Path("/etc/os-release").read_text(encoding="utf-8").splitlines(): + if "=" not in line or line.startswith("#"): + continue + key, value = line.split("=", 1) + values[key] = value.strip().strip('"') + except OSError: + pass + return values + + +def system_info() -> dict[str, str]: + release = _read_os_release() + return { + "distribution": release.get("PRETTY_NAME", "Unknown distribution"), + "kernel": platform.release(), + "architecture": platform.machine(), + "python": platform.python_version(), + } + + +def build_parser() -> argparse.ArgumentParser: + parser = argparse.ArgumentParser(prog="termos", description="TermOS command-line interface") + parser.add_argument("--version", action="version", version=f"%(prog)s {__version__}") + subparsers = parser.add_subparsers(dest="command") + subparsers.add_parser("info", help="show basic host system information") + return parser + + +def main(argv: list[str] | None = None) -> int: + parser = build_parser() + args = parser.parse_args(argv) + if args.command == "info": + for key, value in system_info().items(): + print(f"{key:14} {value}") + return 0 + parser.print_help() + return 0 diff --git a/tests/test_cli.py b/tests/test_cli.py new file mode 100644 index 0000000..e71a993 --- /dev/null +++ b/tests/test_cli.py @@ -0,0 +1,22 @@ +import unittest + +from termos import __version__ +from termos.cli import build_parser, system_info + + +class CliTests(unittest.TestCase): + def test_version_is_development_version(self): + self.assertTrue(__version__.startswith("0.3.0")) + + def test_parser_accepts_info(self): + args = build_parser().parse_args(["info"]) + self.assertEqual(args.command, "info") + + def test_system_info_has_expected_fields(self): + info = system_info() + self.assertEqual(set(info), {"distribution", "kernel", "architecture", "python"}) + self.assertTrue(all(isinstance(value, str) for value in info.values())) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_dashboard.py b/tests/test_dashboard.py deleted file mode 100644 index 53bdec0..0000000 --- a/tests/test_dashboard.py +++ /dev/null @@ -1,66 +0,0 @@ -import importlib.util -import io -import re -import unittest -from contextlib import redirect_stdout -from pathlib import Path -from unittest.mock import patch - - -DASHBOARD_PATH = ( - Path(__file__).resolve().parents[1] - / "board" - / "termos" - / "rootfs-overlay" - / "opt" - / "termos" - / "dashboard.py" -) - -spec = importlib.util.spec_from_file_location("termos_dashboard", DASHBOARD_PATH) -if spec is None or spec.loader is None: - raise RuntimeError(f"Unable to load dashboard module from {DASHBOARD_PATH}") -dashboard = importlib.util.module_from_spec(spec) -spec.loader.exec_module(dashboard) - - -ANSI_RE = re.compile(r"\x1b\[[0-9;]*m") - - -class DashboardFormattingTests(unittest.TestCase): - def test_format_bytes_uses_binary_units(self): - self.assertEqual(dashboard.format_bytes(0), "0.0 B") - self.assertEqual(dashboard.format_bytes(1024), "1.0 KB") - self.assertEqual(dashboard.format_bytes(1024**2), "1.0 MB") - self.assertEqual(dashboard.format_bytes(1024**3), "1.0 GB") - self.assertEqual(dashboard.format_bytes(1024**4), "1.0 TB") - - def test_format_bytes_handles_fractional_values(self): - self.assertEqual(dashboard.format_bytes(1536), "1.5 KB") - - def test_bar_renders_expected_number_of_cells(self): - rendered = ANSI_RE.sub("", dashboard.bar(50, width=20)) - self.assertEqual(rendered.count("#"), 10) - self.assertEqual(rendered.count("-"), 10) - - def test_bar_clamps_percentages(self): - empty = ANSI_RE.sub("", dashboard.bar(-10, width=10)) - full = ANSI_RE.sub("", dashboard.bar(150, width=10)) - self.assertEqual(empty, "-" * 10) - self.assertEqual(full, "#" * 10) - - def test_format_uptime_returns_a_readable_value(self): - uptime = dashboard.format_uptime() - self.assertRegex(uptime, r"^(?:\d+d )?\d+h \d+m$") - - - def test_dashboard_exits_cleanly_when_input_closes(self): - output = io.StringIO() - with patch("builtins.input", side_effect=EOFError): - with redirect_stdout(output): - dashboard.main() - self.assertIn("Dashboard input closed.", output.getvalue()) - - -if __name__ == "__main__": - unittest.main() diff --git a/tpm/README.md b/tpm/README.md deleted file mode 100644 index 5792203..0000000 --- a/tpm/README.md +++ /dev/null @@ -1,72 +0,0 @@ -# TermOS Package Manager (TPM) - -TPM is the terminal package manager developed for TermOS. It builds and -validates `.tpk` archives, installs/removes/upgrades packages in a marked root, -resolves local repository dependencies, and verifies signed repository indexes. - -## Requirements - -- Python 3.12 or newer. -- OpenSSL command-line utility with Ed25519 support for repository signing and - verification. -- A repository public key obtained through a trusted channel for signed-repo - operations. - -## Source-tree usage - -From the TermOS repository root: - -```sh -python3 -m tpm.tpm --help -./test_tpm.sh -./test_tpm_security.py -./test_tpm_install.sh -./test_tpm_remove.sh -./test_tpm_rollback.sh -./test_tpm_upgrade.sh -./test_tpm_dependencies.sh -./test_tpm_repository.sh -``` - -## TermOS image usage - -The integration image installs the runtime under `/opt/termos/python/tpm`, the -launcher at `/usr/bin/tpm`, and the trusted public key at -`/etc/termos/repository-ed25519.pub`. - -Sandbox operations continue to require an explicit `--root DIR`. The separate -`--system` mode is available only on a root-owned TermOS system identified by -`/etc/termos-release`. Mutating system operations require a typed confirmation -and a package present in a signature-verified repository. Example: - -```sh -tpm install packages/example-1.0.0-x86_64.tpk \ - --system --repo /var/lib/termos/repository -``` - -The trusted key defaults to `/etc/termos/repository-ed25519.pub`; an explicit -`--repo-key FILE` can override it. System-root operations require UID 0. - -**Live/ISO persistence warning:** a successful system-root operation modifies -the currently mounted `/` filesystem. Whether it survives reboot depends on the -boot/storage layout. The current TermOS preview is not a disk installer and -must not be assumed to provide persistent package storage in every live-ISO -boot mode. Test first in disposable QEMU/VMware virtual machines. - -## Security model and limitations - -- `.tpk` payload files are checked against manifest sizes and SHA-256 values. -- Repository index signatures are checked with Ed25519 and a provisioned public - key; the private key is never copied into the image. -- Sandbox root initialization and live system-root authorization are separate. -- Live system-root access is gated by root privileges, `/etc/termos-release`, - and explicit confirmation for install/remove/upgrade. -- TPM version 1 does not execute package maintainer scripts and does not support - symlink payloads. It is not a general-purpose replacement for mature package - managers and remains experimental. -- Current transaction tests inject software failures. They do not prove - recovery after power loss, kernel panic, or sudden hardware failure. -- Repository sync over HTTPS, key rotation, revocation, and repository freshness - policy are not provided by this integration step. - -See [`../docs/TPK_FORMAT.md`](../docs/TPK_FORMAT.md) for the archive specification. diff --git a/tpm/VERSION b/tpm/VERSION deleted file mode 100644 index 6e8bf73..0000000 --- a/tpm/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.1.0 diff --git a/tpm/pyproject.toml b/tpm/pyproject.toml deleted file mode 100644 index 14f7d5d..0000000 --- a/tpm/pyproject.toml +++ /dev/null @@ -1,28 +0,0 @@ -[build-system] -requires = ["setuptools>=68"] -build-backend = "setuptools.build_meta" - -[project] -name = "termos-tpm" -version = "0.1.0" -description = "TermOS Package Manager" -readme = "README.md" -requires-python = ">=3.12" -license = { text = "MIT" } -authors = [{ name = "TermOS contributors" }] -dependencies = [] - -[project.optional-dependencies] -test = ["pytest>=8"] - -[project.scripts] -tpm = "tpm.cli:main" - -[tool.setuptools] -packages = ["tpm"] - - -[tool.pytest.ini_options] -testpaths = ["tests"] -python_files = ["test_*.py"] -addopts = "-ra" diff --git a/tpm/tests/__init__.py b/tpm/tests/__init__.py deleted file mode 100644 index 8b13789..0000000 --- a/tpm/tests/__init__.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tpm/tests/conftest.py b/tpm/tests/conftest.py deleted file mode 100644 index 42af6d1..0000000 --- a/tpm/tests/conftest.py +++ /dev/null @@ -1,93 +0,0 @@ -import platform - -import pytest - -from tpm.package import build_package - - -@pytest.fixture -def workspace(tmp_path): - """An isolated temporary workspace for one test.""" - return tmp_path - - -def _build_fixture(workspace, name, version, files, description): - source = workspace / f"source-{name}-{version}" - output = workspace / f"{name}-{version}.tpk" - - for relative, (text, mode) in files.items(): - target = source.joinpath(*relative.split("/")) - target.parent.mkdir(parents=True, exist_ok=True) - target.write_text(text, encoding="utf-8") - target.chmod(mode) - - build_package( - source=source, - output=output, - name=name, - version=version, - architecture=platform.machine(), - description=description, - ) - return output - - -@pytest.fixture -def package(workspace): - """A two-file package used by rollback tests.""" - return _build_fixture( - workspace, - "hello-termos", - "1.0.0", - { - "usr/bin/hello-termos": ( - "#!/bin/sh\necho TPM pytest fixture\n", 0o755 - ), - "usr/share/doc/hello-termos/README.txt": ( - "Temporary TPM rollback fixture.\n", 0o644 - ), - }, - "Temporary TPM rollback test package", - ) - - -@pytest.fixture -def package_v1(workspace): - return _build_fixture( - workspace, - "hello-upgrade", - "1.0.0", - { - "usr/bin/hello-upgrade": ( - "#!/bin/sh\necho Version 1\n", 0o755 - ), - "usr/share/doc/hello-upgrade/kept.txt": ( - "old documentation\n", 0o644 - ), - "usr/share/doc/hello-upgrade/obsolete.txt": ( - "obsolete file\n", 0o644 - ), - }, - "TPM upgrade integration test", - ) - - -@pytest.fixture -def package_v2(workspace): - return _build_fixture( - workspace, - "hello-upgrade", - "1.1.0", - { - "usr/bin/hello-upgrade": ( - "#!/bin/sh\necho Version 2\n", 0o755 - ), - "usr/share/doc/hello-upgrade/kept.txt": ( - "updated documentation\n", 0o644 - ), - "usr/share/doc/hello-upgrade/added.txt": ( - "new documentation\n", 0o644 - ), - }, - "TPM upgrade integration test", - ) diff --git a/tpm/tests/test_dependencies.py b/tpm/tests/test_dependencies.py deleted file mode 100644 index ed13d60..0000000 --- a/tpm/tests/test_dependencies.py +++ /dev/null @@ -1,292 +0,0 @@ -import platform -import subprocess -import sys -import tempfile -from pathlib import Path -from unittest.mock import patch - -from tpm import manager as manager_module -from tpm.database import initialize_root, load_database -from tpm.dependencies import DependencyError, parse_dependency -from tpm.installer import install_package, verify_installed -from tpm.manager import install_with_dependencies -from tpm.package import build_package, validate_package -from tpm.uninstaller import UninstallError, remove_package -from tpm.upgrade import UpgradeError, upgrade_package - - -TPM_PROJECT_DIR = Path(__file__).resolve().parents[1] -PROJECT_ROOT = TPM_PROJECT_DIR.parent -BUILD_DIR = PROJECT_ROOT / "build" - - -def make_package(workspace, name, version, depends=None): - source = workspace / f"source-{name}-{version}" - output = workspace / f"{name}-{version}.tpk" - payload = source / "usr" / "share" / name / "version.txt" - payload.parent.mkdir(parents=True, exist_ok=True) - payload.write_text(f"{name} {version}\n", encoding="utf-8") - build_package( - source=source, - output=output, - name=name, - version=version, - architecture=platform.machine(), - description=f"Dependency test package {name}", - depends=depends or [], - ) - return output - - -def new_root(label, base_dir=None): - base = Path(base_dir) if base_dir is not None else BUILD_DIR - base.mkdir(parents=True, exist_ok=True) - root = Path(tempfile.mkdtemp(prefix=f"tpm-deps-{label}-", dir=base)) - initialize_root(root) - return root - - - -def test_cli_build_and_local_repo_install(workspace): - print("\n===== CLI BUILD / LOCAL REPOSITORY INSTALL =====") - repo = workspace / "repo-cli" - repo.mkdir() - - lib_source = workspace / "cli-lib-source" - lib_payload = lib_source / "usr" / "share" / "cli-lib" / "version.txt" - lib_payload.parent.mkdir(parents=True, exist_ok=True) - lib_payload.write_text("cli-lib 1.0.0\n", encoding="utf-8") - lib_archive = repo / "cli-lib-1.0.0.tpk" - subprocess.run( - [ - sys.executable, "-m", "tpm", "build", str(lib_source), - "--name", "cli-lib", "--version", "1.0.0", - "--arch", platform.machine(), "-o", str(lib_archive), - ], - cwd=TPM_PROJECT_DIR, check=True, capture_output=True, text=True, - ) - - app_source = workspace / "cli-app-source" - app_payload = app_source / "usr" / "share" / "cli-app" / "version.txt" - app_payload.parent.mkdir(parents=True, exist_ok=True) - app_payload.write_text("cli-app 1.0.0\n", encoding="utf-8") - app_archive = workspace / "cli-app-1.0.0.tpk" - subprocess.run( - [ - sys.executable, "-m", "tpm", "build", str(app_source), - "--name", "cli-app", "--version", "1.0.0", - "--arch", platform.machine(), "--depends", "cli-lib>=1.0.0", - "-o", str(app_archive), - ], - cwd=TPM_PROJECT_DIR, check=True, capture_output=True, text=True, - ) - - root = new_root("cli", workspace) - subprocess.run( - [sys.executable, "-m", "tpm", "install", str(app_archive), - "--root", str(root), "--repo", str(repo)], - cwd=TPM_PROJECT_DIR, check=True, capture_output=True, text=True, - ) - packages = load_database(root)["packages"] - assert set(packages) == {"cli-lib", "cli-app"} - assert packages["cli-app"]["depends"] == ["cli-lib>=1.0.0"] - print("[PASS] CLI --depends and --repo built and installed the dependency graph") - -def test_constraint_parser(): - assert parse_dependency("libfoo>=1.2.0") == { - "name": "libfoo", "operator": ">=", "version": "1.2.0" - } - assert parse_dependency("libfoo=1.2.0")["operator"] == "==" - print("[PASS] Dependency constraint parser") - - -def test_local_repo_install_and_remove_guard(workspace): - print("\n===== LOCAL REPOSITORY INSTALL / REMOVE GUARD =====") - repo = workspace / "repo-success" - repo.mkdir() - lib = make_package(workspace, "libmath", "1.2.0") - app = make_package(workspace, "calculator", "1.0.0", ["libmath>=1.2.0"]) - (repo / lib.name).write_bytes(lib.read_bytes()) - - root = new_root("success", workspace) - result = install_with_dependencies(app, root, [repo]) - assert result["dependencies_installed"] == 1 - database = load_database(root) - assert set(database["packages"]) == {"libmath", "calculator"} - assert database["packages"]["calculator"]["depends"] == ["libmath>=1.2.0"] - count, problems = verify_installed(root) - assert count == 2 and not problems, problems - print("[PASS] Missing dependency selected from local repository and installed first") - print("[PASS] Dependency metadata persisted in the installed database") - print("[PASS] Installed dependency graph verifies") - - try: - remove_package("libmath", root) - except UninstallError as exc: - assert "required" in str(exc).lower() or "depend" in str(exc).lower() - print(f"[PASS] Removing a required dependency was blocked: {exc}") - else: - raise AssertionError("TPM allowed removal of a required dependency") - - remove_package("calculator", root) - remove_package("libmath", root) - assert load_database(root)["packages"] == {} - print("[PASS] Dependents can be removed before their dependencies") - - -def test_missing_dependency(workspace): - print("\n===== MISSING DEPENDENCY =====") - app = make_package(workspace, "orphan-app", "1.0.0", ["libnotfound>=1.0.0"]) - root = new_root("missing", workspace) - try: - install_with_dependencies(app, root, []) - except DependencyError as exc: - assert "No compatible local package" in str(exc) - print(f"[PASS] Missing dependency rejected: {exc}") - else: - raise AssertionError("Package with missing dependency was installed") - assert load_database(root)["packages"] == {} - print("[PASS] No partial installation was left behind") - - -def test_incompatible_installed_dependency(workspace): - print("\n===== INCOMPATIBLE INSTALLED DEPENDENCY =====") - old_lib = make_package(workspace, "libcodec", "1.0.0") - app = make_package(workspace, "video-tool", "1.0.0", ["libcodec>=2.0.0"]) - root = new_root("incompatible", workspace) - install_package(old_lib, root) - try: - install_with_dependencies(app, root, []) - except DependencyError as exc: - assert "incompatible" in str(exc).lower() - print(f"[PASS] Incompatible installed version rejected: {exc}") - else: - raise AssertionError("TPM accepted an incompatible installed dependency") - packages = load_database(root)["packages"] - assert set(packages) == {"libcodec"} - print("[PASS] Existing package was not modified") - - -def test_dependency_cycle(workspace): - print("\n===== DEPENDENCY CYCLE =====") - repo = workspace / "repo-cycle" - repo.mkdir() - package_a = make_package(workspace, "cycle-a", "1.0.0", ["cycle-b>=1.0.0"]) - package_b = make_package(workspace, "cycle-b", "1.0.0", ["cycle-a>=1.0.0"]) - (repo / package_b.name).write_bytes(package_b.read_bytes()) - root = new_root("cycle", workspace) - - try: - install_with_dependencies(package_a, root, [repo]) - except DependencyError as exc: - assert "cycle" in str(exc).lower() - print(f"[PASS] Circular dependency rejected: {exc}") - else: - raise AssertionError("TPM accepted a dependency cycle") - assert load_database(root)["packages"] == {} - print("[PASS] No packages were installed") - - -def test_upgrade_preserves_dependents(workspace): - print("\n===== UPGRADE DEPENDENCY COMPATIBILITY =====") - core_v2 = make_package(workspace, "libcore", "2.0.0") - client = make_package(workspace, "core-client", "1.0.0", ["libcore<3.0.0"]) - core_v3 = make_package(workspace, "libcore", "3.0.0") - root = new_root("reverse-upgrade", workspace) - install_package(core_v2, root) - install_package(client, root) - - try: - upgrade_package(core_v3, root) - except UpgradeError as exc: - assert "dependents" in str(exc).lower() - print(f"[PASS] Upgrade that breaks an installed dependent was blocked: {exc}") - else: - raise AssertionError("TPM allowed an upgrade that violates a dependent constraint") - - packages = load_database(root)["packages"] - assert packages["libcore"]["version"] == "2.0.0" - assert packages["core-client"]["version"] == "1.0.0" - print("[PASS] Previous package versions and database were preserved") - - -def test_direct_install_requires_dependencies(workspace): - print("\n===== DIRECT INSTALL DEPENDENCY CHECK =====") - package = make_package(workspace, "direct-app", "1.0.0", ["direct-lib>=1.0.0"]) - root = new_root("direct", workspace) - try: - install_package(package, root) - except Exception as exc: - assert "dependency" in str(exc).lower() - print(f"[PASS] Low-level installer refuses missing dependencies: {exc}") - else: - raise AssertionError("Low-level installer bypassed dependency checks") - assert load_database(root)["packages"] == {} - - - -def test_dependency_transaction_rollback(workspace): - """A failed top-level install must remove dependencies installed in this operation.""" - print("\n===== DEPENDENCY GRAPH TRANSACTION ROLLBACK =====") - repository = workspace / "repo-rollback" - repository.mkdir() - - dependency_archive = make_package(workspace, "librollback", "1.0.0") - (repository / dependency_archive.name).write_bytes(dependency_archive.read_bytes()) - application_archive = make_package( - workspace, "rollback-app", "1.0.0", ["librollback>=1.0.0"] - ) - root = new_root("manager-rollback", workspace) - real_install = manager_module.install_package - attempted = [] - - def fail_on_application(archive, target_root): - manifest = validate_package(archive) - attempted.append(manifest["name"]) - if manifest["name"] == "rollback-app": - raise OSError("injected failure after dependency installation") - return real_install(archive, target_root) - - try: - with patch.object(manager_module, "install_package", side_effect=fail_on_application): - install_with_dependencies(application_archive, root, [repository]) - except OSError as exc: - if "injected failure after dependency installation" not in str(exc): - raise - print(f"[PASS] Top-level package failure injected: {exc}") - else: - raise AssertionError("Injected top-level installation failure did not occur") - - assert attempted == ["librollback", "rollback-app"], attempted - assert load_database(root)["packages"] == {}, "Dependency registration survived rollback" - assert not (root / "usr/share/librollback/version.txt").exists(), "Dependency payload survived rollback" - assert not (root / "usr/share/rollback-app/version.txt").exists(), "Application payload unexpectedly exists" - print("[PASS] Dependency installed earlier in the graph was removed") - print("[PASS] Installed-package database returned to an empty state") - - result = install_with_dependencies(application_archive, root, [repository]) - count, problems = verify_installed(root) - assert result["dependencies_installed"] == 1 - assert count == 2 and not problems, problems - print("[PASS] Normal dependency-graph installation succeeds after rollback") - - -def main(): - BUILD_DIR.mkdir(parents=True, exist_ok=True) - test_constraint_parser() - with tempfile.TemporaryDirectory(prefix="tpm-cli-fixtures-", dir=BUILD_DIR) as temp: - test_cli_build_and_local_repo_install(Path(temp)) - with tempfile.TemporaryDirectory(prefix="tpm-dependency-fixtures-", dir=BUILD_DIR) as temp: - workspace = Path(temp) - test_local_repo_install_and_remove_guard(workspace) - test_missing_dependency(workspace) - test_incompatible_installed_dependency(workspace) - test_dependency_cycle(workspace) - test_upgrade_preserves_dependents(workspace) - test_direct_install_requires_dependencies(workspace) - test_dependency_transaction_rollback(workspace) - print("\nTPM DEPENDENCY TESTS PASSED") - - -if __name__ == "__main__": - main() diff --git a/tpm/tests/test_repository.py b/tpm/tests/test_repository.py deleted file mode 100644 index 53670a1..0000000 --- a/tpm/tests/test_repository.py +++ /dev/null @@ -1,102 +0,0 @@ -import json -import tempfile -from pathlib import Path - -from tpm.package import build_package -from tpm.repository import ( - RepositoryError, build_index, generate_keypair, load_index, - search_packages, sign_index, verify_index_signature, verify_repository, -) - - -def create_package(repo, name, version, description): - source = repo.parent / f"src-{name}-{version}" - file_path = source / "usr" / "share" / name / "README.txt" - file_path.parent.mkdir(parents=True, exist_ok=True) - file_path.write_text(f"{name} {version}\\n", encoding="utf-8") - output = repo / f"{name}-{version}.tpk" - build_package(source, output, name, version, "all", description) - return output - - -def expect_rejection(call, label): - try: - call() - except RepositoryError as exc: - print(f"[PASS] {label}: {exc}") - return - raise AssertionError(f"Expected repository rejection: {label}") - - -def main(): - print("TPM STAGE 7 + 8: REPOSITORY INDEX AND ED25519 SECURITY") - with tempfile.TemporaryDirectory(prefix="tpm-repo-test-") as temporary: - work = Path(temporary) - repo = work / "repo" - repo.mkdir() - create_package(repo, "libmath", "1.2.0", "Math support library") - create_package(repo, "calculator", "1.0.0", "Command line calculator") - - index_path, index = build_index(repo, repository_name="TermOS Test Repository") - loaded = load_index(index_path) - assert len(loaded["packages"]) == 2 - print("[PASS] Repository index generated with package metadata, sizes and SHA-256") - - keys = work / "keys" - keys.mkdir() - private_key, public_key = keys / "repo-ed25519-private.pem", keys / "repo-ed25519-public.pem" - generate_keypair(private_key, public_key) - assert private_key.stat().st_mode & 0o777 == 0o600 - print("[PASS] Ed25519 key pair generated; private key permissions are 0600") - - sign_index(index_path, private_key) - verify_index_signature(index_path, public_key) - print("[PASS] Ed25519 detached signature verified") - - matches, report = search_packages(repo, "math", public_key=public_key) - assert len(matches) == 1 and matches[0]["name"] == "libmath" - assert report["archives_verified"] == 2 - print("[PASS] Search returned the matching package only after signature and archive verification") - - wrong_private, wrong_public = keys / "wrong-private.pem", keys / "wrong-public.pem" - generate_keypair(wrong_private, wrong_public) - expect_rejection(lambda: verify_repository(repo, public_key=wrong_public), "Wrong trusted key rejected") - - original_index = index_path.read_bytes() - changed = json.loads(original_index.decode("utf-8")) - changed["repository"]["name"] = "Attacker Repository" - index_path.write_text(json.dumps(changed, indent=2), encoding="utf-8") - expect_rejection(lambda: verify_repository(repo, public_key=public_key), "Modified repository index rejected") - index_path.write_bytes(original_index) - verify_repository(repo, public_key=public_key) - print("[PASS] Restored signed index verifies again") - - package_path = repo / loaded["packages"][0]["filename"] - original_package = package_path.read_bytes() - altered = bytearray(original_package) - altered[-1] = (altered[-1] + 1) % 256 - package_path.write_bytes(altered) - expect_rejection(lambda: verify_repository(repo, public_key=public_key), "Package archive tampering detected by signed SHA-256") - package_path.write_bytes(original_package) - verify_repository(repo, public_key=public_key) - print("[PASS] Restored package archive hash matches the signed index") - - unsigned = work / "unsigned" - unsigned.mkdir() - create_package(unsigned, "tinyapp", "1.0.0", "Unsigned test package") - build_index(unsigned) - expect_rejection(lambda: search_packages(unsigned, "tinyapp"), "Unsigned repository rejected by default") - results, unsigned_report = search_packages(unsigned, "tinyapp", allow_unsigned=True) - assert len(results) == 1 and unsigned_report["signature"].startswith("unsigned") - print("[PASS] Unsigned repository accepted only with explicit --allow-unsigned") - - print("\nTPM REPOSITORY AND SIGNATURE TESTS PASSED") - - -def test_repository_index_and_ed25519_security(): - """Run repository index and signature integration checks under pytest.""" - main() - - -if __name__ == "__main__": - main() diff --git a/tpm/tests/test_rollback.py b/tpm/tests/test_rollback.py deleted file mode 100644 index 0fbe5cc..0000000 --- a/tpm/tests/test_rollback.py +++ /dev/null @@ -1,164 +0,0 @@ -import os -import shutil -import stat -import tempfile -from pathlib import Path -from unittest.mock import patch - -from tpm import installer -from tpm.database import initialize_root, load_database -from tpm.installer import install_package, verify_installed - - -PROJECT_ROOT = Path(__file__).resolve().parents[2] -DEFAULT_PACKAGE = PROJECT_ROOT / "packages" / "hello-termos-1.0.0-x86_64.tpk" - - -def snapshot_tree(root: Path): - """Capture paths, types, file bytes, and modes beneath a sandbox root.""" - snapshot = {} - for path in sorted(root.rglob("*")): - relative = path.relative_to(root).as_posix() - info = path.lstat() - mode = stat.S_IMODE(info.st_mode) - if stat.S_ISLNK(info.st_mode): - snapshot[relative] = ("symlink", os.readlink(path), mode) - elif stat.S_ISDIR(info.st_mode): - snapshot[relative] = ("directory", mode) - elif stat.S_ISREG(info.st_mode): - snapshot[relative] = ("file", path.read_bytes(), mode) - else: - snapshot[relative] = ("special", info.st_mode, mode) - return snapshot - - -def new_root(label: str, base_dir: Path | None = None) -> Path: - build_dir = Path(base_dir) if base_dir is not None else PROJECT_ROOT / "build" - build_dir.mkdir(parents=True, exist_ok=True) - root = Path(tempfile.mkdtemp(prefix=f"tpm-rollback-{label}-", dir=build_dir)) - initialize_root(root) - return root - - -def assert_clean_after_failure(root: Path, before): - after = snapshot_tree(root) - if after != before: - before_keys = set(before) - after_keys = set(after) - added = sorted(after_keys - before_keys) - missing = sorted(before_keys - after_keys) - changed = sorted( - key for key in before_keys & after_keys if before[key] != after[key] - ) - raise AssertionError( - "Sandbox differs from its pre-install state. " - f"Added={added}; missing={missing}; changed={changed}" - ) - - database = load_database(root) - if database.get("packages") != {}: - raise AssertionError("Package database changed despite failed installation") - - -def test_failure_after_first_file(package: Path, workspace: Path | None = None): - print("===== ROLLBACK: FAILURE DURING FILE INSTALLATION =====") - root = new_root("mid-file", workspace) - before = snapshot_tree(root) - real_open = os.open - attempted_package_files = [] - - def fail_on_second_package_file(path, flags, mode=0o777, *, dir_fd=None): - candidate = Path(path) - try: - relative = candidate.resolve(strict=False).relative_to(root) - except (OSError, ValueError): - relative = None - - if relative is not None and relative.parts and relative.parts[0] == "usr": - attempted_package_files.append(relative.as_posix()) - if len(attempted_package_files) == 2: - raise OSError("injected TPM test failure on second package file") - - if dir_fd is None: - return real_open(path, flags, mode) - return real_open(path, flags, mode, dir_fd=dir_fd) - - try: - with patch.object(installer.os, "open", side_effect=fail_on_second_package_file): - install_package(package, root) - except OSError as exc: - if "injected TPM test failure" not in str(exc): - raise - print(f"[PASS] Injected failure occurred: {exc}") - else: - raise AssertionError("Injected mid-install failure did not occur") - - if len(attempted_package_files) != 2: - raise AssertionError( - f"Expected failure on second package file; observed {attempted_package_files}" - ) - - assert_clean_after_failure(root, before) - print("[PASS] First installed file and newly created directories were rolled back") - print("[PASS] Package database is unchanged") - - # Prove the sandbox remains usable after rollback. - manifest = install_package(package, root) - count, problems = verify_installed(root) - if problems or count != 1 or manifest.get("name") != "hello-termos": - raise AssertionError(f"Sandbox did not recover after rollback: {problems}") - print("[PASS] A normal installation succeeds after rollback") - print(f"Sandbox retained: {root.relative_to(PROJECT_ROOT)}") - - -def test_database_commit_failure(package: Path, workspace: Path | None = None): - print() - print("===== ROLLBACK: DATABASE COMMIT FAILURE =====") - root = new_root("db-commit", workspace) - before = snapshot_tree(root) - - with patch.object( - installer, - "save_database", - side_effect=OSError("injected TPM test database commit failure"), - ): - try: - install_package(package, root) - except OSError as exc: - if "injected TPM test database commit failure" not in str(exc): - raise - print(f"[PASS] Database commit failure injected: {exc}") - else: - raise AssertionError("Injected database commit failure did not occur") - - assert_clean_after_failure(root, before) - print("[PASS] All payload files were removed after database commit failure") - print("[PASS] Package database remains empty and unchanged") - - # Verify that a later normal operation can still use this root. - install_package(package, root) - count, problems = verify_installed(root) - if problems or count != 1: - raise AssertionError(f"Sandbox did not recover after database failure: {problems}") - print("[PASS] A normal installation succeeds after database failure") - print(f"Sandbox retained: {root.relative_to(PROJECT_ROOT)}") - - -def main(): - package = DEFAULT_PACKAGE - if not package.is_file(): - raise SystemExit( - f"Missing package: {package.relative_to(PROJECT_ROOT)}\n" - "Build it first with: ./test_tpm.sh" - ) - - print("TPM INSTALL ROLLBACK TESTS") - print(f"Package: {package.relative_to(PROJECT_ROOT)}") - test_failure_after_first_file(package) - test_database_commit_failure(package) - print() - print("TPM ROLLBACK TESTS PASSED") - - -if __name__ == "__main__": - main() diff --git a/tpm/tests/test_system_root_guard.py b/tpm/tests/test_system_root_guard.py deleted file mode 100644 index 4e452ce..0000000 --- a/tpm/tests/test_system_root_guard.py +++ /dev/null @@ -1,23 +0,0 @@ -import os -import tempfile -import unittest -from pathlib import Path -from unittest.mock import patch - -from tpm.database import DatabaseError, validate_root - - -class SystemRootGuardTests(unittest.TestCase): - def test_live_root_is_rejected_without_launcher_opt_in(self): - with patch.dict(os.environ, {}, clear=True): - with self.assertRaises(DatabaseError): - validate_root(Path("/")) - - def test_unmarked_directory_is_not_a_sandbox(self): - with tempfile.TemporaryDirectory() as temporary: - with self.assertRaises(DatabaseError): - validate_root(Path(temporary)) - - -if __name__ == "__main__": - unittest.main() diff --git a/tpm/tests/test_upgrade.py b/tpm/tests/test_upgrade.py deleted file mode 100644 index ab93bd2..0000000 --- a/tpm/tests/test_upgrade.py +++ /dev/null @@ -1,243 +0,0 @@ -import os -import platform -import shutil -import stat -import tempfile -from pathlib import Path -from unittest.mock import patch - -from tpm import upgrade as upgrade_module -from tpm.database import initialize_root, load_database -from tpm.installer import install_package, verify_installed -from tpm.package import build_package -from tpm.upgrade import UpgradeError, upgrade_package - - -PROJECT_ROOT = Path(__file__).resolve().parents[2] -BUILD_DIR = PROJECT_ROOT / "build" - - -def snapshot_tree(root): - snapshot = {} - for path in sorted(root.rglob("*")): - relative = path.relative_to(root).as_posix() - info = path.lstat() - mode = stat.S_IMODE(info.st_mode) - if stat.S_ISLNK(info.st_mode): - snapshot[relative] = ("symlink", os.readlink(path), mode) - elif stat.S_ISDIR(info.st_mode): - snapshot[relative] = ("directory", mode) - elif stat.S_ISREG(info.st_mode): - snapshot[relative] = ("file", path.read_bytes(), mode) - else: - snapshot[relative] = ("special", info.st_mode, mode) - return snapshot - - -def create_package(source, output, version, files): - for relative, (content, mode) in files.items(): - path = source.joinpath(*relative.split("/")) - path.parent.mkdir(parents=True, exist_ok=True) - path.write_text(content, encoding="utf-8") - path.chmod(mode) - return build_package( - source=source, - output=output, - name="hello-upgrade", - version=version, - architecture=platform.machine(), - description="TPM upgrade integration test", - ) - - -def expect_upgrade_error(package, root, label): - try: - upgrade_package(package, root) - except UpgradeError as exc: - print(f"[PASS] {label}: {exc}") - return - raise AssertionError(f"Expected upgrade rejection: {label}") - - -def make_fixture(workspace): - source_v1 = workspace / "source-v1" - source_v2 = workspace / "source-v2" - package_v1 = workspace / "hello-upgrade-1.0.0.tpk" - package_v2 = workspace / "hello-upgrade-1.1.0.tpk" - - create_package( - source_v1, - package_v1, - "1.0.0", - { - "usr/bin/hello-upgrade": ("#!/bin/sh\necho Version 1\n", 0o755), - "usr/share/doc/hello-upgrade/kept.txt": ("old documentation\n", 0o644), - "usr/share/doc/hello-upgrade/obsolete.txt": ("obsolete file\n", 0o644), - }, - ) - create_package( - source_v2, - package_v2, - "1.1.0", - { - "usr/bin/hello-upgrade": ("#!/bin/sh\necho Version 2\n", 0o755), - "usr/share/doc/hello-upgrade/kept.txt": ("updated documentation\n", 0o644), - "usr/share/doc/hello-upgrade/added.txt": ("new documentation\n", 0o644), - }, - ) - return package_v1, package_v2 - - -def new_root(label, base_dir=None): - base = Path(base_dir) if base_dir is not None else BUILD_DIR - base.mkdir(parents=True, exist_ok=True) - root = Path(tempfile.mkdtemp(prefix=f"tpm-upgrade-{label}-", dir=base)) - initialize_root(root) - return root - - -def test_success_and_version_rules(package_v1, package_v2, workspace: Path | None = None): - print("===== SUCCESSFUL UPGRADE / VERSION RULES =====") - root = new_root("success", workspace) - install_package(package_v1, root) - untouched = root / "etc/local-note.txt" - untouched.parent.mkdir(parents=True, exist_ok=True) - untouched.write_text("leave me alone\n", encoding="utf-8") - - result = upgrade_package(package_v2, root) - database = load_database(root) - record = database["packages"]["hello-upgrade"] - - assert result["old_version"] == "1.0.0" - assert result["new_version"] == "1.1.0" - assert record["version"] == "1.1.0" - assert (root / "usr/bin/hello-upgrade").read_text(encoding="utf-8").endswith("Version 2\n") - assert (root / "usr/share/doc/hello-upgrade/added.txt").is_file() - assert (root / "usr/share/doc/hello-upgrade/kept.txt").read_text(encoding="utf-8") == "updated documentation\n" - assert not (root / "usr/share/doc/hello-upgrade/obsolete.txt").exists() - assert untouched.read_text(encoding="utf-8") == "leave me alone\n" - - count, problems = verify_installed(root) - assert count == 1 and not problems, problems - print("[PASS] Existing files updated, new file added, obsolete file removed") - print("[PASS] Unowned files were preserved") - print("[PASS] Database records the new version") - print("[PASS] Installed package verifies after upgrade") - - expect_upgrade_error(package_v1, root, "Downgrade rejected") - expect_upgrade_error(package_v2, root, "Same-version upgrade rejected") - - -def test_modified_file_protection(package_v1, package_v2, workspace: Path | None = None): - print("\n===== MODIFIED FILE PROTECTION =====") - root = new_root("modified", workspace) - install_package(package_v1, root) - executable = root / "usr/bin/hello-upgrade" - executable.write_text(executable.read_text(encoding="utf-8") + "# local edit\n", encoding="utf-8") - before = snapshot_tree(root) - expect_upgrade_error(package_v2, root, "Modified installed file blocked upgrade") - assert snapshot_tree(root) == before - print("[PASS] Files and database remained unchanged") - - -def test_unowned_collision(package_v1, package_v2, workspace: Path | None = None): - print("\n===== UNOWNED PATH COLLISION =====") - root = new_root("collision", workspace) - install_package(package_v1, root) - collision = root / "usr/share/doc/hello-upgrade/added.txt" - collision.parent.mkdir(parents=True, exist_ok=True) - collision.write_text("user-owned file\n", encoding="utf-8") - before = snapshot_tree(root) - expect_upgrade_error(package_v2, root, "Unowned destination collision blocked") - assert snapshot_tree(root) == before - print("[PASS] Existing unowned file was preserved") - - -def test_mid_apply_rollback(package_v1, package_v2, workspace: Path | None = None): - print("\n===== ROLLBACK: FAILURE DURING FILE REPLACEMENT =====") - root = new_root("mid-apply", workspace) - install_package(package_v1, root) - before = snapshot_tree(root) - real_open = os.open - target_creates = [] - - def fail_on_second_target_create(path, flags, mode=0o777, *, dir_fd=None): - candidate = Path(path) - try: - relative = candidate.resolve(strict=False).relative_to(root) - except (OSError, ValueError): - relative = None - if flags & os.O_CREAT and relative is not None and relative.parts and relative.parts[0] == "usr": - target_creates.append(relative.as_posix()) - if len(target_creates) == 2: - raise OSError("injected TPM upgrade failure on second new file") - if dir_fd is None: - return real_open(path, flags, mode) - return real_open(path, flags, mode, dir_fd=dir_fd) - - try: - with patch.object(upgrade_module.os, "open", side_effect=fail_on_second_target_create): - upgrade_package(package_v2, root) - except UpgradeError as exc: - assert "injected TPM upgrade failure" in str(exc), exc - print(f"[PASS] Mid-upgrade failure injected: {exc}") - else: - raise AssertionError("Injected mid-upgrade failure did not occur") - - after = snapshot_tree(root) - assert after == before, "Sandbox differs from pre-upgrade state after rollback" - assert load_database(root)["packages"]["hello-upgrade"]["version"] == "1.0.0" - print("[PASS] Previous files and database were fully restored") - - result = upgrade_package(package_v2, root) - assert result["new_version"] == "1.1.0" - count, problems = verify_installed(root) - assert count == 1 and not problems, problems - print("[PASS] A normal upgrade succeeds after rollback") - - -def test_database_commit_rollback(package_v1, package_v2, workspace: Path | None = None): - print("\n===== ROLLBACK: DATABASE COMMIT FAILURE =====") - root = new_root("db-commit", workspace) - install_package(package_v1, root) - before = snapshot_tree(root) - - with patch.object( - upgrade_module, - "save_database", - side_effect=OSError("injected TPM upgrade database commit failure"), - ): - try: - upgrade_package(package_v2, root) - except UpgradeError as exc: - assert "previous version restored" in str(exc), exc - print(f"[PASS] Database failure injected and handled: {exc}") - else: - raise AssertionError("Injected database commit failure did not occur") - - assert snapshot_tree(root) == before, "Sandbox differs after database failure rollback" - assert load_database(root)["packages"]["hello-upgrade"]["version"] == "1.0.0" - print("[PASS] Previous files and database were fully restored") - - result = upgrade_package(package_v2, root) - assert result["new_version"] == "1.1.0" - print("[PASS] A normal upgrade succeeds after database failure") - - -def main(): - BUILD_DIR.mkdir(parents=True, exist_ok=True) - with tempfile.TemporaryDirectory(prefix="tpm-upgrade-fixture-", dir=BUILD_DIR) as temporary: - workspace = Path(temporary) - package_v1, package_v2 = make_fixture(workspace) - print("TPM UPGRADE TESTS") - print(f"Packages: {package_v1.name} -> {package_v2.name}") - test_success_and_version_rules(package_v1, package_v2) - test_modified_file_protection(package_v1, package_v2) - test_unowned_collision(package_v1, package_v2) - test_mid_apply_rollback(package_v1, package_v2) - test_database_commit_rollback(package_v1, package_v2) - print("\nTPM UPGRADE TESTS PASSED") - - -if __name__ == "__main__": - main() diff --git a/tpm/tpm/__init__.py b/tpm/tpm/__init__.py deleted file mode 100644 index 8b13789..0000000 --- a/tpm/tpm/__init__.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tpm/tpm/__main__.py b/tpm/tpm/__main__.py deleted file mode 100644 index eb53e2f..0000000 --- a/tpm/tpm/__main__.py +++ /dev/null @@ -1,3 +0,0 @@ -from .cli import main - -raise SystemExit(main()) diff --git a/tpm/tpm/cli.py b/tpm/tpm/cli.py deleted file mode 100644 index 57caf36..0000000 --- a/tpm/tpm/cli.py +++ /dev/null @@ -1,257 +0,0 @@ -import argparse -import json -import sys -from pathlib import Path - -from .database import DatabaseError, initialize_root -from .dependencies import DependencyError -from .manager import install_with_dependencies -from .installer import InstallError, install_package, list_installed, verify_installed -from .package import PackageError, build_package, package_info -from .uninstaller import UninstallError, remove_package -from .upgrade import UpgradeError, upgrade_package -from .repository import RepositoryError, build_index, generate_keypair, sign_index, verify_repository, search_packages - - -def main(): - parser = argparse.ArgumentParser( - prog="tpm", - description="TermOS Package Manager", - ) - commands = parser.add_subparsers(dest="command", required=True) - - build = commands.add_parser("build", help="Build a TPK package") - build.add_argument("source", type=Path) - build.add_argument("--name", required=True) - build.add_argument("--version", required=True) - build.add_argument("--arch", default="x86_64") - build.add_argument("--description", default="") - build.add_argument( - "--depends", action="append", default=[], metavar="SPEC", - help="Package dependency, e.g. libfoo>=1.2.0 (repeatable)", - ) - build.add_argument("-o", "--output", type=Path, required=True) - - info = commands.add_parser("info", help="Inspect and verify a TPK package") - info.add_argument("package", type=Path) - - init_root = commands.add_parser("init-root", help="Initialize a dedicated TPM sandbox") - init_root.add_argument("--root", type=Path, required=True) - - install = commands.add_parser("install", help="Install a package into a TPM sandbox") - install.add_argument("package", type=Path) - install.add_argument("--root", type=Path, required=True) - install.add_argument( - "--repo", type=Path, action="append", default=[], - help="Local directory containing dependency .tpk files (repeatable)", - ) - - listing = commands.add_parser("list", help="List installed packages") - listing.add_argument("--root", type=Path, required=True) - - verify = commands.add_parser("verify", help="Verify installed package files") - verify.add_argument("--root", type=Path, required=True) - verify.add_argument("name", nargs="?", help="Optional package name") - - remove = commands.add_parser("remove", help="Remove an installed package") - remove.add_argument("name", help="Installed package name") - remove.add_argument("--root", type=Path, required=True) - remove.add_argument( - "--keep-modified", - action="store_true", - help="Keep modified files instead of deleting them", - ) - - upgrade = commands.add_parser("upgrade", help="Upgrade an installed package") - upgrade.add_argument("package", type=Path, help="New .tpk package file") - upgrade.add_argument("--root", type=Path, required=True) - - install.add_argument("--repo-key", type=Path, action="append", default=[], help="Trusted public key for each signed --repo directory (one key may be reused)") - # TPM_STAGE7_8_REPOSITORY_PARSERS - repo_parser = commands.add_parser("repo", help="Build and secure a local package repository") - repo_actions = repo_parser.add_subparsers(dest="repo_action", required=True) - - repo_index = repo_actions.add_parser("index", help="Create or refresh repository.json") - repo_index.add_argument("directory", type=Path, help="Directory containing .tpk archives") - repo_index.add_argument("--name", default="TermOS", help="Repository display name") - repo_index.add_argument("--output", type=Path, help="Index output path") - - repo_keygen = repo_actions.add_parser("keygen", help="Generate an Ed25519 repository key pair") - repo_keygen.add_argument("--private-key", type=Path, required=True) - repo_keygen.add_argument("--public-key", type=Path, required=True) - repo_keygen.add_argument("--force", action="store_true", help="Replace existing key files") - - repo_sign = repo_actions.add_parser("sign", help="Sign a repository index with Ed25519") - repo_sign.add_argument("index", type=Path) - repo_sign.add_argument("--private-key", type=Path, required=True) - repo_sign.add_argument("--signature", type=Path) - - repo_verify = repo_actions.add_parser("verify", help="Verify index signature and package hashes") - repo_verify.add_argument("index", type=Path) - repo_verify.add_argument("--public-key", type=Path) - repo_verify.add_argument("--signature", type=Path) - repo_verify.add_argument("--allow-unsigned", action="store_true") - - search_parser = commands.add_parser("search", help="Search packages in a verified local repository") - search_parser.add_argument("query") - search_parser.add_argument("--repo", type=Path, required=True) - search_parser.add_argument("--index", default="repository.json") - search_parser.add_argument("--public-key", type=Path) - search_parser.add_argument("--signature", type=Path) - search_parser.add_argument("--allow-unsigned", action="store_true") - - args = parser.parse_args() - - try: - if args.command == "build": - manifest = build_package( - source=args.source, - output=args.output, - name=args.name, - version=args.version, - architecture=args.arch, - description=args.description, - depends=args.depends, - ) - print(f"Package created: {args.output}") - print(f"Files: {len(manifest['files'])}") - - elif args.command == "info": - manifest = package_info(args.package) - print(json.dumps(manifest, indent=2, ensure_ascii=False)) - print("\nPackage integrity: OK") - - elif args.command == "init-root": - root = initialize_root(args.root) - print(f"TPM sandbox initialized: {root}") - - elif args.command == "install": - # TPM_STAGE7_8_VERIFY_DEPENDENCY_REPOS - repo_paths = getattr(args, "repo", None) or [] - repo_keys = getattr(args, "repo_key", None) or [] - if repo_keys: - if not repo_paths: - raise RepositoryError("--repo-key requires at least one --repo directory") - if len(repo_keys) == 1: - repo_keys = repo_keys * len(repo_paths) - elif len(repo_keys) != len(repo_paths): - raise RepositoryError("Provide one --repo-key per --repo, or one key to reuse") - for repo_path, trusted_key in zip(repo_paths, repo_keys): - report = verify_repository(repo_path, public_key=trusted_key) - print(f"Verified dependency repository: {report['repository']} ({report['packages']} packages)") - else: - for repo_path in repo_paths: - if (Path(repo_path) / ("repository.json" + ".sig")).exists(): - raise RepositoryError("Signed dependency repository requires --repo-key") - print(f"warning: unsigned dependency repository: {repo_path}", file=sys.stderr) - - result = install_with_dependencies(args.package, args.root, args.repo) - manifest = result["manifest"] - print(f"Installed: {manifest['name']} {manifest['version']}") - print(f"Files installed: {len(manifest['files'])}") - if result["dependencies_installed"]: - print(f"Dependencies installed: {result['dependencies_installed']}") - - elif args.command == "list": - packages = list_installed(args.root) - if not packages: - print("No packages installed.") - else: - for name, data in sorted(packages.items()): - print( - f"{name} {data['version']} " - f"[{data['architecture']}] - {len(data['files'])} files" - ) - - elif args.command == "verify": - count, problems = verify_installed(args.root, args.name) - if problems: - for problem in problems: - print(f"[FAIL] {problem}", file=sys.stderr) - print(f"Verification failed: {len(problems)} problem(s)") - return 1 - print(f"Verified {count} package(s): OK") - - elif args.command == "remove": - result = remove_package(args.name, args.root, args.keep_modified) - print(f"Removed package registration: {result['name']}") - print(f"Files removed: {result['removed']}") - if result["missing"]: - print(f"Already missing: {len(result['missing'])} file(s)") - if result["modified_kept"]: - print( - f"Modified files kept: {len(result['modified_kept'])} " - "(now unmanaged by TPM)" - ) - for path in result["modified_kept"]: - print(f" kept: {path}") - if result["cleanup_warning"]: - print(f"warning: {result['cleanup_warning']}", file=sys.stderr) - - - elif args.command == "upgrade": - result = upgrade_package(args.package, args.root) - print( - f"Upgraded: {result['name']} " - f"{result['old_version']} -> {result['new_version']}" - ) - print( - f"Files: {result['added']} added, " - f"{result['updated']} updated, {result['removed']} removed" - ) - - - # TPM_STAGE7_8_REPOSITORY_HANDLERS - elif args.command == "repo": - if args.repo_action == "index": - destination, index_data = build_index(args.directory, args.output, args.name) - print(f"Repository index created: {destination}") - print(f"Packages indexed: {len(index_data['packages'])}") - elif args.repo_action == "keygen": - private_path, public_path = generate_keypair(args.private_key, args.public_key, args.force) - print(f"Private key: {private_path} (keep this secret)") - print(f"Public key: {public_path} (trusted verification key)") - elif args.repo_action == "sign": - signature = sign_index(args.index, args.private_key, args.signature) - print(f"Repository index signed: {signature}") - elif args.repo_action == "verify": - index_file = args.index.expanduser().resolve(strict=True) - result = verify_repository( - index_file.parent, index_name=index_file, public_key=args.public_key, - signature_path=args.signature, allow_unsigned=args.allow_unsigned, - ) - print(f"Repository: {result['repository']}") - print(f"Packages: {result['packages']}") - print(f"Package archives verified: {result['archives_verified']}") - print(f"Signature: {result['signature']}") - elif args.command == "search": - matches, verification = search_packages( - args.repo, args.query, index_name=args.index, public_key=args.public_key, - signature_path=args.signature, allow_unsigned=args.allow_unsigned, - ) - print(f"Repository: {verification['repository']} ({verification['signature']})") - if not matches: - print("No matching packages.") - else: - for item in matches: - print(f"{item['name']} {item['version']} [{item['architecture']}] - {item.get('description', '')}") - print(f" archive: {item['filename']} sha256: {item['sha256']}") - - except ( - PackageError, - DatabaseError, - InstallError, - UninstallError, - UpgradeError, - DependencyError, - OSError, - ValueError, - ) as exc: - print(f"tpm: error: {exc}", file=sys.stderr) - return 1 - - return 0 - - -if __name__ == "__main__": - raise SystemExit(main()) diff --git a/tpm/tpm/database.py b/tpm/tpm/database.py deleted file mode 100644 index 93fd5ce..0000000 --- a/tpm/tpm/database.py +++ /dev/null @@ -1,188 +0,0 @@ -import json -import os -import stat -import tempfile -from pathlib import Path - -MARKER_NAME = ".tpm-root" -MARKER_CONTENT = "TermOS TPM sandbox root v1\n" -DB_PARTS = ("var", "lib", "tpm", "installed.json") -DB_MAX_SIZE = 16 * 1024 * 1024 - - -class DatabaseError(Exception): - pass - - -def _check_root_argument(path): - raw = Path(path).expanduser() - if raw.is_symlink(): - raise DatabaseError("Root path itself cannot be a symlink") - raw.mkdir(parents=True, exist_ok=True) - root = raw.resolve(strict=True) - if root == Path("/"): - raise DatabaseError("Refusing to use / as a TPM sandbox root") - if not root.is_dir(): - raise DatabaseError("Root must be a directory") - return root - - -def initialize_root(path): - root = _check_root_argument(path) - marker = root / MARKER_NAME - - try: - info = marker.lstat() - except FileNotFoundError: - info = None - - if info is not None: - if not stat.S_ISREG(info.st_mode) or marker.is_symlink(): - raise DatabaseError("Invalid TPM root marker") - if marker.read_text(encoding="utf-8") != MARKER_CONTENT: - raise DatabaseError("TPM root marker has unexpected content") - return root - - if any(root.iterdir()): - raise DatabaseError("Refusing to initialize a non-empty directory") - - flags = os.O_WRONLY | os.O_CREAT | os.O_EXCL - if hasattr(os, "O_NOFOLLOW"): - flags |= os.O_NOFOLLOW - fd = os.open(marker, flags, 0o600) - with os.fdopen(fd, "w", encoding="utf-8") as stream: - stream.write(MARKER_CONTENT) - stream.flush() - os.fsync(stream.fileno()) - return root - - -def validate_root(path): - raw = Path(path).expanduser() - if raw.is_symlink(): - raise DatabaseError("Root path itself cannot be a symlink") - root = raw.resolve(strict=True) - if root == Path("/"): - # The live system root is intentionally unavailable to ordinary TPM - # operations. The installed /usr/bin/tpm launcher sets this opt-in only - # after checking root privileges, the TermOS release marker, and a - # typed confirmation for mutating commands. - if os.environ.get("TPM_ALLOW_SYSTEM_ROOT") != "1": - raise DatabaseError( - "Refusing the live system root. Use the installed 'tpm --system' " - "launcher on TermOS." - ) - if not hasattr(os, "geteuid") or os.geteuid() != 0: - raise DatabaseError("System-root operations require effective UID 0") - release_marker = root / "etc" / "termos-release" - try: - marker_info = release_marker.lstat() - marker_text = release_marker.read_text(encoding="utf-8") - except OSError as exc: - raise DatabaseError(f"Cannot validate TermOS system marker: {exc}") from exc - if not stat.S_ISREG(marker_info.st_mode) or stat.S_ISLNK(marker_info.st_mode): - raise DatabaseError("TermOS system marker is not a regular file") - if "ID=termos" not in marker_text.splitlines(): - raise DatabaseError("This root filesystem is not identified as TermOS") - return root - if not root.is_dir(): - raise DatabaseError("Invalid TPM sandbox root") - - marker = root / MARKER_NAME - try: - info = marker.lstat() - except FileNotFoundError as exc: - raise DatabaseError("Not a TPM sandbox. Run 'tpm init-root' first") from exc - if not stat.S_ISREG(info.st_mode) or marker.is_symlink(): - raise DatabaseError("Invalid TPM root marker") - if marker.read_text(encoding="utf-8") != MARKER_CONTENT: - raise DatabaseError("TPM root marker has unexpected content") - return root - - -def _safe_directory(root, parts, create=False): - current = root - for part in parts: - candidate = current / part - try: - info = candidate.lstat() - except FileNotFoundError: - if not create: - return None - try: - candidate.mkdir(mode=0o755) - except FileExistsError: - pass - try: - info = candidate.lstat() - except FileNotFoundError as exc: - raise DatabaseError(f"Directory disappeared: {candidate}") from exc - if stat.S_ISLNK(info.st_mode) or not stat.S_ISDIR(info.st_mode): - raise DatabaseError(f"Unsafe directory component: {candidate}") - current = candidate - return current - - -def empty_database(): - return {"format_version": 1, "packages": {}} - - -def load_database(root): - parent = _safe_directory(root, DB_PARTS[:-1], create=False) - if parent is None: - return empty_database() - - database_path = parent / DB_PARTS[-1] - try: - info = database_path.lstat() - except FileNotFoundError: - return empty_database() - - if stat.S_ISLNK(info.st_mode) or not stat.S_ISREG(info.st_mode): - raise DatabaseError("TPM database is not a regular file") - if info.st_size > DB_MAX_SIZE: - raise DatabaseError("TPM database is too large") - - try: - data = json.loads(database_path.read_text(encoding="utf-8")) - except (OSError, UnicodeError, json.JSONDecodeError) as exc: - raise DatabaseError(f"Cannot read TPM database: {exc}") from exc - - if ( - not isinstance(data, dict) - or data.get("format_version") != 1 - or not isinstance(data.get("packages"), dict) - ): - raise DatabaseError("Invalid TPM database structure") - return data - - -def save_database(root, data): - parent = _safe_directory(root, DB_PARTS[:-1], create=True) - database_path = parent / DB_PARTS[-1] - - try: - info = database_path.lstat() - except FileNotFoundError: - info = None - if info is not None and (stat.S_ISLNK(info.st_mode) or not stat.S_ISREG(info.st_mode)): - raise DatabaseError("Refusing to replace an unsafe TPM database file") - - payload = (json.dumps(data, indent=2, sort_keys=True) + "\n").encode("utf-8") - if len(payload) > DB_MAX_SIZE: - raise DatabaseError("TPM database would exceed size limit") - - fd, temporary_name = tempfile.mkstemp(prefix=".installed-", suffix=".tmp", dir=parent) - try: - with os.fdopen(fd, "wb") as stream: - os.fchmod(stream.fileno(), 0o600) - stream.write(payload) - stream.flush() - os.fsync(stream.fileno()) - os.replace(temporary_name, database_path) - except Exception: - try: - os.unlink(temporary_name) - except FileNotFoundError: - pass - raise diff --git a/tpm/tpm/dependencies.py b/tpm/tpm/dependencies.py deleted file mode 100644 index fca0f9d..0000000 --- a/tpm/tpm/dependencies.py +++ /dev/null @@ -1,266 +0,0 @@ -"""Dependency metadata, constraints, and local package resolution for TPM.""" - -import platform -import re -from pathlib import Path - -PACKAGE_NAME_RE = re.compile(r"^[a-z0-9][a-z0-9+_.-]{0,127}$") -DEPENDENCY_RE = re.compile( - r"^(?P[a-z0-9][a-z0-9+_.-]{0,127})" - r"(?:(?P>=|<=|==|>|<|=)(?P[0-9]+(?:\.[0-9]+){0,7}))?$" -) -MAX_DEPENDENCIES = 256 -MAX_REPOSITORY_PACKAGES = 2000 - - -class DependencyError(Exception): - """Raised when package dependencies cannot be satisfied safely.""" - - -def version_key(value): - """Convert a numeric dotted version into a comparable tuple.""" - if not isinstance(value, str) or len(value) > 128: - raise DependencyError(f"Invalid version: {value!r}") - if not re.fullmatch(r"[0-9]+(?:\.[0-9]+){0,7}", value): - raise DependencyError( - f"Unsupported version {value!r}; use numeric dotted versions such as 1.2.3" - ) - parts = [int(part) for part in value.split(".")] - if any(part > 2_147_483_647 for part in parts): - raise DependencyError("Version component is too large") - while len(parts) > 1 and parts[-1] == 0: - parts.pop() - return tuple(parts) - - -def parse_dependency(spec): - """Parse 'name', 'name>=1.2.0', 'name==1.2.0', etc.""" - if not isinstance(spec, str): - raise DependencyError("Dependency specifications must be strings") - match = DEPENDENCY_RE.fullmatch(spec) - if not match: - raise DependencyError( - f"Invalid dependency {spec!r}; examples: libfoo or libfoo>=1.2.0" - ) - name = match.group("name") - operator = match.group("operator") - version = match.group("version") - if operator == "=": - operator = "==" - if version is not None: - version_key(version) - return {"name": name, "operator": operator, "version": version} - - -def validate_dependencies(items, package_name=None): - """Validate and canonicalize dependency strings; missing means no dependencies.""" - if items is None: - return [] - if not isinstance(items, (list, tuple)): - raise DependencyError("Manifest 'depends' must be a list of dependency strings") - if len(items) > MAX_DEPENDENCIES: - raise DependencyError(f"A package may declare at most {MAX_DEPENDENCIES} dependencies") - - result = [] - seen = set() - for item in items: - parsed = parse_dependency(item) - if package_name and parsed["name"] == package_name: - raise DependencyError(f"Package cannot depend on itself: {package_name}") - canonical = ( - parsed["name"] - + (parsed["operator"] + parsed["version"] if parsed["operator"] else "") - ) - if canonical in seen: - raise DependencyError(f"Duplicate dependency: {canonical}") - seen.add(canonical) - result.append(canonical) - return result - - -def dependency_satisfied(spec, installed_version): - parsed = parse_dependency(spec) - if parsed["operator"] is None: - return True - try: - actual = version_key(installed_version) - required = version_key(parsed["version"]) - except DependencyError: - return False - - operator = parsed["operator"] - if operator == ">=": - return actual >= required - if operator == "<=": - return actual <= required - if operator == ">": - return actual > required - if operator == "<": - return actual < required - if operator == "==": - return actual == required - raise DependencyError(f"Unsupported dependency operator: {operator}") - - -def check_installed_dependencies(depends, installed_packages, package_name=None): - for spec in validate_dependencies(depends, package_name=package_name): - parsed = parse_dependency(spec) - record = installed_packages.get(parsed["name"]) - if record is None: - raise DependencyError( - f"Missing dependency: {spec}. Install it first or provide a local --repo." - ) - installed_version = record.get("version") - if not dependency_satisfied(spec, installed_version): - raise DependencyError( - f"Dependency version mismatch: {spec}; " - f"installed {parsed['name']} is {installed_version!r}" - ) - - -def find_dependents(package_name, installed_packages, exclude=None): - """Return installed package/spec pairs that declare a dependency on package_name.""" - blockers = [] - for other_name, record in installed_packages.items(): - if other_name == exclude or other_name == package_name: - continue - depends = validate_dependencies(record.get("depends", []), package_name=other_name) - for spec in depends: - if parse_dependency(spec)["name"] == package_name: - blockers.append((other_name, spec)) - return blockers - - -def check_reverse_dependencies(package_name, new_version, installed_packages): - """Prevent upgrading a package to a version that breaks installed dependents.""" - blockers = [ - (other_name, spec) - for other_name, spec in find_dependents( - package_name, installed_packages, exclude=package_name - ) - if not dependency_satisfied(spec, new_version) - ] - if blockers: - details = ", ".join(f"{name} requires {spec}" for name, spec in blockers) - raise DependencyError( - f"Upgrade to {new_version} would break installed dependents: {details}" - ) - - -def resolve_install_plan(package_path, repository_dirs, installed_packages): - """Resolve a package and its missing dependencies from local .tpk repositories. - - Returns a topologically ordered list of (archive_path, manifest) pairs. - Existing installed dependencies must already satisfy their constraints; this - first resolver does not silently replace or upgrade installed dependencies. - """ - from .package import validate_package - - root_archive = Path(package_path).expanduser() - if not root_archive.is_file() or root_archive.is_symlink(): - raise DependencyError(f"Package archive is missing or unsafe: {root_archive}") - root_archive = root_archive.resolve() - root_manifest = validate_package(root_archive) - root_name = root_manifest.get("name") - if root_name in installed_packages: - raise DependencyError(f"Package already installed: {root_name}") - - candidates = {} - seen_archives = set() - - def add_candidate(archive): - archive = Path(archive) - try: - if archive.is_symlink() or not archive.is_file(): - return - archive = archive.resolve() - if archive in seen_archives: - return - seen_archives.add(archive) - manifest = validate_package(archive) - name = manifest.get("name") - version = manifest.get("version") - architecture = manifest.get("architecture") - if not isinstance(name, str) or not PACKAGE_NAME_RE.fullmatch(name): - return - if architecture not in ("all", platform.machine()): - return - key = version_key(version) - candidates.setdefault(name, []).append((key, archive, manifest)) - except (OSError, DependencyError, ValueError): - return - except Exception: - # Invalid or unrelated repository archives are not candidates. - return - - add_candidate(root_archive) - archive_count = 0 - for repository in repository_dirs or []: - repository = Path(repository).expanduser() - if repository.is_symlink() or not repository.is_dir(): - raise DependencyError(f"Repository must be an existing non-symlink directory: {repository}") - for archive in sorted(repository.glob("*.tpk")): - archive_count += 1 - if archive_count > MAX_REPOSITORY_PACKAGES: - raise DependencyError( - f"Local repository exceeds {MAX_REPOSITORY_PACKAGES} package archives" - ) - add_candidate(archive) - - for values in candidates.values(): - values.sort(key=lambda item: (item[0], str(item[1])), reverse=True) - - visiting = [] - planned = {} - ordered = [] - - def visit(archive, manifest): - name = manifest["name"] - if name in planned: - return - if name in visiting: - cycle = " -> ".join(visiting + [name]) - raise DependencyError(f"Dependency cycle detected: {cycle}") - - visiting.append(name) - for spec in validate_dependencies(manifest.get("depends", []), package_name=name): - parsed = parse_dependency(spec) - dependency_name = parsed["name"] - - installed = installed_packages.get(dependency_name) - if installed is not None: - if dependency_satisfied(spec, installed.get("version")): - continue - raise DependencyError( - f"Installed dependency is incompatible: {spec}; " - f"{dependency_name} {installed.get('version')!r} is installed. " - "Upgrade it explicitly before installing this package." - ) - - already_planned = planned.get(dependency_name) - if already_planned is not None: - if not dependency_satisfied(spec, already_planned["manifest"]["version"]): - raise DependencyError( - f"Conflicting dependency constraints for {dependency_name}: {spec}" - ) - continue - - matching = [ - item for item in candidates.get(dependency_name, []) - if dependency_satisfied(spec, item[2]["version"]) - ] - if not matching: - raise DependencyError( - f"No compatible local package found for dependency {spec}. " - "Add its .tpk archive to a directory passed with --repo." - ) - - _, dependency_archive, dependency_manifest = matching[0] - visit(dependency_archive, dependency_manifest) - - visiting.pop() - planned[name] = {"archive": archive, "manifest": manifest} - ordered.append((archive, manifest)) - - visit(root_archive, root_manifest) - return ordered diff --git a/tpm/tpm/installer.py b/tpm/tpm/installer.py deleted file mode 100644 index 6dd3755..0000000 --- a/tpm/tpm/installer.py +++ /dev/null @@ -1,265 +0,0 @@ -import hashlib -import os -import platform -import re -import stat -import tarfile -from pathlib import Path - -from .dependencies import DependencyError, check_installed_dependencies -from .database import ( - DatabaseError, - load_database, - save_database, - validate_root, -) -from .package import PackageError, validate_package -from .security import normalize_package_path - - -class InstallError(Exception): - pass - - -def _check_existing_parent(root, parts): - current = root - for part in parts: - candidate = current / part - try: - info = candidate.lstat() - except FileNotFoundError: - return - if stat.S_ISLNK(info.st_mode) or not stat.S_ISDIR(info.st_mode): - raise InstallError(f"Unsafe destination directory: {candidate}") - current = candidate - - -def _create_parent(root, parts, created_directories): - current = root - for part in parts: - candidate = current / part - try: - info = candidate.lstat() - except FileNotFoundError: - try: - candidate.mkdir(mode=0o755) - created_directories.append(candidate) - except FileExistsError: - pass - try: - info = candidate.lstat() - except FileNotFoundError as exc: - raise InstallError(f"Directory disappeared: {candidate}") from exc - if stat.S_ISLNK(info.st_mode) or not stat.S_ISDIR(info.st_mode): - raise InstallError(f"Unsafe destination directory: {candidate}") - current = candidate - return current - - -def _validate_manifest_identity(manifest): - name = manifest.get("name") - version = manifest.get("version") - architecture = manifest.get("architecture") - - if not isinstance(name, str) or not re.fullmatch(r"[a-z0-9][a-z0-9+_.-]{0,127}", name): - raise InstallError("Invalid package name") - if not isinstance(version, str) or not version.strip() or len(version) > 128: - raise InstallError("Invalid package version") - if not isinstance(architecture, str) or not architecture.strip(): - raise InstallError("Invalid package architecture") - - host_arch = platform.machine() - if architecture not in ("all", host_arch): - raise InstallError( - f"Architecture mismatch: package={architecture}, host={host_arch}" - ) - - -def _manifest_paths(manifest): - result = [] - seen = set() - reserved = ".tpm-root" - - for entry in manifest["files"]: - path = normalize_package_path(entry["path"]) - if path == reserved or path.startswith(reserved + "/"): - raise InstallError("Package attempts to overwrite TPM root marker") - if path == "var/lib/tpm" or path.startswith("var/lib/tpm/"): - raise InstallError("Package attempts to overwrite TPM database area") - if path in seen: - raise InstallError(f"Duplicate package path: {path}") - seen.add(path) - result.append(path) - - # A regular file cannot also be the parent directory of another package file. - for path in result: - parts = path.split("/") - for index in range(1, len(parts)): - parent = "/".join(parts[:index]) - if parent in seen: - raise InstallError(f"Conflicting file paths: {parent} and {path}") - - return result - - -def install_package(package_path, root_path): - root = validate_root(root_path) - package_path = Path(package_path) - manifest = validate_package(package_path) - _validate_manifest_identity(manifest) - paths = _manifest_paths(manifest) - - database = load_database(root) - name = manifest["name"] - if name in database["packages"]: - raise InstallError(f"Package already installed: {name}") - try: - check_installed_dependencies( - manifest.get("depends", []), database["packages"], package_name=name - ) - except DependencyError as exc: - raise InstallError(str(exc)) from exc - - owned_paths = { - item["path"] - for package in database["packages"].values() - for item in package.get("files", []) - } - for path in paths: - if path in owned_paths: - raise InstallError(f"File is already owned by another package: {path}") - parts = path.split("/") - _check_existing_parent(root, parts[:-1]) - destination = root.joinpath(*parts) - if os.path.lexists(destination): - raise InstallError(f"Refusing to overwrite existing path: {path}") - - created_files = [] - created_directories = [] - - try: - with tarfile.open(package_path, mode="r:") as archive: - for entry, path in zip(manifest["files"], paths): - member = archive.getmember("payload/" + path) - source = archive.extractfile(member) - if source is None: - raise InstallError(f"Cannot read package file: {path}") - - parts = path.split("/") - parent = _create_parent(root, parts[:-1], created_directories) - destination = parent / parts[-1] - - flags = os.O_WRONLY | os.O_CREAT | os.O_EXCL - if hasattr(os, "O_NOFOLLOW"): - flags |= os.O_NOFOLLOW - fd = os.open(destination, flags, 0o600) - created_files.append(destination) - - digest = hashlib.sha256() - total = 0 - with os.fdopen(fd, "wb") as output, source: - while True: - chunk = source.read(1024 * 1024) - if not chunk: - break - output.write(chunk) - digest.update(chunk) - total += len(chunk) - output.flush() - os.fchmod(output.fileno(), entry["mode"]) - os.fsync(output.fileno()) - - if total != entry["size"]: - raise InstallError(f"Size changed while installing: {path}") - if digest.hexdigest() != entry["sha256"]: - raise InstallError(f"Checksum changed while installing: {path}") - - database["packages"][name] = { - "version": manifest["version"], - "architecture": manifest["architecture"], - "description": manifest.get("description", ""), - "depends": manifest.get("depends", []), - "files": [ - { - "path": entry["path"], - "sha256": entry["sha256"], - "size": entry["size"], - "mode": entry["mode"], - } - for entry in manifest["files"] - ], - } - save_database(root, database) - - except Exception: - for path in reversed(created_files): - try: - path.unlink(missing_ok=True) - except OSError: - pass - for directory in reversed(created_directories): - try: - directory.rmdir() - except OSError: - pass - raise - - return manifest - - -def list_installed(root_path): - root = validate_root(root_path) - return load_database(root)["packages"] - - -def verify_installed(root_path, package_name=None): - root = validate_root(root_path) - packages = load_database(root)["packages"] - - if package_name is not None and package_name not in packages: - raise InstallError(f"Package is not installed: {package_name}") - - selected = ( - {package_name: packages[package_name]} - if package_name is not None - else packages - ) - problems = [] - - for name, package in selected.items(): - try: - check_installed_dependencies( - package.get("depends", []), packages, package_name=name - ) - except DependencyError as exc: - problems.append(f"{name}: {exc}") - - for name, package in selected.items(): - for entry in package.get("files", []): - path = normalize_package_path(entry["path"]) - parts = path.split("/") - try: - _check_existing_parent(root, parts[:-1]) - file_path = root.joinpath(*parts) - info = file_path.lstat() - if stat.S_ISLNK(info.st_mode) or not stat.S_ISREG(info.st_mode): - raise InstallError("not a regular file") - flags = os.O_RDONLY - if hasattr(os, "O_NOFOLLOW"): - flags |= os.O_NOFOLLOW - fd = os.open(file_path, flags) - digest = hashlib.sha256() - total = 0 - with os.fdopen(fd, "rb") as stream: - while True: - chunk = stream.read(1024 * 1024) - if not chunk: - break - digest.update(chunk) - total += len(chunk) - if total != entry["size"] or digest.hexdigest() != entry["sha256"]: - raise InstallError("size or checksum mismatch") - except (OSError, InstallError, ValueError) as exc: - problems.append(f"{name}: {path}: {exc}") - - return len(selected), problems diff --git a/tpm/tpm/manager.py b/tpm/tpm/manager.py deleted file mode 100644 index d4c8051..0000000 --- a/tpm/tpm/manager.py +++ /dev/null @@ -1,46 +0,0 @@ -"""High-level package operations that coordinate dependency installation.""" - -from pathlib import Path - -from .database import load_database, validate_root -from .dependencies import DependencyError, resolve_install_plan -from .installer import install_package -from .uninstaller import remove_package - - -def install_with_dependencies(package_path, root_path, repository_dirs=None): - """Install a package plus missing local dependencies in dependency order. - - If a later package fails, packages installed by this operation are removed - in reverse order. Packages that were already present before the operation - are never touched. - """ - root = validate_root(root_path) - installed_before = load_database(root)["packages"] - plan = resolve_install_plan(package_path, repository_dirs or [], installed_before) - - installed_now = [] - try: - for archive, manifest in plan: - install_package(archive, root) - installed_now.append(manifest["name"]) - except Exception as exc: - rollback_errors = [] - for name in reversed(installed_now): - try: - remove_package(name, root) - except Exception as rollback_exc: - rollback_errors.append(f"{name}: {rollback_exc}") - if rollback_errors: - raise DependencyError( - f"Dependency installation failed ({exc}); rollback was incomplete: " - + "; ".join(rollback_errors) - ) from exc - raise - - root_manifest = plan[-1][1] - return { - "manifest": root_manifest, - "dependencies_installed": max(0, len(plan) - 1), - "installed": installed_now, - } diff --git a/tpm/tpm/package.py b/tpm/tpm/package.py deleted file mode 100644 index 6aefa63..0000000 --- a/tpm/tpm/package.py +++ /dev/null @@ -1,224 +0,0 @@ -import hashlib -import io -import json -import os -import stat -import tarfile - -from pathlib import Path, PurePosixPath - -from .dependencies import DependencyError, validate_dependencies -from .security import ( - PackageSecurityError, - normalize_package_path, -) - -FORMAT_VERSION = 1 -MAX_MANIFEST_SIZE = 4 * 1024 * 1024 -MAX_FILES = 100_000 - - -class PackageError(Exception): - pass - - -def build_package(source, output, name, version, architecture, description="", depends=None): - source = Path(source).resolve() - output = Path(output).resolve() - - if not source.is_dir(): - raise PackageError("Source directory does not exist") - - if not all(isinstance(v, str) and v.strip() for v in (name, version, architecture)): - raise PackageError("Name, version and architecture are required") - - try: - dependency_specs = validate_dependencies(depends or [], package_name=name) - except DependencyError as exc: - raise PackageError(f"Invalid dependencies: {exc}") from exc - - files = [] - - for current, directories, filenames in os.walk(source, followlinks=False): - current_path = Path(current) - - for directory in directories: - if (current_path / directory).is_symlink(): - raise PackageError("Symlink directories are forbidden") - - for filename in filenames: - file_path = current_path / filename - - if file_path.is_symlink() or not stat.S_ISREG(file_path.lstat().st_mode): - raise PackageError(f"Unsupported file: {file_path}") - - relative = file_path.relative_to(source).as_posix() - relative = normalize_package_path(relative) - - digest = hashlib.sha256(file_path.read_bytes()).hexdigest() - - files.append({ - "path": relative, - "sha256": digest, - "mode": stat.S_IMODE(file_path.stat().st_mode) & 0o777, - "size": file_path.stat().st_size, - }) - - if not files or len(files) > MAX_FILES: - raise PackageError("Invalid package file count") - - files.sort(key=lambda item: item["path"]) - - manifest = { - "format": "TPK", - "format_version": FORMAT_VERSION, - "name": name, - "version": version, - "architecture": architecture, - "description": description, - "depends": dependency_specs, - "files": files, - } - - manifest_data = json.dumps( - manifest, ensure_ascii=False, indent=2, sort_keys=True - ).encode("utf-8") - - output.parent.mkdir(parents=True, exist_ok=True) - - with tarfile.open(output, "w", format=tarfile.PAX_FORMAT) as archive: - info = tarfile.TarInfo("manifest.json") - info.size = len(manifest_data) - info.mode = 0o644 - info.mtime = 0 - archive.addfile(info, io.BytesIO(manifest_data)) - - for entry in files: - path = source.joinpath(*PurePosixPath(entry["path"]).parts) - info = tarfile.TarInfo("payload/" + entry["path"]) - info.size = entry["size"] - info.mode = entry["mode"] - info.mtime = 0 - - with path.open("rb") as file: - archive.addfile(info, file) - - return manifest - - -def validate_package(package_path): - try: - with tarfile.open(package_path, "r:") as archive: - members = archive.getmembers() - - if len(members) > MAX_FILES + 1: - raise PackageError("Too many archive entries") - - names = set() - - for member in members: - if member.name in names: - raise PackageError("Duplicate archive entry") - names.add(member.name) - - if not member.isfile(): - raise PackageError("Only regular files are supported") - - if member.name != "manifest.json": - if not member.name.startswith("payload/"): - raise PackageError("Unexpected archive entry") - normalize_package_path(member.name[len("payload/"):]) - - if "manifest.json" not in names: - raise PackageError("Manifest missing") - - manifest_member = archive.getmember("manifest.json") - - if manifest_member.size > MAX_MANIFEST_SIZE: - raise PackageError("Manifest too large") - - stream = archive.extractfile(manifest_member) - if stream is None: - raise PackageError("Cannot read manifest") - - manifest = json.loads(stream.read()) - if not isinstance(manifest, dict): - raise PackageError("Manifest must be a JSON object") - try: - manifest["depends"] = validate_dependencies( - manifest.get("depends", []), package_name=manifest.get("name") - ) - except DependencyError as exc: - raise PackageError(f"Invalid dependency metadata: {exc}") from exc - - if manifest.get("format") != "TPK": - raise PackageError("Invalid package format") - - if manifest.get("format_version") != FORMAT_VERSION: - raise PackageError("Unsupported format version") - - entries = manifest.get("files") - - if not isinstance(entries, list) or not entries or len(entries) > MAX_FILES: - raise PackageError("Invalid manifest file list") - - expected = set() - - for entry in entries: - path = normalize_package_path(entry["path"]) - - if path in expected: - raise PackageError("Duplicate manifest path") - expected.add(path) - - digest = entry["sha256"] - size = entry["size"] - mode = entry["mode"] - - if not isinstance(digest, str) or len(digest) != 64 or any(c not in "0123456789abcdef" for c in digest): - raise PackageError("Invalid SHA-256") - - if type(size) is not int or size < 0: - raise PackageError("Invalid file size") - - if type(mode) is not int or mode < 0 or mode > 0o777: - raise PackageError("Invalid file mode") - - member_name = "payload/" + path - - if member_name not in names: - raise PackageError("Missing payload: " + path) - - member = archive.getmember(member_name) - - if member.size != size: - raise PackageError("Size mismatch: " + path) - - stream = archive.extractfile(member) - if stream is None: - raise PackageError("Cannot read payload: " + path) - - actual = hashlib.sha256(stream.read()).hexdigest() - - if actual != digest: - raise PackageError("Checksum mismatch: " + path) - - actual = {n[8:] for n in names if n.startswith("payload/")} - - if actual != expected: - raise PackageError("Unexpected payload entries") - - return manifest - - except PackageError: - raise - except PackageSecurityError as exc: - raise PackageError( - f"Package security validation failed: {exc}" - ) from exc - except (tarfile.TarError, json.JSONDecodeError, KeyError, TypeError, OSError, UnicodeError) as exc: - raise PackageError(f"Invalid package: {exc}") from exc - - -def package_info(package_path): - return validate_package(package_path) diff --git a/tpm/tpm/repository.py b/tpm/tpm/repository.py deleted file mode 100644 index 2c03969..0000000 --- a/tpm/tpm/repository.py +++ /dev/null @@ -1,399 +0,0 @@ -"""Local TPM repository indexes and Ed25519 signatures. - -The repository index is canonicalized as UTF-8 JSON (sorted keys, compact -separators) before it is signed or verified. Signatures are detached OpenSSL -Ed25519 signatures; the public key must be supplied from a trusted location. -""" - -import hashlib -import json -import os -import shutil -import subprocess -import tempfile -from datetime import datetime, timezone -from pathlib import Path - -from .package import PackageError, validate_package - -INDEX_FORMAT = "TPM-REPOSITORY" -INDEX_VERSION = 1 -DEFAULT_INDEX = "repository.json" -MAX_INDEX_BYTES = 16 * 1024 * 1024 -MAX_PACKAGES = 50000 -_HEX = set("0123456789abcdef") - - -class RepositoryError(Exception): - """Raised for invalid repository data, files, or signatures.""" - - -def _require_regular_file(path: Path, label: str) -> Path: - path = Path(path).expanduser() - try: - path.lstat() - except OSError as exc: - raise RepositoryError(f"Cannot access {label}: {path}: {exc}") from exc - if path.is_symlink() or not path.is_file(): - raise RepositoryError(f"{label} must be a regular, non-symlink file: {path}") - return path - - -def _sha256_file(path: Path): - digest = hashlib.sha256() - size = 0 - with Path(path).open("rb") as stream: - while True: - chunk = stream.read(1024 * 1024) - if not chunk: - break - digest.update(chunk) - size += len(chunk) - return size, digest.hexdigest() - - -def _canonical_json(data) -> bytes: - return json.dumps( - data, - ensure_ascii=False, - sort_keys=True, - separators=(",", ":"), - allow_nan=False, - ).encode("utf-8") - - -def _atomic_write(path: Path, data: bytes, mode=0o644): - path = Path(path).expanduser() - parent = path.parent.resolve(strict=True) - path = parent / path.name - if path.is_symlink(): - raise RepositoryError(f"Refusing to replace symlink: {path}") - fd, temporary = tempfile.mkstemp(prefix=f".{path.name}.", suffix=".tmp", dir=parent) - try: - with os.fdopen(fd, "wb") as stream: - os.fchmod(stream.fileno(), mode) - stream.write(data) - stream.flush() - os.fsync(stream.fileno()) - os.replace(temporary, path) - try: - dir_fd = os.open(parent, os.O_RDONLY) - try: - os.fsync(dir_fd) - finally: - os.close(dir_fd) - except OSError: - pass - except Exception: - try: - os.unlink(temporary) - except FileNotFoundError: - pass - raise - return path - - -def _dependencies_from_manifest(manifest): - # Stage 6 metadata is normally stored under "dependencies". Accept "depends" - # as well for compatibility with early package archives. - value = manifest.get("dependencies", manifest.get("depends", [])) - if value is None: - return [] - if not isinstance(value, list): - raise RepositoryError(f"Invalid dependency metadata in {manifest.get('name', '?')}") - result = [] - for item in value: - if isinstance(item, str) and item.strip(): - result.append(item) - elif isinstance(item, dict): - if not isinstance(item.get("name"), str) or not item["name"].strip(): - raise RepositoryError("Invalid structured dependency in package manifest") - result.append(item) - else: - raise RepositoryError("Invalid dependency entry in package manifest") - return result - - -def build_index(repository_dir, output=None, repository_name="TermOS"): - """Validate top-level .tpk files and create repository.json.""" - repo = Path(repository_dir).expanduser() - if repo.is_symlink() or not repo.is_dir(): - raise RepositoryError(f"Repository path must be a real directory: {repo}") - repo = repo.resolve(strict=True) - if not isinstance(repository_name, str) or not repository_name.strip() or len(repository_name) > 128: - raise RepositoryError("Repository name must contain 1..128 characters") - - archives = sorted(repo.glob("*.tpk"), key=lambda p: p.name.casefold()) - if len(archives) > MAX_PACKAGES: - raise RepositoryError(f"Repository contains more than {MAX_PACKAGES} packages") - - packages = [] - identities = set() - filenames = set() - for archive in archives: - _require_regular_file(archive, "package archive") - try: - manifest = validate_package(archive) - except PackageError as exc: - raise RepositoryError(f"Invalid package {archive.name}: {exc}") from exc - - name = manifest.get("name") - version = manifest.get("version") - architecture = manifest.get("architecture") - description = manifest.get("description", "") - if not all(isinstance(v, str) and v.strip() for v in (name, version, architecture)): - raise RepositoryError(f"Invalid package identity in {archive.name}") - if not isinstance(description, str): - raise RepositoryError(f"Invalid package description in {archive.name}") - - identity = (name, version, architecture) - if identity in identities: - raise RepositoryError(f"Duplicate package identity: {name} {version} [{architecture}]") - if archive.name in filenames: - raise RepositoryError(f"Duplicate package filename: {archive.name}") - identities.add(identity) - filenames.add(archive.name) - - size, digest = _sha256_file(archive) - packages.append({ - "name": name, - "version": version, - "architecture": architecture, - "description": description, - "filename": archive.name, - "size": size, - "sha256": digest, - "dependencies": _dependencies_from_manifest(manifest), - }) - - index = { - "format": INDEX_FORMAT, - "format_version": INDEX_VERSION, - "repository": {"name": repository_name.strip()}, - "generated_at": datetime.now(timezone.utc).replace(microsecond=0).isoformat(), - "packages": packages, - } - destination = Path(output).expanduser() if output is not None else repo / DEFAULT_INDEX - if not destination.is_absolute(): - destination = Path.cwd() / destination - destination.parent.mkdir(parents=True, exist_ok=True) - data = (json.dumps(index, ensure_ascii=False, sort_keys=True, indent=2) + "\n").encode("utf-8") - _atomic_write(destination, data, 0o644) - return destination, index - - -def load_index(index_path): - path = _require_regular_file(Path(index_path), "repository index") - try: - if path.stat().st_size > MAX_INDEX_BYTES: - raise RepositoryError("Repository index is too large") - data = json.loads(path.read_text(encoding="utf-8")) - except RepositoryError: - raise - except (OSError, UnicodeError, json.JSONDecodeError) as exc: - raise RepositoryError(f"Cannot read repository index: {exc}") from exc - - if not isinstance(data, dict) or data.get("format") != INDEX_FORMAT: - raise RepositoryError("Invalid repository index format") - if data.get("format_version") != INDEX_VERSION: - raise RepositoryError("Unsupported repository index version") - repository = data.get("repository") - if not isinstance(repository, dict) or not isinstance(repository.get("name"), str): - raise RepositoryError("Invalid repository metadata") - packages = data.get("packages") - if not isinstance(packages, list) or len(packages) > MAX_PACKAGES: - raise RepositoryError("Invalid repository package list") - - seen_identities = set() - seen_files = set() - for item in packages: - if not isinstance(item, dict): - raise RepositoryError("Invalid package record in repository index") - name, version, arch = item.get("name"), item.get("version"), item.get("architecture") - filename, digest, size = item.get("filename"), item.get("sha256"), item.get("size") - description, dependencies = item.get("description", ""), item.get("dependencies", []) - if not all(isinstance(v, str) and v.strip() for v in (name, version, arch)): - raise RepositoryError("Package record has invalid identity fields") - if (not isinstance(filename, str) or not filename.endswith(".tpk") - or Path(filename).name != filename or filename in (".", "..") - or "/" in filename or "\\" in filename): - raise RepositoryError(f"Unsafe package filename: {filename!r}") - if type(size) is not int or size <= 0: - raise RepositoryError(f"Invalid package size for {name}") - if not isinstance(digest, str) or len(digest) != 64 or any(c not in _HEX for c in digest): - raise RepositoryError(f"Invalid SHA-256 for {name}") - if not isinstance(description, str) or not isinstance(dependencies, list): - raise RepositoryError(f"Invalid optional metadata for {name}") - identity = (name, version, arch) - if identity in seen_identities: - raise RepositoryError(f"Duplicate package identity in index: {identity}") - if filename in seen_files: - raise RepositoryError(f"Duplicate package filename in index: {filename}") - seen_identities.add(identity) - seen_files.add(filename) - return data - - -def _openssl(*args): - executable = shutil.which("openssl") - if not executable: - raise RepositoryError("OpenSSL CLI not found; Ed25519 signing requires openssl") - result = subprocess.run( - [executable, *map(str, args)], stdout=subprocess.PIPE, - stderr=subprocess.PIPE, text=True, check=False, - ) - if result.returncode != 0: - detail = (result.stderr or result.stdout).strip() - raise RepositoryError(f"OpenSSL operation failed: {detail or 'unknown error'}") - return result.stdout.strip() - - -def generate_keypair(private_key, public_key, force=False): - private_path, public_path = Path(private_key).expanduser(), Path(public_key).expanduser() - if private_path.absolute() == public_path.absolute(): - raise RepositoryError("Private and public key paths must be different") - for path in (private_path, public_path): - path.parent.mkdir(parents=True, exist_ok=True) - if path.exists() and not force: - raise RepositoryError(f"Key file already exists (use --force to replace): {path}") - if path.is_symlink(): - raise RepositoryError(f"Refusing to use symlink key path: {path}") - - private_fd, private_tmp = tempfile.mkstemp(prefix=".tpm-ed25519-private-", dir=private_path.parent) - os.close(private_fd) - public_fd, public_tmp = tempfile.mkstemp(prefix=".tpm-ed25519-public-", dir=public_path.parent) - os.close(public_fd) - try: - _openssl("genpkey", "-algorithm", "ED25519", "-out", private_tmp) - _openssl("pkey", "-in", private_tmp, "-pubout", "-out", public_tmp) - os.chmod(private_tmp, 0o600) - os.chmod(public_tmp, 0o644) - os.replace(private_tmp, private_path) - os.replace(public_tmp, public_path) - except Exception: - for temp in (private_tmp, public_tmp): - try: - os.unlink(temp) - except FileNotFoundError: - pass - raise - return private_path, public_path - - -def _canonical_index_file(index_path): - return _canonical_json(load_index(index_path)) - - -def _write_temp_bytes(directory, prefix, data): - fd, path = tempfile.mkstemp(prefix=prefix, dir=directory) - with os.fdopen(fd, "wb") as stream: - stream.write(data) - stream.flush() - os.fsync(stream.fileno()) - return path - - -def sign_index(index_path, private_key, signature_path=None): - index_path = _require_regular_file(Path(index_path), "repository index") - private_key = _require_regular_file(Path(private_key), "private key") - canonical = _canonical_index_file(index_path) - signature = Path(signature_path).expanduser() if signature_path else Path(str(index_path) + ".sig") - signature.parent.mkdir(parents=True, exist_ok=True) - if signature.is_symlink(): - raise RepositoryError("Refusing to replace a symlink signature file") - with tempfile.TemporaryDirectory(prefix="tpm-sign-") as temporary: - message_path = _write_temp_bytes(temporary, "index-", canonical) - signature_tmp = Path(temporary) / "index.sig" - _openssl("pkeyutl", "-sign", "-inkey", private_key, "-rawin", "-in", message_path, "-out", signature_tmp) - data = signature_tmp.read_bytes() - _atomic_write(signature, data, 0o644) - return signature - - -def verify_index_signature(index_path, public_key, signature_path=None): - index_path = _require_regular_file(Path(index_path), "repository index") - public_key = _require_regular_file(Path(public_key), "trusted public key") - signature = Path(signature_path).expanduser() if signature_path else Path(str(index_path) + ".sig") - signature = _require_regular_file(signature, "repository signature") - canonical = _canonical_index_file(index_path) - with tempfile.TemporaryDirectory(prefix="tpm-verify-") as temporary: - message_path = _write_temp_bytes(temporary, "index-", canonical) - _openssl("pkeyutl", "-verify", "-pubin", "-inkey", public_key, - "-rawin", "-in", message_path, "-sigfile", signature) - return True - - -def verify_repository(repository_dir, index_name=DEFAULT_INDEX, public_key=None, - signature_path=None, allow_unsigned=False, verify_archives=True): - repo = Path(repository_dir).expanduser() - if repo.is_symlink() or not repo.is_dir(): - raise RepositoryError(f"Repository path must be a real directory: {repo}") - repo = repo.resolve(strict=True) - index_path = Path(index_name).expanduser() - if not index_path.is_absolute(): - index_path = repo / index_path - index = load_index(index_path) - sig_path = Path(signature_path).expanduser() if signature_path else Path(str(index_path) + ".sig") - - if sig_path.exists(): - if public_key is None: - raise RepositoryError("Repository is signed but no trusted --public-key was supplied") - verify_index_signature(index_path, public_key, sig_path) - signature_status = "verified" - else: - if public_key is not None: - raise RepositoryError("A public key was supplied but the repository signature is missing") - if not allow_unsigned: - raise RepositoryError("Unsigned repository rejected; explicitly use --allow-unsigned only for local testing") - signature_status = "unsigned (explicitly allowed)" - - indexed_filenames = {item["filename"] for item in index["packages"]} - archive_paths = list(repo.glob("*.tpk")) - for archive_path in archive_paths: - _require_regular_file(archive_path, "repository package archive") - actual_filenames = {path.name for path in archive_paths} - if actual_filenames != indexed_filenames: - extra = sorted(actual_filenames - indexed_filenames) - missing = sorted(indexed_filenames - actual_filenames) - raise RepositoryError(f"Repository archive inventory differs from index; extra={extra}, missing={missing}") - - checked = 0 - if verify_archives: - for item in index["packages"]: - archive = repo / item["filename"] - _require_regular_file(archive, "indexed package archive") - size, digest = _sha256_file(archive) - if size != item["size"] or digest != item["sha256"]: - raise RepositoryError(f"Package archive does not match signed index: {item['filename']}") - checked += 1 - return { - "repository": index["repository"]["name"], - "packages": len(index["packages"]), - "archives_verified": checked, - "signature": signature_status, - "index_path": str(index_path), - } - - -def search_packages(repository_dir, query, index_name=DEFAULT_INDEX, public_key=None, - signature_path=None, allow_unsigned=False): - if not isinstance(query, str) or not query.strip(): - raise RepositoryError("Search query cannot be empty") - repo = Path(repository_dir).expanduser().resolve(strict=True) - verification = verify_repository( - repo, index_name=index_name, public_key=public_key, - signature_path=signature_path, allow_unsigned=allow_unsigned, - verify_archives=True, - ) - index_path = Path(index_name).expanduser() - if not index_path.is_absolute(): - index_path = repo / index_path - index = load_index(index_path) - terms = query.casefold().split() - matches = [] - for item in index["packages"]: - haystack = " ".join((item["name"], item["version"], item["architecture"], item.get("description", ""))).casefold() - if all(term in haystack for term in terms): - matches.append(item) - matches.sort(key=lambda item: (item["name"].casefold(), item["version"], item["architecture"])) - return matches, verification diff --git a/tpm/tpm/security.py b/tpm/tpm/security.py deleted file mode 100644 index fed0590..0000000 --- a/tpm/tpm/security.py +++ /dev/null @@ -1,34 +0,0 @@ -import hashlib -from pathlib import PurePosixPath - - -class PackageSecurityError(Exception): - """Raised when a package path violates security rules.""" - - -def normalize_package_path(value: str) -> str: - if not isinstance(value, str) or not value: - raise PackageSecurityError("Empty package path") - - if "\x00" in value or "\\" in value: - raise PackageSecurityError("Invalid characters in package path") - - path = PurePosixPath(value) - - if path.is_absolute(): - raise PackageSecurityError("Absolute paths are forbidden") - - if any(part in ("", ".", "..") for part in value.split("/")): - raise PackageSecurityError("Unsafe package path") - - return path.as_posix() - - -def sha256_file(file_path) -> str: - digest = hashlib.sha256() - - with open(file_path, "rb") as file: - for chunk in iter(lambda: file.read(1024 * 1024), b""): - digest.update(chunk) - - return digest.hexdigest() diff --git a/tpm/tpm/uninstaller.py b/tpm/tpm/uninstaller.py deleted file mode 100644 index 3c53ea2..0000000 --- a/tpm/tpm/uninstaller.py +++ /dev/null @@ -1,236 +0,0 @@ -import hashlib -import os -import re -import shutil -import stat -import tempfile -from pathlib import Path - -from .database import load_database, save_database, validate_root -from .dependencies import DependencyError, find_dependents -from .security import normalize_package_path - - -class UninstallError(Exception): - pass - - -def _ensure_internal_directory(root, parts): - current = root - for part in parts: - candidate = current / part - try: - info = candidate.lstat() - except FileNotFoundError: - try: - candidate.mkdir(mode=0o700) - except FileExistsError: - pass - try: - info = candidate.lstat() - except FileNotFoundError as exc: - raise UninstallError(f"Internal directory disappeared: {candidate}") from exc - if stat.S_ISLNK(info.st_mode) or not stat.S_ISDIR(info.st_mode): - raise UninstallError(f"Unsafe TPM internal directory: {candidate}") - current = candidate - return current - - -def _check_parent_directories(root, parts): - current = root - for part in parts: - current = current / part - try: - info = current.lstat() - except FileNotFoundError: - return False - if stat.S_ISLNK(info.st_mode) or not stat.S_ISDIR(info.st_mode): - raise UninstallError(f"Unsafe path component: {current}") - return True - - -def _hash_regular_file(path): - try: - info = path.lstat() - except FileNotFoundError: - return None - - if stat.S_ISLNK(info.st_mode) or not stat.S_ISREG(info.st_mode): - raise UninstallError(f"Refusing to remove a non-regular file: {path}") - - flags = os.O_RDONLY - if hasattr(os, "O_NOFOLLOW"): - flags |= os.O_NOFOLLOW - fd = os.open(path, flags) - digest = hashlib.sha256() - size = 0 - with os.fdopen(fd, "rb") as stream: - while True: - chunk = stream.read(1024 * 1024) - if not chunk: - break - digest.update(chunk) - size += len(chunk) - return size, digest.hexdigest() - - -def remove_package(package_name, root_path, keep_modified=False): - if not isinstance(package_name, str) or not re.fullmatch( - r"[a-z0-9][a-z0-9+_.-]{0,127}", package_name - ): - raise UninstallError("Invalid package name") - - root = validate_root(root_path) - database = load_database(root) - packages = database["packages"] - - if package_name not in packages: - raise UninstallError(f"Package is not installed: {package_name}") - try: - blockers = find_dependents(package_name, packages) - except DependencyError as exc: - raise UninstallError(f"Cannot safely check dependents: {exc}") from exc - if blockers: - details = ", ".join(f"{name} ({spec})" for name, spec in blockers) - raise UninstallError( - f"Cannot remove {package_name}; it is required by installed package(s): {details}" - ) - - package = packages[package_name] - entries = package.get("files") - if not isinstance(entries, list): - raise UninstallError("Invalid package record in TPM database") - - checked = [] - seen = set() - modified = [] - missing = [] - - # Complete preflight before moving or deleting anything. - for entry in entries: - if not isinstance(entry, dict): - raise UninstallError("Invalid file record in TPM database") - try: - relative = normalize_package_path(entry["path"]) - expected_size = entry["size"] - expected_hash = entry["sha256"] - except (KeyError, TypeError, ValueError) as exc: - raise UninstallError(f"Invalid file record: {exc}") from exc - - if relative in seen: - raise UninstallError(f"Duplicate file record: {relative}") - seen.add(relative) - - parts = relative.split("/") - if relative == ".tpm-root" or relative.startswith(".tpm-root/"): - raise UninstallError("Package record references reserved TPM marker") - if relative == "var/lib/tpm" or relative.startswith("var/lib/tpm/"): - raise UninstallError("Package record references reserved TPM database area") - if type(expected_size) is not int or expected_size < 0: - raise UninstallError(f"Invalid recorded size: {relative}") - if ( - not isinstance(expected_hash, str) - or len(expected_hash) != 64 - or any(char not in "0123456789abcdef" for char in expected_hash) - ): - raise UninstallError(f"Invalid recorded SHA-256: {relative}") - - if not _check_parent_directories(root, parts[:-1]): - missing.append(relative) - continue - - destination = root.joinpath(*parts) - actual = _hash_regular_file(destination) - if actual is None: - missing.append(relative) - continue - - if actual != (expected_size, expected_hash): - modified.append(relative) - else: - checked.append((relative, destination)) - - if modified and not keep_modified: - preview = ", ".join(modified[:5]) - if len(modified) > 5: - preview += f", and {len(modified) - 5} more" - raise UninstallError( - "Modified files detected; nothing was removed. " - f"Use --keep-modified to leave them in place: {preview}" - ) - - transaction_parent = _ensure_internal_directory( - root, ("var", "lib", "tpm", "transactions") - ) - transaction = Path( - tempfile.mkdtemp(prefix="remove-", dir=str(transaction_parent)) - ) - moved = [] - committed = False - - try: - for relative, source in checked: - parts = relative.split("/") - backup = transaction.joinpath(*parts) - backup.parent.mkdir(parents=True, exist_ok=True) - - # Re-check immediately before moving the file. - if not _check_parent_directories(root, parts[:-1]): - raise UninstallError(f"File parent disappeared: {relative}") - current = _hash_regular_file(source) - expected = next( - (item["size"], item["sha256"]) - for item in entries - if item["path"] == relative - ) - if current != expected: - raise UninstallError(f"File changed during removal: {relative}") - - os.replace(source, backup) - moved.append((source, backup)) - - del packages[package_name] - save_database(root, database) - committed = True - - except Exception as exc: - rollback_errors = [] - for original, backup in reversed(moved): - try: - relative_parts = original.relative_to(root).parts - if not _check_parent_directories(root, relative_parts[:-1]): - raise OSError("original parent directory is missing") - if os.path.lexists(original): - raise OSError("original path is occupied; refusing to overwrite") - os.replace(backup, original) - except OSError as rollback_exc: - rollback_errors.append(f"{original}: {rollback_exc}") - - if rollback_errors: - details = "; ".join(rollback_errors) - raise UninstallError( - f"Removal failed ({exc}); rollback was incomplete. " - f"Recovery files remain in {transaction}: {details}" - ) from exc - shutil.rmtree(transaction, ignore_errors=True) - if isinstance(exc, UninstallError): - raise - raise UninstallError(f"Removal failed; changes rolled back: {exc}") from exc - - cleanup_warning = None - if committed: - try: - shutil.rmtree(transaction) - except OSError as exc: - cleanup_warning = ( - f"Package was removed, but temporary backup data remains at " - f"{transaction}: {exc}" - ) - - return { - "name": package_name, - "removed": len(moved), - "modified_kept": modified if keep_modified else [], - "missing": missing, - "cleanup_warning": cleanup_warning, - } diff --git a/tpm/tpm/upgrade.py b/tpm/tpm/upgrade.py deleted file mode 100644 index fe9fdb2..0000000 --- a/tpm/tpm/upgrade.py +++ /dev/null @@ -1,407 +0,0 @@ -"""Transactional package upgrades for the TermOS Package Manager.""" - -import hashlib -import os -import re -import shutil -import stat -import tarfile -import tempfile -from pathlib import Path - -from .database import load_database, save_database, validate_root -from .dependencies import ( - DependencyError, - check_installed_dependencies, - check_reverse_dependencies, -) -from .installer import _manifest_paths, _validate_manifest_identity -from .package import PackageError, validate_package -from .security import normalize_package_path - - -class UpgradeError(Exception): - """Raised when a package upgrade cannot be completed safely.""" - - -def _version_key(value): - """Parse a numeric dotted version (for example 1.2.3) for safe ordering.""" - if not isinstance(value, str) or len(value) > 128: - raise UpgradeError("Upgrade requires numeric dotted versions such as 1.2.3") - if not re.fullmatch(r"[0-9]+(?:\.[0-9]+){0,7}", value): - raise UpgradeError( - f"Unsupported version format: {value!r}; use numeric dotted versions such as 1.2.3" - ) - parts = [int(part) for part in value.split(".")] - if any(part > 2_147_483_647 for part in parts): - raise UpgradeError("Version component is too large") - while len(parts) > 1 and parts[-1] == 0: - parts.pop() - return tuple(parts) - - -def _safe_hash(path): - """Return (size, sha256) for a regular, non-symlink file; None if absent.""" - try: - info = path.lstat() - except FileNotFoundError: - return None - if stat.S_ISLNK(info.st_mode) or not stat.S_ISREG(info.st_mode): - raise UpgradeError(f"Refusing to replace a non-regular file: {path}") - - flags = os.O_RDONLY - if hasattr(os, "O_NOFOLLOW"): - flags |= os.O_NOFOLLOW - fd = os.open(path, flags) - digest = hashlib.sha256() - size = 0 - with os.fdopen(fd, "rb") as stream: - while True: - chunk = stream.read(1024 * 1024) - if not chunk: - break - digest.update(chunk) - size += len(chunk) - return size, digest.hexdigest() - - -def _check_parent(root, parts): - current = root - for part in parts: - current = current / part - try: - info = current.lstat() - except FileNotFoundError: - return - if stat.S_ISLNK(info.st_mode) or not stat.S_ISDIR(info.st_mode): - raise UpgradeError(f"Unsafe destination directory: {current}") - - -def _create_parent(root, parts, created_directories): - current = root - for part in parts: - candidate = current / part - try: - info = candidate.lstat() - except FileNotFoundError: - try: - candidate.mkdir(mode=0o755) - created_directories.append(candidate) - except FileExistsError: - pass - try: - info = candidate.lstat() - except FileNotFoundError as exc: - raise UpgradeError(f"Directory disappeared: {candidate}") from exc - if stat.S_ISLNK(info.st_mode) or not stat.S_ISDIR(info.st_mode): - raise UpgradeError(f"Unsafe destination directory: {candidate}") - current = candidate - return current - - -def _transaction_parent(root): - """Create and validate the internal transaction directory.""" - current = root - created = [] - for part in ("var", "lib", "tpm", "transactions"): - candidate = current / part - try: - info = candidate.lstat() - except FileNotFoundError: - try: - candidate.mkdir(mode=0o700 if part == "transactions" else 0o755) - created.append(candidate) - except FileExistsError: - pass - try: - info = candidate.lstat() - except FileNotFoundError as exc: - raise UpgradeError(f"TPM transaction directory disappeared: {candidate}") from exc - if stat.S_ISLNK(info.st_mode) or not stat.S_ISDIR(info.st_mode): - raise UpgradeError(f"Unsafe TPM transaction directory: {candidate}") - current = candidate - return current, created - - -def _validate_installed_entries(entries): - if not isinstance(entries, list): - raise UpgradeError("Invalid installed package record: files must be a list") - - result = {} - reserved = (".tpm-root", "var/lib/tpm") - for entry in entries: - if not isinstance(entry, dict): - raise UpgradeError("Invalid installed package file record") - try: - path = normalize_package_path(entry["path"]) - size = entry["size"] - digest = entry["sha256"] - mode = entry["mode"] - except (KeyError, TypeError, ValueError) as exc: - raise UpgradeError(f"Invalid installed package file record: {exc}") from exc - - if any(path == item or path.startswith(item + "/") for item in reserved): - raise UpgradeError(f"Installed package record references reserved path: {path}") - if path in result: - raise UpgradeError(f"Duplicate installed package path: {path}") - if type(size) is not int or size < 0: - raise UpgradeError(f"Invalid recorded file size: {path}") - if ( - not isinstance(digest, str) - or len(digest) != 64 - or any(char not in "0123456789abcdef" for char in digest) - ): - raise UpgradeError(f"Invalid recorded SHA-256: {path}") - if type(mode) is not int or mode < 0 or mode > 0o777: - raise UpgradeError(f"Invalid recorded file mode: {path}") - result[path] = entry - - paths = set(result) - for path in paths: - parts = path.split("/") - for index in range(1, len(parts)): - parent = "/".join(parts[:index]) - if parent in paths: - raise UpgradeError(f"Conflicting installed file paths: {parent} and {path}") - return result - - -def _manifest_record(manifest): - return { - "version": manifest["version"], - "architecture": manifest["architecture"], - "description": manifest.get("description", ""), - "depends": manifest.get("depends", []), - "files": [ - { - "path": entry["path"], - "sha256": entry["sha256"], - "size": entry["size"], - "mode": entry["mode"], - } - for entry in manifest["files"] - ], - } - - -def upgrade_package(package_path, root_path): - """Upgrade one installed package, rolling files back if commit fails.""" - root = validate_root(root_path) - package_path = Path(package_path) - - try: - manifest = validate_package(package_path) - except PackageError: - raise - - _validate_manifest_identity(manifest) - new_paths = _manifest_paths(manifest) - name = manifest["name"] - new_version = manifest["version"] - - database = load_database(root) - packages = database["packages"] - if name not in packages: - raise UpgradeError(f"Package is not installed: {name}") - - old_record = packages[name] - old_version = old_record.get("version") - if _version_key(new_version) <= _version_key(old_version): - raise UpgradeError( - f"New version {new_version} must be greater than installed version {old_version}" - ) - - if old_record.get("architecture") != manifest["architecture"]: - raise UpgradeError("Package architecture cannot change during an upgrade") - try: - check_installed_dependencies( - manifest.get("depends", []), packages, package_name=name - ) - check_reverse_dependencies(name, new_version, packages) - except DependencyError as exc: - raise UpgradeError(str(exc)) from exc - - old_entries = _validate_installed_entries(old_record.get("files")) - new_entries = {entry["path"]: entry for entry in manifest["files"]} - old_paths = set(old_entries) - new_path_set = set(new_paths) - - other_owned = { - item.get("path") - for other_name, record in packages.items() - if other_name != name - for item in record.get("files", []) - if isinstance(item, dict) and isinstance(item.get("path"), str) - } - for path in new_path_set: - for owned in other_owned: - if path == owned or path.startswith(owned + "/") or owned.startswith(path + "/"): - raise UpgradeError(f"New package path conflicts with another package: {path}") - - # Preflight every old file before making any change. Modified files are never - # silently overwritten or removed by an upgrade. - old_present = set() - for relative, entry in old_entries.items(): - parts = relative.split("/") - _check_parent(root, parts[:-1]) - destination = root.joinpath(*parts) - actual = _safe_hash(destination) - if actual is None: - continue # A missing old file can be restored by the new package. - if actual != (entry["size"], entry["sha256"]): - raise UpgradeError( - f"Modified installed file detected; upgrade aborted: {relative}" - ) - old_present.add(relative) - - # New paths not owned by the current package must be genuinely unused. - for relative in new_path_set - old_paths: - parts = relative.split("/") - _check_parent(root, parts[:-1]) - destination = root.joinpath(*parts) - if os.path.lexists(destination): - raise UpgradeError(f"Refusing to overwrite an unowned path: {relative}") - - transaction_parent, created_internal_dirs = _transaction_parent(root) - transaction = Path(tempfile.mkdtemp(prefix="upgrade-", dir=str(transaction_parent))) - stage_root = transaction / "stage" - backup_root = transaction / "backup" - stage_root.mkdir(mode=0o700) - backup_root.mkdir(mode=0o700) - - created_files = [] - created_directories = [] - moved_old_files = [] - committed = False - - try: - # Extract into a private staging area first. Nothing in the installed root - # changes until all incoming files have been rechecked and staged. - with tarfile.open(package_path, mode="r:") as archive: - for relative in new_paths: - entry = new_entries[relative] - member = archive.getmember("payload/" + relative) - source = archive.extractfile(member) - if source is None: - raise UpgradeError(f"Cannot read package file: {relative}") - - staged = stage_root.joinpath(*relative.split("/")) - staged.parent.mkdir(parents=True, exist_ok=True) - digest = hashlib.sha256() - total = 0 - with staged.open("xb") as output, source: - while True: - chunk = source.read(1024 * 1024) - if not chunk: - break - output.write(chunk) - digest.update(chunk) - total += len(chunk) - output.flush() - os.fchmod(output.fileno(), entry["mode"]) - os.fsync(output.fileno()) - - if total != entry["size"] or digest.hexdigest() != entry["sha256"]: - raise UpgradeError(f"Package content changed while staging: {relative}") - - # Move every still-present old file into the transaction backup. This - # includes obsolete paths that are absent from the new version. - for relative in sorted(old_present): - parts = relative.split("/") - source = root.joinpath(*parts) - current = _safe_hash(source) - expected = old_entries[relative] - if current != (expected["size"], expected["sha256"]): - raise UpgradeError(f"Installed file changed during upgrade: {relative}") - backup = backup_root.joinpath(*parts) - backup.parent.mkdir(parents=True, exist_ok=True) - os.replace(source, backup) - moved_old_files.append((source, backup)) - - # Put the staged new version in place without following symlinks and - # without overwriting an unexpected file that appeared after preflight. - for relative in new_paths: - entry = new_entries[relative] - parts = relative.split("/") - parent = _create_parent(root, parts[:-1], created_directories) - destination = parent / parts[-1] - flags = os.O_WRONLY | os.O_CREAT | os.O_EXCL - if hasattr(os, "O_NOFOLLOW"): - flags |= os.O_NOFOLLOW - fd = os.open(destination, flags, 0o600) - created_files.append(destination) - staged = stage_root.joinpath(*parts) - with os.fdopen(fd, "wb") as output, staged.open("rb") as source: - while True: - chunk = source.read(1024 * 1024) - if not chunk: - break - output.write(chunk) - output.flush() - os.fchmod(output.fileno(), entry["mode"]) - os.fsync(output.fileno()) - - packages[name] = _manifest_record(manifest) - save_database(root, database) - committed = True - - except Exception as exc: - rollback_errors = [] - - for path in reversed(created_files): - try: - path.unlink(missing_ok=True) - except OSError as rollback_exc: - rollback_errors.append(f"remove {path}: {rollback_exc}") - - for original, backup in reversed(moved_old_files): - try: - if os.path.lexists(original): - raise OSError("original path is occupied; refusing to overwrite") - parent = _create_parent(root, original.relative_to(root).parts[:-1], created_directories) - os.replace(backup, parent / original.name) - except OSError as rollback_exc: - rollback_errors.append(f"restore {original}: {rollback_exc}") - except UpgradeError as rollback_exc: - rollback_errors.append(f"restore {original}: {rollback_exc}") - - if rollback_errors: - details = "; ".join(rollback_errors) - raise UpgradeError( - f"Upgrade failed ({exc}); rollback was incomplete. " - f"Recovery data remains in {transaction}: {details}" - ) from exc - - for directory in reversed(created_directories): - try: - directory.rmdir() - except OSError: - pass - - shutil.rmtree(transaction, ignore_errors=True) - for directory in reversed(created_internal_dirs): - try: - directory.rmdir() - except OSError: - pass - - if isinstance(exc, (UpgradeError, PackageError)): - raise - raise UpgradeError(f"Upgrade failed; previous version restored: {exc}") from exc - - if committed: - shutil.rmtree(transaction) - for directory in reversed(created_internal_dirs): - try: - directory.rmdir() - except OSError: - pass - - return { - "name": name, - "old_version": old_version, - "new_version": new_version, - "added": len(new_path_set - old_paths), - "updated": len(new_path_set & old_paths), - "removed": len(old_paths - new_path_set), - } From 7f7184e5212405fdcbcd72858e46fc9f6ae365d3 Mon Sep 17 00:00:00 2001 From: MaybeSobi?! <261196905+MaybeSobi@users.noreply.github.com> Date: Wed, 18 Nov 2026 20:57:53 +0330 Subject: [PATCH 2/5] build: package the TermOS CLI for Debian live images --- .github/workflows/ci.yml | 2 +- config/package-lists/termos-base.list.chroot | 2 - config/packages.chroot/.gitkeep | 1 + .../0006-debian-package-integration.md | 19 +++++++ installer/README.md | 16 ++++++ scripts/build-deb.sh | 50 +++++++++++++++++++ scripts/build-iso.sh | 1 + src/termos/tui/README.md | 7 +++ 8 files changed, 95 insertions(+), 3 deletions(-) create mode 100644 config/packages.chroot/.gitkeep create mode 100644 docs/decisions/0006-debian-package-integration.md create mode 100644 installer/README.md create mode 100755 scripts/build-deb.sh create mode 100644 src/termos/tui/README.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d888a3f..da1a816 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,6 @@ jobs: - name: Validate Python package metadata run: | - python -m pip install --no-deps --no-build-isolation . + python -m pip install --no-deps . termos --version termos info diff --git a/config/package-lists/termos-base.list.chroot b/config/package-lists/termos-base.list.chroot index ede1a40..8936a85 100644 --- a/config/package-lists/termos-base.list.chroot +++ b/config/package-lists/termos-base.list.chroot @@ -10,8 +10,6 @@ less nano openssh-client python3 -python3-venv -python3-pip iproute2 iputils-ping pciutils diff --git a/config/packages.chroot/.gitkeep b/config/packages.chroot/.gitkeep new file mode 100644 index 0000000..f3a4422 --- /dev/null +++ b/config/packages.chroot/.gitkeep @@ -0,0 +1 @@ +This directory receives the locally built TermOS .deb package during ISO construction. diff --git a/docs/decisions/0006-debian-package-integration.md b/docs/decisions/0006-debian-package-integration.md new file mode 100644 index 0000000..e24e109 --- /dev/null +++ b/docs/decisions/0006-debian-package-integration.md @@ -0,0 +1,19 @@ +# ADR 0006: Package the TermOS CLI as a Debian Package + +- **Status:** Accepted for v0.3.0 +- **Date:** 2026-11-18 + +## Context + +The live ISO needs to include the TermOS CLI without using pip to modify the system Python environment or creating a parallel package manager. + +## Decision + +Build a small architecture-independent .deb package from the TermOS Python source using dpkg-deb. live-build installs this local package from config/packages.chroot. The package owns only the TermOS module under /usr/lib/python3/dist-packages and the termos entry point under /usr/bin. + +## Consequences + +- dpkg owns and tracks the installed TermOS CLI files. +- APT/dpkg remain the only package-management authority. +- The local .deb is generated during the build and is not committed as a binary artifact. +- The package build script must be tested and the generated package inspected before release. diff --git a/installer/README.md b/installer/README.md new file mode 100644 index 0000000..1390df4 --- /dev/null +++ b/installer/README.md @@ -0,0 +1,16 @@ +# Custom Installer + +The custom TermOS installer is planned for v0.5.0. This directory is an architectural placeholder, not an implemented installer. + +The installer will be a separate application running from the live environment. It will not be part of live-build itself. + +Mandatory safety requirements: +- Explicitly identify the target disk and partitions. +- Never format or repartition by default. +- Show the complete planned destructive changes before execution. +- Require a separate final confirmation. +- Stop when device identity or user intent is ambiguous. +- Keep an inspectable log and provide actionable failure details. +- Test only against disposable virtual disks until the workflow is proven. + +Do not add disk-writing behavior here until its design, test plan, and recovery behavior have been reviewed. diff --git a/scripts/build-deb.sh b/scripts/build-deb.sh new file mode 100755 index 0000000..2bb5ed4 --- /dev/null +++ b/scripts/build-deb.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" +PACKAGE_VERSION="${TERMOS_PACKAGE_VERSION:-0.3.0~dev1}" +STAGING_DIR="$ROOT_DIR/.build/deb-root" +PACKAGE_DIR="$ROOT_DIR/config/packages.chroot" +PACKAGE_FILE="$PACKAGE_DIR/termos_${PACKAGE_VERSION}_all.deb" + +command -v dpkg-deb >/dev/null 2>&1 || { + echo "ERROR: dpkg-deb is required to build the TermOS Debian package." >&2 + exit 1 +} + +[[ "$PACKAGE_VERSION" =~ ^[0-9A-Za-z.+:~_-]+$ ]] || { + echo "ERROR: invalid Debian package version: $PACKAGE_VERSION" >&2 + exit 2 +} + +rm -rf "$STAGING_DIR" +mkdir -p \ + "$STAGING_DIR/DEBIAN" \ + "$STAGING_DIR/usr/lib/python3/dist-packages" \ + "$STAGING_DIR/usr/bin" \ + "$PACKAGE_DIR" + +cp -a "$ROOT_DIR/src/termos" "$STAGING_DIR/usr/lib/python3/dist-packages/" + +cat > "$STAGING_DIR/DEBIAN/control" <= 3.11) +Maintainer: TermOS contributors +Description: TermOS command-line tools + A minimal CLI entry point for the Debian-based TermOS generation. +EOF + +cat > "$STAGING_DIR/usr/bin/termos" <<'EOF' +#!/usr/bin/python3 +from termos.cli import main + +raise SystemExit(main()) +EOF +chmod 0755 "$STAGING_DIR/usr/bin/termos" + +dpkg-deb --build --root-owner-group "$STAGING_DIR" "$PACKAGE_FILE" +echo "Built Debian package: $PACKAGE_FILE" diff --git a/scripts/build-iso.sh b/scripts/build-iso.sh index bd19f0f..b2a6673 100755 --- a/scripts/build-iso.sh +++ b/scripts/build-iso.sh @@ -17,6 +17,7 @@ command -v lb >/dev/null 2>&1 || { exit 1 } +./scripts/build-deb.sh lb config lb build diff --git a/src/termos/tui/README.md b/src/termos/tui/README.md new file mode 100644 index 0000000..a879a3e --- /dev/null +++ b/src/termos/tui/README.md @@ -0,0 +1,7 @@ +# TermOS TUI Control Center + +The TUI Control Center is planned after the v0.3.0 Debian foundation. + +The first implementation should be a Python TUI that calls shared TermOS application interfaces. It must not own privileged system logic or become the only way to administer the system. + +The CLI must remain independently usable. TUI actions must have documented CLI equivalents or stable API equivalents. From 40a1cf938cea4e35cec3df77bf745eb6e6430e53 Mon Sep 17 00:00:00 2001 From: MaybeSobi?! <261196905+MaybeSobi@users.noreply.github.com> Date: Wed, 18 Nov 2026 20:59:02 +0330 Subject: [PATCH 3/5] fix: harden local Debian package staging --- .gitignore | 2 ++ config/packages.chroot/.gitkeep | 1 - scripts/build-deb.sh | 11 +++++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) delete mode 100644 config/packages.chroot/.gitkeep diff --git a/.gitignore b/.gitignore index 669df0a..cf93858 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ /cache/ /chroot/ /binary/ +/.build/ +/config/packages.chroot/*.deb /*.iso /*.iso.sha256 /auto/config.old diff --git a/config/packages.chroot/.gitkeep b/config/packages.chroot/.gitkeep deleted file mode 100644 index f3a4422..0000000 --- a/config/packages.chroot/.gitkeep +++ /dev/null @@ -1 +0,0 @@ -This directory receives the locally built TermOS .deb package during ISO construction. diff --git a/scripts/build-deb.sh b/scripts/build-deb.sh index 2bb5ed4..9b2ec1f 100755 --- a/scripts/build-deb.sh +++ b/scripts/build-deb.sh @@ -3,9 +3,11 @@ set -Eeuo pipefail ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" PACKAGE_VERSION="${TERMOS_PACKAGE_VERSION:-0.3.0~dev1}" -STAGING_DIR="$ROOT_DIR/.build/deb-root" PACKAGE_DIR="$ROOT_DIR/config/packages.chroot" PACKAGE_FILE="$PACKAGE_DIR/termos_${PACKAGE_VERSION}_all.deb" +TEMP_DIR="$(mktemp -d "${TMPDIR:-/tmp}/termos-deb.XXXXXX")" +STAGING_DIR="$TEMP_DIR/root" +trap 'rm -rf "$TEMP_DIR"' EXIT command -v dpkg-deb >/dev/null 2>&1 || { echo "ERROR: dpkg-deb is required to build the TermOS Debian package." >&2 @@ -17,13 +19,18 @@ command -v dpkg-deb >/dev/null 2>&1 || { exit 2 } -rm -rf "$STAGING_DIR" +if [[ -L "$PACKAGE_DIR" ]]; then + echo "ERROR: refusing to write packages through a symlink: $PACKAGE_DIR" >&2 + exit 1 +fi + mkdir -p \ "$STAGING_DIR/DEBIAN" \ "$STAGING_DIR/usr/lib/python3/dist-packages" \ "$STAGING_DIR/usr/bin" \ "$PACKAGE_DIR" +find "$PACKAGE_DIR" -maxdepth 1 -type f -name 'termos_*_all.deb' -delete cp -a "$ROOT_DIR/src/termos" "$STAGING_DIR/usr/lib/python3/dist-packages/" cat > "$STAGING_DIR/DEBIAN/control" < Date: Wed, 18 Nov 2026 21:01:10 +0330 Subject: [PATCH 4/5] docs: preserve complete v0.2.0 release review records --- docs/archive/v0.2.0/LEGAL_REVIEW_CHECKLIST.md | 34 +++ docs/archive/v0.2.0/RELEASE_CHECKLIST.md | 91 +++++++- .../v0.2.0/THIRD_PARTY_LICENSE_REVIEW.md | 210 ++++++------------ 3 files changed, 181 insertions(+), 154 deletions(-) create mode 100644 docs/archive/v0.2.0/LEGAL_REVIEW_CHECKLIST.md diff --git a/docs/archive/v0.2.0/LEGAL_REVIEW_CHECKLIST.md b/docs/archive/v0.2.0/LEGAL_REVIEW_CHECKLIST.md new file mode 100644 index 0000000..b269868 --- /dev/null +++ b/docs/archive/v0.2.0/LEGAL_REVIEW_CHECKLIST.md @@ -0,0 +1,34 @@ +# TermOS 0.2.0 — Release, licensing, and validation checklist + +This checklist distinguishes evidence that CI generated successfully from obligations that still require review. Do not mark a legal obligation complete based only on the existence of Buildroot legal-info output. + +## Verified against the v0.2.0 tag + +- [x] The v0.2.0 Git tag points to commit 14e0173e354a44b640723755b28180a1c819af05. +- [x] Main-branch CI run #22 for that exact commit completed successfully. +- [x] ISO build, checksum generation, kernel configuration checks, and QEMU UEFI boot to init passed in run #22. +- [x] Buildroot legal-info completed and produced README and manifest.csv. +- [x] CI recorded 61 package collection entries and 86 successful license-file hash checks. These are collection counts, not a legal conclusion. +- [x] The release ISO SHA-256 was checked against the GitHub release asset digest: 4b09ad178f3eaf202ab4e26a1c6b60c83eb4d869074de4352e1be92ba56da565. +- [x] The repository MIT license applies to TermOS-authored project files only, not third-party components. + +## Remaining legal review + +- [ ] Inspect target and host manifests separately; identify unknown license/version fields. +- [ ] Inspect legal-info README and resolve or document missing-material warnings, including the Buildroot source warning. +- [ ] Compare license declarations with actual license texts, exceptions, dual licensing, and embedded notices. +- [ ] Identify corresponding source, patches, and build/install scripts for distributed copyleft components. +- [ ] Verify durable source access for the exact tagged build. +- [ ] Publish required third-party notices, license texts, source links or written-offer information, and checksums. +- [ ] Review whether the repository-wide MIT declaration accurately covers all TermOS-authored files and contributions. +- [ ] Obtain independent legal review before claiming legal certification or full compliance. + +## Physical hardware validation + +- [ ] Boot the exact v0.2.0 ISO from USB on physical x86_64 hardware. +- [ ] Record device model, firmware mode, boot result, display, keyboard, storage, and network observations. +- [ ] Test additional physical hardware before making broad compatibility claims. + +## Current status + +The v0.2.0 ISO is published. Passing CI and generating Buildroot legal-info do not prove legal compliance. The actual manifests, README warnings, and source obligations require review. This document is an engineering review record, not legal advice, a formal legal opinion, or a compliance certificate. diff --git a/docs/archive/v0.2.0/RELEASE_CHECKLIST.md b/docs/archive/v0.2.0/RELEASE_CHECKLIST.md index 53d1dbf..bec76ae 100644 --- a/docs/archive/v0.2.0/RELEASE_CHECKLIST.md +++ b/docs/archive/v0.2.0/RELEASE_CHECKLIST.md @@ -1,11 +1,90 @@ -# TermOS 0.2.0 — Release readiness +# TermOS v0.2.0 — Release and Validation Checklist -The detailed release and compliance status for v0.2.0 is maintained in the current checklist: +This document records the published state of TermOS v0.2.0. Check an item only when the result is supported by a release artifact, CI run, or recorded test. -**[Open the v0.2.0 compliance checklist](COMPLIANCE_CHECKLIST_0.2.0.md)** +## Release identity -This file remains as a compatibility link for older references. The current checklist separates successful build/release evidence from the remaining source-publication verification, contributor-rights confirmation, legal review, and physical-hardware testing. +- [x] Version: v0.2.0 +- [x] Release type: experimental preview +- [x] Build system: Buildroot 2025.02.19 +- [x] Linux kernel: 6.12.27 +- [x] Target architecture: x86_64 +- [x] Boot mode: UEFI +- [x] Release tag: https://github.com/MaybeSobi/TermOS/releases/tag/v0.2.0 -The exact package inventory is available in [THIRD_PARTY_COMPONENTS_0.2.0.csv](THIRD_PARTY_COMPONENTS_0.2.0.csv). The detailed package-level technical review is in [THIRD_PARTY_LICENSE_REVIEW_0.2.0.md](THIRD_PARTY_LICENSE_REVIEW_0.2.0.md), with the [third-party notices index](THIRD_PARTY_NOTICES.md) as the stable entry point. +## Published release assets -TermOS v0.2.0 is an experimental preview. The published ISO passed automated UEFI/QEMU validation, but it has not been verified on physical hardware. Buildroot legal-info and the generated inventory are technical evidence, not a legal opinion or compliance certificate. +- [x] TermOS-CI-x86_64.iso — 44,107,776 bytes +- [x] SHA256SUMS — published with the release +- [x] TermOS-Corresponding-Source-v0.2.0.tar.gz — 470,346,600 bytes +- [x] TermOS-Corresponding-Source-v0.2.0.tar.gz.sha256 — published with the source bundle +- [x] ISO SHA-256: 4b09ad178f3eaf202ab4e26a1c6b60c83eb4d869074de4352e1be92ba56da565 + +## CI and automated validation + +- [x] Main ISO workflow completed successfully — run 42126043907. +- [x] Source publisher workflow completed successfully — run 42126460206. +- [x] Automated UEFI/QEMU boot validation passed. +- [x] Source bundle was generated and attached to the release. +- [x] Source bundle checksum file was generated and published. + +## Manual boot validation + +- [x] Maintainer-reported boot test in VMware Workstation Pro 17 using UEFI. +- [x] Maintainer-reported successful boot on one physical computer. +- [ ] Record the physical computer's exact model and hardware specifications. +- [ ] Record the physical test date, USB creation method, and boot settings. +- [ ] Repeat physical boot testing on additional hardware. +- [ ] Record results for networking, storage, keyboard, display, and shutdown/reboot on each tested device. + +A successful boot on one physical computer is a useful smoke test, not a claim of broad hardware compatibility. + +## TPM validation status + +TPM is experimental in v0.2.0. Its documented capabilities include package archive validation, guarded system-root operations, local repository dependency resolution, and Ed25519-signed repository index verification. + +- [x] TPM test scripts are present for core, security, install, remove, rollback, upgrade, dependency, and repository behavior. +- [x] Guest/system-root test scripts are present. +- [ ] Run and record the complete TPM test suite against the exact v0.2.0 source and release image. +- [ ] Record the tested package fixtures and repository key setup. +- [ ] Keep documented v1 limitations visible: no maintainer-script execution and no symlink payload support. +- [ ] Do not describe HTTPS repository synchronization, key rotation, revocation, or repository freshness enforcement as supported in v0.2.0. + +## Known limitations and release caveats + +- TermOS v0.2.0 is an experimental UEFI ISO preview, not a full disk installer. +- Persistence across reboot depends on the boot and storage layout. +- TPM system-root operations modify the currently mounted root filesystem and must be tested in a disposable VM. +- TPM transaction tests do not prove recovery from power loss, kernel panic, or sudden hardware failure. +- Hardware compatibility beyond the recorded test machines is not established. + +## Third-party licensing and corresponding-source review + +The v0.2.0 corresponding-source archive is published. Publication of a source archive does not, by itself, establish that every third-party license obligation has been reviewed and satisfied. + +- [ ] Generate Buildroot legal-info from the exact Buildroot output used to produce the v0.2.0 ISO. +- [ ] Review the package manifest and license texts. +- [ ] Resolve or document missing-source warnings for all components that require corresponding source. +- [ ] Verify required copyright notices, license texts, and source-availability information. +- [ ] Record the review outcome and the location of the applicable notices/source materials. + +Do not treat a successful legal-info run or the existence of the source bundle as legal approval. + +## Reproducing the build + +The release build uses Buildroot 2025.02.19. From the TermOS repository root: + +~~~bash +./scripts/build.sh +~~~ + +The build script produces the ISO under build/images/rootfs.iso9660. + +For legal information, run from the Buildroot source directory using the same output directory as the release build: + +~~~bash +cd src/buildroot-2025.02.19 +make O="../../build" legal-info +~~~ + +This checklist is specific to v0.2.0. Do not reuse its completed status for v0.3.0. diff --git a/docs/archive/v0.2.0/THIRD_PARTY_LICENSE_REVIEW.md b/docs/archive/v0.2.0/THIRD_PARTY_LICENSE_REVIEW.md index b1507dc..91ba9b6 100644 --- a/docs/archive/v0.2.0/THIRD_PARTY_LICENSE_REVIEW.md +++ b/docs/archive/v0.2.0/THIRD_PARTY_LICENSE_REVIEW.md @@ -1,148 +1,62 @@ -# TermOS 0.2.0 — Third-party license review - -**Release:** v0.2.0 -**Release commit:** 14e0173e354a44b640723755b28180a1c819af05 -**Buildroot:** 2025.02.19 -**Linux:** 6.12.27 -**Architecture:** x86_64 - -## Review result - -The exact target and host manifests from the successful v0.2.0 CI build were inspected. The recorded technical results are: - -| Check | Result | -|---|---:| -| Target package entries | 10 | -| Host/build-tool package entries | 38 | -| Total manifest entries | 48 | -| Collected license-file entries | 86 | -| SHA-256 license-file checks reported successful by Buildroot | 86 | -| Blank/unknown declared license fields | 0 | -| Missing declared license-file fields | 0 | -| Source archive entries not found by the review generator | 1 | - -The one source entry not saved by legal-info is Buildroot itself: the host manifest lists version -gf7b6724 with source archive and source site marked "not saved". All other 47 manifest entries have source archives located by filename in the legal-info source directories. The sole explicit warning in the release legal-info README is that Buildroot source was not saved. - -The review generator reports human_review_required=true by design. A complete inventory is not the same as a legal opinion. Some declared license names are custom descriptions rather than SPDX identifiers, and some packages contain code under several different licenses. - -The exact source inventory is preserved in [THIRD_PARTY_COMPONENTS_0.2.0.csv](THIRD_PARTY_COMPONENTS_0.2.0.csv). The original full manifests and all collected license texts are also preserved in the legal-info archive used by the source-bundle publisher. - -## 1. Target image components - -These are the ten entries in Buildroot's target manifest. Their license-file names and source archive names are in the CSV inventory. - -| Package | Version | Buildroot-declared license | -|---|---|---| -| gcc-final | 13.4.0 | GPL-3.0-with-GCC-exception | -| glibc | 2.41-167-gf247c0a2fb5b3e48a771d2d23efc9a45c64e957d | GPL-2.0+ (programs), LGPL-2.1+, BSD-3-Clause, MIT (library) | -| linux-headers | 6.12.27 | GPL-2.0 | -| busybox | 1.37.0 | GPL-2.0, bzip2-1.0.6 | -| libffi | 3.4.6 | MIT | -| libopenssl | 3.5.9 | Apache-2.0 | -| libzlib | 1.3.2 | Zlib | -| python3 | 3.12.15 | Python-2.0, others | -| grub2 | 2.12 | GPL-3.0+ | -| linux | 6.12.27 | GPL-2.0 | - -### Target-license observations - -- **Linux and Linux headers:** Buildroot collects COPYING, the preferred GPL-2.0 text, and the Linux syscall exception. Preserve the exception text alongside the GPL text and the complete Linux source. -- **BusyBox:** the package is declared GPL-2.0 and additionally records the bzip2 1.0.6 license for bundled archive code. Both license files are collected; do not replace the latter with a generic GPL label. -- **glibc:** this is a multi-license package. The manifest identifies GPL for programs, LGPL for the library, and BSD/MIT portions. The source bundle must retain all glibc license files and any applicable notices. -- **GCC runtime:** the target gcc-final entry is declared GPL-3.0-with-GCC-exception and points to COPYING.RUNTIME. The exception must remain associated with the corresponding runtime components. -- **GRUB:** declared GPL-3.0+. Its COPYING text and exact source archive are part of the recorded legal-info material. -- **OpenSSL 3.5.9:** Buildroot declares Apache-2.0 and collects LICENSE.txt. Retain the license and any upstream NOTICE material that applies to this source release. -- **Python 3.12.15:** the package is declared "Python-2.0, others". The collected LICENSE identifies the Python Software Foundation License Version 2, the Zero-Clause BSD license for documentation examples, and states that some software incorporated into Python has different licenses. Therefore "others" must not be treated as a single license or silently dropped. The complete Python source archive and its upstream license file are included in the legal-info bundle; a final determination of every bundled module actually shipped in this image remains a human-review item. -- **libffi and zlib:** the manifest declares MIT and Zlib respectively; their upstream license files are collected. - -## 2. Host/build-tool components - -Host entries describe tools used to construct the image. They are not automatically software shipped in the target ISO, but they are included in the source/evidence package to support reproducibility and review of the build process. - -| Package | Version | Buildroot-declared license | -|---|---|---| -| buildroot | -gf7b6724 | GPL-2.0+ | -| gcc-final | 13.4.0 | GPL-2.0, GPL-3.0, LGPL-2.1, LGPL-3.0 | -| bison | 3.8.2 | GPL-3.0+ | -| m4 | 1.4.21 | GPL-3.0+ | -| gawk | 5.3.1 | GPL-3.0+ | -| gcc-initial | 13.4.0 | GPL-2.0, GPL-3.0, LGPL-2.1, LGPL-3.0 | -| binutils | 2.43.1 | GPL-3.0+, GPL-2.0+, LGPL-2.1+ | -| gmp | 6.3.0 | LGPL-3.0+ or GPL-2.0+ | -| autoconf | 2.72 | GPL-3.0+ with exceptions | -| libtool | 2.4.6 | GPL-2.0+ (libtool), LGPL-2.1+ (libltdl) | -| automake | 1.16.5 | GPL-2.0+ | -| mpc | 1.3.1 | LGPL-3.0+ | -| mpfr | 4.1.1 | LGPL-3.0+ | -| e2fsprogs | 1.47.2 | GPL-2.0, MIT-like with advertising clause (libss and libet) | -| libarchive | 3.8.9 | BSD-2-Clause, BSD-3-Clause, CC0-1.0, OpenSSL, Apache-2.0 | -| libzlib | 1.3.2 | Zlib | -| pkgconf | 2.3.0 | pkgconf license | -| util-linux | 2.40.4 | GPL-2.0+, BSD-4-Clause, LGPL-2.1+ (libblkid, libfdisk, libmount), BSD-3-Clause (libuuid), BSD-2-Clause (xxhash), ISC (rfkill), MIT (hardlink, flock) | -| kmod | 33 | LGPL-2.1+ (library) | -| patchelf | 0.13 | GPL-3.0+ | -| python3 | 3.12.15 | Python-2.0, others | -| autoconf-archive | 2023.02.20 | GPL-3.0+ with exception | -| expat | 2.9.0 | MIT | -| libffi | 3.4.6 | MIT | -| flex | 2.6.4 | FLEX | -| gettext-tiny | 0.3.2 | MIT, GPL-3.0+ (extra gettext) | -| grub2 | 2.12 | GPL-3.0+ | -| elfutils | 0.193 | GPL-2.0+ or LGPL-3.0+ (library) | -| bzip2 | 1.0.8 | bzip2 license | -| xz | 5.6.4 | 0BSD, GPL-2.0+, GPL-3.0+, LGPL-2.1+, FSFUL, FSFULLR, Public Domain | -| zstd | 1.5.7 | BSD-3-Clause or GPL-2.0 | -| acl | 2.3.2 | GPL-2.0+ (programs), LGPL-2.1+ (libraries) | -| attr | 2.5.2 | GPL-2.0+ (programs), LGPL-2.1+ (libraries) | -| fakeroot | 1.36 | GPL-3.0+ | -| dosfstools | 4.2 | GPL-3.0+ | -| lzip | 1.25 | GPL-2.0+ | -| mtools | 4.0.48 | GPL-3.0+ | -| xorriso | 1.5.4.pl02 | GPL-3.0+ | - -### Custom and multi-license host entries - -The following entries deserve individual attention rather than being normalized to a convenient SPDX label: - -- **flex 2.6.4:** Buildroot calls the license FLEX. The collected COPYING is a modified Berkeley/Flex BSD-style notice with retention conditions, a disclaimer, and a non-endorsement clause. Preserve the actual text. -- **pkgconf 2.3.0:** Buildroot calls this "pkgconf license". Its collected COPYING is a short permissive notice requiring preservation of copyright and permission text plus a warranty disclaimer. Retain the original text rather than inventing an SPDX identifier. -- **bzip2 1.0.8:** the package uses its own multi-condition bzip2 license, not a generic MIT/BSD label. Preserve its original LICENSE and conditions. -- **e2fsprogs 1.47.2:** its NOTICE distinguishes GPL-2.0 utilities, LGPL-covered libraries, a BSD-style UUID library, and MIT-style libet/libss code with an advertising clause. The collected NOTICE and the specified source/header license files must travel together. -- **libarchive 3.8.9:** multiple license families are declared. The complete source and COPYING file are included; preserve the individual notices present in the source distribution. -- **util-linux 2.40.4:** licensing differs by subcomponent (including GPL, BSD, LGPL, ISC, and MIT portions). Do not apply one license to the whole source tree. -- **xz 5.6.4:** the recipe records several possible license families, including 0BSD, GPL, LGPL, FSFUL/FSFULLR, and public-domain material. Preserve the source's separate license texts and patches. -- **GCC, GMP, MPC, MPFR, binutils, glibc, and Linux:** these are material to the internal Buildroot toolchain or target runtime. Their distinct source archives and license texts are included in the host/target legal-info trees; the GCC runtime exception and the glibc/Linux exceptions must not be omitted. - -## 3. Corresponding-source and notice preparation - -The release legal-info README contains one explicit warning: Buildroot source itself was not saved. It also explains two limitations of legal-info: - -1. Toolchain source may need to be collected manually. In this build, the host manifest records source archives for the internal GCC toolchain components, including GCC initial/final, binutils, GMP, MPC, and MPFR. The source bundle includes the host-sources directory so those sources and their collected patches are available for inspection. -2. Buildroot applies additional patches to Libtool scripts under support/libtool; these are not copied into each package's legal-info source tree. The exact Buildroot 2025.02.19 source archive is therefore included separately in the source bundle, along with its original detached signature. - -The automated corresponding-source publisher is configured to take the legal-info archive from the successful release-build run, add the exact TermOS v0.2.0 tag source snapshot, add the official Buildroot 2025.02.19 source archive and signature, include the CycloneDX SBOM and compliance documents, generate SHA-256 sums, and attach the resulting source archive and checksum to the existing v0.2.0 GitHub release. Publication is only complete after that workflow succeeds and the two assets are visible on the release page. - -## 4. Buildroot inventory limitations - -Buildroot documents that legal-info is based on declarative package recipe metadata. It collects more material than every license strictly requires, and its metadata may be inaccurate or incomplete. It is therefore not a substitute for checking the actual package version and source. Buildroot also says it does not normally collect its own source, and its legal-info output omits the additional support/libtool patch material described above. - -TermOS also generates a CycloneDX SBOM using Buildroot's show-info and generate-cyclonedx tools. The SBOM is useful for machine-readable inventory, but it also relies on Buildroot package metadata and does not independently prove legal compliance. - -## 5. Remaining human decisions - -The technical evidence and reproducible source bundle are being prepared in the repository. The following decisions cannot be honestly marked as completed solely from CI: - -- Confirm that all TermOS-authored files are covered by the repository MIT license and that every contributor had the right to contribute under that license. -- Resolve the detailed scope of "others" in Python's package license and every relevant subcomponent license for the exact binary. -- Have a qualified legal reviewer assess any remaining interpretation of GPL/LGPL, Apache-2.0, multi-license packages, and whether the publication method satisfies the applicable obligations for this specific distribution. -- Confirm the corresponding-source archive has been attached successfully to the public v0.2.0 release and can be downloaded and verified by a third party. - -This document is a technical review record, not a legal opinion, legal audit opinion, or certificate. No legal certification is claimed. - -## References - -- [Buildroot manual — legal notice and licensing](https://buildroot.org/downloads/manual/manual.html#legal-notice-and-licensing) -- [Official Buildroot 2025.02.19 source archive and PGP signature](https://buildroot.org/downloads/buildroot-2025.02.19.tar.xz) -- [Buildroot download page](https://buildroot.org/download.html) -- [TermOS v0.2.0 release](https://github.com/MaybeSobi/TermOS/releases/tag/v0.2.0) -- [TermOS v0.2.0 CI workflow run #22](https://github.com/MaybeSobi/TermOS/actions/runs/42106722558) +# TermOS 0.2.0 — Third-party license review record + +**Review status:** Preliminary inventory review; not a legal opinion or certification +**Release tag:** v0.2.0 +**Tagged commit:** 14e0173e354a44b640723755b28180a1c819af05 +**Build system:** Buildroot 2025.02.19 +**Evidence:** Main-branch CI run #22 + +## 1. Scope + +This record covers the x86_64 ISO produced by the TermOS v0.2.0 tagged commit. It separates software included in the target image from host-only tools used to build the image. Host tools are part of the build record, but their presence in Buildroot's host manifest does not mean they are shipped in the ISO. + +TermOS's repository MIT license applies only to TermOS-authored project files. It does not replace the licenses of the Linux kernel, BusyBox, glibc, GRUB, OpenSSL, Python, Buildroot, or other third-party components. + +## 2. CI evidence collected + +The successful run #22 built the tagged commit and completed Buildroot legal-info generation, ISO format and SHA-256 checks, and QEMU UEFI boot validation until init was reached. + +The legal-info section of the job log contains 61 package collection entries and 86 successful SHA-256 checks for collected license/notice files. These counts describe log output; they are not a count of distinct target packages or a legal conclusion. + +Buildroot reported: "WARNING: the Buildroot source code has not been saved". This warning must be considered alongside the actual README and manifests. Buildroot is the build system; it is not automatically a package shipped in the target ISO. Exact build sources, patches, configuration, and scripts needed for distributed copyleft components still require individual verification. + +## 3. Selected upstream recipe declarations + +The following are declarations in Buildroot 2025.02.19 recipes for components identified in the v0.2.0 legal-info collection log. They are a cross-check, not a substitute for the exact target manifest or source inspection. + +| Component | Version in CI log | Recipe license declaration | Review note | +| --- | --- | --- | --- | +| Linux kernel | 6.12.27 | GPL-2.0 | Verify exact source, patches, configuration, and exceptions. | +| GRUB 2 | 2.12 | GPL-3.0+ | Copyleft source and notices must be included or made available. | +| BusyBox | 1.37.0 | GPL-2.0; bzip2-1.0.6 | Check configuration and source; include the bzip2 license text. | +| glibc | 2.41 snapshot | GPL-2.0+ (programs), LGPL-2.1+, BSD-3-Clause, MIT (library) | Multi-license component; do not reduce to one SPDX label. | +| OpenSSL library | 3.5.9 | Apache-2.0 | Preserve license and required notices. | +| Python | 3.12.15 | Python-2.0, others | The "others" declaration requires investigation of bundled components. | +| zlib | 1.3.2 | Zlib | Preserve notice and confirm source version. | +| libffi | 3.4.6 | MIT | Preserve license notice. | + +The CI collection log also lists host-kmod 33; its recipe declares LGPL-2.1+ for the library and GPL-2.0+ for tools. This is a host-side build dependency in the observed log, not evidence that kmod is in the target ISO. + +The exact manifest.csv and host-manifest.csv from the tagged build still require manual inspection. Recipe declarations can differ from actual package contents, and sources may contain additional separately licensed files or exceptions. + +## 4. What is not verified + +The actual target manifest, host manifest, and complete legal-info README were not manually inspected in the preliminary review. This record does not assert that every package has a known and correct license, every license text has been matched, all source obligations are satisfied, all notices are present, or the MIT declaration covers every contribution with valid authorship evidence. + +## 5. Review workflow + +1. Read README and record every warning. +2. Review target manifest and host manifest separately. +3. Flag missing or unknown license/version fields. +4. Compare recipe declarations with collected texts and package-specific exceptions. +5. Identify exact corresponding source, patches, and applicable build/install scripts for every copyleft component in the target image. +6. Publish durable notices and source-access information once verified. +7. Retain the exact source/configuration snapshot associated with the ISO. + +## 6. References + +- Buildroot manual — legal information: https://buildroot.org/downloads/manual/manual.html +- GNU GPL FAQ: https://www.gnu.org/licenses/gpl-faq.en.html +- GNU GPL v2: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html + +This document is an engineering review record, not legal advice, a formal legal opinion, or a compliance certificate. From 266c872ab74444033667da5f12a5f03dcdde1cc3 Mon Sep 17 00:00:00 2001 From: MaybeSobi?! <261196905+MaybeSobi@users.noreply.github.com> Date: Wed, 18 Nov 2026 21:02:18 +0330 Subject: [PATCH 5/5] ci: verify Debian package contents and live configuration --- .github/workflows/ci.yml | 9 +++++++++ config/package-lists/termos-base.list.chroot | 2 ++ 2 files changed, 11 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da1a816..2105424 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,15 @@ jobs: sh -n auto/config bash -n scripts/*.sh + - name: Build and inspect the TermOS Debian package + run: | + ./scripts/build-deb.sh + dpkg-deb --info config/packages.chroot/termos_0.3.0~dev1_all.deb + mkdir -p /tmp/termos-package-test + dpkg-deb --extract config/packages.chroot/termos_0.3.0~dev1_all.deb /tmp/termos-package-test + PYTHONPATH=/tmp/termos-package-test/usr/lib/python3/dist-packages python -m termos --version + PYTHONPATH=/tmp/termos-package-test/usr/lib/python3/dist-packages python -m termos info + - name: Validate Python package metadata run: | python -m pip install --no-deps . diff --git a/config/package-lists/termos-base.list.chroot b/config/package-lists/termos-base.list.chroot index 8936a85..9a042c6 100644 --- a/config/package-lists/termos-base.list.chroot +++ b/config/package-lists/termos-base.list.chroot @@ -1,4 +1,6 @@ live-boot +live-config +live-config-systemd systemd-sysv sudo network-manager