diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml index 5b935cdc72..8d132737c5 100644 --- a/.github/actionlint.yaml +++ b/.github/actionlint.yaml @@ -18,6 +18,7 @@ self-hosted-runner: - k8s-ppc64le - metrics - ppc64le + - riscv-builder - sev - sev-snp - s390x diff --git a/.github/workflows/build-kata-static-tarball-riscv64.yaml b/.github/workflows/build-kata-static-tarball-riscv64.yaml new file mode 100644 index 0000000000..4cc5ca0695 --- /dev/null +++ b/.github/workflows/build-kata-static-tarball-riscv64.yaml @@ -0,0 +1,79 @@ +name: CI | Build kata-static tarball for riscv64 +on: + workflow_call: + inputs: + stage: + required: false + type: string + default: test + tarball-suffix: + required: false + type: string + push-to-registry: + required: false + type: string + default: no + commit-hash: + required: false + type: string + target-branch: + required: false + type: string + default: "" + +jobs: + build-asset: + runs-on: riscv-builder + permissions: + contents: read + packages: write + id-token: write + attestations: write + strategy: + matrix: + asset: + - kernel + - virtiofsd + steps: + - name: Login to Kata Containers quay.io + if: ${{ inputs.push-to-registry == 'yes' }} + uses: docker/login-action@v3 + with: + registry: quay.io + username: ${{ secrets.QUAY_DEPLOYER_USERNAME }} + password: ${{ secrets.QUAY_DEPLOYER_PASSWORD }} + + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.commit-hash }} + fetch-depth: 0 # This is needed in order to keep the commit ids history + + - name: Rebase atop of the latest target branch + run: | + ./tests/git-helper.sh "rebase-atop-of-the-latest-target-branch" + env: + TARGET_BRANCH: ${{ inputs.target-branch }} + + - name: Build ${{ matrix.asset }} + run: | + make "${KATA_ASSET}-tarball" + build_dir=$(readlink -f build) + # store-artifact does not work with symlink + mkdir -p kata-build && cp "${build_dir}"/kata-static-"${KATA_ASSET}"*.tar.* kata-build/. + env: + KATA_ASSET: ${{ matrix.asset }} + TAR_OUTPUT: ${{ matrix.asset }}.tar.gz + PUSH_TO_REGISTRY: ${{ inputs.push-to-registry }} + ARTEFACT_REGISTRY: ghcr.io + ARTEFACT_REGISTRY_USERNAME: ${{ github.actor }} + ARTEFACT_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }} + TARGET_BRANCH: ${{ inputs.target-branch }} + RELEASE: ${{ inputs.stage == 'release' && 'yes' || 'no' }} + + - name: store-artifact ${{ matrix.asset }} + uses: actions/upload-artifact@v4 + with: + name: kata-artifacts-arm64-${{ matrix.asset }}${{ inputs.tarball-suffix }} + path: kata-build/kata-static-${{ matrix.asset }}.tar.xz + retention-days: 15 + if-no-files-found: error diff --git a/tools/packaging/kernel/build-kernel.sh b/tools/packaging/kernel/build-kernel.sh index a2943648b1..c887b289aa 100755 --- a/tools/packaging/kernel/build-kernel.sh +++ b/tools/packaging/kernel/build-kernel.sh @@ -94,7 +94,7 @@ Commands: Options: - -a : Arch target to build the kernel, such as aarch64/ppc64le/s390x/x86_64. + -a : Arch target to build the kernel, such as aarch64/ppc64le/riscv64/s390x/x86_64. -b : Enable optional config type. -c : Path to config file to build the kernel. -D : DPU/SmartNIC vendor, only nvidia. @@ -124,6 +124,7 @@ arch_to_kernel() { case "$arch" in aarch64) echo "arm64" ;; ppc64le) echo "powerpc" ;; + riscv64) echo "riscv" ;; s390x) echo "s390" ;; x86_64) echo "$arch" ;; *) die "unsupported architecture: $arch" ;; @@ -551,7 +552,7 @@ install_kata() { fi # Install uncompressed kernel - if [ "${arch_target}" = "arm64" ]; then + if [ "${arch_target}" = "arm64" ] || [ "${arch_target}" = "riscv" ]; then install --mode 0644 -D "arch/${arch_target}/boot/Image" "${install_path}/${vmlinux}" elif [ "${arch_target}" = "s390" ]; then install --mode 0644 -D "arch/${arch_target}/boot/vmlinux" "${install_path}/${vmlinux}" diff --git a/tools/packaging/kernel/configs/fragments/common/acpi.conf b/tools/packaging/kernel/configs/fragments/common/acpi.conf index 25f7d3b1ed..43c9dfe591 100644 --- a/tools/packaging/kernel/configs/fragments/common/acpi.conf +++ b/tools/packaging/kernel/configs/fragments/common/acpi.conf @@ -1,4 +1,4 @@ -# !s390x !powerpc +# !s390x !powerpc !riscv # enable ACPI support. # This could do with REVIEW diff --git a/tools/packaging/kernel/configs/fragments/riscv/base.conf b/tools/packaging/kernel/configs/fragments/riscv/base.conf new file mode 100644 index 0000000000..226c82ed3c --- /dev/null +++ b/tools/packaging/kernel/configs/fragments/riscv/base.conf @@ -0,0 +1,5 @@ +CONFIG_RISCV=y +CONFIG_64BIT=y + +CONFIG_VIRTUALIZATION=y +CONFIG_KVM=y diff --git a/tools/packaging/kernel/configs/fragments/riscv/mmu.conf b/tools/packaging/kernel/configs/fragments/riscv/mmu.conf new file mode 100644 index 0000000000..4e3228e40c --- /dev/null +++ b/tools/packaging/kernel/configs/fragments/riscv/mmu.conf @@ -0,0 +1,6 @@ +# riscv specific memory related items + +CONFIG_NUMA=y +CONFIG_SPARSEMEM=y +CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y +CONFIG_MEMORY_HOTPLUG=y diff --git a/tools/packaging/kernel/configs/fragments/riscv/pci.conf b/tools/packaging/kernel/configs/fragments/riscv/pci.conf new file mode 100644 index 0000000000..ae81a99224 --- /dev/null +++ b/tools/packaging/kernel/configs/fragments/riscv/pci.conf @@ -0,0 +1,4 @@ +CONFIG_PCI_HOST_COMMON=y +CONFIG_PCI_HOST_GENERIC=y + +CONFIG_PCI_MSI_IRQ_DOMAIN=y diff --git a/tools/packaging/kernel/kata_config_version b/tools/packaging/kernel/kata_config_version index 15c44e939b..fa8f08cb6f 100644 --- a/tools/packaging/kernel/kata_config_version +++ b/tools/packaging/kernel/kata_config_version @@ -1 +1 @@ -149 +150