- #!/usr/bin/ksh93
- #
- # Build Debian RT kernel from source,
- # and retain the kernel build including source and *.o
- # files so we can build custom kernel modules from
- # that
- #
- compound bconfig=(
- # config
- typeset kernel_maj_min='5.10'
- # calculated values
- typeset kernel_build_path
- )
- function build_debian_kernel_from_src
- {
- set -o xtrace
- set -o errexit
- set -o nounset
- integer res
- integer num_cpus=$(getconf '_NPROCESSORS_CONF')
- tar xf "/usr/src/linux-source-${bconfig.kernel_maj_min}.tar.xz"
- cd "linux-source-${bconfig.kernel_maj_min}"
- unxz <"/usr/src/linux-patch-${bconfig.kernel_maj_min}-rt.patch.xz" | patch -p1
- cp "/usr/src/linux-config-${bconfig.kernel_maj_min}/config.amd64_rt_amd64.xz" .
- unxz 'config.amd64_rt_amd64.xz'
- # copy config and make kernel build accept it without
- # jumping to the $ make menu # menu
- cp 'config.amd64_rt_amd64' '.config'
- make oldconfig <'/dev/null'
- # show any modifications $ make oldconfig # did to the kernel config
- print '--------------------------------------'
- diff -u 'config.amd64_rt_amd64' '.config' || true
- print '--------------------------------------'
- make clean
- time nice -n 19 make -j$((num_cpus*2)) deb-pkg 2>&1 | tee -a buildlog.log
- (( res=$? ))
- printf '#### Finished, return code = %d\n' res
- if (( res == 0 )) ; then
- # remember the path to the kernel build, but only if we were successful
- bconfig.kernel_build_path="$PWD"
- fi
- return $res
- }
- function build_simatic_kernel_modules
- {
- set -o xtrace
- set -o errexit
- set -o nounset
- cd "${bconfig.kernel_build_path}"
- # dummy for now
- #simatic-ipc-modules-lsp-v1.2.0RC1$ make -C /home/test001/work/kernel_test001/linux-5.10.52/ M=$PWD
- return 1
- }
- function build_igb_avb_kernel_module
- {
- set -o xtrace
- set -o errexit
- set -o nounset
- cd "${bconfig.kernel_build_path}"
- # dummy for now
- return 1
- }
- function main
- {
- set -o xtrace
- set -o errexit
- build_debian_kernel_from_src
- build_simatic_kernel_modules
- build_igb_avb_kernel_module
- }
- #
- # main
- #
- builtin getconf
- main "$@"
- # EOF.
Build Debian kernel manually from source
Posted by Anonymous on Fri 11th Mar 2022 09:29
raw | new post
view followups (newest first): Build Debian kernel manually from source by Anonymous and Build Debian kernel manually from source by Anonymous
modification of post by Anonymous (view diff)
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.