All of lore.kernel.org
 help / color / mirror / Atom feed
* [poky][master] [PATCH v6 0/1] initramfs-framework:configuration to boot up live image
@ 2017-07-12 19:29 wei.tee.ng
  2017-07-12 19:29 ` [PATCH v6 1/1] initramfs-framework: module to support boot " wei.tee.ng
  0 siblings, 1 reply; 3+ messages in thread
From: wei.tee.ng @ 2017-07-12 19:29 UTC (permalink / raw)
  To: openembedded-core; +Cc: wei.tee.ng

From: "Ng, Wei Tee" <wei.tee.ng@intel.com>

Hi, 

This patch is to get initramfs-framework able 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. 

This version included the changes for typo, re-correct the indenting issues and squashing 2 commits into single commit. It involve the creation of initramfs-module-setup-live in the recipe and added udev-extraconf rdepends on this module because it is needed for automounting process. 

This changes has been verified with build test and boot up 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 81498aac9560fbeaeb58eaada32ce80e0ea51628:

  yocto-project-qs: Updated Next Steps list (2017-07-12 00:28:16 +0100)

are available in the git repository at:

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

Ng, Wei Tee (1):
  initramfs-framework: module to support boot live image

 .../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

-- 
2.7.4



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v6 1/1] initramfs-framework: module to support boot live image
  2017-07-12 19:29 [poky][master] [PATCH v6 0/1] initramfs-framework:configuration to boot up live image wei.tee.ng
@ 2017-07-12 19:29 ` wei.tee.ng
  2017-07-31 20:32   ` Patrick Ohly
  0 siblings, 1 reply; 3+ messages in thread
From: wei.tee.ng @ 2017-07-12 19:29 UTC (permalink / raw)
  To: openembedded-core; +Cc: wei.tee.ng

From: "Ng, Wei Tee" <wei.tee.ng@intel.com>

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]

Signed-off-by: Ng, Wei Tee <wei.tee.ng@intel.com>
---
This version is to re-correct the typo in the message.

 .../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

diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/setup-live b/meta/recipes-core/initrdscripts/initramfs-framework/setup-live
new file mode 100644
index 0000000..ec4a139
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/setup-live
@@ -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
+}
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
index 67a1b04..211e89d 100644
--- a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
@@ -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"
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v6 1/1] initramfs-framework: module to support boot live image
  2017-07-12 19:29 ` [PATCH v6 1/1] initramfs-framework: module to support boot " wei.tee.ng
@ 2017-07-31 20:32   ` Patrick Ohly
  0 siblings, 0 replies; 3+ messages in thread
From: Patrick Ohly @ 2017-07-31 20:32 UTC (permalink / raw)
  To: wei.tee.ng, openembedded-core

On Wed, 2017-07-12 at 12:29 -0700, wei.tee.ng@intel.com wrote:
> +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"

Same problem as with install-efi: this RDEPENDS in initramfs-framework
makes building the recipe more complicated than strictly necessary.

Please move setup-live to its own recipe.

-- 
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.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-31 20:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-12 19:29 [poky][master] [PATCH v6 0/1] initramfs-framework:configuration to boot up live image wei.tee.ng
2017-07-12 19:29 ` [PATCH v6 1/1] initramfs-framework: module to support boot " wei.tee.ng
2017-07-31 20:32   ` Patrick Ohly

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.