pastebin - collaborative debugging tool
rovema.kpaste.net RSS

Difference between
modified post 4bec58 by Anonymous on Fri 11th Mar 2022 09:29
original post 28f by Anonymous on Thu 10th Mar 2022 12:23
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
1010
compound bconfig=(
1111
	# config
1212
	typeset kernel_maj_min='5.10'
1313
1414
	# calculated values
1515
	typeset kernel_build_path
1616
)
1717
1818
function build_debian_kernel_from_src
1919
{
2020
	set -o xtrace
2121
	set -o errexit
2222
	set -o nounset
2323
2424
	integer res
2525
	integer num_cpus=$(getconf '_NPROCESSORS_CONF')
2626
2727
	tar xf "/usr/src/linux-source-${bconfig.kernel_maj_min}.tar.xz"
2828
2929
	cd "linux-source-${bconfig.kernel_maj_min}"
3030
3131
	unxz <"/usr/src/linux-patch-${bconfig.kernel_maj_min}-rt.patch.xz" | patch -p1
3232
3333
	cp "/usr/src/linux-config-${bconfig.kernel_maj_min}/config.amd64_rt_amd64.xz" .
3434
	unxz 'config.amd64_rt_amd64.xz'
3535
3636
	# copy config and make kernel build accept it without
3737
	# jumping to the $ make menu # menu
3838
	cp 'config.amd64_rt_amd64' '.config'
3939
	make oldconfig <'/dev/null'
4040
4141
	# show any modifications $ make oldconfig # did to the kernel config
4242
	print '--------------------------------------'
43-
	diff -u 'config.amd64_rt_amd64' '.config'
43+
	diff -u 'config.amd64_rt_amd64' '.config' || true
4444
	print '--------------------------------------'
4545
4646
	make clean
4747
	time nice -n 19 make -j$((num_cpus*2)) deb-pkg 2>&1 | tee -a buildlog.log
4848
	(( res=$? ))
4949
5050
	printf '#### Finished, return code = %d\n' res
5151
5252
	if (( res == 0 )) ; then
5353
		# remember the path to the kernel build, but only if we were successful
5454
		bconfig.kernel_build_path="$PWD"
5555
	fi
5656
5757
	return $res
5858
}
5959
6060
function build_simatic_kernel_modules
6161
{
6262
	set -o xtrace
6363
	set -o errexit
6464
	set -o nounset
6565
6666
	cd "${bconfig.kernel_build_path}"
6767
6868
	# dummy for now
6969
	#simatic-ipc-modules-lsp-v1.2.0RC1$ make -C /home/test001/work/kernel_test001/linux-5.10.52/ M=$PWD
7070
	return 1
7171
}
7272
7373
7474
function build_igb_avb_kernel_module
7575
{
7676
	set -o xtrace
7777
	set -o errexit
7878
	set -o nounset
7979
8080
	cd "${bconfig.kernel_build_path}"
8181
8282
	# dummy for now
8383
8484
	return 1
8585
}
8686
8787
function main
8888
{
8989
	set -o xtrace
9090
	set -o errexit
9191
9292
	build_debian_kernel_from_src
9393
	build_simatic_kernel_modules
9494
	build_igb_avb_kernel_module
9595
}
9696
9797
#
9898
# main
9999
#
100100
builtin getconf
101101
102102
main "$@"
103103
104104
# EOF.
105105

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