diff --git a/.github/workflows/build_kernel_bookworm.yml b/.github/workflows/build_kernel_bookworm.yml index 74e8ad7..9df26a2 100644 --- a/.github/workflows/build_kernel_bookworm.yml +++ b/.github/workflows/build_kernel_bookworm.yml @@ -55,16 +55,27 @@ jobs: restore-keys: | ${{ runner.os }}-kernel- - # Step 6: Make the build script executable + # Step 6: Verify Custom Config File Presence + - name: Verify Custom Config File Presence + run: | + echo "Verifying presence of wlanpi_v8_defconfig in build/ directory..." + if [ -f build/wlanpi_v8_defconfig ]; then + echo "wlanpi_v8_defconfig found." + else + echo "ERROR: wlanpi_v8_defconfig not found in build/ directory." + exit 1 + fi + + # Step 7: Make the build script executable - name: Make Build Script Executable run: chmod +x build/build-wlanpi-kernel.sh - # Step 7: Execute the build script + # Step 8: Execute the build script - name: Execute Build Script id: build-kernel run: ./build/build-wlanpi-kernel.sh - # Step 8: Extract Kernel Version and Date + # Step 9: Extract Kernel Version and Date - name: Extract Kernel Version and Date id: version-info run: | @@ -86,7 +97,7 @@ jobs: echo "PACKAGE_NAME=wlanpi-kernel-bookworm" >> $GITHUB_ENV echo "PACKAGE_VERSION=${VERSION}" >> $GITHUB_ENV - # Step 9: Debug Kernel and Package Versions + # Step 10: Debug Kernel and Package Versions - name: Debug Kernel and Package Versions run: | echo "Kernel Version: ${{ env.KERNEL_VERSION }}" @@ -94,10 +105,11 @@ jobs: echo "Package Name: ${{ env.PACKAGE_NAME }}" echo "Package Version: ${{ env.PACKAGE_VERSION }}" - # Step 10: Upload Debian Package as Artifact + # Step 11: Upload Debian Package as Artifact - name: Upload Debian Package uses: actions/upload-artifact@v4 # Updated to v4 to avoid deprecation warnings with: name: ${{ env.PACKAGE_NAME }}-${{ env.KERNEL_VERSION }} path: output/*.deb + diff --git a/.gitignore b/.gitignore index a2bf006..12373a9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ output *swp build/build_kernel.log build/linux/ +linux/ diff --git a/build/build-wlanpi-kernel.sh b/build/build-wlanpi-kernel.sh index 27faa34..edcec1c 100755 --- a/build/build-wlanpi-kernel.sh +++ b/build/build-wlanpi-kernel.sh @@ -12,15 +12,21 @@ LOG_FILE="build_kernel.log" exec > >(tee -i "$LOG_FILE") exec 2>&1 +# Determine the directory where the script resides +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# Set the repository root directory (assuming the script is in 'build/' directory) +REPO_ROOT="$(dirname "$SCRIPT_DIR")" + # Variables KERNEL_REPO="https://github.com/raspberrypi/linux.git" KERNEL_BRANCH="rpi-6.12.y" -KERNEL_SRC_DIR="linux" -OUTPUT_PATH="$(pwd)/output" # Output directory +KERNEL_SRC_DIR="$REPO_ROOT/linux" +OUTPUT_PATH="$REPO_ROOT/output" # Output directory CROSS_COMPILE="aarch64-linux-gnu-" ARCH="arm64" BASE_CONFIG="bcm2711_defconfig" -CUSTOM_CONFIG="wlanpi_v8_defconfig" # Corrected path +CUSTOM_CONFIG_FILE="wlanpi_v8_defconfig" +CUSTOM_CONFIG_PATH="$SCRIPT_DIR/$CUSTOM_CONFIG_FILE" NUM_CORES=$(nproc) # Define the new kernel image name @@ -30,12 +36,9 @@ IMAGE_OUTPUT="${OUTPUT_PATH}/boot/firmware/${KERNEL_IMAGE_NAME}" DTB_OUTPUT_DIR="${OUTPUT_PATH}/boot/firmware/" DTBO_OUTPUT_DIR="${OUTPUT_PATH}/boot/firmware/overlays/" MODULES_OUTPUT_DIR="${OUTPUT_PATH}/lib/modules" -PACKAGE_DIR="$(pwd)/wlanpi-kernel-package" +PACKAGE_DIR="$REPO_ROOT/wlanpi-kernel-package" # PACKAGE_NAME and PACKAGE_VERSION will be set after retrieving KERNEL_VERSION and BUILD_DATE -# Save the main build directory before changing directories -BUILD_DIR="$(pwd)" - # Functions error_exit() { echo "Error on line $1" @@ -66,7 +69,7 @@ else git fetch origin "$KERNEL_BRANCH" git checkout "$KERNEL_BRANCH" git reset --hard "origin/$KERNEL_BRANCH" - cd "$BUILD_DIR" # Return to main build directory + cd "$REPO_ROOT" # Return to repository root directory fi # Change to kernel source directory @@ -90,14 +93,14 @@ echo "Loading base config: $BASE_CONFIG..." make "$BASE_CONFIG" # Merge custom config -echo "Merging custom config: $CUSTOM_CONFIG..." -if [ -f "$BUILD_DIR/$CUSTOM_CONFIG" ]; then +echo "Merging custom config: $CUSTOM_CONFIG_PATH..." +if [ -f "$CUSTOM_CONFIG_PATH" ]; then # Use merge_config.sh to merge the custom config fragment with the base config - ./scripts/kconfig/merge_config.sh -m .config "$BUILD_DIR/$CUSTOM_CONFIG" .config + ./scripts/kconfig/merge_config.sh -m .config "$CUSTOM_CONFIG_PATH" .config # Apply the merged configuration make olddefconfig else - echo "ERROR: Custom config file $CUSTOM_CONFIG not found in $BUILD_DIR." + echo "ERROR: Custom config file $CUSTOM_CONFIG_PATH not found." exit 1 fi @@ -273,3 +276,4 @@ echo "Cleaning up temporary package directory..." rm -rf "$PACKAGE_DIR" echo "Kernel build, module installation, and package creation completed successfully." +