책을 읽는 것과
사랑을 하는 것에는
정답이 없는 것이 아닐까?
그래서 그런지 좋다.
'Life > A sentense of the day' 카테고리의 다른 글
처한 상황 (0) | 2018.06.06 |
---|---|
맥주 한 잔의 마법 (0) | 2018.06.06 |
근묵자흑 (0) | 2018.05.23 |
다음에 (0) | 2018.05.02 |
피아 (0) | 2018.04.10 |
책을 읽는 것과
사랑을 하는 것에는
정답이 없는 것이 아닐까?
그래서 그런지 좋다.
처한 상황 (0) | 2018.06.06 |
---|---|
맥주 한 잔의 마법 (0) | 2018.06.06 |
근묵자흑 (0) | 2018.05.23 |
다음에 (0) | 2018.05.02 |
피아 (0) | 2018.04.10 |
먹을 가까이 하는 사람은 검게 마련이다.
조심하다가도 한순간 방심하면 묻는다.
왠만하면 묻는다.
멀리하자.
맥주 한 잔의 마법 (0) | 2018.06.06 |
---|---|
정답이 없다 (0) | 2018.05.28 |
다음에 (0) | 2018.05.02 |
피아 (0) | 2018.04.10 |
별 (0) | 2018.04.09 |
Kernel Module Programming
Module 기본 구조
#include <linux/module.h>
#include <linux/kernel.h>
int init_module(void)
{
printk("<1>Hello world\n");
return 0;
}
void cleanup_module(void)
{
printk(KERN_ALERT "Bye World\n");
}
※ init_module()은 모듈 추가(insmod) 시, cleanup_module()은 모듈 삭제(rmmod) 시 호출 됨
아래와 같이 헤더로 linux/init.h 를 포함하고, module_init/module_exit 함수를 통해 init_module()/cleanup_module() 함수의 이름을 자유롭게 설정할 수 있다.
#include <linux/module.h>
#include <linux/kernel.h>
#inlcude <linux/init.h>
int my_init(void)
{
printk(KERN_ALERT"Hello World\n");
return 0;
}
void my_exit(void)
{
printk(KERN_ALERT"Bye World\n");
}
module_init(my_init);
module_exit(my_exit);
Device 를 시스템에서 사용하기 위해서는 우선 디바이스 노드를 만들어야 한다.
$ sudo mknod /dev/<device_name> <major_num> <minor_num>
$ sudo chmod 666 /dev<device_name>
참조: https://www.joinc.co.kr/w/Site/Embedded/Documents/LinuxKernelModuleProg
cross kernel debugging (0) | 2020.06.19 |
---|---|
Linux kernel module compile from linux source (0) | 2019.01.17 |
Kernel Version Check (0) | 2018.05.23 |
Kernel 프로그래밍 - printk (0) | 2017.06.20 |
Linux 시스템 상에서 kernel의 version을 확인하기 위한 방법
$ cat /proc/version
참조: https://zetawiki.com/wiki/%EB%A6%AC%EB%88%85%EC%8A%A4_%EC%BB%A4%EB%84%90_%EB%B2%84%EC%A0%84_%ED%99%95%EC%9D%B8
cross kernel debugging (0) | 2020.06.19 |
---|---|
Linux kernel module compile from linux source (0) | 2019.01.17 |
Kernel module programming (0) | 2018.05.23 |
Kernel 프로그래밍 - printk (0) | 2017.06.20 |
Bash script에서 for문은 아래와 같은 형태를 가진다.
for <variable> in <list>
do
statements
done
C언어에서와 같이 i++을 진행하면서 하고자 하는 경우,
for i in `seq 1 10`;
do
statements
done
※seq 1 3 == 1,2,3
Bash if statement with regex (0) | 2021.09.06 |
---|---|
Bash script argument parsing with getopts (0) | 2020.01.23 |
Bash Script case statement (0) | 2018.02.06 |
Bash Script Variable Split by Space (0) | 2018.02.04 |
Bash Script Echo (0) | 2018.02.04 |
Raspbian 을 처음 설치하면, 한글이 설치 되지 않아, Naver 에 접속해도 깨져보이고, 키보드의 한영키 를눌러도, 한글이 입력되지 않는다.
한글 폰트 및 한글 입력기가 설치 되어 있지 않아서 그렇다.
한글 폰트를 설치하여, 깨지지 않게 보기 위한 방법
$ sudo apt-get install fonts-nanum
한글 입력을 하기 위한 방법
$ sudo apt-get install ibus-hangul
$ ibus-setup
ibus-setup 을 실행하면, 뜨는 창에서 Input Method 탭에서 Korean을 찾아 Add 하면된다.
ibus-hangul 은 일부 환경(티스토리)에서 띄어쓰기가 제멋대로 되는 문제가있다.ㅠ
그나마, iBusHangul Setup 에서 Commit in word unit 옵션을 활성화 하면 쓸 수 있는 정도가 되긴하는데, 완벽하진않다.
그래서 대안으로 설치한 uim!
문제없이 동작 잘 된다. 설치 방법
$ sudo apt-get install uim uim-byeoru
uim은 키보드입력기 일테고, byeoru 는 뭐지? 했는데, 한글입력을 위한 패키지 이름인가보다.
한영 전환은 shift+space
Rasbian qbittorrent-nox installation (0) | 2019.11.19 |
---|---|
SD card image backup (0) | 2018.10.12 |
SDcard Partition Resize (0) | 2018.08.21 |
RaspberryPi Remote Desktop Client (0) | 2018.06.01 |
Raspbian Install (0) | 2018.05.16 |
Raspbian installation on Raspberry Pi 3
Raspberry Pi 3 model B는 프로세서로 Broadcom BCM2837를 포함하고 있는데, 이는 ARM Cortex A-53 quad core를 포함한다.
Raspbian은 Raspberry Pi 를 위한 Debian based OS이다.
RaspberryPi 에는 다른 OS 보다 Raspbian 을 사용하는 것이 편리할 수 있다.
Raspbian 은 Rasberry Pi 사이트로 부터 다운 받을 수 있다.
2018년 5월 현재 Stable 버전인 RASPBIAN STRETCH WITH DESKTOP 을 다운 받으면 된다.
stretch는 Debian의 code name 이다.
zip 파일을 다운 받아 압축을 풀면(반디집 등으로 풀면 됨) .img 파일이 나온다.
다운받은 image 를 USB bunner중 하나인 Etcher 를 사용하여 USB 디스크를 만들면 된다.
Etcher는 https://etcher.io 에서 다운로드
Select image로 위에서 압축 풀어 나온 .img 파일을 선택하고
USB 장치는 자동으로 선택되는데, 잘 선택 되었는지 확인
Flash!를 하면 된다. 쉽다.
참조: https://www.raspberrypi.org/documentation/installation/installing-images/README.md
Rasbian qbittorrent-nox installation (0) | 2019.11.19 |
---|---|
SD card image backup (0) | 2018.10.12 |
SDcard Partition Resize (0) | 2018.08.21 |
RaspberryPi Remote Desktop Client (0) | 2018.06.01 |
Raspbian Korean(Hangul) Install (0) | 2018.05.18 |
Linux에서 백그라운드로 자동으로 실행하게끔 service를 등록할 수 있다.
현재 등록된 service 목록은 /etc/systemd/system 경로에 *.service 파일을 보면 확인 할 수 있다.
systemd는 Linux의 init system 중 하나로,
init system을 사용하는 가장 기본적인 이유는 Linux system 이 부팅 된 다음 User영역의 Component를 initialize 하기 위함이다.
또한 백그라운드에서 동작하는 daemon이나 서비스를 관리하기 위함이다.
간단하게, /etc/init.d 경로에 있는 script 등은 System V init, /etc/systemd/system 경로에 있는 *.service는 systemd 라고 생각하면 된다.
가장 간단하게 systemd를 추가하는 방법은 아래와 같은 파일을 /etc/systemd/system 경로에 추가 하면 된다.
파일 이름은 <service_name>.service
[Unit]
Description=<Description of your own service>
After=network.target
[Service]
ExecStart=<File would be executed with this service>
[Install]
WantedBy=multi-user.target
Description: 해당 service에 대한 설명으로, systemctl status로 확인 할 때 가장 첫 줄에 표현된다.
ExecStart: 실행할 파일의 절대경로
※위의 ExecStart 로 표기된 파일은 ./<file> & 와 비슷한 방식으로 구동되기 때문에, 실행되는 파일의 첫 줄에 해당 파일을 실행할 shell을 나타내는 shebang(#!)을 포함해줘야 한다.
<service_name.service 파일을 추가 한 후에는,
$ sudo systemctl daemon-reload
를 통해 새로운 모듈을 load 하고,
시작, 정지, 상태 확인은 아래와 같은 명령어로 할 수 있다.
$ sudo systemctl start <service_name>
$ sudo systemctl stop <service_name>
$ sudo systemctl restart <service_name>
$ sudo systemctl status <service_name>
부팅 시 자동으로 실행되게 하기 위해서는 아래와 같이 enable 하면 된다.
$ sudo systemctl enable <service_name>
$ sudo systemctl disable <service_name>
참조: https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units
Ctags (0) | 2018.07.03 |
---|---|
scp (0) | 2018.05.29 |
Linux tar, gz, bz2 (0) | 2018.04.25 |
Linux HDD mount (0) | 2018.04.06 |
HandBrakeCLI (0) | 2018.04.06 |
Linux 압축 하기/압축 풀기
Tape Archive
tar은 Tape Archive 의 약자로, 옛날부터 Tape 드라이브를 백업하기 위해 사용했다고 한다. tarball 이라고 불리기도 한다고 한다.
tar은 압축을 옵션으로 줄 수 있는데, gzip 으로 압축을 하면 tar.gz 파일이, bzip2로 압축하면 tar.bz2 가 생성된다.
tar command의 (사실은 상당히 많은 옵션을 가지고 있지만) 기본적인 옵션은 아래와 같다.
c : Create a new .tar file
v : Verbosely show the pregress
f : File name
x : Extract
t : List content
z : for gzip
j : for bzip2
간단 사용예
tar 압축 하기
$ tar -cvf <output_file_name>.tar <input_folder>
tar 압축 풀기
$ tar -xvf <input_file_name>.tar
tar.gz 압축 하기
$ tar -zcvf <output_file_name>.tar.gz <input_folder>
tar.gz 압축 풀기
$ tar -zxvf <input_file_name>.tar.gz
tar.bz2 압축 하기
$ tar -jcvf <output_file_name>.tar.bz2 <input_folder>
tar.bz2 압축 풀기
$ tar -jxvf <input_file_name>.tar.bz2
보다 자세한 내용은, https://www.tecmint.com/18-tar-command-examples-in-linux/ 참조
scp (0) | 2018.05.29 |
---|---|
Systemd Service (0) | 2018.05.04 |
Linux HDD mount (0) | 2018.04.06 |
HandBrakeCLI (0) | 2018.04.06 |
Linux sed (0) | 2018.02.05 |