Skip to content

Instantly share code, notes, and snippets.

@fuji246
Last active September 26, 2019 18:17
Show Gist options
  • Save fuji246/1accee13706ce713fc2d3095e1327197 to your computer and use it in GitHub Desktop.
Save fuji246/1accee13706ce713fc2d3095e1327197 to your computer and use it in GitHub Desktop.
ubuntu netem module compile
  1. uncomment the “deb-src” lines in /etc/apt/sources.list.

  2. install packages and source

sudo apt update
sudo apt-get build-dep linux linux-image-$(uname -r)
sudo apt-get install libncurses-dev flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf
sudo apt-get install git
sudo apt-get source linux-image-$(uname -r)
  1. linux source will in current working directory, for example “linux-4.4.0”, then enter into that directory, and copy config, then compile, it will pop some module options, i guess just choose y should be fine.
cd linux-4.4.0
cp /boot/config-`uname -r` .config
make net/sched/sch_netem.ko

** You probabaly need to change Makefile it the module have version check, use dmesg | tail -n 10 to check the error when loading the module and change the VERSION in Makefile **

  1. you can try load the module you compile to see if it works, for example, make a change of the module name only,
  sudo mv /lib/modules/$(uname -r)/kernel/net/sched/sch_netem.ko /lib/modules/$(uname -r)/kernel/net/sched/sch_netem.ko.bak
  sudo mv net/sched/sch_netem.ko /lib/modules/$(uname -r)/kernel/net/sched/sch_netem.ko
  sudo rmmod sch_netem
  sudo insmod /lib/modules/$(uname -r)/kernel/net/sched/sch_netem.ko
  dmesg | tail -n 10
  1. if that works, go with the netem patch to see if it works
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment