diff options
author | Cem Keylan <cem@ckyln.com> | 2020-09-13 18:27:42 +0300 |
---|---|---|
committer | Cem Keylan <cem@ckyln.com> | 2020-09-13 18:27:42 +0300 |
commit | f68f6e0ac5555297e3d78d4aaf8ee549431b100d (patch) | |
tree | 82b6ced5e2ab65b879b9c6eab85a33f6f151eebb /personal/linux/build | |
parent | 4f3ddd38e915defd091cf203b69055e714da461b (diff) | |
download | repository-f68f6e0ac5555297e3d78d4aaf8ee549431b100d.tar.gz |
linux: bump to 5.8.9
Diffstat (limited to 'personal/linux/build')
-rwxr-xr-x | personal/linux/build | 72 |
1 files changed, 66 insertions, 6 deletions
diff --git a/personal/linux/build b/personal/linux/build index 1747214..6f77fd3 100755 --- a/personal/linux/build +++ b/personal/linux/build @@ -1,16 +1,76 @@ #!/bin/sh -e +# POSIX install functions, similar to 'install -Dm' +# and 'install -Dm* -t' +kinstall() { + # usage: kinstall 644 file /usr/bin/prog + mkdir -p "${3%/*}"; rmdir "$3" 2>/dev/null ||: + cp "$2" "$3" + [ -d "$3" ] && set -- "$1" "$3/${2##*/}" + chmod "$1" "${3:-$2}" +} + +kinstall_t() { + # usage: kinstall_t 644 /usr/bin prog1 prog2 + mod=$1 dir=$2; mkdir -p "$dir" + shift 2 + for file; do + cp "$file" "$dir" + chmod "$mod" "$dir/${file##*/}" + done +} + +# Use an out function similar to KISS' log. +out() { printf '\033[1;33m-> \033[1;36mlinux \033[m%s\n' "$@" >&2 ;} + patch -p1 < kernel-no-perl.patch cp .config oldconfig make olddefconfig # Store the build version in a file and a variable. -read -r ver <<EOF -$(make -s kernelrelease) -EOF +make kernelrelease > version +read ver < version + +modulepath="$1/usr/lib/modules/$ver/build" +out "Compiling the kernel" make -install -Dm644 "$(make -s image_name)" "$1/boot/vmlinuz-$ver" -install -Dm644 System.map "$1/boot/System.map-$ver" -install -Dm644 .config "$1/boot/Config-$ver" + +out "Installing the kernel" +kinstall 644 "$(make -s image_name)" "$1/boot/vmlinuz-$ver" +kinstall 644 System.map "$1/boot/System.map-$ver" +kinstall 644 .config "$1/boot/Config-$ver" + +out "Installing kernel modules" +make INSTALL_MOD_PATH="$1/usr" modules_install + +out "Creating module source directory" +rm -f "${modulepath%/*}/build" "${modulepath%/*}/source" +kinstall_t 644 "$modulepath/arch/x86" arch/x86/Makefile +kinstall_t 644 "$modulepath/arch/x86/kernel" arch/x86/kernel/asm-offsets.s +kinstall_t 644 "$modulepath/kernel" kernel/Makefile +kinstall_t 644 "$modulepath/drivers/md" drivers/md/*.h +kinstall_t 644 "$modulepath/net/mac80211" net/mac80211/*.h +kinstall_t 755 "$modulepath/tools/objtool" tools/objtool/objtool +kinstall_t 644 "$modulepath" .config Makefile Module.symvers \ + System.map version vmlinux + + +cp -a scripts "$modulepath/scripts" +cp -a include "$modulepath/include" +cp -a arch/x86/include "$modulepath/arch/x86/include" + +find . -name 'Kconfig*' | while read -r file; do + kinstall 644 "$file" "$modulepath/$file" +done + +out "Removing junk" +find -L "${modulepath%/*}" -type l -exec rm -rf {} + +find "${modulepath%/*}" -type f -name '*.o' -exec rm -rf {} + + +out "Linking /usr/src/linux to the module directory" +mkdir -p "$1/usr/src" +ln -sf "${modulepath#$1}" "$1/usr/src/linux" + +out Done. |