RDK Resources
[*RDK Preferred*]
Code Management Facility
RDK Forums
[RDK Conferences]
RDK Support
Archives
Papers & Presentations Archive
...
Code Block | ||
---|---|---|
| ||
#!/usr/bin/env bash
set -eu
echo "$(id)"
mkdir ${HOME}/qemu || ls -la ${HOME}/qemu/
cd ${HOME}/qemu
IMAGE_WIC="${IMAGE_FILE%.*}"
if [ ! -f "${IMAGE_WIC}" ]; then
cp -v /qemu/* .
fi
wait_for_sshd () {
while true;
do
(ssh -o ConnectTimeout=5 \
-o HostKeyAlgorithms=+ssh-rsa \
-o StrictHostKeyChecking=no \
-p 2223 root@localhost /bin/true) && break || \
echo "<<< Please wait ... >>>"
sleep 5
done
}
run_qemu () {
set +e
QEMU_LOG="${HOME}/qemu-$(date +%Y%m%d.%H%M.%s).log"
echo "<<< Run RDK-B with QEMU >>>"
timeout -v 900 bash <<-EOF
set -x
qemu-system-aarch64 \
-machine virt \
-cpu cortex-a72 \
-m 2G \
-smp 4 \
-nographic \
-kernel "${KERNEL_FILE}" \
-drive file="${IMAGE_WIC},if=none,id=hd0,cache=writeback,format=raw" \
-device virtio-blk-device,drive=hd0 \
-append "rw earlyprintk loglevel=8 console=ttyAMA0,115200 root=/dev/vda2 rootdelay=1" \
-device "virtio-net-device,netdev=eth0" \
-netdev "user,id=eth0,${HOST_FWD}" \
>> "${QEMU_LOG}" 2>&1 &
set +x
echo "<<< Waiting for RDK-B to fully initialise >>>"
sleep 5
( tail -f -n0 "${QEMU_LOG}" & ) | while IFS= read -r line; do
echo "\${line}"
if \$(echo "\${line}" | grep -q "Apache License") ; then
echo "Apache service has been started!"
break
fi
done
EOF
}
echo "Starting QEMU ..."
set -e
run_qemu
wait_for_sshd
ssh -p 2223 -o StrictHostKeyChecking=no root@localhost /sbin/reboot
sleep 10
wait_for_sshd
echo "<<< RDK-B fully initialised >>>"
|
...