kernel plugin: pick the correct kernel-image-target per architecture

Bug #1604801 reported by Paolo Pisati
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
High
Sergio Schvezov

Bug Description

Different kernel architecture needs different kernel-image-target:

ARCH=arm:
...
Architecture specific targets (arm):
* zImage - Compressed kernel image (arch/arm/boot/zImage)
  Image - Uncompressed kernel image (arch/arm/boot/Image)
...

ARCH=arm64:
...
Architecture specific targets (arm64):
* Image.gz - Compressed kernel image (arch/arm64/boot/Image.gz)
  Image - Uncompressed kernel image (arch/arm64/boot/Image)
...

ARCH=powerpc:
...
Architecture specific targets (powerpc):
* zImage - Build default images selected by kernel config
  zImage.* - Compressed kernel image (arch/powerpc/boot/zImage.*)
...

etcetc

At the moment snapcraft.yaml::kernel-image-target could be only a string, and to support compiling the kernel for different architectures from the same snapcraft.yaml, we need a dynamic mechanism - either an internal mapping in snapcraft:

case ARCH:
 amd64)
  target=bzImage
 arm)
  target=zImage
 arm64)
  target=Image
...
etcetc
...
esac

or a callback mechanism (as we exploited in kdefconfig to support multiple archs/configs):

...
kdefconfig: ['--makefile=debian/snapcraft.mk', 'branch=master','flavour=generic', 'config']
...

$ cat debian/snapcraft.mk
ifeq ($(ARCH),)
  arch := $(shell uname -m | sed -e s/i.86/i386/ -e s/x86_64/amd64/ \
            -e s/arm.*/armhf/ -e s/s390/s390x/ -e s/ppc.*/powerpc/ \
            -e s/aarch64.*/arm64/ )
else ifeq ($(ARCH),arm)
  arch := armhf
else
  arch := $(ARCH)
endif
config:
        cat debian.$(branch)/config/config.common.ubuntu debian.$(branch)/config/$(arch)/config.common.$(arch) debian.$(branch)/config/$(arch)/config.flavour.$(flavour) >.config

The entire snapcraft.yaml that we would like to ship with the generic Ubuntu kernel, is attached below.

Revision history for this message
Paolo Pisati (p-pisati) wrote :
Revision history for this message
Sergio Schvezov (sergiusens) wrote :
Changed in snapcraft:
status: New → In Progress
importance: Undecided → High
assignee: nobody → Sergio Schvezov (sergiusens)
milestone: none → 2.14
Revision history for this message
Paolo Pisati (p-pisati) wrote :

With this patch i was able to snap, from the same kernel tree, kernels for amd64, arm64 and armhf - looks good.

Changed in snapcraft:
status: In Progress → Fix Committed
Changed in snapcraft:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.