Announcement

Collapse
No announcement yet.

Building custom kernel for 4DPi-24-HAT ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Building custom kernel for 4DPi-24-HAT ?

    Hello,

    A while back I purchased the 4DPi-24-HAT to use with a Raspberry PI3.
    It worked fine, but each time I did an apt-get update & upgrade, it stopped working (known problem...).

    In theory I can avoid problems by waiting for an updated kernel release, the problem is to know which kernel package is the most recent.
    The product page still shows: 4DPi-24-HAT Kernel Package (Kernel 4.9.35). I know there are more recent releases.
    The page doesn't seem up to date. PS: the webserver disallows directory browsing so I can't easily find out the most recent file.

    So I am looking for a more permanent and stable solution.
    I understand that building a custom kernel for the Raspberry PI could be the solution.
    I have some experience with Linux but building a custom kernel is something new for me.I checked the posts on the forum and did some research.
    Some relevant posts:Building the custom kernel

    I followed the documentation: https://www.raspberrypi.org/document...el/building.md

    My host computer is Arch Linux 64-bit
    Code:
    uname -a
    Linux ########## 4.16.5-1-ARCH #1 SMP PREEMPT Thu Apr 26 16:53:40 UTC 2018 x86_64 GNU/Linux
    I chose cross-compiling, as doing it on the PI would be too slow.
    I performed the following steps:

    Install toolchain:
    Code:
    git clone https://github.com/raspberrypi/tools ~/tools
    Updating the $PATH environment variable (for a 64-bit host system):
    Code:
    echo PATH=\$PATH:~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin >> ~/.bashrc
    source ~/.bashrc
    Get sources:
    Code:
    git clone --depth=1 https://github.com/raspberrypi/linux
    Then I followed the instructions here:
    https://bitbucket.org/4DPi/4d-hats

    Code:
    cd drivers/video
    git clone https://bitbucket.org/4DPi/4d-hats.git
    Editing the files:
    Code:
        Add to drivers/video/Kconfig:   source "drivers/video/4d-hats/Kconfig"
        -----------------------------------
        config HDMI
                bool
    
        source "drivers/video/4d-hats/Kconfig"
    
        if VT
                source "drivers/video/console/Kconfig"
        endif
        -----------------------------------
    Code:
        Add to drivers/video/Makefile:  obj-y += 4d-hats/
        -----------------------------------
        obj-y                  += fbdev/
        obj-y                                 += 4d-hats/
    
        obj-$(CONFIG_VIDEOMODE_HELPERS) += display_timing.o videomode.o
    
        -----------------------------------
    I did not follow the last step:
    Code:
      Compiling device tree overlays (only necessary if overlay sources are mofified):
        recent dtc (device tree compiler) has to be installed. A script is provided.
        For example DT overlay for 24-hat can be compiled with:
    
        ./dtc.sh 24-hat
    
        resulting .dtb files should be flashed to HAT EEPROMs or copied to:
        /boot/overlays on RPi.
    I am not sure it is relevant here.


    Enable driver(s) in menuconfig and build the kernel:
    Code:
    cd ~/linux
    make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
    I enabled the 4D modules as described here:
    Code:
      Enable driver(s) in menuconfig and build the kernel:
        Device Drivers-->Graphics support
    
        <*> Support for 4D Systems display modules  --->
            <*>   4D Systems LCD HAT support (2.4, 3.2 and 3.5 inch)
            <*>   DMA Enabled SPI Master Driver
            <M>   Module for ADS7846 resistive touch screen controller
    
        <M> Module for AR1020 resistive touch screen controller
        <M> Module for DMA supported PWM backlight driver
    Screenshot:
    Menuconfig for 4D
    Menuconfig for 4D

    Build sources:
    For Pi 2, Pi 3, or Compute Module 3:
    Code:
    cd linux
    KERNEL=kernel7
    make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
    Next:
    Code:
    make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs

    Finally, I followed the section 'Install directly onto the SD card'.
    I have a clean and working micro SD card with Raspbian.
    Version:
    Code:
    Raspbian Stretch with desktop
    Version: April 2018
    Release date: 2018-04-18
    Using lsblk my SD cards shows up as sdh1 & sdh2

    Code:
    mkdir mnt
    mkdir mnt/fat32
    mkdir mnt/ext4
    sudo mount /dev/sdh1 mnt/fat32
    sudo mount /dev/sdh2 mnt/ext4
    Next, install the modules:
    Code:
    sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=mnt/ext4 modules_install
    Finally, copy the kernel and Device Tree blobs onto the SD card, making sure to back up your old kernel:
    Code:
    sudo cp mnt/fat32/$KERNEL.img mnt/fat32/$KERNEL-backup.img
    sudo cp arch/arm/boot/zImage mnt/fat32/$KERNEL.img
    sudo cp arch/arm/boot/dts/*.dtb mnt/fat32/
    sudo cp arch/arm/boot/dts/overlays/*.dtb* mnt/fat32/overlays/
    sudo cp arch/arm/boot/dts/overlays/README mnt/fat32/overlays/
    sudo umount mnt/fat32
    sudo umount mnt/ext4
    I have verified that the resulting image is still bootable by connecting a screen to the HDMI plug.
    However, I am wondering if I got the steps in the right order.

    In the /boot/overlays/ directory I don't see any 4D files
    At this time my /boot/config.txt does not contain directives about overloads.
    Could someone confirm if I am on the right track ?


    @4D team: as a workaround is there any way you could keep the product page up to date with a link to the most recent kernel files ?

  • #2
    Hi Marjorie,

    Good Day.

    Welcome to the forum.

    We do update the product page as soon as the new kernel pack is available and has been tested. We try to do this as promptly as we can after a new Raspbian release has been done.

    We are currently updating the datasheet to update some instructions to catch with the raspberry pi fast update.

    For now, here is the new link for new 4DPi kernel:

    http://www.4dsystems.com.au/download...34_v1.0.tar.gz

    Code:
    http://www.4dsystems.com.au/downloads/4DPi/All/gen4-hats_4-14-34_v1.0.tar.gz


    Best Regards,

    Comment


    • #3
      Dear frsantiago,

      thank you for trying to keep up with the kernel development and Raspbian releases. I'm the creator of the other topic (https://forum.4dsystems.com.au/forum...anch-rpi-4-9-y) and would like to compile a kernel for the current 4.14 branch. Could you please provide the used sources for the display driver?

      Thank you
      Peter

      Comment


      • #4
        Dear PeterPablo,

        Good Day.

        Here is the link of the sources of 4DPi display driver.

        https://bitbucket.org/4DPi/gen4-hats

        You can also use the latest kernel of 4DPi displays for Raspbian Stretch release 2018-04-18 at the link below.

        http://www.4dsystems.com.au/download...34_v1.1.tar.gz

        Hope this helps.


        Comment


        • #5
          Dear frsantiago,

          please take a look at my posting at https://forum.4dsystems.com.au/forum...1409#post61409
          You'll notice that at least in January compilation of a 4.14.y kernel did not succeed with the sources that were releaased back then (https://bitbucket.org/4DPi/4d-hats/). I'll take a look at the new sources.

          Thank you for your fast response.
          Peter

          Comment


        • #6
          I needed this thanks guys

          Comment


          • #7
            Hi,

            Does the download link from the datasheet and this forum here doesn't exist anymore?
            Is there a new URL for the Kernel?

            from Datasheet:
            8) To download and install files, enter the following commands in terminal/shell /SSH to download the kernel from the 4D Systems Server: $ wget http://www.4dsystems.com.au/downloads/4DPi/All/gen4-hats_4-14-34_v1.1.tar.gz

            if i try do download using the links from above, it is the same:

            Resolving 4dsystems.com.au (4dsystems.com.au)... 13.238.245.146
            Connecting to 4dsystems.com.au (4dsystems.com.au)|13.238.245.146|:443... connected.
            HTTP request sent, awaiting response... 404 Not Found
            2019-07-23 14:37:19 ERROR 404: Not Found.

            Comment


            • James_4DSystems
              James_4DSystems commented
              Editing a comment
              The download link is currently being resolved. After we changed to a new website and server a few things like this broke, and they are in progress to be solved. The actual file can be found on the download section of the product page on the website however.
              We are trying to get this resolved as soon as possible.

            • CHRIS4DSYSTEMS
              CHRIS4DSYSTEMS commented
              Editing a comment
              James_4DSystems, please provide the link where updated kernel can be found. I have the same result as mhaag have. My situation is urgent, I need to get my display running as soon as possible. We use this displays on our instruments at work. You guys need to resolve this quickly.

            • James_4DSystems
              James_4DSystems commented
              Editing a comment
              The URL should now work from the 4D Server, as per the link above.

          • #8
            dear frsantiago,

            Beside the fact that the kernel link doesn't work, there is another issue with the bitbucket source code, why are there files as compiled binary in the repo?

            compress-v6.o
            compress-v7.o

            are only available as binary, this makes it almost impossible for future kernel versions to compile...
            is it possible to check in the source files for it?

            so i can analyse/fix the errors during compiling the actual version from the git repo above...
            https://github.com/raspberrypi/linux
            in combination with the gen4-hats:
            https://bitbucket.org/4DPi/gen4-hats

            e.g.:
            drivers/video/gen4-hats/compress-v6.o: In function `lcdpi_spi_write':
            compress-v6.c.text+0x88): undefined reference to `__memzero'
            drivers/video/gen4-hats/compress-v6.o: In function `lcdpi_spi_write_ssd1963':
            compress-v6.c.text+0x140): undefined reference to `__memzero'
            drivers/video/gen4-hats/compress-v6.o: In function `write_spi_dma':
            compress-v6.c.text+0x1cc): undefined reference to `__memzero'
            drivers/video/gen4-hats/4dpi_touch.o: In function `ads7846_remove':
            4dpi_touch.c.text+0xb50): undefined reference to `hwmon_device_unregister'
            drivers/video/gen4-hats/4dpi_touch.o: In function `ads7846_probe':
            4dpi_touch.c.text+0x1a6c): undefined reference to `hwmon_device_unregister'
            4dpi_touch.c.text+0x1ab8): undefined reference to `hwmon_device_register'


            Comment


            • #9
              Dear James,

              Thanks for your answer, i found now a precompiled version in download section: gen4-hats_4-14-34_v1.1.tar_1.gz

              But these binaries does not work, why is the source code not complete in the Bitbucket repo?
              I want compile them with an actual kernel to get support for
              Debian Buster Distribution, because the Stretch Distribution is not longer available for download on the http://downloads.raspberrypi.org/
              page.

              If i use your precompiled version with Buster i get following errors during boot:
              spi-bcm2835 3f00b840..spi: could not get clk: -517
              bcm2835_vchiq 3f00b840.mailbox: Missing firmware node
              irq 39: nobody cared (try booting with the "irqpoll" option)
              ....

              I can see afterwards the screen with the LXQT Desktop but the RASPI stucks/freezes after the boot.

              Please help, i have 4 Displays and i want them up and running until end of this week.
              KR,
              Markus

              Comment


              • colinvv
                colinvv commented
                Editing a comment
                I have the screen working with my Buster install and driver 4.14.34v1.1... but other parts of the Pi3B+ have stopped working. (like the network!)

              • colinvv
                colinvv commented
                Editing a comment
                Also, yes, you can still find old releases of the Raspi distros...
                http://downloads.raspberrypi.org/raspbian/images/

            • #10
              Here is a pre-release Kernel Pack for the Buster Desktop release from July 2019. It is not working for Lite yet it seems, but hopefully there will be an update soon.
              Please note the /download link as per the datasheet is not working currently, we are actively trying to resolve this.
              For now, you can download the Pre-Release kernel pack from the product pages on the website.
              Kernel 4-19-57

              Here is a temporary direct link
              https://4dsystems.com.au/mwdownloads...d/link/id/715/
              James

              Comment


              • CHRIS4DSYSTEMS
                CHRIS4DSYSTEMS commented
                Editing a comment
                How about for the Jessie OS, I'm still using it.

              • CHRIS4DSYSTEMS
                CHRIS4DSYSTEMS commented
                Editing a comment
                Also, can you show me how to install this new kernel pack on the raspberry pi. I can't seem to open the link you indicated above.

            • #11
              CHRIS4DSYSTEMS what kernel is your Jessie OS running?
              At the moment while our server is still being sorted so the links work as per the Datasheet, you will need to download the file and put it onto a flash drive or something, and then plug it into your Pi, and then execute the commands from the Datasheet but pointing to the file you downloaded. But you wont be able to install the one listed above on top of Jessie I wouldn't think, you would need the one to match the OS Kernel you are using.
              Let me know what you are using and ill try and find the matching older Kernel Patch for it.
              James

              Comment


              • CHRIS4DSYSTEMS
                CHRIS4DSYSTEMS commented
                Editing a comment
                Hey James, thanks for your support. Unfortunately it did not work for me. It did go through the install on Raspbian Buster OS, but when I change to the Gen4 display it's just black... So, resorted back to Raspbian Stretch, this time the kernel indicated in the datasheet worked... the download from the website went through, my system is now running. Any thoughts on this? In the future I might be using the Buster, so I will need that working kernel.

              • James_4DSystems
                James_4DSystems commented
                Editing a comment
                Hi Chris. Did you install the Buster Desktop version or the Buster Lite version? It only works with Buster Desktop at this stage. We have tested it on multiple Pis and on all of our 4DPi display models and it is working correctly.

              • CHRIS4DSYSTEMS
                CHRIS4DSYSTEMS commented
                Editing a comment
                I installed 'Raspbian Buster with recommended software'. I must be doing something wrong then.... can you give me the detailed steps (like the one on the datasheet) for the Raspbian Buster OS?

            • #12
              hi James,

              thanks for you effort and compiling it for buster, but again the question, why are following files not in the bitbucket repo?

              compress-v6.c and compress-v7.c ( the compress-vX.o object files are not working for actual kernel versions)

              it makes it easier to create our own patches for different kernel versions.
              At least i prefer source code releases and not dedicated binary releases for SOME kernel versions.
              Why are you doing this? It creates a lot of work on your side too....

              If you release the complete source code base it gives us (not 4dsystems employees) the possibility to compile it for future kernels,

              KR,
              Markus

              Comment


              • #13
                Hi CHRIS4DSYSTEMS ,

                After downloading the Raspbian Buster with desktop, you can try and proceed with the following steps.

                1.) Load the Raspberry Pi image onto an SD card, using the instructions provided on the Raspberry Pi website for Linux, Mac or PC:

                http://www.raspberrypi.org/documenta...ages/README.md

                2) Insert the SD card into the Raspberry Pi. Do not connect the 4DPi yet. You will need an external monitor/keyboard/network connection, else simply a network connection to the Pi and the rest can be done over an SSH connection.

                3.) Either log into the Raspberry Pi from your keyboard/monitor using the standard ‘pi’ and ‘raspberry’ credentials, else SSH into your raspberry PI and log in via your SSH session.

                4.) Expand the file system on the downloaded image using raspi-config (submenu Expand Filesystem).
                After exiting raspi-config a reboot is needed.

                Code:
                sudo raspi-config
                sudo reboot
                5.) To download and install files, enter the following commands in terminal/shell /SSH to download the kernel from the 4D Systems Server:

                Code:
                wget http://4dsystems.com.au/downloads/4DPi/All/gen4-hats_4-19-57-v7l+_v1.0.tar.gz
                Then install it using this command:

                Code:
                sudo tar -xzvf gen4-hats_4-19-57-v7l+_v1.0.tar.gz -C /
                6.) After the installation, shut down the Raspberry Pi.

                Code:
                sudo shutdown now
                7.) Connect the 4DPi to the Raspberry Pi, and reapply power.

                You should be able to see the Raspberry Pi booting on the display.

                Let me know if that helps.

                Best Regards,
                Kevin

                Comment


                • CHRIS4DSYSTEMS
                  CHRIS4DSYSTEMS commented
                  Editing a comment
                  Thanks much John. Appreciate your support.

              • #14
                Hi CHRIS4DSYSTEMS ,

                Good Day.

                The display kernel is now also working with Raspbian Buster Lite (2019-07-10). Tested in Raspberry Pi 3B+ and 4DPi Displays.

                Hope this helps.

                BR,

                Comment

                Working...
                X