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

170 lines
No EOL
4 KiB
Markdown

# 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:
## Option 1: Use WSL (Windows Subsystem for Linux) - Recommended
### 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**:
```bash
cd /mnt/c/Users/rob/Documents/Projects/Particle-OS/tools
```
3. **Compile all tools**:
```bash
# 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**:
```cmd
compile-windows.bat
```
5. **Or use the PowerShell script**:
```powershell
.\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**:
```bash
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**:
```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**:
```cmd
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**:
```bash
scp -r src/ particle-os:/tmp/particle-os-src/
```
2. **Compile on the VM**:
```bash
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**:
```bash
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:
```bash
dos2unix src/*/scriptlets/*.sh
```
2. **Permission problems**:
- Make sure scripts are executable:
```bash
chmod +x src/*/compile.sh
chmod +x src/*/scriptlets/*.sh
```
3. **Missing dependencies**:
- Install required packages in WSL:
```bash
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**:
```bash
scp *.sh particle-os:/tmp/
```
2. **Run the fix scripts on your VM**:
```bash
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**:
```bash
sudo ./dev-install.sh
```
## Recommended Approach
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