compiling a vanilla kernel to a .deb

As I keep losing this….

Creating a .deb kernel package from a vanilla kernel :

  1. wget
  2. tar -xf linux-4.4.24.tar.xz
  3. cd linux-4.4.24
  4. cp /boot/config-whatever .config
  5. Optionally: edit and set: CONFIG_DEBUG_INFO=n to stop the *dbg* package being generated
  6. make olddefconfig
  7. make deb-pkg -j6 LOCALVERSION=-dg1

Bash random number generation

Historically I’ve used $RANDOM as a random number source in bash — a bit like :

RAND=$(( $RANDOM % 10 )) 

when I’ve needed a random number out of 0,1,2,3,4,5,6,7,8 and 9

one problem with this is that $RANDOM itself is populated between 0 and 32767 by the shell – so it’s not going to give totally even distribution.

Finally, I discovered ‘shuf’ — usage like :

shuf -i 1-100 -n 1

-i RangeFrom-RangeTo
-n how many

So –

RAND=$(( shuf -i 1-10 -n 1))