pastebin - collaborative debugging tool
rovema.kpaste.net RSS

Difference between
modified post 09623486f by Anonymous on Fri 26th Jan 2024 11:12
original post 449bb94f by Anonymous on Wed 24th Jan 2024 17:25
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-088 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_10_rt19/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.10-rt19-rovema088/kernel/drivers/net/ethernet/intel/igb/.
2626
# $ mv /lib/modules/6.6.10-rt19-rovema088/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_10_rt19/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.10-rt19-rovema088/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_10_rt19/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.10-rt19
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.10-rt19' 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_10_rt19.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 chrt --idle 0 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
134134
		git clone https://github.com/wheybags/glibc_version_header.git
135135
136136
		cd igb_avb/
137137
138-
		# switch to commit 6c115ee89c88f6284d1407244b4a47586c3332d,
138+
		# switch to commit 52ad70906fcb50d167475fe606aeb9631ca2b1fb,
139139
		# which is known to work with Linux 6.6.10-rt19
140-
		git checkout '86c115ee89c88f6284d1407244b4a47586c3332d'
140+
		git checkout '52ad70906fcb50d167475fe606aeb9631ca2b1fb'
141141
142142
		#
143143
		# apply patches
144144
		#
145145
		# fixme:
146146
		# - pciid patch is missing
147147
		# - igb patches may need backport (bfp ?)
148148
		#
149149
		git am <'../../0001-libigb-Use-PTHREAD_PRIO_INHERIT-for-mutex-to-avoid-r.patch'
150150
		git am <'../../0002-Disable-pci_-_pcie_error_reporting-for-Linux-kernels.patch'
151151
152152
		#
153153
		# build kernel module
154154
		#
155155
		cd kmod/
156-
		CC="gcc -m32" make -j4 -C "$PWD/../../../builddir_kernel/linux-rt-devel/" KSRC="$PWD/../../../builddir_kernel/linux-rt-devel/" M=$PWD
156+
		CC="gcc -m32" make -j2 -C "$PWD/../../../builddir_kernel/linux-rt-devel/" KSRC="$PWD/../../../builddir_kernel/linux-rt-devel/" M=$PWD
157157
		cp igb_avb.ko	"${c.dist_files_dir}/"
158158
		cd ..
159159
160160
		#cp simatic-ipc*.ko /lib/modules/6.6.10-rt19-rovema088/kernel/drivers/mfd/.
161161
		# build libigb.a
162162
		#
163163
		cd lib
164164
		CC="gcc -m32 -pthread -include $PWD/../../glibc_version_header/version_headers/x86/force_link_glibc_2.18.h" make all
165165
166166
		#
167167
		# build shared library vesion of libigb.a
168168
		#
169169
		gcc -m32 -pthread -shared -fPIC -o libigb_avb.so -Wl,--whole-archive libigb.a -Wl,--no-whole-archive -lpthread -lrt
170170
171171
		# make sure we do not pick up libc symbols beyond glibc 2.19
172172
		glibcversymmatch="$(strings 'libigb_avb.so' | grep -E 'GLIBC_2\.[2-9][0-9]')" || true
173173
		if [[ "${glibcversymmatch}" != '' ]] ; then
174174
			print -u2 -f '# build_igbavb: glibc ELF ref for glibc > 2.19 found: %q\n' "$glibcversymmatch"
175175
			return 1
176176
		fi
177177
178178
		cp libigb_avb.so	"${c.dist_files_dir}/."
179179
	)
180180
181181
	print '# build_igbavb OK'
182182
183183
	return 0
184184
}
185185
186186
function build_simatic
187187
{
188188
	set -o errexit
189189
	set -o nounset
190190
191191
	# subshell so CWD remains unchanged on return
192192
	(
193193
		mkdir builddir_simatic
194194
		cd builddir_simatic/
195195
196196
		svn checkout http://svn.rovema.de/repos/bootimage/branches/dev027_kernel5_15/rovema_simatickernelmodules/simatic-ipc-modules-lsp-v1.2.0RC1/
197197
		cd simatic-ipc-modules-lsp-v1.2.0RC1/
198198
		make -C "$PWD/../../builddir_kernel/linux-rt-devel/" KSRC="$PWD/../../builddir_kernel/linux-rt-devel/" M=$PWD
199199
200200
		cp ./simatic-ipc.ko		"${c.dist_files_dir}/"
201201
		cp ./simatic-ipc-leds.ko	"${c.dist_files_dir}/"
202202
		cp ./simatic-ipc-wdt.ko		"${c.dist_files_dir}/"
203203
		cp ./simatic-ipc-batt.ko	"${c.dist_files_dir}/"
204204
		cp ./simatic-ipc-sensors.ko	"${c.dist_files_dir}/"
205205
		cp ./simatic-ipc-ps.ko		"${c.dist_files_dir}/"
206206
		cp ./simatic-ipc-nvram.ko	"${c.dist_files_dir}/"
207207
	)
208208
209209
	print '# build_simatic OK'
210210
211211
	return 0
212212
}
213213
214214
function build_firmware_tarball
215215
{
216216
	set -o errexit
217217
	set -o nounset
218218
219219
	typeset -r linux_firmware_git_tag='20231211'
220220
	typeset -r tarball_filename="linux_firmware_git_lib_firmware_i915_${linux_firmware_git_tag}.tar.bz2"
221221
222222
	# subshell so CWD remains unchanged on return
223223
	(
224224
		mkdir build_firmware_tarball
225225
		cd build_firmware_tarball/
226226
227227
		git clone -b "${linux_firmware_git_tag}" git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
228228
		mkdir -p 'lib/firmware/i915'
229229
		ln linux-firmware/i915/* 'lib/firmware/i915/.'
230230
		tar -cvf - 'lib' | pbzip2 >"${tarball_filename}"
231231
		cp "${tarball_filename}" "${c.dist_files_dir}/"
232232
	)
233233
}
234234
235235
#
236236
# main
237237
#
238238
239239
# use ksh93 builtins
240240
export PATH="/opt/ast/bin/:/usr/ast/bin:$PATH"
241241
builtin mkdir
242242
243243
# keep all global script data in a compound variable
244244
# so we can use $ print -u2 -v c # for debugging
245245
compound c
246246
247247
typeset c.dist_files_dir="$PWD/dist_files"
248248
mkdir -p "${c.dist_files_dir}"
249249
250250
251251
#
252252
# build packages
253253
#
254-
build_kernel
254+
#build_kernel
255255
build_igbavb
256-
build_simatic
256+
#build_simatic
257-
build_firmware_tarball
257+
#build_firmware_tarball
258258
259259
#
260260
# list resulting packages
261261
#
262262
ls -l "${c.dist_files_dir}"
263263
264264
# EOF.
265265

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