pastebin - collaborative debugging tool
rovema.kpaste.net RSS

Difference between
modified post 9ca by Anonymous on Wed 23rd Mar 2022 12:34
original post 215770fac3 by Anonymous on Tue 22nd Mar 2022 14:33
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'
13+
	typeset kernel_config_name='config.amd64_rt_amd64'
1314
	typeset igb_avb_src_gitbundle='/home/test001/work/dev_current/dev026/elbe/igb_avb/rovema_igb_avb_git20220302_001.bundle'
1415
	typeset simatic_src_gitbundle='/home/test001/work/dev_current/dev026/elbe/simatickernelmodules/rovema_simatickernelmodules_git20220304_001.bundle'
1516
1617
	# calculated values
1718
	typeset kernel_build_path
1819
)
1920
2021
function build_debian_kernel_from_src
2122
{
2223
	set -o xtrace
2324
	set -o errexit
2425
	set -o nounset
2526
2627
	integer res
2728
	integer num_cpus=$(getconf '_NPROCESSORS_CONF')
2829
2930
	tar xf "/usr/src/linux-source-${bconfig.kernel_maj_min}.tar.xz"
3031
3132
	cd "linux-source-${bconfig.kernel_maj_min}"
3233
3334
	unxz <"/usr/src/linux-patch-${bconfig.kernel_maj_min}-rt.patch.xz" | patch -p1
3435
35-
	cp "/usr/src/linux-config-${bconfig.kernel_maj_min}/config.amd64_rt_amd64.xz" .
36+
	cp "/usr/src/linux-config-${bconfig.kernel_maj_min}/${bconfig.kernel_config_name}.xz" .
36-
	unxz 'config.amd64_rt_amd64.xz'
37+
	unxz "${bconfig.kernel_config_name}.xz"
3738
3839
	# copy config and make kernel build accept it without
3940
	# jumping to the $ make menu # menu
40-
	cp 'config.amd64_rt_amd64' '.config'
41+
	cp "${bconfig.kernel_config_name}" '.config'
4142
	make oldconfig <'/dev/null'
4243
4344
	# show any modifications $ make oldconfig # did to the kernel config
4445
	print '--------------------------------------'
45-
	diff -u 'config.amd64_rt_amd64' '.config' || true
46+
	diff -u "${bconfig.kernel_config_name}" '.config' || true
4647
	print '--------------------------------------'
4748
4849
	make clean
49-
	time nice -n 19 make -j$((num_cpus*2)) deb-pkg 2>&1 | tee -a buildlog.log
50+
	time nice -n 19 make -j$((num_cpus*4)) deb-pkg 2>&1 | tee -a buildlog.log
5051
	(( res=$? ))
5152
5253
	printf '#### Kernel build finished, return code = %d\n' res
5354
5455
	if (( res == 0 )) ; then
5556
		# remember the path to the kernel build, but only if we were successful
5657
		bconfig.kernel_build_path="$PWD/"
5758
	fi
5859
5960
	return $res
6061
}
6162
6263
function build_simatic_kernel_modules
6364
{
6465
	set -o xtrace
6566
	set -o errexit
6667
	set -o nounset
6768
6869
	# dummy for now
6970
	#simatic-ipc-modules-lsp-v1.2.0RC1$ make -C /home/test001/work/kernel_test001/linux-5.10.52/ M=$PWD
7071
7172
	rm -Rf simatic_build
7273
	mkdir simatic_build
7374
	cd simatic_build
7475
7576
	cp "${bconfig.simatic_src_gitbundle}" .
7677
	git clone rovema_simatickernelmodules_git20220304_001.bundle
7778
7879
	cd rovema_simatickernelmodules_git20220304_001/simatic-ipc-modules-lsp-v1.2.0RC1/
7980
	make -C "${bconfig.kernel_build_path}" KSRC="${bconfig.kernel_build_path}" M=$PWD
8081
8182
	#
8283
	# ToDo: Install in root/ dir, and turn that filesystem hieracy into a
8384
	# Debian package
8485
	# see https://unix.stackexchange.com/questions/30303/how-to-create-a-deb-file-manually
8586
	#
8687
8788
	return 1
8889
}
8990
9091
9192
function build_igb_avb_kernel_module
9293
{
9394
	set -o xtrace
9495
	set -o errexit
9596
	set -o nounset
9697
9798
	rm -Rf igb_avb_build
9899
	mkdir igb_avb_build
99100
	cd igb_avb_build
100101
101102
	cp "${bconfig.igb_avb_src_gitbundle}" .
102103
	git clone rovema_igb_avb_git20220302_001.bundle
103104
104105
	cd rovema_igb_avb_git20220302_001/kmod
105106
106107
	make -C "${bconfig.kernel_build_path}" KSRC="${bconfig.kernel_build_path}" M=$PWD clean
107108
	make -C ${bconfig.kernel_build_path} KSRC="${bconfig.kernel_build_path}" M=$PWD
108109
109110
110111
	cd ../lib
111112
	make
112113
113114
	#
114115
	# ToDo: Install in root/ dir, and turn that filesystem hieracy into a
115116
	# Debian package
116117
	#
117118
118119
	# dummy for now
119120
	# see https://unix.stackexchange.com/questions/30303/how-to-create-a-deb-file-manually
120121
121122
	return 1
122123
}
123124
124125
function main
125126
{
126127
	set -o xtrace
127128
	set -o errexit
128129
129130
	if (( 0 )) ; then
130131
		build_debian_kernel_from_src
131132
	else
132133
		bconfig.kernel_build_path="$PWD/linux-source-${bconfig.kernel_maj_min}/"
133134
	fi
134135
	build_simatic_kernel_modules || true
135136
	build_igb_avb_kernel_module
136137
}
137138
138139
#
139140
# main
140141
#
141142
builtin getconf
142143
143144
main "$@"
144145
145146
# EOF.
146147

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