From 989db4c0e7db84e52b4e564101a974ef59f1bba6 Mon Sep 17 00:00:00 2001 From: Alejandro Hernandez Date: Fri, 15 Sep 2017 12:42:36 -0700 Subject: core-image-tiny: Provide a new image recipe for poky-tiny that boots from RAM This new image recipe creates an image from the artifacts obtained after building core-image-tiny-initramfs, it boots directly to a tiny rootfs provided by initrd Signed-off-by: Alejandro Hernandez --- .../images/core-image-tiny-initramfs.bbappend | 11 ------- common/recipes-core/images/core-image-tiny.bb | 37 ++++++++++++++++++++++ wic/core-image-tiny.wks.in | 14 ++++++++ wic/systemd-bootdisk-tiny32.wks | 8 ----- wic/systemd-bootdisk-tiny64.wks | 14 -------- 5 files changed, 51 insertions(+), 33 deletions(-) delete mode 100644 common/recipes-core/images/core-image-tiny-initramfs.bbappend create mode 100644 common/recipes-core/images/core-image-tiny.bb create mode 100644 wic/core-image-tiny.wks.in delete mode 100644 wic/systemd-bootdisk-tiny32.wks delete mode 100644 wic/systemd-bootdisk-tiny64.wks diff --git a/common/recipes-core/images/core-image-tiny-initramfs.bbappend b/common/recipes-core/images/core-image-tiny-initramfs.bbappend deleted file mode 100644 index 6fe2d7c4..00000000 --- a/common/recipes-core/images/core-image-tiny-initramfs.bbappend +++ /dev/null @@ -1,11 +0,0 @@ -# Set WKS file depending on the MACHINE picked by the user applies -# only when using an Intel MACHINE, otherwise leaves it as it is. - -python (){ - if d.getVar('MACHINE', True) == "intel-core2-32": - d.setVar('WKS_FILE', "systemd-bootdisk-tiny32.wks") - elif d.getVar('MACHINE', True) == "intel-corei7-64": - d.setVar('WKS_FILE', "systemd-bootdisk-tiny64.wks") - elif d.getVar('MACHINE', True) == "intel-quark": - d.setVar('WKS_FILE', "mktinygalileodisk.wks") -} diff --git a/common/recipes-core/images/core-image-tiny.bb b/common/recipes-core/images/core-image-tiny.bb new file mode 100644 index 00000000..ed39fd77 --- /dev/null +++ b/common/recipes-core/images/core-image-tiny.bb @@ -0,0 +1,37 @@ +SUMMARY = "A tiny image just capable of allowing a device to boot from RAM, \ +this image recipe generates an image file which rather boots from initrd than \ +from storage, it achieves this by using wic to pick up the artifacts generated \ +by the core-image-tiny-initramfs image" + +# The actual rootfs/initrd will be the one from core-image-tiny-initramfs, so +# we reset IMAGE_INSTALL to avoid building other things that will be pointless +IMAGE_INSTALL = "" + +# Do not pollute the initrd image with rootfs features +IMAGE_FEATURES = "" + +IMAGE_LINGUAS = " " + +LICENSE = "MIT" + +IMAGE_ROOTFS_SIZE ?= "8192" + +IMAGE_FSTYPES = "wic" +inherit core-image + +# We get some parts from image-live that we need in order to boot from initrd +INITRD_IMAGE_LIVE ?= "core-image-tiny-initramfs" + +python() { + image_b = d.getVar('IMAGE_BASENAME') + initrd_i = d.getVar('INITRD_IMAGE_LIVE') + if image_b == initrd_i: + bb.error('INITRD_IMAGE_LIVE %s cannot use the requested IMAGE_FSTYPE' % initrd_i) + bb.fatal('Check IMAGE_FSTYPES and INITRAMFS_FSTYPES settings.') + elif initrd_i: + d.appendVarFlag('do_image', 'depends', ' %s:do_image_complete' % initrd_i) +} + +WKS_FILE_intel-corei7-64 = "core-image-tiny.wks.in" +WKS_FILE_intel-core2-32 = "core-image-tiny.wks.in" +WKS_FILE_intel-quark = "mktinygalileodisk.wks" diff --git a/wic/core-image-tiny.wks.in b/wic/core-image-tiny.wks.in new file mode 100644 index 00000000..b0decae6 --- /dev/null +++ b/wic/core-image-tiny.wks.in @@ -0,0 +1,14 @@ +# short-description: Create an EFI disk image with systemd-boot and corei7-64/core2-32 +# long-description: Creates a partitioned EFI disk image that the user +# can directly dd to boot media. The selected bootloader is systemd-boot. +# This disk image is meant to be used by corei7-64/core2-32 and core-image-tiny-initramfs + +part /boot --source bootimg-efi --sourceparams="loader=systemd-boot,initrd=core-image-tiny-initramfs-${MACHINE}.cpio.gz" --ondisk sda --label msdos --active --align 1024 + +bootloader --ptable gpt --timeout=5 --append="init=/bin/busybox sh init console=ttyS0,115200 console=tty0 rw LABEL=boot debugshell=5" + +# Some devices require different console parameters, the console parameter can be given repeatedly, input is taken +# only from the last listed console, for example on the Minnowboard MAX, the previously listed setting would show +# a login prompt on its video output and not on the serial terminal. +# +# See http://www.tldp.org/HOWTO/Remote-Serial-Console-HOWTO/configure-kernel.html diff --git a/wic/systemd-bootdisk-tiny32.wks b/wic/systemd-bootdisk-tiny32.wks deleted file mode 100644 index c4011c0e..00000000 --- a/wic/systemd-bootdisk-tiny32.wks +++ /dev/null @@ -1,8 +0,0 @@ -# short-description: Create an EFI disk image with systemd-boot and core2-32 -# long-description: Creates a partitioned EFI disk image that the user -# can directly dd to boot media. The selected bootloader is systemd-boot. -# This disk image is meant to be used by core2-32 and core-image-tiny-initramfs - -part /boot --source bootimg-efi --sourceparams="loader=systemd-boot,initrd=core-image-tiny-initramfs-intel-core2-32.cpio.gz" --ondisk sda --label msdos --active --align 1024 - -bootloader --ptable gpt --timeout=5 --append="init=/bin/busybox sh init console=ttyS0,115200 console=tty0 rw LABEL=boot debugshell=5" diff --git a/wic/systemd-bootdisk-tiny64.wks b/wic/systemd-bootdisk-tiny64.wks deleted file mode 100644 index c957572a..00000000 --- a/wic/systemd-bootdisk-tiny64.wks +++ /dev/null @@ -1,14 +0,0 @@ -# short-description: Create an EFI disk image with systemd-boot and corei7-64 -# long-description: Creates a partitioned EFI disk image that the user -# can directly dd to boot media. The selected bootloader is systemd-boot. -# This disk image is meant to be used by corei7-64 and core-image-tiny-initramfs - -part /boot --source bootimg-efi --sourceparams="loader=systemd-boot,initrd=core-image-tiny-initramfs-intel-corei7-64.cpio.gz" --ondisk sda --label msdos --active --align 1024 - -bootloader --ptable gpt --timeout=5 --append="init=/bin/busybox sh init console=ttyS0,115200 console=tty0 rw LABEL=boot debugshell=5" - -# Some devices require different console parameters, the console parameter can be given repeatedly, input is taken -# only from the last listed console, for example on the Minnowboard MAX, the previously listed setting would show -# a login prompt on its video output and not on the serial terminal. -# -# See http://www.tldp.org/HOWTO/Remote-Serial-Console-HOWTO/configure-kernel.html -- cgit v1.2.3-54-g00ecf