Simplified pipeline: Direct Android building without Docker
- Removed Docker dependency for simpler setup - Added direct Android build environment setup - Streamlined ROM building process - Works directly on Buildkite agent with minimal setup
This commit is contained in:
@@ -1,51 +1,107 @@
|
||||
steps:
|
||||
- label: ":android: Setup Environment"
|
||||
- label: ":android: Setup Android Environment"
|
||||
key: "setup"
|
||||
command: |
|
||||
echo "Setting up Android build environment..."
|
||||
docker --version
|
||||
docker-compose --version
|
||||
echo "Environment ready!"
|
||||
echo "🚀 Setting up Android build environment..."
|
||||
|
||||
# Check system requirements
|
||||
echo "📊 System info:"
|
||||
uname -a
|
||||
free -h
|
||||
df -h .
|
||||
nproc
|
||||
|
||||
# Check required tools
|
||||
echo "🔧 Checking required tools..."
|
||||
which python3 || echo "⚠️ Python3 not found"
|
||||
which git || echo "⚠️ Git not found"
|
||||
which curl || echo "⚠️ Curl not found"
|
||||
|
||||
echo "✅ Environment check complete!"
|
||||
agents:
|
||||
queue: "default"
|
||||
|
||||
- label: ":package: Build Docker Image"
|
||||
key: "build-image"
|
||||
- label: ":package: Install Dependencies"
|
||||
key: "install-deps"
|
||||
depends_on: "setup"
|
||||
command: |
|
||||
echo "Building Android ROM builder Docker image..."
|
||||
cd docker
|
||||
docker build -t android-rom-builder:latest .
|
||||
echo "Docker image built successfully!"
|
||||
echo "📦 Installing Android build dependencies..."
|
||||
|
||||
# Update package lists
|
||||
sudo apt-get update
|
||||
|
||||
# Install essential packages for Android building
|
||||
sudo apt-get install -y \
|
||||
git curl python3 python3-pip \
|
||||
openjdk-8-jdk build-essential \
|
||||
libssl-dev libc6-dev libncurses5 \
|
||||
libncurses5-dev libreadline-dev \
|
||||
libtinfo5 libxml2-utils xsltproc \
|
||||
zip zlib1g-dev g++-multilib \
|
||||
gcc-multilib lib32ncurses5-dev \
|
||||
lib32readline-dev lib32z1-dev \
|
||||
ccache bison flex bc rsync \
|
||||
schedtool squashfs-tools \
|
||||
python3-mako libffi-dev
|
||||
|
||||
# Install repo tool
|
||||
sudo curl https://storage.googleapis.com/git-repo-downloads/repo -o /usr/local/bin/repo
|
||||
sudo chmod a+x /usr/local/bin/repo
|
||||
|
||||
echo "✅ Dependencies installed!"
|
||||
agents:
|
||||
queue: "default"
|
||||
timeout_in_minutes: 20
|
||||
|
||||
- label: ":octocat: Initialize Android Source"
|
||||
key: "init-source"
|
||||
depends_on: "build-image"
|
||||
depends_on: "install-deps"
|
||||
command: |
|
||||
echo "Initializing Android source repository..."
|
||||
mkdir -p source
|
||||
docker run --rm \
|
||||
-v $$(pwd)/source:/home/buildbot/android/source \
|
||||
-v $$(pwd)/scripts:/home/buildbot/scripts:ro \
|
||||
android-rom-builder:latest \
|
||||
/home/buildbot/scripts/init-source.sh
|
||||
echo "🔧 Initializing Android source repository..."
|
||||
|
||||
# Configuration
|
||||
MANIFEST_URL="${MANIFEST_URL:-https://github.com/LineageOS/android.git}"
|
||||
MANIFEST_BRANCH="${MANIFEST_BRANCH:-lineage-21.0}"
|
||||
|
||||
echo "📋 Using manifest: $MANIFEST_URL"
|
||||
echo "🌿 Branch: $MANIFEST_BRANCH"
|
||||
|
||||
# Configure git
|
||||
git config --global user.email "buildbot@buildkite.local"
|
||||
git config --global user.name "Buildkite Android Builder"
|
||||
|
||||
# Create and initialize source directory
|
||||
mkdir -p android-source
|
||||
cd android-source
|
||||
|
||||
if [ ! -d ".repo" ]; then
|
||||
echo "🔄 Initializing repo..."
|
||||
repo init -u "$MANIFEST_URL" -b "$MANIFEST_BRANCH" --depth=1 --no-clone-bundle
|
||||
echo "✅ Repository initialized!"
|
||||
else
|
||||
echo "📁 Repository already initialized"
|
||||
fi
|
||||
agents:
|
||||
queue: "default"
|
||||
timeout_in_minutes: 30
|
||||
timeout_in_minutes: 10
|
||||
env:
|
||||
MANIFEST_URL: "https://github.com/LineageOS/android.git"
|
||||
MANIFEST_BRANCH: "lineage-21.0"
|
||||
|
||||
- label: ":arrows_counterclockwise: Sync Android Source"
|
||||
- label: ":arrows_counterclockwise: Sync Android Source"
|
||||
key: "sync-source"
|
||||
depends_on: "init-source"
|
||||
command: |
|
||||
echo "Syncing Android source code..."
|
||||
docker run --rm \
|
||||
-v $$(pwd)/source:/home/buildbot/android/source \
|
||||
-v $$(pwd)/ccache:/home/buildbot/android/ccache \
|
||||
-v $$(pwd)/scripts:/home/buildbot/scripts:ro \
|
||||
android-rom-builder:latest \
|
||||
/home/buildbot/scripts/sync-source.sh
|
||||
echo "⬇️ Syncing Android source code..."
|
||||
|
||||
cd android-source
|
||||
|
||||
# Sync with parallel jobs
|
||||
echo "🚀 Starting source sync with $(nproc) parallel jobs..."
|
||||
repo sync -c -j$(nproc) --force-sync --no-clone-bundle --no-tags --optimized-fetch --prune
|
||||
|
||||
echo "✅ Source sync completed!"
|
||||
echo "📊 Source size: $(du -sh . | cut -f1)"
|
||||
agents:
|
||||
queue: "default"
|
||||
timeout_in_minutes: 120
|
||||
@@ -54,54 +110,149 @@ steps:
|
||||
key: "build-rom"
|
||||
depends_on: "sync-source"
|
||||
command: |
|
||||
echo "Building Android ROM..."
|
||||
docker run --rm \
|
||||
-v $$(pwd)/source:/home/buildbot/android/source \
|
||||
-v $$(pwd)/out:/home/buildbot/android/out \
|
||||
-v $$(pwd)/ccache:/home/buildbot/android/ccache \
|
||||
-v $$(pwd)/scripts:/home/buildbot/scripts:ro \
|
||||
--shm-size=2g \
|
||||
android-rom-builder:latest \
|
||||
/home/buildbot/scripts/build-rom.sh
|
||||
echo "🔨 Building Android ROM..."
|
||||
|
||||
cd android-source
|
||||
|
||||
# Configuration
|
||||
TARGET_DEVICE="${TARGET_DEVICE:-generic}"
|
||||
BUILD_TYPE="${BUILD_TYPE:-userdebug}"
|
||||
BUILD_VARIANT="${BUILD_VARIANT:-lineage}"
|
||||
|
||||
echo "🎯 Build configuration:"
|
||||
echo " Device: $TARGET_DEVICE"
|
||||
echo " Type: $BUILD_TYPE"
|
||||
echo " Variant: $BUILD_VARIANT"
|
||||
|
||||
# Set up build environment
|
||||
echo "⚙️ Setting up build environment..."
|
||||
source build/envsetup.sh
|
||||
|
||||
# Configure ccache
|
||||
export USE_CCACHE=1
|
||||
export CCACHE_DIR=$PWD/../ccache
|
||||
mkdir -p $CCACHE_DIR
|
||||
ccache -M 50G
|
||||
|
||||
# Select build target
|
||||
echo "🎯 Selecting build target..."
|
||||
lunch "${BUILD_VARIANT}_${TARGET_DEVICE}-${BUILD_TYPE}"
|
||||
|
||||
# Start build
|
||||
echo "🚀 Starting compilation..."
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
if [ "$BUILD_VARIANT" = "lineage" ]; then
|
||||
brunch "$TARGET_DEVICE"
|
||||
else
|
||||
make -j$(nproc) otapackage
|
||||
fi
|
||||
|
||||
END_TIME=$(date +%s)
|
||||
BUILD_TIME=$((END_TIME - START_TIME))
|
||||
|
||||
echo "✅ Build completed successfully!"
|
||||
echo "⏱️ Build time: $(date -u -d @$BUILD_TIME +%H:%M:%S)"
|
||||
agents:
|
||||
queue: "default"
|
||||
timeout_in_minutes: 480
|
||||
env:
|
||||
TARGET_DEVICE: "generic"
|
||||
BUILD_TYPE: "userdebug"
|
||||
BUILD_VARIANT: "lineage"
|
||||
USE_CCACHE: "1"
|
||||
CCACHE_DIR: "/home/buildbot/android/ccache"
|
||||
|
||||
- label: ":package: Package ROM"
|
||||
- label: ":package: Package ROM Artifacts"
|
||||
key: "package-rom"
|
||||
depends_on: "build-rom"
|
||||
command: |
|
||||
echo "Packaging ROM artifacts..."
|
||||
docker run --rm \
|
||||
-v $$(pwd)/out:/home/buildbot/android/out \
|
||||
-v $$(pwd)/artifacts:/home/buildbot/artifacts \
|
||||
-v $$(pwd)/scripts:/home/buildbot/scripts:ro \
|
||||
android-rom-builder:latest \
|
||||
/home/buildbot/scripts/package-rom.sh
|
||||
echo "📦 Packaging ROM artifacts..."
|
||||
|
||||
TARGET_DEVICE="${TARGET_DEVICE:-generic}"
|
||||
OUT_DIR="android-source/out/target/product/$TARGET_DEVICE"
|
||||
|
||||
# Create artifacts directory
|
||||
mkdir -p artifacts
|
||||
|
||||
echo "📁 Copying build artifacts..."
|
||||
|
||||
# Copy ROM files
|
||||
find "$OUT_DIR" -name "*.zip" -exec cp {} artifacts/ \; 2>/dev/null || true
|
||||
find "$OUT_DIR" -name "recovery.img" -exec cp {} artifacts/ \; 2>/dev/null || true
|
||||
find "$OUT_DIR" -name "boot.img" -exec cp {} artifacts/ \; 2>/dev/null || true
|
||||
find "$OUT_DIR" -name "system.img" -exec cp {} artifacts/ \; 2>/dev/null || true
|
||||
|
||||
# Create build info
|
||||
cat > artifacts/build-info.json << EOF
|
||||
{
|
||||
"build_number": "${BUILDKITE_BUILD_NUMBER:-unknown}",
|
||||
"commit": "${BUILDKITE_COMMIT:-unknown}",
|
||||
"branch": "${BUILDKITE_BRANCH:-unknown}",
|
||||
"device": "$TARGET_DEVICE",
|
||||
"build_date": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
|
||||
"build_type": "${BUILD_TYPE:-userdebug}",
|
||||
"variant": "${BUILD_VARIANT:-lineage}"
|
||||
}
|
||||
EOF
|
||||
|
||||
# Generate checksums
|
||||
cd artifacts
|
||||
for file in *.zip *.img 2>/dev/null; do
|
||||
[ -f "$file" ] && md5sum "$file" > "$file.md5"
|
||||
[ -f "$file" ] && sha256sum "$file" > "$file.sha256"
|
||||
done
|
||||
|
||||
echo "📊 Artifacts created:"
|
||||
ls -lh
|
||||
|
||||
echo "✅ Packaging completed!"
|
||||
agents:
|
||||
queue: "default"
|
||||
timeout_in_minutes: 30
|
||||
env:
|
||||
TARGET_DEVICE: "generic"
|
||||
BUILD_TYPE: "userdebug"
|
||||
BUILD_VARIANT: "lineage"
|
||||
|
||||
- label: ":arrow_up: Upload Artifacts"
|
||||
- label: ":arrow_up: Upload Artifacts"
|
||||
key: "upload-artifacts"
|
||||
depends_on: "package-rom"
|
||||
command: |
|
||||
echo "Uploading ROM artifacts..."
|
||||
buildkite-agent artifact upload "artifacts/*.zip"
|
||||
buildkite-agent artifact upload "artifacts/*.img"
|
||||
echo "⬆️ Uploading ROM artifacts..."
|
||||
|
||||
# Upload all ROM files
|
||||
if ls artifacts/*.zip >/dev/null 2>&1; then
|
||||
buildkite-agent artifact upload "artifacts/*.zip"
|
||||
fi
|
||||
|
||||
if ls artifacts/*.img >/dev/null 2>&1; then
|
||||
buildkite-agent artifact upload "artifacts/*.img"
|
||||
fi
|
||||
|
||||
# Upload metadata
|
||||
buildkite-agent artifact upload "artifacts/*.json"
|
||||
buildkite-agent artifact upload "artifacts/*.md5"
|
||||
buildkite-agent artifact upload "artifacts/*.sha256"
|
||||
|
||||
echo "✅ Artifacts uploaded successfully!"
|
||||
agents:
|
||||
queue: "default"
|
||||
|
||||
- label: ":white_check_mark: Build Complete"
|
||||
depends_on: "upload-artifacts"
|
||||
command: |
|
||||
echo ":tada: Android ROM build completed successfully!"
|
||||
echo "Build Number: $BUILDKITE_BUILD_NUMBER"
|
||||
echo "Commit: $BUILDKITE_COMMIT"
|
||||
echo "Branch: $BUILDKITE_BRANCH"
|
||||
echo "🎉 Android ROM build completed successfully!"
|
||||
echo ""
|
||||
echo "📊 Build Information:"
|
||||
echo " Build Number: ${BUILDKITE_BUILD_NUMBER}"
|
||||
echo " Commit: ${BUILDKITE_COMMIT}"
|
||||
echo " Branch: ${BUILDKITE_BRANCH}"
|
||||
echo " Device: ${TARGET_DEVICE:-generic}"
|
||||
echo " Variant: ${BUILD_VARIANT:-lineage}"
|
||||
echo ""
|
||||
echo "📱 Your ROM is ready for download in the Artifacts tab!"
|
||||
agents:
|
||||
queue: "default"
|
||||
queue: "default"
|
||||
env:
|
||||
TARGET_DEVICE: "generic"
|
||||
BUILD_VARIANT: "lineage"
|
||||
179
README.md
179
README.md
@@ -1,179 +0,0 @@
|
||||
# Android ROM Building with Buildkite
|
||||
|
||||
This repository contains everything you need to build Android ROMs using Buildkite CI/CD with Docker containers.
|
||||
|
||||
## 🚀 Quick Setup
|
||||
|
||||
### 1. Buildkite Pipeline Setup
|
||||
|
||||
1. Go to your Buildkite dashboard
|
||||
2. Click "New Pipeline"
|
||||
3. Connect this GitHub repository
|
||||
4. Set the pipeline configuration to use `.buildkite/pipeline.yml`
|
||||
5. Add your agent queue (usually "default")
|
||||
|
||||
### 2. Agent Configuration
|
||||
|
||||
Make sure your Buildkite agent has:
|
||||
- Docker installed and running
|
||||
- Sufficient disk space (200GB+ recommended)
|
||||
- Good internet connection for source sync
|
||||
|
||||
### 3. Environment Configuration
|
||||
|
||||
Copy `.env.example` to `.env` and configure:
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
# Edit .env with your specific settings
|
||||
```
|
||||
|
||||
## 📋 Pipeline Steps
|
||||
|
||||
The pipeline includes these automated steps:
|
||||
|
||||
1. **🔧 Setup Environment** - Verify Docker and dependencies
|
||||
2. **📦 Build Docker Image** - Create Android build environment
|
||||
3. **🐙 Initialize Source** - Set up Android source repository
|
||||
4. **🔄 Sync Source** - Download Android source code (~100GB)
|
||||
5. **🔨 Build ROM** - Compile the Android ROM (2-8 hours)
|
||||
6. **📦 Package ROM** - Prepare artifacts for download
|
||||
7. **⬆️ Upload Artifacts** - Upload ROM files to Buildkite
|
||||
8. **✅ Complete** - Build finished notification
|
||||
|
||||
## 🎯 Device Configuration
|
||||
|
||||
To build for a specific device, modify these environment variables:
|
||||
|
||||
```yaml
|
||||
env:
|
||||
TARGET_DEVICE: "your_device_codename"
|
||||
BUILD_VARIANT: "lineage" # or aosp, etc.
|
||||
BUILD_TYPE: "userdebug" # or user, eng
|
||||
```
|
||||
|
||||
## 🏗️ Supported ROM Types
|
||||
|
||||
- **LineageOS** (default configuration)
|
||||
- **AOSP** (Android Open Source Project)
|
||||
- **Custom ROMs** (modify manifest URL)
|
||||
|
||||
## 📱 Popular Device Examples
|
||||
|
||||
### OnePlus 9 Pro (lemonades)
|
||||
```yaml
|
||||
env:
|
||||
TARGET_DEVICE: "lemonades"
|
||||
MANIFEST_URL: "https://github.com/LineageOS/android.git"
|
||||
MANIFEST_BRANCH: "lineage-21.0"
|
||||
```
|
||||
|
||||
### Pixel 7 Pro (cheetah)
|
||||
```yaml
|
||||
env:
|
||||
TARGET_DEVICE: "cheetah"
|
||||
MANIFEST_URL: "https://github.com/PixelExperience/manifest.git"
|
||||
MANIFEST_BRANCH: "thirteen"
|
||||
```
|
||||
|
||||
## 🔧 Manual Build Commands
|
||||
|
||||
If you want to run builds manually:
|
||||
|
||||
```bash
|
||||
# Build Docker image
|
||||
cd docker && docker build -t android-rom-builder .
|
||||
|
||||
# Run full build process
|
||||
docker-compose up
|
||||
|
||||
# Run individual steps
|
||||
docker run --rm -v $(pwd)/source:/home/buildbot/android/source android-rom-builder /home/buildbot/scripts/init-source.sh
|
||||
docker run --rm -v $(pwd)/source:/home/buildbot/android/source android-rom-builder /home/buildbot/scripts/sync-source.sh
|
||||
docker run --rm -v $(pwd)/source:/home/buildbot/android/source -v $(pwd)/out:/home/buildbot/android/out android-rom-builder /home/buildbot/scripts/build-rom.sh
|
||||
```
|
||||
|
||||
## 📊 Build Requirements
|
||||
|
||||
### System Requirements
|
||||
- **CPU**: 8+ cores recommended
|
||||
- **RAM**: 32GB+ recommended
|
||||
- **Storage**: 200GB+ free space
|
||||
- **Network**: Stable high-speed connection
|
||||
|
||||
### Build Times (approximate)
|
||||
- **Source Sync**: 30-60 minutes
|
||||
- **First Build**: 4-8 hours
|
||||
- **Incremental**: 30-120 minutes
|
||||
|
||||
## 🗂️ Directory Structure
|
||||
|
||||
```
|
||||
.
|
||||
├── .buildkite/
|
||||
│ └── pipeline.yml # Buildkite pipeline configuration
|
||||
├── docker/
|
||||
│ ├── Dockerfile # Android build environment
|
||||
│ └── docker-compose.yml # Container orchestration
|
||||
├── scripts/
|
||||
│ ├── init-source.sh # Initialize Android source
|
||||
│ ├── sync-source.sh # Sync source code
|
||||
│ ├── build-rom.sh # Build ROM
|
||||
│ └── package-rom.sh # Package artifacts
|
||||
├── source/ # Android source code (auto-created)
|
||||
├── out/ # Build outputs (auto-created)
|
||||
├── ccache/ # Build cache (auto-created)
|
||||
├── artifacts/ # Final ROM files (auto-created)
|
||||
└── .env # Environment configuration
|
||||
```
|
||||
|
||||
## 🎛️ Advanced Configuration
|
||||
|
||||
### Custom Manifest
|
||||
To use a different ROM source:
|
||||
|
||||
```bash
|
||||
# In .env file
|
||||
MANIFEST_URL=https://github.com/YourROM/android.git
|
||||
MANIFEST_BRANCH=your-branch-name
|
||||
```
|
||||
|
||||
### Build Optimization
|
||||
```bash
|
||||
# Enable ccache for faster builds
|
||||
USE_CCACHE=1
|
||||
|
||||
# Set build jobs (usually = CPU cores)
|
||||
BUILD_JOBS=16
|
||||
|
||||
# Clean build (slower but ensures clean state)
|
||||
CLEAN_BUILD=1
|
||||
```
|
||||
|
||||
## 🔍 Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
1. **Out of disk space**: Ensure 200GB+ free space
|
||||
2. **Build fails**: Check logs in Buildkite dashboard
|
||||
3. **Sync errors**: Verify internet connection and manifest URL
|
||||
4. **Docker issues**: Ensure Docker daemon is running
|
||||
|
||||
### Log Locations
|
||||
- Buildkite logs: Available in web dashboard
|
||||
- Docker logs: `docker logs android-rom-builder`
|
||||
- Build logs: `out/verbose.log.gz`
|
||||
|
||||
## 📞 Support
|
||||
|
||||
- Check Buildkite documentation for CI/CD issues
|
||||
- Android build issues: Check device-specific forums
|
||||
- Docker problems: Verify container setup
|
||||
|
||||
## 🎉 Success!
|
||||
|
||||
Once your build completes, download artifacts from the Buildkite dashboard:
|
||||
- `*.zip` - Flashable ROM package
|
||||
- `*.img` - Individual partition images
|
||||
- `build-info.json` - Build metadata
|
||||
- `*.md5`/`*.sha256` - Checksums for verification
|
||||
@@ -1,65 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
echo "🔨 Starting Android ROM build..."
|
||||
|
||||
cd /home/buildbot/android/source
|
||||
|
||||
# Configuration - modify these for your target device
|
||||
TARGET_DEVICE="${TARGET_DEVICE:-generic}"
|
||||
BUILD_TYPE="${BUILD_TYPE:-userdebug}"
|
||||
BUILD_VARIANT="${BUILD_VARIANT:-lineage}"
|
||||
|
||||
echo "🎯 Build configuration:"
|
||||
echo " Device: $TARGET_DEVICE"
|
||||
echo " Type: $BUILD_TYPE"
|
||||
echo " Variant: $BUILD_VARIANT"
|
||||
|
||||
# Set up build environment
|
||||
echo "⚙️ Setting up build environment..."
|
||||
source build/envsetup.sh
|
||||
|
||||
# Setup ccache
|
||||
if [ "${USE_CCACHE:-1}" = "1" ]; then
|
||||
echo "🚀 Configuring ccache..."
|
||||
export USE_CCACHE=1
|
||||
export CCACHE_DIR=/home/buildbot/android/ccache
|
||||
ccache -M 50G
|
||||
ccache -s
|
||||
fi
|
||||
|
||||
# Clean previous builds if requested
|
||||
if [ "${CLEAN_BUILD:-0}" = "1" ]; then
|
||||
echo "🧹 Cleaning previous build..."
|
||||
make clean
|
||||
fi
|
||||
|
||||
# Select build target
|
||||
echo "🎯 Selecting build target..."
|
||||
lunch "${BUILD_VARIANT}_${TARGET_DEVICE}-${BUILD_TYPE}"
|
||||
|
||||
# Start build
|
||||
echo "🔨 Starting compilation..."
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
# Build with appropriate number of parallel jobs
|
||||
JOBS=${BUILD_JOBS:-$(nproc)}
|
||||
echo "🚀 Building with $JOBS parallel jobs..."
|
||||
|
||||
if [ "$BUILD_VARIANT" = "lineage" ]; then
|
||||
# LineageOS specific build command
|
||||
brunch "$TARGET_DEVICE"
|
||||
else
|
||||
# Generic AOSP build
|
||||
make -j"$JOBS" otapackage
|
||||
fi
|
||||
|
||||
END_TIME=$(date +%s)
|
||||
BUILD_TIME=$((END_TIME - START_TIME))
|
||||
|
||||
echo "✅ Build completed successfully!"
|
||||
echo "⏱️ Build time: $(date -u -d @$BUILD_TIME +%H:%M:%S)"
|
||||
|
||||
# Display build artifacts
|
||||
echo "📦 Build artifacts:"
|
||||
find /home/buildbot/android/out/target/product/"$TARGET_DEVICE"/ -name "*.zip" -o -name "*.img" | head -10
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
echo "🚀 Initializing Android source repository..."
|
||||
|
||||
cd /home/buildbot/android/source
|
||||
|
||||
# Configuration - you can modify these
|
||||
MANIFEST_URL="https://github.com/LineageOS/android.git"
|
||||
MANIFEST_BRANCH="lineage-21.0"
|
||||
MANIFEST_NAME="default.xml"
|
||||
|
||||
# Check if source is already initialized
|
||||
if [ ! -d ".repo" ]; then
|
||||
echo "📁 Initializing repo with manifest: $MANIFEST_URL"
|
||||
echo "📋 Branch: $MANIFEST_BRANCH"
|
||||
|
||||
repo init \
|
||||
-u "$MANIFEST_URL" \
|
||||
-b "$MANIFEST_BRANCH" \
|
||||
-m "$MANIFEST_NAME" \
|
||||
--depth=1 \
|
||||
--no-clone-bundle
|
||||
|
||||
echo "✅ Repository initialized successfully!"
|
||||
else
|
||||
echo "📁 Repository already initialized, skipping..."
|
||||
fi
|
||||
|
||||
# Display repo info
|
||||
echo "📊 Repository information:"
|
||||
repo info | head -10
|
||||
@@ -1,68 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
echo "📦 Packaging ROM artifacts..."
|
||||
|
||||
TARGET_DEVICE="${TARGET_DEVICE:-generic}"
|
||||
OUT_DIR="/home/buildbot/android/out/target/product/$TARGET_DEVICE"
|
||||
ARTIFACTS_DIR="/home/buildbot/artifacts"
|
||||
|
||||
# Create artifacts directory
|
||||
mkdir -p "$ARTIFACTS_DIR"
|
||||
|
||||
echo "📁 Copying build artifacts..."
|
||||
|
||||
# Copy main ROM files
|
||||
if [ -f "$OUT_DIR"/*.zip ]; then
|
||||
echo "📱 Copying ROM zip files..."
|
||||
cp "$OUT_DIR"/*.zip "$ARTIFACTS_DIR/" || true
|
||||
fi
|
||||
|
||||
# Copy recovery image
|
||||
if [ -f "$OUT_DIR/recovery.img" ]; then
|
||||
echo "🔧 Copying recovery image..."
|
||||
cp "$OUT_DIR/recovery.img" "$ARTIFACTS_DIR/" || true
|
||||
fi
|
||||
|
||||
# Copy boot image
|
||||
if [ -f "$OUT_DIR/boot.img" ]; then
|
||||
echo "🥾 Copying boot image..."
|
||||
cp "$OUT_DIR/boot.img" "$ARTIFACTS_DIR/" || true
|
||||
fi
|
||||
|
||||
# Copy system image
|
||||
if [ -f "$OUT_DIR/system.img" ]; then
|
||||
echo "💿 Copying system image..."
|
||||
cp "$OUT_DIR/system.img" "$ARTIFACTS_DIR/" || true
|
||||
fi
|
||||
|
||||
# Copy vendor image
|
||||
if [ -f "$OUT_DIR/vendor.img" ]; then
|
||||
echo "🏪 Copying vendor image..."
|
||||
cp "$OUT_DIR/vendor.img" "$ARTIFACTS_DIR/" || true
|
||||
fi
|
||||
|
||||
# Create build info JSON
|
||||
echo "📋 Creating build information..."
|
||||
cat > "$ARTIFACTS_DIR/build-info.json" << EOF
|
||||
{
|
||||
"build_number": "${BUILDKITE_BUILD_NUMBER:-unknown}",
|
||||
"commit": "${BUILDKITE_COMMIT:-unknown}",
|
||||
"branch": "${BUILDKITE_BRANCH:-unknown}",
|
||||
"device": "$TARGET_DEVICE",
|
||||
"build_date": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
|
||||
"build_type": "${BUILD_TYPE:-userdebug}",
|
||||
"variant": "${BUILD_VARIANT:-lineage}"
|
||||
}
|
||||
EOF
|
||||
|
||||
# Create checksums
|
||||
echo "🔐 Generating checksums..."
|
||||
cd "$ARTIFACTS_DIR"
|
||||
find . -name "*.zip" -o -name "*.img" | xargs -I {} sh -c 'md5sum "{}" > "{}.md5"'
|
||||
find . -name "*.zip" -o -name "*.img" | xargs -I {} sh -c 'sha256sum "{}" > "{}.sha256"'
|
||||
|
||||
echo "📊 Artifact summary:"
|
||||
ls -lh "$ARTIFACTS_DIR"
|
||||
|
||||
echo "✅ Packaging completed successfully!"
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
echo "🔄 Syncing Android source code..."
|
||||
|
||||
cd /home/buildbot/android/source
|
||||
|
||||
# Check if repo is initialized
|
||||
if [ ! -d ".repo" ]; then
|
||||
echo "❌ Repository not initialized! Run init-source.sh first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Sync with multiple jobs for faster download
|
||||
echo "⬇️ Starting source sync..."
|
||||
repo sync \
|
||||
-c \
|
||||
-j$(nproc) \
|
||||
--force-sync \
|
||||
--no-clone-bundle \
|
||||
--no-tags \
|
||||
--optimized-fetch \
|
||||
--prune
|
||||
|
||||
echo "✅ Source sync completed successfully!"
|
||||
|
||||
# Display sync statistics
|
||||
echo "📊 Sync statistics:"
|
||||
echo "Total repositories: $(find .repo/projects -name "*.git" | wc -l)"
|
||||
echo "Disk usage: $(du -sh . | cut -f1)"
|
||||
|
||||
# Check for any missing projects
|
||||
echo "🔍 Checking for missing projects..."
|
||||
if repo status | grep -q "project.*dirty\|project.*not up-to-date"; then
|
||||
echo "⚠️ Some projects may need attention:"
|
||||
repo status | grep -E "project.*dirty|project.*not up-to-date" || true
|
||||
else
|
||||
echo "✅ All projects are clean and up-to-date"
|
||||
fi
|
||||
88
setup.sh
88
setup.sh
@@ -1,88 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
echo "🚀 Setting up Android ROM building environment..."
|
||||
|
||||
# Create necessary directories
|
||||
echo "📁 Creating directory structure..."
|
||||
mkdir -p source out ccache artifacts
|
||||
|
||||
# Create environment file if it doesn't exist
|
||||
if [ ! -f ".env" ]; then
|
||||
echo "⚙️ Creating environment configuration..."
|
||||
cat > .env << 'EOF'
|
||||
# Buildkite Agent Configuration
|
||||
BUILDKITE_AGENT_TOKEN=your_buildkite_agent_token_here
|
||||
|
||||
# Android Build Configuration
|
||||
TARGET_DEVICE=generic
|
||||
BUILD_TYPE=userdebug
|
||||
BUILD_VARIANT=lineage
|
||||
BUILD_JOBS=8
|
||||
|
||||
# Build Options
|
||||
USE_CCACHE=1
|
||||
CLEAN_BUILD=0
|
||||
|
||||
# Manifest Configuration
|
||||
MANIFEST_URL=https://github.com/LineageOS/android.git
|
||||
MANIFEST_BRANCH=lineage-21.0
|
||||
MANIFEST_NAME=default.xml
|
||||
|
||||
# Storage Paths (adjust these for your system)
|
||||
SOURCE_DIR=./source
|
||||
OUT_DIR=./out
|
||||
CCACHE_DIR=./ccache
|
||||
ARTIFACTS_DIR=./artifacts
|
||||
EOF
|
||||
echo "✅ Created .env file - please edit it with your configuration!"
|
||||
else
|
||||
echo "⚠️ .env file already exists, skipping..."
|
||||
fi
|
||||
|
||||
# Check Docker installation
|
||||
echo "🐳 Checking Docker installation..."
|
||||
if command -v docker &> /dev/null; then
|
||||
echo "✅ Docker is installed"
|
||||
docker --version
|
||||
else
|
||||
echo "❌ Docker is not installed! Please install Docker first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check Docker Compose
|
||||
if command -v docker-compose &> /dev/null; then
|
||||
echo "✅ Docker Compose is installed"
|
||||
docker-compose --version
|
||||
else
|
||||
echo "❌ Docker Compose is not installed! Please install Docker Compose first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check available disk space
|
||||
echo "💾 Checking available disk space..."
|
||||
AVAILABLE_SPACE=$(df -BG . | tail -1 | awk '{print $4}' | sed 's/G//')
|
||||
if [ "$AVAILABLE_SPACE" -lt 200 ]; then
|
||||
echo "⚠️ Warning: Only ${AVAILABLE_SPACE}GB available. Android builds need 200GB+!"
|
||||
else
|
||||
echo "✅ ${AVAILABLE_SPACE}GB available - sufficient for ROM building"
|
||||
fi
|
||||
|
||||
# Build Docker image
|
||||
echo "🔨 Building Docker image (this may take a while)..."
|
||||
cd docker
|
||||
docker build -t android-rom-builder:latest .
|
||||
cd ..
|
||||
|
||||
echo ""
|
||||
echo "🎉 Setup completed successfully!"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo "1. Edit .env file with your device and ROM configuration"
|
||||
echo "2. Set up your Buildkite pipeline using .buildkite/pipeline.yml"
|
||||
echo "3. Push this repository to GitHub/GitLab"
|
||||
echo "4. Connect the repository to Buildkite"
|
||||
echo "5. Trigger your first build!"
|
||||
echo ""
|
||||
echo "For manual builds, run: docker-compose up"
|
||||
echo ""
|
||||
Reference in New Issue
Block a user