pastebin - collaborative debugging tool
rovema.kpaste.net RSS

Difference between
modified post 28f by Anonymous on Thu 10th Mar 2022 12:23
original post f84c4b8d by Anonymous on Thu 10th Mar 2022 11:51
Download diff
Show old version | new version | both versions

    
11
#!/usr/bin/ksh93
22
33
#
44
# Build Debian RT kernel from source,
55
# and retain the kernel build including source and *.o
66
# files so we can build custom kernel modules from
77
# that
88
#
99
10-
set -o xtrace
10+
compound bconfig=(
11-
set -o errexit
11+
	# config
12+
	typeset kernel_maj_min='5.10'
1213
13-
integer num_cpus=$(getconf '_NPROCESSORS_CONF')
14+
	# calculated values
15+
	typeset kernel_build_path
1417
15-
# mkdir try5 && cd try5/
18+
function build_debian_kernel_from_src
19+
{
1623
17-
tar xf /usr/src/linux-source-5.10.tar.xz
24+
	integer res
25+
	integer num_cpus=$(getconf '_NPROCESSORS_CONF')
1826
19-
cd linux-source-5.10
27+
	tar xf "/usr/src/linux-source-${bconfig.kernel_maj_min}.tar.xz"
2028
21-
unxz </usr/src/linux-patch-5.10-rt.patch.xz | patch -p1
29+
	cd "linux-source-${bconfig.kernel_maj_min}"
2230
23-
cp /usr/src/linux-config-5.10/config.amd64_rt_amd64.xz .
31+
	unxz <"/usr/src/linux-patch-${bconfig.kernel_maj_min}-rt.patch.xz" | patch -p1
2532
33+
	cp "/usr/src/linux-config-${bconfig.kernel_maj_min}/config.amd64_rt_amd64.xz" .
2636
# copy config and make kernel build accept it without
2737
# jumping to the $ make menu # menu
28-
cp config.amd64_rt_amd64 .config
38+
	cp 'config.amd64_rt_amd64' '.config'
2939
make oldconfig <'/dev/null'
3040
41+
	# show any modifications $ make oldconfig # did to the kernel config
3245
46+
	make clean
3347
time nice -n 19 make -j$((num_cpus*2)) deb-pkg 2>&1 | tee -a buildlog.log
48+
	(( res=$? ))
3449
35-
print '#### Finished!!'
50+
	printf '#### Finished, return code = %d\n' res
3751
38-
52+
	if (( res == 0 )) ; then
39-
53+
		# remember the path to the kernel build, but only if we were successful
40-
54+
		bconfig.kernel_build_path="$PWD"
41-
55+
	fi
4256
43-
57+
	return $res
44-
58+
}
4559
46-
60+
function build_simatic_kernel_modules
47-
61+
{
48-
62+
	set -o xtrace
49-
63+
	set -o errexit
50-
64+
	set -o nounset
5165
52-
66+
	cd "${bconfig.kernel_build_path}"
5367
54-
68+
	# dummy for now
55-
69+
	#simatic-ipc-modules-lsp-v1.2.0RC1$ make -C /home/test001/work/kernel_test001/linux-5.10.52/ M=$PWD
56-
70+
	return 1
57-
71+
}
5872
5973
60-
74+
function build_igb_avb_kernel_module
61-
75+
{
62-
76+
	set -o xtrace
63-
77+
	set -o errexit
64-
78+
	set -o nounset
6579
66-
80+
	cd "${bconfig.kernel_build_path}"
6781
68-
82+
	# dummy for now
6983
70-
84+
	return 1
71-
85+
}
7286
73-
87+
function main
74-
88+
{
75-
89+
	set -o xtrace
76-
90+
	set -o errexit
7791
78-
92+
	build_debian_kernel_from_src
79-
93+
	build_simatic_kernel_modules
80-
94+
	build_igb_avb_kernel_module
81-
95+
}
8296
83-
97+
#
84-
98+
# main
85-
99+
#
86-
100+
builtin getconf
87101
88-
102+
main "$@"
89103
90-
104+
# EOF.
91105

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at