diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dec5668c060..84824fc3782 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -273,6 +273,8 @@ jobs: platform: protectli vendor: ${{ matrix.vendor }} model: ${{ matrix.model }} + artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}" + secrets: inherit strategy: matrix: @@ -312,6 +314,7 @@ jobs: platform: protectli vendor: ${{ matrix.vendor }} model: ${{ matrix.model }} + artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}" secrets: inherit strategy: matrix: @@ -325,6 +328,7 @@ jobs: platform: protectli vendor: ${{ matrix.vendor }} model: ${{ matrix.model }} + artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}" secrets: inherit strategy: matrix: @@ -338,6 +342,7 @@ jobs: platform: protectli vendor: ${{ matrix.vendor }} model: ${{ matrix.model }} + artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}" secrets: inherit strategy: matrix: @@ -351,18 +356,40 @@ jobs: platform: protectli vendor: ${{ matrix.vendor }} model: ${{ matrix.model }} + artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}" secrets: inherit strategy: matrix: vendor: [ protectli ] model: [ vp46xx ] - deploy_novacustom: - if: startsWith(github.ref, 'refs/tags/novacustom') + deploy_novacustom_adl: + if: startsWith(github.ref, 'refs/tags/novacustom') && contains(github.ref, 'adl') needs: build_novacustom uses: ./.github/workflows/deploy-template.yml with: platform: novacustom + vendor: ${{ matrix.vendor }} + model: ${{ matrix.model }} + artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}" secrets: inherit + strategy: + matrix: + vendor: [ novacustom ] + model: [ nv4x_adl, ns5x_adl ] + deploy_novacustom_tgl: + if: startsWith(github.ref, 'refs/tags/novacustom') && contains(github.ref, 'tgl') + needs: build_novacustom + uses: ./.github/workflows/deploy-template.yml + with: + platform: novacustom + vendor: ${{ matrix.vendor }} + model: ${{ matrix.model }} + artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}" + secrets: inherit + strategy: + matrix: + vendor: [ novacustom ] + model: [ nv4x_tgl, ns5x_tgl ] deploy_pcengines: if: startsWith(github.ref, 'refs/tags/pcengines') needs: build_pcengines @@ -372,22 +399,42 @@ jobs: vendor: ${{ matrix.vendor }} model: ${{ matrix.model }} payload: ${{ matrix.payload }} + artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}-${{ matrix.payload }}" secrets: inherit strategy: matrix: vendor: [ pcengines ] model: [ apu2, apu3, apu4, apu6 ] payload: [ uefi ] - deploy_msi: - if: startsWith(github.ref, 'refs/tags/msi') + deploy_msi_ms7d25: + if: startsWith(github.ref, 'refs/tags/msi_ms7d25') needs: build_msi uses: ./.github/workflows/deploy-template.yml with: platform: msi + vendor: ${{ matrix.vendor }} + model: "ms7d25" type: ${{ matrix.type }} + artifact_name: "dasharo-${{ matrix.vendor }}-ms7d25_${{ matrix.type }}" secrets: inherit strategy: matrix: + vendor: [ msi ] + type: [ ddr4, ddr5 ] + deploy_msi_ms7e06: + if: startsWith(github.ref, 'refs/tags/msi_ms7e06') + needs: build_msi + uses: ./.github/workflows/deploy-template.yml + with: + platform: msi + vendor: ${{ matrix.vendor }} + model: "ms7e06" + type: ${{ matrix.type }} + artifact_name: "dasharo-${{ matrix.vendor }}-ms7e06_${{ matrix.type }}" + secrets: inherit + strategy: + matrix: + vendor: [ msi ] type: [ ddr4, ddr5 ] deploy_hardkernel_odroid: if: startsWith(github.ref, 'refs/tags/hardkernel_odroid_h4') @@ -395,8 +442,9 @@ jobs: uses: ./.github/workflows/deploy-template.yml with: platform: hardkernel - vendor: ${{ matrix.vendor }} model: ${{ matrix.model }} + vendor: ${{ matrix.model }} + artifact_name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}" secrets: inherit strategy: matrix: diff --git a/.github/workflows/deploy-template.yml b/.github/workflows/deploy-template.yml index ef49f026e06..f0872b55bb6 100644 --- a/.github/workflows/deploy-template.yml +++ b/.github/workflows/deploy-template.yml @@ -16,6 +16,8 @@ on: type: type: string required: false + artifact_name: + type: string jobs: deploy: @@ -31,54 +33,32 @@ jobs: - name: Parse directories id: parse_directories run: | + tag=${{ steps.tag_name.outputs.tag }} - if [ "${{ inputs.platform }}" == "protectli" ]; then - base_dir="protectli" - if [ "${{ inputs.model }}" == "vp2430" ]; then - model="protectli_vp2430" - release=$(echo "$tag" | cut -d'_' -f3) - else - model=$(echo "$tag" | cut -d'_' -f1-3) - release=$(echo "$tag" | cut -d'_' -f4) - fi - elif [ "${{ inputs.platform }}" == "novacustom" ]; then - base_dir="novacustom" - model=$(echo "$tag" | cut -d'_' -f1-3) - release=$(echo "$tag" | cut -d'_' -f4) - elif [ "${{ inputs.platform }}" == "pcengines" ]; then - base_dir="pcengines" - model="pcengines_apu2" - release=$(echo "$tag" | cut -d'_' -f3) - elif [ "${{ inputs.platform }}" == "msi" ]; then - base_dir="msi" - model=$(echo "$tag" | cut -d'_' -f1-2) - release=$(echo "$tag" | cut -d'_' -f3) - fi + # Extract platform model string (everything before the last underscore in the tag) + model=$(echo "$tag" | awk -F'_' '{OFS="_"; $(NF)=""; print $0}' | sed 's/_$//') + # Extract version string (everything after the last underscore in the tag) + release=$(echo "$tag" | awk -F'_' '{print $NF}') + + # Use 3mdeb directory for community / DPP releases + case "${{ inputs.platform }}" in + msi|hardkernel) + base_dir="3mdeb" + ;; + *) + # by default, use platform vendor name as a directory + base_dir="${{ inputs.platform }}" + ;; + esac + echo "base_dir=$base_dir" >> "$GITHUB_OUTPUT" echo "model=$model" >> "$GITHUB_OUTPUT" echo "release=$release" >> "$GITHUB_OUTPUT" - - name: Parse artifact name - id: artifact_name - run: | - if [ "${{ inputs.platform }}" == "protectli" ]; then - echo "artifact_name=dasharo-${{ inputs.vendor }}-${{ inputs.model }}" >> "$GITHUB_OUTPUT" - elif [ "${{ inputs.platform }}" == "novacustom" ]; then - first_part=$(echo ${{ steps.tag_name.outputs.tag }} | cut -d "_" -f1) - second_part=$(echo ${{ steps.tag_name.outputs.tag }} | cut -d "_" -f2-3) - echo "artifact_name=dasharo-$first_part-$second_part" >> "$GITHUB_OUTPUT" - elif [ "${{ inputs.platform }}" == "pcengines" ]; then - echo "artifact_name=dasharo-${{ inputs.vendor }}-${{ inputs.model }}-${{ inputs.payload }}" >> "$GITHUB_OUTPUT" - elif [ "${{ inputs.platform }}" == "msi" ]; then - first_part=$(echo ${{ steps.tag_name.outputs.tag }} | cut -d "_" -f1) - second_part=$(echo ${{ steps.tag_name.outputs.tag }} | cut -d "_" -f2) - echo "artifact_name=dasharo-$first_part-${second_part}_${{ inputs.type }}" >> "$GITHUB_OUTPUT" - fi - - name: Download workflow artifact uses: actions/download-artifact@v4 with: - name: ${{ steps.artifact_name.outputs.artifact_name }} + name: ${{ inputs.artifact_name }} path: "./artifacts" - name: Upload to Nextcloud @@ -90,18 +70,27 @@ jobs: release="${{ steps.parse_directories.outputs.release }}" CURL_CMD="curl -u $url_part:${{ secrets.CLOUD_PASSWORD }}" - if [ "${{ inputs.platform }}" == "protectli" ]; then - new_name=$(echo "${{ inputs.vendor }}-${{ inputs.model }}-${release}.rom" | sed 's/-/_/g; s/.*/\L&/') - elif [ "${{ inputs.platform }}" == "novacustom" ]; then - new_name=$(echo "${model}_${release}.rom" | sed 's/-/_/g; s/.*/\L&/') - elif [ "${{ inputs.platform }}" == "pcengines" ]; then - new_name=$(echo "${{ inputs.vendor }}_${{ inputs.model }}_${{ inputs.payload }}_${release}.rom" | sed 's/.*/\L&/') - elif [ "${{ inputs.platform }}" == "msi" ]; then - new_name=$(echo "${model}_${{ inputs.type }}_${release}.rom" | sed 's/-/_/g; s/.*/\L&/') + if [ "${{ inputs.platform }}" == "pcengines" ]; then + new_name="pcengines_${{ inputs.model }}_${release}.rom" + else + new_name="${{ inputs.model }}_${release}.rom" + if [ ! -z "${{ inputs.vendor }}" ]; then + new_name="${{ inputs.vendor }}_${new_name}" + fi + if [ ! -z "${{ inputs.payload }}" ]; then + new_name=$(echo "$new_name" | awk -F'_' '{OFS="_"; $NF="${{ inputs.payload }}_"$NF; print}') + fi + if [ ! -z "${{ inputs.type }}" ]; then + new_name=$(echo "${new_name%.rom}_${{ inputs.type }}.rom") + fi fi # Create release directory if it doesn't exist + $CURL_CMD -X MKCOL "$BASE_URL/$base_dir" + $CURL_CMD -X MKCOL "$BASE_URL/$base_dir/$model" $CURL_CMD -X MKCOL "$BASE_URL/$base_dir/$model/$release" + + # upload firmware and hash files $CURL_CMD -X PUT -T "artifacts/coreboot.rom" "$BASE_URL/$base_dir/$model/$release/$new_name" sha256sum artifacts/coreboot.rom > ${new_name}.sha256 $CURL_CMD -X PUT -T "${new_name}.sha256" "$BASE_URL/$base_dir/$model/$release/" diff --git a/build.sh b/build.sh index 19646f0029a..34ba598f590 100755 --- a/build.sh +++ b/build.sh @@ -25,9 +25,10 @@ usage() { echo -e "\toptiplex_9010 - build Dasharo compatible with Dell OptiPlex 7010/9010" echo -e "\tqemu - build Dasharo for QEMU Q35" echo -e "\tqemu_full - build Dasharo for QEMU Q35 with all menus available" + echo -e "\todroid_h4 - build Dasharo compatible with Hardkernel ODROID H4" } -SDKVER="2023-11-24_2731fa619b" +SDKVER="2024-02-18_732134932b" function build_optiplex_9010 { @@ -222,6 +223,39 @@ function build_qemu { fi } +function build_odroid_h4 { + DEFCONFIG="configs/config.hardkernel_odroid_h4" + FW_VERSION=$(cat ${DEFCONFIG} | grep CONFIG_LOCALVERSION | cut -d '=' -f 2 | tr -d '"') + + # checkout several submodules needed by these boards (some others are checked + # out by coreboot's Makefile) + git submodule update --init --force --checkout \ + 3rdparty/dasharo-blobs + + docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \ + -v $HOME/.ssh:/home/coreboot/.ssh \ + -w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \ + /bin/bash -c "make distclean" + + cp $DEFCONFIG .config + + echo "Building Dasharo compatbile with Hardkernel ODROID H4 (version $FW_VERSION)" + + docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \ + -v $HOME/.ssh:/home/coreboot/.ssh \ + -w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \ + /bin/bash -c "make olddefconfig && make -j$(nproc)" + + cp build/coreboot.rom hardkernel_odroid_h4_${FW_VERSION}.rom + if [ $? -eq 0 ]; then + echo "Result binary placed in $PWD/hardkernel_odroid_h4_${FW_VERSION}.rom" + sha256sum hardkernel_odroid_h4_${FW_VERSION}.rom > hardkernel_odroid_h4_${FW_VERSION}.rom.sha256 + else + echo "Build failed!" + exit 1 + fi +} + CMD="$1" case "$CMD" in @@ -299,6 +333,9 @@ case "$CMD" in "qemu_full" | "QEMU_full" | "q35_full" | "Q35_full" ) build_qemu "_all_menus" ;; + "odroid_h4" | "odroid_H4" | "ODROID_H4" ) + build_odroid_h4 + ;; *) echo "Invalid command: \"$CMD\"" usage