라즈베리파이에서 가장 많이 쓰는 라즈비안은 꾸준히 최신 커널 버전을 지원합니다.
 
최신 라즈비안 커널 소스 코드 내려받기
 
먼저 다음 명령어를 입력해 라즈비안 최신 커널 소스를 내려 받겠습니다.
"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

http://cccding.tistory.com/96

 

출처: http://dullwolf.tistory.com/17

 

 

키보드 설정을 안하고 셋팅을 하다보면 !@#$%등의 Shift키를 누르고 입력하는 것들이 입력이 안된다.

괜히 나처럼 나중에 삽질하지말고, 키보드 셋팅부터하고 라즈베리를 사용하는 것이 좋다.

나야 원래 좌충우돌 라즈베리파이 삽질기를 올리는 것이기에..... ㅠㅠ

아~ 혹시 패스워드를 !@#$%등이 들어가는 것으로 설정해 놓은 상태라면, 필히 !@#$%등이 들어가지 않게 패스워드를 변경하고 키보드 셋팅을 바란다.

 

이제 raspi-config를 띄우는 법을 알테니, 그림으로 설명을 넘어가겠다. 모르겠다면, 2. 라즈베리파이(Raspberry Pi) 초기 설정 - raspi-config) 을 읽어보기 바란다.

sudo raspi-config를 입력하면 아래의 화면이 뜬다.

 

키보드 셋팅은 어디? 4번 Internationalisation Options를 선택한다. 이후 설명은 그림위주~

 

3번 Change Keyboard Layout 선택

 

Generic 105-key (Intl) PC 선택

 

Other 선택

 

Korean 선택

 

Korean - Korean (101/104 Key compatible) 선택

 

The default for the keyboard layout 선택

 

No compose Key 선택

 

Yes

 

키보드 셋팅 하기편 끝!



출처: http://dullwolf.tistory.com/17 [노는게 남는거]

SD 카드 포멧, 라즈베리안 복사 관련 내용
 

제가 이번 프로젝트를 진행하면서 사용하게될 라즈베리파이는 라즈베리파이3입니다. 라즈베리파이3는 전 시리즈들이 32 비트를 사용했던 것에 비해 64 비트 Quad Core를 사용하고 있고, 속도도 1.2GHz로 확 올랐습니다. 무엇보다도 이전 시리즈와 다른 점은 Wi-Fi와 BLE(블루투스)가 내장되어 있다는 점인 것 같네요.

 

    드디어 라즈베리파이를 개봉해보도록 하겠습니다. 케이스가 무척 예뻐요♥

 

내부를 개봉하고 나면 위와 같습니다. 이제부터는 이 라즈베리파이3를 이용하여 프로젝트를 진행해보도록 합시다. 

 

 

 

먼저 라즈베리파이를 사용하기 위해서 라즈베리파이에 OS를 설치해보도록 하겠습니다. 

 

 

STEP1. 준비물

라즈베리파이, SD 카드

 

 

STEP2. 설치 과정

    먼저 라즈베리파이 운영체제를 라즈베리 홈페이지에 들어가서 다운 받으시면 됩니다.

 

홈페이지의 상단에 있는 DOWNLOAD 카테고리로 가서 라즈비안을 선택하시고 나면 아래와 같은 창이 뜨는데 여기서 왼쪽에 있는 것을 다운받아주세요.

 

 

다운 받으신 파일의 압축을 풀면 img 파일이 나옵니다. 그 파일을 라즈베리파이에 넣을 SD카드에 구워줘야합니다. 윈도우에서는 Win32 Disk Imager를 이용해서 이미지 파일을 구울 수 있습니다. Win 32 Disk Imager는 https://sourceforge.net/projects/win32diskimager/ 에서 다운받을 수 있습니다. 

 

 

Win32 Disk Imager를 다운받은 뒤에 SD 카드를 꽂고 실행시켜서 다운받은 img파일을 선택합니다.

그런 후에 아래의 Write 버튼을 눌러서 SD 카드를 구워주세요. 완료되면 SD카드를 라즈베리파이에 꽂아주시면 됩니다.

 

다음 글에서는 라즈베리파이에 모니터와 키보드, 마우스를 연결해서 라즈비안을 본격적으로 설치해보도록 하겠습니다.

프로젝트를 진행하다보면 리눅스 서버에 있는 데이터를 바로 복사하고 싶을 때가 있습니다.
이때 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 명령어를 잘 활용해서 집에 일찍 갑시다.

+ Recent posts