pastebin - collaborative debugging tool
rovema.kpaste.net RSS

Difference between
modified post d7702614 by Anonymous on Tue 19th Dec 2023 10:29
original post 7b3abd7e by Anonymous on Thu 14th Dec 2023 18:13
Download diff
Show old version | new version | both versions

    
11
#!/bin/ksh93
22
33
#
44
# build_rovema_kernel.ksh
55
#
6-
# worse-is-better/simpler rewrite for rovema-081 kernel
6+
# worse-is-better/simpler rewrite for rovema-082 kernel
77
#
88
# Written by Roland Mainz <roland.mainz@nrubsig.org>
99
#
1010
1111
1212
#
1313
# * igb_avb.ko installation:
1414
# igb_avb kernel module must be manually installed on the target system, and the igb.ko kernel module removed
15-
# $ dist_files/igb_avb.ko /lib/modules/6.6.5-rt16-rovema082/kernel/drivers/net/ethernet/intel/igb/.
15+
# $ cp dist_files/igb_avb.ko /lib/modules/6.6.5-rt16-rovema082/kernel/drivers/net/ethernet/intel/igb/.
1616
# $ mv /lib/modules/6.6.5-rt16-rovema082/kernel/drivers/net/ethernet/intel/igb/igb.ko /root/igb.ko_disabled
1717
# $ depmod
1818
# $ update-initramfs -k all -u
1919
2020
#
2121
#
2222
# * simatic installation:
2323
# $ cp dist_files/simatic-ipc*.ko /lib/modules/6.6.5-rt16-rovema082/kernel/drivers/mfd/.
2424
# $ depmod
2525
# $ update-initramfs -k all -u
2626
#
2727
# * install closed-source firmware data:
2828
# $ cd /
2929
# $ 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
3030
# $ update-initramfs -k all -u
3131
#
3232
3333
3434
#
3535
# build Linux kernel v6.6.5-rt16
3636
#
3737
3838
function build_kernel
3939
{
4040
	set -o errexit
4141
	set -o nounset
4242
4343
	# subshell so CWD remains unchanged on return
4444
	(
4545
		mkdir builddir_kernel
4646
		cd builddir_kernel/
4747
4848
		git clone -b 'v6.6.5-rt16' git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git
4949
5050
		cd linux-rt-devel/
5151
		cp '../../myconfig_linux_v6_6_5_rt16.config' '.config'
5252
5353
		#
5454
		# fixme: add patches here
5555
		# - rt RCU patch
5656
		# - default boot args patch
5757
		# - i915 patches
5858
		# - rt udev dir
5959
		#
6060
6161
		time nice -n 19 ksh -c 'CC="gcc -m32" make -j2 bindeb-pkg 2>&1 | tee buildlog.log'
6262
6363
		cd ..
6464
6565
		cp linux-headers-*_i386.deb	"${c.dist_files_dir}/"
6666
		cp linux-image-*_i386.deb	"${c.dist_files_dir}/"
6767
		cp linux-libc-*_i386.deb	"${c.dist_files_dir}/"
6868
	)
6969
7070
	print '# build_kernel OK'
7171
7272
	return 0
7373
}
7474
7575
7676
#
7777
# build custom igb_avb module
7878
#
7979
function build_igbavb
8080
{
8181
	set -o errexit
8282
	set -o nounset
8383
8484
	# subshell so CWD remains unchanged on return
8585
	(
8686
		mkdir builddir_igbavb
8787
		cd builddir_igbavb/
8888
8989
		git clone https://github.com/Avnu/igb_avb.git
9090
9191
		cd igb_avb/
9292
9393
		# switch to commit 6c115ee89c88f6284d1407244b4a47586c3332d,
9494
		# which is known to work with Linux 6.6.5-RT16
9595
		git checkout '86c115ee89c88f6284d1407244b4a47586c3332d'
9696
9797
		#
9898
		# apply patches
9999
		#
100100
		# fixme:
101101
		# - pciid patch is missing
102102
		# - igb patches may need backport (bfp ?)
103103
		#
104104
		git am <'../../0001-libigb-Use-PTHREAD_PRIO_INHERIT-for-mutex-to-avoid-r.patch'
105105
		git am <'../../0002-Disable-pci_-_pcie_error_reporting-for-Linux-kernels.patch'
106106
107107
		#
108108
		# build kernel module
109109
		#
110110
		cd kmod/
111111
		CC="gcc -m32" make -j4 -C "$PWD/../../../builddir_kernel/linux-rt-devel/" KSRC="$PWD/../../../builddir_kernel/linux-rt-devel/" M=$PWD
112112
		cp igb_avb.ko	"${c.dist_files_dir}/"
113113
		cd ..
114114
115115
		#cp simatic-ipc*.ko /lib/modules/6.6.5-rt16-rovema082/kernel/drivers/mfd/.
116116
		# build libigb.a
117117
		#
118118
		cd lib
119119
		CC="gcc -m32" make all
120120
121121
		#
122122
		# build shared library vesion of libigb.a
123123
		#
124124
		gcc -m32 -shared -fPIC -o libigb.so -Wl,--whole-archive libigb.a -Wl,--no-whole-archive -lpthread
125125
		cp libigb.so	"${c.dist_files_dir}/"
126126
	)
127127
128128
	print '# build_igbavb OK'
129129
130130
	return 0
131131
}
132132
133133
function build_simatic
134134
{
135135
	set -o errexit
136136
	set -o nounset
137137
138138
	# subshell so CWD remains unchanged on return
139139
	(
140140
		mkdir builddir_simatic
141141
		cd builddir_simatic/
142142
143143
		svn checkout http://svn.rovema.de/repos/bootimage/branches/dev027_kernel5_15/rovema_simatickernelmodules/simatic-ipc-modules-lsp-v1.2.0RC1/
144144
		cd simatic-ipc-modules-lsp-v1.2.0RC1/
145145
		make -C "$PWD/../../builddir_kernel/linux-rt-devel/" KSRC="$PWD/../../builddir_kernel/linux-rt-devel/" M=$PWD
146146
147147
		cp ./simatic-ipc.ko		"${c.dist_files_dir}/"
148148
		cp ./simatic-ipc-leds.ko	"${c.dist_files_dir}/"
149149
		cp ./simatic-ipc-wdt.ko		"${c.dist_files_dir}/"
150150
		cp ./simatic-ipc-batt.ko	"${c.dist_files_dir}/"
151151
		cp ./simatic-ipc-sensors.ko	"${c.dist_files_dir}/"
152152
		cp ./simatic-ipc-ps.ko		"${c.dist_files_dir}/"
153153
		cp ./simatic-ipc-nvram.ko	"${c.dist_files_dir}/"
154154
	)
155155
156156
	print '# build_simatic OK'
157157
158158
	return 0
159159
}
160160
161161
function build_firmware_tarball
162162
{
163163
	set -o errexit
164164
	set -o nounset
165165
166166
	typeset -r linux_firmware_git_tag='20231211'
167167
	typeset -r tarball_filename="linux_firmware_git_lib_firmware_i915_${linux_firmware_git_tag}.tar.bz2"
168168
169169
	# subshell so CWD remains unchanged on return
170170
	(
171171
		mkdir build_firmware_tarball
172172
		cd build_firmware_tarball/
173173
174174
		git clone -b "${linux_firmware_git_tag}" git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
175175
		mkdir -p 'lib/firmware/i915'
176176
		ln linux-firmware/i915/* 'lib/firmware/i915/.'
177177
		tar -cvf - 'lib' | pbzip2 >"${tarball_filename}"
178178
		cp "${tarball_filename}" "${c.dist_files_dir}/"
179179
	)
180180
}
181181
182182
#
183183
# main
184184
#
185185
186186
# use ksh93 builtins
187187
export PATH="/opt/ast/bin/:/usr/ast/bin:$PATH"
188188
builtin mkdir
189189
190190
# keep all global script data in a compound variable
191191
# so we can use $ print -u2 -v c # for debugging
192192
compound c
193193
194194
typeset c.dist_files_dir="$PWD/dist_files"
195195
mkdir -p "${c.dist_files_dir}"
196196
197197
198198
#
199199
# build packages
200200
#
201201
build_kernel
202202
build_igbavb
203203
build_simatic
204204
build_firmware_tarball
205205
206206
#
207207
# list resulting packages
208208
#
209209
ls -l "${c.dist_files_dir}"
210210
211211
# EOF.
212212

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