[Intel AI SW 아카데미] 리눅스 Root File System, Yocto

Jimeaning·2024년 2월 19일
0

Intel AIoT

목록 보기
36/38

2024.02.19 (월)

Yocto 설치

  • 디렉토리 생성 및 패키지 다운로드
ubuntu@ubuntu09:~/pi_bsp$ mkdir rootfs ; cd rootfs
ubuntu@ubuntu09:~/pi_bsp/rootfs$ mkdir yocto ; cd yocto
ubuntu@ubuntu09:~/pi_bsp/rootfs/yocto$ sudo apt update					//필수 패키지 설치
ubuntu@ubuntu09:~/pi_bsp/rootfs/yocto$ sudo apt-get install gawk wget git diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm python zstd liblz4-tool

임베디드 시스템은 대부분 파일 시스템이 미니멀함

  • poky 다운로드하기
ubuntu@ubuntu09:~/pi_bsp/rootfs/yocto$ git clone -b kirkstone git://git.yoctoproject.org/poky.git

ubuntu@ubuntu09:~/pi_bsp/rootfs/yocto$ ls
poky
ubuntu@ubuntu09:~/pi_bsp/rootfs/yocto$ cd poky
  • meta-raspberrypi 레이어 다운로드
ubuntu@ubuntu09:~/pi_bsp/rootfs/yocto/poky$ git clone -b kirkstone git://git.yoctoproject.org/meta-raspberrypi
  • build 환경 적용
ubuntu@ubuntu09:~/pi_bsp/rootfs/yocto/poky$ source oe-init-build-env
  • 머신 등록
ubuntu@ubuntu09:~/pi_bsp/rootfs/yocto/poky/build$ vi conf/local.conf
38 #MACINE ??= "qemux86-64"
39 MACINE ??= "raspberrypi4"
  • 레이어 경로 등록
ubuntu@ubuntu09:~/pi_bsp/rootfs/yocto/poky/build$ vi conf/bblayers.conf
12 /home/ubuntu/pi_bsp/rootfs/yocto/poky/meta-raspberrypi \
  • 빌드 (오래 걸림)
ubuntu@ubuntu09:~/pi_bsp/rootfs/yocto/poky/build$ bitbake core-image-minimal

NOOBS

NOOBS(New Out Of Box Software)는 라즈베리 파이를 위한 쉬운 운영체제 설치 관리자이다.

  • noobs 다운로드하고 압축 풀기
ubuntu@ubuntu09:~/pi_bsp/rootfs$ wget https://downloads.raspberrypi.org/NOOBS_latest
ubuntu@ubuntu14:~/pi_bsp/rootfs$ unzip -d noobs NOOBS_latest
ubuntu@ubuntu14:~/pi_bsp/rootfs$ cd noobs/os/RaspiOS_Full_armhf/
  • 루트파일시스템 압축 풀기
ubuntu@ubuntu14:~/pi_bsp/rootfs/noobs/os/RaspiOS_Full_armhf$ mkdir rootfs
ubuntu@ubuntu14:~/pi_bsp/rootfs/noobs/os/RaspiOS_Full_armhf$ tar xvfp root.tar.xz -C ./rootfs/

Ubuntu와 Ubuntu 간 nfs

home directory에서

$ vi .profile

맨 밑에 코드 추가

 28 if [ -f /mnt/nfs.sh ] ; then
 29     . /mnt/nfs.sh
 30 fi

nfs.sh 파일 만들고 코드 추가해주기

$ cd /mnt ; sudo mkdir lect_nfs
$ chmod 777 lect_nfs
$ sudo vi nfs.sh		// /mnt/nfs.sh
#!/bin/bash

SERVIP=10.10.15.71
if ! df | grep lect_nfs > /dev/null ; then
        ping -c 1 $SERVIP > /dev/null
        if [ $? -eq 0 ] ; then
                        sudo mount -t nfs $SERVIP:/srv/lect_nfs /mnt/lect_nfs
                        df | grep lect_nfs
        fi
fi

실행시켜주면 df 명령어를 쳤을 때 마운트된 걸 확인할 수 있다

$ source nfs.sh

profile
I mean

0개의 댓글