Fixing cdemu 0.8 for a 2.6.17+ kernel

cdemu 0.8 was released for a 2.6.16 kernel. In the 2.6.17 kernel, the function generic_file_read() was replaced with the do_sync_read() function. Here are two approaches to solve this:

More on cdemu: http://cdemu.sourceforge.net/

Remember: You can check your kernel as follows:

# uname -a
Linux dappy 2.6.20-gentoo-r1 #1 PREEMPT Thu Mar 8 18:41:41 GMT 2007 i686 AMD Athlon(tm) XP 1700+ AuthenticAMD GNU/Linux

The Source tar-ball way

  • Unpack the code and replace the generic_file_read() function with the do_sync_read() function in cdemu_core.c
  • Uhm...Save your changed file
  • Rebuild and install using the usual ./configure, make, make install commands

The Gentoo ebuild way

(only works if you are runnign Gentoo, Sabayon or other derivative)

The 'proper' way to patch a Gentoo ebuild:

  • Create an ebuild overlay with the new path code as follows:
# ebuild /usr/local/portage/app-cdr/cdemu/cdemu-0.8.ebuild digest
  • Ensure that the new cdemu overlay will build with the command:
# echo "app-cdr/cdemu"  >> /etc/portage/package.keywords
  • Emerge cdemu again:
# emerge cdemu

The quick-and-dirty way to fix a Gentoo ebuild (package) is:

  • Unpack the code in /usr/portage/distfiles/cdemu-0.8.tar.bz2 and replace the generic_file_read() function with the do_sync_read() function in cdemu_core.c
  • Pack it back together again and make sure that the tar-ball ends up in /usr/portage/distfiles/cdemu-0.8.tar.bz2.
  • Update the MD5 hash of the new tar-ball
# emerge --digest cdemu
  • Emerge cdemu again:
# emerge cdemu