LoRa

Chirpstack(LoRa Server) Gateway OS build

Beans 2019. 12. 2. 17:19

https://github.com/brocaar/chirpstack-gateway-os

 

brocaar/chirpstack-gateway-os

Yocto based gateway images including ChirpStack components. - brocaar/chirpstack-gateway-os

github.com

https://www.chirpstack.io/gateway-os/overview/

 

해당 링크에서 제공하는 gateway-os를 빌드하여 사용하려고 한다. 

 

빌드 방법이 github 페이지에서 바로 제공되고 있지만, 바로 되지 않은 부분들을 정리 하려고 한다.

 

Initial setup

Run the following command to fetch the git submodules and setup directory permissions (to write back from the Docker container):

# update the submodules
make submodules 

# setup permissions
make permissions

이 두가지 커맨드를 사용하는 과정에서 이슈가 생기지 않았다면, 아랫 단락은 생략해도 좋다.


위의 make submodules 진행 중, git clone 하는 과정에서 문제가 있었다.

git@github.com: Permission denied (publickey).

이러한 에러 메시지를 내 보내면서 make에 실패하였는데, 이는 두가지 방법으로 해결할 수 있다.

 

작업 디렉토리의 .gitmodules 파일을 수정하는 방법

url = git@github.com:brocaar/chirpstack-hugo-theme.git

이 url 값을

url = https://github.com/brocaar/chirpstack-hugo-theme.git

이와 같이 바꾸면 해결된다.

 

두번째 방법으로는 github 계정에 SSH key를 추가하는 방법이 있다.

 

ssh-keygen -t rsa -C "계정@이메일.com"

입력 후, 다른 옵션은 아무것도 주지 않고

Overwrite (y/n)? y

해당 옵션이 나올때만 y 입력 해 준다.

 

자신의 키가 정상적으로 생성이 되었다면 /home/계정/.ssh/id_rsa에 ssh key가 저장되어 있다.

cat /home/계정/.ssh/id_rsa.pub

나온 결과값을 복사하여 자신의 github 세팅에 넣어준다.

 

깃허브 홈페이지에서 자신의 계정 -> setting -> SSH and GPG key 에 들어가면

 

초록색 New SSH Key 버튼이 있다. 누르고 복사 해 놓은 자신의 ssh key 값을 넣어주면 된다.

 

위의 내용은 github 계정에 SSH Key 추가하는 방법으로 찾아보면 더 자세한 방법을 찾을 수 있을 것이다.


위의 작업이 완료되었다면, docker-compose 및 docker를 설치하고 아래의 커맨드를 실행한다.

# on the host
docker-compose run --rm busybox 

# within the container
chown 999:999 /build

# exit docker busybox 
exit

완료 되었다면 exit로 docker busybox 환경을 빠져나온다.

Building

Run the following command to setup the build environment:

# on the host
docker-compose run --rm yocto bash 

# within the container 
# initialize the yocto / openembedded build environment
source oe-init-build-env /build/ /chirpstack-gateway-os/bitbake/

# build the chirpstack-gateway-os-base image 
bitbake chirpstack-gateway-os-base

 

docker-compose로 yocto 빌드 환경을 구성한다. 

 

다음에 bitbake를 사용하기 위해 oe-init-build-env로 bitbake 환경변수를 설정 해 주고 bitbake를 진행한다.

 

빌드되는 소스량이 상당해서 시간이 좀 오래 소요된다. 

 

여기서 빌드하는 이미지는 라즈베리파이3에서만 사용 가능하다. 

 

'LoRa' 카테고리의 다른 글

ChirpStack(LoRa Server) Overview  (0) 2019.11.12