pastebin - collaborative debugging tool
rovema.kpaste.net RSS

Difference between
modified post d3f422 by Anonymous on Tue 22nd Mar 2022 09:13
original post f502a9 by Anonymous on Wed 16th Mar 2022 14:30
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 igb_avb_src_gitbundle='/home/test001/work/dev_current/dev026/elbe/igb_avb/rovema_igb_avb_git20220302_001.bundle'
1315
1416
	# calculated values
1517
	typeset kernel_build_path
1618
)
1719
1820
function build_debian_kernel_from_src
1921
{
2022
	set -o xtrace
2123
	set -o errexit
2224
	set -o nounset
2325
2426
	integer res
2527
	integer num_cpus=$(getconf '_NPROCESSORS_CONF')
2628
2729
	tar xf "/usr/src/linux-source-${bconfig.kernel_maj_min}.tar.xz"
2830
2931
	cd "linux-source-${bconfig.kernel_maj_min}"
3032
3133
	unxz <"/usr/src/linux-patch-${bconfig.kernel_maj_min}-rt.patch.xz" | patch -p1
3234
3335
	cp "/usr/src/linux-config-${bconfig.kernel_maj_min}/config.amd64_rt_amd64.xz" .
3436
	unxz 'config.amd64_rt_amd64.xz'
3537
3638
	# copy config and make kernel build accept it without
3739
	# jumping to the $ make menu # menu
3840
	cp 'config.amd64_rt_amd64' '.config'
3941
	make oldconfig <'/dev/null'
4042
4143
	# show any modifications $ make oldconfig # did to the kernel config
4244
	print '--------------------------------------'
4345
	diff -u 'config.amd64_rt_amd64' '.config' || true
4446
	print '--------------------------------------'
4547
4648
	make clean
4749
	time nice -n 19 make -j$((num_cpus*2)) deb-pkg 2>&1 | tee -a buildlog.log
4850
	(( res=$? ))
4951
5052
	printf '#### Finished, return code = %d\n' res
5153
5254
	if (( res == 0 )) ; then
5355
		# remember the path to the kernel build, but only if we were successful
5456
		bconfig.kernel_build_path="$PWD"
5557
	fi
5658
5759
	return $res
5860
}
5961
6062
function build_simatic_kernel_modules
6163
{
6264
	set -o xtrace
6365
	set -o errexit
6466
	set -o nounset
6567
6668
	# dummy for now
6769
	#simatic-ipc-modules-lsp-v1.2.0RC1$ make -C /home/test001/work/kernel_test001/linux-5.10.52/ M=$PWD
6870
6971
	rm -Rf simatic_build
7072
	mkdir simatic_build
7173
	cd simatic_build
7274
73-
	cp /home/test001/work/dev_current/dev026/elbe/simatickernelmodules/rovema_simatickernelmodules_git20220304_001.bundle .
75+
	cp "${bconfig.simatic_src_gitbundle}" .
7476
	git clone rovema_simatickernelmodules_git20220304_001.bundle
7577
7678
	cd rovema_simatickernelmodules_git20220304_001/simatic-ipc-modules-lsp-v1.2.0RC1/
7779
	typeset kernel_build_path="$PWD/../../../linux-source-${bconfig.kernel_maj_min}"
7880
	make -C ${kernel_build_path} KSRC="${kernel_build_path}" M=$PWD
7981
8082
	#
8183
	# ToDo: Install in root/ dir, and turn that filesystem hieracy into a
8284
	# Debian package
8385
	#
8486
8587
	return 1
8688
}
8789
8890
8991
function build_igb_avb_kernel_module
9092
{
9193
	set -o xtrace
9294
	set -o errexit
9395
	set -o nounset
9496
9597
	rm -Rf igb_avb_build
9698
	mkdir igb_avb_build
9799
	cd igb_avb_build
98100
99-
	cp /home/test001/work/dev_current/dev026/elbe/igb_avb/rovema_igb_avb_git20220302_001.bundle .
101+
	cp "${bconfig.igb_avb_src_gitbundle}" .
100102
	git clone rovema_igb_avb_git20220302_001.bundle
101103
102104
	cd rovema_igb_avb_git20220302_001/kmod
103-
	typeset kernel_build_path="$PWD/../../../linux-source-${bconfig.kernel_maj_min}"
105+
	typeset kernel_build_path="$PWD/../../../../../../linux-source-${bconfig.kernel_maj_min}"
104106
	make -C ${kernel_build_path} KSRC="${kernel_build_path}" M=$PWD clean
105107
	make -C ${kernel_build_path} KSRC="${kernel_build_path}" M=$PWD
106108
107109
108110
	cd ../lib
109111
	make
110112
111113
	#
112114
	# ToDo: Install in root/ dir, and turn that filesystem hieracy into a
113115
	# Debian package
114116
	#
115117
116118
	# dummy for now
117119
118120
	return 1
119121
}
120122
121123
function main
122124
{
123125
	set -o xtrace
124126
	set -o errexit
125127
126128
#	build_debian_kernel_from_src
127-
	build_simatic_kernel_modules
129+
	build_simatic_kernel_modules || true
128-
#	build_igb_avb_kernel_module
130+
	build_igb_avb_kernel_module
129131
}
130132
131133
#
132134
# main
133135
#
134136
builtin getconf
135137
136138
main "$@"
137139
138140
# EOF.
139141

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