particle-os-tools/WINDOWS-COMPILATION.md
robojerk 74c7bede5f Initial commit: Particle-OS tools repository
- Complete Particle-OS rebranding from uBlue-OS
- Professional installation system with standardized paths
- Self-initialization system with --init and --reset commands
- Enhanced error messages and dependency checking
- Comprehensive testing infrastructure
- All source scriptlets updated with runtime improvements
- Clean codebase with redundant files moved to archive
- Complete documentation suite
2025-07-11 21:14:33 -07:00

4 KiB

Particle-OS Compilation on Windows

Since Particle-OS tools are Bash scripts, they need to be compiled in a Linux environment. Here are your options on Windows:

Prerequisites

  1. Install WSL: https://docs.microsoft.com/en-us/windows/wsl/install
  2. Install Ubuntu on WSL (or your preferred Linux distribution)

Compilation Steps

  1. Open WSL terminal

  2. Navigate to your project:

    cd /mnt/c/Users/rob/Documents/Projects/Particle-OS/tools
    
  3. Compile all tools:

    # Compile apt-layer
    cd src/apt-layer && ./compile.sh && cd ../..
    
    # Compile composefs
    cd src/composefs && ./compile.sh && cd ../..
    
    # Compile bootc
    cd src/bootc && ./compile.sh && cd ../..
    
    # Compile bootupd
    cd src/bootupd && ./compile.sh && cd ../..
    
  4. Or use the batch file:

    compile-windows.bat
    
  5. Or use the PowerShell script:

    .\compile-windows.ps1
    

Option 2: Use Git Bash

Prerequisites

  1. Install Git for Windows (includes Git Bash): https://git-scm.com/download/win

Compilation Steps

  1. Open Git Bash

  2. Navigate to your project:

    cd /c/Users/rob/Documents/Projects/Particle-OS/tools
    
  3. Compile all tools (same commands as WSL)

Option 3: Use Docker

Prerequisites

  1. Install Docker Desktop: https://www.docker.com/products/docker-desktop

Compilation Steps

  1. Create a Dockerfile:

    FROM ubuntu:24.04
    RUN apt update && apt install -y bash coreutils
    WORKDIR /workspace
    COPY . .
    CMD ["bash", "-c", "cd src/apt-layer && ./compile.sh && cd ../composefs && ./compile.sh && cd ../bootc && ./compile.sh && cd ../bootupd && ./compile.sh"]
    
  2. Build and run:

    docker build -t particle-os-compile .
    docker run -v %cd%:/workspace particle-os-compile
    

Option 4: Use Your VM

Since you already have a VM, you can:

  1. Copy the source files to your VM:

    scp -r src/ particle-os:/tmp/particle-os-src/
    
  2. Compile on the VM:

    ssh particle-os
    cd /tmp/particle-os-src
    
    # Compile all tools
    cd apt-layer && ./compile.sh && cd ..
    cd composefs && ./compile.sh && cd ..
    cd bootc && ./compile.sh && cd ..
    cd bootupd && ./compile.sh && cd ..
    
  3. Copy compiled scripts back:

    scp particle-os:/tmp/particle-os-src/*/apt-layer.sh .
    scp particle-os:/tmp/particle-os-src/*/composefs.sh .
    scp particle-os:/tmp/particle-os-src/*/bootc.sh .
    scp particle-os:/tmp/particle-os-src/*/bootupd.sh .
    

Troubleshooting

Common Issues

  1. Line ending problems:

    • The compilation scripts include dos2unix to fix Windows line endings
    • If you still have issues, manually convert files:
      dos2unix src/*/scriptlets/*.sh
      
  2. Permission problems:

    • Make sure scripts are executable:
      chmod +x src/*/compile.sh
      chmod +x src/*/scriptlets/*.sh
      
  3. Missing dependencies:

    • Install required packages in WSL:
      sudo apt update
      sudo apt install -y dos2unix jq
      

Verification

After compilation, you should have these files:

  • apt-layer.sh (in tools directory)
  • composefs.sh (in tools directory)
  • bootc.sh (in tools directory)
  • bootupd.sh (in tools directory)

Next Steps

After successful compilation:

  1. Copy scripts to your VM:

    scp *.sh particle-os:/tmp/
    
  2. Run the fix scripts on your VM:

    ssh particle-os
    cd /tmp
    chmod +x *.sh
    ./quick-fix-particle-os.sh
    sudo ./fix-system-permissions.sh
    ./test-particle-os-system.sh
    
  3. Install the tools:

    sudo ./dev-install.sh
    

For your situation, I recommend Option 4 (Use Your VM) because:

  • You already have the VM set up
  • It's the same environment where the tools will run
  • No additional software installation needed
  • Can test the tools immediately after compilation