Asking again: example of snapping a kernel and modules

Paolo Pisati paolo.pisati at canonical.com
Wed May 4 16:47:59 UTC 2016


I'm assuming you're running xenial, you have a recent version of
snapcraft installed (>= 2.4.8), your target hardware is an x86_64 box
and you have the tools necessary to build a kernel installed.
If so:

alias fdr='fakeroot debian/rules'
git clone git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/xenial
cd xenial
fdr clean prepare-generic
cp debian/build/build-generic/.config arch/x86/config/xenial_config
git add arch/x86/config/xenial_config
git commit -s -m "UBUNTU: import the xenial config in
arch/x86/config/xenial_config"

then create a snapcraft.yaml file:

cat > snapcraft.yaml << EOF
name: xenialkernel
version: 4.4.0
summary: A generic amd64 kernel built from source
description: This is a generic kernel for amd64 / kvm built using xenial config
type: kernel

parts:
  kernel:
    plugin: kernel
    source: .
    source-branch: master
    source-type: git
    kdefconfig: [xenial_config]
    kconfigs:
      - CONFIG_LOCALVERSION="-xenial_config"
      - CONFIG_DEBUG_INFO=n
    kernel-initrd-modules:
      - squashfs
    kernel-initrd-firmware:
      - lib/firmware/e100/d101m_ucode.bin
      - lib/firmware/e100/d101s_ucode.bin
      - lib/firmware/e100/d102e_ucode.bin
    kernel-image-target: bzImage
EOF

and finally build the kernel snap:

snapcraft -d

If you want to modify the kernel configuration, either you modify
arch/x86/config/xenial_config or you add the desired CONFIG option in
the 'kconfigs' section in snapcraft.yaml.

On Wed, May 4, 2016 at 5:17 PM, MikeB <mabnhdev at gmail.com> wrote:
> I didn't get any answers when I posted this question a couple months ago...
>
> Can you add the following snapcraft examples either to this list or to
> snapcraft-examples.
>
> * Creating an Ubuntu Core kernel for amd64 with some selective config
> changes.
>
> I'm especially interested in generating a kernel that would include all the
> source, patches, and config that goes into building a "standard" Ubuntu Core
> kernel for an amd64 target.
>
> * Building a custom kernel loadable module for a given kernel that would be
> insmod'ed as part of an application snap.  ie. An application snap that
> requires a custom kernel module.
>
> Thanks.
>
> --
> snappy-devel mailing list
> snappy-devel at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/snappy-devel
>



-- 
bye,
p.



More information about the snappy-devel mailing list