prototype snap components building

Bug #2051246 reported by Dimitri John Ledkov
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
canonical-kernel-snaps
In Progress
Undecided
Jesse Sung

Bug Description

prototype snap components building with snapcraft from latest/edge/components

examples are available at https://github.com/snapcore/snapcraft/tree/feature/components/tests/spread/core22/components

the goal is to fork https://git.launchpad.net/~canonical-kernel-snaps/+git/kernel-snaps-uc22/tree/snapcraft.yaml?h=hwe

and add components

 - iwlwifi component that stages .ko from linux-modules-iwlwifi-generic-hwe-22.04 and stages the matching required firmware files for that .ko

 - ipu6 component that stages .ko from linux-modules-ivsc-generic-hwe-22.04 and linux-modules-ipu6-generic-hwe-22.04 and any firmware files they require

 - nvidia comonenets that stages .o files an firmware from linux-modules-nvidia-535-server-generic-hwe-22.04

Changed in canonical-kernel-snaps:
assignee: nobody → Jesse Sung (wenchien)
Revision history for this message
Jesse Sung (wenchien) wrote :

As a quick test, I tried with the following changes and found that the component file contains only the component.yaml file:

--- a/snapcraft.yaml
+++ b/snapcraft.yaml
@@ -11,6 +11,13 @@ architectures:
   - build-on: [amd64]
   - build-on: [arm64]

+components:
+ iwlwifi:
+ type: test
+ summary: iwlwifi modules
+ description: iwlwifi modules
+ version: "0.1"
+
 parts:
   kernel:
     # Need .ko.zst support from u23.10 for backport
@@ -25,8 +32,10 @@ parts:
       - kmod
     stage-packages:
       - linux-image-uc-generic-hwe-22.04
+ - linux-modules-iwlwifi-generic-hwe-22.04
     organize:
       boot: ./
+ lib/modules/6.5.0-15-generic/ubuntu/iwlwifi: (component/iwlwifi)/modules/6.5.0-15-generic/ubuntu/iwlwifi
       lib/firmware: firmware
       lib/modules: modules
       usr/share/doc: doc

The line in organize needs to be
modules/6.5.0-15-generic/ubuntu/iwlwifi: (component/iwlwifi)/modules/6.5.0-15-generic/ubuntu/iwlwifi
to make the files actually go into the component file.

Changed in canonical-kernel-snaps:
status: New → In Progress
Revision history for this message
Jesse Sung (wenchien) wrote :

The ABI string in the path is an issue for organize since we don't want it to be hard-coded in the yaml file.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

we do calculate the ABI later on, can one use vairable in the dictionary key? I can't remember if this was ever possible.

Revision history for this message
Callahan Kovacs (mr-cal) wrote :

Currently, craft-parts only supports predefined SNAPCRAFT_ and CRAFT_ variables in `organize` keys and values:

CRAFT_ARCH_BUILD_FOR
CRAFT_ARCH_BUILD_ON
CRAFT_ARCH_TRIPLET
CRAFT_ARCH_TRIPLET_BUILD_FOR
CRAFT_ARCH_TRIPLET_BUILD_ON
CRAFT_PARALLEL_BUILD_COUNT
CRAFT_PRIME
CRAFT_PROJECT_DIR
CRAFT_PROJECT_NAME
CRAFT_STAGE
CRAFT_TARGET_ARCH
SNAPCRAFT_ARCH_TRIPLET
SNAPCRAFT_PARALLEL_BUILD_COUNT
SNAPCRAFT_PRIME
SNAPCRAFT_PROJECT_DIR
SNAPCRAFT_PROJECT_GRADE
SNAPCRAFT_PROJECT_NAME
SNAPCRAFT_PROJECT_VERSION
SNAPCRAFT_STAGE
SNAPCRAFT_TARGET_ARCH

Globs in the key is a possibility (modules/*/ubuntu/iwlwifi) but that won't fully solve this problem. Anyways, I don't know if globs are officially supported by craft-parts (although they work for me).

Revision history for this message
Jesse Sung (wenchien) wrote :

If iwlwifi is moved into a standalone part then we don't need to put the ABI string in the dictionary key:
https://git.launchpad.net/~wenchien/+git/kernel-snaps-uc22/commit/?id=f766de2b42fbbfde76585b15ce39ee5d5079ccd4

"iwlwifi.firmware-list" can be used as a hint in part kernel for moving relevant firmware files into the component, though since most of them are also used by the in-tree iwlwifi, we should only move the ones that are exclusively used by the component and keep others in the snap. "trim-firmware" may or may not need some rework depending on how we are going to list the firmware files used by components only.

Revision history for this message
Jesse Sung (wenchien) wrote :

Another thing to consider is the module dependencies. Since those files are read-only in the snap file, how are we going to update the info when there's a component being installed or removed?

Revision history for this message
Dimitri John Ledkov (xnox) wrote :
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.