Skip to content

Instantly share code, notes, and snippets.

@andreanidouglas
Last active September 9, 2020 23:50
Show Gist options
  • Save andreanidouglas/5d45413007d47f4f3d560925a1b3b628 to your computer and use it in GitHub Desktop.
Save andreanidouglas/5d45413007d47f4f3d560925a1b3b628 to your computer and use it in GitHub Desktop.
#!/bin/sh
### This will compile a bzImage and the modules the latest version on the repository
### Required a file "config_default" to compile with
set -ex
unique=$(date +%s)
version=$(git ls-remote --refs --tags https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git | cut -d" " -f2 | cut -d'/' -f3 | sort | tail -1)
curl -4 -L --url "https://git.kernel.org/torvalds/t/linux-$version.tar.gz" -o linux-"$version"_"$unique".tar.gz
tar xvf linux-"$version"_"$unique".tar.gz
cd linux_"$version"_"$unique"
make mrproper
cp ../config_default .config
make olddefconfig
make -j`nproc --all` bzImage 2>&1 | tee ../build_linux_"$version"_"$unique".log
make -j`nproc --all` modules 2>&1 | tee ../build_linux_modules_"$version"_"$unique".log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment