RDK Resources
[*RDK Preferred*]
Code Management Facility
RDK Forums
[RDK Conferences]
RDK Support
Archives
Papers & Presentations Archive
Below you can find how to setup and run emulated RDK-B from image build for Raspberry Pi 4. It can be useful for CICD systems, for the first run after the new image build or some new features tests. Currently ETH interface is functional.
Ubuntu 22.04 64-bit
At least 8GB of RAM
256GB hard drive
Please follow the guide: Ubuntu | Docker Docs
Use docker without sudo: Post-installation steps | Docker Docs
Build your RDK-B Raspberry Pi 4 64-bit image, example: https://wiki.rdkcentral.com/pages/viewpage.action?pageId=292335921
Follow below steps:
mkdir ~/vRDK-B cd ~/vRDK-B mkdir qemu_files
Copy RPI 4 image to ~/vRDK-B/qemu_files:
Image-raspberrypi4-64-rdk-broadband.bin
rdk-generic-broadband-tdk-image-raspberrypi4-64-rdk-broadband.wic.bz2
Create Dockerfile and paste:
FROM ubuntu:22.04 ARG QEMU_USER=dev QEMU_UID=1001 ENV TZ=US RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update -y && \ apt-get install -y \ bzip2 \ fdisk \ locales \ mtools \ net-tools \ openssh-client \ slirp \ sudo \ wget \ xz-utils \ build-essential \ python3 \ python3-pip \ ninja-build \ libglib2.0-dev \ git \ flex \ bison \ libslirp-dev \ && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* RUN python3 -m pip install \ pyvenv \ tomli \ sphinx \ sphinx_rtd_theme \ termcolor ARG QEMU_VERSION=9.2.0 RUN wget https://download.qemu.org/qemu-${QEMU_VERSION}.tar.xz && \ tar xvJf qemu-${QEMU_VERSION}.tar.xz && \ cd qemu-${QEMU_VERSION} && \ ./configure \ --enable-slirp \ --target-list=aarch64-softmmu RUN cd qemu-${QEMU_VERSION} && \ make install && \ cd .. && \ sudo rm -rf qemu-${QEMU_VERSION}* RUN locale-gen "en_US.UTF-8" && dpkg-reconfigure locales
Create run-vrdk-b.sh and paste:
#!/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 >>>"
chmod +x run-vrdk-b.sh
Build docker image:
cd ~/vRDK-B docker build -t vrdk-b \ --build-arg QEMU_VERSION=9.2.0 \ --build-arg QEMU_USER=dev \ --build-arg QEMU_UID=${USER_ID} \ -f Dockerfile .
Run container:
docker run -d \ --name vrdk-b \ --privileged \ -e KERNEL_FILE=Image-raspberrypi4-64-rdk-broadband.bin \ -e IMAGE_FILE=rdk-generic-broadband-tdk-image-raspberrypi4-64-rdk-broadband.wic.bz2 \ -e HOST_FWD=hostfwd=tcp::2223-:22,hostfwd=tcp::8081-:80 \ -p 2223:2223 \ -p 8081:8081 \ -v /dev:/dev \ -v ${PWD}/qemu_files:/qemu \ --mount type=bind,source=$(pwd)/run-vrdk-b.sh,target=/run-vrdk-b.sh \ -it vrdk-b
Run qemu:
docker exec -it vrdk-b /run-vrdk-b.sh
Wait until vRDK-B boot.
In a web browser on your host paste:
localhost:8081
Example:
Connect via SSH from host to vRDK-B:
ssh -p 2223 root@localhost
Example: