-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix snap boot kernel path (Bugfix) (#884)
As describe in this snap doc[1], to access to host’s snap-related files, it's now have to access via /var/lib/snapd/hostfs. This system-backup interface gives privileged read-only access to system data. The change can be traced back to snapd 2.36. [1] https://snapcraft.io/docs/the-system-backup-interface * fix snap boot kernel path * add comment for reference * add unit test for boot_mode_test_snappy.py * amend for flake8 check * remove unnecessary test data Co-authored-by: Pierre Equoy <[email protected]> --------- Co-authored-by: Pierre Equoy <[email protected]>
- Loading branch information
Showing
3 changed files
with
112 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright 2023 Canonical Ltd. | ||
# Written by: | ||
# Nancy Chen <[email protected]> | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License version 3, | ||
# as published by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import unittest | ||
import os | ||
from boot_mode_test_snappy import get_bootloader, get_uboot_kernel | ||
|
||
|
||
class TestBootModeTestSnappy(unittest.TestCase): | ||
def test_get_bootloader(self): | ||
"""Test for get_bootloader function""" | ||
kdrp_kdrp_k4500_gadget_yaml = os.path.join( | ||
os.path.dirname(os.path.abspath(__file__)), | ||
"test_data/kdrp-kdrp-k4500-gadget.yaml", | ||
) | ||
self.assertEqual("u-boot", get_bootloader(kdrp_kdrp_k4500_gadget_yaml)) | ||
|
||
def test_get_uboot_kernel(self): | ||
""" | ||
Test if system-backup interface is included in kernel.img file path | ||
https://snapcraft.io/docs/the-system-backup-interface | ||
""" | ||
self.assertIn( | ||
"/var/lib/snapd/hostfs/boot/uboot/", get_uboot_kernel("kernel") | ||
) |
40 changes: 40 additions & 0 deletions
40
providers/base/tests/test_data/kdrp-kdrp-k4500-gadget.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
volumes: | ||
kdrp-k4500: | ||
schema: mbr | ||
bootloader: u-boot | ||
structure: | ||
- name: ubuntu-seed | ||
role: system-seed | ||
filesystem: vfat | ||
type: 0C | ||
size: 2400M | ||
content: | ||
- source: $kernel:boot-assets/boot-assets/ | ||
target: / | ||
- source: $kernel:dtbs/dtbs/bcm2710-rpi-custom-keurig.dtb | ||
target: / | ||
- source: $kernel:dtbs/dtbs/dt-blob-keurig.dtb | ||
target: /dt-blob.bin | ||
- source: $kernel:dtbs/dtbs/overlays/ | ||
target: /overlays | ||
- name: ubuntu-boot | ||
role: system-boot | ||
filesystem: vfat | ||
type: 0C | ||
# whats the appropriate size? | ||
size: 750M | ||
content: | ||
# TODO:UC20: install the boot.sel via snapd instead of via the gadget | ||
- source: boot.sel | ||
target: uboot/ubuntu/boot.sel | ||
- name: ubuntu-save | ||
role: system-save | ||
filesystem: ext4 | ||
type: 83,0FC63DAF-8483-4772-8E79-3D69D8477DE4 | ||
size: 16M | ||
- name: ubuntu-data | ||
role: system-data | ||
filesystem: ext4 | ||
type: 83,0FC63DAF-8483-4772-8E79-3D69D8477DE4 | ||
# XXX: make auto-grow to partition | ||
size: 2500M |