pastebin - collaborative debugging tool
rovema.kpaste.net RSS

Difference between
modified post 95b544 by Anonymous on Mon 15th Jan 2024 11:04
original post b2e6364e by Anonymous on Wed 20th Dec 2023 14:51
Download diff
Show old version | new version | both versions

    
11
#!/bin/ksh93
22
33
#
44
# build_rovema_kernel.ksh
55
#
66
# worse-is-better/simpler rewrite for rovema-082 kernel
77
#
88
# Written by Roland Mainz <roland.mainz@nrubsig.org>
99
#
1010
1111
#
1212
# * install new kernel
1313
#
1414
# $ mount -o remount,rw /
1515
# $ cd /mnt_nfs/work/debian_rt_kernel_src/linux_6_6_5_rt16/dist_files/
1616
# $ dpkg -i *.deb
1717
#
1818
# remove old linux 4.9 kernel:
1919
# $ dpkg -r --force-depends linux-image-4.9.303-rt192
2020
#
2121
2222
#
2323
# * igb_avb.ko installation:
2424
# # igb_avb kernel module must be manually installed on the target system, and the igb.ko kernel module removed
2525
# $ cp dist_files/igb_avb.ko /lib/modules/6.6.5-rt16-rovema082/kernel/drivers/net/ethernet/intel/igb/.
2626
# $ mv /lib/modules/6.6.5-rt16-rovema082/kernel/drivers/net/ethernet/intel/igb/igb.ko /root/igb.ko_disabled
2727
# $ depmod
2828
# $ update-initramfs -k all -u
2929
#
3030
# $ cp /mnt_nfs/work/debian_rt_kernel_src/linux_6_6_5_rt16/dist_files/libigb.so /usr/lib/i386-linux-gnu/libigb_avb.so
3131
#
3232
#
3333
3434
#
3535
#
3636
# * simatic installation:
3737
# $ cp dist_files/simatic-ipc*.ko /lib/modules/6.6.5-rt16-rovema082/kernel/drivers/mfd/.
3838
# $ depmod
3939
# $ update-initramfs -k all -u
4040
#
4141
# * install closed-source firmware data:
4242
# $ cd /
4343
# $ tar -xf /mnt_nfs/work/debian_rt_kernel_src/linux_6_6_5_rt16/dist_files/linux_firmware_git_lib_firmware_i915_20231211.tar.bz2
4444
# $ update-initramfs -k all -u
4545
#
4646
4747
#
4848
# Installation:
4949
#
5050
5151
#
5252
# Login into target machine:
5353
# $ ksh ~/work/nrubsigsvn/gisburn/scripts/sshnfs/sshnfs.ksh -o NFSURL=ssh+nfs://derfwpc5131/export/home2/rmainz target@fe80::d6f5:27ff:fe2b:4330%enp2s0
5454
#
5555
5656
#
5757
# Install updated Debian Jessie packages:
5858
# $ cd /mnt_nfs/work/jessie_target_packages/
5959
# dpkg -i --force-conflicts console-*.deb # conflicts with "plymouth"
6060
# dpkg -i *.deb
6161
#
6262
6363
#
6464
# Update Linux kernel boot args in grub:
6565
# $ vi /etc/default/grub
6666
# GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_idle.max_cstate=0 processor.max_cstate=1 intel_pstate=disable nosoftlockup nmi_watchdog=0 idle=poll nohz=on i915.disable_power_well=0 i915.enable_rc6=0 i915.enable_dc=0 i915.enable_guc=2"
6767
# $ update-grub
6868
#
6969
7070
#
7171
# fix binfmt (Debian 'Jessie' bug):
7272
# printf 'ksh\nmagic\n0\n\\x0B\\x13\\x08\n\n/bin/ksh\n\n\n\n\n' >'/var/lib/binfmts/ksh'
7373
#
7474
7575
7676
7777
7878
#
7979
# build Linux kernel v6.6.5-rt16
8080
#
8181
8282
function build_kernel
8383
{
8484
	set -o errexit
8585
	set -o nounset
8686
8787
	# subshell so CWD remains unchanged on return
8888
	(
8989
		mkdir builddir_kernel
9090
		cd builddir_kernel/
9191
9292
		git clone -b 'v6.6.5-rt16' git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git
9393
9494
		cd linux-rt-devel/
9595
		cp '../../myconfig_linux_v6_6_5_rt16.config' '.config'
9696
9797
		#
9898
		# fixme: add patches here
9999
		# - rt RCU patch
100100
		# - default boot args patch
101101
		# - i915 patches
102102
		# - rt udev dir
103103
		#
104104
105105
		time nice -n 19 ksh -c 'CC="gcc -m32" make -j2 bindeb-pkg 2>&1 | tee buildlog.log'
106106
107107
		cd ..
108108
109109
		cp linux-headers-*_i386.deb	"${c.dist_files_dir}/"
110110
		cp linux-image-*_i386.deb	"${c.dist_files_dir}/"
111111
		cp linux-libc-*_i386.deb	"${c.dist_files_dir}/"
112112
	)
113113
114114
	print '# build_kernel OK'
115115
116116
	return 0
117117
}
118118
119119
120120
#
121121
# build custom igb_avb module
122122
#
123123
function build_igbavb
124124
{
125125
	set -o errexit
126126
	set -o nounset
127127
128128
	# subshell so CWD remains unchanged on return
129129
	(
130130
		mkdir builddir_igbavb
131131
		cd builddir_igbavb/
132132
133133
		git clone https://github.com/Avnu/igb_avb.git
134+
		git clone https://github.com/wheybags/glibc_version_header.git
134135
135136
		cd igb_avb/
136137
137138
		# switch to commit 6c115ee89c88f6284d1407244b4a47586c3332d,
138139
		# which is known to work with Linux 6.6.5-RT16
139140
		git checkout '86c115ee89c88f6284d1407244b4a47586c3332d'
140141
141142
		#
142143
		# apply patches
143144
		#
144145
		# fixme:
145146
		# - pciid patch is missing
146147
		# - igb patches may need backport (bfp ?)
147148
		#
148149
		git am <'../../0001-libigb-Use-PTHREAD_PRIO_INHERIT-for-mutex-to-avoid-r.patch'
149150
		git am <'../../0002-Disable-pci_-_pcie_error_reporting-for-Linux-kernels.patch'
150151
151152
		#
152153
		# build kernel module
153154
		#
154155
		cd kmod/
155156
		CC="gcc -m32" make -j4 -C "$PWD/../../../builddir_kernel/linux-rt-devel/" KSRC="$PWD/../../../builddir_kernel/linux-rt-devel/" M=$PWD
156157
		cp igb_avb.ko	"${c.dist_files_dir}/"
157158
		cd ..
158159
159160
		#cp simatic-ipc*.ko /lib/modules/6.6.5-rt16-rovema082/kernel/drivers/mfd/.
160161
		# build libigb.a
161162
		#
162163
		cd lib
163-
		CC="gcc -m32" make all
164+
		CC="gcc -m32 -pthread -include $PWD/../../glibc_version_header/version_headers/x86/force_link_glibc_2.18.h" make all
164165
165166
		#
166167
		# build shared library vesion of libigb.a
167168
		#
168-
		gcc -m32 -shared -fPIC -o libigb.so -Wl,--whole-archive libigb.a -Wl,--no-whole-archive -lpthread
169+
		gcc -m32 -pthread -shared -fPIC -o libigb_avb.so -Wl,--whole-archive libigb.a -Wl,--no-whole-archive -lpthread -lrt
171170
172-
	print '# build_igbavb OK'
171+
		# make sure we do not pick up libc symbols beyond glibc 2.19
172+
		glibcversymmatch="$(strings 'libigb_avb.so' | grep -E 'GLIBC_2\.[2-9][0-9]')" || true
173177
178+
		cp libigb_avb.so	"${c.dist_files_dir}/."
176180
181+
	print '# build_igbavb OK'
181182
183+
	return 0
186185
187-
		svn checkout http://svn.rovema.de/repos/bootimage/branches/dev027_kernel5_15/rovema_simatickernelmodules/simatic-ipc-modules-lsp-v1.2.0RC1/
186+
function build_simatic
188-
		cd simatic-ipc-modules-lsp-v1.2.0RC1/
187+
{
189-
		make -C "$PWD/../../builddir_kernel/linux-rt-devel/" KSRC="$PWD/../../builddir_kernel/linux-rt-devel/" M=$PWD
188+
	set -o errexit
189+
	set -o nounset
190190
191+
	# subshell so CWD remains unchanged on return
191200
		cp ./simatic-ipc.ko		"${c.dist_files_dir}/"
192201
		cp ./simatic-ipc-leds.ko	"${c.dist_files_dir}/"
193202
		cp ./simatic-ipc-wdt.ko		"${c.dist_files_dir}/"
194203
		cp ./simatic-ipc-batt.ko	"${c.dist_files_dir}/"
195204
		cp ./simatic-ipc-sensors.ko	"${c.dist_files_dir}/"
196205
		cp ./simatic-ipc-ps.ko		"${c.dist_files_dir}/"
197206
		cp ./simatic-ipc-nvram.ko	"${c.dist_files_dir}/"
198207
	)
199208
200209
	print '# build_simatic OK'
201210
202211
	return 0
203212
}
204213
205214
function build_firmware_tarball
206215
{
207216
	set -o errexit
208217
	set -o nounset
209218
210219
	typeset -r linux_firmware_git_tag='20231211'
211220
	typeset -r tarball_filename="linux_firmware_git_lib_firmware_i915_${linux_firmware_git_tag}.tar.bz2"
212221
213222
	# subshell so CWD remains unchanged on return
214223
	(
215224
		mkdir build_firmware_tarball
216225
		cd build_firmware_tarball/
217226
218227
		git clone -b "${linux_firmware_git_tag}" git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
219228
		mkdir -p 'lib/firmware/i915'
220229
		ln linux-firmware/i915/* 'lib/firmware/i915/.'
221230
		tar -cvf - 'lib' | pbzip2 >"${tarball_filename}"
222231
		cp "${tarball_filename}" "${c.dist_files_dir}/"
223232
	)
224233
}
225234
226235
#
227236
# main
228237
#
229238
230239
# use ksh93 builtins
231240
export PATH="/opt/ast/bin/:/usr/ast/bin:$PATH"
232241
builtin mkdir
233242
234243
# keep all global script data in a compound variable
235244
# so we can use $ print -u2 -v c # for debugging
236245
compound c
237246
238247
typeset c.dist_files_dir="$PWD/dist_files"
239248
mkdir -p "${c.dist_files_dir}"
240249
241250
242251
#
243252
# build packages
244253
#
245-
build_kernel
254+
#build_kernel
246255
build_igbavb
247-
build_simatic
256+
#build_simatic
248-
build_firmware_tarball
257+
#build_firmware_tarball
249258
250259
#
251260
# list resulting packages
252261
#
253262
ls -l "${c.dist_files_dir}"
254263
255264
# EOF.
256265

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