pastebin - collaborative debugging tool
rovema.kpaste.net RSS

Difference between
modified post 215770fac3 by Anonymous on Tue 22nd Mar 2022 14:33
original post d3f422 by Anonymous on Tue 22nd Mar 2022 09:13
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
	typeset igb_avb_src_gitbundle='/home/test001/work/dev_current/dev026/elbe/igb_avb/rovema_igb_avb_git20220302_001.bundle'
1414
	typeset simatic_src_gitbundle='/home/test001/work/dev_current/dev026/elbe/simatickernelmodules/rovema_simatickernelmodules_git20220304_001.bundle'
1515
1616
	# calculated values
1717
	typeset kernel_build_path
1818
)
1919
2020
function build_debian_kernel_from_src
2121
{
2222
	set -o xtrace
2323
	set -o errexit
2424
	set -o nounset
2525
2626
	integer res
2727
	integer num_cpus=$(getconf '_NPROCESSORS_CONF')
2828
2929
	tar xf "/usr/src/linux-source-${bconfig.kernel_maj_min}.tar.xz"
3030
3131
	cd "linux-source-${bconfig.kernel_maj_min}"
3232
3333
	unxz <"/usr/src/linux-patch-${bconfig.kernel_maj_min}-rt.patch.xz" | patch -p1
3434
3535
	cp "/usr/src/linux-config-${bconfig.kernel_maj_min}/config.amd64_rt_amd64.xz" .
3636
	unxz 'config.amd64_rt_amd64.xz'
3737
3838
	# copy config and make kernel build accept it without
3939
	# jumping to the $ make menu # menu
4040
	cp 'config.amd64_rt_amd64' '.config'
4141
	make oldconfig <'/dev/null'
4242
4343
	# show any modifications $ make oldconfig # did to the kernel config
4444
	print '--------------------------------------'
4545
	diff -u 'config.amd64_rt_amd64' '.config' || true
4646
	print '--------------------------------------'
4747
4848
	make clean
4949
	time nice -n 19 make -j$((num_cpus*2)) deb-pkg 2>&1 | tee -a buildlog.log
5050
	(( res=$? ))
5151
52-
	printf '#### Finished, return code = %d\n' res
52+
	printf '#### Kernel build finished, return code = %d\n' res
5353
5454
	if (( res == 0 )) ; then
5555
		# remember the path to the kernel build, but only if we were successful
56-
		bconfig.kernel_build_path="$PWD"
56+
		bconfig.kernel_build_path="$PWD/"
5757
	fi
5858
5959
	return $res
6060
}
6161
6262
function build_simatic_kernel_modules
6363
{
6464
	set -o xtrace
6565
	set -o errexit
6666
	set -o nounset
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
7171
	rm -Rf simatic_build
7272
	mkdir simatic_build
7373
	cd simatic_build
7474
7575
	cp "${bconfig.simatic_src_gitbundle}" .
7676
	git clone rovema_simatickernelmodules_git20220304_001.bundle
7777
7878
	cd rovema_simatickernelmodules_git20220304_001/simatic-ipc-modules-lsp-v1.2.0RC1/
79-
	typeset kernel_build_path="$PWD/../../../linux-source-${bconfig.kernel_maj_min}"
79+
	make -C "${bconfig.kernel_build_path}" KSRC="${bconfig.kernel_build_path}" M=$PWD
8180
8281
	#
8382
	# ToDo: Install in root/ dir, and turn that filesystem hieracy into a
8483
	# Debian package
84+
	# see https://unix.stackexchange.com/questions/30303/how-to-create-a-deb-file-manually
8585
	#
8686
8787
	return 1
8888
}
8989
9090
9191
function build_igb_avb_kernel_module
9292
{
9393
	set -o xtrace
9494
	set -o errexit
9595
	set -o nounset
9696
9797
	rm -Rf igb_avb_build
9898
	mkdir igb_avb_build
9999
	cd igb_avb_build
100100
101101
	cp "${bconfig.igb_avb_src_gitbundle}" .
102102
	git clone rovema_igb_avb_git20220302_001.bundle
103103
104104
	cd rovema_igb_avb_git20220302_001/kmod
105-
	typeset kernel_build_path="$PWD/../../../../../../linux-source-${bconfig.kernel_maj_min}"
106-
	make -C ${kernel_build_path} KSRC="${kernel_build_path}" M=$PWD clean
107-
	make -C ${kernel_build_path} KSRC="${kernel_build_path}" M=$PWD
108105
106+
	make -C "${bconfig.kernel_build_path}" KSRC="${bconfig.kernel_build_path}" M=$PWD clean
109108
109+
110110
	cd ../lib
111111
	make
112112
113113
	#
114114
	# ToDo: Install in root/ dir, and turn that filesystem hieracy into a
115115
	# Debian package
116116
	#
117117
118118
	# dummy for now
119+
	# see https://unix.stackexchange.com/questions/30303/how-to-create-a-deb-file-manually
119120
120121
	return 1
121122
}
122123
123124
function main
124125
{
125126
	set -o xtrace
126127
	set -o errexit
127128
128-
#	build_debian_kernel_from_src
129+
	if (( 0 )) ; then
130+
		build_debian_kernel_from_src
129134
	build_simatic_kernel_modules || true
130135
	build_igb_avb_kernel_module
131136
}
132137
133138
#
134139
# main
135140
#
136141
builtin getconf
137142
138143
main "$@"
139144
140145
# EOF.
141146

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