From a59288da9e0139a3b43659774a8b9c457a72a52d Mon Sep 17 00:00:00 2001 From: Razvan Deaconescu Date: Wed, 15 Nov 2023 00:10:05 +0200 Subject: [PATCH] feat(library): Introduce base (ELF Loader) to library Introduce `base` image (ELF Loader) for bincompat runs. Add `Kraftfile` to build for QMEU and Firecracker on x86_64 using initrd for volume support. It uses the `testing` branch of Unikraft, that incorporates all not-yet-upstream changes. Add GitHub workflow to build and deploy the image. Add success badge in `README.md`. Signed-off-by: Razvan Deaconescu --- .github/workflows/library-base.yaml | 73 ++++++++++++++++++++++ README.md | 1 + library/base/Kraftfile | 93 +++++++++++++++++++++++++++++ 3 files changed, 167 insertions(+) create mode 100644 .github/workflows/library-base.yaml create mode 100644 library/base/Kraftfile diff --git a/.github/workflows/library-base.yaml b/.github/workflows/library-base.yaml new file mode 100644 index 00000000..b6e73bc0 --- /dev/null +++ b/.github/workflows/library-base.yaml @@ -0,0 +1,73 @@ +name: library/base + +on: + schedule: + - cron: '0 0 * * *' # Everyday at 12AM + + push: + branches: [main] + paths: + - 'library/base/**' + - '.github/workflows/library-base.yaml' + + pull_request: + types: [opened, synchronize, reopened] + branches: [main] + paths: + - 'library/base/**' + - '.github/workflows/library-base.yaml' + +jobs: + build: + strategy: + fail-fast: false + matrix: + include: + - plat: qemu + arch: x86_64 + - plat: fc + arch: x86_64 + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Build base + uses: unikraft/kraftkit@staging + with: + loglevel: debug + workdir: library/base + runtimedir: /github/workspace/.kraftkit + plat: ${{ matrix.plat }} + arch: ${{ matrix.arch }} + push: false + output: oci://index.unikraft.io/unikraft.org/base:latest + + - name: Archive OCI digests + uses: actions/upload-artifact@v3 + with: + name: oci-digests-${{ matrix.arch }}-${{ matrix.plat }} + path: ${{ github.workspace }}/.kraftkit/oci/digests + if-no-files-found: error + + push: + if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }} + needs: [ build ] + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Login to OCI registry + uses: docker/login-action@v2 + with: + registry: index.unikraft.io + username: ${{ secrets.REG_USERNAME }} + password: ${{ secrets.REG_TOKEN }} + + - name: Retrieve, merge and push OCI digests + uses: ./.github/actions/merge-oci-digests + with: + name: index.unikraft.io/unikraft.org/base:latest + push: true diff --git a/README.md b/README.md index 9f114bdf..670c644e 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ kraft pkg ls --apps --update | Status | Image | |-|-| +| [![](https://github.com/unikraft/catalog/actions/workflows/library-base.yaml/badge.svg)](https://github.com/unikraft/catalog/actions/workflows/library-base.yaml) | [`unikraft.org/base:latest`](library/base) | | [![](https://github.com/unikraft/catalog/actions/workflows/library-helloworld.yaml/badge.svg)](https://github.com/unikraft/catalog/actions/workflows/library-helloworld.yaml) | [`unikraft.org/helloworld:latest`](library/helloworld) | | [![](https://github.com/unikraft/catalog/actions/workflows/library-nginx1.15.yaml/badge.svg)](https://github.com/unikraft/catalog/actions/workflows/library-nginx1.15.yaml) | [`unikraft.org/nginx:1.15`](library/nginx/1.15) | | [![](https://github.com/unikraft/catalog/actions/workflows/library-python3.10.yaml/badge.svg)](https://github.com/unikraft/catalog/actions/workflows/library-python3.10.yaml) | [`unikraft.org/python:3.10`](library/python/3.10) | diff --git a/library/base/Kraftfile b/library/base/Kraftfile new file mode 100644 index 00000000..045494c5 --- /dev/null +++ b/library/base/Kraftfile @@ -0,0 +1,93 @@ +spec: v0.6 + +template: + source: https://github.com/unikraft/app-elfloader.git + version: stable + +unikraft: + source: https://github.com/unikraft/unikraft.git + version: staging + kconfig: + CONFIG_APPELFLOADER_ARCH_PRCTL: 'y' + CONFIG_APPELFLOADER_BRK: 'y' + CONFIG_APPELFLOADER_CUSTOMAPPNAME: 'y' + CONFIG_APPELFLOADER_STACK_NBPAGES: 128 + CONFIG_APPELFLOADER_VFSEXEC_EXECBIT: 'n' + CONFIG_APPELFLOADER_VFSEXEC: 'y' + CONFIG_HAVE_PAGING_DIRECTMAP: 'y' + CONFIG_HAVE_PAGING: 'y' + CONFIG_LIBDEVFS_AUTOMOUNT: 'y' + CONFIG_LIBDEVFS_DEV_NULL: 'y' + CONFIG_LIBDEVFS_DEV_STDOUT: 'y' + CONFIG_LIBDEVFS_DEV_ZERO: 'y' + CONFIG_LIBDEVFS: 'y' + CONFIG_LIBISRLIB: 'y' + CONFIG_LIBPOSIX_ENVIRON_ENVP0: "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + CONFIG_LIBPOSIX_ENVIRON_ENVP1: "LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib" + CONFIG_LIBPOSIX_ENVIRON_ENVP2: "HOME=/" + CONFIG_LIBPOSIX_ENVIRON: 'y' + CONFIG_LIBPOSIX_EVENTFD: 'y' + CONFIG_LIBPOSIX_FDIO: 'y' + CONFIG_LIBPOSIX_FDTAB: 'y' + CONFIG_LIBPOSIX_FUTEX: 'y' + CONFIG_LIBPOSIX_MMAP: 'y' + CONFIG_LIBPOSIX_NETLINK: 'y' + CONFIG_LIBPOSIX_PIPE: 'y' + CONFIG_LIBPOSIX_POLL: 'y' + CONFIG_LIBPOSIX_PROCESS_CLONE: 'y' + CONFIG_LIBPOSIX_SOCKET: 'y' + CONFIG_LIBPOSIX_SYSINFO: 'y' + CONFIG_LIBPOSIX_TIME: 'y' + CONFIG_LIBPOSIX_TIMERFD: 'y' + CONFIG_LIBPOSIX_UNIXSOCKET: 'y' + CONFIG_LIBPOSIX_USER_GID: 0 + CONFIG_LIBPOSIX_USER_GROUPNAME: "root" + CONFIG_LIBPOSIX_USER_UID: 0 + CONFIG_LIBPOSIX_USER_USERNAME: "root" + CONFIG_LIBPOSIX_USER: 'y' + CONFIG_LIBRAMFS: 'y' + CONFIG_LIBSYSCALL_SHIM_HANDLER_ULTLS: 'y' + CONFIG_LIBSYSCALL_SHIM_HANDLER: 'y' + CONFIG_LIBSYSCALL_SHIM_LEGACY_VERBOSE: 'y' + CONFIG_LIBSYSCALL_SHIM: 'y' + CONFIG_LIBUKALLOCPOOL: 'y' + CONFIG_LIBUKBLKDEV_SYNC_IO_BLOCKED_WAITING: 'y' + CONFIG_LIBUKBLKDEV: 'y' + CONFIG_LIBUKBOOT_BANNER_MINIMAL: 'y' + CONFIG_LIBUKBOOT_HEAP_BASE: '0x400000000' + CONFIG_LIBUKCPIO: 'y' + CONFIG_LIBUKFALLOC: 'y' + CONFIG_LIBUKMPI: 'n' + CONFIG_LIBUKSIGNAL: 'y' + CONFIG_LIBUKVMEM_DEFAULT_BASE: '0x0000001000000000' + CONFIG_LIBUKVMEM_DEMAND_PAGE_IN_SIZE: 12 + CONFIG_LIBUKVMEM_PAGEFAULT_HANDLER_PRIO: 4 + CONFIG_LIBUKVMEM: 'y' + CONFIG_LIBVFSCORE_AUTOMOUNT_ROOTFS: 'n' + CONFIG_LIBVFSCORE_FSTAB: 'y' + CONFIG_LIBVFSCORE_NONLARGEFILE: 'y' + CONFIG_OPTIMIZE_DEADELIM: 'y' + CONFIG_OPTIMIZE_LTO: 'y' + CONFIG_PAGING: 'y' + CONFIG_STACK_SIZE_PAGE_ORDER: 4 # 128 * 4K = 512K + CONFIG_UKPLAT_KSP_SIZE: 32768 + CONFIG_UKPLAT_MEMREGION_MAX_COUNT: 64 + + # Debug options + CONFIG_KVM_DEBUG_VGA_CONSOLE: 'n' + CONFIG_KVM_KERNEL_VGA_CONSOLE: 'n' + CONFIG_LIBUKDEBUG_CRASH_SCREEN: 'n' + CONFIG_LIBUKDEBUG_ENABLE_ASSERT: 'n' + CONFIG_LIBUKDEBUG_PRINT_TIME: 'n' + + # CONFIG_LIBSYSCALL_SHIM_STRACE: 'y' + # CONFIG_LIBUKDEBUG_PRINTD: 'y' + # CONFIG_LIBUKDEBUG_PRINTK_INFO: 'y' + +libraries: + lwip: staging + libelf: stable + +targets: +- fc/x86_64 +- qemu/x86_64