[Intel AI SW 아카데미] Yocto Project

Jimeaning·2024년 2월 20일
0

Intel AIoT

목록 보기
37/38

2024.02.20 (화)

Socket 통신

TCP/IP로 단체 채팅방 생성하기

  • 교수님 코드 가져오기
ubuntu@ubuntu09:~/ipc$ cp -r  /mnt/lect_nfs/iot_socket/ .

ubuntu@ubuntu09:~/ipc$ ls
iot_socket      msqrcv.c  sharedmemory.c  sigkill.c
messagequeue.c  pipe.c    sigkill         sigloop.c
  • iot_socket 파일로 이동
ubuntu@ubuntu09:~/ipc$ cd iot_socket/
ubuntu@ubuntu09:~/ipc/iot_socket$ ls
Makefile  iot_client.c  iot_server.c
  • 실행 권한 삭제하기
ubuntu@ubuntu09:~/ipc/iot_socket$ ls -l
합계 16
-rwxr--r-- 1 ubuntu ubuntu  446  220 09:50 Makefile
-rwxr--r-- 1 ubuntu ubuntu 3038  220 09:50 iot_client.c
-rwxr--r-- 1 ubuntu ubuntu 7366  220 09:50 iot_server.c
ubuntu@ubuntu09:~/ipc/iot_socket$ chmod u-x *
ubuntu@ubuntu09:~/ipc/iot_socket$ ls -l
합계 16
-rw-r--r-- 1 ubuntu ubuntu  446  220 09:50 Makefile
-rw-r--r-- 1 ubuntu ubuntu 3038  220 09:50 iot_client.c
-rw-r--r-- 1 ubuntu ubuntu 7366  220 09:50 iot_server.c
  • make 하기
ubuntu@ubuntu09:~/ipc/iot_socket$ make
gcc -c -o iot_server.o iot_server.c
gcc -o iot_server iot_server.o  -D_REENTRANT -pthread
gcc -c -o iot_client.o iot_client.c
gcc -o iot_client iot_client.o  -D_REENTRANT -pthread
ubuntu@ubuntu09:~/ipc/iot_socket$ ls
Makefile    iot_client.c  iot_server    iot_server.o
iot_client  iot_client.o  iot_server.c
  • 실행시키기
ubuntu@ubuntu09:~/ipc/iot_socket$ ./iot_client 10.10.15.71 5000 17

ext3 이미지로 sd카드 저장 방법

  • 생성 이미지 위치
ubuntu@ubuntu09:~/pi_bsp/rootfs/yocto/poky/build$ cd tmp/deploy/images/raspberrypi4/
ubuntu@ubuntu09:~/pi_bsp/rootfs/yocto/poky/build/tmp/deploy/images/raspberrypi4$ ls *ext3
core-image-minimal-raspberrypi4-20240219004418.rootfs.ext3
core-image-minimal-raspberrypi4.ext3
  • sd카드 우분투 연결 후 장치 파일 언마운트
ubuntu@ubuntu09:~/pi_bsp/rootfs/yocto/poky/build/tmp/deploy/images/raspberrypi4$ sudo umount /dev/sdb?
ubuntu@ubuntu09:~/pi_bsp/rootfs/yocto/poky/build/tmp/deploy/images/raspberrypi4$ sudo dd if=core-image-minimal-raspberrypi4.ext3 of=/dev/sdb2 bs=1M status=progress

if : input file
of : output file
bs : block speed
status를 출력해달라(progress)

bz2 압축 파일로 sd카드 저장 방법

  • 다운로드 및 압축 풀기
ubuntu@ubuntu09:~/pi_bsp/rootfs/yocto/poky$ cp /mnt/lect_nfs/meta-rpilinux.tar .

ubuntu@ubuntu09:~/pi_bsp/rootfs/yocto/poky$ tar xvf meta-rpilinux.tar
  • bblayers.conf에 추가된 레이어 경로 등록
ubuntu@ubuntu09:~/pi_bsp/rootfs/yocto/poky/build/conf$ vi bblayers.conf

  1 # POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
  2 # changes incompatibly
  3 POKY_BBLAYERS_CONF_VERSION = "2"
  4
  5 BBPATH = "${TOPDIR}"
  6 BBFILES ?= ""
  7
  8 BBLAYERS ?= " \
  9   /home/ubuntu/pi_bsp/rootfs/yocto/poky/meta \
 10   /home/ubuntu/pi_bsp/rootfs/yocto/poky/meta-poky \
 11   /home/ubuntu/pi_bsp/rootfs/yocto/poky/meta-yocto-bsp \
 12   /home/ubuntu/pi_bsp/rootfs/yocto/poky/meta-raspberrypi \
 13   /home/ubuntu/pi_bsp/rootfs/yocto/poky/meta-rpilinux \
 14   "
  • 다운로드된 패키지 확인 및 빌드해주기
ubuntu@ubuntu09:~/pi_bsp/rootfs/yocto/poky/build$ bitbake -s core-image-minimal | grep openssh
nativesdk-openssh                                   :8.9p1-r0                   
openssh                                             :8.9p1-r0                   
packagegroup-core-ssh-openssh                         :1.0-r1

ubuntu@ubuntu09:~/pi_bsp/rootfs/yocto/poky$ source oe-init-build-env
  • 이미지 삭제해주기
ubuntu@ubuntu09:~/pi_bsp/rootfs/yocto/poky/build$ bitbake -c cleanall
  • 이미지 만들기 (..?)
ubuntu@ubuntu09:~/pi_bsp/rootfs/yocto/poky/build$ bitbake rpilinux-image
profile
I mean

0개의 댓글