To compile kernel modules on a Cloud Server you need to complete the following steps, making sure to change the kernel version and directories where appropriate (–for example, 2.6.33.5-rscloud extracts to linux-2.6.33.5, whereas 2.6.35.4-rscloud extracts to 2.6.35.4-rscloud).
- Grab the patched kernel source for your kernel from the repository (check your kernel version with uname -a).
wget http://kernel.slicehost.com/2.6.35.4-rscloud/patched_source/2.6.35.4-rscloud.tar.gz
- Extract the kernel to /usr/src.
sudo tar xpf 2.6.35.4-rscloud.tar.gz -C /usr/src
- Create a link to /usr/src/linux and link to build in /lib/modules
sudo rm -rf /usr/src/linux sudo ln -s /usr/src/2.6.35.4-rscloud /usr/src/linux sudo rm -rf /lib/modules/2.6.35.4-rscloud/build sudo ln -s /usr/src/linux /lib/modules/2.6.35.4-rscloud/build
- Create the configuration file and prepare the modules
zcat /proc/config.gz | sudo tee /usr/src/linux/.config > /dev/null sudo make oldconfig sudo make modules_prepare sudo make INSTALL_HDR_PATH=/usr headers_install
If all went well you can now build custom kernel modules.
« Creating backups for Cloud Servers larger than 2GB Using your own OS on Cloud Servers »
Hello. Thanks for this post.. but I’ve been having a hell of a time to get the headers_install to work. When I issue that last command, it removes the headers.. but doesn’t add them. I restored the headers by spinning up another server and copying the headers over. Here is my output of sudo make modules_prepare.. and make INSTALL_HDR_PATH=/usr headers_install. As you will see, it stops after the REMOVE.
sudo make modules_prepare
scripts/kconfig/conf -s arch/x86/Kconfig
CHK include/linux/version.h
CHK include/generated/utsrelease.h
CALL scripts/checksyscalls.sh
HOSTCC scripts/mod/mk_elfconfig
MKELF scripts/mod/elfconfig.h
HOSTCC scripts/mod/file2alias.o
HOSTCC scripts/mod/modpost.o
HOSTCC scripts/mod/sumversion.o
HOSTLD scripts/mod/modpost
HOSTCC scripts/selinux/genheaders/genheaders
HOSTCC scripts/selinux/mdp/mdp
HOSTCC scripts/kallsyms
HOSTCC scripts/bin2c
sudo make INSTALL_HDR_PATH=/usr headers_install
CHK include/linux/version.h
HOSTCC scripts/unifdef
REMOVE FlexLexer.h _G_config.h a.out.h aio.h aliases.h alloca.h ansidecl.h ar.h argp.h argz.h assert.h autosprintf.h bfd.h bfdlink.h byteswap.h bzlib.h complex.h cpio.h crack.h crypt.h ctype.h curses.h cursesapp.h cursesf.h cursesm.h cursesp.h cursesw.h cursslk.h db.h db_185.h dirent.h dis-asm.h dlfcn.h elf.h endian.h envz.h err.h errno.h error.h eti.h etip.h execinfo.h expat.h expat_external.h fcntl.h features.h fenv.h fmtmsg.h fnmatch.h form.h fpu_control.h fstab.h fts.h ftw.h gconv.h gdbm.h getopt.h gettext-po.h glob.h gmp.h gmpxx.h gnu-versions.h gpm.h grp.h iconv.h ieee754.h ifaddrs.h initreq.h inttypes.h ip6tables.h iptables.h langinfo.h lastlog.h libgen.h libiberty.h libintl.h libio.h libipq.h libudev.h libvolume_id.h limits.h link.h locale.h ltdl.h lzmadec.h magic.h malloc.h math.h mcheck.h memory.h menu.h mntent.h monetary.h mpf2mpfr.h mpfr.h mqueue.h ncurses.h ncurses_dll.h netdb.h nl_types.h nss.h obstack.h packer.h panel.h paths.h pcre.h pcre_scanner.h pcre_stringpiece.h pcrecpp.h pcrecpparg.h pcreposix.h poll.h popt.h printf.h pthread.h pty.h pwd.h re_comp.h regex.h regexp.h resolv.h sched.h search.h semaphore.h setjmp.h sgtty.h shadow.h signal.h spawn.h stab.h stdint.h stdio.h stdio_ext.h stdlib.h string.h strings.h stropts.h symcat.h syscall.h sysexits.h syslog.h tar.h tcpd.h term.h termcap.h termio.h termios.h tgmath.h thread_db.h time.h ttyent.h ucontext.h ulimit.h unctrl.h unistd.h ustat.h utime.h utmp.h utmpx.h values.h wait.h wchar.h wctype.h wordexp.h xlocale.h xtables.h zconf.h zlib.h
Thanks!
Hello
Thanks for this post.
I’ve got a problem with a VPS that I’m trying the above guide on. when I issue:
zcat /proc/config.gz | sudo tee /usr/src/linux/.config > /dev/null
I get:
gzip: /proc/config.gz: No such file or directory
tee: /usr/src/linux/.config: Not a directory
Any advice would be appreciated.
Thanks
I’m running on Rackspace cloud servers, so I can’t run a custom kernel. I’ve tried running modprobe, but that doesn’t work.