# RDKB on RPI4 # REF https://wiki.rdkcentral.com/display/CMF/RDKB_2023q2_dunfell https://wiki.rdkcentral.com/display/RDK/RDK-B+%28Raspberry+Pi%29+Build+and+Setup+Manual+-+Router+Profile https://wiki.rdkcentral.com/display/ASP/Cellular+Manager+-+Reference+set+up # SDK Source Code Download with an authenticated user of RDK Central ``` repo init -u https://code.rdkcentral.com/r/manifests -m rdkb-extsrc.xml -b rdkb-2023q2-dunfell repo sync -j `nproc` --no-clone-bundle --no-tags ``` Or download the packaged SDK, which is temporarily placed in `/opt/build_data/rdkb_rpi.tar.bz2` on the AMAROK server. # Start to build image ## Build commands for raspberry 4B 64bit ``` MACHINE=raspberrypi4-64-rdk-broadband source meta-cmf-raspberrypi/setup-environment bitbake rdk-generic-broadband-image ``` # Fix compiling errors If you encounter a building error about the `/tmp/dhcp_relay.conf`, you could comment out the following line and rebuild it again. ``` ~/rdkb_rpi/build-raspberrypi4-64-rdk-broadband/tmp/work/aarch64-rdk-linux/opensync/git-r0/git/core//./src/lib/dhcp_relay/ut/unit.mk ... #${Q} cp $< $@ ... ``` If the `JAVA_HOME` can not be detected, disable the package `zilker` that requires it. The `zilker` is included in the image by the the following `bbappend` file, we could disable it by removing it from the `RDEPENDS_packagegroup-rdk-oss-broadband_append` variable. ``` ~/rdkb_rpi/meta-cmf-raspberrypi/recipes-core/packagegroups/packagegroup-rdk-oss-broadband.bbappend RDEPENDS_packagegroup-rdk-oss-broadband_append = " \ ... - zilker-sdk \ ... " ``` # Flash Image into SD card The final image is located in the `DEPLOY_DIR`, and the image file name is `rdk-generic-broadband-image-raspberrypi4-rdk-broadband.wic.bz2` which is a symbolic link to `rdkb-generic-broadband-image_rdk-next_2023xxxxxxxxxx.rootfs.wic.bz2`. ```shell ~/rdkb_rpi/build-raspberrypi4-rdk-broadband/tmp/deploy/images/raspberrypi4-rdk-broadband$ ls | grep wic rdkb-generic-broadband-image_rdk-next_20231003101038.rootfs.wic.bmap rdkb-generic-broadband-image_rdk-next_20231003101038.rootfs.wic.bz2 rdk-generic-broadband-image-raspberrypi4-rdk-broadband.wic.bmap rdk-generic-broadband-image-raspberrypi4-rdk-broadband.wic.bz2 ~/rdkb_rpi/build-raspberrypi4-rdk-broadband/tmp/deploy/images/raspberrypi4-rdk-broadband$ ls -al rdk-generic-broadband-image-raspberrypi4-64-rdk-broadband.wic.bz2 lrwxrwxrwx 2 jeff_shiu jeff_shiu 78 Oct 26 20:43 rdk-generic-broadband-image-raspberrypi4-64-rdk-broadband.wic.bz2 -> rdkb-generic-broadband-image_rdkb-2023q2-dunfell_20231026123545.rootfs.wic.bz2 ``` Before flashing it into the SD card, we have to decompress it to get the raw image, then we could use `Raspberry Pi Imager` to flash the image. ```shell ~/rdkb_rpi/build-raspberrypi4-rdk-broadband/tmp/deploy/images/raspberrypi4-rdk-broadband$ bunzip2 -dkf rdk-generic-broadband-image-raspberrypi4-64-rdk-broadband.wic.bz2 ``` The `Raspberry Pi Imager` can be downloaded from the link `https://downloads.raspberrypi.org/imager/imager_latest.exe`. This tool can help us flash any image to SD card by selecting "Use the custom image", so we use it to flash the RDKB image. ![image.png](https://mail.google.com/mail/u/0?ui=2&ik=df284cb85c&attid=0.1&permmsgid=msg-a:r8618806172377129102&th=18b6f43353b7a362&view=fimg&fur=ip&sz=s0-l75-ft&attbid=ANGjdJ9p9lJyyp7PQUrflefLd6xNnoVXTMzowwerPt8mbrz44Ism8XhxalbEbEoejQh-5-k4wiD1v18JhOWq7Oq_YfdVQi1nEnq8QPjZp9HW-WE4-kTksBVwAlj_yc8&disp=emb&realattid=ii_lo824g570) # Serial Console (UART) on RPI4 The following figure is the GPIO pin map of RPI4. We could know that `GPIO 14` is for `TX` and `GPIO 15` is for `RX`. Typically, the color of the RX wire is white and the TX is green, so we need to plug the white wire into `GPIO 14` and the green wire into `GPIO 15`. ![GPIO pins](https://www.raspberrypi.com/documentation/computers/images/GPIO-Pinout-Diagram-2.png)