Skip to content

Commit

Permalink
tests/lib/tools/build_kernel_with_comps.sh: use repacked kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
valentindavid authored and pedronis committed Feb 4, 2025
1 parent a369914 commit 407bebd
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
2 changes: 2 additions & 0 deletions tests/lib/nested.sh
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,8 @@ nested_prepare_kernel() {
fi

if nested_is_core_24_system; then
# shellcheck source=tests/lib/prepare.sh
. "$TESTSLIB"/prepare.sh
uc24_build_initramfs_kernel_snap "pc-kernel.snap" "$NESTED_ASSETS_DIR" "$epochBumpTime"
else
uc20_build_initramfs_kernel_snap "pc-kernel.snap" "$NESTED_ASSETS_DIR" "$epochBumpTime"
Expand Down
6 changes: 4 additions & 2 deletions tests/lib/tools/build_kernel_with_comps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ build_kernel_with_comp() {
kernel_snap_file=${3:-}

if [ -z "${kernel_snap_file}" ]; then
VERSION="$(tests.nested show version)"
snap download --channel="$VERSION"/beta --basename=pc-kernel pc-kernel
nested_prepare_kernel
cp "$(tests.nested get extra-snaps-path)/pc-kernel.snap" "pc-kernel.snap"
kernel_snap_file="pc-kernel.snap"
fi
unsquashfs -d kernel "${kernel_snap_file}"
Expand Down Expand Up @@ -47,6 +47,8 @@ EOF
# append component meta-information
printf 'components:\n %s:\n type: kernel-modules\n' "$comp_name" >> kernel/meta/snap.yaml
snap pack --filename="${kernel_snap_file}" kernel
# Just so that nested_prepare_kernel does not recopy the old one
cp "${kernel_snap_file}" "${NESTED_ASSETS_DIR}/pc-kernel.snap"
}

build_kernel_with_comp "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ environment:
NESTED_ENABLE_SECURE_BOOT/plain: false

NESTED_BUILD_SNAPD_FROM_CURRENT: true
NESTED_REPACK_KERNEL_SNAP: false
NESTED_ENABLE_OVMF: true

KMOD_COMP: efi-pstore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ environment:
FAULT/kernel_panic_prepare_kernel_components: panic

NESTED_BUILD_SNAPD_FROM_CURRENT: true
NESTED_REPACK_KERNEL_SNAP: false
NESTED_ENABLE_OVMF: true

prepare: |
# Modify kernel and create a component
VERSION="$(tests.nested show version)"
snap download --channel="$VERSION"/beta pc-kernel
unsquashfs -d kernel pc-kernel_*.snap
#shellcheck source=tests/lib/nested.sh
. "$TESTSLIB"/nested.sh
nested_prepare_kernel
unsquashfs -d kernel "$(tests.nested get extra-snaps-path)/pc-kernel.snap"
kern_ver=$(find kernel/modules/* -maxdepth 0 -printf "%f\n")
comp_ko_dir=wifi-comp/modules/"$kern_ver"/wireless/
mkdir -p "$comp_ko_dir"
Expand All @@ -35,13 +35,12 @@ prepare: |
ln -s ../modules kernel/lib/modules
depmod -b kernel/ "$kern_ver"
rm -rf kernel/lib
rm pc-kernel_*.snap
# append component meta-information
printf 'components:\n wifi-comp:\n type: kernel-modules\n' >> kernel/meta/snap.yaml
snap pack kernel
cp pc-kernel_*.snap "$(tests.nested get extra-snaps-path)"
tests.nested build-image core
cp pc-kernel_*.snap "$(tests.nested get extra-snaps-path)/pc-kernel.snap"
NESTED_REPACK_KERNEL_SNAP=false tests.nested build-image core
tests.nested create-vm core
echo "Inject a $FAULT on $TAG"
Expand Down
1 change: 0 additions & 1 deletion tests/nested/manual/kernel-modules-components/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ environment:
NESTED_ENABLE_SECURE_BOOT/plain: false

NESTED_BUILD_SNAPD_FROM_CURRENT: true
NESTED_REPACK_KERNEL_SNAP: false
NESTED_ENABLE_OVMF: true

prepare: |
Expand Down

0 comments on commit 407bebd

Please sign in to comment.