Difference between
modified post 28f by Anonymous on Thu 10th Mar 2022 12:23
original post f84c4b8d by Anonymous on Thu 10th Mar 2022 11:51
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 | - | set -o xtrace | |
| 10 | + | compound bconfig=( | |
| 11 | - | set -o errexit | |
| 11 | + | # config | |
| 12 | + | typeset kernel_maj_min='5.10' | |
| 12 | 13 | ||
| 13 | - | integer num_cpus=$(getconf '_NPROCESSORS_CONF') | |
| 14 | + | # calculated values | |
| 15 | + | typeset kernel_build_path | |
| 14 | 17 | ||
| 15 | - | # mkdir try5 && cd try5/ | |
| 18 | + | function build_debian_kernel_from_src | |
| 19 | + | { | |
| 16 | 23 | ||
| 17 | - | tar xf /usr/src/linux-source-5.10.tar.xz | |
| 24 | + | integer res | |
| 25 | + | integer num_cpus=$(getconf '_NPROCESSORS_CONF') | |
| 18 | 26 | ||
| 19 | - | cd linux-source-5.10 | |
| 27 | + | tar xf "/usr/src/linux-source-${bconfig.kernel_maj_min}.tar.xz" | |
| 20 | 28 | ||
| 21 | - | unxz </usr/src/linux-patch-5.10-rt.patch.xz | patch -p1 | |
| 29 | + | cd "linux-source-${bconfig.kernel_maj_min}" | |
| 22 | 30 | ||
| 23 | - | cp /usr/src/linux-config-5.10/config.amd64_rt_amd64.xz . | |
| 31 | + | unxz <"/usr/src/linux-patch-${bconfig.kernel_maj_min}-rt.patch.xz" | patch -p1 | |
| 25 | 32 | ||
| 33 | + | cp "/usr/src/linux-config-${bconfig.kernel_maj_min}/config.amd64_rt_amd64.xz" . | |
| 26 | 36 | # copy config and make kernel build accept it without | |
| 27 | 37 | # jumping to the $ make menu # menu | |
| 28 | - | cp config.amd64_rt_amd64 .config | |
| 38 | + | cp 'config.amd64_rt_amd64' '.config' | |
| 29 | 39 | make oldconfig <'/dev/null' | |
| 30 | 40 | ||
| 41 | + | # show any modifications $ make oldconfig # did to the kernel config | |
| 32 | 45 | ||
| 46 | + | make clean | |
| 33 | 47 | time nice -n 19 make -j$((num_cpus*2)) deb-pkg 2>&1 | tee -a buildlog.log | |
| 48 | + | (( res=$? )) | |
| 34 | 49 | ||
| 35 | - | print '#### Finished!!' | |
| 50 | + | printf '#### Finished, return code = %d\n' res | |
| 37 | 51 | ||
| 38 | - | ||
| 52 | + | if (( res == 0 )) ; then | |
| 39 | - | ||
| 53 | + | # remember the path to the kernel build, but only if we were successful | |
| 40 | - | ||
| 54 | + | bconfig.kernel_build_path="$PWD" | |
| 41 | - | ||
| 55 | + | fi | |
| 42 | 56 | ||
| 43 | - | ||
| 57 | + | return $res | |
| 44 | - | ||
| 58 | + | } | |
| 45 | 59 | ||
| 46 | - | ||
| 60 | + | function build_simatic_kernel_modules | |
| 47 | - | ||
| 61 | + | { | |
| 48 | - | ||
| 62 | + | set -o xtrace | |
| 49 | - | ||
| 63 | + | set -o errexit | |
| 50 | - | ||
| 64 | + | set -o nounset | |
| 51 | 65 | ||
| 52 | - | ||
| 66 | + | cd "${bconfig.kernel_build_path}" | |
| 53 | 67 | ||
| 54 | - | ||
| 68 | + | # dummy for now | |
| 55 | - | ||
| 69 | + | #simatic-ipc-modules-lsp-v1.2.0RC1$ make -C /home/test001/work/kernel_test001/linux-5.10.52/ M=$PWD | |
| 56 | - | ||
| 70 | + | return 1 | |
| 57 | - | ||
| 71 | + | } | |
| 58 | 72 | ||
| 59 | 73 | ||
| 60 | - | ||
| 74 | + | function build_igb_avb_kernel_module | |
| 61 | - | ||
| 75 | + | { | |
| 62 | - | ||
| 76 | + | set -o xtrace | |
| 63 | - | ||
| 77 | + | set -o errexit | |
| 64 | - | ||
| 78 | + | set -o nounset | |
| 65 | 79 | ||
| 66 | - | ||
| 80 | + | cd "${bconfig.kernel_build_path}" | |
| 67 | 81 | ||
| 68 | - | ||
| 82 | + | # dummy for now | |
| 69 | 83 | ||
| 70 | - | ||
| 84 | + | return 1 | |
| 71 | - | ||
| 85 | + | } | |
| 72 | 86 | ||
| 73 | - | ||
| 87 | + | function main | |
| 74 | - | ||
| 88 | + | { | |
| 75 | - | ||
| 89 | + | set -o xtrace | |
| 76 | - | ||
| 90 | + | set -o errexit | |
| 77 | 91 | ||
| 78 | - | ||
| 92 | + | build_debian_kernel_from_src | |
| 79 | - | ||
| 93 | + | build_simatic_kernel_modules | |
| 80 | - | ||
| 94 | + | build_igb_avb_kernel_module | |
| 81 | - | ||
| 95 | + | } | |
| 82 | 96 | ||
| 83 | - | ||
| 97 | + | # | |
| 84 | - | ||
| 98 | + | # main | |
| 85 | - | ||
| 99 | + | # | |
| 86 | - | ||
| 100 | + | builtin getconf | |
| 87 | 101 | ||
| 88 | - | ||
| 102 | + | main "$@" | |
| 89 | 103 | ||
| 90 | - | ||
| 104 | + | # EOF. | |
| 91 | 105 |
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