Compiling cdrtools/cdrecord with kernel 2.6

Cdrtools does not seem to compile properly on kernel version 2.6 f you try and do it yourself from source.

Firstly you will need to download the 'smake' compiling from the the cdrtools website, no point asking why gnu make does not work with package.

You get download 'smake' from:

ftp://ftp.berlios.de/pub/smake/alpha/

extract it and then compile it using the the following commands:

./Gmake.linux
./Gmake.linux install

This will install it in to /opt/schily/bin/smake

Now download the latest version of 'cdrtools' and then patch the source using the following diff information:

DEFAULTS/Defaults.gnu 
@@ -18,7 +18,7 @@
 ###########################################################################
 CWARNOPTS=

-DEFINCDIRS=    $(SRCROOT)/include /usr/src/linux/include
+DEFINCDIRS=    $(SRCROOT)/include
 LDPATH=        -L/opt/schily/lib
 RUNPATH=   -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR)



DEFAULTS/Defaults.linux
@@ -18,7 +18,7 @@

###########################################################################
 CWARNOPTS=

-DEFINCDIRS=    $(SRCROOT)/include /usr/src/linux/include
+DEFINCDIRS=    $(SRCROOT)/include
 LDPATH=        -L/opt/schily/lib
 RUNPATH=   -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR)



libscg/scsi-linux-sg.c
@@ -65,6 +65,14 @@

 #if LINUX_VERSION_CODE >= 0x01031a /* <linux/scsi.h> introduced in 1.3.26 */
 #if LINUX_VERSION_CODE >= 0x020000 /* <scsi/scsi.h> introduced somewhere. */
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
+   #define __KERNEL__
+   #include <asm/types.h>
+   #include <asm/byteorder.h>
+   #undef __KERNEL__
+#endif
+
 /* Need to fine tune the ifdef so we get the transition point right. */
 #include <scsi/scsi.h>
 #else

After you have altered the above 3 files you will need to compile the whole thing by issuing :

/opt/schily/bin/smake
/opt/schily/bin/smake install

All done.

Last updated: 25/07/2005