diff options
| author | Ng, Wei Tee <wei.tee.ng@intel.com> | 2017-07-23 16:51:55 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-27 22:36:53 +0100 |
| commit | 716d5d9e65ad05712e127e575bd5e9c68178d33e (patch) | |
| tree | 76ee7308ef33ddd7f839a0ffe5b13a9fb4f2a276 | |
| parent | 05e4f13971883441503823e430f44c8136be660f (diff) | |
| download | poky-716d5d9e65ad05712e127e575bd5e9c68178d33e.tar.gz | |
initramfs-framework: module to support boot live image
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]
(From OE-Core rev: 4d3300e85a8e65207a415b9cf84c9fa1f71b0406)
Signed-off-by: Ng, Wei Tee <wei.tee.ng@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/recipes-core/initrdscripts/initramfs-framework/setup-live | 66 | ||||
| -rw-r--r-- | meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb | 13 |
2 files changed, 77 insertions, 2 deletions
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 0000000000..ec4a139084 --- /dev/null +++ b/meta/recipes-core/initrdscripts/initramfs-framework/setup-live | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | #/bin/sh | ||
| 2 | # Copyright (C) 2011 O.S. Systems Software LTDA. | ||
| 3 | # Licensed on MIT | ||
| 4 | |||
| 5 | setup_enabled() { | ||
| 6 | return 0 | ||
| 7 | } | ||
| 8 | |||
| 9 | setup_run() { | ||
| 10 | ROOT_IMAGE="rootfs.img" | ||
| 11 | ISOLINUX="" | ||
| 12 | ROOT_DISK="" | ||
| 13 | shelltimeout=30 | ||
| 14 | |||
| 15 | if [ -z $bootparam_root ]; then | ||
| 16 | echo "Waiting for removable media..." | ||
| 17 | C=0 | ||
| 18 | while true | ||
| 19 | do | ||
| 20 | for i in `ls /run/media 2>/dev/null`; do | ||
| 21 | if [ -f /run/media/$i/$ROOT_IMAGE ] ; then | ||
| 22 | found="yes" | ||
| 23 | ROOT_DISK="$i" | ||
| 24 | break | ||
| 25 | elif [ -f /run/media/$i/isolinux/$ROOT_IMAGE ]; then | ||
| 26 | found="yes" | ||
| 27 | ISOLINUX="isolinux" | ||
| 28 | ROOT_DISK="$i" | ||
| 29 | break | ||
| 30 | fi | ||
| 31 | done | ||
| 32 | if [ "$found" = "yes" ]; then | ||
| 33 | break; | ||
| 34 | fi | ||
| 35 | # don't wait for more than $shelltimeout seconds, if it's set | ||
| 36 | if [ -n "$shelltimeout" ]; then | ||
| 37 | echo -n " " $(( $shelltimeout - $C )) | ||
| 38 | if [ $C -ge $shelltimeout ]; then | ||
| 39 | echo "..." | ||
| 40 | echo "Mounted filesystems" | ||
| 41 | mount | grep media | ||
| 42 | echo "Available block devices" | ||
| 43 | cat /proc/partitions | ||
| 44 | fatal "Cannot find $ROOT_IMAGE file in /run/media/* , dropping to a shell " | ||
| 45 | fi | ||
| 46 | C=$(( C + 1 )) | ||
| 47 | fi | ||
| 48 | sleep 1 | ||
| 49 | done | ||
| 50 | # The existing rootfs module has no support for rootfs images. Assign the rootfs image. | ||
| 51 | bootparam_root="/run/media/$ROOT_DISK/$ISOLINUX/$ROOT_IMAGE" | ||
| 52 | else | ||
| 53 | break | ||
| 54 | fi | ||
| 55 | |||
| 56 | if [ "$bootparam_LABEL" != "boot" -a -f /init.d/$bootparam_LABEL.sh ] ; then | ||
| 57 | if [ -f /run/media/$i/$ISOLINUX/$ROOT_IMAGE ] ; then | ||
| 58 | ./init.d/$bootparam_LABEL.sh $i/$ISOLINUX $ROOT_IMAGE $video_mode $vga_mode $console_params | ||
| 59 | else | ||
| 60 | fatal "Could not find $bootparam_LABEL script" | ||
| 61 | fi | ||
| 62 | |||
| 63 | # If we're getting here, we failed... | ||
| 64 | fatal "Target $bootparam_LABEL failed" | ||
| 65 | fi | ||
| 66 | } | ||
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb index 67a1b04d28..211e89d5d3 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 \ | |||
| 13 | file://mdev \ | 13 | file://mdev \ |
| 14 | file://udev \ | 14 | file://udev \ |
| 15 | file://e2fs \ | 15 | file://e2fs \ |
| 16 | file://debug" | 16 | file://debug \ |
| 17 | file://setup-live" | ||
| 17 | 18 | ||
| 18 | S = "${WORKDIR}" | 19 | S = "${WORKDIR}" |
| 19 | 20 | ||
| @@ -25,6 +26,9 @@ do_install() { | |||
| 25 | install -m 0755 ${WORKDIR}/rootfs ${D}/init.d/90-rootfs | 26 | install -m 0755 ${WORKDIR}/rootfs ${D}/init.d/90-rootfs |
| 26 | install -m 0755 ${WORKDIR}/finish ${D}/init.d/99-finish | 27 | install -m 0755 ${WORKDIR}/finish ${D}/init.d/99-finish |
| 27 | 28 | ||
| 29 | # setup-live | ||
| 30 | install -m 0755 ${WORKDIR}/setup-live ${D}/init.d/80-setup-live | ||
| 31 | |||
| 28 | # mdev | 32 | # mdev |
| 29 | install -m 0755 ${WORKDIR}/mdev ${D}/init.d/01-mdev | 33 | install -m 0755 ${WORKDIR}/mdev ${D}/init.d/01-mdev |
| 30 | 34 | ||
| @@ -48,7 +52,8 @@ PACKAGES = "${PN}-base \ | |||
| 48 | initramfs-module-udev \ | 52 | initramfs-module-udev \ |
| 49 | initramfs-module-e2fs \ | 53 | initramfs-module-e2fs \ |
| 50 | initramfs-module-rootfs \ | 54 | initramfs-module-rootfs \ |
| 51 | initramfs-module-debug" | 55 | initramfs-module-debug \ |
| 56 | initramfs-module-setup-live" | ||
| 52 | 57 | ||
| 53 | FILES_${PN}-base = "/init /init.d/99-finish /dev" | 58 | FILES_${PN}-base = "/init /init.d/99-finish /dev" |
| 54 | 59 | ||
| @@ -68,6 +73,10 @@ SUMMARY_initramfs-module-udev = "initramfs support for udev" | |||
| 68 | RDEPENDS_initramfs-module-udev = "${PN}-base udev" | 73 | RDEPENDS_initramfs-module-udev = "${PN}-base udev" |
| 69 | FILES_initramfs-module-udev = "/init.d/01-udev" | 74 | FILES_initramfs-module-udev = "/init.d/01-udev" |
| 70 | 75 | ||
| 76 | SUMMARY_initramfs-module-setup-live = "initramfs support for setup live" | ||
| 77 | RDEPENDS_initramfs-module-setup-live = "${PN}-base udev-extraconf" | ||
| 78 | FILES_initramfs-module-setup-live = "/init.d/80-setup-live" | ||
| 79 | |||
| 71 | SUMMARY_initramfs-module-e2fs = "initramfs support for ext4/ext3/ext2 filesystems" | 80 | SUMMARY_initramfs-module-e2fs = "initramfs support for ext4/ext3/ext2 filesystems" |
| 72 | RDEPENDS_initramfs-module-e2fs = "${PN}-base" | 81 | RDEPENDS_initramfs-module-e2fs = "${PN}-base" |
| 73 | FILES_initramfs-module-e2fs = "/init.d/10-e2fs" | 82 | FILES_initramfs-module-e2fs = "/init.d/10-e2fs" |
