From 92256b5f480589bffa2065b2ef9d89c10d9ce266 Mon Sep 17 00:00:00 2001 From: Ivan Efimov Date: Sun, 26 Jul 2020 19:46:54 +0500 Subject: [PATCH 1/3] README.md: add howto build RDKB (OE 3.1) with prplMesh for TurrisOmnia Add sections howto: * build RDKB (OE 2.2) for RPi 3B+ * run prplMesh on RPi 3B+ * build RDKB (OE 3.1) for TurrisOmnia Signed-off-by: Ivan Efimov --- README.md | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 106 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0e78594..f47f582 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,92 @@ This code is subject to the terms of the BSD+Patent license. See LICENSE file for more details. --> -## HOWTO build Yocto Poky 2.2 +# RDKB (OE 2.2) + +## Raspberry Pi 3 B+ + +### HOWTO build + +> Based on [official RDK build manual](https://wiki.rdkcentral.com/pages/viewpage.action?pageId=71011616#RDK-B(RaspberryPi3B+)BuildandSetupManual-RouterProfile-BuildInstructions) + +* Fetch sources +``` +repo init -u https://code.rdkcentral.com/r/manifests -b rdk-next -m rdkb-extsrc.xml +repo sync -j4 --no-clone-bundle +``` + +* Fetch meta-prplmesh +``` +git clone -b rdk-next https://github.com/prplfoundation/meta-prplmesh +``` + +* Source build env +``` +MACHINE=raspberrypi-rdk-broadband source meta-cmf-raspberrypi/setup-environment +``` + +* Append to file `conf/bblayers.conf` +``` +BBLAYERS =+ "${RDKROOT}/meta-prplmesh" +``` + +* Run image build +``` +bitbake rdk-generic-broadband-image +``` + +### HOWTO run + +* Run on board after boot +``` +hostapd -B /usr/ccsp/wifi/hostapd0.conf +/opt/prplmesh/scripts/prplmesh_utils.sh start +``` +* Check status +``` +/opt/prplmesh/scripts/prplmesh_utils.sh status +``` + +# RDKB (OE 3.1) + +## Turris Omnia + +Based on [RDK Central Wiki](https://wiki.rdkcentral.com/display/RDK/Yocto-3.1+rdk-generic-broadband-image+Turris+Omnia) + +## HOWTO build + +* Fetch sources +``` +repo init -u https://code.rdkcentral.com/r/manifests -m rdkb-turris-extsrc.xml -b yocto-dunfell-upgrade +repo sync -j4 --no-clone-bundle +``` + +* Fetch meta-prplmesh +``` +git clone -b master https://github.com/prplfoundation/meta-prplmesh +``` + +* Source build env +``` +MACHINE=turris source meta-turris/setup-environment +``` + +* Append to file `conf/bblayers.conf` +``` +BBLAYERS =+ "${RDKROOT}/meta-prplmesh" +``` + +* Run image build +``` +bitbake core-image-minimal +bitbake rdk-generic-broadband-image +``` + +# Yocto Poky 2.2 (Morty) + +## QEMU + +### HOWTO build * fetch sources ``` @@ -24,7 +109,25 @@ TEMPLATECONF=../meta-prplmesh/conf/poky source oe-init-build-env bitbake core-image-minimal ``` -## HOWTO build Yocto Poky 3.1 +### HOWTO run + +* Run QEMU by command +``` +runqemu tmp/deploy/images/qemux86-64 nographic +``` +* Login as "root" (no password) +* Run prplmesh inside +``` +/opt/prplmesh/scripts/prplmesh_utils.sh -p -v -D eth0 -C eth0 start +``` +* Check status +``` +/opt/prplmesh/scripts/prplmesh_utils.sh status +``` + +# Yocto Poky 3.1 Dunfell + +## HOWTO build * fetch sources ``` @@ -59,3 +162,4 @@ runqemu tmp/deploy/images/qemux86-64 nographic ``` /opt/prplmesh/scripts/prplmesh_utils.sh status ``` + From 1e22eca77e985659fa9be519630df0b9a0a2df35 Mon Sep 17 00:00:00 2001 From: Ivan Efimov Date: Mon, 27 Jul 2020 00:45:04 +0500 Subject: [PATCH 2/3] prplmesh.bb: define prplMesh wlan ifaces for Turris Omnia board prplMesh wlan ifaces names are: * wifi0 * wifi1 * wifi2 BEEROCKS_BH_WIRE_IFACE became "erouter0" for any RDK images Signed-off-by: Ivan Efimov --- recipes-connectivity/prplmesh/prplmesh.bb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/recipes-connectivity/prplmesh/prplmesh.bb b/recipes-connectivity/prplmesh/prplmesh.bb index 4251098..88dc794 100644 --- a/recipes-connectivity/prplmesh/prplmesh.bb +++ b/recipes-connectivity/prplmesh/prplmesh.bb @@ -45,12 +45,22 @@ BEEROCKS_WLAN1_IFACE_raspberrypi-rdk-broadband = "wlan0" BEEROCKS_WLAN2_IFACE_raspberrypi-rdk-broadband = "wlan1" BEEROCKS_HOSTAP_WLAN1_CTRL_IFACE_raspberrypi-rdk-broadband="/var/run/hostapd0/wlan0" BEEROCKS_HOSTAP_WLAN2_CTRL_IFACE_raspberrypi-rdk-broadband="/var/run/hostapd4/wlan1" -BEEROCKS_BH_WIRE_IFACE_raspberrypi-rdk-broadband = "erouter0" +# +# Turris Omnia machine specific +# +BEEROCKS_WLAN1_IFACE_turris = "wifi0" +BEEROCKS_WLAN2_IFACE_turris = "wifi1" +BEEROCKS_WLAN3_IFACE_turris = "wifi2" + +BEEROCKS_HOSTAP_WLAN1_CTRL_IFACE="/var/run/hostapd/wifi0" +BEEROCKS_HOSTAP_WLAN2_CTRL_IFACE="/var/run/hostapd/wifi1" +BEEROCKS_HOSTAP_WLAN3_CTRL_IFACE="/var/run/hostapd/wifi2" # # RDKB specific # "ZeroMG" has incompatible license for RDKB so use NNG MSGLIB_rdk ?= "mq-nng" +BEEROCKS_BH_WIRE_IFACE_rdk = "erouter0" BEEROCKS_BRIDGE_IFACE_rdk ?= "brlan0" # # FIXME: There is a bug in script printing status From 76570b1489aed3669109f1a9cb74785227ab32d5 Mon Sep 17 00:00:00 2001 From: Ivan Efimov Date: Wed, 29 Jul 2020 00:57:02 +0500 Subject: [PATCH 3/3] prplmesh.bb: bpl: add patch to able use "wifiX" instead of "wlanX" iface names Wi-Fi ifaces on Turris Omnia with RDKB (OE 3.1) image has names "wifiX", where X is 0, 1 or 2 But bpl library logic works with "wlanX" names, where X is 0, 1 or 2 As a result the agents cannot find the ifaces and start. Add a patch to make "bpl_cfg.cpp" a template file "bpl_cfg.cpp.in" and change function "cfg_get_hostap_iface" inside to use CMake variables BEEROCKS_WLAN1_IFACE, etc. Signed-off-by: Ivan Efimov --- recipes-connectivity/prplmesh/prplmesh.bb | 1 + ...01-bpl-cfg-explicit-wlan-iface-names.patch | 45 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 recipes-connectivity/prplmesh/prplmesh/001-bpl-cfg-explicit-wlan-iface-names.patch diff --git a/recipes-connectivity/prplmesh/prplmesh.bb b/recipes-connectivity/prplmesh/prplmesh.bb index 88dc794..9bb231c 100644 --- a/recipes-connectivity/prplmesh/prplmesh.bb +++ b/recipes-connectivity/prplmesh/prplmesh.bb @@ -18,6 +18,7 @@ RDEPENDS_${PN} = "iproute2 busybox" SRCREV = "d55b727b52158d46b3a0263734445ac29116220f" SRC_URI = "git://github.com/prplfoundation/prplMesh.git;protocol=http;branch=master \ + file://001-bpl-cfg-explicit-wlan-iface-names.patch \ " PACKAGECONFIG ??= "${BWL_TYPE} ${MSGLIB}" diff --git a/recipes-connectivity/prplmesh/prplmesh/001-bpl-cfg-explicit-wlan-iface-names.patch b/recipes-connectivity/prplmesh/prplmesh/001-bpl-cfg-explicit-wlan-iface-names.patch new file mode 100644 index 0000000..4b79545 --- /dev/null +++ b/recipes-connectivity/prplmesh/prplmesh/001-bpl-cfg-explicit-wlan-iface-names.patch @@ -0,0 +1,45 @@ +diff --git a/framework/platform/bpl/CMakeLists.txt b/framework/platform/bpl/CMakeLists.txt +index 3fe9d810..9b34a584 100644 +--- a/framework/platform/bpl/CMakeLists.txt ++++ b/framework/platform/bpl/CMakeLists.txt +@@ -25,6 +25,12 @@ set(BEEROCKS_WPA_SUPPLICANT_WLAN3_CTRL_IFACE "/var/run/wpa_supplicant/${BEEROCKS + # Add prplmesh_platform_db config generation + add_subdirectory(platform_db) + ++configure_file( ++ "${CMAKE_CURRENT_SOURCE_DIR}/linux/bpl_cfg.cpp.in" ++ "${CMAKE_CURRENT_SOURCE_DIR}/linux/bpl_cfg.cpp" ++ ) ++ ++ + # OpenWRT + if (TARGET_PLATFORM STREQUAL "openwrt") + +diff --git a/framework/platform/bpl/linux/bpl_cfg.cpp b/framework/platform/bpl/linux/bpl_cfg.cpp.in +similarity index 97% +rename from framework/platform/bpl/linux/bpl_cfg.cpp +rename to framework/platform/bpl/linux/bpl_cfg.cpp.in +index 93975c38..9d4711d4 100644 +--- a/framework/platform/bpl/linux/bpl_cfg.cpp ++++ b/framework/platform/bpl/linux/bpl_cfg.cpp.in +@@ -296,11 +296,15 @@ int cfg_get_hostap_iface(int32_t radio_num, char hostap_iface[BPL_IFNAME_LEN]) + return RETURN_ERR; + } + +- // the linux implementation expects to receive "wlanX" for interface names where the X is: +- // 0,2 for Linux-PC +- // 0,1 for Turris-Omnia and GLInet +- // we return 0,1,2 and the upper layer filters the non-supported interface +- std::string iface_str("wlan" + std::to_string(radio_num)); ++ std::string iface_str; ++ switch (radio_num) { ++ case 0: iface_str = "@BEEROCKS_WLAN1_IFACE@"; break; ++ case 1: iface_str = "@BEEROCKS_WLAN2_IFACE@"; break; ++ case 2: iface_str = "@BEEROCKS_WLAN3_IFACE@"; break; ++ default: ++ MAPF_ERR("cfg_get_hostap_iface: unknown iface index: " + std::to_string(radio_num)); ++ return RETURN_ERR; ++ } + mapf::utils::copy_string(hostap_iface, iface_str.c_str(), BPL_IFNAME_LEN); + return RETURN_OK; + }