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

          Working...
          X