diff options
Diffstat (limited to 'images/enea-edge-host-common.inc')
-rw-r--r-- | images/enea-edge-host-common.inc | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/images/enea-edge-host-common.inc b/images/enea-edge-host-common.inc new file mode 100644 index 0000000..3df6cb9 --- /dev/null +++ b/images/enea-edge-host-common.inc | |||
@@ -0,0 +1,84 @@ | |||
1 | IMAGE_FSTYPES += "hddimg" | ||
2 | IMAGE_FSTYPES_remove = "wic" | ||
3 | |||
4 | REQUIRE_FILES = " \ | ||
5 | images/enea-edge-common.inc \ | ||
6 | " | ||
7 | REQUIRE_FILES_append_df-efi-secure-boot = " \ | ||
8 | classes/override_live-vm-common.inc \ | ||
9 | images/secure-boot.inc \ | ||
10 | " | ||
11 | |||
12 | require ${REQUIRE_FILES} | ||
13 | |||
14 | IMAGE_INSTALL += " \ | ||
15 | packagegroup-enea-virtualization-host \ | ||
16 | packagegroup-enea-virtualization-4gusb-modems \ | ||
17 | " | ||
18 | |||
19 | # Set labels for GRUB and SYSLINUX | ||
20 | LABELS_LIVE = "installer live-boot" | ||
21 | |||
22 | # Append default parameters for x86-64 targets | ||
23 | APPEND_x86-64 = "quiet console=tty0 console=ttyS0,115200" | ||
24 | SYSLINUX_DEFAULT_CONSOLE_x86-64 = "console=ttyS0,115200" | ||
25 | |||
26 | # Skip menu and boot installer immediately | ||
27 | GRUB_TIMEOUT_x86-64 = "0" | ||
28 | AUTO_SYSLINUXMENU_x86-64 = "0" | ||
29 | |||
30 | # If building with sota enabled, build the otaimg before the hddimg, because | ||
31 | # the hddimg needs it as a base image | ||
32 | python __anonymous() { | ||
33 | ## ENEA_start ## | ||
34 | if bb.utils.contains('DISTRO_FEATURES', 'sota', True, False, d): | ||
35 | d.appendVarFlag("do_bootimg", "depends", " %s:do_image_ota_ext4" % d.getVar("IMAGE_BASENAME", True)) | ||
36 | ## ENEA_end ## | ||
37 | } | ||
38 | |||
39 | # Append OSTree specific parameters to the kernel command line before creating the live image | ||
40 | python do_bootimg_prepend () { | ||
41 | ## ENEA_start ## | ||
42 | if bb.utils.contains('DISTRO_FEATURES', 'sota', True, False, d): | ||
43 | ostree_osname = d.getVar('OSTREE_OSNAME') | ||
44 | checksum = bb.utils.sha256_file(d.getVar('DEPLOY_DIR_IMAGE') + "/" + d.getVar('OSTREE_KERNEL')) | ||
45 | |||
46 | # The boot tree is identified through a sha256 checksum over the kernel binary | ||
47 | ostree_params = " ostree=/ostree/boot.1/" + ostree_osname + "/" + checksum + "/0" | ||
48 | |||
49 | d.setVar("APPEND", d.getVar("APPEND") + ostree_params) | ||
50 | ## ENEA_end ## | ||
51 | } | ||
52 | |||
53 | # Before building the OSTree image, move DPKG data to /usr/dpkg, because | ||
54 | # OSTree does not preserve the contents of /var | ||
55 | IMAGE_CMD_ostree_prepend () { | ||
56 | ## ENEA_start ## | ||
57 | # Note: We do configure DPKG admindir at build time, but we can't do the same for APT since | ||
58 | # yocto hardcodes /var/lib/dpkg paths in various places in OE-core, which we can't override, | ||
59 | # so instead we move the contents to their expected location here and configure apt at runtime | ||
60 | # via a configuration fragment to use the new location. | ||
61 | mkdir -p usr/dpkg/lib/dpkg | ||
62 | if [ "$(ls -A var/lib/dpkg)" ]; then | ||
63 | mv var/lib/dpkg/* usr/dpkg/lib/dpkg/ | ||
64 | fi | ||
65 | # In Enea Edge, the EFI binaries (shim, seloader etc.) are copied from the yocto deploy dir to | ||
66 | # the installation image (hddimg) - see "classes/override_live-vm-common.inc" in this repo; | ||
67 | # and during Enea Edge installation (via utils.sh) from hddimg to the destination disk. | ||
68 | # Files installed by the package manager end up under OSTree /boot hardlink tree, but are | ||
69 | # never actually used. To avoid confusion and save some resources, clean them up. | ||
70 | rm -rf boot/* | ||
71 | ## ENEA_end ## | ||
72 | } | ||
73 | |||
74 | IMAGE_CMD_ota_prepend () { | ||
75 | ## ENEA_start ## | ||
76 | if [ "${OSTREE_BOOTLOADER}" = "grub" ]; then | ||
77 | # Upstream bbclass creates /boot/grub2, complement it with /boot/grub | ||
78 | # Note: /boot/grub2 is a dir with /boot/grub2/grub.cfg -> ../loader/grub.cfg symlink | ||
79 | # while /boot/grub -> loader is a symlink to also account for /boot/grub/grubenv | ||
80 | mkdir -p ${OTA_SYSROOT}/boot | ||
81 | ln -s loader ${OTA_SYSROOT}/boot/grub | ||
82 | fi | ||
83 | ## ENEA_end ## | ||
84 | } | ||