From 767ecf173159bc9821403ff2658e914b803d0319 Mon Sep 17 00:00:00 2001 From: Yang Song Date: Mon, 16 Dec 2024 01:56:07 +0000 Subject: [PATCH 1/2] Update the Rasbian image to Debian 12 Bookworm to support Raspi 5 --- script/make-commissioner.bash | 7 ++----- script/make-raspbian.bash | 5 +++-- script/otbr-setup.bash | 26 +++++++++++++++++--------- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/script/make-commissioner.bash b/script/make-commissioner.bash index d35ba609..311b0ece 100755 --- a/script/make-commissioner.bash +++ b/script/make-commissioner.bash @@ -31,16 +31,13 @@ set -euxo pipefail cd ot-commissioner -wget https://bootstrap.pypa.io/pip/2.7/get-pip.py -sudo python2 get-pip.py - -pip2 install -r tools/commissioner_thci/requirements.txt +pip3 install -r tools/commissioner_thci/requirements.txt ./script/bootstrap.sh || true mkdir -p build cd build -/usr/local/bin/cmake -GNinja -DCMAKE_INSTALL_PREFIX=/usr -DOT_COMM_REFERENCE_DEVICE=ON .. +cmake -GNinja -DCMAKE_INSTALL_PREFIX=/usr -DOT_COMM_REFERENCE_DEVICE=ON .. ninja -j10 ninja install diff --git a/script/make-raspbian.bash b/script/make-raspbian.bash index 3aa71703..2bbd8ba1 100755 --- a/script/make-raspbian.bash +++ b/script/make-raspbian.bash @@ -88,16 +88,17 @@ main() [ -d "$IMAGES_DIR" ] || mkdir -p "$IMAGES_DIR" # Download raspios image - RASPIOS_URL=https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2021-05-28/2021-05-07-raspios-buster-armhf-lite.zip + RASPIOS_URL=https://downloads.raspberrypi.com/raspios_lite_armhf/images/raspios_lite_armhf-2024-11-19/2024-11-19-raspios-bookworm-armhf-lite.img.xz IMAGE_ARCHIVE=$(basename "${RASPIOS_URL}") - IMAGE_FILE=$(basename "${IMAGE_ARCHIVE}" .zip).img wget -q -O "$IMAGES_DIR/$IMAGE_ARCHIVE" -c "$RASPIOS_URL" # Extract the downloaded archive mime_type=$(file "$IMAGES_DIR/$IMAGE_ARCHIVE" --mime-type) if [[ $mime_type == *"application/zip"* ]]; then + IMAGE_FILE=$(basename "${IMAGE_ARCHIVE}" .zip).img unzip -o "$IMAGES_DIR/$IMAGE_ARCHIVE" -d $IMAGES_DIR elif [[ $mime_type == *"application/"* ]]; then + IMAGE_FILE=$(basename "${IMAGE_ARCHIVE}" .xz) xz -f -k -d "$IMAGES_DIR/$IMAGE_ARCHIVE" else echo "ERROR: Unrecognized archive type\n${mime_type}" diff --git a/script/otbr-setup.bash b/script/otbr-setup.bash index ac98d3d8..6b41759e 100755 --- a/script/otbr-setup.bash +++ b/script/otbr-setup.bash @@ -178,9 +178,9 @@ fi configure_apt_source() { if [ "$IN_CHINA" = 1 ]; then - echo 'deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib rpi -deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib rpi' | sudo tee /etc/apt/sources.list - echo 'deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui' | sudo tee /etc/apt/sources.list.d/raspi.list + echo 'deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ bookworm main non-free contrib rpi +deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ bookworm main non-free contrib rpi' | sudo tee /etc/apt/sources.list + echo 'deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ bookworm main ui' | sudo tee /etc/apt/sources.list.d/raspi.list fi } configure_apt_source @@ -189,13 +189,16 @@ echo "127.0.0.1 $(hostname)" >>/etc/hosts chown -R pi:pi /home/pi/repo cd /home/pi/repo/ot-br-posix apt-get update -apt-get install -y --no-install-recommends git python3-pip +apt-get install -y --no-install-recommends git python3-pip python3-venv su -c "DOCKER=1 ${build_options[*]} script/bootstrap" pi rm -rf /home/pi/repo/ot-br-posix/third_party/openthread/repo cp -rp /home/pi/repo/openthread /home/pi/repo/ot-br-posix/third_party/openthread/repo apt-get purge -y cmake + +python3 -m venv /home/pi/.venv +source /home/pi/.venv/bin/activate pip3 install scikit-build pip3 install cmake==3.20.2 cmake --version @@ -214,13 +217,18 @@ fi # nRF Connect SDK related actions if [ "${REFERENCE_PLATFORM?}" = "ncs" ]; then - wget https://bootstrap.pypa.io/pip/2.7/get-pip.py - sudo python2 get-pip.py - apt-get install -y --no-install-recommends vim wiringpi - pip install wrapt==1.12.1 - pip install nrfutil + apt-get install -y --no-install-recommends vim + + wget https://project-downloads.drogon.net/wiringpi-latest.deb + sudo dpkg -i wiringpi-latest.deb + + pip3 install wrapt==1.12.1 + pip3 install nrfutil # add calling of link_dongle.py script at startup to update symlink to the dongle + sudo touch /etc/rc.local + sudo chmod +x /etc/rc.local + sed -i '/exit 0/d' /etc/rc.local grep -qxF 'sudo systemctl restart otbr-agent.service' /etc/rc.local || echo 'sudo systemctl restart otbr-agent.service' >>/etc/rc.local echo 'exit 0' >>/etc/rc.local From b2cf35cc2da42bca59d4feaacb1b9b5f197a3ff2 Mon Sep 17 00:00:00 2001 From: Yang Song Date: Thu, 9 Jan 2025 07:55:23 +0000 Subject: [PATCH 2/2] Update the Rasbian image to Debian 12 Bookworm to support Raspi 5 --- script/otbr-setup.bash | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/script/otbr-setup.bash b/script/otbr-setup.bash index 6b41759e..21520535 100755 --- a/script/otbr-setup.bash +++ b/script/otbr-setup.bash @@ -157,7 +157,6 @@ elif [ "${REFERENCE_RELEASE_TYPE?}" = "1.4" ]; then 'BORDER_ROUTING=1' 'NAT64=1' 'DNS64=1' - 'DHCPV6_PD_REF=1' "OTBR_OPTIONS=\"${OTBR_THREAD_1_4_OPTIONS[@]} -DOT_RCP_RESTORATION_MAX_COUNT=100 -DCMAKE_CXX_FLAGS='-DOPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US=5000'\"" ) build_options+=("${LOCAL_OPTIONS[@]}") @@ -167,7 +166,6 @@ elif [ "${REFERENCE_RELEASE_TYPE?}" = "1.4" ]; then 'BORDER_ROUTING=1' 'NAT64=1' 'DNS64=1' - 'DHCPV6_PD_REF=1' "OTBR_OPTIONS=\"${OTBR_THREAD_1_4_OPTIONS[@]}\"" ) build_options+=("${LOCAL_OPTIONS[@]}") @@ -197,16 +195,15 @@ cp -rp /home/pi/repo/openthread /home/pi/repo/ot-br-posix/third_party/openthread apt-get purge -y cmake -python3 -m venv /home/pi/.venv -source /home/pi/.venv/bin/activate +python3 -m venv /home/pi/.python3_venv +source /home/pi/.python3_venv/bin/activate + pip3 install scikit-build pip3 install cmake==3.20.2 cmake --version pip3 install zeroconf - -apt-get install -y --no-install-recommends libgirepository1.0-dev -pip3 install dbus-python PyGObject +apt-get install -y --no-install-recommends python3-gi python3-dbus su -c "${build_options[*]} script/setup" pi @@ -228,7 +225,6 @@ if [ "${REFERENCE_PLATFORM?}" = "ncs" ]; then # add calling of link_dongle.py script at startup to update symlink to the dongle sudo touch /etc/rc.local sudo chmod +x /etc/rc.local - sed -i '/exit 0/d' /etc/rc.local grep -qxF 'sudo systemctl restart otbr-agent.service' /etc/rc.local || echo 'sudo systemctl restart otbr-agent.service' >>/etc/rc.local echo 'exit 0' >>/etc/rc.local @@ -245,4 +241,5 @@ elif [ "${REFERENCE_PLATFORM?}" = "efr32mg12" ]; then sed -i "s/OpenThread_BR/OTS${REFERENCE_RELEASE_TYPE//./}_BR/g" /usr/sbin/testharness-discovery fi +deactivate # deactivate the virtual python environment /home/pi/.python3_venv sync