0

Here is quick description what im trying to achieve, building this mender yocto image for raspberry pi want to encrypt the root partition, while secure boot, need to add the init script which can decrypt the LUKS encrypted rootfs partition. Poky layer already has core-image-minimal-initramfs which can be bundled in linux kernel, the problem is im not able to add the init script from custom layer, have no idea how to achieve it

This is the poky layer content core-image-minimal-initramfs.bb

# Simple initramfs image. Mostly used for live images.
SUMMARY = "Small image capable of booting a device."
DESCRIPTION = "Small image capable of booting a device. The kernel includes \
the Minimal RAM-based Initial Root Filesystem (initramfs), which finds the \
first 'init' program more efficiently."

INITRAMFS_SCRIPTS ?= "\
                      initramfs-framework-base \
                      initramfs-module-setup-live \
                      initramfs-module-udev \
                      initramfs-module-install \
                      initramfs-module-install-efi \
                     "

PACKAGE_INSTALL = "${INITRAMFS_SCRIPTS} ${VIRTUAL-RUNTIME_base-utils} udev base-passwd ${ROOTFS_BOOTSTRAP_INSTALL}"

# Do not pollute the initrd image with rootfs features
IMAGE_FEATURES = ""

# Don't allow the initramfs to contain a kernel
PACKAGE_EXCLUDE = "kernel-image-*"

IMAGE_NAME_SUFFIX ?= ""
IMAGE_LINGUAS = ""

LICENSE = "MIT"

IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
inherit core-image

IMAGE_ROOTFS_SIZE = "8192"
IMAGE_ROOTFS_EXTRA_SPACE = "0"

# Use the same restriction as initramfs-module-install
COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*|loongarch64.*)-(linux.*|freebsd.*)'

the is meta-mender/meta-mender-core/recipe-core tree, ihave added this core-image-minimal-initramfs.bbappend and initLUKSdecrpyt.sh

/meta-mender/meta-mender-core/recipes-core$ tree 
.
├── initrdscripts
│   ├── core-image-minimal-initramfs.bbappend
│   ├── files
│   │   ├── init-install-efi-mender.sh
│   │   └── initLUKSdecrypt.sh
│   ├── initramfs-module-install_%.bbappend
│   ├── initramfs-module-install-efi_%.bbappend
│   └── initramfs-module-install.inc


8 directories, 12 files

this is code in core-image-minimal-initramfs.bbappend file,here the do_install is not getting called.

FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
SRC_URI += "file://initLUKSdecrypt.sh"

PACKAGE_INSTALL += "cryptsetup"

do_install:append:mender-uboot(){
    bbwarn "WorkDIR=${WORKDIR}  Destination=${D}"
    install -m 0755 ${WORKDIR}/initLUKSdecrypt.sh ${D}/init.d/initLUKSdecrypt.sh
}

So add the code in initramfs-module-install_%.bbappend, the do_install gets called but while final pacakging gets error.

require initramfs-module-install.inc

do_install:append:mender-efi-boot() {
    install -m 0755 ${WORKDIR}/init-install-efi-mender-altered.sh ${D}/init.d/install.sh
}

FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

SRC_URI := " file://initLUKSdecrypt.sh "

do_install() {
    bbwarn "WorkDIR=${WORKDIR}  Destination=${D}"
    install -m 0755 ${WORKDIR}/initLUKSdecrypt.sh ${D}/../package/init.d/
}

Error logs:

ERROR: Task (/home/john/meta-mender-community/yocto-raspberrypi4/build/../../kas/demos/meta-mender-raspberrypi-wifi/recipes-raspberrypi/images/core-image-raspberrypi-wifi.bb:do_image_bootimg) failed with exit code '1'
ERROR: core-image-minimal-initramfs-1.0-r0 do_rootfs: Unable to install packages. Command '/home/john/meta-mender-community/yocto-raspberrypi4/build/tmp/work/raspberrypi4_64-poky-linux/core-image-minimal-initramfs/1.0/recipe-sysroot-native/usr/bin/opkg --volatile-cache -f /home/john/meta-mender-community/yocto-raspberrypi4/build/tmp/work/raspberrypi4_64-poky-linux/core-image-minimal-initramfs/1.0/opkg.conf -t /home/john/meta-mender-community/yocto-raspberrypi4/build/tmp/work/raspberrypi4_64-poky-linux/core-image-minimal-initramfs/1.0/temp/ipktemp/ -o /home/john/meta-mender-community/yocto-raspberrypi4/build/tmp/work/raspberrypi4_64-poky-linux/core-image-minimal-initramfs/1.0/rootfs  --force_postinstall --prefer-arch-to-version  --add-exclude kernel-image-* --add-exclude kernel-image-* install base-passwd busybox cryptsetup initramfs-framework-base initramfs-module-install initramfs-module-install-efi initramfs-module-setup-live initramfs-module-udev run-postinsts udev' returned 255:
 * opkg_solver_install: No candidates to install initramfs-module-install (null)!

ERROR: Logfile of failure stored in: /home/john/meta-mender-community/yocto-raspberrypi4/build/tmp/work/raspberrypi4_64-poky-linux/core-image-minimal-initramfs/1.0/temp/log.do_rootfs.10642
ERROR: Task (/home/john/meta-mender-community/yocto-raspberrypi4/build/../poky/meta/recipes-core/images/core-image-minimal-initramfs.bb:do_rootfs) failed with exit code '1'

don't know what im missing.

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.