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
| 1 | 1 | #!/bin/ksh93 | |
| 2 | 2 | ||
| 3 | 3 | # | |
| 4 | 4 | # build_rovema_kernel.ksh | |
| 5 | 5 | # | |
| 6 | 6 | # worse-is-better/simpler rewrite for rovema-088 kernel | |
| 7 | 7 | # | |
| 8 | 8 | # Written by Roland Mainz <roland.mainz@nrubsig.org> | |
| 9 | 9 | # | |
| 10 | 10 | ||
| 11 | 11 | # | |
| 12 | 12 | # * install new kernel | |
| 13 | 13 | # | |
| 14 | 14 | # $ mount -o remount,rw / | |
| 15 | 15 | # $ cd /mnt_nfs/work/debian_rt_kernel_src/linux_6_6_10_rt19/dist_files/ | |
| 16 | 16 | # $ dpkg -i *.deb | |
| 17 | 17 | # | |
| 18 | 18 | # remove old linux 4.9 kernel: | |
| 19 | 19 | # $ dpkg -r --force-depends linux-image-4.9.303-rt192 | |
| 20 | 20 | # | |
| 21 | 21 | ||
| 22 | 22 | # | |
| 23 | 23 | # * igb_avb.ko installation: | |
| 24 | 24 | # # igb_avb kernel module must be manually installed on the target system, and the igb.ko kernel module removed | |
| 25 | 25 | # $ cp dist_files/igb_avb.ko /lib/modules/6.6.10-rt19-rovema088/kernel/drivers/net/ethernet/intel/igb/. | |
| 26 | 26 | # $ mv /lib/modules/6.6.10-rt19-rovema088/kernel/drivers/net/ethernet/intel/igb/igb.ko /root/igb.ko_disabled | |
| 27 | 27 | # $ depmod | |
| 28 | 28 | # $ update-initramfs -k all -u | |
| 29 | 29 | # | |
| 30 | 30 | # $ 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 | |
| 31 | 31 | # | |
| 32 | 32 | # | |
| 33 | 33 | ||
| 34 | 34 | # | |
| 35 | 35 | # | |
| 36 | 36 | # * simatic installation: | |
| 37 | 37 | # $ cp dist_files/simatic-ipc*.ko /lib/modules/6.6.10-rt19-rovema088/kernel/drivers/mfd/. | |
| 38 | 38 | # $ depmod | |
| 39 | 39 | # $ update-initramfs -k all -u | |
| 40 | 40 | # | |
| 41 | 41 | # * install closed-source firmware data: | |
| 42 | 42 | # $ cd / | |
| 43 | 43 | # $ 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 | |
| 44 | 44 | # $ update-initramfs -k all -u | |
| 45 | 45 | # | |
| 46 | 46 | ||
| 47 | 47 | # | |
| 48 | 48 | # Installation: | |
| 49 | 49 | # | |
| 50 | 50 | ||
| 51 | 51 | # | |
| 52 | 52 | # Login into target machine: | |
| 53 | 53 | # $ ksh ~/work/nrubsigsvn/gisburn/scripts/sshnfs/sshnfs.ksh -o NFSURL=ssh+nfs://derfwpc5131/export/home2/rmainz target@fe80::d6f5:27ff:fe2b:4330%enp2s0 | |
| 54 | 54 | # | |
| 55 | 55 | ||
| 56 | 56 | # | |
| 57 | 57 | # Install updated Debian Jessie packages: | |
| 58 | 58 | # $ cd /mnt_nfs/work/jessie_target_packages/ | |
| 59 | 59 | # dpkg -i --force-conflicts console-*.deb # conflicts with "plymouth" | |
| 60 | 60 | # dpkg -i *.deb | |
| 61 | 61 | # | |
| 62 | 62 | ||
| 63 | 63 | # | |
| 64 | 64 | # Update Linux kernel boot args in grub: | |
| 65 | 65 | # $ vi /etc/default/grub | |
| 66 | 66 | # 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" | |
| 67 | 67 | # $ update-grub | |
| 68 | 68 | # | |
| 69 | 69 | ||
| 70 | 70 | # | |
| 71 | 71 | # fix binfmt (Debian 'Jessie' bug): | |
| 72 | 72 | # printf 'ksh\nmagic\n0\n\\x0B\\x13\\x08\n\n/bin/ksh\n\n\n\n\n' >'/var/lib/binfmts/ksh' | |
| 73 | 73 | # | |
| 74 | 74 | ||
| 75 | 75 | ||
| 76 | 76 | ||
| 77 | 77 | ||
| 78 | 78 | # | |
| 79 | 79 | # build Linux kernel v6.6.10-rt19 | |
| 80 | 80 | # | |
| 81 | 81 | ||
| 82 | 82 | function build_kernel | |
| 83 | 83 | { | |
| 84 | 84 | set -o errexit | |
| 85 | 85 | set -o nounset | |
| 86 | 86 | ||
| 87 | 87 | # subshell so CWD remains unchanged on return | |
| 88 | 88 | ( | |
| 89 | 89 | mkdir builddir_kernel | |
| 90 | 90 | cd builddir_kernel/ | |
| 91 | 91 | ||
| 92 | 92 | git clone -b 'v6.6.10-rt19' git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git | |
| 93 | 93 | ||
| 94 | 94 | cd linux-rt-devel/ | |
| 95 | 95 | cp '../../myconfig_linux_v6_6_10_rt19.config' '.config' | |
| 96 | 96 | ||
| 97 | 97 | # | |
| 98 | 98 | # fixme: add patches here | |
| 99 | 99 | # - rt RCU patch | |
| 100 | 100 | # - default boot args patch | |
| 101 | 101 | # - i915 patches | |
| 102 | 102 | # - rt udev dir | |
| 103 | 103 | # | |
| 104 | 104 | ||
| 105 | 105 | time nice -n 19 chrt --idle 0 ksh -c 'CC="gcc -m32" make -j2 bindeb-pkg 2>&1 | tee buildlog.log' | |
| 106 | 106 | ||
| 107 | 107 | cd .. | |
| 108 | 108 | ||
| 109 | 109 | cp linux-headers-*_i386.deb "${c.dist_files_dir}/" | |
| 110 | 110 | cp linux-image-*_i386.deb "${c.dist_files_dir}/" | |
| 111 | 111 | cp linux-libc-*_i386.deb "${c.dist_files_dir}/" | |
| 112 | 112 | ) | |
| 113 | 113 | ||
| 114 | 114 | print '# build_kernel OK' | |
| 115 | 115 | ||
| 116 | 116 | return 0 | |
| 117 | 117 | } | |
| 118 | 118 | ||
| 119 | 119 | ||
| 120 | 120 | # | |
| 121 | 121 | # build custom igb_avb module | |
| 122 | 122 | # | |
| 123 | 123 | function build_igbavb | |
| 124 | 124 | { | |
| 125 | 125 | set -o errexit | |
| 126 | 126 | set -o nounset | |
| 127 | 127 | ||
| 128 | 128 | # subshell so CWD remains unchanged on return | |
| 129 | 129 | ( | |
| 130 | 130 | mkdir builddir_igbavb | |
| 131 | 131 | cd builddir_igbavb/ | |
| 132 | 132 | ||
| 133 | 133 | git clone https://github.com/Avnu/igb_avb.git | |
| 134 | 134 | git clone https://github.com/wheybags/glibc_version_header.git | |
| 135 | 135 | ||
| 136 | 136 | cd igb_avb/ | |
| 137 | 137 | ||
| 138 | - | # switch to commit 6c115ee89c88f6284d1407244b4a47586c3332d, | |
| 138 | + | # switch to commit 52ad70906fcb50d167475fe606aeb9631ca2b1fb, | |
| 139 | 139 | # which is known to work with Linux 6.6.10-rt19 | |
| 140 | - | git checkout '86c115ee89c88f6284d1407244b4a47586c3332d' | |
| 140 | + | git checkout '52ad70906fcb50d167475fe606aeb9631ca2b1fb' | |
| 141 | 141 | ||
| 142 | 142 | # | |
| 143 | 143 | # apply patches | |
| 144 | 144 | # | |
| 145 | 145 | # fixme: | |
| 146 | 146 | # - pciid patch is missing | |
| 147 | 147 | # - igb patches may need backport (bfp ?) | |
| 148 | 148 | # | |
| 149 | 149 | git am <'../../0001-libigb-Use-PTHREAD_PRIO_INHERIT-for-mutex-to-avoid-r.patch' | |
| 150 | 150 | git am <'../../0002-Disable-pci_-_pcie_error_reporting-for-Linux-kernels.patch' | |
| 151 | 151 | ||
| 152 | 152 | # | |
| 153 | 153 | # build kernel module | |
| 154 | 154 | # | |
| 155 | 155 | 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 | |
| 157 | 157 | cp igb_avb.ko "${c.dist_files_dir}/" | |
| 158 | 158 | cd .. | |
| 159 | 159 | ||
| 160 | 160 | #cp simatic-ipc*.ko /lib/modules/6.6.10-rt19-rovema088/kernel/drivers/mfd/. | |
| 161 | 161 | # build libigb.a | |
| 162 | 162 | # | |
| 163 | 163 | cd lib | |
| 164 | 164 | CC="gcc -m32 -pthread -include $PWD/../../glibc_version_header/version_headers/x86/force_link_glibc_2.18.h" make all | |
| 165 | 165 | ||
| 166 | 166 | # | |
| 167 | 167 | # build shared library vesion of libigb.a | |
| 168 | 168 | # | |
| 169 | 169 | gcc -m32 -pthread -shared -fPIC -o libigb_avb.so -Wl,--whole-archive libigb.a -Wl,--no-whole-archive -lpthread -lrt | |
| 170 | 170 | ||
| 171 | 171 | # make sure we do not pick up libc symbols beyond glibc 2.19 | |
| 172 | 172 | glibcversymmatch="$(strings 'libigb_avb.so' | grep -E 'GLIBC_2\.[2-9][0-9]')" || true | |
| 173 | 173 | if [[ "${glibcversymmatch}" != '' ]] ; then | |
| 174 | 174 | print -u2 -f '# build_igbavb: glibc ELF ref for glibc > 2.19 found: %q\n' "$glibcversymmatch" | |
| 175 | 175 | return 1 | |
| 176 | 176 | fi | |
| 177 | 177 | ||
| 178 | 178 | cp libigb_avb.so "${c.dist_files_dir}/." | |
| 179 | 179 | ) | |
| 180 | 180 | ||
| 181 | 181 | print '# build_igbavb OK' | |
| 182 | 182 | ||
| 183 | 183 | return 0 | |
| 184 | 184 | } | |
| 185 | 185 | ||
| 186 | 186 | function build_simatic | |
| 187 | 187 | { | |
| 188 | 188 | set -o errexit | |
| 189 | 189 | set -o nounset | |
| 190 | 190 | ||
| 191 | 191 | # subshell so CWD remains unchanged on return | |
| 192 | 192 | ( | |
| 193 | 193 | mkdir builddir_simatic | |
| 194 | 194 | cd builddir_simatic/ | |
| 195 | 195 | ||
| 196 | 196 | svn checkout http://svn.rovema.de/repos/bootimage/branches/dev027_kernel5_15/rovema_simatickernelmodules/simatic-ipc-modules-lsp-v1.2.0RC1/ | |
| 197 | 197 | cd simatic-ipc-modules-lsp-v1.2.0RC1/ | |
| 198 | 198 | make -C "$PWD/../../builddir_kernel/linux-rt-devel/" KSRC="$PWD/../../builddir_kernel/linux-rt-devel/" M=$PWD | |
| 199 | 199 | ||
| 200 | 200 | cp ./simatic-ipc.ko "${c.dist_files_dir}/" | |
| 201 | 201 | cp ./simatic-ipc-leds.ko "${c.dist_files_dir}/" | |
| 202 | 202 | cp ./simatic-ipc-wdt.ko "${c.dist_files_dir}/" | |
| 203 | 203 | cp ./simatic-ipc-batt.ko "${c.dist_files_dir}/" | |
| 204 | 204 | cp ./simatic-ipc-sensors.ko "${c.dist_files_dir}/" | |
| 205 | 205 | cp ./simatic-ipc-ps.ko "${c.dist_files_dir}/" | |
| 206 | 206 | cp ./simatic-ipc-nvram.ko "${c.dist_files_dir}/" | |
| 207 | 207 | ) | |
| 208 | 208 | ||
| 209 | 209 | print '# build_simatic OK' | |
| 210 | 210 | ||
| 211 | 211 | return 0 | |
| 212 | 212 | } | |
| 213 | 213 | ||
| 214 | 214 | function build_firmware_tarball | |
| 215 | 215 | { | |
| 216 | 216 | set -o errexit | |
| 217 | 217 | set -o nounset | |
| 218 | 218 | ||
| 219 | 219 | typeset -r linux_firmware_git_tag='20231211' | |
| 220 | 220 | typeset -r tarball_filename="linux_firmware_git_lib_firmware_i915_${linux_firmware_git_tag}.tar.bz2" | |
| 221 | 221 | ||
| 222 | 222 | # subshell so CWD remains unchanged on return | |
| 223 | 223 | ( | |
| 224 | 224 | mkdir build_firmware_tarball | |
| 225 | 225 | cd build_firmware_tarball/ | |
| 226 | 226 | ||
| 227 | 227 | git clone -b "${linux_firmware_git_tag}" git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git | |
| 228 | 228 | mkdir -p 'lib/firmware/i915' | |
| 229 | 229 | ln linux-firmware/i915/* 'lib/firmware/i915/.' | |
| 230 | 230 | tar -cvf - 'lib' | pbzip2 >"${tarball_filename}" | |
| 231 | 231 | cp "${tarball_filename}" "${c.dist_files_dir}/" | |
| 232 | 232 | ) | |
| 233 | 233 | } | |
| 234 | 234 | ||
| 235 | 235 | # | |
| 236 | 236 | # main | |
| 237 | 237 | # | |
| 238 | 238 | ||
| 239 | 239 | # use ksh93 builtins | |
| 240 | 240 | export PATH="/opt/ast/bin/:/usr/ast/bin:$PATH" | |
| 241 | 241 | builtin mkdir | |
| 242 | 242 | ||
| 243 | 243 | # keep all global script data in a compound variable | |
| 244 | 244 | # so we can use $ print -u2 -v c # for debugging | |
| 245 | 245 | compound c | |
| 246 | 246 | ||
| 247 | 247 | typeset c.dist_files_dir="$PWD/dist_files" | |
| 248 | 248 | mkdir -p "${c.dist_files_dir}" | |
| 249 | 249 | ||
| 250 | 250 | ||
| 251 | 251 | # | |
| 252 | 252 | # build packages | |
| 253 | 253 | # | |
| 254 | - | build_kernel | |
| 254 | + | #build_kernel | |
| 255 | 255 | build_igbavb | |
| 256 | - | build_simatic | |
| 256 | + | #build_simatic | |
| 257 | - | build_firmware_tarball | |
| 257 | + | #build_firmware_tarball | |
| 258 | 258 | ||
| 259 | 259 | # | |
| 260 | 260 | # list resulting packages | |
| 261 | 261 | # | |
| 262 | 262 | ls -l "${c.dist_files_dir}" | |
| 263 | 263 | ||
| 264 | 264 | # EOF. | |
| 265 | 265 |
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.
rovema.kpaste.net RSS