Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the Rasbian image to Debian 12 Bookworm to support Raspi 5 #100

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions script/make-commissioner.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions script/make-raspbian.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
26 changes: 17 additions & 9 deletions script/otbr-setup.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the name of the virtual env be more specific so it's less likely to conflict with other virtual envs?

superwhd marked this conversation as resolved.
Show resolved Hide resolved
source /home/pi/.venv/bin/activate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should you call deactivate at some time point?

pip3 install scikit-build
pip3 install cmake==3.20.2
cmake --version
Expand All @@ -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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

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
Expand Down
Loading