pastebin - collaborative debugging tool
rovema.kpaste.net RSS

Difference between
modified post e517 by Anonymous on Mon 4th Apr 2022 09:15
original post 75a8dab by Anonymous on Mon 28th Mar 2022 13:23
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
	# 32bit == 'config.i386_rt_686-pae', 64bit == 'config.amd64_rt_amd64'
1414
	typeset kernel_config_name='config.amd64_rt_amd64'
15-
	typeset igb_avb_src_gitbundle='/home/test001/work/dev_current/dev026/elbe/igb_avb/rovema_igb_avb_git20220302_001.bundle'
15+
	typeset igb_avb_src_gitbundle='/home/rmainz/work/dev_current/dev026/elbe/igb_avb/rovema_igb_avb_git20220302_001.bundle'
16-
	typeset simatic_src_gitbundle='/home/test001/work/dev_current/dev026/elbe/simatickernelmodules/rovema_simatickernelmodules_git20220304_001.bundle'
16+
	typeset simatic_src_gitbundle='/home/rmainz/work/dev_current/dev026/elbe/simatickernelmodules/rovema_simatickernelmodules_git20220304_001.bundle'
1717
1818
	# calculated values
1919
	typeset kernel_build_path
2020
)
2121
2222
function build_debian_kernel_from_src
2323
{
2424
	set -o xtrace
2525
	set -o errexit
2626
	set -o nounset
2727
2828
	integer res
2929
	integer num_cpus=$(getconf '_NPROCESSORS_CONF')
3030
3131
	tar xf "/usr/src/linux-source-${bconfig.kernel_maj_min}.tar.xz"
3232
3333
	cd "linux-source-${bconfig.kernel_maj_min}"
3434
3535
	unxz <"/usr/src/linux-patch-${bconfig.kernel_maj_min}-rt.patch.xz" | patch -p1
3636
3737
	cp "/usr/src/linux-config-${bconfig.kernel_maj_min}/${bconfig.kernel_config_name}.xz" .
3838
	unxz "${bconfig.kernel_config_name}.xz"
3939
4040
	# copy config and make kernel build accept it without
4141
	# jumping to the $ make menu # menu
4242
	cp "${bconfig.kernel_config_name}" '.config'
4343
	make oldconfig <'/dev/null'
4444
4545
	# show any modifications $ make oldconfig # did to the kernel config
4646
	print '--------------------------------------'
4747
	diff -u "${bconfig.kernel_config_name}" '.config' || true
4848
	print '--------------------------------------'
4949
5050
	make clean
5151
	time nice -n 19 make -j$((num_cpus*4)) deb-pkg 2>&1 | tee -a buildlog.log
5252
	(( res=$? ))
5353
5454
	printf '#### Kernel build finished, return code = %d\n' res
5555
5656
	if (( res == 0 )) ; then
5757
		# remember the path to the kernel build, but only if we were successful
5858
		bconfig.kernel_build_path="$PWD/"
5959
	fi
6060
6161
	return $res
6262
}
6363
6464
function build_simatic_kernel_modules
6565
{
6666
	set -o xtrace
6767
	set -o errexit
6868
	set -o nounset
6969
7070
	# dummy for now
71-
	#simatic-ipc-modules-lsp-v1.2.0RC1$ make -C /home/test001/work/kernel_test001/linux-5.10.52/ M=$PWD
71+
	#simatic-ipc-modules-lsp-v1.2.0RC1$ make -C /home/rmainz/work/kernel_test001/linux-5.10.52/ M=$PWD
7272
7373
	rm -Rf simatic_build
7474
	mkdir simatic_build
7575
	cd simatic_build
7676
7777
	cp "${bconfig.simatic_src_gitbundle}" .
7878
	git clone rovema_simatickernelmodules_git20220304_001.bundle
7979
8080
	cd rovema_simatickernelmodules_git20220304_001/simatic-ipc-modules-lsp-v1.2.0RC1/
8181
	make -C "${bconfig.kernel_build_path}" KSRC="${bconfig.kernel_build_path}" M=$PWD
8282
8383
	#
8484
	# ToDo: Install in root/ dir, and turn that filesystem hieracy into a
8585
	# Debian package
8686
	# see https://unix.stackexchange.com/questions/30303/how-to-create-a-deb-file-manually
8787
	#
8888
8989
	return 1
9090
}
9191
9292
9393
function build_igb_avb_kernel_module
9494
{
9595
	set -o xtrace
9696
	set -o errexit
9797
	set -o nounset
9898
9999
	rm -Rf igb_avb_build
100100
	mkdir igb_avb_build
101101
	cd igb_avb_build
102102
103103
	cp "${bconfig.igb_avb_src_gitbundle}" .
104104
	git clone rovema_igb_avb_git20220302_001.bundle
105105
106106
	cd rovema_igb_avb_git20220302_001/kmod
107107
108108
	make -C "${bconfig.kernel_build_path}" KSRC="${bconfig.kernel_build_path}" M=$PWD clean
109109
	make -C ${bconfig.kernel_build_path} KSRC="${bconfig.kernel_build_path}" M=$PWD
110110
111111
112112
	cd ../lib
113113
	make
114114
115115
	#
116116
	# ToDo: Install in root/ dir, and turn that filesystem hieracy into a
117117
	# Debian package
118118
	#
119119
120120
	# dummy for now
121121
	# see https://unix.stackexchange.com/questions/30303/how-to-create-a-deb-file-manually
122122
123123
	return 1
124124
}
125125
126126
function main
127127
{
128128
	set -o xtrace
129129
	set -o errexit
130130
	set -o nounset
131131
132132
	typeset bbd="$PWD" # base build directory
133133
134134
	if (( 1 )) ; then
135135
		cd $bbd && build_debian_kernel_from_src
136136
	else
137137
		bconfig.kernel_build_path="$PWD/linux-source-${bconfig.kernel_maj_min}/"
138138
	fi
139139
	cd $bbd ; build_simatic_kernel_modules || true
140140
	cd $bbd ; build_igb_avb_kernel_module
141141
}
142142
143143
#
144144
# main
145145
#
146146
builtin getconf
147147
148148
main "$@"
149149
150150
# EOF.
151151

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