Hi,
I have problems to get an initramfs work which should be bundled to the kernel via INITRAMFS_IMAGE_BUNDLE.
I switched to "zeus" as yocto version to be able to work with .wic files. I have an i.MX8mm evalboard where I boot Linux from SD card.
That's why I configured the build with: DISTRO=fsl-imx-wayland MACHINE=imx8mmevk source imx-setup-release.sh -b build which results to the following variables in local.conf:
MACHINE ??= 'imx8mmevk'
DISTRO ?= 'fsl-imx-wayland'
The rest is as it comes by default.
What did I do?:
INITRAMFS_IMAGE = "core-image-tiny-initramfs"
INITRAMFS_IMAGE_BUNDLE = "1"
VIRTUAL-RUNTIME_dev_manager = "busybox-mdev"
COMPATIBLE_HOST = "(i.86|x86_64|aarch64).*-linux"
#IMAGE_CLASSES += "image_types_create_sdcard_symlink"
core-image-minimal-imx8mmevk-[timestamp].rootfs.wic.bz2 42,3 MiB
setenv mmcroot /dev/ram0 rootwait rw
Now the Linux boots properly but hangs with: Waiting for root device /dev/ram0...
It seems to me a core-image-minimal image without bundled initramfs image is just 200KB smaller. So I suspect the bundling does not properly work.
What goes wrong? What must be changed to let the Linux kernel use the bundled initramfs RAM filesystem??? Is there a problem with the scripts which bundle the initramfs to the wic file?
The actual thing I want to do is to setup my Linux with an overlayfs over the whole rootfs, and I can see core-image-tiny-initramfs is exactly doing that as it is configured so via its yocto/sources/poky/meta/recipes-core/initrdscripts/files/init-live.sh.
Thanx in advance for your help.
Solved! Go to Solution.
Meanwhile I found out I also have to do 2 things more to really boot with that bundled initramfs:
Well, now it boots the kernel with the bundled initramfs but stops now here:
[ 3.806081] mmc1: new ultra high speed SDR104 SDHC card at address 0001
[ 3.813856] mmcblk1: mmc1:0001 EB1QT 29.8 GiB
[ 3.820328] mmcblk1: p1 p2
[ 4.131276] imx6q-pcie 33800000.pcie: Phy link never came up
[ 4.136983] imx6q-pcie 33800000.pcie: failed to initialize host
[ 4.142921] imx6q-pcie 33800000.pcie: unable to add pcie port.
[ 4.161500] Freeing unused kernel memory: 40640K
[ 4.166205] Run /init as init process
Starting version 243.2+
Waiting for removable media...
I've searched the internet for this problem and found this one: Waiting for removable media ...
So the cool thing is I realise my core-image-tiny-initramfs has started up. :-) I just need to tweak the script recipes-core/initrdscripts/files/init-live.sh a bit, and I must remove the script part with the loop of waiting for plugging in a live-CD to get over that hang on "Waiting for removable media". I must set my own /dev/mmcblk1p2 partition to be the lower layer for the overlayfs. Just look at script function mount_and_boot() in init-live.sh...
I hope this answer may help other people, too. It took me lots of hours, and I have to thank the yocto guys at freenode chat irc for their incredible help to solve this problem.
-- Cheers, F.B.
OK, in the end I switched to yocto-version "dunfell" and it works there pretty easy with these settings:
INITRAMFS_IMAGE = "core-image-tiny-initramfs"
INITRAMFS_IMAGE_BUNDLE = "1"
INITRAMFS_KERNEL_IMAGE="${KERNEL_IMAGETYPE}-initramfs-${MACHINE}.bin"
VIRTUAL-RUNTIME_dev_manager = "busybox-mdev"
IMAGE_BOOT_FILES_append = " ${INITRAMFS_KERNEL_IMAGE};${KERNEL_IMAGETYPE}"
Hi,
Update 22 Oct 2023: If you are building from Yocto honister (3.4) and above (ie. honister, kirkstone etc) you may get this error message:
"ERROR: Variable IMAGE_BOOT_FILES_append file: [you base folder]/imx-linux-kirkstone/build/conf/local.conf line: 31 contains an operation using the old override syntax. Please convert this layer/metadata before attempting to use with a newer bitbake."
To fix this, you may need to replace the "_" to ":" due to syntax change to override from honister onwards (i built in kirkstone, didn't verify on newer releases though).
IMAGE_BOOT_FILES_append = " ${INITRAMFS_KERNEL_IMAGE};${KERNEL_IMAGETYPE}"
needs to be changed to
IMAGE_BOOT_FILES:append = " ${INITRAMFS_KERNEL_IMAGE};${KERNEL_IMAGETYPE}"
due to change in syntax for override documented here:
https://docs.yoctoproject.org/next/migration-guides/migration-3.4.html
Meanwhile I found out I also have to do 2 things more to really boot with that bundled initramfs:
Well, now it boots the kernel with the bundled initramfs but stops now here:
[ 3.806081] mmc1: new ultra high speed SDR104 SDHC card at address 0001
[ 3.813856] mmcblk1: mmc1:0001 EB1QT 29.8 GiB
[ 3.820328] mmcblk1: p1 p2
[ 4.131276] imx6q-pcie 33800000.pcie: Phy link never came up
[ 4.136983] imx6q-pcie 33800000.pcie: failed to initialize host
[ 4.142921] imx6q-pcie 33800000.pcie: unable to add pcie port.
[ 4.161500] Freeing unused kernel memory: 40640K
[ 4.166205] Run /init as init process
Starting version 243.2+
Waiting for removable media...
I've searched the internet for this problem and found this one: Waiting for removable media ...
So the cool thing is I realise my core-image-tiny-initramfs has started up. :-) I just need to tweak the script recipes-core/initrdscripts/files/init-live.sh a bit, and I must remove the script part with the loop of waiting for plugging in a live-CD to get over that hang on "Waiting for removable media". I must set my own /dev/mmcblk1p2 partition to be the lower layer for the overlayfs. Just look at script function mount_and_boot() in init-live.sh...
I hope this answer may help other people, too. It took me lots of hours, and I have to thank the yocto guys at freenode chat irc for their incredible help to solve this problem.
-- Cheers, F.B.
Hi F.B.,
Have you managed to tweak init-live.sh script so that your rootfs starts from /dev/mmcblk1p2?
Best regards,
Adde
Hi,
u-boot should set a command-line parameter flash_device=/dev/mmcblk1p2. Parse that in your script:
#
#early setup
#
mkdir -p /proc /sys /run /var/run
mount -t proc proc /proc
mount -t sysfs sysfs /sys
mount -t devtmpfs none /dev
# parse u-boot parameters
CMDLINE=$(cat /proc/cmdline)
for x in $CMDLINE
do
case $x in
flash_device*)
FLASHDEVICE="${x//flash_device=}"
;;
esac
done
Next, create a directory and mount the partition to that created dir.
Finally, switch to root of your filesystem to that mounted dir (here I assign it to a variable ROOT_MOUNT):
# Watches the udev event queue, and exits if all current events are handled
udevadm settle --timeout=3
# Don't run systemd-update-done on systemd-based live systems
# because it triggers a slow rebuild of ldconfig caches.
touch ${ROOT_MOUNT}/etc/.updated ${ROOT_MOUNT}/var/.updated
mount -n --move /proc ${ROOT_MOUNT}/proc
mount -n --move /sys ${ROOT_MOUNT}/sys
mount -n --move /dev ${ROOT_MOUNT}/dev
cd $ROOT_MOUNT
# busybox switch_root supports -c option
exec switch_root -c /dev/console $ROOT_MOUNT /sbin/init $CMDLINE ||
fatal "Couldn't switch_root, dropping to shell"
I hope this helps
Thank you so much fbre for you help! It works like a charm.:)
Best regards,
Adde
Hello F B,
Have you tried to generate the core-image-minimal-initramfs? The image is used for minimal RAM based rootfs. Let me know more details about the issue - how it can be reproduced ?
Regards
Yes, I also tried INITRAMFS_IMAGE = core-image-minimal-initramfs instead of INITRAMFS_IMAGE = core-image-tiny-initramfs. Also here, I had to add aarch64 to the .bb file of this image. But in the end I get a strange bitbake error on generating the rootfs:
"Some packages could not be installed....
The following packages have unmet dependencies:
initramfs-module-install : Depends: grub but it is not installable"
I haven't tried to go this path further since my actual aim was to have that overlayfs stuff of init-live.sh which is not in the scripts of core-image-minimal-initramfs, you know.
This all can be reproduced with a fresh git checkout of the current zeus branch. Just follow the instructions of https://www.nxp.com/docs/en/user-guide/IMX_YOCTO_PROJECT_USERS_GUIDE.pdf A.1Quick Start, and additionally do the things described in this posting.
I am currently running into the same issue on Zeus (5.4.70-2.3.11 release). Is there a quick resolution for this issue that anyone has found? I would rather not dive in if I don't have to, but since this is the last hurdle for my build I may not have much of a choice.