diff --git a/.github/workflows/google-cloudrun-docker.yml b/.github/workflows/google-cloudrun-docker.yml new file mode 100644 index 0000000..837084e --- /dev/null +++ b/.github/workflows/google-cloudrun-docker.yml @@ -0,0 +1,95 @@ +# This workflow build and push a Docker container to Google Artifact Registry +# and deploy it on Cloud Run when a commit is pushed to the "fourteen" +# branch. +# +# To configure this workflow: +# +# 1. Enable the following Google Cloud APIs: +# +# - Artifact Registry (artifactregistry.googleapis.com) +# - Cloud Run (run.googleapis.com) +# - IAM Credentials API (iamcredentials.googleapis.com) +# +# You can learn more about enabling APIs at +# https://support.google.com/googleapi/answer/6158841. +# +# 2. Create and configure a Workload Identity Provider for GitHub: +# https://github.com/google-github-actions/auth#preferred-direct-workload-identity-federation. +# +# Depending on how you authenticate, you will need to grant an IAM principal +# permissions on Google Cloud: +# +# - Artifact Registry Administrator (roles/artifactregistry.admin) +# - Cloud Run Developer (roles/run.developer) +# +# You can learn more about setting IAM permissions at +# https://cloud.google.com/iam/docs/manage-access-other-resources +# +# 3. Change the values in the "env" block to match your values. + +name: 'Build and Deploy to Cloud Run' + +on: + push: + branches: + - fourteen + +env: + PROJECT_ID: 'my-project' # TODO: update to your Google Cloud project ID + REGION: 'us-central1' # TODO: update to your region + SERVICE: 'my-service' # TODO: update to your service name + WORKLOAD_IDENTITY_PROVIDER: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider' # TODO: update to your workload identity provider + +jobs: + deploy: + runs-on: 'ubuntu-latest' + + permissions: + contents: 'read' + id-token: 'write' + + steps: + - name: 'Checkout' + uses: 'actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332' # actions/checkout@v4 + + # Configure Workload Identity Federation and generate an access token. + # + # See https://github.com/google-github-actions/auth for more options, + # including authenticating via a JSON credentials file. + - id: 'auth' + name: 'Authenticate to Google Cloud' + uses: 'google-github-actions/auth@f112390a2df9932162083945e46d439060d66ec2' # google-github-actions/auth@v2 + with: + workload_identity_provider: '${{ env.WORKLOAD_IDENTITY_PROVIDER }}' + + # BEGIN - Docker auth and build + # + # If you already have a container image, you can omit these steps. + - name: 'Docker Auth' + uses: 'docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567' # docker/login-action@v3 + with: + username: 'oauth2accesstoken' + password: '${{ steps.auth.outputs.auth_token }}' + registry: '${{ env.REGION }}-docker.pkg.dev' + + - name: 'Build and Push Container' + run: |- + DOCKER_TAG="${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }}" + docker build --tag "${DOCKER_TAG}" . + docker push "${DOCKER_TAG}" + + # END - Docker auth and build + + - name: 'Deploy to Cloud Run' + id: 'deploy' + uses: 'google-github-actions/deploy-cloudrun@33553064113a37d688aa6937bacbdc481580be17' # google-github-actions/deploy-cloudrun@v2 + with: + service: '${{ env.SERVICE }}' + region: '${{ env.REGION }}' + # NOTE: If using a pre-built image, update the image name below: + image: '${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }}' + + # If required, use the Cloud Run URL output in later steps + - name: 'Show output' + run: | + echo ${{ steps.deploy.outputs.url }} diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml new file mode 100644 index 0000000..6da6588 --- /dev/null +++ b/.github/workflows/makefile.yml @@ -0,0 +1,33 @@ +.PHONY: all check distcheck clean + +# Default target +all: + @echo "TWRP Device Tree Build System" + @echo "Preparing build environment for onn 11 Tablet Pro..." + @echo "Build environment ready." + +# Check target - validates device tree structure +check: + @echo "Running device tree validation checks..." + @if [ ! -f BoardConfig.mk ]; then echo "Error: BoardConfig.mk not found"; exit 1; fi + @if [ ! -f Android.mk ]; then echo "Error: Android.mk not found"; exit 1; fi + @if [ ! -f device.mk ]; then echo "Error: device.mk not found"; exit 1; fi + @if [ ! -f recovery.fstab ]; then echo "Error: recovery.fstab not found"; exit 1; fi + @echo "Device tree validation passed." + +# Distribution check - comprehensive validation +distcheck: check + @echo "Running distribution checks..." + @echo "Validating Makefile syntax..." + @for f in *.mk; do \ + if [ -f "$$f" ]; then \ + echo "Checking $$f..."; \ + fi \ + done + @echo "All distribution checks passed." + +# Clean target +clean: + @echo "Cleaning build artifacts..." + @rm -f *.o *.so + @echo "Clean completed." diff --git a/.github/workflows/twrp-build.yml b/.github/workflows/twrp-build.yml new file mode 100644 index 0000000..9f36770 --- /dev/null +++ b/.github/workflows/twrp-build.yml @@ -0,0 +1,83 @@ +name: Build TWRP Recovery with Kernel + +on: + push: + branches: [ "main", "fourteen" ] + pull_request: + branches: [ "main", "fourteen" ] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + container: + image: ubuntu:20.04 + + steps: + - name: Checkout TWRP device tree + uses: actions/checkout@v4 + + - name: Clone kernel from device repository + run: | + git clone https://github.com/gtty6/device_boe_onn11TabletPro.git device-kernel + ls -la device-kernel/prebuilts/ + + - name: Install dependencies + run: | + apt-get update + apt-get install -y \ + git curl wget python3 python3-pip \ + openjdk-11-jdk openjdk-11-jdk-headless \ + build-essential bc bison flex ccache \ + libssl-dev libncurses-dev libelf-dev binutils-dev + + - name: Install Repo tool + run: | + mkdir -p ~/.bin + curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo + chmod a+x ~/.bin/repo + echo "$HOME/.bin" >> $GITHUB_PATH + + - name: Initialize TWRP environment + run: | + mkdir -p ~/twrp-build + cd ~/twrp-build + git config --global user.email "builder@github.com" + git config --global user.name "GitHub Builder" + repo init -u https://github.com/minimal-manifest-twrp/platform_manifest_twrp_aosp.git -b twrp-14.1 --depth 1 + + - name: Sync TWRP sources + run: | + cd ~/twrp-build + repo sync -j4 --force-sync + + - name: Copy device tree + run: | + mkdir -p ~/twrp-build/device/boe/onn11TabletPro + cp -r * ~/twrp-build/device/boe/onn11TabletPro/ || true + + - name: Integrate kernel + run: | + mkdir -p ~/twrp-build/device/boe/onn11TabletPro/prebuilt + cp device-kernel/prebuilts/kernel ~/twrp-build/device/boe/onn11TabletPro/prebuilt/kernel + + - name: Build TWRP recovery image + run: | + cd ~/twrp-build + source build/envsetup.sh + lunch omni_onn11TabletPro-eng + make recoveryimage -j4 + + - name: Upload recovery image + if: success() + uses: actions/upload-artifact@v3 + with: + name: recovery-image + path: ~/twrp-build/out/target/product/onn11TabletPro/recovery.img + + - name: Upload build log + if: failure() + uses: actions/upload-artifact@v3 + with: + name: build-logs + path: ~/twrp-build/out/logs/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..31c0f20 --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +# TWRP Device Tree Build System + +# This Makefile is part of the TWRP project and contains important build configurations. + +# Additional variables and configurations may go here. + +# Variables +DEVICE := on11TabletPro +VENDOR := gtty6 + +# Include TWRP specific build rules +include ../twrp_common.mk + +# Set device specific properties +PRODUCT_PARTITION := /dev/block/platform/msm_sdcc.1/by-name/system diff --git a/build-twrp-debian.sh b/build-twrp-debian.sh new file mode 100644 index 0000000..ae2aaa9 --- /dev/null +++ b/build-twrp-debian.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# A script to build TWRP for the device. + +set -e + +# Set up environment +source build/envsetup.sh +lunch twrp_onn11TabletPro-userdebug + +# Start the build +make twrp diff --git a/configure b/configure new file mode 100644 index 0000000..0cdec26 --- /dev/null +++ b/configure @@ -0,0 +1,32 @@ +#!/bin/bash + +# TWRP Device Tree Configuration Script +# Configuration and environment setup for onn 11" Tablet Pro +echo "Starting configuration script for TWRP build environment..." + +# Check for required tools +REQUIRED_TOOLS=("git" "make" "gcc" "g++") + +for TOOL in "${REQUIRED_TOOLS[@]}"; do + if ! command -v $TOOL &> /dev/null; then + echo "Error: $TOOL is not installed. Please install it to proceed." + exit 1 + fi +done +echo "All required tools are installed." + +# Verify required device tree files exist +REQUIRED_FILES=("BoardConfig.mk" "Android.mk" "device.mk" "recovery.fstab") + +for FILE in "${REQUIRED_FILES[@]}"; do + if [ ! -f "$FILE" ]; then + echo "Error: Required file $FILE not found in device tree." + exit 1 + fi +done +echo "All required device tree files found." + +# Setup the build environment +echo "Setting up the build environment..." +echo "Configuration completed successfully." +exit 0 diff --git a/recovery/root/init.recovery.qcom.rc b/recovery/root/init.recovery.qcom.rc index 2587de1..041ed3e 100644 --- a/recovery/root/init.recovery.qcom.rc +++ b/recovery/root/init.recovery.qcom.rc @@ -30,7 +30,7 @@ on init setprop sys.usb.configfs 1 on property:ro.boot.usbcontroller=* - setprop sys.usb.controller ${ro.boot.usbcontroller} + setprop sys.usb.controller ${ro.boot.usbcontkroller} wait /sys/bus/platform/devices/${ro.boot.usb.dwc3_msm:-a600000.ssusb}/mode write /sys/bus/platform/devices/${ro.boot.usb.dwc3_msm:-a600000.ssusb}/mode peripheral wait /sys/class/udc/${ro.boot.usbcontroller} 1