---
# System prepended metadata

title: 2020q1 Homework1 (lab0)
tags: [Linux Kernel Internals]

---

# 2020q1 Homework1 (lab0)
contributed by <`sunkist0429`>

課程 [Linux 核心設計 (Linux Kernel Internals)](http://wiki.csie.ncku.edu.tw/linux/schedule)
作業 [H01: lab0](https://hackmd.io/@sysprog/linux2020-lab0)

## 開發環境設定
* build-essential
* git-core
* valgrind
* cppcheck 
* clang-format
* aspell 
* colordiff 
* valgrind
* tig
```
$ sudo apt install build-essential git-core valgrind
$ sudo apt install cppcheck clang-format aspell colordiff valgrind
# tig 套件，更便利地瀏覽 git repository
```

## homework study
* get lab0-c 
```
git clone https://github.com/sysprog21/lab0-c
# after fork
git clone git@github.com:你的帳號名稱/lab0-c
```
* make
```
make
make clean
make check
make test
make SANITIZER=1
```

## Coding style
[clang-format](https://clang.llvm.org/docs/ClangFormat.html)

## Git
~~git commit -m~~ => git commit -a
### good commit message
* 用一行空白行分隔標題與內容
* 限制標題最多只有 50 字元
* 標題開頭要大寫
* 標題不以句點結尾
* 以祈使句撰寫標題
* 內文每行最多 72 字
* 用內文解釋 what 以及 why vs. how

## Valgrind 
```
# complier
gcc -o case1 -g case1.c
# verify with valgrind
valgrind -q --leak-check=full ./case1
```

###### tags: `Linux Kernel Internals`