alexparser Posted July 11, 2016 Share Posted July 11, 2016 Hi all! Try build the kernel module on the Lime2 Debian jessie 4.6.3, but failed. I use src files from here - https://github.com/linux-sunxi/linux-sunxi/tree/sunxi-3.4/sound/soc/sunxi/i2s Makefile KERNELDIR := /lib/modules/4.6.3-sunxi/build obj-m += sndi2s.o all: $(MAKE) -C $(KERNELDIR) M=`pwd` modules clean: $(MAKE) -C $(KERNELDIR) M=`pwd` clean Ouput make all make -C /lib/modules/4.6.3-sunxi/build M=`pwd` modules make[1]: Entering directory '/usr/src/linux-headers-4.6.3-sunxi' CC [M] /root/src/sndi2s.o /root/src/sndi2s.c:24:29: fatal error: plat/sys_config.h: No such file or directory #include <plat/sys_config.h> ^ compilation terminated. scripts/Makefile.build:297: recipe for target '/root/src/sndi2s.o' failed make[2]: *** [/root/src/sndi2s.o] Error 1 Makefile:1429: recipe for target '_module_/root/sunxi-i2s-src' failed make[1]: *** [_module_/root/sunxi-i2s-src] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-4.6.3-sunxi' Makefile:5: recipe for target 'all' failed make: *** [all] Error 2 Why the compiler can not find the file sys_config.h? Any recommendations by the module assembly... Link to comment Share on other sites More sharing options...
zador.blood.stained Posted July 11, 2016 Share Posted July 11, 2016 You can't build a module for sunxi legacy kernel (3.4) on mainline kernel (4.6). Link to comment Share on other sites More sharing options...
alexparser Posted July 12, 2016 Author Share Posted July 12, 2016 Thanks zador.blood.stained, I understand. Maybe you can give me recommendation, how to compile sndi2s.c on the legacy kernel (3.4)? Link to comment Share on other sites More sharing options...
zador.blood.stained Posted July 12, 2016 Share Posted July 12, 2016 Maybe you can give me recommendation, how to compile sndi2s.c on the legacy kernel (3.4)? It should be built-in in latest Armbian legacy kernel $ grep SND_SUNXI_SOC_I2S_INTERFACE config/kernel/linux-sun7i-default.config CONFIG_SND_SUNXI_SOC_I2S_INTERFACE=y For a Lime2 board you need to enable I2S in fex file (and recompile it to bin file afterwards), setting i2s_used = 1 in [i2s_para] section. Whether it does work or not I don't know (don't have any I2S hardware). Link to comment Share on other sites More sharing options...
alexparser Posted July 12, 2016 Author Share Posted July 12, 2016 It should be built-in in latest Armbian legacy kernel $ grep SND_SUNXI_SOC_I2S_INTERFACE config/kernel/linux-sun7i-default.config CONFIG_SND_SUNXI_SOC_I2S_INTERFACE=y For a Lime2 board you need to enable I2S in fex file (and recompile it to bin file afterwards), setting i2s_used = 1 in [i2s_para] section. Whether it does work or not I don't know (don't have any I2S hardware). CONFIG_SND_SUNXI_SOC_I2S_INTERFACE=y - OK i2s_used = 1 - OK I wanted to know how to make a compilation of a particular file sndi2s.c directly on the Lime2. Link to comment Share on other sites More sharing options...
jernej Posted July 12, 2016 Share Posted July 12, 2016 I wanted to know how to make a compilation of a particular file sndi2s.c directly on the Lime2. Well, if you use legacy image you have this driver already included and you don't have to do absolutely anything, except fix script.bin Unless you want to have it as a module, but this will give you just additional work without any benefit. Do you by any chance want to transfer this module to mainline kernel? 1 Link to comment Share on other sites More sharing options...
alexparser Posted July 12, 2016 Author Share Posted July 12, 2016 Well, if you use legacy image you have this driver already included and you don't have to do absolutely anything, except fix script.bin Unless you want to have it as a module, but this will give you just additional work without any benefit. Do you by any chance want to transfer this module to mainline kernel? I have a custom designed board for external clocking. I want make changes into I2S driver for my board. And yes, after that I would make port a I2S driver to mainline kernel. Link to comment Share on other sites More sharing options...
jernej Posted July 12, 2016 Share Posted July 12, 2016 If you want to port driver, then approach in the first post is correct one. You have to remove all references to sys_config.h (functions for reading script.bin) and replace it with device tree functions (device tree files are replacement for script.bin). Along with that you would have to fix all functions and/or principles which changed during 4 years of kernel development. However, if you want just copy module file from image with legacy kernel to image with mainline kernel, it won't work. Link to comment Share on other sites More sharing options...
zador.blood.stained Posted July 12, 2016 Share Posted July 12, 2016 I want make changes into I2S driver for my board. In this case you probably will need to recompile kernel without built-in I2S to avoid conflicts. In any case if you compile on Armbian with legacy kernel, sys_config.h shouldn't be an issue, but you will need to extend your Makefile to compile all source files, something like this: obj-m+= sunxi-i2s.o sunxi-i2s-objs+= sunxi-i2sdma.o sndi2s.o sunxi-sndi2s.o And yes, after that I would make port a I2S driver to mainline kernel. You don't have to: https://linux-sunxi.org/Linux_mainlining_effort#Planned_for_4.8 Link to comment Share on other sites More sharing options...
alexparser Posted July 12, 2016 Author Share Posted July 12, 2016 You don't have to: https://linux-sunxi....Planned_for_4.8 Thanks again, I did not know it. Will it be driver ported in main line at 2016y? Maybe I can see the timeline of works? Link to comment Share on other sites More sharing options...
zador.blood.stained Posted July 12, 2016 Share Posted July 12, 2016 Maybe I can see the timeline of works? Kernel release schedule is 2-3 months between major releases, current version is 4.6 Driver is already available in linux-next tree, but you will need DT bits to activate and configure it. Link to comment Share on other sites More sharing options...
jernej Posted July 12, 2016 Share Posted July 12, 2016 DT bits are already included in this repo: https://git.kernel.org/cgit/linux/kernel/git/mripard/linux.git/log/?h=sunxi/for-nextCheck this commit. Link to comment Share on other sites More sharing options...
alexparser Posted July 12, 2016 Author Share Posted July 12, 2016 Kernel release schedule is 2-3 months between major releases, current version is 4.6 Driver is already available in linux-next tree, but you will need DT bits to activate and configure it. This driver for sun4i A10 SoC, Lime2 A20 SoC. What is DT bits? Link to comment Share on other sites More sharing options...
jernej Posted July 12, 2016 Share Posted July 12, 2016 This driver for sun4i A10 SoC, Lime2 A20 SoC. What is DT bits? Please check this commit: https://git.kernel.org/cgit/linux/kernel/git/mripard/linux.git/commit/?h=sunxi/for-next&id=6a706356b4456204fd89ef3fbfc6ed4165cebf37 You can see that I2S driver is compatible with both chips, A10 and A20. DT bits are just things you must put inside device tree file to make driver aware of important things. This exactly what is done in aforementioned commit. Link to comment Share on other sites More sharing options...
zador.blood.stained Posted July 12, 2016 Share Posted July 12, 2016 This driver for sun4i A10 SoC, Lime2 A20 SoC. A10 and A20 share most of SoC IP blocks and thus most of the drivers. What is DT bits? Device Tree. A standart for describing hardware configuratiuon for the kernel, that is used in modern kernel versions instead of Allwinner-specific FEX files. You will need to add generic sections from @jernej's link and activate one of I2S interfaces in board-specific file. You may want to read some official specifications like this and look at current generic (family-specific) and board-specific files for A20 and Lime2. Link to comment Share on other sites More sharing options...
alexparser Posted July 12, 2016 Author Share Posted July 12, 2016 Thanks guys!How I know for build Kernel without I2S support I need:1. Rebuild Armbian legacy kernel without I2S support 'CONFIG_SND_SUNXI_SOC_I2S_INTERFACE=n'2. Compile I2S like Kernel module 'sunxi-i2s.ko'3. Load the module into Kernel Link to comment Share on other sites More sharing options...
Recommended Posts