가끔 Ubuntu 버전을 확인하고 싶을 때가 있습니다.
이 때 'lsb_release -a' 명령어를 입력하면 됩니다.
 
root:~/oss_prj$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.7 LTS
Release:        16.04
Codename:       xenial
 
위 출력 결과로 우분투의 버전은 16.04임을 알 수 있습니다.
어느 훌륭한 개발자 분이 유용한 GIT 커멘드를 정리했습니다.
 
출처:
 
이렇게 유용한 GIT 명령어를 정리해주신 블로그 운영자께 감사의 마음을 전합니다.
가끔 하위 디렉토리에 있는 특정 확장자의 파일을 지우고 싶을 때가 있습니다.
만약 *.png 파일을 지우고 싶으면 아래 명령어를 입력하면 됩니다.
 
$ rm -rf `find . -name *.png`
프로젝트를 진행하다보면 리눅스 서버에 있는 데이터를 바로 복사하고 싶을 때가 있습니다.
이때 scp 유틸리티를 쓰면 되는데요. 사용법은 다음과 같습니다.
 
[1] 먼저, 복사할 데이터가 있는 리눅스 서버에 접속합니다.
 
[2] 이어서 다음 명령어를 입력합니다. 
 
scp bald_candy.data bald.candy@12.345.67.89:~/bald_candy_data
 
여기서, 각 명령어의 내용은 다음과 같습니다.
 
복사할 대상의 리눅스 서버의 IP 주소: 12.345.67.89
복사할 대상의 리눅스 서버의 계정: bald.candy
복사하고 싶은 파일 이름: bald_candy.data
 
[3] 만약 폴더를 복사하려면 다음 명령어를 입력하면 됩니다.
 
scp -r bald_candy_folder bald.candy@12.345.67.89:~/bald_candy_data
 
(where)
복사할 대상의 리눅스 서버의 IP 주소: 12.345.67.89
복사할 대상의 리눅스 서버의 계정: bald.candy
복사하고 싶은 디렉토리 이름: bald_candy_folder
 
이번에 소개하는 scp 명령어를 잘 활용해서 집에 일찍 갑시다.
라즈베리파이에서 가장 많이 쓰는 라즈비안은 꾸준히 최신 커널 버전을 지원합니다.
 
최신 라즈비안 커널 소스 코드 내려받기
 
먼저 다음 명령어를 입력해 라즈비안 최신 커널 소스를 내려 받겠습니다.
"git clone --depth=3000 https://github.com/raspberrypi/linux"
 
root@raspberrypi:/home/pi/RPi_kernel_src# git clone --depth=3000 https://github.com/raspberrypi/linux
Cloning into 'linux'...
remote: Enumerating objects: 85646, done.
remote: Counting objects: 100% (85646/85646), done.
remote: Compressing objects: 100% (65774/65774), done.
Receiving objects:  33% (28569/85646), 41.45 MiB | 1.22 MiB/s     
 
커널 소스를 다 내려받고 나서 브랜치를 확인하니 rpi-4.19.y입니다.
root@raspberrypi:/home/pi/RPi_kernel_src# git branch
* rpi-4.19.y
 
linux 폴더에 생성되는 .git/config 파일을 열어보면 기본으로 rpi-4.19.y 브랜치를 Fetch합니다.
root@raspberrypi:/home/pi/RPi_kernel_src/linux# vi .git/config
.git/config
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    fetch = +refs/heads/rpi-4.19.y:refs/remotes/origin/rpi-4.19.y
[branch "rpi-4.19.y"]
    remote = origin
    merge = refs/heads/rpi-4.19.y
 
다음으로 커밋을 볼까요?
root@raspberrypi:/home/pi/RPi_kernel_src# git log
commit b40edce4d946218457aa65902c9baf313f670591
Author: Stefan Wahren <stefan.wahren@i2se.com>
Date:   Thu Mar 7 19:27:05 2019 +0100
 
    configs: Enable MT76 USB wifi
 
    Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
 
03/11/2019에 반영한 커밋이 보입니다.
 
기존 rpi-4.14.y 브랜치로 소스 코드를 어떻게 내려받을까?
 
그러면 기존 rpi-4.14.y 브랜치로 소스 코드를 내려 받고 싶으면 어떻게 해야 할까요?
방법은 간단합니다.
 
git clone 명령어에서 브랜치 이름을 지정하면 됩니다.
--branch "브랜치 이름"
 
그러면 "rpi-4.14.y" 브랜치 소스 코드를 내려 받기 위해 다음 명령어를 입력합시다.
root@raspberrypi:/home/pi/RPi_kernel_4_14_src# git clone --depth=1000 --branch rpi-4.14.y https://github.com/raspberrypi/linux
Cloning into 'linux'...
remote: Enumerating objects: 122739, done.
remote: Counting objects: 100% (122739/122739), done.
remote: Compressing objects: 100% (74357/74357), done.
remote: Total 122739 (delta 54284), reused 72109 (delta 47307), pack-reused 0
Receiving objects: 100% (122739/122739), 185.97 MiB | 1.17 MiB/s, done.
Resolving deltas: 100% (54284/54284), done.
Checking connectivity... done.
Checking out files: 100% (61885/61885), done.
 
빌드 서버 성능에 따라 소스 다운로드 시간에 차이가 있습니다만 약 10분 정도 걸립니다.
 
root@raspberrypi:/home/pi/RPi_kernel_4_14_src/linux# git branch
* rpi-4.14.y
 
.git/config를 확인하니 정말 rpi-4.14.y 브랜치가 보입니다.
root@raspberrypi:/home/pi/RPi_kernel_4_14_src/linux# vi .git/config
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    fetch = +refs/heads/rpi-4.14.y:refs/remotes/origin/rpi-4.14.y
[branch "rpi-4.14.y"]
    remote = origin
    merge = refs/heads/rpi-4.14.y
 
제대로 rpi-4.14.y 브랜치 코드를 패치해 왔습니다.
 
이번에는 리눅스 커널 버전을 확인해볼까요?
root@raspberrypi:/home/pi/RPi_kernel_4_14_src/linux# vi Makefile
# SPDX-License-Identifier: GPL-2.0
VERSION = 4
PATCHLEVEL = 14
SUBLEVEL = 98
EXTRAVERSION =
NAME = Petit Gorille
 
커널 버전 4.14.98입니다.
 
이번엔 "git log" 명령어를 입력해 가장 최신 커밋을 확인합시다. 
root@raspberrypi:/home/pi/RPi_kernel_4_14_src/linux# git log
commit e9829ff3e92f125072adae4de40750546f4268a2
Author: Chao Yu <yuchao0@huawei.com>
Date:   Sat Aug 11 23:42:09 2018 +0800
 
    f2fs: fix to skip verifying block address for non-regular inode
 
    commit dda9f4b9cac6bdd2a96253b4444d7a6ce5132edb upstream.
 
    generic/184 1s ... [failed, exit status 1]- output mismatch
        --- tests/generic/184.out       2015-01-11 16:52:27.643681072 +0800
         QA output created by 184 - silence is golden
        +rm: cannot remove '/mnt/f2fs/null': Bad address
        +mknod: '/mnt/f2fs/null': Bad address
        +chmod: cannot access '/mnt/f2fs/null': Bad address
        +./tests/generic/184: line 36: /mnt/f2fs/null: Bad address
 
2018/08/11 에 올린 커밋입니다.
 
라즈비안은 4.14에서 4.19 커널 버전으로 완전히 갈아 탔습니다.
 
결론
 
라즈비안 커널 소스를 다음 명령어로 내려 받으면 최신 브랜치를 패치합니다.
 
만약 2020년에 라즈비안 기본 브랜치가 rpi-5.4.y 라면 rpi-5.4.y 브랜치를 패치할 것입니다.
 
특정 브랜치를 지정해 라즈비안 소스 코드를 내려받으려면 다음과 같이 "--branch 브랜치 이름" 구문을 추가합시다.
git clone --depth=1000 --branch rpi-4.14.y https://github.com/raspberrypi/linux

라즈베리파이 4 Model B 시작하기

https://newsight.tistory.com/287

리눅스 서버 간 대용량 파일을 복사 받고하고 싶을 때가 있습니다.
이럴 때 rsync -azuv -e ssh 명령어를 쓰면 됩니다.
 
제 계정이 bret.hart, 복사하고 싶은 리눅스 서버 계정이 hulk.hogan이라고 가정하겠습니다.
여기서 hulk.hogan 계정 아이피 주소가 10.123.123.12:입니다.
 
여기서 주의해야 할 점은 다음 명령어를 입력하는 서버가 bret.hart 서버 터미널이란 점입니다.
 
rsync -azuv -e ssh hulk.hogan@10.123.123.12:/home001/hulk.hogan/* /home001/bret.hart/
 
위 명령어를 입력하면 10.123.123.12 IP 주소 리눅스 서버에 있는 hulk.hogan 서버 비밀번호를 입력하라는 메시지가 뜹니다.
이 때 비밀번호를 입력하면 바로 파일을 복사합니다.
이번에는 git clone 명령어로 특정 커밋으로 소스 코드를 변경하는 과정을 알아봅시다.
 
돌아가려는 커밋은 6/13/2018 날짜입니다.
commit 5762758699e1ddab22bf4c14eb225941761c52c8
Author: Dave Stevenson <dave.stevenson@raspberrypi.org>
Date:   Wed Jun 13 15:21:10 2018 +0100
 
    net: lan78xx: Disable TCP Segmentation Offload (TSO)
    
    TSO seems to be having issues when packets are dropped and the
    remote end uses Selective Acknowledge (SACK) to denote that
    data is missing. The missing data is never resent, so the
    connection eventually stalls.
    
    There is a module parameter of enable_tso added to allow
    further debugging without forcing a rebuild of the kernel.
    
    
    Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
 
먼저 다음 명령어로 최신 라즈비안 리눅스 커널 소스를 다운로드 받습니다.
 
--depth=1 대신 --depth=3000 명령어를 입력합시다.
 
소스를 받는데 10분 정도 시간이 걸립니다.
소스를 다 받고 난 다음 "cd linux" 명령어로 linux 폴더로 이동한 다음 git log 명령어로 커밋을 봅시다. 
확인하니 리눅스 커널 4.14.68버전입니다. 
commit 8c8666ff6c1254d325cfa300d16f9928b3f31fc0
Merge: 3dc96a2 ee13f7e
Author: popcornmix <popcornmix@gmail.com>
Date:   Wed Sep 5 15:26:48 2018 +0100
 
    Merge remote-tracking branch 'stable/linux-4.14.y' into rpi-4.14.y
 
commit ee13f7edca5838436feefde90ed1b2ebb07c4184
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Wed Sep 5 09:26:42 2018 +0200
 
    Linux 4.14.68
 
다음 명령어로 브랜치와 커밋 해시(돌아가려는 커밋) 값을 입력합니다.
git checkout -b raspbian_liunx 5762758699e1ddab22bf4c1
 
raspbian_liunx 는 브랜치 이름이고 5762758699e1ddab22bf4c1 는 커밋 메세지에서 보이는 커밋 해시 정보입니다.
6/13/2018 커밋으로 돌아가려는 겁니다.
(where)
commit 5762758699e1ddab22bf4c14eb225941761c52c8
Author: Dave Stevenson <dave.stevenson@raspberrypi.org>
Date:   Wed Jun 13 15:21:10 2018 +0100
 
    net: lan78xx: Disable TCP Segmentation Offload (TSO)
 
git branch 명령어를 입력하니 raspbian_liunx 브랜치가 생성됐습니다.
austindh.kim:~/src/test_raspbian_src/linux$ git checkout -b raspbian_liunx 5762758699e1ddab22bf4c1
Switched to a new branch 'raspbian_liunx'
austindh.kim:~/src/test_raspbian_src/linux$ git branch
* raspbian_liunx
  rpi-4.14.y
 
다시 git log 명령어를 입력하면 현재 커밋을 다음과 같이 볼 수 있습니다.
austindh.kim:~/src/test_raspbian_src/linux$ git log
 
commit 5762758699e1ddab22bf4c14eb225941761c52c8
Author: Dave Stevenson <dave.stevenson@raspberrypi.org>
Date:   Wed Jun 13 15:21:10 2018 +0100
 
    net: lan78xx: Disable TCP Segmentation Offload (TSO)
 
    TSO seems to be having issues when packets are dropped and the
    remote end uses Selective Acknowledge (SACK) to denote that
    data is missing. The missing data is never resent, so the
    connection eventually stalls.
 
    There is a module parameter of enable_tso added to allow
    further debugging without forcing a rebuild of the kernel.
 
 
    Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
 
라즈비안은 한 달에 2번 주기로 계속 리눅스 커널 버전이 업그레이드됩니다. 보통 실전 리눅스 프로젝트는 리눅스 커널 버전을 자주 바꾸지 않습니다.
 
주의할 점
다음과 같은 커밋이 보이면 "Merge remote-tracking branch 'stable/linux-4.14.y' into rpi-4.14.y"와 같은 머지 커밋으로 돌아가야 합니다.
commit 58eb131ce78d1976dad26c21bd75a7da290cd6aa
Merge: 4fca48b 2c6025e
Author: popcornmix <popcornmix@gmail.com>
Date:   Tue Jun 5 17:28:54 2018 +0100
 
    Merge remote-tracking branch 'stable/linux-4.14.y' into rpi-4.14.y
 
commit 2c6025ebc7fd8e0a8ca785d778dc6ae25225744b
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Tue Jun 5 11:42:00 2018 +0200
 
    Linux 4.14.48
 
만약 Author: Greg Kroah-Hartman 커밋으로 돌아가면 다음 컨피그 파일이 빠져 있어 라즈베리파이 커널 빌드를 못합니다.
./arch/arm/configs/bcm2709_defconfig
1. 무선랜을 연결합니다. 네트워크 연결이 안돼 있으면 apt-get update 명령어를 제대로 실행 못합니다.
 
2.  다음 명령어로 패키지를 업데이트합니다.
apt-get update
apt-get upgrade
 
apt-get upgrade 명령어는 apt-get update를 통해서 확인한 패키지들의 최신 버전에 따라서 패키지들의 버전을 업그레이드 해주는 명령어입니다.
apt-get upgrade 명령어가 실행 완료까지는 5분 정도 시간이 걸립니다.
 
3. 한글 폰트를 설치합니다
apt-get install ibus
apt-get install ibus-hangul
apt-get ttf-unfonts-core
 
4. 키보드 설정을 합니다. 아래 링크를 참고하세요
 
 
SD Formatter 4.0 프로그램을 이용하여 SD카드를 포맷합니다. 내컴퓨터에서 직접 포맷을 하면 SD 카드 포멧이 잘 안됩니다.
SD Formatter 4.0 프로그램을 이용하여 SD카드를 포맷합니다. 내컴퓨터에서 직접 포맷을 하면 SD 카드 포멧이 잘 안됩니다.
아래 링크에 담겨 있는 SD 카드 포멧 방법을 참고하세요.

https://kocoafab.cc/tutorial/view/299

+ Recent posts