pastebin - collaborative debugging tool
rovema.kpaste.net RSS

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

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