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
| 1 | 1 | #!/bin/ksh93 | |
| 2 | 2 | ||
| 3 | 3 | # | |
| 4 | 4 | # build_rovema_kernel.ksh | |
| 5 | 5 | # | |
| 6 | - | # worse-is-better/simpler rewrite for rovema-081 kernel | |
| 6 | + | # worse-is-better/simpler rewrite for rovema-082 kernel | |
| 7 | 7 | # | |
| 8 | 8 | # Written by Roland Mainz <roland.mainz@nrubsig.org> | |
| 9 | 9 | # | |
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | 12 | # | |
| 13 | 13 | # * igb_avb.ko installation: | |
| 14 | 14 | # 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/. | |
| 16 | 16 | # $ mv /lib/modules/6.6.5-rt16-rovema082/kernel/drivers/net/ethernet/intel/igb/igb.ko /root/igb.ko_disabled | |
| 17 | 17 | # $ depmod | |
| 18 | 18 | # $ update-initramfs -k all -u | |
| 19 | 19 | ||
| 20 | 20 | # | |
| 21 | 21 | # | |
| 22 | 22 | # * simatic installation: | |
| 23 | 23 | # $ cp dist_files/simatic-ipc*.ko /lib/modules/6.6.5-rt16-rovema082/kernel/drivers/mfd/. | |
| 24 | 24 | # $ depmod | |
| 25 | 25 | # $ update-initramfs -k all -u | |
| 26 | 26 | # | |
| 27 | 27 | # * install closed-source firmware data: | |
| 28 | 28 | # $ cd / | |
| 29 | 29 | # $ 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 | |
| 30 | 30 | # $ update-initramfs -k all -u | |
| 31 | 31 | # | |
| 32 | 32 | ||
| 33 | 33 | ||
| 34 | 34 | # | |
| 35 | 35 | # build Linux kernel v6.6.5-rt16 | |
| 36 | 36 | # | |
| 37 | 37 | ||
| 38 | 38 | function build_kernel | |
| 39 | 39 | { | |
| 40 | 40 | set -o errexit | |
| 41 | 41 | set -o nounset | |
| 42 | 42 | ||
| 43 | 43 | # subshell so CWD remains unchanged on return | |
| 44 | 44 | ( | |
| 45 | 45 | mkdir builddir_kernel | |
| 46 | 46 | cd builddir_kernel/ | |
| 47 | 47 | ||
| 48 | 48 | git clone -b 'v6.6.5-rt16' git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git | |
| 49 | 49 | ||
| 50 | 50 | cd linux-rt-devel/ | |
| 51 | 51 | cp '../../myconfig_linux_v6_6_5_rt16.config' '.config' | |
| 52 | 52 | ||
| 53 | 53 | # | |
| 54 | 54 | # fixme: add patches here | |
| 55 | 55 | # - rt RCU patch | |
| 56 | 56 | # - default boot args patch | |
| 57 | 57 | # - i915 patches | |
| 58 | 58 | # - rt udev dir | |
| 59 | 59 | # | |
| 60 | 60 | ||
| 61 | 61 | time nice -n 19 ksh -c 'CC="gcc -m32" make -j2 bindeb-pkg 2>&1 | tee buildlog.log' | |
| 62 | 62 | ||
| 63 | 63 | cd .. | |
| 64 | 64 | ||
| 65 | 65 | cp linux-headers-*_i386.deb "${c.dist_files_dir}/" | |
| 66 | 66 | cp linux-image-*_i386.deb "${c.dist_files_dir}/" | |
| 67 | 67 | cp linux-libc-*_i386.deb "${c.dist_files_dir}/" | |
| 68 | 68 | ) | |
| 69 | 69 | ||
| 70 | 70 | print '# build_kernel OK' | |
| 71 | 71 | ||
| 72 | 72 | return 0 | |
| 73 | 73 | } | |
| 74 | 74 | ||
| 75 | 75 | ||
| 76 | 76 | # | |
| 77 | 77 | # build custom igb_avb module | |
| 78 | 78 | # | |
| 79 | 79 | function build_igbavb | |
| 80 | 80 | { | |
| 81 | 81 | set -o errexit | |
| 82 | 82 | set -o nounset | |
| 83 | 83 | ||
| 84 | 84 | # subshell so CWD remains unchanged on return | |
| 85 | 85 | ( | |
| 86 | 86 | mkdir builddir_igbavb | |
| 87 | 87 | cd builddir_igbavb/ | |
| 88 | 88 | ||
| 89 | 89 | git clone https://github.com/Avnu/igb_avb.git | |
| 90 | 90 | ||
| 91 | 91 | cd igb_avb/ | |
| 92 | 92 | ||
| 93 | 93 | # switch to commit 6c115ee89c88f6284d1407244b4a47586c3332d, | |
| 94 | 94 | # which is known to work with Linux 6.6.5-RT16 | |
| 95 | 95 | git checkout '86c115ee89c88f6284d1407244b4a47586c3332d' | |
| 96 | 96 | ||
| 97 | 97 | # | |
| 98 | 98 | # apply patches | |
| 99 | 99 | # | |
| 100 | 100 | # fixme: | |
| 101 | 101 | # - pciid patch is missing | |
| 102 | 102 | # - igb patches may need backport (bfp ?) | |
| 103 | 103 | # | |
| 104 | 104 | git am <'../../0001-libigb-Use-PTHREAD_PRIO_INHERIT-for-mutex-to-avoid-r.patch' | |
| 105 | 105 | git am <'../../0002-Disable-pci_-_pcie_error_reporting-for-Linux-kernels.patch' | |
| 106 | 106 | ||
| 107 | 107 | # | |
| 108 | 108 | # build kernel module | |
| 109 | 109 | # | |
| 110 | 110 | cd kmod/ | |
| 111 | 111 | CC="gcc -m32" make -j4 -C "$PWD/../../../builddir_kernel/linux-rt-devel/" KSRC="$PWD/../../../builddir_kernel/linux-rt-devel/" M=$PWD | |
| 112 | 112 | cp igb_avb.ko "${c.dist_files_dir}/" | |
| 113 | 113 | cd .. | |
| 114 | 114 | ||
| 115 | 115 | #cp simatic-ipc*.ko /lib/modules/6.6.5-rt16-rovema082/kernel/drivers/mfd/. | |
| 116 | 116 | # build libigb.a | |
| 117 | 117 | # | |
| 118 | 118 | cd lib | |
| 119 | 119 | CC="gcc -m32" make all | |
| 120 | 120 | ||
| 121 | 121 | # | |
| 122 | 122 | # build shared library vesion of libigb.a | |
| 123 | 123 | # | |
| 124 | 124 | gcc -m32 -shared -fPIC -o libigb.so -Wl,--whole-archive libigb.a -Wl,--no-whole-archive -lpthread | |
| 125 | 125 | cp libigb.so "${c.dist_files_dir}/" | |
| 126 | 126 | ) | |
| 127 | 127 | ||
| 128 | 128 | print '# build_igbavb OK' | |
| 129 | 129 | ||
| 130 | 130 | return 0 | |
| 131 | 131 | } | |
| 132 | 132 | ||
| 133 | 133 | function build_simatic | |
| 134 | 134 | { | |
| 135 | 135 | set -o errexit | |
| 136 | 136 | set -o nounset | |
| 137 | 137 | ||
| 138 | 138 | # subshell so CWD remains unchanged on return | |
| 139 | 139 | ( | |
| 140 | 140 | mkdir builddir_simatic | |
| 141 | 141 | cd builddir_simatic/ | |
| 142 | 142 | ||
| 143 | 143 | svn checkout http://svn.rovema.de/repos/bootimage/branches/dev027_kernel5_15/rovema_simatickernelmodules/simatic-ipc-modules-lsp-v1.2.0RC1/ | |
| 144 | 144 | cd simatic-ipc-modules-lsp-v1.2.0RC1/ | |
| 145 | 145 | make -C "$PWD/../../builddir_kernel/linux-rt-devel/" KSRC="$PWD/../../builddir_kernel/linux-rt-devel/" M=$PWD | |
| 146 | 146 | ||
| 147 | 147 | cp ./simatic-ipc.ko "${c.dist_files_dir}/" | |
| 148 | 148 | cp ./simatic-ipc-leds.ko "${c.dist_files_dir}/" | |
| 149 | 149 | cp ./simatic-ipc-wdt.ko "${c.dist_files_dir}/" | |
| 150 | 150 | cp ./simatic-ipc-batt.ko "${c.dist_files_dir}/" | |
| 151 | 151 | cp ./simatic-ipc-sensors.ko "${c.dist_files_dir}/" | |
| 152 | 152 | cp ./simatic-ipc-ps.ko "${c.dist_files_dir}/" | |
| 153 | 153 | cp ./simatic-ipc-nvram.ko "${c.dist_files_dir}/" | |
| 154 | 154 | ) | |
| 155 | 155 | ||
| 156 | 156 | print '# build_simatic OK' | |
| 157 | 157 | ||
| 158 | 158 | return 0 | |
| 159 | 159 | } | |
| 160 | 160 | ||
| 161 | 161 | function build_firmware_tarball | |
| 162 | 162 | { | |
| 163 | 163 | set -o errexit | |
| 164 | 164 | set -o nounset | |
| 165 | 165 | ||
| 166 | 166 | typeset -r linux_firmware_git_tag='20231211' | |
| 167 | 167 | typeset -r tarball_filename="linux_firmware_git_lib_firmware_i915_${linux_firmware_git_tag}.tar.bz2" | |
| 168 | 168 | ||
| 169 | 169 | # subshell so CWD remains unchanged on return | |
| 170 | 170 | ( | |
| 171 | 171 | mkdir build_firmware_tarball | |
| 172 | 172 | cd build_firmware_tarball/ | |
| 173 | 173 | ||
| 174 | 174 | git clone -b "${linux_firmware_git_tag}" git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git | |
| 175 | 175 | mkdir -p 'lib/firmware/i915' | |
| 176 | 176 | ln linux-firmware/i915/* 'lib/firmware/i915/.' | |
| 177 | 177 | tar -cvf - 'lib' | pbzip2 >"${tarball_filename}" | |
| 178 | 178 | cp "${tarball_filename}" "${c.dist_files_dir}/" | |
| 179 | 179 | ) | |
| 180 | 180 | } | |
| 181 | 181 | ||
| 182 | 182 | # | |
| 183 | 183 | # main | |
| 184 | 184 | # | |
| 185 | 185 | ||
| 186 | 186 | # use ksh93 builtins | |
| 187 | 187 | export PATH="/opt/ast/bin/:/usr/ast/bin:$PATH" | |
| 188 | 188 | builtin mkdir | |
| 189 | 189 | ||
| 190 | 190 | # keep all global script data in a compound variable | |
| 191 | 191 | # so we can use $ print -u2 -v c # for debugging | |
| 192 | 192 | compound c | |
| 193 | 193 | ||
| 194 | 194 | typeset c.dist_files_dir="$PWD/dist_files" | |
| 195 | 195 | mkdir -p "${c.dist_files_dir}" | |
| 196 | 196 | ||
| 197 | 197 | ||
| 198 | 198 | # | |
| 199 | 199 | # build packages | |
| 200 | 200 | # | |
| 201 | 201 | build_kernel | |
| 202 | 202 | build_igbavb | |
| 203 | 203 | build_simatic | |
| 204 | 204 | build_firmware_tarball | |
| 205 | 205 | ||
| 206 | 206 | # | |
| 207 | 207 | # list resulting packages | |
| 208 | 208 | # | |
| 209 | 209 | ls -l "${c.dist_files_dir}" | |
| 210 | 210 | ||
| 211 | 211 | # EOF. | |
| 212 | 212 |
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