Integrate Particle-OS tools into simple-cli
Some checks failed
Build Simple CLI / build (push) Failing after 1s

- Add apt-ostree, deb-bootupd, and bootc packages to tools/
- Update Containerfile to install Particle-OS tools with dependencies
- Add tool verification script and updated welcome message
- Update justfile with new build and test recipes
- Add comprehensive tool testing and bootable image generation
- Successfully integrate 2/3 tools (apt-ostree and bootupd working)
- Note: bootc package contains only documentation, not binary

Ready for bootable image generation and QEMU testing!
This commit is contained in:
joe 2025-08-15 07:56:10 -07:00
parent 6aa6d32e1e
commit 9e9d4ea8d2
19 changed files with 1603 additions and 130 deletions

153
scripts/analyze-boot.sh Executable file
View file

@ -0,0 +1,153 @@
#!/bin/bash
# Boot Performance Analysis Script for Simple-CLI
# This script analyzes and optimizes boot performance
set -e
echo "=== Simple-CLI Boot Performance Analysis ==="
echo ""
# Function to measure boot time
measure_boot_time() {
echo "📊 Measuring boot performance..."
if command -v systemd-analyze >/dev/null 2>&1; then
echo "⏱️ Total boot time:"
systemd-analyze time
echo ""
echo "🐌 Slowest services:"
systemd-analyze blame | head -10
echo ""
echo "🔗 Critical boot chain:"
systemd-analyze critical-chain
echo ""
echo "📈 Boot timeline:"
systemd-analyze plot > /tmp/boot-timeline.svg 2>/dev/null && echo "Timeline saved to /tmp/boot-timeline.svg" || echo "Timeline generation failed"
else
echo "❌ systemd-analyze not available"
fi
}
# Function to check boot configuration
check_boot_config() {
echo ""
echo "🔍 Checking boot configuration..."
# Check GRUB configuration
if [ -f /etc/default/grub ]; then
echo "✅ GRUB config found"
echo " Timeout: $(grep GRUB_TIMEOUT /etc/default/grub || echo 'Not set')"
echo " Kernel params: $(grep GRUB_CMDLINE_LINUX /etc/default/grub || echo 'Not set')"
else
echo "❌ GRUB config not found"
fi
# Check systemd configuration
if [ -f /etc/systemd/system.conf.d/99-boot-performance.conf ]; then
echo "✅ Boot performance config found"
cat /etc/systemd/system.conf.d/99-boot-performance.conf
else
echo "❌ Boot performance config not found"
fi
# Check kernel parameters
if [ -f /etc/sysctl.d/99-boot-performance.conf ]; then
echo "✅ Kernel performance config found"
cat /etc/sysctl.d/99-boot-performance.conf
else
echo "❌ Kernel performance config not found"
fi
}
# Function to enable verbose boot logging
enable_verbose_logging() {
echo ""
echo "🔧 Enabling verbose boot logging..."
# Enable verbose GRUB logging
if [ -f /etc/default/grub ]; then
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="[^"]*"/GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0 root=\/dev\/sda1 rw quiet splash fastboot loglevel=7"/' /etc/default/grub
echo "✅ Verbose GRUB logging enabled"
fi
# Enable verbose systemd logging
mkdir -p /etc/systemd/system.conf.d
cat > /etc/systemd/system.conf.d/99-verbose-boot.conf << EOF
[Manager]
LogLevel=debug
LogTarget=console
EOF
echo "✅ Verbose systemd logging enabled"
# Enable verbose kernel logging
mkdir -p /etc/sysctl.d
echo "kernel.printk = 7 4 1 7" > /etc/sysctl.d/99-verbose-kernel.conf
echo "✅ Verbose kernel logging enabled"
}
# Function to optimize boot performance
optimize_boot() {
echo ""
echo "⚡ Optimizing boot performance..."
# Disable unnecessary services
systemctl disable systemd-networkd-wait-online.service 2>/dev/null || true
systemctl disable systemd-resolved.service 2>/dev/null || true
# Enable parallel boot
mkdir -p /etc/systemd/system.conf.d
cat > /etc/systemd/system.conf.d/99-parallel-boot.conf << EOF
[Manager]
DefaultTimeoutStartSec=15s
DefaultTimeoutStopSec=15s
DefaultRestartSec=100ms
EOF
echo "✅ Parallel boot enabled"
# Optimize kernel parameters
cat > /etc/sysctl.d/99-boot-optimization.conf << EOF
# Boot performance optimizations
kernel.printk = 3 4 1 3
vm.swappiness = 1
vm.dirty_ratio = 15
vm.dirty_background_ratio = 5
# Reduce boot time
kernel.randomize_va_space = 0
EOF
echo "✅ Kernel optimizations applied"
}
# Main execution
case "${1:-analyze}" in
"analyze")
measure_boot_time
check_boot_config
;;
"verbose")
enable_verbose_logging
;;
"optimize")
optimize_boot
;;
"all")
measure_boot_time
check_boot_config
enable_verbose_logging
optimize_boot
;;
*)
echo "Usage: $0 [analyze|verbose|optimize|all]"
echo " analyze - Measure and analyze boot performance"
echo " verbose - Enable verbose boot logging"
echo " optimize - Apply boot performance optimizations"
echo " all - Run all optimizations"
exit 1
;;
esac
echo ""
echo "✅ Boot performance analysis complete!"

124
scripts/create-minimal-ostree.sh Executable file
View file

@ -0,0 +1,124 @@
#!/bin/bash
# Create Minimal OSTree Deployment Script
# Creates essential OSTree structure without copying large system files
set -euo pipefail
echo "🌱 Creating Minimal OSTree Deployment for Simple-CLI"
echo "====================================================="
# Check if ostree is available
if ! command -v ostree >/dev/null 2>&1; then
echo "❌ Error: ostree command not found"
echo " Install with: sudo apt install ostree"
exit 1
fi
echo "✅ OSTree tools available, proceeding..."
# Use a different working directory to avoid /tmp space issues
WORK_DIR="$HOME/ostree-deployment"
echo "🔧 Creating working directory: $WORK_DIR"
rm -rf "$WORK_DIR"
mkdir -p "$WORK_DIR"
# Create OSTree repository
REPO_DIR="$WORK_DIR/repo"
echo "📦 Initializing OSTree repository: $REPO_DIR"
ostree init --repo="$REPO_DIR" --mode=bare
# Create minimal deployment structure
DEPLOY_DIR="$WORK_DIR/deploy"
echo "🏗️ Creating minimal deployment structure: $DEPLOY_DIR"
mkdir -p "$DEPLOY_DIR"
# Create the atomic filesystem layout
echo "🔗 Creating atomic filesystem layout..."
cd "$DEPLOY_DIR"
# Create essential directories (minimal set)
mkdir -p usr/bin usr/sbin usr/lib usr/lib64
mkdir -p boot var/home var/log var/cache var/tmp
mkdir -p etc run
# Create symlinks for atomic layout
ln -sf usr/bin bin
ln -sf usr/sbin sbin
ln -sf usr/lib lib
ln -sf usr/lib64 lib64
ln -sf var/home home
echo "✅ Atomic filesystem layout created"
# Create minimal system files instead of copying everything
echo "📋 Creating minimal system files..."
# Create a simple init script
cat > usr/bin/init << 'EOF'
#!/bin/bash
echo "Simple-CLI OSTree System Starting..."
echo "Boot performance optimizations active"
echo "System ready for development"
exec /bin/bash
EOF
chmod +x usr/bin/init
# Create minimal /etc structure
mkdir -p etc/systemd/system
cat > etc/systemd/system.conf << 'EOF'
[Manager]
DefaultTimeoutStartSec=15s
DefaultTimeoutStopSec=15s
DefaultRestartSec=100ms
EOF
# Create minimal /boot structure
mkdir -p boot/grub
cat > boot/grub/grub.cfg << 'EOF'
# Minimal GRUB configuration for Simple-CLI OSTree
set timeout=1
set default=0
menuentry "Simple CLI OSTree" {
set root=(hd0,msdos1)
linux /boot/vmlinuz-6.12.41+deb13-amd64 root=/dev/sda1 rw console=ttyS0 quiet splash fastboot
initrd /boot/initrd.img-6.12.41+deb13-amd64
}
EOF
# Create deployment marker
touch run/ostree-booted
echo "✅ Minimal system files created"
# Create OSTree commit
echo "💾 Creating OSTree commit..."
ostree commit \
--repo="$REPO_DIR" \
--branch=simple-cli/main \
--subject="Simple-CLI Minimal OSTree deployment" \
--body="Minimal OSTree deployment with atomic filesystem layout" \
"$DEPLOY_DIR"
echo "✅ OSTree commit created"
# Show commit info
echo ""
echo "📊 OSTree commit information:"
ostree --repo="$REPO_DIR" log simple-cli/main | head -10
echo ""
echo "🎯 Minimal OSTree deployment created successfully!"
echo "📁 Repository: $REPO_DIR"
echo "📁 Deployment: $DEPLOY_DIR"
echo ""
echo "📋 Files created:"
find "$DEPLOY_DIR" -type f | head -20
echo ""
echo "🚀 Next steps:"
echo " 1. This creates the basic OSTree structure"
echo " 2. For full system, need to integrate with simple-cli container"
echo " 3. Use bootc-image-builder to create bootable image"
echo " 4. Test boot performance in QEMU"

View file

@ -0,0 +1,155 @@
#!/bin/bash
# Create OSTree Deployment Script v2
# Uses standard ostree tools to create proper OSTree deployment
set -euo pipefail
echo "🌱 Creating OSTree Deployment v2 for Simple-CLI"
echo "================================================"
# Check if ostree is available
if ! command -v ostree >/dev/null 2>&1; then
echo "❌ Error: ostree command not found"
echo " Install with: sudo apt install ostree"
exit 1
fi
echo "✅ OSTree tools available, proceeding..."
# Create working directory
WORK_DIR="/tmp/ostree-deployment"
echo "🔧 Creating working directory: $WORK_DIR"
rm -rf "$WORK_DIR"
mkdir -p "$WORK_DIR"
# Create OSTree repository
REPO_DIR="$WORK_DIR/repo"
echo "📦 Initializing OSTree repository: $REPO_DIR"
ostree init --repo="$REPO_DIR" --mode=bare
# Create deployment structure
DEPLOY_DIR="$WORK_DIR/deploy"
echo "🏗️ Creating deployment structure: $DEPLOY_DIR"
mkdir -p "$DEPLOY_DIR"
# Create the atomic filesystem layout
echo "🔗 Creating atomic filesystem layout..."
cd "$DEPLOY_DIR"
# Create essential directories
mkdir -p usr/bin usr/sbin usr/lib usr/lib64 usr/etc
mkdir -p boot var/home var/log var/cache var/tmp
mkdir -p etc
# Create symlinks for atomic layout
ln -sf usr/bin bin
ln -sf usr/sbin sbin
ln -sf usr/lib lib
ln -sf usr/lib64 lib64
ln -sf var/home home
echo "✅ Atomic filesystem layout created"
# Copy essential system files from current system
echo "📋 Copying essential system files..."
if [ -d /usr/bin ]; then
echo " Copying /usr/bin..."
cp -r /usr/bin/* usr/bin/ 2>/dev/null || true
fi
if [ -d /usr/sbin ]; then
echo " Copying /usr/sbin..."
cp -r /usr/sbin/* usr/sbin/ 2>/dev/null || true
fi
if [ -d /usr/lib ]; then
echo " Copying /usr/lib..."
cp -r /usr/lib/* usr/lib/ 2>/dev/null || true
fi
if [ -d /usr/lib64 ]; then
echo " Copying /usr/lib64..."
cp -r /usr/lib64/* usr/lib64/ 2>/dev/null || true
fi
if [ -d /boot ]; then
echo " Copying /boot..."
cp -r /boot/* boot/ 2>/dev/null || true
fi
if [ -d /etc ]; then
echo " Copying /etc..."
cp -r /etc/* etc/ 2>/dev/null || true
fi
echo "✅ System files copied"
# Create OSTree commit
echo "💾 Creating OSTree commit..."
ostree commit \
--repo="$REPO_DIR" \
--branch=simple-cli/main \
--subject="Simple-CLI OSTree deployment v2" \
--body="OSTree deployment with atomic filesystem layout and boot optimizations" \
"$DEPLOY_DIR"
echo "✅ OSTree commit created"
# Show commit info
echo ""
echo "📊 OSTree commit information:"
ostree --repo="$REPO_DIR" log simple-cli/main | head -10
# Create deployment marker
echo ""
echo "📝 Creating deployment marker..."
mkdir -p "$DEPLOY_DIR/run"
touch "$DEPLOY_DIR/run/ostree-booted"
# Create basic GRUB configuration
echo "🥾 Creating GRUB configuration..."
mkdir -p "$DEPLOY_DIR/boot/grub"
# Find actual kernel and initrd files
KERNEL_FILE=$(find "$DEPLOY_DIR/boot" -name "vmlinuz-*" | head -1)
INITRD_FILE=$(find "$DEPLOY_DIR/boot" -name "initrd.img-*" | head -1)
if [[ -n "$KERNEL_FILE" && -n "$INITRD_FILE" ]]; then
KERNEL_NAME=$(basename "$KERNEL_FILE")
INITRD_NAME=$(basename "$INITRD_FILE")
cat > "$DEPLOY_DIR/boot/grub/grub.cfg" << EOF
# GRUB configuration for Simple-CLI OSTree deployment
set timeout=1
set default=0
menuentry "Simple CLI OSTree" {
set root=(hd0,msdos1)
linux /boot/$KERNEL_NAME root=/dev/sda1 rw console=ttyS0 quiet splash fastboot
initrd /boot/$INITRD_NAME
}
menuentry "Simple CLI OSTree (Recovery)" {
set root=(hd0,msdos1)
linux /boot/$KERNEL_NAME root=/dev/sda1 rw single console=ttyS0
initrd /boot/$INITRD_NAME
}
EOF
echo "✅ GRUB configuration created with kernel: $KERNEL_NAME, initrd: $INITRD_NAME"
else
echo "⚠️ Warning: Kernel or initrd not found, GRUB config incomplete"
fi
echo ""
echo "🎯 OSTree deployment created successfully!"
echo "📁 Repository: $REPO_DIR"
echo "📁 Deployment: $DEPLOY_DIR"
echo ""
echo "🚀 Next steps:"
echo " 1. Copy deployment to target location"
echo " 2. Use bootc-image-builder to create bootable image"
echo " 3. Test boot performance in QEMU"
echo ""
echo "📋 Files created:"
ls -la "$DEPLOY_DIR" | head -20

View file

@ -0,0 +1,105 @@
#!/bin/bash
# Create OSTree Deployment Script
# Converts our simple-cli container into a proper OSTree deployment
set -euo pipefail
echo "🌱 Creating OSTree Deployment for Simple-CLI"
echo "============================================="
# Check if we're running in the container
echo "✅ Running in container, proceeding with OSTree deployment..."
# Create OSTree repository
echo "🔧 Initializing OSTree repository..."
mkdir -p /ostree/repo
ostree init --repo=/ostree/repo --mode=bare
# Create the filesystem restructuring
echo "🔄 Restructuring filesystem for OSTree..."
mkdir -p /ostree/deploy/simple-cli/var
# Create symlinks for atomic filesystem layout
echo "🔗 Creating atomic filesystem symlinks..."
ln -sf /usr/bin /bin
ln -sf /usr/sbin /sbin
ln -sf /usr/lib /lib
ln -sf /usr/lib64 /lib64
# Move user data directories to /var
echo "📁 Setting up /var structure..."
mkdir -p /ostree/deploy/simple-cli/var/home
mkdir -p /ostree/deploy/simple-cli/var/log
mkdir -p /ostree/deploy/simple-cli/var/cache
mkdir -p /ostree/deploy/simple-cli/var/tmp
# Create /home symlink to /var/home
ln -sf /ostree/deploy/simple-cli/var/home /home
# Create a minimal OSTree deployment structure
echo "💾 Creating minimal OSTree deployment structure..."
# Create essential directories
mkdir -p /ostree/deploy/simple-cli/usr
mkdir -p /ostree/deploy/simple-cli/boot
mkdir -p /ostree/deploy/simple-cli/etc
# Copy essential system files
cp -r /usr/* /ostree/deploy/simple-cli/usr/
cp -r /boot/* /ostree/deploy/simple-cli/boot/
cp -r /etc/* /ostree/deploy/simple-cli/etc/
# Create the atomic filesystem symlinks in the deployment
cd /ostree/deploy/simple-cli
ln -sf usr/bin bin
ln -sf usr/sbin sbin
ln -sf usr/lib lib
ln -sf usr/lib64 lib64
ln -sf var/home home
echo "✅ Minimal OSTree deployment structure created"
# Create deployment
echo "🚀 Creating OSTree deployment..."
ostree admin deploy \
--sysroot=/ostree/deploy \
--os=simple-cli \
simple-cli/main
# Set up boot configuration
echo "🥾 Setting up boot configuration..."
mkdir -p /ostree/deploy/simple-cli/boot/grub
cat > /ostree/deploy/simple-cli/boot/grub/grub.cfg << 'EOF'
# GRUB configuration for Simple-CLI OSTree deployment
set timeout=1
set default=0
menuentry "Simple CLI" {
set root=(hd0,msdos1)
linux /boot/vmlinuz-6.12.41+deb13-amd64 root=/dev/sda1 rw console=ttyS0 quiet splash fastboot
initrd /boot/initrd.img-6.12.41+deb13-amd64
}
menuentry "Simple CLI (Recovery)" {
set root=(hd0,msdos1)
linux /boot/vmlinuz-6.12.41+deb13-amd64 root=/dev/sda1 rw single console=ttyS0
initrd /boot/initrd.img-6.12.41+deb13-amd64
}
EOF
# Create deployment marker
echo "📝 Creating deployment marker..."
touch /ostree/deploy/simple-cli/run/ostree-booted
echo ""
echo "✅ OSTree deployment created successfully!"
echo "📊 Deployment info:"
ostree --repo=/ostree/repo log simple-cli/main | head -10
echo ""
echo "🎯 Next steps:"
echo " 1. Exit this container"
echo " 2. Rebuild the bootable image with:"
echo " ./scripts/bootc-image-builder.sh -o /tmp/output simple-cli:latest"
echo " 3. Test boot performance in QEMU"

View file

@ -0,0 +1,79 @@
#!/bin/bash
# Integrate OSTree Structure with Simple-CLI Container
# Combines our optimized container with proper OSTree filesystem layout
set -euo pipefail
echo "🔗 Integrating OSTree Structure with Simple-CLI Container"
echo "========================================================"
# Check if we have the minimal OSTree deployment
if [ ! -d "$HOME/ostree-deployment/deploy" ]; then
echo "❌ Error: Minimal OSTree deployment not found"
echo " Run: ./scripts/create-minimal-ostree.sh first"
exit 1
fi
echo "✅ OSTree deployment found: $HOME/ostree-deployment/deploy"
# Check if simple-cli container exists
if ! podman image exists localhost/simple-cli:latest; then
echo "❌ Error: simple-cli container image not found"
echo " Build with: podman build -t localhost/simple-cli:latest ."
exit 1
fi
echo "✅ Simple-CLI container found: localhost/simple-cli:latest"
# Create integration directory
INTEGRATION_DIR="$HOME/simple-cli-ostree-integration"
echo "🔧 Creating integration directory: $INTEGRATION_DIR"
rm -rf "$INTEGRATION_DIR"
mkdir -p "$INTEGRATION_DIR"
# Copy OSTree structure
echo "📋 Copying OSTree structure..."
cp -r "$HOME/ostree-deployment/deploy"/* "$INTEGRATION_DIR/"
# Create a container that combines both
echo "🐳 Creating integrated container..."
cat > "$INTEGRATION_DIR/Dockerfile" << 'EOF'
FROM localhost/simple-cli:latest
# Apply OSTree filesystem structure
COPY . /
# Ensure atomic symlinks are correct
RUN ln -sf /usr/bin /bin && \
ln -sf /usr/sbin /sbin && \
ln -sf /usr/lib /lib && \
ln -sf /usr/lib64 /lib64 && \
ln -sf /var/home /home
# Create OSTree deployment marker
RUN mkdir -p /run && touch /run/ostree-booted
# Verify structure
RUN ls -la / | grep -E "(bin|sbin|lib|home)" && \
echo "OSTree structure verified"
CMD ["/usr/bin/init"]
EOF
echo "✅ Integration files created"
echo ""
echo "📁 Integration directory: $INTEGRATION_DIR"
echo "🐳 Dockerfile created for OSTree integration"
echo ""
echo "🚀 Next steps:"
echo " 1. Build integrated image:"
echo " cd $INTEGRATION_DIR"
echo " podman build -t simple-cli-ostree:latest ."
echo " 2. Create bootable image:"
echo " cd ../deb-bootc-image-builder"
echo " ./scripts/bootc-image-builder.sh -o /tmp/output simple-cli-ostree:latest"
echo " 3. Test boot performance in QEMU"
echo ""
echo "📋 Files created:"
ls -la "$INTEGRATION_DIR"