qemu
This commit is contained in:
parent
f30d31a24f
commit
515f8ed36c
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -20,3 +20,29 @@ services:
|
||||
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'
|
||||
"
|
||||
@ -0,0 +1 @@
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINue5q76BNrHp4aFL4SHKxwK0QojS4J4z65kH7HF7iWQ fcb-looper-key
|
||||
@ -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"
|
||||
Loading…
x
Reference in New Issue
Block a user