6. Raspberry Pi
6์ฅ Raspberry Pi ๊ฐ์
Raspberry Pi๋ Broadcom SoC ๊ธฐ๋ฐ์ ์ ๊ฐ/์ ์ ๋ ฅ ์ฑ๊ธ๋ณด๋ ์ปดํจํฐ๋ก, ์๋ฒ ๋๋ ์์คํ ๊ต์ก ๋ฐ ํ๋กํ ํ์ดํ์ ๋๋ฆฌ ์ฐ์ธ๋ค. ARM ์ํคํ ์ฒ, Linux OS, shell command, file system, process ๊ด๋ฆฌ๊น์ง ์ค์ต ์ค์ฌ์ผ๋ก ๋ค๋ฃฌ๋ค.
Raspberry Pi Technical Specs
- APU: Broadcom BCM2711 ๊ธฐ๋ฐ SoC
- Cache coherency ์ ์ง (controller ์ฌ์ฉ)
- Multi-core (4 core) โ ARM Cortex-A72 ๊ณ์ด
- GPU, GPIO, UART, SPI, I2C ๋ฑ peripheral ๋ด์ฅ
L1 Cache
- 2-way set-associative instruction cache (โ Temporal locality?)
- 4-way set-associative data cache (โ Temporal locality?)
- Line size ๋ณดํต 64B
Per Partition Size
ARM big.LITTLE ๊ตฌ์กฐ์์๋ partition ๋ณ๋ก pipeline/cache ์ค์ ์ด ๋ค๋ฆ. ๊ฐ ์ฝ์ด๋ pipeline ๊น์ด์ ๋ฐ๋ผ ์๋/์ ๋ ฅ์ด ๋ค๋ฅด๊ฒ ์ค๊ณ.
L2 Cache
- 512KB, 1MB, 2MB, 4MB ๊ณ์ด ์ค ์ ํ
- N-way set-associative data & instruction cache
- Software programmable (shared cache, replacement policy ์กฐ์ ๊ฐ๋ฅ)
ARM vs x86
- Broadcom BCM2711 SoC โ ARM Architecture (ARM v7/v8)
- CISC Architecture (Complex Instruction Set Computer): high performance
- ํ instruction์ ๋ง์ ์ผ์ ์ํ ๊ฐ๋ฅ (multi-cycle)
- Intel, AMD, x86 ๊ณ์ด
- RISC Architecture (Reduced Instruction Set Computer): low power
- ๋จ์ํ instruction, pipeline ํจ์จ โ
- ARM, ARM v7, ARM v8
โ Raspberry Pi๋ ARM Cortex-A ๊ณ์ด โ RISC ๊ธฐ๋ฐ.

Windows vs Linux
- Windows: MS Windows, Apple macOS โ closed source
- Linux (Raspbian, etc.): ๋ฆฌ๋ ์ค ์ปค๋ ๊ธฐ๋ฐ, open source
- Rasbian, Ubuntu Mate, Arch Linux, Kali Linux ๋ฑ ์ฃผ์ distro
Linux Basic โ Shell Command
Prompt
pi@raspberry:~ $
pi: usernameraspberry: hostname~: ํ์ฌ ๋๋ ํ ๋ฆฌ (home directory)$: user mode (root๋#)
์ฃผ์ ๋ช ๋ น์ด
pwd: (print working directory) ํ์ฌ dir ํ์ls: list โ ํ์ฌ dir์ ํ์ผ/ํด๋ ๋ชฉ๋กcd: change directorycd /etcโ ์ ๋๊ฒฝ๋กcd ~โ homecd ..โ parent directorycd -โ ์ด์ ๋๋ ํ ๋ฆฌmkdir: make directory โ ๋น folder ์์ฑrmdir: remove directory โ ๋น folder ์ญ์ rm: ํ์ผ/๋๋ ํ ๋ฆฌ ์ญ์ rm -r(recursive)rm -f(force, no prompt)cp: copymv: move/renameclear: clear screen (Ctrl+L)

Linux Basic โ File Commands
head: ํ์ผ์ ์ฒ์๋ถํฐ 10์ค ํ๋ฉด์ ์ถ๋ ฅ.head -5 science.txt๋ 5์ค ์ถ๋ ฅtail: ํ์ผ์ ๋์์๋ถํฐ 10์ค ํ๋ฉด์ ์ถ๋ ฅcat(concatenate): ํ์ผ์ ๋ด์ฉ์ ํ๋ฉด์ ๋ณด์ฌ์คcat name.txt/cat name1.txt name2.txt(๋ ํ์ผ ์ฐ๊ฒฐ ๋ณด๊ธฐ)cat name.txt name2.txt > name3.txtโ name3์ ์ถ๊ฐ (ํ์ผ ํฉ์น ๋ ์ฌ์ฉ)less: ํ์ผ์ ์ฐ ๋ค/์ ์ด์ฉํด ๋จ์ด ์ฐพ์ โ ํ์ด๋ผ์ดํธ ์ฒ๋ฆฌ.n๋ค์์ผ๋ก ์ด๋sort: ์ํ๋ฒณ, ์ซ์ ์ ๋ ฌ
Pipe
์ ๋ช ๋ น์ output์ ๋ค์ ๋ช ๋ น์ input์ผ๋ก ์ธ ๋ ์ฌ์ฉ (๊ฐ๋จํ๊ณ ๋น ๋ฅด๊ฒ ์ํ).
who: ๋ฆฌ๋ ์ค์ ๋ก๊ทธ์ธํ ๊ณ์ ์ด ๋ณด์who > names.txt: names ํ์ผ๋ก ๋ก๊ทธ์ธํ ๊ณ์ ์ ์ถ๋ ฅsort < names.txt: names ํ์ผ์ ์ฝ์ด์ ์ํ๋ฒณ์ ์ ๋ ฌ (input์ file๋ก ๋ฐ๊ฒ ๋ค๋ ์๋ฏธ)
โ pipe๋ฅผ ์ฌ์ฉํ์ฌ ํ๋๋ก ์ฌ์ฉ ๊ฐ๋ฅ
who | sort: who์ stdout์ sort๊ฐ ๋ฐ์์ ๊ณ์ ์ ์ํ๋ฒณ์์ผ๋ก ์ ๋ ฌwho | wc -l: ๊ณ์ ์ line ์๋ฅผ ์๋ ค์คls -la | less: ๋ชจ๋ ํ์ผ์ less๋ฅผ ํตํด ๋ณผ ์ ์์
Redirection
Linux ๋ช ๋ น์ ์ํ ๋ง์ ํ๋ก์ธ์๋ค์ ๊ฒฐ๊ณผ๋ฅผ:
- Standard output์ผ๋ก ๋ด๋ณด๋ด๋ ๊ฒ (๋๋ถ๋ถ์ system์์ terminal screen์ ์๋ฏธ)
- Standard input์ผ๋ก ๋ฐ๋ ๊ฒ (๋๋ถ๋ถ ํค๋ณด๋)
โ Input๊ณผ output์ ๋ณ๋์ ์ค์ ์ ํ์ง ์์ผ๋ฉด standard input/output ์ฌ์ฉ.
์: cat์ Ctrl+D๋ก ์ข
๋ฃ.

Wildcard
ํน์ ๋ช ๋ น์ด์ ์ธ์๋ก ํ์ผ ์ด๋ฆ์ ๋๊ธธ ๋, ํจํด ๋งค์นญ์ ํ์ฉ:
*: 0๊ฐ ์ด์์ ๋ฌธ์?: ํ ๊ฐ ๋ฌธ์[abc]: a ๋๋ b ๋๋ c[!abc]: a, b, c๊ฐ ์๋ ๊ฒ
File System Security
chmod / ๊ถํ
Unix์ ํ์ผ ๊ถํ์ owner, group, other์ ๋ํ rwx (read, write, execute).
-rwxr-xr-- 1 pi pi 1234 ...
โโโฌโโโฌโโโฌโ
โ โ โ โ other์ ๊ถํ (r--)
โ โ โโโ group์ ๊ถํ (r-x)
โ โโโโโโ owner์ ๊ถํ (rwx)
โโ ํ์ผ type (- <mark class="highlight"><strong><u> regular file, d </u></strong></mark> directory)
chmod ์ซ์ ๋ฐฉ์
- 4: read (r)
- 2: write (w)
- 1: execute (x)
- 7 = rwx
์: chmod 755 file โ owner=rwx, group=rx, other=rx.
Changing a File's Mode
chmod(change mode)chown(change owner)chgrp(change group)

Processes and Jobs
Processes
- Foreground: ํ์ฌ ์คํ ์ค์ด๋ฉฐ ์ฌ์ฉ์ ์ ๋ ฅ์ ๋ฐ๋ process (prompt๋ฅผ ์ ์ )
- Background:
&๋ก ์คํ, prompt ๋ฐํ ํ ๋ฐฑ๊ทธ๋ผ์ด๋์์ ๊ณ์ ์คํ - Suspended: ์ผ์ ์ ์ง๋จ (Ctrl+Z)
Job ๊ด๋ จ ๋ช ๋ น
&: ๋ช ๋ น ๋ค์&๋ฅผ ๋ถ์ฌ backgroud๋ก ์คํps: ํ์ฌ ์คํ ์ค์ธ process ๋ชฉ๋กjobs: ํ์ฌ background/suspended job ๋ชฉ๋กfg %n: job n๋ฒ์ foreground๋กbg %n: job n๋ฒ์ background๋กkill %n/kill PID: job/process ์ข ๋ฃ
Signals
Ctrl+C: SIGINT (interrupt) โ foreground process ์ข ๋ฃCtrl+Z: SIGTSTP (suspend)
Killing a Process
kill PID: SIGTERM (์ ์ ์ข ๋ฃ ์์ฒญ)kill -9 PID: SIGKILL (๊ฐ์ ์ข ๋ฃ)

File System ์ข ๋ฅ
- ext2: ๊ธฐ๋ณธ Linux filesystem
- ext3/ext4: journaling ์ง์, ํ๋ ํ์ค
- NTFS: Windows native
- FAT32/exFAT: ํธํ์ฑ, USB
- btrfs, xfs: ๊ณ ๊ธ ๊ธฐ๋ฅ
File Types
- Regular file
- Directory
- Symbolic link
- Block/character device
- Socket / pipe
sudo ๊ถํ
sudo: ์ผ์์ ์ผ๋ก superuser ๊ถํ ํ๋su: switch user/etc/sudoersํ์ผ๋ก sudo ๊ถํ ๊ด๋ฆฌ
Account
/etc/passwd: ์ฌ์ฉ์ ์ ๋ณด/etc/shadow: ์ํธ hash/etc/group: group ์ ๋ณด

File System Layout
Logical Layout
/: root/home/<username>: ์ฌ์ฉ์ ํ ๋๋ ํ ๋ฆฌ/etc: ์ค์ ํ์ผ/var: ๋ก๊ทธ, ๊ฐ๋ณ ๋ฐ์ดํฐ/usr: ์์ฉ ํ๋ก๊ทธ๋จ, ๋ผ์ด๋ธ๋ฌ๋ฆฌ/bin,/sbin: ํ์ ์คํ ํ์ผ/dev: ๋๋ฐ์ด์ค ํ์ผ/proc,/sys: ๊ฐ์ ํ์ผ์์คํ (์ปค๋ ์ ๋ณด)/mnt,/media: ๋ง์ดํธ ์ง์
Physical Layout
- Boot partition: FAT, kernel ์ด๋ฏธ์ง, boot loader โ Raspberry Pi์์๋ ํ์
- Root partition: ext4 (๋๋ถ๋ถ์ ์์คํ ํ์ผ)
- Swap partition: Swap ์์ญ (๋ณด์กฐ ๋ฉ๋ชจ๋ฆฌ)
Installing/Uninstalling Software
Raspberry Pi package manager: apt (Advanced Package Tool).
apt-get install <package>: installapt-get update: package ๋ชฉ๋ก updateapt-get upgrade: ์ค์น๋ package upgradeapt-get remove <package>: uninstallapt-get purge <package>: ์ค์ ํ์ผ๊น์ง ์ ๊ฑฐdpkg -i <file>.deb: ๋ก์ปฌ .deb ํ์ผ ์ค์น

Comments (0)
No comments yet. Be the first to comment!
Please to write a comment.