Openembedded Core Discussions
 help / color / mirror / Atom feed
* [poky][master][PATCH v2 0/3] initramfs-framework: configuration to boot up live image
@ 2017-06-30  0:30 wei.tee.ng
  2017-06-30  0:30 ` [PATCH v2 1/3] initramfs-framework: udev: Add a runtime dependency on udev-extraconf wei.tee.ng
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: wei.tee.ng @ 2017-06-30  0:30 UTC (permalink / raw)
  To: openembedded-core; +Cc: wei.tee.ng

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

This patch is to get initramfs-framework able to boot up live image.
In order to implement this framework, there is a need to add runtime                                                                                                                                                                     dependency on udev-extraconf due to the automounting process.

Secondly, a new scriptlet 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 change 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 98099349e358a9caaec8ec81f0d4abe588909cfe:

  bitbake: npm fetcher: fix unknown variable name. (2017-06-29 14:33:42 +0100)

are available in the git repository at:

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

Ng, Wei Tee (3):
  initramfs-framework: udev: Add a runtime dependency on udev-extraconf
  initramfs-framework: setup-live: detect media and assign rootfs image
  initramfs-framwork: module to support boot live image

 .../initrdscripts/initramfs-framework/setup-live   | 67 ++++++++++++++++++++++
 .../initrdscripts/initramfs-framework_1.0.bb       |  8 ++-
 2 files changed, 72 insertions(+), 3 deletions(-)
 create mode 100644 meta/recipes-core/initrdscripts/initramfs-framework/setup-live

-- 
2.7.4



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

* [PATCH v2 1/3] initramfs-framework: udev: Add a runtime dependency on udev-extraconf
  2017-06-30  0:30 [poky][master][PATCH v2 0/3] initramfs-framework: configuration to boot up live image wei.tee.ng
@ 2017-06-30  0:30 ` wei.tee.ng
  2017-07-03 20:17   ` Otavio Salvador
  2017-06-30  0:30 ` [PATCH v2 2/3] initramfs-framework: setup-live: detect media and assign rootfs image wei.tee.ng
  2017-06-30  0:30 ` [PATCH v2 3/3] initramfs-framwork: module to support boot live image wei.tee.ng
  2 siblings, 1 reply; 9+ messages in thread
From: wei.tee.ng @ 2017-06-30  0:30 UTC (permalink / raw)
  To: openembedded-core; +Cc: wei.tee.ng

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

In order to implement initramfs-framework for boot up process, it
depends on udev performing automounting, which happens in udev-extraconf.
Explicitly depend on it so that we always have it installed.

Signed-off-by: Ng, Wei Tee <wei.tee.ng@intel.com>
---
 meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
index 67a1b04..6bbe4c1 100644
--- a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
@@ -65,7 +65,7 @@ RDEPENDS_initramfs-module-mdev = "${PN}-base busybox-mdev"
 FILES_initramfs-module-mdev = "/init.d/01-mdev"
 
 SUMMARY_initramfs-module-udev = "initramfs support for udev"
-RDEPENDS_initramfs-module-udev = "${PN}-base udev"
+RDEPENDS_initramfs-module-udev = "${PN}-base udev udev-extraconf"
 FILES_initramfs-module-udev = "/init.d/01-udev"
 
 SUMMARY_initramfs-module-e2fs = "initramfs support for ext4/ext3/ext2 filesystems"
-- 
2.7.4



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

* [PATCH v2 2/3] initramfs-framework: setup-live: detect media and assign rootfs image
  2017-06-30  0:30 [poky][master][PATCH v2 0/3] initramfs-framework: configuration to boot up live image wei.tee.ng
  2017-06-30  0:30 ` [PATCH v2 1/3] initramfs-framework: udev: Add a runtime dependency on udev-extraconf wei.tee.ng
@ 2017-06-30  0:30 ` wei.tee.ng
  2017-06-30  0:30 ` [PATCH v2 3/3] initramfs-framwork: module to support boot live image wei.tee.ng
  2 siblings, 0 replies; 9+ messages in thread
From: wei.tee.ng @ 2017-06-30  0:30 UTC (permalink / raw)
  To: openembedded-core; +Cc: wei.tee.ng

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

Integrate the featuers in init-live.sh into new scriptlet to handle
boot up live image process using framework method.

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

Signed-off-by: Ng, Wei Tee <wei.tee.ng@intel.com>
---
 .../initrdscripts/initramfs-framework/setup-live   | 67 ++++++++++++++++++++++
 1 file changed, 67 insertions(+)
 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..16da34a
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/setup-live
@@ -0,0 +1,67 @@
+#/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
+}
-- 
2.7.4



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

* [PATCH v2 3/3] initramfs-framwork: module to support boot live image
  2017-06-30  0:30 [poky][master][PATCH v2 0/3] initramfs-framework: configuration to boot up live image wei.tee.ng
  2017-06-30  0:30 ` [PATCH v2 1/3] initramfs-framework: udev: Add a runtime dependency on udev-extraconf wei.tee.ng
  2017-06-30  0:30 ` [PATCH v2 2/3] initramfs-framework: setup-live: detect media and assign rootfs image wei.tee.ng
@ 2017-06-30  0:30 ` wei.tee.ng
  2 siblings, 0 replies; 9+ messages in thread
From: wei.tee.ng @ 2017-06-30  0:30 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 in order to
support the live boot image. It gets to run before the rootfs
and finish module.

[YOCTO #11701]

Signed-off-by: Ng, Wei Tee <wei.tee.ng@intel.com>
---
 meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
index 6bbe4c1..f7b47d9 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}"
 
@@ -24,6 +25,7 @@ do_install() {
     install -m 0755 ${WORKDIR}/init ${D}/init
     install -m 0755 ${WORKDIR}/rootfs ${D}/init.d/90-rootfs
     install -m 0755 ${WORKDIR}/finish ${D}/init.d/99-finish
+    install -m 0755 ${WORKDIR}/setup-live ${D}/init.d/80-setup-live
 
     # mdev
     install -m 0755 ${WORKDIR}/mdev ${D}/init.d/01-mdev
@@ -50,7 +52,7 @@ PACKAGES = "${PN}-base \
             initramfs-module-rootfs \
             initramfs-module-debug"
 
-FILES_${PN}-base = "/init /init.d/99-finish /dev"
+FILES_${PN}-base = "/init /init.d/99-finish /init.d/80-setup-live /dev"
 
 # 99-finish in base depends on some other module which mounts
 # the rootfs, like 90-rootfs. To replace that default, use
-- 
2.7.4



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

* Re: [PATCH v2 1/3] initramfs-framework: udev: Add a runtime dependency on udev-extraconf
  2017-06-30  0:30 ` [PATCH v2 1/3] initramfs-framework: udev: Add a runtime dependency on udev-extraconf wei.tee.ng
@ 2017-07-03 20:17   ` Otavio Salvador
  2017-07-04  1:11     ` Ng, Wei Tee
  0 siblings, 1 reply; 9+ messages in thread
From: Otavio Salvador @ 2017-07-03 20:17 UTC (permalink / raw)
  To: wei.tee.ng; +Cc: Patches and discussions about the oe-core layer

On Thu, Jun 29, 2017 at 9:30 PM,  <wei.tee.ng@intel.com> wrote:
> From: "Ng, Wei Tee" <wei.tee.ng@intel.com>
>
> In order to implement initramfs-framework for boot up process, it
> depends on udev performing automounting, which happens in udev-extraconf.
> Explicitly depend on it so that we always have it installed.
>
> Signed-off-by: Ng, Wei Tee <wei.tee.ng@intel.com>

Wrong; this is need for the live support so the rdepends should be there.


-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


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

* Re: [PATCH v2 1/3] initramfs-framework: udev: Add a runtime dependency on udev-extraconf
  2017-07-03 20:17   ` Otavio Salvador
@ 2017-07-04  1:11     ` Ng, Wei Tee
  2017-07-04 13:49       ` Otavio Salvador
  0 siblings, 1 reply; 9+ messages in thread
From: Ng, Wei Tee @ 2017-07-04  1:11 UTC (permalink / raw)
  To: Otavio Salvador; +Cc: Patches and discussions about the oe-core layer

Yes, it's mainly to support the live boot image. Therefore the udev-extraconf is being added in the rdepends.
The wrong that you mentioned is because of the commit message was not convey in the correct way?
The initramfs-framework currently is not handling live boot support. Perhaps, "In order to implement initramfs-framework for live boot support" will be better?

Regards,
Wei Tee

-----Original Message-----
From: Otavio Salvador [mailto:otavio.salvador@ossystems.com.br] 
Sent: Tuesday, July 4, 2017 4:17 AM
To: Ng, Wei Tee <wei.tee.ng@intel.com>
Cc: Patches and discussions about the oe-core layer <openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [PATCH v2 1/3] initramfs-framework: udev: Add a runtime dependency on udev-extraconf

On Thu, Jun 29, 2017 at 9:30 PM,  <wei.tee.ng@intel.com> wrote:
> From: "Ng, Wei Tee" <wei.tee.ng@intel.com>
>
> In order to implement initramfs-framework for boot up process, it 
> depends on udev performing automounting, which happens in udev-extraconf.
> Explicitly depend on it so that we always have it installed.
>
> Signed-off-by: Ng, Wei Tee <wei.tee.ng@intel.com>

Wrong; this is need for the live support so the rdepends should be there.


-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750

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

* Re: [PATCH v2 1/3] initramfs-framework: udev: Add a runtime dependency on udev-extraconf
  2017-07-04  1:11     ` Ng, Wei Tee
@ 2017-07-04 13:49       ` Otavio Salvador
  2017-07-05  1:03         ` Ng, Wei Tee
  0 siblings, 1 reply; 9+ messages in thread
From: Otavio Salvador @ 2017-07-04 13:49 UTC (permalink / raw)
  To: Ng, Wei Tee; +Cc: Patches and discussions about the oe-core layer

On Mon, Jul 3, 2017 at 10:11 PM, Ng, Wei Tee <wei.tee.ng@intel.com> wrote:
> Yes, it's mainly to support the live boot image. Therefore the udev-extraconf is being added in the rdepends.
> The wrong that you mentioned is because of the commit message was not convey in the correct way?
> The initramfs-framework currently is not handling live boot support. Perhaps, "In order to implement initramfs-framework for live boot support" will be better?

Move it to live-boot package rdepends.

I don't want automount when adding udev only it seems wrong.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


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

* Re: [PATCH v2 1/3] initramfs-framework: udev: Add a runtime dependency on udev-extraconf
  2017-07-04 13:49       ` Otavio Salvador
@ 2017-07-05  1:03         ` Ng, Wei Tee
  2017-07-05 12:51           ` Otavio Salvador
  0 siblings, 1 reply; 9+ messages in thread
From: Ng, Wei Tee @ 2017-07-05  1:03 UTC (permalink / raw)
  To: Otavio Salvador; +Cc: Patches and discussions about the oe-core layer

Hi 

The existing live-boot package is consists of udev and udev-extraconf. (http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb ) Now I am working on integrate this into the initramfs-framework model. Because when it is using the initramfs-framework method, the image could not automount  which depends on udev-extraconf. Therefore, I added the runtime dependency on udev-extraconf in my recipe file (http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb )  to include the same features as the live-boot package. 

Please correct it if I get it wrong. 

Regards,
Wei Tee

-----Original Message-----
From: Otavio Salvador [mailto:otavio.salvador@ossystems.com.br] 
Sent: Tuesday, July 4, 2017 9:50 PM
To: Ng, Wei Tee <wei.tee.ng@intel.com>
Cc: Patches and discussions about the oe-core layer <openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [PATCH v2 1/3] initramfs-framework: udev: Add a runtime dependency on udev-extraconf

On Mon, Jul 3, 2017 at 10:11 PM, Ng, Wei Tee <wei.tee.ng@intel.com> wrote:
> Yes, it's mainly to support the live boot image. Therefore the udev-extraconf is being added in the rdepends.
> The wrong that you mentioned is because of the commit message was not convey in the correct way?
> The initramfs-framework currently is not handling live boot support. Perhaps, "In order to implement initramfs-framework for live boot support" will be better?

Move it to live-boot package rdepends.

I don't want automount when adding udev only it seems wrong.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750

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

* Re: [PATCH v2 1/3] initramfs-framework: udev: Add a runtime dependency on udev-extraconf
  2017-07-05  1:03         ` Ng, Wei Tee
@ 2017-07-05 12:51           ` Otavio Salvador
  0 siblings, 0 replies; 9+ messages in thread
From: Otavio Salvador @ 2017-07-05 12:51 UTC (permalink / raw)
  To: Ng, Wei Tee; +Cc: Patches and discussions about the oe-core layer

On Tue, Jul 4, 2017 at 10:03 PM, Ng, Wei Tee <wei.tee.ng@intel.com> wrote:
> The existing live-boot package is consists of udev and udev-extraconf. (http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb ) Now I am working on integrate this into the initramfs-framework model. Because when it is using the initramfs-framework method, the image could not automount  which depends on udev-extraconf. Therefore, I added the runtime dependency on udev-extraconf in my recipe file (http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb )  to include the same features as the live-boot package.
>
> Please correct it if I get it wrong.

I understood it.

What I meant is that adding udev-extraconf rdepends to udev module is
conceptually wrong as it does not require it to work. live-boot
requires it so make a module that makes use of it. For example:
initramfs-framework-udev-automount

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


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

end of thread, other threads:[~2017-07-05 12:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-30  0:30 [poky][master][PATCH v2 0/3] initramfs-framework: configuration to boot up live image wei.tee.ng
2017-06-30  0:30 ` [PATCH v2 1/3] initramfs-framework: udev: Add a runtime dependency on udev-extraconf wei.tee.ng
2017-07-03 20:17   ` Otavio Salvador
2017-07-04  1:11     ` Ng, Wei Tee
2017-07-04 13:49       ` Otavio Salvador
2017-07-05  1:03         ` Ng, Wei Tee
2017-07-05 12:51           ` Otavio Salvador
2017-06-30  0:30 ` [PATCH v2 2/3] initramfs-framework: setup-live: detect media and assign rootfs image wei.tee.ng
2017-06-30  0:30 ` [PATCH v2 3/3] initramfs-framwork: module to support boot live image wei.tee.ng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox