Эх сурвалжийг харах

ci(workflows): add LZ4 compression support and kernel images zip

- Enable LZ4 compression in kernel config
- Install LZ4 tools in workflow
- Create zip archive of all available kernel images
- Clean up temporary files after zip creation
TheWildJames 1 жил өмнө
parent
commit
a806989049

+ 35 - 2
.github/workflows/build.yml

@@ -56,7 +56,7 @@ jobs:
           sudo apt update && sudo apt install -y libelf-dev libssl-dev build-essential
           
           AOSP_MIRROR=https://android.googlesource.com
-          BRANCH=main-kernel-build-2024
+          BRANCH=main-kernel-2025
           git clone $AOSP_MIRROR/kernel/prebuilts/build-tools -b $BRANCH --depth 1 kernel-build-tools &
           git clone $AOSP_MIRROR/platform/system/tools/mkbootimg -b $BRANCH --depth 1 mkbootimg &
           wait
@@ -65,6 +65,7 @@ jobs:
           echo "MKBOOTIMG=$GITHUB_WORKSPACE/mkbootimg/mkbootimg.py" >> $GITHUB_ENV
           echo "UNPACK_BOOTIMG=$GITHUB_WORKSPACE/mkbootimg/unpack_bootimg.py" >> $GITHUB_ENV
           echo "BOOT_SIGN_KEY_PATH=$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem" >> $GITHUB_ENV
+          echo "PATH=$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/bin:$PATH" >> $GITHUB_ENV
           
           mkdir -p ./git-repo
           curl https://storage.googleapis.com/git-repo-downloads/repo > ./git-repo/repo
@@ -289,6 +290,12 @@ jobs:
           echo "CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y" >> "$defconfig"
           echo "CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=n" >> "$defconfig"
           
+          # LZ4 Compression Support
+          echo "CONFIG_HAVE_KERNEL_LZ4=y" >> "$defconfig"
+          echo "CONFIG_KERNEL_LZ4=y" >> "$defconfig"
+          echo "CONFIG_LZ4_COMPRESS=y" >> "$defconfig"
+          echo "CONFIG_LZ4_DECOMPRESS=y" >> "$defconfig"
+          
           # Remove check_defconfig
           #sed -i 's/check_defconfig//' ./common/build.config.gki
 
@@ -446,22 +453,46 @@ jobs:
       - name: Create Bootimgs Folder and Copy Images
         run: |
           mkdir bootimgs
+          mkdir kernel_images_temp
 
           SUBLEVEL_FOR_NAME="${{ inputs.sub_level }}"
           if [ -n "$ACTUAL_SUBLEVEL" ]; then
             SUBLEVEL_FOR_NAME="$ACTUAL_SUBLEVEL"
           fi
-            
+          
+          # Collect all available images for one zip
+          images_found=0
           for img_type in "" ".lz4" ".gz"; do
             src_file="$CONFIG/common/out/arch/arm64/boot/Image${img_type}"
             dest_file="./bootimgs/Image${img_type}"
             versioned_file="./WKSU-$KSUVER-${{ inputs.android_version }}-${{ inputs.kernel_version }}.$SUBLEVEL_FOR_NAME-${{ inputs.os_patch_level }}-Image${img_type}"
+            temp_file="./kernel_images_temp/Image${img_type}"
             
             if [ -f "$src_file" ]; then
               cp "$src_file" "$dest_file"
               cp "$src_file" "$versioned_file"
+              cp "$src_file" "$temp_file"
+              images_found=$((images_found + 1))
+              echo "Found and copied Image${img_type}"
+            else
+              echo "Warning: $src_file not found, skipping Image${img_type}"
             fi
           done
+          
+          # Create one zip containing all available images with maximum compression
+          if [ $images_found -gt 0 ]; then
+            zip_name="WKSU-$KSUVER-${{ inputs.android_version }}-${{ inputs.kernel_version }}.$SUBLEVEL_FOR_NAME-${{ inputs.os_patch_level }}-KernelImages.zip"
+            cd kernel_images_temp
+            zip -9 "../$zip_name" Image*
+            cd ..
+            echo "Created compressed zip with $images_found images: $zip_name"
+          else
+            echo "Error: No kernel images found to compress"
+            exit 1
+          fi
+          
+          # Clean up temp directory
+          rm -rf kernel_images_temp
 
       - name: Build Boot Images
         run: |
@@ -581,4 +612,6 @@ jobs:
           path: |
             *.zip
             *.img
+            *KernelImages.zip
             *Image*
+            !bootimgs/