diff --git a/image/Dockerfile b/image/Dockerfile index 117f10b..8a6408c 100644 --- a/image/Dockerfile +++ b/image/Dockerfile @@ -3,7 +3,7 @@ FROM ubuntu:22.04 # Prevent interactive prompts during package installation ENV DEBIAN_FRONTEND=noninteractive -# Install Yocto build dependencies +# Install dependencies RUN apt-get update && apt-get install -y \ gawk \ wget \ @@ -34,6 +34,9 @@ RUN apt-get update && apt-get install -y \ vim \ less \ tree \ + qemu-system-data \ + qemu-system-x86 \ + qemu-utils \ && rm -rf /var/lib/apt/lists/* # Set up locale @@ -56,7 +59,7 @@ ENV CCACHE_DIR=/workspace/.ccache WORKDIR /workspace # Change ownership of workspace to yocto user -RUN chown -R yocto:yocto /workspace +RUN chown -R builder:builder /workspace # Switch to yocto user USER builder diff --git a/image/conf/local.conf b/image/conf/local.conf index ccc7e85..a1b0d93 100644 --- a/image/conf/local.conf +++ b/image/conf/local.conf @@ -1,7 +1,17 @@ MACHINE = "genericx86-64" DISTRO = "poky" PREFERRED_PROVIDER_virtual/kernel = "linux-yocto" -IMAGE_INSTALL:append = " openssh" +IMAGE_INSTALL:append = " openssh ssh-keys" +EXTRA_IMAGE_FEATURES += "ssh-server-openssh" + +# Image formats for QEMU testing and deployment +IMAGE_FSTYPES += "ext4 tar.bz2" + +# Root access configuration +EXTRA_IMAGE_FEATURES += "empty-root-password" +EXTRA_IMAGE_FEATURES += "allow-empty-password" + +# SSH configuration EXTRA_IMAGE_FEATURES += "ssh-server-openssh" # Memory optimization settings diff --git a/image/docker-compose.yml b/image/docker-compose.yml index d45d5e1..87af2fc 100644 --- a/image/docker-compose.yml +++ b/image/docker-compose.yml @@ -19,4 +19,30 @@ services: cp /workspace/conf/* /workspace/build/conf/ && bitbake core-image-minimal && echo 'Build complete. Image files available in output directory.' + " + + qemu-server: + build: + context: . + dockerfile: Dockerfile + args: + USER_ID: ${USER_ID:-1000} + GROUP_ID: ${GROUP_ID:-1000} + container_name: qemu-server + hostname: qemu-server + working_dir: /workspace + network_mode: "host" + volumes: + - ./:/workspace + tty: true + stdin_open: true + depends_on: + - disk-image + command: > + bash -c " + echo 'Starting QEMU with host networking...' && + echo 'VNC will be available on localhost:5901' && + echo 'SSH will be available on localhost:2222' && + echo 'QEMU monitor on localhost:4444' && + qemu-system-x86_64 -cpu core2duo -m 2048 -smp 2 -kernel /workspace/build/tmp/deploy/images/genericx86-64/bzImage -drive file=/workspace/build/tmp/deploy/images/genericx86-64/core-image-minimal-genericx86-64.rootfs.ext4,if=virtio,format=raw -netdev user,id=net0,hostfwd=tcp:127.0.0.1:2222-:22,hostfwd=tcp:127.0.0.1:8080-:8080 -device virtio-net-pci,netdev=net0 -vnc 127.0.0.1:1 -monitor telnet:127.0.0.1:4444,server,nowait -serial stdio -append 'root=/dev/vda rw console=ttyS0 console=tty0' " \ No newline at end of file diff --git a/image/meta-layers/meta-fcb-looper/recipes-core/ssh-keys/files/authorized_keys b/image/meta-layers/meta-fcb-looper/recipes-core/ssh-keys/files/authorized_keys new file mode 100644 index 0000000..a28155f --- /dev/null +++ b/image/meta-layers/meta-fcb-looper/recipes-core/ssh-keys/files/authorized_keys @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINue5q76BNrHp4aFL4SHKxwK0QojS4J4z65kH7HF7iWQ fcb-looper-key diff --git a/image/meta-layers/meta-fcb-looper/recipes-core/ssh-keys/ssh-keys_1.0.bb b/image/meta-layers/meta-fcb-looper/recipes-core/ssh-keys/ssh-keys_1.0.bb new file mode 100644 index 0000000..0846b79 --- /dev/null +++ b/image/meta-layers/meta-fcb-looper/recipes-core/ssh-keys/ssh-keys_1.0.bb @@ -0,0 +1,20 @@ +SUMMARY = "SSH public key installation" +DESCRIPTION = "Installs SSH public key for root user" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +inherit allarch + +SRC_URI = "file://authorized_keys" + +# Since we're not unpacking source code, just copying files +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +do_install() { + install -d ${D}${ROOT_HOME}/.ssh + install -m 0600 ${UNPACKDIR}/authorized_keys ${D}${ROOT_HOME}/.ssh/authorized_keys +} + +FILES:${PN} = "${ROOT_HOME}/.ssh/authorized_keys" +RDEPENDS:${PN} = "openssh" \ No newline at end of file