OTBR 코드 가져오기
Raspberry Pi에서 다음을 실행합니다.
git을 설치합니다.
sudo apt install gitGitHub에서
ot-br-posix를 클론합니다.git clone --depth=1 https://github.com/openthread/ot-br-posix
OTBR 빌드 및 설치
OTBR에는 스레드 보더 라우터를 부트스트랩하고 설정하는 두 개의 스크립트가 있습니다.
cd ot-br-posix./script/bootstrapINFRA_IF_NAME=wlan0 ./script/setup
OTBR은 INFRA_IF_NAME로 지정된 스레드 인터페이스와 인프라 네트워크 인터페이스 (예: Wi-Fi/이더넷) 모두에서 작동합니다. 스레드 인터페이스는 OTBR 자체에서 생성되며 기본적으로 wpan0로 이름이 지정되고 인프라 인터페이스의 기본값은 INFRA_IF_NAME가 명시적으로 지정되지 않은 경우 wlan0입니다. 이더넷 케이블로 Raspberry Pi를 연결한 경우 이더넷 인터페이스 이름 (예: eth0)을 지정합니다.
INFRA_IF_NAME=eth0 ./script/setup
이제 otbr-agent 서비스가 사용 설정되었으며 재부팅 시 시작됩니다. 재부팅하지 않고 즉시 서비스를 시작하려면 server 스크립트를 사용하세요.
./script/server
otbr-agent 서비스가 활성 상태인지 확인합니다.
sudo service otbr-agent status
● otbr-agent.service - Border Router Agent
Loaded: loaded (/lib/systemd/system/otbr-agent.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2021-03-01 05:46:26 GMT; 2s ago
Main PID: 2997 (otbr-agent)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/otbr-agent.service
└─2997 /usr/sbin/otbr-agent -I wpan0 -B wlan0 spinel+hdlc+uart:///dev/ttyACM0
Mar 01 05:46:26 raspberrypi otbr-agent[2997]: Stop publishing service
Mar 01 05:46:26 raspberrypi otbr-agent[2997]: [adproxy] Stopped
Mar 01 05:46:26 raspberrypi otbr-agent[2997]: PSKc is not initialized
Mar 01 05:46:26 raspberrypi otbr-agent[2997]: Check if PSKc is initialized: OK
Mar 01 05:46:26 raspberrypi otbr-agent[2997]: Initialize OpenThread Border Router Agent: OK
Mar 01 05:46:26 raspberrypi otbr-agent[2997]: Border router agent started.
Mar 01 05:46:26 raspberrypi otbr-agent[2997]: [INFO]-CORE----: Notifier: StateChanged (0x00038200) [NetData PanId NetName ExtPanId]
Mar 01 05:46:26 raspberrypi otbr-agent[2997]: [INFO]-PLAT----: Host netif is down
뮤직 스테이션 URL 경로 수정
OTBR 에이전트는 시작 매개변수에 /etc/default/otbr-agent 구성 파일을 사용합니다. 이 파일에는 라디오 URL과 같은 설정을 정의하는 OTBR_AGENT_OPTS 변수가 포함되어 있습니다. 예를 들면 spinel+hdlc+uart:///dev/ttyACM0입니다.
이 구성 파일은 CMake에서 otbr-agent.default.in 소스 파일로부터 생성됩니다. 그런 다음 시스템 서비스에 서비스 시작 매개변수로 제공됩니다.
타겟 시스템에서 라디오 URL 경로를 변경하려면 다음 단계를 따르세요.
텍스트 편집기에서 OTBR 에이전트 구성 파일을 엽니다.
sudoedit /etc/default/otbr-agentOTBR_AGENT_OPTS변수를 찾습니다.문자열의 라디오 URL 부분을 찾습니다. 예를 들면
spinel+hdlc+uart:///dev/ttyACM0입니다.이 문자열을 새 경로로 변경합니다.
파일을 저장하고 편집기를 종료합니다.
otbr-agent서비스를 다시 시작하여 변경사항을 적용합니다.sudo systemctl restart otbr-agent