pastebin - collaborative debugging tool
rovema.kpaste.net RSS

Difference between
modified post 4c9f by Anonymous on Tue 19th Dec 2023 14:56
original post f1237 by Anonymous on Tue 19th Dec 2023 13: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-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
#
3131
#
3232
# * simatic installation:
3333
# $ cp dist_files/simatic-ipc*.ko /lib/modules/6.6.5-rt16-rovema082/kernel/drivers/mfd/.
3434
# $ depmod
3535
# $ update-initramfs -k all -u
3636
#
3737
# * install closed-source firmware data:
3838
# $ cd /
3939
# $ 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
4040
# $ update-initramfs -k all -u
4141
#
4242
4343
#
4444
# Installation:
4545
#
4646
4747
#
4848
# Login into target machine:
4949
# $ ksh ~/work/nrubsigsvn/gisburn/scripts/sshnfs/sshnfs.ksh -o NFSURL=ssh+nfs://derfwpc5131/export/home2/rmainz target@fe80::d6f5:27ff:fe2b:4330%enp2s0
5050
#
5151
5252
#
5353
# Install updated Debian Jessie packages:
5454
# $ cd /mnt_nfs/work/jessie_target_packages/
55-
# dpkg -i *.deb
5655
# dpkg -i --force-conflicts console-*.deb # conflicts with "plymouth"
56+
# dpkg -i *.deb
5757
#
5858
5959
#
6060
# Update Linux kernel boot args in grub:
6161
# $ vi /etc/default/grub
6262
# 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"
6363
# $ update-grub
6464
#
6565
6666
#
6767
# fix binfmt (Debian 'Jessie' bug):
6868
# printf 'ksh\nmagic\n0\n\\x0B\\x13\\x08\n\n/bin/ksh\n\n\n\n\n' >'/var/lib/binfmts/ksh'
6969
#
7070
7171
7272
7373
7474
#
7575
# build Linux kernel v6.6.5-rt16
7676
#
7777
7878
function build_kernel
7979
{
8080
	set -o errexit
8181
	set -o nounset
8282
8383
	# subshell so CWD remains unchanged on return
8484
	(
8585
		mkdir builddir_kernel
8686
		cd builddir_kernel/
8787
8888
		git clone -b 'v6.6.5-rt16' git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git
8989
9090
		cd linux-rt-devel/
9191
		cp '../../myconfig_linux_v6_6_5_rt16.config' '.config'
9292
9393
		#
9494
		# fixme: add patches here
9595
		# - rt RCU patch
9696
		# - default boot args patch
9797
		# - i915 patches
9898
		# - rt udev dir
9999
		#
100100
101101
		time nice -n 19 ksh -c 'CC="gcc -m32" make -j2 bindeb-pkg 2>&1 | tee buildlog.log'
102102
103103
		cd ..
104104
105105
		cp linux-headers-*_i386.deb	"${c.dist_files_dir}/"
106106
		cp linux-image-*_i386.deb	"${c.dist_files_dir}/"
107107
		cp linux-libc-*_i386.deb	"${c.dist_files_dir}/"
108108
	)
109109
110110
	print '# build_kernel OK'
111111
112112
	return 0
113113
}
114114
115115
116116
#
117117
# build custom igb_avb module
118118
#
119119
function build_igbavb
120120
{
121121
	set -o errexit
122122
	set -o nounset
123123
124124
	# subshell so CWD remains unchanged on return
125125
	(
126126
		mkdir builddir_igbavb
127127
		cd builddir_igbavb/
128128
129129
		git clone https://github.com/Avnu/igb_avb.git
130130
131131
		cd igb_avb/
132132
133133
		# switch to commit 6c115ee89c88f6284d1407244b4a47586c3332d,
134134
		# which is known to work with Linux 6.6.5-RT16
135135
		git checkout '86c115ee89c88f6284d1407244b4a47586c3332d'
136136
137137
		#
138138
		# apply patches
139139
		#
140140
		# fixme:
141141
		# - pciid patch is missing
142142
		# - igb patches may need backport (bfp ?)
143143
		#
144144
		git am <'../../0001-libigb-Use-PTHREAD_PRIO_INHERIT-for-mutex-to-avoid-r.patch'
145145
		git am <'../../0002-Disable-pci_-_pcie_error_reporting-for-Linux-kernels.patch'
146146
147147
		#
148148
		# build kernel module
149149
		#
150150
		cd kmod/
151151
		CC="gcc -m32" make -j4 -C "$PWD/../../../builddir_kernel/linux-rt-devel/" KSRC="$PWD/../../../builddir_kernel/linux-rt-devel/" M=$PWD
152152
		cp igb_avb.ko	"${c.dist_files_dir}/"
153153
		cd ..
154154
155155
		#cp simatic-ipc*.ko /lib/modules/6.6.5-rt16-rovema082/kernel/drivers/mfd/.
156156
		# build libigb.a
157157
		#
158158
		cd lib
159159
		CC="gcc -m32" make all
160160
161161
		#
162162
		# build shared library vesion of libigb.a
163163
		#
164164
		gcc -m32 -shared -fPIC -o libigb.so -Wl,--whole-archive libigb.a -Wl,--no-whole-archive -lpthread
165165
		cp libigb.so	"${c.dist_files_dir}/"
166166
	)
167167
168168
	print '# build_igbavb OK'
169169
170170
	return 0
171171
}
172172
173173
function build_simatic
174174
{
175175
	set -o errexit
176176
	set -o nounset
177177
178178
	# subshell so CWD remains unchanged on return
179179
	(
180180
		mkdir builddir_simatic
181181
		cd builddir_simatic/
182182
183183
		svn checkout http://svn.rovema.de/repos/bootimage/branches/dev027_kernel5_15/rovema_simatickernelmodules/simatic-ipc-modules-lsp-v1.2.0RC1/
184184
		cd simatic-ipc-modules-lsp-v1.2.0RC1/
185185
		make -C "$PWD/../../builddir_kernel/linux-rt-devel/" KSRC="$PWD/../../builddir_kernel/linux-rt-devel/" M=$PWD
186186
187187
		cp ./simatic-ipc.ko		"${c.dist_files_dir}/"
188188
		cp ./simatic-ipc-leds.ko	"${c.dist_files_dir}/"
189189
		cp ./simatic-ipc-wdt.ko		"${c.dist_files_dir}/"
190190
		cp ./simatic-ipc-batt.ko	"${c.dist_files_dir}/"
191191
		cp ./simatic-ipc-sensors.ko	"${c.dist_files_dir}/"
192192
		cp ./simatic-ipc-ps.ko		"${c.dist_files_dir}/"
193193
		cp ./simatic-ipc-nvram.ko	"${c.dist_files_dir}/"
194194
	)
195195
196196
	print '# build_simatic OK'
197197
198198
	return 0
199199
}
200200
201201
function build_firmware_tarball
202202
{
203203
	set -o errexit
204204
	set -o nounset
205205
206206
	typeset -r linux_firmware_git_tag='20231211'
207207
	typeset -r tarball_filename="linux_firmware_git_lib_firmware_i915_${linux_firmware_git_tag}.tar.bz2"
208208
209209
	# subshell so CWD remains unchanged on return
210210
	(
211211
		mkdir build_firmware_tarball
212212
		cd build_firmware_tarball/
213213
214214
		git clone -b "${linux_firmware_git_tag}" git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
215215
		mkdir -p 'lib/firmware/i915'
216216
		ln linux-firmware/i915/* 'lib/firmware/i915/.'
217217
		tar -cvf - 'lib' | pbzip2 >"${tarball_filename}"
218218
		cp "${tarball_filename}" "${c.dist_files_dir}/"
219219
	)
220220
}
221221
222222
#
223223
# main
224224
#
225225
226226
# use ksh93 builtins
227227
export PATH="/opt/ast/bin/:/usr/ast/bin:$PATH"
228228
builtin mkdir
229229
230230
# keep all global script data in a compound variable
231231
# so we can use $ print -u2 -v c # for debugging
232232
compound c
233233
234234
typeset c.dist_files_dir="$PWD/dist_files"
235235
mkdir -p "${c.dist_files_dir}"
236236
237237
238238
#
239239
# build packages
240240
#
241241
build_kernel
242242
build_igbavb
243243
build_simatic
244244
build_firmware_tarball
245245
246246
#
247247
# list resulting packages
248248
#
249249
ls -l "${c.dist_files_dir}"
250250
251251
# EOF.
252252

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