My personal and professional life

2018-03-04

How do I build my server's kernels

With the recent Meltdown and Spectre critical vulnerabilities, I had to recompile my server's kernel quote often, so I established the following routine:

  1. Download incremental patches:

    for pn in `seq 115 118`; do
      wget "https://cdn.kernel.org/pub/linux/kernel/v4.x/incr/patch-4.4.${pn}-$((pn+1)).xz"
    done
  2. Unpack incremental patches:

    for pn in `seq 115 118`; do
      xz -d patch-4.4.${pn}-$((pn+1)).xz
    done
  3. Apply incremental patches:

    for pn in `seq 115 118`; do
      patch -p1 < patch-4.4.${pn}-$((pn+1))
    done
  4. Update configuration:

    make oldconfig
  5. Build:

    time nice -+19 make

All this (except 4) could be automated in a bash script, but I'm feeling lazy, so I wrote it down here for my personal reference.

Post a Comment