Add network support to Pi2/3

Also include changes needed for Qemu 5.1 from #20 as needed for
USB support.

Device comes up as usb0 but close enough to get started
This commit is contained in:
Ben Hardill 2020-11-28 20:07:18 +00:00
parent 35b55bcd34
commit ddb079efda
No known key found for this signature in database
GPG key ID: 74DD076979ABB1E7
2 changed files with 10 additions and 4 deletions

View file

@ -1,6 +1,6 @@
# Build stage for qemu-system-arm
FROM debian:stable-slim AS qemu-builder
ARG QEMU_VERSION=4.2.0
ARG QEMU_VERSION=5.1.0
ENV QEMU_TARBALL="qemu-${QEMU_VERSION}.tar.xz"
WORKDIR /qemu
@ -67,6 +67,7 @@ ARG RPI_KERNEL_CHECKSUM="295a22f1cd49ab51b9e7192103ee7c917624b063cc5ca2e11434164
COPY --from=qemu-builder /qemu/arm-softmmu/qemu-system-arm /usr/local/bin/qemu-system-arm
COPY --from=qemu-builder /qemu/aarch64-softmmu/qemu-system-aarch64 /usr/local/bin/qemu-system-aarch64
COPY --from=qemu-builder /qemu/qemu-img /usr/local/bin/qemu-img
COPY --from=fatcat-builder /fatcat/fatcat /usr/local/bin/fatcat
ADD $RPI_KERNEL_URL /tmp/qemu-rpi-kernel.zip

View file

@ -15,6 +15,8 @@ if [ ! -e $image_path ]; then
fi
fi
qemu-img resize 4G
if [ "${target}" = "pi1" ]; then
emulator=qemu-system-arm
kernel="/root/qemu-rpi-kernel/kernel-qemu-4.19.50-buster"
@ -22,6 +24,7 @@ if [ "${target}" = "pi1" ]; then
machine=versatilepb
memory=256m
root=/dev/sda2
extra=''
nic='--net nic --net user,hostfwd=tcp::5022-:22'
elif [ "${target}" = "pi2" ]; then
emulator=qemu-system-arm
@ -29,14 +32,16 @@ elif [ "${target}" = "pi2" ]; then
memory=1024m
kernel_pattern=kernel7.img
dtb_pattern=bcm2709-rpi-2-b.dtb
nic=''
extra='dwc_otg.fiq_fsm_enable=0'
nic='-netdev user,id=net0 -device usb-net,netdev=net0'
elif [ "${target}" = "pi3" ]; then
emulator=qemu-system-aarch64
machine=raspi3
memory=1024m
kernel_pattern=kernel8.img
dtb_pattern=bcm2710-rpi-3-b-plus.dtb
nic=''
extra='dwc_otg.fiq_fsm_enable=0'
nic='-netdev user,id=net0 -device usb-net,netdev=net0'
else
echo "Target ${target} not supported"
echo "Supported targets: pi1 pi2 pi3"
@ -78,7 +83,7 @@ exec ${emulator} \
${nic} \
--dtb "${dtb}" \
--kernel "${kernel}" \
--append "rw earlyprintk loglevel=8 console=ttyAMA0,115200 dwc_otg.lpm_enable=0 root=${root} rootwait panic=1" \
--append "rw earlyprintk loglevel=8 console=ttyAMA0,115200 dwc_otg.lpm_enable=0 root=${root} rootwait panic=1 ${extra}" \
--no-reboot \
--display none \
--serial mon:stdio