forked from tfgrid/zosbuilder
Summary
- Implemented plain S3-only flist workflow (no web endpoint). rfs pack uploads blobs using write creds; flist route.url is patched to embed read-only S3 credentials so rfs mount reads directly from S3.
Changes
1) New RFS tooling (scripts/rfs/)
- common.sh:
- Compute FULL_KERNEL_VERSION from configs (no uname).
- Load S3 config and construct pack store URI.
- Build read-only S3 route URL and patch flist (sqlite).
- Helpers to locate modules/firmware trees and rfs binary.
- pack-modules.sh:
- Pack /lib/modules/<FULL_KERNEL_VERSION> to dist/flists/modules-<FULL_KERNEL_VERSION>.fl
- Patch flist route to s3://READ:READ@host:port/ROUTE_PATH?region=ROUTE_REGION (default /blobs, garage).
- Optional upload of .fl using MinIO client (mcli/mc).
- pack-firmware.sh:
- Source firmware from $PROJECT_ROOT/firmware (fallback to initramfs/lib/firmware).
- Pack to dist/flists/firmware-<TAG_OR_DATE>.fl (FIRMWARE_TAG or YYYYMMDD).
- Patch flist route to read-only S3; optional .fl upload via mcli/mc.
- verify-flist.sh:
- rfs flist inspect/tree; optional mount test (best effort).
- patch-stores.sh:
- Helper to patch stores (kept though not used by default).
2) Dev-container (Dockerfile)
- Added sqlite and MinIO client package for manifest patching/upload (expect mcli binary at runtime; scripts support both mcli/mc).
- Retains rustup and musl target for building rfs/zinit/mycelium.
3) Config and examples
- config/rfs.conf.example:
- S3_ENDPOINT/S3_REGION/S3_BUCKET/S3_PREFIX
- S3_ACCESS_KEY/S3_SECRET_KEY (write)
- READ_ACCESS_KEY/READ_SECRET_KEY (read-only)
- ROUTE_ENDPOINT (defaults to S3_ENDPOINT), ROUTE_PATH=/blobs, ROUTE_REGION=garage
- MANIFESTS_SUBPATH, UPLOAD_MANIFESTS (mcli upload optional)
- config/rfs.conf updated by user with real values (not committed here; example included).
- config/modules.conf minor tweak (staged).
4) Zinit mount scripts (config/zinit/init/)
- firmware.sh:
- Mounts firmware-latest.fl over /usr/lib/firmware using rfs mount (env override FIRMWARE_FLIST supported).
- modules.sh:
- Mounts modules-$(uname -r).fl over /lib/modules/$(uname -r) (env override MODULES_FLIST supported).
- Both skip if target already mounted and respect RFS_BIN env.
5) Documentation
- docs/rfs-flists.md:
- End-to-end flow, S3-only route URL patching, mcli upload notes.
- docs/review-rfs-integration.md:
- Integration points, build flow, and post-build standalone usage.
- docs/depmod-behavior.md:
- depmod reads .modinfo; recommend prebuilt modules.*(.bin); use depmod -A only on mismatch.
6) Utility
- scripts/functionlist.md synced with current functions.
Behavioral details
- Pack (write):
s3://S3_ACCESS_KEY:S3_SECRET_KEY@HOST:PORT/S3_BUCKET/S3_PREFIX?region=REGION
- Flist route (read, post-patch):
s3://READ_ACCESS_KEY:READ_SECRET_KEY@HOST:PORT/ROUTE_PATH?region=ROUTE_REGION
Defaults: ROUTE_PATH=/blobs, ROUTE_REGION=garage; ROUTE_ENDPOINT derived from S3_ENDPOINT if not set.
Runtime mount examples
- Modules:
rfs mount -m dist/flists/modules-6.12.44-Zero-OS.fl /lib/modules/6.12.44-Zero-OS
- Firmware:
rfs mount -m dist/flists/firmware-YYYYMMDD.fl /usr/lib/firmware
Notes
- FUSE policy: If "allow_other" error occurs, enable user_allow_other in /etc/fuse.conf or run mounts as root.
- WEB_ENDPOINT rewrite is disabled by default (set WEB_ENDPOINT=""). Plain S3 route is embedded in flists.
- MinIO client binary in dev-container is mcli; scripts support mcli (preferred) and mc (fallback).
Files added/modified
- Added: scripts/rfs/{common.sh,pack-modules.sh,pack-firmware.sh,verify-flist.sh,patch-stores.sh}
- Added: config/zinit/init/{firmware.sh,modules.sh}
- Added: docs/{rfs-flists.md,review-rfs-integration.md,depmod-behavior.md}
- Added: config/rfs.conf.example
- Modified: Dockerfile, scripts/functionlist.md, config/modules.conf, config/zinit/sshd-setup.yaml, .gitignore
5.6 KiB
5.6 KiB
Function List - scripts/lib Library
This document lists all functions currently defined under scripts/lib with their source locations.
alpine.sh - Alpine Linux operations
File: scripts/lib/alpine.sh
- alpine_extract_miniroot() - Download and extract Alpine miniroot
- alpine_setup_chroot() - Setup chroot mounts and resolv.conf
- alpine_cleanup_chroot() - Unmount chroot mounts
- alpine_install_packages() - Install packages from packages.list
- alpine_aggressive_cleanup() - Reduce image size by removing docs/locales/etc
- alpine_configure_repos() - Configure APK repositories
- alpine_configure_system() - Configure hostname, hosts, timezone, profile
- alpine_install_firmware() - Install required firmware packages
common.sh - Core utilities
File: scripts/lib/common.sh
- log_info()
- log_warn()
- log_error()
- log_debug()
- safe_execute()
- section_header()
- command_exists()
- in_container()
- check_dependencies()
- safe_mkdir()
- safe_rmdir()
- safe_copy()
- is_absolute_path()
- resolve_path()
- get_file_size()
- wait_for_file()
- cleanup_on_exit()
components.sh - Component management
File: scripts/lib/components.sh
- components_parse_sources_conf()
- components_download_git()
- components_download_release()
- components_process_extra_options()
- components_build_component()
- components_setup_rust_env()
- build_zinit()
- build_rfs()
- build_mycelium()
- install_rfs()
- install_corex()
- components_verify_installation()
- components_cleanup()
docker.sh - Container runtime management
File: scripts/lib/docker.sh
- docker_detect_runtime()
- docker_verify_rootless()
- docker_build_container()
- docker_create_dockerfile()
- docker_start_rootless()
- docker_run_build()
- docker_commit_builder()
- docker_cleanup()
- docker_check_capabilities()
- docker_setup_rootless()
initramfs.sh - Initramfs assembly
File: scripts/lib/initramfs.sh
- initramfs_setup_zinit()
- initramfs_install_init_script()
- initramfs_copy_components()
- initramfs_setup_modules()
- initramfs_resolve_module_dependencies()
- initramfs_create_module_scripts()
- initramfs_strip_and_upx()
- initramfs_finalize_customization()
- initramfs_create_cpio()
- initramfs_validate()
- initramfs_test_archive()
- initramfs_copy_resolved_modules()
kernel.sh - Kernel building
File: scripts/lib/kernel.sh
- kernel_get_full_version()
- kernel_download_source()
- kernel_apply_config()
- kernel_modify_config_for_initramfs()
- kernel_build_with_initramfs()
- kernel_build_modules()
- kernel_cleanup()
stages.sh - Build stage tracking
File: scripts/lib/stages.sh
- stages_init()
- stage_is_completed()
- stage_mark_completed()
- stage_force_rebuild()
- stages_clear_all()
- stage_run()
- stages_status()
testing.sh - Boot testing
File: scripts/lib/testing.sh