pastebin - collaborative debugging tool
rovema.kpaste.net RSS

Difference between
modified post f502a9 by Anonymous on Wed 16th Mar 2022 14:30
original post 176d4285f by Anonymous on Wed 16th Mar 2022 14:18
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 '--------------------------------------'
4343
	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
	# dummy for now
6767
	#simatic-ipc-modules-lsp-v1.2.0RC1$ make -C /home/test001/work/kernel_test001/linux-5.10.52/ M=$PWD
6868
6969
	rm -Rf simatic_build
7070
	mkdir simatic_build
7171
	cd simatic_build
7272
7373
	cp /home/test001/work/dev_current/dev026/elbe/simatickernelmodules/rovema_simatickernelmodules_git20220304_001.bundle .
7474
	git clone rovema_simatickernelmodules_git20220304_001.bundle
7575
7676
	cd rovema_simatickernelmodules_git20220304_001/simatic-ipc-modules-lsp-v1.2.0RC1/
7777
	typeset kernel_build_path="$PWD/../../../linux-source-${bconfig.kernel_maj_min}"
7878
	make -C ${kernel_build_path} KSRC="${kernel_build_path}" M=$PWD
7979
8080
	#
8181
	# ToDo: Install in root/ dir, and turn that filesystem hieracy into a
8282
	# Debian package
8383
	#
8484
8585
	return 1
8686
}
8787
8888
8989
function build_igb_avb_kernel_module
9090
{
9191
	set -o xtrace
9292
	set -o errexit
9393
	set -o nounset
9494
9595
	rm -Rf igb_avb_build
9696
	mkdir igb_avb_build
9797
	cd igb_avb_build
9898
9999
	cp /home/test001/work/dev_current/dev026/elbe/igb_avb/rovema_igb_avb_git20220302_001.bundle .
100100
	git clone rovema_igb_avb_git20220302_001.bundle
101101
102102
	cd rovema_igb_avb_git20220302_001/kmod
103103
	typeset kernel_build_path="$PWD/../../../linux-source-${bconfig.kernel_maj_min}"
104104
	make -C ${kernel_build_path} KSRC="${kernel_build_path}" M=$PWD clean
105105
	make -C ${kernel_build_path} KSRC="${kernel_build_path}" M=$PWD
106106
107107
108108
	cd ../lib
109109
	make
110110
111111
	#
112112
	# ToDo: Install in root/ dir, and turn that filesystem hieracy into a
113113
	# Debian package
114114
	#
115115
116116
	# dummy for now
117117
118118
	return 1
119119
}
120120
121121
function main
122122
{
123123
	set -o xtrace
124124
	set -o errexit
125125
126126
#	build_debian_kernel_from_src
127127
	build_simatic_kernel_modules
128128
#	build_igb_avb_kernel_module
129129
}
130130
131131
#
132132
# main
133133
#
134134
builtin getconf
135135
136136
main "$@"
137137
138138
# EOF.
139139

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