diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 03b793b..5812046 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,10 @@ on: device_tree: type: string required: true + header_version: + type: string + required: false + default: '' workflow_dispatch: inputs: device: @@ -36,6 +40,10 @@ on: device_tree: type: string required: true + header_version: + type: string + required: false + default: '' jobs: build: @@ -55,7 +63,7 @@ jobs: - name: Build u-boot run: | cd u-boot/builder - ./build_container.sh "${{ inputs.config }}" "${{ inputs.device_tree }}" + ./build_container.sh "${{ inputs.config }}" "${{ inputs.device_tree }}" "${{ inputs.header_version }}" mv output/u-boot.img output/u-boot-${{ inputs.device }}.img - name: Upload build artifacts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5ca6a6f..c5786cb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,10 +25,11 @@ jobs: config: "qcom_defconfig phone.config" device_tree: "qcom/sdm845-xiaomi-beryllium-tianma" - device: fairphone-fp5 - repo: https://git.codelinaro.org/clo/qcomlt/u-boot.git - ref: 6fc40f2499b1a517487933d7d81a482f6dce7751 - config: "qcom_defconfig phone.config" + repo: https://source.denx.de/u-boot/u-boot + ref: next + config: "qcm6490_defconfig qcom-phone.config" device_tree: "qcom/qcm6490-fairphone-fp5" + header_version: "2" uses: ./.github/workflows/build.yml with: device: ${{ matrix.target.device }} @@ -36,6 +37,7 @@ jobs: ref: ${{ matrix.target.ref }} config: ${{ matrix.target.config }} device_tree: ${{ matrix.target.device_tree }} + header_version: ${{ matrix.target.header_version }} release: needs: [ build ] diff --git a/build.sh b/build.sh index 9308e5a..f042520 100755 --- a/build.sh +++ b/build.sh @@ -4,12 +4,23 @@ set -uexo pipefail CONFIG="$1" DEVICE_TREE="$2" +HEADER_VERSION="${3:-}" cd .. make $CONFIG -make -j $(nproc) DEVICE_TREE="$DEVICE_TREE" +make -j $(nproc) gzip u-boot-nodtb.bin -c > u-boot-nodtb.bin.gz -cat u-boot-nodtb.bin.gz dts/upstream/src/arm64/$DEVICE_TREE.dtb > u-boot-dtb -mkbootimg --kernel_offset '0x00008000' --pagesize '4096' --kernel u-boot-dtb -o u-boot.img + +if [ "$HEADER_VERSION" = "2" ]; then + # Boot image v2 requires separate --dtb parameter + MKBOOTIMG_ARGS="--kernel u-boot-nodtb.bin.gz --dtb dts/upstream/src/arm64/$DEVICE_TREE.dtb --pagesize 4096 --base 0x0 --kernel_offset 0x8000 --ramdisk_offset 0x1000000 --tags_offset 0x100 --dtb_offset 0x1f00000 --header_version 2 -o u-boot.img" +else + # Legacy format: concatenate kernel and dtb + cat u-boot-nodtb.bin.gz dts/upstream/src/arm64/$DEVICE_TREE.dtb > u-boot-dtb + + MKBOOTIMG_ARGS="--kernel u-boot-dtb --pagesize 4096 --base 0x0 --kernel_offset 0x8000 -o u-boot.img" +fi + +mkbootimg $MKBOOTIMG_ARGS mkdir -p builder/output/ cp u-boot.img builder/output/u-boot.img diff --git a/build_container.sh b/build_container.sh index 5a66c88..287c19d 100755 --- a/build_container.sh +++ b/build_container.sh @@ -4,5 +4,5 @@ podman run --rm -it -v..:/srv:z -w/srv fedora:43 bash -c \ " dnf -y install bison flex android-tools make gcc glibc-devel openssl-devel openssl-devel-engine gnutls-devel awk xxd cd builder - ./build.sh \"${1}\" \"${2}\" + ./build.sh \"${1}\" \"${2}\" \"${3}\" "