summaryrefslogtreecommitdiff
path: root/schulung_tools/notes/linux-build-targets.txt
blob: dc6ecd75b0efb8b9243320cc221bd67e0a4a8b74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
============================
 Common Linux Build Targets
============================

help            (see almost all targets available)
*_defconfig     (kernel configuration)
menuconfig      (change kernel configuration)
savedefconfig   (convert the current configuration to a defconfig)
zImage          (build arm kernel)
modules         (build modules)
modules_install (install modules)
*.dtb           (compile the device tree)
clean           (delete all object files)


================
 Pre-Requisites
================

If you want to build and boot a kernel, you need the following:

- kernel source
- .config kernel configuration file (or defconfig)
- device tree (arm/powerpc only)


===============================
 Create Wrapper mk.sh for make
===============================

#!/bin/sh

# define prefix to toolchain commands
CROSS_COMPILE=/opt/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-

# define the architecture to build for
# (this is the directory-name in arch/ )
ARCH=arm

export CROSS_COMPILE ARCH

exec make $@


===========
 Procedure
===========

# unpack the kernel soruce
tar xJf ~/Downloads/linux-4.18.5.tar.xz

# change to kernel source directory
cd linux-4.18.5

# configure the kernel for vexpress boards
../mk.sh vexpress_defconfig

# perform custom changes to the configuration
../mk.sh menuconfig

# save the custom changes as a defconfig
../mk.sh savedefconfig

# copy the custom defconfig to the kernel sources
# (so it is available as a make target)
cp defconfig arch/arm/configs/myboard_defconfig

# build the kernel
../mk.sh -j 4 zImage

# build the device tree
../mk.sh vexpress-v2p-ca9.dtb

# the built kernel is here:      arch/arm/boot/zImage
# the built device tree is here: arch/arm/boot/dts/vexpress-v2p-ca9.dtb