TheWildJames il y a 3 mois
Parent
commit
d982c18a8b

+ 6 - 13
.github/actions/build-kernel/action.yml

@@ -36,16 +36,7 @@ runs:
   
       rm -rf "out"
 
-      GKI_KCONFIG_FRAGMENT_PATH="${{ github.workspace }}/wild_gki.fragment"
-      GKI_DEFCONFIG_WRAPPER_PATH="${{ github.workspace }}/wild_gki.wrap.sh"
-
-      cat > "${GKI_DEFCONFIG_WRAPPER_PATH}" <<EOF
-      append_cmd POST_DEFCONFIG_CMDS 'if [ -f "${GKI_KCONFIG_FRAGMENT_PATH}" ]; then \${KERNEL_DIR}/scripts/kconfig/merge_config.sh -m -O \${OUT_DIR} \${OUT_DIR}/.config "${GKI_KCONFIG_FRAGMENT_PATH}"; fi && (cd \${KERNEL_DIR} && make O=\${OUT_DIR} olddefconfig)'
-      EOF
-
-      # Override expensive GKI build.sh artifact defaults we do not need in CI.
-      GKI_BUILD_CONFIG_FRAGMENT_PATH="${{ github.workspace }}/gki_build_overrides.fragment"
-      cat > "${GKI_BUILD_CONFIG_FRAGMENT_PATH}" <<'EOF'
+      cat > ${{ github.workspace }}/gki_build_overrides.fragment <<'EOF'
       BUILD_GKI_ARTIFACTS=
       BUILD_GKI_CERTIFICATION_TOOLS=0
       BUILD_SYSTEM_DLKM=0
@@ -57,14 +48,16 @@ runs:
       SKIP_MRPROPER=1
       EOF
 
+      cp "${{ github.workflow }}/wild_gki.fragment" "${{ github.workflow }}/kernel/common/wild_gki.fragment"
+      cp "${{ github.workflow }}/gki_build_overrides.fragment" "${{ github.workflow }}/kernel/common/gki_build_overrides.fragment"
+
       mkdir -p /home/runner/out
 
       if [ -f "build/build.sh" ]; then
-        #SKIP_MRPROPER=1 
         OUT_DIR="/home/runner/out" \
         LTO=thin \
-        GKI_DEFCONFIG_FRAGMENT="${GKI_DEFCONFIG_WRAPPER_PATH}" \
-        GKI_BUILD_CONFIG_FRAGMENT="${GKI_BUILD_CONFIG_FRAGMENT_PATH}" \
+        GKI_DEFCONFIG_FRAGMENT=wild_gki.fragment \
+        GKI_BUILD_CONFIG_FRAGMENT=gki_build_overrides.fragment \
         BUILD_CONFIG=common/build.config.gki.aarch64 \
         build/build.sh -j"$(nproc)" \
         CC="/usr/bin/ccache clang" \

+ 12 - 37
.github/actions/set-kernel-config/action.yml

@@ -1,22 +1,11 @@
 # .github/actions/set-kernel-config/action.yml
 name: Set Kernel Config
-description: Enables kernel configs — handles =y, =n, "not set", missing, and arbitrary values
+description: Writes kernel config values into a fragment (NO defconfig edits)
 
 inputs:
   configs:
-    description: |
-      Newline-separated list of configs to set.
-      Plain name defaults to =y. Supply a value for anything else.
-      Examples:
-        CONFIG_PID_NS
-        CONFIG_IP_SET_MAX=65534
-        CONFIG_LOG_BUF_SHIFT=17
-    required: true
-  defconfig:
-    description: Path to the defconfig file
     required: true
   fragment:
-    description: Path to the .config fragment file (missing configs land here)
     required: true
 
 runs:
@@ -25,15 +14,19 @@ runs:
     - name: Apply configs
       shell: bash
       run: |
-        DEFCONFIG="${{ inputs.defconfig }}"
-        FRAGMENT="${{ inputs.fragment }}"
+        set -euo pipefail
 
+        FRAGMENT="${{ inputs.fragment }}"
         touch "${FRAGMENT}"
 
         set_config() {
           local input="$1"
 
-          # Split name=value — default to =y if no value supplied
+          # trim whitespace
+          input="$(echo "$input" | xargs)"
+
+          [[ -z "$input" || "$input" == \#* ]] && return
+
           if [[ "$input" == *"="* ]]; then
             local config="${input%%=*}"
             local value="${input#*=}"
@@ -42,31 +35,13 @@ runs:
             local value="y"
           fi
 
-          if grep -q "^${config}=${value}$" "${DEFCONFIG}"; then
-            echo "[SKIP]  ${config} already =${value} in defconfig"
+          # remove any existing entry (prevents duplicates/conflicts)
+          sed -i "/^${config}=/d" "${FRAGMENT}"
 
-          elif grep -q "^${config}=" "${DEFCONFIG}"; then
-            # Present but wrong value — replace it
-            sed -i "s/^${config}=.*/${config}=${value}/" "${DEFCONFIG}"
-            echo "[FIX]   ${config} had wrong value → updated to =${value} in defconfig"
-
-          elif grep -q "# ${config} is not set" "${DEFCONFIG}"; then
-            sed -i "s/# ${config} is not set/${config}=${value}/" "${DEFCONFIG}"
-            echo "[FIX]   ${config} was 'not set' → set to =${value} in defconfig"
-
-          else
-            if ! grep -q "^${config}=${value}$" "${FRAGMENT}"; then
-              echo "${config}=${value}" >> "${FRAGMENT}"
-              echo "[FRAG]  ${config} not found → added =${value} to fragment"
-            else
-              echo "[SKIP]  ${config} already =${value} in fragment"
-            fi
-          fi
+          # write clean value
+          echo "${config}=${value}" >> "${FRAGMENT}"
         }
 
         while IFS= read -r line; do
-          # Strip whitespace, skip blanks and comments
-          line="$(echo "$line" | tr -d '[:space:]')"
-          [[ -z "$line" || "$line" == \#* ]] && continue
           set_config "$line"
         done <<< "${{ inputs.configs }}"