From ecd08a434630cd02ae063ccb880622f81d2b3c3c Mon Sep 17 00:00:00 2001 From: Raymond Lai Date: Fri, 29 Aug 2025 00:21:02 +0800 Subject: [PATCH] Adaptations to enable 16KB page size support - Forcing use of NDK 28c (if applicable) - CMakeLists.txt add linker flag to force page size of 16KB - Added setup NDK step in Github Actions workflow to force use of NDK 28c --- .github/workflows/android-build.yml | 6 ++++++ .github/workflows/android-debug-artifact-ondemand.yml | 6 ++++++ .github/workflows/android-debug-artifact-release.yml | 6 ++++++ .github/workflows/android-feature.yml | 6 ++++++ .github/workflows/android-main.yml | 6 ++++++ file_operations/build.gradle | 1 + file_operations/src/main/c/CMakeLists.txt | 1 + gradle/libs.versions.toml | 1 + 8 files changed, 33 insertions(+) diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml index 24cbf5c350..7df4d792cb 100644 --- a/.github/workflows/android-build.yml +++ b/.github/workflows/android-build.yml @@ -21,6 +21,12 @@ jobs: with: distribution: "temurin" java-version: 17 + - name: Set up NDK + uses: nttld/setup-ndk@afb4c9964b521afb97c864b7d40b11e6911bd410 + with: + ndk-version: r28c + link-to-sdk: true + local-cache: true - name: Check formatting using spotless uses: gradle/actions/setup-gradle@v3 with: diff --git a/.github/workflows/android-debug-artifact-ondemand.yml b/.github/workflows/android-debug-artifact-ondemand.yml index 4f19d69688..9513f9fa55 100644 --- a/.github/workflows/android-debug-artifact-ondemand.yml +++ b/.github/workflows/android-debug-artifact-ondemand.yml @@ -40,6 +40,12 @@ jobs: with: distribution: "temurin" java-version: 17 + - name: Set up NDK + uses: nttld/setup-ndk@afb4c9964b521afb97c864b7d40b11e6911bd410 + with: + ndk-version: r28c + link-to-sdk: true + local-cache: true - name: Build with Gradle uses: gradle/actions/setup-gradle@v3 with: diff --git a/.github/workflows/android-debug-artifact-release.yml b/.github/workflows/android-debug-artifact-release.yml index 53d915a20c..d4052fdd1e 100644 --- a/.github/workflows/android-debug-artifact-release.yml +++ b/.github/workflows/android-debug-artifact-release.yml @@ -14,6 +14,12 @@ jobs: with: distribution: "temurin" java-version: 17 + - name: Set up NDK + uses: nttld/setup-ndk@afb4c9964b521afb97c864b7d40b11e6911bd410 + with: + ndk-version: r28c + link-to-sdk: true + local-cache: true - name: Build with Gradle uses: gradle/actions/setup-gradle@v3 with: diff --git a/.github/workflows/android-feature.yml b/.github/workflows/android-feature.yml index 91d46524ba..abb78f30fe 100644 --- a/.github/workflows/android-feature.yml +++ b/.github/workflows/android-feature.yml @@ -22,6 +22,12 @@ jobs: with: distribution: "temurin" java-version: 17 + - name: Set up NDK + uses: nttld/setup-ndk@afb4c9964b521afb97c864b7d40b11e6911bd410 + with: + ndk-version: r28c + link-to-sdk: true + local-cache: true - name: Check formatting using spotless uses: gradle/actions/setup-gradle@v3 with: diff --git a/.github/workflows/android-main.yml b/.github/workflows/android-main.yml index 6565eee6a2..18f7e55310 100644 --- a/.github/workflows/android-main.yml +++ b/.github/workflows/android-main.yml @@ -22,6 +22,12 @@ jobs: with: distribution: "temurin" java-version: 17 + - name: Set up NDK + uses: nttld/setup-ndk@afb4c9964b521afb97c864b7d40b11e6911bd410 + with: + ndk-version: r28c + link-to-sdk: true + local-cache: true - name: Check formatting using spotless uses: gradle/actions/setup-gradle@v3 with: diff --git a/file_operations/build.gradle b/file_operations/build.gradle index 695dcfa1a9..032d022500 100644 --- a/file_operations/build.gradle +++ b/file_operations/build.gradle @@ -8,6 +8,7 @@ android { defaultConfig { minSdkVersion libs.versions.minSdk.get().toInteger() + ndkVersion libs.versions.ndk.get() testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" diff --git a/file_operations/src/main/c/CMakeLists.txt b/file_operations/src/main/c/CMakeLists.txt index 2ce2b13b1f..a6a2a47fc9 100644 --- a/file_operations/src/main/c/CMakeLists.txt +++ b/file_operations/src/main/c/CMakeLists.txt @@ -10,3 +10,4 @@ add_library(rootoperations SHARED rootoperations.c) find_library(log-lib log) target_link_libraries(rootoperations ${log-lib}) +target_link_options(${CMAKE_PROJECT_NAME} PRIVATE "-Wl,-z,max-page-size=16384") \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6b1c16d97b..92d923e604 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,6 +3,7 @@ compileSdk = "34" minSdk = "21" targetSdk = "34" kotlin = "1.9.25" +ndk = "28.2.13676358" jacocoAndroid = "0.2.1" gradle = "8.5.2"