Skip to contentSkip to conversation

core-image-minimal-initramfs: use initramfs-framework for initialization by default

PATCH In review [email protected] 5 participants 10 messages Jul 24, 2017 – Aug 4, 2017

lore
Share & tools
lore
#0 lore raw

cover core-image-minimal-initramfs: use initramfs-framework for initialization by default

From: "Ng, Wei Tee" <[email protected]>

These patches is to initialize initramfs-framework by default. The initramfs-framework is able to boot up live image and enable the installation mechanism.

For the configuration to boot up live image, a new scriplet named setup-live module has been created to handle the removeable media detection and assign the rootfs.img. This is because the current rootfs module has no support for rootfs images, only rootfs partitions. A new initramfs-module-setup-live recipe is being created and added udev-extraconf rdepends on this module because it is needed for automounting process.

For the installation mechanism, it used the existing init-install-efi.sh script in the initrdscript and install a new module named initramfs-module-install-efi in the recipe.

This changes has been verified with build test, boot up test and installation test on Minnowboard Max platform.

Please review and provide feedback if you have any. The patches are targeted for merging into poky master branch.

Thanks and regards,
Wei Tee

The following changes since commit 15901164ee71dec0906dadaff08f3365a66feb05:

dev-manual, ref-manual: Eliminated pre-built section (2017-07-22 09:19:25 +0100)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib weiteeng/initramfs
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=weiteeng/initramfs

Ng, Wei Tee (3):
initramfs-framework: module to support boot live image
initramfs-framework: include install-efi module in recipe for
installation
core-image-minimal-initramfs: use initramfs-framework by default

 .../images/core-image-minimal-initramfs.bb         |   2 +-
 .../initramfs-framework/install-efi.sh             | 276 +++++++++++++++++++++
 .../initrdscripts/initramfs-framework/setup-live   |  66 +++++
 .../initrdscripts/initramfs-framework_1.0.bb       |  28 ++-
 4 files changed, 368 insertions(+), 4 deletions(-)
 create mode 100644 meta/recipes-core/initrdscripts/initramfs-framework/install-efi.sh
 create mode 100644 meta/recipes-core/initrdscripts/initramfs-framework/setup-live
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/3 initramfs-framework: module to support boot live image

From: "Ng, Wei Tee" <[email protected]>

setup-live module is a new module being introduced to integrate the functionality of init-live.sh into new scriptlet named setup-live in order to support the live boot image. The udev-extraconf rdepends is being added to perform automounting. It gets to run before the rootfs and finish module.

The setup-live scriplet include the changes for:

- Create a conditional loop for the bootparam_root variable. If it is not set, then it will boot from ROOT_IMAGE. Else, it will boot normally which is not from removable media.

- Gives a standard path to the original boot disk mount which can be used to. While /media/sda is a good guess, it isn't always right, nor is it a good assumption that only one boot disk is in the system.

- The current rootfs module has no support for rootfs images, currently it only support for rootfs partitions for wic image. Therefore, there is a need to assign the rootfs image for live image.

[YOCTO #11701]

---
 .../initrdscripts/initramfs-framework/setup-live   | 66 ++++++++++++++++++++++
 .../initrdscripts/initramfs-framework_1.0.bb       | 13 ++++-
 2 files changed, 77 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-core/initrdscripts/initramfs-framework/setup-live
meta/recipes-core/initrdscripts/initramfs-framework/setup-live new file +66 -0
new file mode 100644
index 0000000..ec4a139
@@ -0,0 +1,66 @@
+#/bin/sh
+# Copyright (C) 2011 O.S. Systems Software LTDA.
+# Licensed on MIT
+
+setup_enabled() {
+	return 0
+}
+
+setup_run() {
+ROOT_IMAGE="rootfs.img"
+ISOLINUX=""
+ROOT_DISK=""
+shelltimeout=30
+
+	if [ -z $bootparam_root ]; then
+		echo "Waiting for removable media..."
+		C=0
+		while true
+		do
+		  for i in `ls /run/media 2>/dev/null`; do
+		      if [ -f /run/media/$i/$ROOT_IMAGE ] ; then
+				found="yes"
+				ROOT_DISK="$i"
+				break
+			  elif [ -f /run/media/$i/isolinux/$ROOT_IMAGE ]; then
+				found="yes"
+				ISOLINUX="isolinux"
+				ROOT_DISK="$i"
+				break
+		      fi
+		  done
+		  if [ "$found" = "yes" ]; then
+		      break;
+		  fi
+		  # don't wait for more than $shelltimeout seconds, if it's set
+		  if [ -n "$shelltimeout" ]; then
+		      echo -n " " $(( $shelltimeout - $C ))
+		      if [ $C -ge $shelltimeout ]; then
+		           echo "..."
+			   echo "Mounted filesystems"
+		           mount | grep media
+		           echo "Available block devices"
+		           cat /proc/partitions
+		           fatal "Cannot find $ROOT_IMAGE file in /run/media/* , dropping to a shell "
+		      fi
+		      C=$(( C + 1 ))
+		  fi
+		  sleep 1
+		done
+		# The existing rootfs module has no support for rootfs images. Assign the rootfs image.
+		bootparam_root="/run/media/$ROOT_DISK/$ISOLINUX/$ROOT_IMAGE"
+	else
+		break
+	fi
+
+	if [ "$bootparam_LABEL" != "boot" -a -f /init.d/$bootparam_LABEL.sh ] ; then
+		if [ -f /run/media/$i/$ISOLINUX/$ROOT_IMAGE ] ; then
+		    ./init.d/$bootparam_LABEL.sh $i/$ISOLINUX $ROOT_IMAGE $video_mode $vga_mode $console_params
+		else
+		    fatal "Could not find $bootparam_LABEL script"
+		fi
+
+		# If we're getting here, we failed...
+		fatal "Target $bootparam_LABEL failed"
+	fi
+}
meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb +11 -2
index 67a1b04..211e89d 100644
@@ -13,7 +13,8 @@ SRC_URI = "file://init \
            file://mdev \
            file://udev \
            file://e2fs \
-           file://debug"
+           file://debug \
+           file://setup-live"
 
 S = "${WORKDIR}"
 
@@ -25,6 +26,9 @@ do_install() {
     install -m 0755 ${WORKDIR}/rootfs ${D}/init.d/90-rootfs
     install -m 0755 ${WORKDIR}/finish ${D}/init.d/99-finish
 
+    # setup-live
+    install -m 0755 ${WORKDIR}/setup-live ${D}/init.d/80-setup-live
+
     # mdev
     install -m 0755 ${WORKDIR}/mdev ${D}/init.d/01-mdev
 
@@ -48,7 +52,8 @@ PACKAGES = "${PN}-base \
             initramfs-module-udev \
             initramfs-module-e2fs \
             initramfs-module-rootfs \
-            initramfs-module-debug"
+            initramfs-module-debug \
+            initramfs-module-setup-live"
 
 FILES_${PN}-base = "/init /init.d/99-finish /dev"
 
@@ -68,6 +73,10 @@ SUMMARY_initramfs-module-udev = "initramfs support for udev"
 RDEPENDS_initramfs-module-udev = "${PN}-base udev"
 FILES_initramfs-module-udev = "/init.d/01-udev"
 
+SUMMARY_initramfs-module-setup-live = "initramfs support for setup live"
+RDEPENDS_initramfs-module-setup-live = "${PN}-base udev-extraconf"
+FILES_initramfs-module-setup-live = "/init.d/80-setup-live"
+
 SUMMARY_initramfs-module-e2fs = "initramfs support for ext4/ext3/ext2 filesystems"
 RDEPENDS_initramfs-module-e2fs = "${PN}-base"
 FILES_initramfs-module-e2fs = "/init.d/10-e2fs"
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/3 initramfs-framework: include install-efi module in recipe for installation

In reply to [email protected]

From: "Ng, Wei Tee" <[email protected]>

Utilized the existing init-install-efi.sh script and renamed it to install-efi.sh to manage the installation process of images in initramfs-framework model. This script will be executed when "install" option is being chosen in the grub menu and install the image on the target platform. A new install-efi module is being added in the recipe to handle the installation process using initramfs-framework.

[YOCTO #10989]

---
This version solve the failure of the oe-selftest which is related to the allarch issues.

 .../initramfs-framework/install-efi.sh             | 276 +++++++++++++++++++++
 .../initrdscripts/initramfs-framework_1.0.bb       |  19 +-
 2 files changed, 292 insertions(+), 3 deletions(-)
 create mode 100644 meta/recipes-core/initrdscripts/initramfs-framework/install-efi.sh
meta/recipes-core/initrdscripts/initramfs-framework/install-efi.sh new file +276 -0
new file mode 100644
index 0000000..5ad3a60
@@ -0,0 +1,276 @@
+#!/bin/sh -e
+#
+# Copyright (c) 2012, Intel Corporation.
+# All rights reserved.
+#
+# install.sh [device_name] [rootfs_name]
+#
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+# We need 20 Mb for the boot partition
+boot_size=20
+
+# 5% for swap
+swap_ratio=5
+
+# Get a list of hard drives
+hdnamelist=""
+live_dev_name=`cat /proc/mounts | grep ${1%/} | awk '{print $1}'`
+live_dev_name=${live_dev_name#\/dev/}
+# Only strip the digit identifier if the device is not an mmc
+case $live_dev_name in
+    mmcblk*)
+    ;;
+    nvme*)
+    ;;
+    *)
+        live_dev_name=${live_dev_name%%[0-9]*}
+    ;;
+esac
+
+echo "Searching for hard drives ..."
+
+# Some eMMC devices have special sub devices such as mmcblk0boot0 etc
+# we're currently only interested in the root device so pick them wisely
+devices=`ls /sys/block/ | grep -v mmcblk` || true
+mmc_devices=`ls /sys/block/ | grep "mmcblk[0-9]\{1,\}$"` || true
+devices="$devices $mmc_devices"
+
+for device in $devices; do
+    case $device in
+        loop*)
+            # skip loop device
+            ;;
+        sr*)
+            # skip CDROM device
+            ;;
+        ram*)
+            # skip ram device
+            ;;
+        *)
+            # skip the device LiveOS is on
+            # Add valid hard drive name to the list
+            case $device in
+                $live_dev_name*)
+                # skip the device we are running from
+                ;;
+                *)
+                    hdnamelist="$hdnamelist $device"
+                ;;
+            esac
+            ;;
+    esac
+done
+
+if [ -z "${hdnamelist}" ]; then
+    echo "You need another device (besides the live device /dev/${live_dev_name}) to install the image. Installation aborted."
+    exit 1
+fi
+
+TARGET_DEVICE_NAME=""
+for hdname in $hdnamelist; do
+    # Display found hard drives and their basic info
+    echo "-------------------------------"
+    echo /dev/$hdname
+    if [ -r /sys/block/$hdname/device/vendor ]; then
+        echo -n "VENDOR="
+        cat /sys/block/$hdname/device/vendor
+    fi
+    if [ -r /sys/block/$hdname/device/model ]; then
+        echo -n "MODEL="
+        cat /sys/block/$hdname/device/model
+    fi
+    if [ -r /sys/block/$hdname/device/uevent ]; then
+        echo -n "UEVENT="
+        cat /sys/block/$hdname/device/uevent
+    fi
+    echo
+done
+
+# Get user choice
+while true; do
+    echo "Please select an install target or press n to exit ($hdnamelist ): "
+    read answer
+    if [ "$answer" = "n" ]; then
+        echo "Installation manually aborted."
+        exit 1
+    fi
+    for hdname in $hdnamelist; do
+        if [ "$answer" = "$hdname" ]; then
+            TARGET_DEVICE_NAME=$answer
+            break
+        fi
+    done
+    if [ -n "$TARGET_DEVICE_NAME" ]; then
+        break
+    fi
+done
+
+if [ -n "$TARGET_DEVICE_NAME" ]; then
+    echo "Installing image on /dev/$TARGET_DEVICE_NAME ..."
+else
+    echo "No hard drive selected. Installation aborted."
+    exit 1
+fi
+
+device=/dev/$TARGET_DEVICE_NAME
+
+#
+# The udev automounter can cause pain here, kill it
+#
+rm -f /etc/udev/rules.d/automount.rules
+rm -f /etc/udev/scripts/mount*
+
+#
+# Unmount anything the automounter had mounted
+#
+umount ${device}* 2> /dev/null || /bin/true
+
+mkdir -p /tmp
+
+# Create /etc/mtab if not present
+if [ ! -e /etc/mtab ] && [ -e /proc/mounts ]; then
+    ln -sf /proc/mounts /etc/mtab
+fi
+
+disk_size=$(parted ${device} unit mb print | grep '^Disk .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//")
+
+swap_size=$((disk_size*swap_ratio/100))
+rootfs_size=$((disk_size-boot_size-swap_size))
+
+rootfs_start=$((boot_size))
+rootfs_end=$((rootfs_start+rootfs_size))
+swap_start=$((rootfs_end))
+
+# MMC devices are special in a couple of ways
+# 1) they use a partition prefix character 'p'
+# 2) they are detected asynchronously (need rootwait)
+rootwait=""
+part_prefix=""
+if [ ! "${device#/dev/mmcblk}" = "${device}" ] || \
+   [ ! "${device#/dev/nvme}" = "${device}" ]; then
+    part_prefix="p"
+    rootwait="rootwait"
+fi
+
+# USB devices also require rootwait
+if [ -n `readlink /dev/disk/by-id/usb* | grep $TARGET_DEVICE_NAME` ]; then
+    rootwait="rootwait"
+fi
+
+bootfs=${device}${part_prefix}1
+rootfs=${device}${part_prefix}2
+swap=${device}${part_prefix}3
+
+echo "*****************"
+echo "Boot partition size:   $boot_size MB ($bootfs)"
+echo "Rootfs partition size: $rootfs_size MB ($rootfs)"
+echo "Swap partition size:   $swap_size MB ($swap)"
+echo "*****************"
+echo "Deleting partition table on ${device} ..."
+dd if=/dev/zero of=${device} bs=512 count=35
+
+echo "Creating new partition table on ${device} ..."
+parted ${device} mklabel gpt
+
+echo "Creating boot partition on $bootfs"
+parted ${device} mkpart boot fat32 0% $boot_size
+parted ${device} set 1 boot on
+
+echo "Creating rootfs partition on $rootfs"
+parted ${device} mkpart root ext3 $rootfs_start $rootfs_end
+
+echo "Creating swap partition on $swap"
+parted ${device} mkpart swap linux-swap $swap_start 100%
+
+parted ${device} print
+
+echo "Formatting $bootfs to vfat..."
+mkfs.vfat $bootfs
+
+echo "Formatting $rootfs to ext3..."
+mkfs.ext3 $rootfs
+
+echo "Formatting swap partition...($swap)"
+mkswap $swap
+
+mkdir /tgt_root
+mkdir /src_root
+mkdir -p /boot
+
+# Handling of the target root partition
+mount $rootfs /tgt_root
+mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /src_root
+echo "Copying rootfs files..."
+cp -a /src_root/* /tgt_root
+if [ -d /tgt_root/etc/ ] ; then
+    boot_uuid=$(blkid -o value -s UUID ${bootfs})
+    swap_part_uuid=$(blkid -o value -s PARTUUID ${swap})
+    echo "/dev/disk/by-partuuid/$swap_part_uuid                swap             swap       defaults              0  0" >> /tgt_root/etc/fstab
+    echo "UUID=$boot_uuid              /boot            vfat       defaults              1  2" >> /tgt_root/etc/fstab
+    # We dont want udev to mount our root device while we're booting...
+    if [ -d /tgt_root/etc/udev/ ] ; then
+        echo "${device}" >> /tgt_root/etc/udev/mount.blacklist
+    fi
+fi
+
+umount /src_root
+
+# Handling of the target boot partition
+mount $bootfs /boot
+echo "Preparing boot partition..."
+
+EFIDIR="/boot/EFI/BOOT"
+mkdir -p $EFIDIR
+# Copy the efi loader
+cp /run/media/$1/EFI/BOOT/*.efi $EFIDIR
+
+if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then
+    root_part_uuid=$(blkid -o value -s PARTUUID ${rootfs})
+    GRUBCFG="$EFIDIR/grub.cfg"
+    cp /run/media/$1/EFI/BOOT/grub.cfg $GRUBCFG
+    # Update grub config for the installed image
+    # Delete the install entry
+    sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG
+    # Delete the initrd lines
+    sed -i "/initrd /d" $GRUBCFG
+    # Delete any LABEL= strings
+    sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG
+    # Delete any root= strings
+    sed -i "s/ root=[^ ]*/ /g" $GRUBCFG
+    # Add the root= and other standard boot options
+    sed -i "s@linux /vmlinuz *@linux /vmlinuz root=PARTUUID=$root_part_uuid rw $rootwait quiet @" $GRUBCFG
+fi
+
+if [ -d /run/media/$1/loader ]; then
+    rootuuid=$(blkid -o value -s PARTUUID ${rootfs})
+    SYSTEMDBOOT_CFGS="/boot/loader/entries/*.conf"
+    # copy config files for systemd-boot
+    cp -dr /run/media/$1/loader /boot
+    # delete the install entry
+    rm -f /boot/loader/entries/install.conf
+    # delete the initrd lines
+    sed -i "/initrd /d" $SYSTEMDBOOT_CFGS
+    # delete any LABEL= strings
+    sed -i "s/ LABEL=[^ ]*/ /" $SYSTEMDBOOT_CFGS
+    # delete any root= strings
+    sed -i "s/ root=[^ ]*/ /" $SYSTEMDBOOT_CFGS
+    # add the root= and other standard boot options
+    sed -i "s@options *@options root=PARTUUID=$rootuuid rw $rootwait quiet @" $SYSTEMDBOOT_CFGS
+fi
+
+umount /tgt_root
+
+cp /run/media/$1/vmlinuz /boot
+
+umount /boot
+
+sync
+
+echo "Remove your installation media, and press ENTER"
+
+read enter
+
+echo "Rebooting..."
+reboot -f
meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb +16 -3
index 211e89d..9d69a69 100644
@@ -5,7 +5,11 @@ RDEPENDS_${PN} += "${VIRTUAL-RUNTIME_base-utils}"
 
 PR = "r2"
 
-inherit allarch
+# While the packages maybe an allarch due to it being a
+# simple script, reality is that it is Host specific based
+# on the COMPATIBLE_HOST below, which needs to take precedence
+#inherit allarch
+INHIBIT_DEFAULT_DEPS = "1"
 
 SRC_URI = "file://init \
            file://rootfs \
@@ -14,7 +18,8 @@ SRC_URI = "file://init \
            file://udev \
            file://e2fs \
            file://debug \
-           file://setup-live"
+           file://setup-live \
+           file://install-efi.sh"
 
 S = "${WORKDIR}"
 
@@ -41,6 +46,9 @@ do_install() {
     # debug
     install -m 0755 ${WORKDIR}/debug ${D}/init.d/00-debug
 
+    # install-efi
+    install -m 0755 ${WORKDIR}/install-efi.sh ${D}/init.d/install-efi.sh
+
     # Create device nodes expected by some kernels in initramfs
     # before even executing /init.
     install -d ${D}/dev
@@ -53,7 +61,8 @@ PACKAGES = "${PN}-base \
             initramfs-module-e2fs \
             initramfs-module-rootfs \
             initramfs-module-debug \
-            initramfs-module-setup-live"
+            initramfs-module-setup-live \
+            initramfs-module-install-efi"
 
 FILES_${PN}-base = "/init /init.d/99-finish /dev"
 
@@ -88,3 +97,7 @@ FILES_initramfs-module-rootfs = "/init.d/90-rootfs"
 SUMMARY_initramfs-module-debug = "initramfs dynamic debug support"
 RDEPENDS_initramfs-module-debug = "${PN}-base"
 FILES_initramfs-module-debug = "/init.d/00-debug"
+
+SUMMARY_initramfs-module-install-efi = "initramfs support for installation option"
+RDEPENDS_initramfs-module-install-efi = "${PN}-base parted e2fsprogs-mke2fs dosfstools util-linux-blkid"
+FILES_initramfs-module-install-efi = "/init.d/install-efi.sh"
Signature · 1 line
2.7.4
#3 lore raw

Re: [PATCH 2/3] initramfs-framework: include install-efi module in recipe for installation

meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb FILES_initramfs-module-rootfs = "/init.d/90-rootfs" · line 103

Quoted 4 lines · On Sun, 2017-07-23 at 16:51 -0700, [email protected] wrote:
meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb +4 -0
+
+SUMMARY_initramfs-module-install-efi = "initramfs support for installation option"
+RDEPENDS_initramfs-module-install-efi = "${PN}-base parted e2fsprogs-mke2fs dosfstools util-linux-blkid"
+FILES_initramfs-module-install-efi = "/init.d/install-efi.sh"

By making the install-efi module a part of initramfs-module that is enabled unconditionally, parted now needs to be built for the target even when only the rest of initramfs-module is used.

Can the module please be split out into its own recipe?

Alternatively one could add a PACKAGECONFIG for it, but that's less flexible.

Signature · 6 lines
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.
#4 lore raw

PATCH 3/3 core-image-minimal-initramfs: use initramfs-framework by default

In reply to [email protected]

From: "Ng, Wei Tee" <[email protected]>

Use the initramfs-framework for initialization by default due to the modularity and expansibility.

[YOCTO #10987]

---
 meta/recipes-core/images/core-image-minimal-initramfs.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/images/core-image-minimal-initramfs.bb +1 -1
index 5794a25..c1f2855 100644
@@ -3,7 +3,7 @@ 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."
 
-PACKAGE_INSTALL = "initramfs-live-boot initramfs-live-install initramfs-live-install-efi ${VIRTUAL-RUNTIME_base-utils} udev base-passwd ${ROOTFS_BOOTSTRAP_INSTALL}"
+PACKAGE_INSTALL = "initramfs-framework-base initramfs-module-udev initramfs-module-setup-live initramfs-module-install-efi ${VIRTUAL-RUNTIME_base-utils} udev base-passwd ${ROOTFS_BOOTSTRAP_INSTALL}"
 
 # Do not pollute the initrd image with rootfs features
 IMAGE_FEATURES = ""
Signature · 1 line
2.7.4
#5 lore raw

Re: [PATCH 3/3] core-image-minimal-initramfs: use initramfs-framework by default

Quoted 11 lines · On Sun, 2017-07-23 at 16:51 -0700, [email protected] wrote:

From: "Ng, Wei Tee" <[email protected]>

Use the initramfs-framework for initialization by default due to the modularity and expansibility.

[YOCTO #10987]

---
 meta/recipes-core/images/core-image-minimal-initramfs.bb | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)

I'm afraid I had to revert this change:

http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=fab2219af4a6566124
cf95d1d2648d4729391baf

because it was causing oe-selftest failures as shown here:

https://autobuilder.yocto.io/builders/nightly-oe-selftest/builds/415/st
eps/Running%20oe-selftest/logs/stdio

Cheers,

Richard

#6 lore raw

Re: [PATCH 3/3] core-image-minimal-initramfs: use initramfs-framework by default

Hi Richard,

Noted with the changes. I had try to reproduce the same failure log that you send to me. However, the result is different.

How can I run the oe-selftest to test out the patch on my machine correctly? Can you verify with me whether the steps below are the correct steps?
Firstly git clone a poky and meta-intel layer, then source a build. I also enable the oe-selftest configuration on my local.conf and run the command "oe-selftest -r runqemu.RunqemuTests.test_boot_deploy_hddimg"?

I try to test the latest poky master branch without my "use initramfs-framework by default" commit, the oe-selftest for those two testcases are failed too) Here is the failure log that I captured: http://pastebin.intel.com/hefizelixo.vhdl

Regards,
Wei Tee

-----Original Message-----
From: Richard Purdie [mailto:[email protected]]
Sent: Sunday, July 30, 2017 3:48 PM
To: Ng, Wei Tee <[email protected]>; [email protected]
Cc: Wold, Saul <[email protected]>
Subject: Re: [OE-core] [PATCH 3/3] core-image-minimal-initramfs: use initramfs-framework by default

Quoted 11 lines · On Sun, 2017-07-23 at 16:51 -0700, [email protected] wrote:

From: "Ng, Wei Tee" <[email protected]>

Use the initramfs-framework for initialization by default due to the modularity and expansibility.

[YOCTO #10987]

---
 meta/recipes-core/images/core-image-minimal-initramfs.bb | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)

I'm afraid I had to revert this change:

http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=fab2219af4a6566124
cf95d1d2648d4729391baf

because it was causing oe-selftest failures as shown here:

https://autobuilder.yocto.io/builders/nightly-oe-selftest/builds/415/st
eps/Running%20oe-selftest/logs/stdio

Cheers,

Richard

#7 lore raw

Re: [PATCH 3/3] core-image-minimal-initramfs: use initramfs-framework by default

Hi Wei Tee,

I'm not sure what is causing the issue you're seeing when trying to run the selftests, but I was able to track down the issue causing the selftests to fail in normal usage.

Apparently, only systemd-boot sets no "root=" kernel command line parameter when booting live. Our other bootloaders (grub, syslinux) set root=/dev/ram0. The selftests use syslinux.

From what I can tell from the kernel docs, this is basically just a sentinel value to say "mount the initrd as root":
https://www.kernel.org/doc/html/v4.11/admin-guide/initrd.html

We already have the procedure correct, and just have to account for /dev/ram0 as well now.

I'll send a patch for it.

Thanks,
Cal

Quoted 45 lines · Wei Tee

Hi Richard,

Noted with the changes. I had try to reproduce the same failure log that you send to me. However, the result is different.

How can I run the oe-selftest to test out the patch on my machine correctly? Can you verify with me whether the steps below are the correct steps?
Firstly git clone a poky and meta-intel layer, then source a build. I also enable the oe-selftest configuration on my local.conf and run the command "oe-selftest -r runqemu.RunqemuTests.test_boot_deploy_hddimg"?

I try to test the latest poky master branch without my "use initramfs-framework by default" commit, the oe-selftest for those two testcases are failed too) Here is the failure log that I captured: http://pastebin.intel.com/hefizelixo.vhdl

Regards,
Wei Tee

-----Original Message-----
From: Richard Purdie [mailto:[email protected]]
Sent: Sunday, July 30, 2017 3:48 PM
To: Ng, Wei Tee <[email protected]>; [email protected]
Cc: Wold, Saul <[email protected]>
Subject: Re: [OE-core] [PATCH 3/3] core-image-minimal-initramfs: use initramfs-framework by default

Quoted 11 lines · On Sun, 2017-07-23 at 16:51 -0700, [email protected] wrote:

From: "Ng, Wei Tee" <[email protected]>

Use the initramfs-framework for initialization by default due to the modularity and expansibility.

[YOCTO #10987]

---
  meta/recipes-core/images/core-image-minimal-initramfs.bb | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

I'm afraid I had to revert this change:

http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=fab2219af4a6566124
cf95d1d2648d4729391baf

because it was causing oe-selftest failures as shown here:

https://autobuilder.yocto.io/builders/nightly-oe-selftest/builds/415/st
eps/Running%20oe-selftest/logs/stdio

Cheers,

Richard

#8 lore raw

PATCH 1/1 initramfs-framework/setup-live: also boot live image if root=/dev/ram0

Our grub and syslinux bootloaders both define root=/dev/ram0 for live images by default. Kernel docs show that root=/dev/ram0 is just a sentinel value to mount the initrd as root, which we're already doing in this path, so just check for a missing root= parameter OR root=/dev/ram0.

---
NOTE: for the selftests to be fixed, the patch "initramfs-framework/setup-live: remove superfluous break" needs to be merged as well.

 meta/recipes-core/initrdscripts/initramfs-framework/setup-live | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/initrdscripts/initramfs-framework/setup-live +1 -1
index 591c93a..b98a321 100644
@@ -12,7 +12,7 @@ ISOLINUX=""
 ROOT_DISK=""
 shelltimeout=30
 
-	if [ -z $bootparam_root ]; then
+	if [ -z $bootparam_root -o $bootparam_root = "/dev/ram0" ]; then
 		echo "Waiting for removable media..."
 		C=0
 		while true
Signature · 1 line
2.9.4
#9 lore raw

✗ patchtest: failure for core-image-minimal-initramfs: use initramfs-framework for initialization by default (rev2)

In reply to [email protected]

== Series Details ==

Series: core-image-minimal-initramfs: use initramfs-framework for initialization by default (rev2)
Revision: 2
URL : https://patchwork.openembedded.org/series/7879/
State : failure

== Summary ==

Thank you for submitting this patch series to OpenEmbedded Core. This is an automated response. Several tests have been executed on the proposed series by patchtest resulting in the following failures:

* Issue Series does not apply on top of target branch [test_series_merge_on_head]
Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at a5bb13a5d7)

If you believe any of these test results are incorrect, please reply to the mailing list ([email protected]) raising your concerns. Otherwise we would appreciate you correcting the issues and submitting a new version of the patchset if applicable. Please ensure you add/increment the version number when sending the new version (i.e. [PATCH] -> [PATCH v2] -> [PATCH v3] -> ...).

---

Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe