2
kern-bld.sh - build a kernel
4
kern-bld.sh [OPTIONS] kerneldirectory
6
This script will build a new, from scratch, kernel or update an existing kernel.
7
Run with the appropriate privileges it can also install the kernel. The two
8
directory parameters, which can be persisted, should point to the location of
9
the source and the location of the parallel build target. The kerneldirectory
10
specified on the command line is then appended to these paths. The config file
11
option, which can be persisted, should point to an existing kernel config file
12
which will be copied to the output directory.
14
When building a new kernel the following tasks are performed:-
16
a) make distclean is run.
18
b) a specified kernel config file is copied in as .config
20
c) make menuconfig is run so changes to the config can be made
22
d) lsmod is run ignoring Virtualbox modules, the output is then used in
24
e) make localmodconfig is run using the above lsmod output
26
f) the temporary lsmod input file is removed
28
g) make -jX is run where X is the concurrency parameter or -j --jobs value
30
When updating a kernel only make -jX is run.
33
-c, --config-file full path to the kernel config file to be copied in. Only
34
valid with -n option, not -u
36
-h, --help prints usage information
38
-i, --install install the kernel and kernel modules
40
-j, --jobs the number of parallel processes to use in the build
42
-n, --new build a new kernel from scratch using a new copy of the .config file
44
-o, --output-dir specify a build output directory
46
-p, --persist save the --output-dir, --source-dir, --jobs and --config-file
47
values for future defaults
49
-s, --source-dir specify a source directory
51
-u, --update update a previously built kernel
53
-V, --version prints version information
60
kern-bld.sh -ups /home/mg/kernel/source -o /home/mg/kernel/build stable
62
will build a kernel from source located in /home/mg/kernel/source/stable putting
63
the built objects in /home/mg/kernel/build/stable. It will also store the 2
64
parameters to use as defaults.
66
Written by Mark Grant.
68
Report bugs to <m.grant.prg@gmail.com>
70
Copyright 2016-2017 Mark Grant.
72
License GPLv3+: GNU GPL version 3 or later
74
<http://gnu.org/licenses/gpl.html>.
76
This is free software: you are free to change and redistribute it.
78
There is NO WARRANTY, to the extent permitted by law.