Thanks for the tips. After cross checking the missing label / function / file etc in lxr website, the code confirmed have been changed from 3.16 --> 3.18 in large extend. The i915 folder from the DKMS source package can be replaced with the Linux kernel source one (/drivers/gpu/drm/i915), almost all errors gone.
The only error left is the missing reference from hdmi_audio_if.h which was actually backported from intel gma source code from kernel 2.6.x. I think the effort to port kernel 2.6.x source code to 3.18 is overwhelming. So better stay at 3.16. ---------------------------------------- > From: dbpa...@hotmail.com > To: debian-devel@lists.debian.org > Subject: Porting DKMS package from ubuntu to debian shows compilation errors > Date: Sun, 27 Sep 2015 16:44:54 +0800 > > When I ported the hdmi_audio dkms package from ubuntu to debian (since ubuntu > package hard-coded kernel version checking) and install, it shows many > compilation errors. > > Did I missed some library include path / compile parameters for building the > dkms module? > > Alan > > > > Source code: > http://intel.archive.canonical.com/pool/public/o/oem-audio-i915-baytrail-dkms/ > > DKMS package installation messages: > > # dpkg -i oem-audio-i915-baytrail-dkms_0.20150605_all.deb > (Reading database ... 148856 files and directories currently installed.) > Preparing to unpack oem-audio-i915-baytrail-dkms_0.20150605_all.deb ... > ------------------------------ > Deleting module version: 0.20150605 > completely from the DKMS tree. > ------------------------------ > Done. > Unpacking oem-audio-i915-baytrail-dkms (0.20150605) over (0.20150605) ... > Setting up oem-audio-i915-baytrail-dkms (0.20150605) ... > Loading new oem-audio-i915-baytrail-0.20150605 DKMS files... > First Installation: checking all kernels... > Building for 3.18.21 > Building for architecture amd64 > Building initial module for 3.18.21 > Error! Bad return status for module build on kernel: 3.18.21 (amd64) > Consult /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/make.log for > more information. > dpkg: error processing package oem-audio-i915-baytrail-dkms (--install): > subprocess installed post-installation script returned error exit status 1 > Processing triggers for initramfs-tools (0.120) ... > Errors were encountered while processing: > oem-audio-i915-baytrail-dkms > > # cat /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/make.log > DKMS make.log for oem-audio-i915-baytrail-0.20150605 for kernel 3.18.21 > (amd64) > Sun Sep 27 16:29:28 HKT 2015 > make -C /lib/modules/3.18.21/build > M=/var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build modules > make[1]: warning: jobserver unavailable: using -j1. Add '+' to parent make > rule. > make[1]: Entering directory '/usr/local/src/kernel/linux-3.18.21' > CC [M] > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/hdmi_audio/intel_mid_hdmi_audio.o > In file included from include/linux/printk.h:261:0, > from include/linux/kernel.h:13, > from include/linux/list.h:8, > from include/linux/kobject.h:20, > from include/linux/device.h:17, > from include/linux/platform_device.h:14, > from > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/hdmi_audio/intel_mid_hdmi_audio.c:29: > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/hdmi_audio/intel_mid_hdmi_audio.c: > In function ‘snd_intelhad_pcm_prepare’: > include/linux/dynamic_debug.h:64:16: warning: format ‘%d’ expects argument of > type ‘int’, but argument 3 has type ‘ssize_t’ [-Wformat=] > static struct _ddebug __aligned(8) \ > ^ > include/linux/dynamic_debug.h:76:2: note: in expansion of macro > ‘DEFINE_DYNAMIC_DEBUG_METADATA’ > DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ > ^ > include/linux/printk.h:267:2: note: in expansion of macro ‘dynamic_pr_debug’ > dynamic_pr_debug(fmt, ##__VA_ARGS__) > ^ > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/hdmi_audio/intel_mid_hdmi_audio.c:1478:2: > note: in expansion of macro ‘pr_debug’ > pr_debug("period_size=%d\n", > ^ > include/linux/dynamic_debug.h:64:16: warning: format ‘%d’ expects argument of > type ‘int’, but argument 3 has type ‘size_t’ [-Wformat=] > static struct _ddebug __aligned(8) \ > ^ > include/linux/dynamic_debug.h:76:2: note: in expansion of macro > ‘DEFINE_DYNAMIC_DEBUG_METADATA’ > DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ > ^ > include/linux/printk.h:267:2: note: in expansion of macro ‘dynamic_pr_debug’ > dynamic_pr_debug(fmt, ##__VA_ARGS__) > ^ > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/hdmi_audio/intel_mid_hdmi_audio.c:1481:2: > note: in expansion of macro ‘pr_debug’ > pr_debug("buffer_size=%d\n", snd_pcm_lib_buffer_bytes(substream)); > ^ > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/hdmi_audio/intel_mid_hdmi_audio.c: > In function ‘snd_intelhad_pcm_pointer’: > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/hdmi_audio/intel_mid_hdmi_audio.c:1546:6: > warning: unused variable ‘l’ [-Wunused-variable] > u32 l[4]; > ^ > In file included from include/linux/printk.h:261:0, > from include/linux/kernel.h:13, > from include/linux/list.h:8, > from include/linux/kobject.h:20, > from include/linux/device.h:17, > from include/linux/platform_device.h:14, > from > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/hdmi_audio/intel_mid_hdmi_audio.c:29: > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/hdmi_audio/intel_mid_hdmi_audio.c: > In function ‘hdmi_audio_probe’: > include/linux/dynamic_debug.h:64:16: warning: format ‘%d’ expects argument of > type ‘int’, but argument 3 has type ‘u64 *’ [-Wformat=] > static struct _ddebug __aligned(8) \ > ^ > include/linux/dynamic_debug.h:76:2: note: in expansion of macro > ‘DEFINE_DYNAMIC_DEBUG_METADATA’ > DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ > ^ > include/linux/printk.h:267:2: note: in expansion of macro ‘dynamic_pr_debug’ > dynamic_pr_debug(fmt, ##__VA_ARGS__) > ^ > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/hdmi_audio/intel_mid_hdmi_audio.c:1790:2: > note: in expansion of macro ‘pr_debug’ > pr_debug("hdmi_audio_probe dma_mask: %d\n", devptr->dev.dma_mask); > ^ > include/linux/dynamic_debug.h:64:16: warning: format ‘%d’ expects argument of > type ‘int’, but argument 3 has type ‘u64 *’ [-Wformat=] > static struct _ddebug __aligned(8) \ > ^ > include/linux/dynamic_debug.h:76:2: note: in expansion of macro > ‘DEFINE_DYNAMIC_DEBUG_METADATA’ > DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ > ^ > include/linux/printk.h:267:2: note: in expansion of macro ‘dynamic_pr_debug’ > dynamic_pr_debug(fmt, ##__VA_ARGS__) > ^ > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/hdmi_audio/intel_mid_hdmi_audio.c:1864:3: > note: in expansion of macro ‘pr_debug’ > pr_debug("hdmi_audio_probe dma_mask is : %d\n", card->dev->dma_mask); > ^ > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/hdmi_audio/intel_mid_hdmi_audio.c: > At top level: > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/hdmi_audio/intel_mid_hdmi_audio.c:1750:23: > warning: ‘had_ops_v1’ defined but not used [-Wunused-variable] > static struct had_ops had_ops_v1 = { > ^ > CC [M] > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/hdmi_audio/intel_mid_hdmi_audio_if.o > LD [M] > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/hdmi_audio/hdmi_audio.o > CC [M] > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/i915/i915_drv.o > In file included from > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/i915/i915_drv.c:33:0: > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/i915/i915_drv.h:277:2: > error: unknown type name ‘drm_local_map_t’ > drm_local_map_t *sarea; > ^ > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/i915/i915_drv.h:1382:2: > error: unknown type name ‘drm_dma_handle_t’ > drm_dma_handle_t *status_page_dmah; > ^ > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/i915/i915_drv.h:1621:24: > error: field ‘base’ has incomplete type > struct drm_gem_object base; > ^ > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/i915/i915_drv.h:1730:2: > error: unknown type name ‘drm_dma_handle_t’ > drm_dma_handle_t *phys_handle; > ^ > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/i915/i915_drv.c:1486:10: > error: ‘drm_gem_vm_open’ undeclared here (not in a function) > .open = drm_gem_vm_open, > ^ > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/i915/i915_drv.c:1487:11: > error: ‘drm_gem_vm_close’ undeclared here (not in a function) > .close = drm_gem_vm_close, > ^ > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/i915/i915_drv.c:1495:10: > error: ‘drm_gem_mmap’ undeclared here (not in a function) > .mmap = drm_gem_mmap, > ^ > /var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/i915/i915_drv.c:1540:18: > error: ‘drm_gem_dumb_destroy’ undeclared here (not in a function) > .dumb_destroy = drm_gem_dumb_destroy, > ^ > scripts/Makefile.build:257: recipe for target > '/var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/i915/i915_drv.o' > failed > make[3]: *** > [/var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/i915/i915_drv.o] > Error 1 > scripts/Makefile.build:402: recipe for target > '/var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/i915' failed > make[2]: *** [/var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build/i915] > Error 2 > Makefile:1381: recipe for target > '_module_/var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build' failed > make[1]: *** [_module_/var/lib/dkms/oem-audio-i915-baytrail/0.20150605/build] > Error 2 > make[1]: Leaving directory '/usr/local/src/kernel/linux-3.18.21' > Makefile:10: recipe for target 'all' failed > make: *** [all] Error 2 > > >