Easier way to build a custom kernel

I have a device build around RPI: https://www.tagtagtag.fr/index_eng.html It’s a new board for an old french connected rabbit (2005).

Current provided firmware is a Raspbian with custom scripts.

I would like to use Ubuntu Core with custom snaps for easier maintenance.

BUT, I need to use a kernel with custom modules (to move ears and soundboard).

I try to find an easy way to build a kernel with custom kernel… but nothing is easy.

metadata
name: pi
adopt-info: kernel
summary: The Ubuntu generic Linux kernel for Pi4
description: |
  This Ubuntu generic Linux kernel is built for the Raspberry Pi4
grade: stable
confinement: strict
build-base: core18
type: kernel

architectures:
  - build-on: amd64
    run-on: armhf
First try
parts:
  firmware:
    plugin: nil
    source: git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
    source-depth: 1
    override-build: |
      mkdir -p $SNAPCRAFT_PART_INSTALL/firmware
      cp -av ./* $SNAPCRAFT_PART_INSTALL/firmware/
  kernel:
    plugin: kernel
    source: git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux-raspi/+git/focal
    source-type: git
    source-depth: 1
    source-tag: Ubuntu-raspi-5.4.0-1048.53
    kconfigflavour: raspi
    kconfigs:
      - CONFIG_TRUSTED_KEY=n
      - CONFIG_SYSTEM_TRUSTED_KEYRING=n
      - CONFIG_SYSTEM_TRUSTED_KEYS=""
      - CONFIG_MODULE_SIG_KEY=""
      - CONFIG_DEBUG_INFO=n
      - CONFIG_CC_STACKPROTECTOR=y
      - CONFIG_CC_STACKPROTECTOR_STRONG=y
      - CONFIG_DEBUG_RODATA=y
      - CONFIG_DEBUG_SET_MODULE_RONX=y
      - SYSTEM_REVOCATION_KEYS=""
    override-pull: |
      snapcraftctl pull
      echo "setting version to $(git tag|sed 's/^Ubuntu-//')"
      snapcraftctl set-version "$(git tag|sed 's/^Ubuntu-//')"
    override-build: |
      # cp debian/scripts/retpoline-extract-one \
      #   $SNAPCRAFT_PART_BUILD/scripts/ubuntu-retpoline-extract-one
      # scripts/config --disable SYSTEM_TRUSTED_KEYS
      # scripts/config --disable SYSTEM_REVOCATION_KEYS
      snapcraftctl build
    kernel-with-firmware: false
    build-packages:
      - cpio
      - libssl-dev
      - on amd64 to armhf:
        - gcc-arm-linux-gnueabihf:amd64
    after: [ firmware ]
```

it fails because revocation keys are absent (SYSTEM_REVOCATION_KEYS override doesn’t work).

kernel and kbuild seems to only exist with core18, is it deprecated?

Second try
parts:
  kernel:
    source: git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux-snap/+git/bionic
    source-type: git
    source-branch: master
    plugin: make
    make-parameters:
      - KERNEL=linux-image-raspi-hwe-18.04-edge
      - KERNEL_SOURCE=linux-raspi-5.4
      - PKGS=bluez-firmware linux-firmware-raspi2
      - PROPOSED=true
      - KERNEL_ASSETS=true
    build-packages:
      - debootstrap
      - lsb-release

It fails because make plugin doesn’t work with multi-arch.

What is the best way to do it?