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