9 Replies Latest reply on Oct 18, 2020 8:28 AM by david.bozo

    Compile kernel module (sc16is7xx.c)

    david.bozo

      Hello!

      I'm looking for a way to add driver for SC16IS752 IC.

       

      I want to use the Waveshare 2-CH RS232 HAT . This hat contains a SC16IS752 IC which uses SPI to communicate.

      As far as i see the default image does not contains this module so i want to compile it from source: sc16is7xx.c(v4.14)

       

      But i did not found the current kernel headers in /lib/modules/4.14.78/build. It points to /home/embest/compile/linux which is a not exist.

      How can i achive this the most easily? Could someone point me in the right direction?

        • Re: Compile kernel module (sc16is7xx.c)
          jafoste4

          Hi David,

           

          I'll look into this today. Will have an answer come tomorrow.

           

          Thx,

          Josh

          1 of 1 people found this helpful
          • Re: Compile kernel module (sc16is7xx.c)
            zebular13

            Hi David,

             

            I believe that to enable the driver you'll have to compile the kernel from source using these instructions: MaaXBoard-Linux-Development_Guide-V1.0-EN.pdf

            After running "make em-sbc-imx8m_defconfig" and before running "make" in step 2.2.2 you can enable the driver in the .config file in the "linux" directory (found here: http://downloads.element14.com/downloads/zedboard/MaaxBoard/MaaXBoard-LinuxSourceCode-V1.0.6r07.rar.zip?ICID=maaxboard-d…

            I'm currently going through the same process, so reach out if you have further questions.

             

            Monica

            2 of 2 people found this helpful
              • Re: Compile kernel module (sc16is7xx.c)
                david.bozo

                So i tried to compile the source using the documentation but i have some new questions.

                 

                1. Sometimes if a compile the source i'm getting this kind of error:

                In file included from drivers/usb/phy/phy-gpio-vbus-usb.c:14:0:./include/linux/module.h: In function ’within_module_init’:./include/linux/module.h:511:9: internal compiler error: Segmentation fault
                
                         addr < (unsigned long)mod->init_layout.base + mod->init_layout.size;         ^~~~Please submit a full bug report,with preprocessed source if appropriate.See <https://gcc.gnu.org/bugs/> for instructions.make[3]: *** [scripts/Makefile.build:328: drivers/usb/phy/phy-gpio-vbus-usb.o] Error 1

                Have you ever got this kind of error?

                After this i start make -j8 again and it compiles successfully. Is it probably just some gcc error because it is outdated?

                I'm using the provided 'gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu'. Are you using the same too?

                 

                2. As you suggested i edited the .config file after make 'em-sbc-imx8m_defconfig' but it does not compiles the kernel module:

                lbozo@lbozo-PC:~/maaxboard/01LinuxSourceCode/linux$ find . -name "*sc16is7*"
                ./drivers/tty/serial/sc16is7xx.o
                ./drivers/tty/serial/.sc16is7xx.o.cmd
                ./drivers/tty/serial/sc16is7xx.c
                ./include/config/serial/sc16is7xx
                ./include/config/serial/sc16is7xx.h
                ./Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt
                

                I looked for it in the output folder too after:  'make modules_install INSTALL_MOD_PATH=~/output/modules/'

                But i did not found it.

                Sure is this the right way to enable this module? I tried to find other ways like make config, make menuconfig but not sure i can use them and i didnt even find the module in the menu.

                Edit (solution):

                I found the solution for the 2. question. If someone needs the solution:

                By editing the .config file with:

                'CONFIG_SERIAL_SC16IS7XX=y'

                I probably just statically linked it into the kernel. I used make xconfig GUI to configure. If the checkbox is checked (✓) it will compile it statically. If it is a dot (•) then it will create a kernel module.

              • Re: Compile kernel module (sc16is7xx.c)
                david.bozo

                Thank you! I hoped i had other option then this. This will be my first time to do this so i might take the opportunity to ask you.

                 

                But another question of mine. Is there any other linux distro for this board? Some more mainstream? Ubuntu, Debian, Alpine? I mean i know it is based on Debian 10.5 but i would rather use the official builds.

                In theory what would it take to for example use Ubuntu?

                  • Re: Compile kernel module (sc16is7xx.c)
                    jafoste4

                    Hi David,


                    The only supported systems for the MaaXBoard/Mini are Yocto / Debian Linux and Android 9.0

                     

                    Link to Yocto Sources -https://github.com/Avnet/meta-maaxboard

                     

                    I would reccomend you avoid using another distro from a support standpoint, a significant amount of effort went into the development of the MaaXBoard/Mini specific libraries in each distribution supported. This would need to be created from scratch by you if you wanted for instance to use somthing besides Debian/Yocto/Android.

                     

                    If you wanted to use the official Debian release as mentioned above, you may be able to port the MaaXBoard specific files from the current Debian build. However support from our side would be quite limited.

                     

                    -Josh

                    1 of 1 people found this helpful