diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 122d89cc7b3..51b1848d6b8 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -50,6 +50,7 @@ "https://bcr.bazel.build/modules/aspect_rules_js/2.3.8/source.json": "411ec9d79d6f5fe8a083359588c21d01a5b48d88a2cbd334a4c90365015b7836", "https://bcr.bazel.build/modules/aspect_rules_lint/0.12.0/MODULE.bazel": "e767c5dbfeb254ec03275a7701b5cfde2c4d2873676804bc7cb27ddff3728fed", "https://bcr.bazel.build/modules/aspect_rules_lint/1.0.3/MODULE.bazel": "ed0fe929647ba21d2041e14ea3d757133ca306b72d4998e8a3d0d2f515196765", + "https://bcr.bazel.build/modules/aspect_rules_lint/1.3.1/MODULE.bazel": "06ce330900a7d6403bc8d88e5dfad6aeeb8ae40179f66bb89e69c8bf6f6b1a0b", "https://bcr.bazel.build/modules/aspect_rules_lint/1.4.2/MODULE.bazel": "78d025facf6fa675fd6f0b62fd6a9a2bec7ef5ae1e288e5b53f4383b98017105", "https://bcr.bazel.build/modules/aspect_rules_lint/1.5.3/MODULE.bazel": "7fee71b11be63f1cf0458cd8c731712a0e672d0bb6df8879ed70249bf8dfdfdc", "https://bcr.bazel.build/modules/aspect_rules_lint/2.0.0/MODULE.bazel": "1f4c81edd9af0c54e65dedbe36653fc63dc9a91605313d54d5ab371f853d693c", @@ -623,6 +624,7 @@ "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/aspect_rules_js/2.3.8/MODULE.bazel": "not found", "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/aspect_rules_lint/0.12.0/MODULE.bazel": "not found", "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/aspect_rules_lint/1.0.3/MODULE.bazel": "not found", + "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/aspect_rules_lint/1.3.1/MODULE.bazel": "not found", "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/aspect_rules_lint/1.4.2/MODULE.bazel": "not found", "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/aspect_rules_lint/1.5.3/MODULE.bazel": "not found", "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/aspect_rules_lint/2.0.0/MODULE.bazel": "not found", @@ -1000,6 +1002,8 @@ "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_bazel_cpp_toolchains/1.0.3/source.json": "47eab63b3a98244787a9ab611f825d9c62d48bfdb5000173144d2f9e24b521b8", "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_devcontainer/1.8.0/MODULE.bazel": "89f855b94d041d2e61ff9667562fb4539c146249f6fb4c5dddf3d13bb9064aa7", "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_devcontainer/1.8.0/source.json": "ef316fad71fdbd53daf43fc0a82fbc7c293908a2712214ff79134c177d028024", + "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_format_checker/0.1.1/MODULE.bazel": "1acc254faa90e9f97b79ac69af25b6c21c561f8d6079914f6352b9b20d26bd37", + "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_format_checker/0.1.1/source.json": "e3d10be878d1a007967b75a5c6d9c3ec3d47c320685904b7f31c689b3cbcdb3a", "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_python_basics/0.3.4/MODULE.bazel": "53bd16dfbb1fb8ecf6822fb26f9f4e8333bac7b14d12bb02bf84078063820a31", "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_python_basics/0.3.4/source.json": "28ed0207a16f8498a84fae4983fa73060805003a4fbd68c6d749e2f1cc14601f", "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_qnx_unit_tests/0.2.0/MODULE.bazel": "aaffff67916dd058737aac8e04368f12b214e7646ff58adbab48e6429d1a5410", diff --git a/bazel_common/score_images.MODULE.bazel b/bazel_common/score_images.MODULE.bazel index 6b79fc38b71..a9b9b27923f 100644 --- a/bazel_common/score_images.MODULE.bazel +++ b/bazel_common/score_images.MODULE.bazel @@ -42,12 +42,11 @@ use_repo( "ubuntu_22_04_linux_amd64", ) -http_file = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") - -http_file( - name = "eb_corbos_toolkit_fastdev_archive", - sha256 = "e5eb75be5a9f4bbe219b06dc9d010012796495ba3cf31b4f21adc7dd14888409", - url = "https://github.com/Elektrobit/eb_corbos_toolkit/releases/download/v2.0.0-beta2/fastdev-trixie-ebclfsa-ebcl-qemuarm64.tar.gz", +bazel_dep(name = "os_images", version = "0.0.0") +git_override( + module_name = "os_images", + commit = "c708e4a47a552ca4b15ab40cd9f8e0ae909706f2", + remote = "https://github.com/eclipse-score/os_images.git", ) bazel_dep(name = "score_rules_imagefs", version = "0.0.1") diff --git a/images/ebclfsa_aarch64/build/BUILD b/images/ebclfsa_aarch64/build/BUILD index b5d66fbafe6..ea01b2f08bd 100644 --- a/images/ebclfsa_aarch64/build/BUILD +++ b/images/ebclfsa_aarch64/build/BUILD @@ -12,19 +12,6 @@ # ******************************************************************************* load("@rules_pkg//pkg:tar.bzl", "pkg_tar") -genrule( - name = "extract-fastdev-image", - srcs = ["@eb_corbos_toolkit_fastdev_archive//file"], - outs = [ - "ebcl-qemuarm64/fastdev-trixie-ebclfsa-ebcl-qemuarm64.wic", - "ebcl-qemuarm64/fastdev-trixie-ebclfsa-ebcl-qemuarm64-vmlinux", - ], - cmd = "tar xzf $(location @eb_corbos_toolkit_fastdev_archive//file) -C $(RULEDIR)/ebcl-qemuarm64 && chmod +w $(RULEDIR)/ebcl-qemuarm64/fastdev-trixie-ebclfsa-ebcl-qemuarm64.wic && ls -lah $(RULEDIR)/ebcl-qemuarm64/fastdev-trixie-ebclfsa-ebcl-qemuarm64.wic > /tmp/foo", - visibility = [ - "//visibility:public", - ], -) - pkg_tar( name = "crinit_config_tar", srcs = [ @@ -48,19 +35,20 @@ genrule( srcs = [ "//showcases:showcases_pkg_tar", "//feature_integration_tests/configs:etc_configs", - ":extract-fastdev-image", + "@os_images//ebclfsa_aarch64:vanilla-image", + "@os_images//ebclfsa_aarch64:kernel", ":crinit_config_tar", ":scripts_tar", - "build_image.sh", + "@os_images//scripts:build_ebclfsa_aarch64_image.sh", ], outs = [ "ebcl-qemuarm64-deployed/fastdev-trixie-ebclfsa-ebcl-qemuarm64.wic", "ebcl-qemuarm64-deployed/fastdev-trixie-ebclfsa-ebcl-qemuarm64-vmlinux", ], cmd = " \ - $(location build_image.sh) \ + $(location @os_images//scripts:build_ebclfsa_aarch64_image.sh) \ $(RULEDIR) \ - $(RULEDIR)/ebcl-qemuarm64 \ + $$(dirname $(location @os_images//ebclfsa_aarch64:vanilla-image)) \ $(RULEDIR)/ebcl-qemuarm64-deployed \ $(location //showcases:showcases_pkg_tar) \ $(location :crinit_config_tar) \ diff --git a/images/ebclfsa_aarch64/build/build_image.sh b/images/ebclfsa_aarch64/build/build_image.sh deleted file mode 100755 index 04712c3d095..00000000000 --- a/images/ebclfsa_aarch64/build/build_image.sh +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/bash -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* - -set -uoex pipefail - -if [[ $# -lt 4 ]]; then - echo "Error: Expected at least 4 arguments (working directoy, image source location, image target location, and one or more tar files to deploy relative to the root of the image)" >&2 - exit 1 -fi - -# Check if sshpass is installed -if ! command -v sshpass &> /dev/null; then - echo "Error: sshpass is not installed. Please install it to proceed." >&2 - exit 1 -fi - -WORKING_DIR="$1" -IMAGE_SOURCE="$2" -IMAGE_TARGET="$3" -shift 3 -DEPLOY_SRCS=("$@") - -# Validate that the source directory exists -if [[ ! -d "$IMAGE_SOURCE" ]]; then - echo "Error: Image source location is not a directory: $IMAGE_SOURCE" >&2 - exit 1 -fi - -# Check for .wic file -if ! find "$IMAGE_SOURCE" -maxdepth 1 \( -name "*.wic" -type f -o -name "*.wic" -type l \) | grep -q .; then - echo "Error: No .wic file found in $IMAGE_SOURCE" >&2 - exit 1 -fi - -# Check for vmlinux file -if ! find "$IMAGE_SOURCE" -maxdepth 1 \( -name "*vmlinux" -type f -o -name "*vmlinux" -type l \) | grep -q .; then - echo "Error: No vmlinux file found in $IMAGE_SOURCE" >&2 - exit 1 -fi - -# Validate that the target directory exists -if [[ ! -d "$IMAGE_TARGET" ]]; then - echo "Error: Image target location is not a directory: $IMAGE_TARGET" >&2 - exit 1 -fi - -# Validate that each deploy source exists -for src in "${DEPLOY_SRCS[@]}"; do - if [[ ! -f "$src" ]]; then - echo "Error: Deploy source file does not exist: $src" >&2 - exit 1 - fi - # Check if the file is a tar file - if [[ ! "$src" =~ \.tar(\.(gz|bz2|xz))?$ ]]; then - echo "Error: Deploy source is not a tar file: $src" >&2 - exit 1 - fi -done - -# Clear target directory and copy source directory content to target directory -mkdir -p "$IMAGE_TARGET" -rm -f "${IMAGE_TARGET:?}/"* -cp -L "$IMAGE_SOURCE"/* "$IMAGE_TARGET"/ - -IMAGE=$(find "$IMAGE_TARGET" -maxdepth 1 \( -name "*.wic" -type f -o -name "*.wic" -type l \) -print -quit) -KERNEL=$(find "$IMAGE_TARGET" -maxdepth 1 \( -name "*vmlinux" -type f -o -name "*vmlinux" -type l \) -print -quit) - -# the image file needs to be writable for qemu to run, so we change the permissions here -chmod +w "$IMAGE" - -qemu-system-aarch64 -m 2048 -cpu cortex-a53 -machine virt \ - -kernel "$KERNEL" \ - -machine "virt,virtualization=true,gic-version=3" \ - -smp 8 \ - -device virtio-blk-device,drive=vd0 -drive if=none,format=raw,file="${IMAGE}",id=vd0 \ - -append "root=/dev/vda1 sdk_enable lisa_syscall_whitelist=2026 rw sharedmem.enable_sharedmem=0 init=/usr/bin/ebclfsa-cflinit" \ - -netdev user,id=net0,net=192.168.7.0/24,dhcpstart=192.168.7.2,dns=192.168.7.3,host=192.168.7.5,hostfwd=tcp::2222-:22,hostfwd=tcp::3333-:3333 -device virtio-net-device,netdev=net0 \ - -pidfile "$WORKING_DIR/qemu.pid" \ - -nographic \ - > "$WORKING_DIR/qemu_deployment.log" \ - & - -# Wait for QEMU to be accessible via SSH -for i in {1..60}; do - if sshpass -p linux ssh -o StrictHostKeyChecking=no -o ConnectTimeout=1 -p 2222 root@localhost true 2>/dev/null; then - echo "QEMU is accessible" - break - fi - echo "Waiting for QEMU to be ready... ($i/60)" - sleep 1 -done - -# deploy files to QEMU via scp -for src in "${DEPLOY_SRCS[@]}"; do - sshpass -p linux scp -rp -o StrictHostKeyChecking=no -P 2222 "$src" root@localhost:/ - sshpass -p linux ssh -o StrictHostKeyChecking=no -p 2222 root@localhost "tar -xf /$(basename "$src") -C /" - sshpass -p linux ssh -o StrictHostKeyChecking=no -p 2222 root@localhost "rm -f /$(basename "$src")" -done - -# Shutdown QEMU via SSH -sshpass -p linux ssh -o StrictHostKeyChecking=no -p 2222 root@localhost sync -sshpass -p linux ssh -o StrictHostKeyChecking=no -p 2222 root@localhost crinit-ctl poweroff || true - -# Wait for QEMU process to finish -if [[ -f "$WORKING_DIR/qemu.pid" ]]; then - wait "$(cat "$WORKING_DIR/qemu.pid")" 2>/dev/null || true - rm -f "$WORKING_DIR/qemu.pid" -fi