本例子将在 ubuntu 16.04 64 bit 中使用 gcc 5.4.0 编译 Linux kernel 3.19。
## Checkout stable branch of Linux kernel
这里使用清华的stable kernel git remote repository。
```shell
$ git clone https://mirrors.tuna.tsinghua.edu.cn/git/linux-stable.git
```
确认库中存在kernel v3.19
```shell
$ git tag | grep v3.19 # 回显`v3.19`等
$ git checkout b319 -b v3.19 # 作为branch checkout
$ git branch # 确认当前branch
$ git log # 观察log确认为v3.19
```
## 以soc versatilepb为目标编译kernel
```shell
$ make ARCH=arm versatile_defconfig # configure for versatilepb
# -j5 : 5 threads
# CROSS_COMPILE: prefix of cross-compilation toolchain
$ make -j5 ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
```
编译后的kernel为 arch/arm/boot/zImage。
## Checkout stable branch of Linux kernel
这里使用清华的stable kernel git remote repository。
```shell
$ git clone https://mirrors.tuna.tsinghua.edu.cn/git/linux-stable.git
```
确认库中存在kernel v3.19
```shell
$ git tag | grep v3.19 # 回显`v3.19`等
$ git checkout b319 -b v3.19 # 作为branch checkout
$ git branch # 确认当前branch
$ git log # 观察log确认为v3.19
```
## 以soc versatilepb为目标编译kernel
```shell
$ make ARCH=arm versatile_defconfig # configure for versatilepb
# -j5 : 5 threads
# CROSS_COMPILE: prefix of cross-compilation toolchain
$ make -j5 ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
```
编译后的kernel为 arch/arm/boot/zImage。