Difference between
modified post d3f422 by Anonymous on Tue 22nd Mar 2022 09:13
original post f502a9 by Anonymous on Wed 16th Mar 2022 14:30
Download diff
Show
old version |
new version |
both versions
| 1 | 1 | #!/usr/bin/ksh93 | |
| 2 | 2 | ||
| 3 | 3 | # | |
| 4 | 4 | # Build Debian RT kernel from source, | |
| 5 | 5 | # and retain the kernel build including source and *.o | |
| 6 | 6 | # files so we can build custom kernel modules from | |
| 7 | 7 | # that | |
| 8 | 8 | # | |
| 9 | 9 | ||
| 10 | 10 | compound bconfig=( | |
| 11 | 11 | # config | |
| 12 | 12 | typeset kernel_maj_min='5.10' | |
| 13 | + | typeset igb_avb_src_gitbundle='/home/test001/work/dev_current/dev026/elbe/igb_avb/rovema_igb_avb_git20220302_001.bundle' | |
| 13 | 15 | ||
| 14 | 16 | # calculated values | |
| 15 | 17 | typeset kernel_build_path | |
| 16 | 18 | ) | |
| 17 | 19 | ||
| 18 | 20 | function build_debian_kernel_from_src | |
| 19 | 21 | { | |
| 20 | 22 | set -o xtrace | |
| 21 | 23 | set -o errexit | |
| 22 | 24 | set -o nounset | |
| 23 | 25 | ||
| 24 | 26 | integer res | |
| 25 | 27 | integer num_cpus=$(getconf '_NPROCESSORS_CONF') | |
| 26 | 28 | ||
| 27 | 29 | tar xf "/usr/src/linux-source-${bconfig.kernel_maj_min}.tar.xz" | |
| 28 | 30 | ||
| 29 | 31 | cd "linux-source-${bconfig.kernel_maj_min}" | |
| 30 | 32 | ||
| 31 | 33 | unxz <"/usr/src/linux-patch-${bconfig.kernel_maj_min}-rt.patch.xz" | patch -p1 | |
| 32 | 34 | ||
| 33 | 35 | cp "/usr/src/linux-config-${bconfig.kernel_maj_min}/config.amd64_rt_amd64.xz" . | |
| 34 | 36 | unxz 'config.amd64_rt_amd64.xz' | |
| 35 | 37 | ||
| 36 | 38 | # copy config and make kernel build accept it without | |
| 37 | 39 | # jumping to the $ make menu # menu | |
| 38 | 40 | cp 'config.amd64_rt_amd64' '.config' | |
| 39 | 41 | make oldconfig <'/dev/null' | |
| 40 | 42 | ||
| 41 | 43 | # show any modifications $ make oldconfig # did to the kernel config | |
| 42 | 44 | print '--------------------------------------' | |
| 43 | 45 | diff -u 'config.amd64_rt_amd64' '.config' || true | |
| 44 | 46 | print '--------------------------------------' | |
| 45 | 47 | ||
| 46 | 48 | make clean | |
| 47 | 49 | time nice -n 19 make -j$((num_cpus*2)) deb-pkg 2>&1 | tee -a buildlog.log | |
| 48 | 50 | (( res=$? )) | |
| 49 | 51 | ||
| 50 | 52 | printf '#### Finished, return code = %d\n' res | |
| 51 | 53 | ||
| 52 | 54 | if (( res == 0 )) ; then | |
| 53 | 55 | # remember the path to the kernel build, but only if we were successful | |
| 54 | 56 | bconfig.kernel_build_path="$PWD" | |
| 55 | 57 | fi | |
| 56 | 58 | ||
| 57 | 59 | return $res | |
| 58 | 60 | } | |
| 59 | 61 | ||
| 60 | 62 | function build_simatic_kernel_modules | |
| 61 | 63 | { | |
| 62 | 64 | set -o xtrace | |
| 63 | 65 | set -o errexit | |
| 64 | 66 | set -o nounset | |
| 65 | 67 | ||
| 66 | 68 | # dummy for now | |
| 67 | 69 | #simatic-ipc-modules-lsp-v1.2.0RC1$ make -C /home/test001/work/kernel_test001/linux-5.10.52/ M=$PWD | |
| 68 | 70 | ||
| 69 | 71 | rm -Rf simatic_build | |
| 70 | 72 | mkdir simatic_build | |
| 71 | 73 | cd simatic_build | |
| 72 | 74 | ||
| 73 | - | cp /home/test001/work/dev_current/dev026/elbe/simatickernelmodules/rovema_simatickernelmodules_git20220304_001.bundle . | |
| 75 | + | cp "${bconfig.simatic_src_gitbundle}" . | |
| 74 | 76 | git clone rovema_simatickernelmodules_git20220304_001.bundle | |
| 75 | 77 | ||
| 76 | 78 | cd rovema_simatickernelmodules_git20220304_001/simatic-ipc-modules-lsp-v1.2.0RC1/ | |
| 77 | 79 | typeset kernel_build_path="$PWD/../../../linux-source-${bconfig.kernel_maj_min}" | |
| 78 | 80 | make -C ${kernel_build_path} KSRC="${kernel_build_path}" M=$PWD | |
| 79 | 81 | ||
| 80 | 82 | # | |
| 81 | 83 | # ToDo: Install in root/ dir, and turn that filesystem hieracy into a | |
| 82 | 84 | # Debian package | |
| 83 | 85 | # | |
| 84 | 86 | ||
| 85 | 87 | return 1 | |
| 86 | 88 | } | |
| 87 | 89 | ||
| 88 | 90 | ||
| 89 | 91 | function build_igb_avb_kernel_module | |
| 90 | 92 | { | |
| 91 | 93 | set -o xtrace | |
| 92 | 94 | set -o errexit | |
| 93 | 95 | set -o nounset | |
| 94 | 96 | ||
| 95 | 97 | rm -Rf igb_avb_build | |
| 96 | 98 | mkdir igb_avb_build | |
| 97 | 99 | cd igb_avb_build | |
| 98 | 100 | ||
| 99 | - | cp /home/test001/work/dev_current/dev026/elbe/igb_avb/rovema_igb_avb_git20220302_001.bundle . | |
| 101 | + | cp "${bconfig.igb_avb_src_gitbundle}" . | |
| 100 | 102 | git clone rovema_igb_avb_git20220302_001.bundle | |
| 101 | 103 | ||
| 102 | 104 | cd rovema_igb_avb_git20220302_001/kmod | |
| 103 | - | typeset kernel_build_path="$PWD/../../../linux-source-${bconfig.kernel_maj_min}" | |
| 105 | + | typeset kernel_build_path="$PWD/../../../../../../linux-source-${bconfig.kernel_maj_min}" | |
| 104 | 106 | make -C ${kernel_build_path} KSRC="${kernel_build_path}" M=$PWD clean | |
| 105 | 107 | make -C ${kernel_build_path} KSRC="${kernel_build_path}" M=$PWD | |
| 106 | 108 | ||
| 107 | 109 | ||
| 108 | 110 | cd ../lib | |
| 109 | 111 | make | |
| 110 | 112 | ||
| 111 | 113 | # | |
| 112 | 114 | # ToDo: Install in root/ dir, and turn that filesystem hieracy into a | |
| 113 | 115 | # Debian package | |
| 114 | 116 | # | |
| 115 | 117 | ||
| 116 | 118 | # dummy for now | |
| 117 | 119 | ||
| 118 | 120 | return 1 | |
| 119 | 121 | } | |
| 120 | 122 | ||
| 121 | 123 | function main | |
| 122 | 124 | { | |
| 123 | 125 | set -o xtrace | |
| 124 | 126 | set -o errexit | |
| 125 | 127 | ||
| 126 | 128 | # build_debian_kernel_from_src | |
| 127 | - | build_simatic_kernel_modules | |
| 129 | + | build_simatic_kernel_modules || true | |
| 128 | - | # build_igb_avb_kernel_module | |
| 130 | + | build_igb_avb_kernel_module | |
| 129 | 131 | } | |
| 130 | 132 | ||
| 131 | 133 | # | |
| 132 | 134 | # main | |
| 133 | 135 | # | |
| 134 | 136 | builtin getconf | |
| 135 | 137 | ||
| 136 | 138 | main "$@" | |
| 137 | 139 | ||
| 138 | 140 | # EOF. | |
| 139 | 141 |
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