Initramfs embedded in kernel

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Initramfs embedded in kernel

913 Views
adde_ado
Contributor III

Hi,

I have been struggling with initramfs last couple of days without success.

My intention is to use initramfs to unlock encrypted rootfs partition before kernel starts to mount that particular partition. 

I'm using my own image-small-initramfs.bb recipe to generate initramfs.

After bitbake build "image-small-initramfs-imx8mmevk-20220421133958.rootfs.cpio.gz" is created.

I have also added path to that file in linux menuconfig.

That is done in "Initramfs source file" and string/path looks something like this:

/home/user/...../build/tmp/deploy/images/imx8mmevk/image-small-initramfs-imx8mmevk.cpio.gz

local.conf is also updated with flowing information. 

INITRAMFS_IMAGE = "image-small-initramfs"
INITRAMFS_IMAGE_BUNDLE = "1"

Yocto builds fine. No error or warnings.

When i boot my board I change  mmcroot to "mmcroot /dev/ram0 rootwait rw"

The kernel starts and kernel panic occurs.

[ 3.714140] Freeing unused kernel memory: 4800K
[ 3.732554] Run /init as init process
[ 3.736274] Failed to execute /init (error -13)
[ 3.740822] Run /sbin/init as init process
[ 3.744970] Run /etc/init as init process
[ 3.749006] Run /bin/init as init process
[ 3.753052] Run /bin/sh as init process
[ 3.758574] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000
[ 3.766247] CPU: 3 PID: 1 Comm: sh Not tainted 5.4.70-2.3.2+g8c73bc625c4d #1
[ 3.773299] Hardware name: FSL i.MX8MM EVK board (DT)
[ 3.778355] Call trace:
[ 3.780812] dump_backtrace+0x0/0x140
[ 3.784478] show_stack+0x14/0x20
[ 3.787800] dump_stack+0xb4/0x114
[ 3.791207] panic+0x158/0x324
[ 3.794268] do_exit+0x95c/0x980
[ 3.797498] do_group_exit+0x40/0xa0
[ 3.801080] __arm64_sys_exit_group+0x14/0x18
[ 3.805443] el0_svc_common.constprop.0+0x68/0x160
[ 3.810236] el0_svc_handler+0x20/0x80
[ 3.813990] el0_svc+0x8/0x208
[ 3.817052] SMP: stopping secondary CPUs
[ 3.821301] Kernel Offset: disabled
[ 3.824793] CPU features: 0x0002,2000200c
[ 3.828805] Memory Limit: none
[ 3.831868] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000 ]---

 

Does anyone understand what I'm doing wrong.

This is image-small-initramfs.bb recipe:

DESCRIPTION = "Minimal console-only initramfs image."

PACKAGE_INSTALL= "\
base-files \
base-passwd \
busybox \
initscripts \
${ROOTFS_BOOTSTRAP_INSTALL} \
"

IMAGE_LINGUAS = " "

LICENSE = "MIT"

IMAGE_FEATURES = ""

export IMAGE_BASENAME = "image-small-initramfs"

IMAGE_FSTYPES = "${INITRAMFS_FSTYPES} ${INITRAMFS_FSTYPES}.u-boot"
inherit image

IMAGE_ROOTFS_SIZE = "8192"

 

 

Regards,

Adde

 

 

 

 

 

 

 

Labels (1)
0 Kudos
Reply
0 Replies