poky-tiny improvements
v2 cover poky-tiny improvements
This is the first set of patches meant to improve some of the characteristics of poky-tiny, these patches are from or based on Tom Zanussi's work; includes a new image recipe to be able to boot poky-tiny from initrd, along with changes to be able to create it using bootimg-efi, make it compatible with systemd-boot, and scripts to measure size of the image, kernel and modules.
The following changes since commit 7d5dec1b1f3d1580e10bf4f92ef4aac4edb5ee77:
gummiboot: Remove old gummiboot recipe, related class and wks file (2017-01-11 19:45:41 +0000)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib hsalejandro/tinymaster3
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=hsalejandro/tinymaster3
Alejandro Hernandez (3):
image-.bbclass: standarize usage of DEPLOY_DIR_IMAGE
core-image-tiny-initramfs: Fix error message shown after a successful
initrd boot
systemd-boot.bbclass: Fix SYSYTEMD_BOOT_CFG creation
Tom Zanussi (4):
image-live-artifacts: Add support for creating image artifacts only
wic: Look for image artifacts in a common location
core-image-tiny-initramfs: Add and image creating image artifacts only tiny scripts improvements: python3 fixes and new tool ksum
meta/classes/image-live-artifacts.bbclass | 40 +++++ meta/classes/image-live.bbclass | 18 +-- meta/classes/image-vm.bbclass | 12 +- meta/classes/image.bbclass | 3 + meta/classes/image_types.bbclass | 4 +- meta/classes/systemd-boot.bbclass | 3 + meta/lib/oeqa/selftest/wic.py | 2 +- .../images/core-image-tiny-initramfs.bb | 42 ++++++ scripts/lib/wic/plugins/source/bootimg-efi.py | 28 +++- .../lib/wic/plugins/source/isoimage-isohybrid.py | 21 ++- scripts/tiny/ksize.py | 17 ++- scripts/tiny/ksum.py | 168 +++++++++++++++++++++ 12 files changed, 323 insertions(+), 35 deletions(-) create mode 100644 meta/classes/image-live-artifacts.bbclass create mode 100644 meta/recipes-core/images/core-image-tiny-initramfs.bb create mode 100755 scripts/tiny/ksum.py
Signature · 1 line
2.6.6
PATCH v2 1/7 image-live-artifacts: Add support for creating image artifacts only
From: Tom Zanussi <[email protected]>
Rather than create an actual image, just put the image artifacts in an 'artifacts' directory that can then be picked up by wic.
--- meta/classes/image-live-artifacts.bbclass | 40 +++++++++++++++++++++++++++++++ meta/classes/image.bbclass | 3 +++ meta/classes/image_types.bbclass | 2 ++ 3 files changed, 45 insertions(+) create mode 100644 meta/classes/image-live-artifacts.bbclass
meta/classes/image-live-artifacts.bbclass new file +40 -0
@@ -0,0 +1,40 @@ +# Create the artifacts only on an ARTIFACTS_DIR, +# which can be later picked up by wic + +inherit live-vm-common + +do_bootimg[depends] += "dosfstools-native:do_populate_sysroot \ + mtools-native:do_populate_sysroot \ + cdrtools-native:do_populate_sysroot \ + virtual/kernel:do_deploy \ + ${MLPREFIX}syslinux:do_populate_sysroot \ + syslinux-native:do_populate_sysroot \ + ${@oe.utils.ifelse(d.getVar('COMPRESSISO', False),'zisofs-tools-native:do_populate_sysroot','')} \ + " + + +LABELS_LIVE ?= "boot install" + +ARTIFACTS_DIR = "${DEPLOY_DIR_IMAGE}/artifacts" + +populate_bootloader() { + populate_kernel ${ARTIFACTS_DIR} + + if [ "${PCBIOS}" = "1" ]; then + syslinux_hddimg_populate ${ARTIFACTS_DIR} + fi + if [ "${EFI}" = "1" ]; then + efi_hddimg_populate ${ARTIFACTS_DIR} + fi +} + +python do_bootimg() { + set_live_vm_vars(d, 'LIVE') + if d.getVar("PCBIOS", True) == "1": + bb.build.exec_func('build_syslinux_cfg', d) + if d.getVar("EFI", True) == "1": + bb.build.exec_func('build_efi_cfg', d) + bb.build.exec_func('populate_bootloader', d) +} + +addtask bootimg before do_image_complete
meta/classes/image.bbclass +3 -0
@@ -130,6 +130,9 @@ do_rootfs[vardeps] += "${@rootfs_variables(d)}" do_build[depends] += "virtual/kernel:do_deploy" def build_live(d): + if bb.utils.contains("IMAGE_FSTYPES", "live-artifacts-only", "live-artifacts-only", "0", d) == "live-artifacts-only": + return "image-live-artifacts" + if bb.utils.contains("IMAGE_FSTYPES", "live", "live", "0", d) == "0": # live is not set but hob might set iso or hddimg d.setVar('NOISO', bb.utils.contains('IMAGE_FSTYPES', "iso", "0", "1", d)) d.setVar('NOHDD', bb.utils.contains('IMAGE_FSTYPES', "hddimg", "0", "1", d))
meta/classes/image_types.bbclass +2 -0
@@ -270,6 +270,8 @@ python () { bb.build.addtask('do_write_wks_template', 'do_image_wic', None, d) } +IMAGE_CMD_live-artifacts-only = " " + EXTRA_IMAGECMD = "" inherit siteinfo
Signature · 1 line
2.6.6
Re: [PATCH v2 1/7] image-live-artifacts: Add support for creating image artifacts only
Quoted 6 lines · Alejandro Hernandez
From: Tom Zanussi <[email protected]>
Rather than create an actual image, just put the image artifacts in an 'artifacts' directory that can then be picked up by wic.
This is a desired goal now that wic is more widely used. However, any particular
reason why the implementation talks about "live" and copies what the live imagedo_bootimg gives?
Quoted 18 lines
Signed-off-by Alejandro Hernandez <[email protected]>Signed-off-by Tom Zanussi <[email protected]>--- meta/classes/image-live-artifacts.bbclass | 40 +++++++++++++++++++++++++++++++ meta/classes/image.bbclass | 3 +++ meta/classes/image_types.bbclass | 2 ++ 3 files changed, 45 insertions(+) create mode 100644 meta/classes/image-live-artifacts.bbclassmeta/classes/image-live-artifacts.bbclass new file +0
-0
meta/classes/image-live-artifacts.bbclass line 6
Quoted 6 lines
meta/classes/image-live-artifacts.bbclass new file +6
-0@@ -0,0 +1,40 @@ +# Create the artifacts only on an ARTIFACTS_DIR, +# which can be later picked up by wic + +inherit live-vm-common + +do_bootimg[depends] += "dosfstools-native:do_populate_sysroot \
perhaps have 'do_image_artifacts' and let users/other classes set additional dependencies.
meta/classes/image-live-artifacts.bbclass line 11
Quoted 6 lines
meta/classes/image-live-artifacts.bbclass new file +5
-0+ mtools-native:do_populate_sysroot \ + cdrtools-native:do_populate_sysroot \ + virtual/kernel:do_deploy \ + ${MLPREFIX}syslinux:do_populate_sysroot \ + syslinux-native:do_populate_sysroot \
For example, if I use systemd-boot I don't need syslinux built at all. The EFI_CLASS/PCBIOS_CLASS
could define the additional depends here (like they are currently doing for bootimg/bootdirectdisk).
The defaults should be just kernel and initrd(s) (if defined).
Quoted 39 lines
meta/classes/image-live-artifacts.bbclass new file +1
-0+ ${@oe.utils.ifelse(d.getVar('COMPRESSISO',False),'zisofs-tools-native:do_populate_sysroot','')} \
meta/classes/image-live-artifacts.bbclass new file +28
-0+ " + + +LABELS_LIVE ?= "boot install" + +ARTIFACTS_DIR = "${DEPLOY_DIR_IMAGE}/artifacts" + +populate_bootloader() { + populate_kernel ${ARTIFACTS_DIR} + + if [ "${PCBIOS}" = "1" ]; then + syslinux_hddimg_populate ${ARTIFACTS_DIR} + fi + if [ "${EFI}" = "1" ]; then + efi_hddimg_populate ${ARTIFACTS_DIR} + fi +} + +python do_bootimg() { + set_live_vm_vars(d, 'LIVE') + if d.getVar("PCBIOS", True) == "1": + bb.build.exec_func('build_syslinux_cfg', d) + if d.getVar("EFI", True) == "1": + bb.build.exec_func('build_efi_cfg', d) + bb.build.exec_func('populate_bootloader', d) +} + +addtask bootimg before do_image_completemeta/classes/image.bbclass +1
-0@@ -130,6 +130,9 @@ do_rootfs[vardeps] += "${@rootfs_variables(d)}" do_build[depends] += "virtual/kernel:do_deploy" def build_live(d): + if bb.utils.contains("IMAGE_FSTYPES", "live-artifacts-only",
Quoted 3 lines
"live-artifacts-only", "0", d) == "live-artifacts-only":
+ return "image-live-artifacts"
Is there a need for the image artifacts for other than wic? It could be made so that if wic is in IMAGE_FSTYPES,
image-artifacts are built by default. This means the logic of inheriting image-artifacts has a better place, e.g.,
in it's own build_wic() check.
-- Mikko
Re: [PATCH v2 1/7] image-live-artifacts: Add support for creating image artifacts only
Hey Mikko
Quoted 10 lines · Mikko
On Wed, Jan 11, 2017 at 9:55 PM, Alejandro Hernandez <[email protected] <mailto:[email protected]>> wrote:
From: Tom Zanussi <[email protected] <mailto:[email protected]>>
Rather than create an actual image, just put the image artifacts in an 'artifacts' directory that can then be picked up by wic.
I thought about changing it to boot-artifacts-only, but once I did, since it is based on image-live the code looked more confusing in my opinion. Also, we wanted what image-live does in some parts, in this case do_bootimg, but we also avoid other things from image-live.
Quoted 23 lines
This is a desired goal now that wic is more widely used. However, any particular reason why the implementation talks about "live" and copies what the live image
do_bootimggives?Signed-off-by: Alejandro Hernandez <[email protected] <mailto:[email protected]>> Signed-off-by: Tom Zanussi <[email protected] <mailto:[email protected]>> --- meta/classes/image-live-artifacts.bbclass | 40 +++++++++++++++++++++++++++++++ meta/classes/image.bbclass | 3 +++ meta/classes/image_types.bbclass | 2 ++ 3 files changed, 45 insertions(+) create mode 100644 meta/classes/image-live-artifacts.bbclass diff --git a/meta/classes/image-live-artifacts.bbclass b/meta/classes/image-live-artifacts.bbclass new file mode 100644 index 0000000..1501a9b --- /dev/null
Quoted 10 lines
+++ b/meta/classes/image-live-artifacts.bbclass
@@ -0,0 +1,40 @@
+# Create the artifacts only on an ARTIFACTS_DIR,
+# which can be later picked up by wic
+
+inherit live-vm-common
+
+do_bootimg[depends] += "dosfstools-native:do_populate_sysroot \Again, this was thought based on what image-live does, I'm not saying I disagree with you regarding handling the dependencies, but in this case you're saying you have the same issue with image-live?
Quoted 51 lines
perhaps have '
do_image_artifacts' and let users/other classes set additional dependencies.+ mtools-native:do_populate_sysroot \
+ cdrtools-native:do_populate_sysroot \
+ virtual/kernel:do_deploy \
+ ${MLPREFIX}syslinux:do_populate_sysroot \
+ syslinux-native:do_populate_sysroot \For example, if I use systemd-boot I don't need syslinux built at all. The EFI_CLASS/PCBIOS_CLASS could define the additional depends here (like they are currently doing for bootimg/bootdirectdisk).
The defaults should be just kernel and initrd(s) (if defined).
+ ${@oe.utils.ifelse(d.getVar('COMPRESSISO',
False),'zisofs-tools-native:do_populate_sysroot','')} \
+ "
+
+
+LABELS_LIVE ?= "boot install"
+
+ARTIFACTS_DIR = "${DEPLOY_DIR_IMAGE}/artifacts"
+
+populate_bootloader() {
+populate_kernel${ARTIFACTS_DIR}
+
+ if [ "${PCBIOS}" = "1" ]; then
+syslinux_hddimg_populate${ARTIFACTS_DIR}
+ fi
+ if [ "${EFI}" = "1" ]; then
+efi_hddimg_populate${ARTIFACTS_DIR}
+ fi
+}
+
+pythondo_bootimg(){
+set_live_vm_vars(d, 'LIVE')
+ ifd.getVar("PCBIOS", True)== "1":
+bb.build.exec_func('build_syslinux_cfg', d)
+ ifd.getVar("EFI", True)== "1":
+bb.build.exec_func('build_efi_cfg', d)
+bb.build.exec_func('populate_bootloader', d)
+}
+
+addtask bootimg beforedo_image_complete
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 04fd5f9..fd249c8 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -130,6 +130,9 @@ do_rootfs[vardeps] += "${@rootfs_variables(d)}"
do_build[depends] += "virtual/kernel:do_deploy"
Quoted 6 lines
def
build_live(d):
+ if bb.utils.contains("IMAGE_FSTYPES", "live-artifacts-only",
"live-artifacts-only", "0", d) == "live-artifacts-only":
+ return "image-live-artifacts"
Not as far as I know, but so that would work when building something AND the artifacts, but what if you want to build the artifacts only?, you would have to build everything else as well wouldn't you?
I'm trying to think if this change is not more related to actually changing image-live, but I could be misunderstanding things
Quoted 5 lines
Is there a need for the image artifacts for other than wic? It could be made so that if wic is in
IMAGE_FSTYPES, image-artifacts are built by default. This means the logic of inheriting image-artifacts has a better place, e.g., in it's ownbuild_wic()check.-- Mikko
PATCH v2 2/7 wic: Look for image artifacts in a common location
In reply to Alejandro HernandezFrom: Tom Zanussi <[email protected]>
Rather than have each image type look for artifacts in image-specific locations, move towards having them look for artifacts in a common location, in this case DEPLOY_DIR_IMAGE/artifacts.
This only applies if the oe-core image classes have been modified to generate artifacts there (e.g. using image-live-artifacts).
--- meta/classes/image_types.bbclass | 2 +- meta/lib/oeqa/selftest/wic.py | 2 +- scripts/lib/wic/plugins/source/bootimg-efi.py | 28 +++++++++++++++++----- .../lib/wic/plugins/source/isoimage-isohybrid.py | 21 ++++++++++------ 4 files changed, 38 insertions(+), 15 deletions(-)
meta/classes/image_types.bbclass +1 -1
@@ -371,4 +371,4 @@ IMAGE_TYPES_MASKED ?= "" # The WICVARS variable is used to define list of bitbake variables used in wic code # variables from this list is written to <image>.env file -WICVARS ?= "BBLAYERS IMGDEPLOYDIR DEPLOY_DIR_IMAGE HDDDIR IMAGE_BASENAME IMAGE_BOOT_FILES IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD ISODIR MACHINE_ARCH ROOTFS_SIZE STAGING_DATADIR STAGING_DIR_NATIVE STAGING_LIBDIR TARGET_SYS" +WICVARS ?= "BBLAYERS IMGDEPLOYDIR DEPLOY_DIR_IMAGE IMAGE_BASENAME IMAGE_BOOT_FILES IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD ISODIR MACHINE_ARCH ROOTFS_SIZE STAGING_DATADIR STAGING_DIR_NATIVE STAGING_LIBDIR TARGET_SYS"
meta/lib/oeqa/selftest/wic.py +1 -1
@@ -350,7 +350,7 @@ class Wic(oeSelfTest): wicvars = set(get_bb_var('WICVARS', image).split()) # filter out optional variables - wicvars = wicvars.difference(('HDDDIR', 'IMAGE_BOOT_FILES', + wicvars = wicvars.difference(('DEPLOY_DIR_IMAGE', 'IMAGE_BOOT_FILES', 'INITRD', 'ISODIR')) with open(path) as envfile: content = dict(line.split("=", 1) for line in envfile)
scripts/lib/wic/plugins/source/bootimg-efi.py +22 -6
@@ -42,7 +42,7 @@ class BootimgEFIPlugin(SourcePlugin): name = 'bootimg-efi' @classmethod - def do_configure_grubefi(cls, hdddir, creator, cr_workdir): + def do_configure_grubefi(cls, hdddir, creator, cr_workdir, source_params): """ Create loader-specific (grub-efi) config """
@@ -82,7 +82,7 @@ class BootimgEFIPlugin(SourcePlugin): cfg.close() @classmethod - def do_configure_systemdboot(cls, hdddir, creator, cr_workdir): + def do_configure_systemdboot(cls, hdddir, creator, cr_workdir, source_params): """ Create loader-specific systemd-boot/gummiboot config """
@@ -98,6 +98,18 @@ class BootimgEFIPlugin(SourcePlugin): loader_conf += "default boot\n" loader_conf += "timeout %d\n" % bootloader.timeout + initrd = "" + + if source_params['initrd']: + initrd = source_params['initrd'] + # obviously we need to have a common common deploy var + bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") + if not bootimg_dir: + msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n") + + cp_cmd = "cp %s/%s %s" % (bootimg_dir, initrd, hdddir) + exec_cmd(cp_cmd, True) + msger.debug("Writing systemd-boot config %s/hdd/boot/loader/loader.conf" \ % cr_workdir) cfg = open("%s/hdd/boot/loader/loader.conf" % cr_workdir, "w")
@@ -127,6 +139,9 @@ class BootimgEFIPlugin(SourcePlugin): boot_conf += "options LABEL=Boot root=%s %s\n" % \ (creator.rootdev, bootloader.append) + if initrd: + boot_conf += "initrd /%s\n" % initrd + msger.debug("Writing systemd-boot config %s/hdd/boot/loader/entries/boot.conf" \ % cr_workdir) cfg = open("%s/hdd/boot/loader/entries/boot.conf" % cr_workdir, "w")
@@ -148,9 +163,9 @@ class BootimgEFIPlugin(SourcePlugin): try: if source_params['loader'] == 'grub-efi': - cls.do_configure_grubefi(hdddir, creator, cr_workdir) + cls.do_configure_grubefi(hdddir, creator, cr_workdir, source_params) elif source_params['loader'] == 'systemd-boot': - cls.do_configure_systemdboot(hdddir, creator, cr_workdir) + cls.do_configure_systemdboot(hdddir, creator, cr_workdir, source_params) else: msger.error("unrecognized bootimg-efi loader: %s" % source_params['loader']) except KeyError:
@@ -167,9 +182,10 @@ class BootimgEFIPlugin(SourcePlugin): In this case, prepare content for an EFI (grub) boot partition. """ if not bootimg_dir: - bootimg_dir = get_bitbake_var("HDDDIR") + bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") if not bootimg_dir: - msger.error("Couldn't find HDDDIR, exiting\n") + msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n") + bootimg_dir += "/artifacts" # just so the result notes display it creator.set_bootimg_dir(bootimg_dir)
scripts/lib/wic/plugins/source/isoimage-isohybrid.py +14 -7
@@ -298,7 +298,7 @@ class IsoImagePlugin(SourcePlugin): part.rootfs_dir = rootfs_dir # Prepare rootfs.img - hdd_dir = get_bitbake_var("HDDDIR") + hdd_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") img_iso_dir = get_bitbake_var("ISODIR") rootfs_img = "%s/rootfs.img" % hdd_dir
@@ -331,12 +331,19 @@ class IsoImagePlugin(SourcePlugin): if os.path.isfile(part.source_file): os.remove(part.source_file) - # Prepare initial ramdisk - initrd = "%s/initrd" % hdd_dir - if not os.path.isfile(initrd): - initrd = "%s/initrd" % img_iso_dir - if not os.path.isfile(initrd): - initrd = cls._build_initramfs_path(rootfs_dir, cr_workdir) + # Support using a different initrd other than default + if source_params['initrd']: + initrd = source_params['initrd'] + if not hdd_dir: + msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n") + cp_cmd = "cp %s/%s %s" % (hdd_dir, initrd, cr_workdir) + else: + # Prepare initial ramdisk + initrd = "%s/initrd" % hdd_dir + if not os.path.isfile(initrd): + initrd = "%s/initrd" % img_iso_dir + if not os.path.isfile(initrd): + initrd = cls._build_initramfs_path(rootfs_dir, cr_workdir) install_cmd = "install -m 0644 %s %s/initrd" \ % (initrd, isodir)
Signature · 1 line
2.6.6
PATCH v2 3/7 image-.bbclass: standarize usage of DEPLOY_DIR_IMAGE
In reply to Alejandro HernandezSince wic now looks for boot artifacts on DEPLOY_DIR_IMAGE, we need to standarize the usage of this variable and drop HDDDIR to avoid confusion, which will let us drop support for hddimg in the future.
--- meta/classes/image-live.bbclass | 18 +++++++++--------- meta/classes/image-vm.bbclass | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-)
meta/classes/image-live.bbclass +9 -9
@@ -60,7 +60,7 @@ python() { d.appendVarFlag('do_bootimg', 'depends', ' %s:do_image_complete' % initrd_i) } -HDDDIR = "${S}/hddimg" +DEPLOY_DIR_IMAGE = "${S}/hddimg" ISODIR = "${S}/iso" EFIIMGDIR = "${S}/efi_img" COMPACT_ISODIR = "${S}/iso.z"
@@ -230,29 +230,29 @@ build_fat_img() { build_hddimg() { # Create an HDD image if [ "${NOHDD}" != "1" ] ; then - populate_live ${HDDDIR} + populate_live ${DEPLOY_DIR_IMAGE} if [ "${PCBIOS}" = "1" ]; then - syslinux_hddimg_populate ${HDDDIR} + syslinux_hddimg_populate ${DEPLOY_DIR_IMAGE} fi if [ "${EFI}" = "1" ]; then - efi_hddimg_populate ${HDDDIR} + efi_hddimg_populate ${DEPLOY_DIR_IMAGE} fi - # Check the size of ${HDDDIR}/rootfs.img, error out if it + # Check the size of ${DEPLOY_DIR_IMAGE}/rootfs.img, error out if it # exceeds 4GB, it is the single file's max size of FAT fs. - if [ -f ${HDDDIR}/rootfs.img ]; then - rootfs_img_size=`stat -c '%s' ${HDDDIR}/rootfs.img` + if [ -f ${DEPLOY_DIR_IMAGE}/rootfs.img ]; then + rootfs_img_size=`stat -c '%s' ${DEPLOY_DIR_IMAGE}/rootfs.img` max_size=`expr 4 \* 1024 \* 1024 \* 1024` if [ $rootfs_img_size -gt $max_size ]; then - bberror "${HDDDIR}/rootfs.img execeeds 4GB," + bberror "${DEPLOY_DIR_IMAGE}/rootfs.img execeeds 4GB," bberror "this doesn't work on FAT filesystem, you can try either of:" bberror "1) Reduce the size of rootfs.img" bbfatal "2) Use iso, vmdk or vdi to instead of hddimg\n" fi fi - build_fat_img ${HDDDIR} ${IMGDEPLOYDIR}/${IMAGE_NAME}.hddimg + build_fat_img ${DEPLOY_DIR_IMAGE} ${IMGDEPLOYDIR}/${IMAGE_NAME}.hddimg if [ "${PCBIOS}" = "1" ]; then syslinux_hddimg_install
meta/classes/image-vm.bbclass +6 -6
@@ -50,26 +50,26 @@ DISK_SIGNATURE ?= "${DISK_SIGNATURE_GENERATED}" DISK_SIGNATURE[vardepsexclude] = "DISK_SIGNATURE_GENERATED" build_boot_dd() { - HDDDIR="${S}/hdd/boot" + DEPLOY_DIR_IMAGE="${S}/hdd/boot" HDDIMG="${S}/hdd.image" IMAGE=${IMGDEPLOYDIR}/${IMAGE_NAME}.hdddirect - populate_kernel $HDDDIR + populate_kernel $DEPLOY_DIR_IMAGE if [ "${PCBIOS}" = "1" ]; then - syslinux_hddimg_populate $HDDDIR + syslinux_hddimg_populate $DEPLOY_DIR_IMAGE fi if [ "${EFI}" = "1" ]; then - efi_hddimg_populate $HDDDIR + efi_hddimg_populate $DEPLOY_DIR_IMAGE fi - BLOCKS=`du -bks $HDDDIR | cut -f 1` + BLOCKS=`du -bks $DEPLOY_DIR_IMAGE | cut -f 1` BLOCKS=`expr $BLOCKS + ${BOOTDD_EXTRA_SPACE}` # Remove it since mkdosfs would fail when it exists rm -f $HDDIMG mkdosfs -n ${BOOTDD_VOLUME_ID} -S 512 -C $HDDIMG $BLOCKS - mcopy -i $HDDIMG -s $HDDDIR/* ::/ + mcopy -i $HDDIMG -s $DEPLOY_DIR_IMAGE/* ::/ if [ "${PCBIOS}" = "1" ]; then syslinux_hdddirect_install $HDDIMG
Signature · 1 line
2.6.6
Re: [PATCH 3/7] image-.bbclass: standarize usage of DEPLOY_DIR_IMAGE
Quoted 10 lines · Alejandro Hernandez
Since wic now looks for boot artifacts on
DEPLOY_DIR_IMAGE, we need to standarize the usage of this variable and drop HDDDIR to avoid confusion, which will let us drop support for hddimg in the future.Signed-off-by Alejandro Hernandez <[email protected]>--- meta/classes/image-live.bbclass | 18 +++++++++--------- meta/classes/image-vm.bbclass | 12 ++++++------
There's other places that use this variable:
meta/lib/oeqa/selftest/wic.py: wicvars =
wicvars.difference(('HDDDIR', 'IMAGE_BOOT_FILES',scripts/lib/wic/plugins/source/bootimg-efi.py: bootimg_dir =get_bitbake_var("HDDDIR")scripts/lib/wic/plugins/source/bootimg-efi.py:
msger.error("Couldn't find HDDDIR, exiting\n")scripts/lib/wic/plugins/source/isoimage-isohybrid.py: hdd_dir =get_bitbake_var("HDDDIR")
Ross
Re: [PATCH 3/7] image-.bbclass: standarize usage of DEPLOY_DIR_IMAGE
Quoted 8 lines · Ross
On 11 January 2017 at 19:55, Alejandro Hernandez <[email protected] <mailto:[email protected]>> wrote:
Since wic now looks for boot artifacts on
DEPLOY_DIR_IMAGE, we need to standarize the usage of this variable and drop HDDDIR to avoid confusion, which will let us drop support for hddimg in the future.
Quoted 7 lines
Signed-off-by: Alejandro Hernandez <[email protected] <mailto:[email protected]>>
---
meta/classes/image-live.bbclass | 18 +++++++++---------
meta/classes/image-vm.bbclass | 12 ++++++------
Yes, these are changed on the previous patch (2/7)
Quoted 10 lines
There's other places that use this variable:
meta/lib/oeqa/selftest/wic.py: wicvars = wicvars.difference(('HDDDIR', 'IMAGE_BOOT_FILES',scripts/lib/wic/plugins/source/bootimg-efi.py:bootimg_dir=get_bitbake_var("HDDDIR")scripts/lib/wic/plugins/source/bootimg-efi.py:
msger.error("Couldn't find HDDDIR, exiting\n")scripts/lib/wic/plugins/source/isoimage-isohybrid.py:hdd_dir=get_bitbake_var("HDDDIR")Ross
PATCH v2 4/7 core-image-tiny-initramfs: Add and image creating image artifacts only
In reply to Alejandro HernandezFrom: Tom Zanussi <[email protected]>
Add an image that simply creates image artifacts using image-live-artifacts support instead of creating an actual image.
The image artifacts can then be subsequently assembled by an external tool such as wic to create an actual image.
This eliminates redundant image creation when using such tools.
--- .../images/core-image-tiny-initramfs.bb | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 meta/recipes-core/images/core-image-tiny-initramfs.bb
meta/recipes-core/images/core-image-tiny-initramfs.bb new file +30 -0
@@ -0,0 +1,30 @@ +# Simple initramfs image artifact generation for tiny images. +DESCRIPTION = "Tiny 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. core-image-tiny-initramfs doesn't \ +actually generate an image but rather generates boot and rootfs artifacts \ +into a common location that can subsequently be picked up by external image \ +generation tools such as wic." + +PACKAGE_INSTALL = "initramfs-live-boot packagegroup-core-boot dropbear ${VIRTUAL-RUNTIME_base-utils} udev base-passwd ${ROOTFS_BOOTSTRAP_INSTALL}" + +# Do not pollute the initrd image with rootfs features +IMAGE_FEATURES = "" + +export IMAGE_BASENAME = "core-image-tiny-initramfs" +IMAGE_LINGUAS = "" + +LICENSE = "MIT" + +# don't actually generate an image, just the artifacts needed for one +IMAGE_FSTYPES = "${INITRAMFS_FSTYPES} live-artifacts-only" + +inherit core-image + +IMAGE_ROOTFS_SIZE = "8192" +IMAGE_ROOTFS_EXTRA_SPACE = "0" + +BAD_RECOMMENDATIONS += "busybox-syslog" + +# Use the same restriction as initramfs-live-install +COMPATIBLE_HOST = "(i.86|x86_64).*-linux"
Signature · 1 line
2.6.6
PATCH v2 5/7 core-image-tiny-initramfs: Fix error message shown after a successful initrd boot
In reply to Alejandro HernandezWhen booting core-image-tiny-initramfs, since we want to live on initrd, on purpose, we never find a rootfs image to switch root to, this causes init to show an error as it would with other images, this patch replaces the message shown to the user, avoiding confusion when it was indeed a successful boot.
--- meta/recipes-core/images/core-image-tiny-initramfs.bb | 12 ++++++++++++ 1 file changed, 12 insertions(+)
meta/recipes-core/images/core-image-tiny-initramfs.bb +12 -0
@@ -28,3 +28,15 @@ BAD_RECOMMENDATIONS += "busybox-syslog" # Use the same restriction as initramfs-live-install COMPATIBLE_HOST = "(i.86|x86_64).*-linux" + +python tinyinitrd () { + # Modify our init file so the user knows we drop to shell prompt on purpose + newinit = None + with open(d.expand('${IMAGE_ROOTFS}/init'), 'r') as init: + newinit = init.read() + newinit = newinit.replace('Cannot find $ROOT_IMAGE file in /run/media/* , dropping to a shell ', 'Poky Tiny Reference Distribution:') + with open(d.expand('${IMAGE_ROOTFS}/init'), 'w') as init: + init.write(newinit) +} + +IMAGE_PREPROCESS_COMMAND += "tinyinitrd;"
Signature · 1 line
2.6.6
PATCH v2 6/7 tiny scripts improvements: python3 fixes and new tool ksum
In reply to Alejandro HernandezFrom: Tom Zanussi <[email protected]>
'ksum.py' generates a combined summary of vmlinux and module sizes for a built kernel, as a quick tool for comparing the overall effects of systemic tinification changes. Execute from the base directory of the kernel build you want to summarize. Setting the 'verbose' flag will display the sizes for each file included in the summary.
--- scripts/tiny/ksize.py | 17 +++-- scripts/tiny/ksum.py | 168 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 180 insertions(+), 5 deletions(-) create mode 100755 scripts/tiny/ksum.py
scripts/tiny/ksize.py +12 -5
@@ -41,7 +41,7 @@ def usage(): class Sizes: def __init__(self, glob): self.title = glob - p = Popen("size -t " + glob, shell=True, stdout=PIPE, stderr=PIPE) + p = Popen("size -t " + str(glob), shell=True, stdout=PIPE, stderr=PIPE) output = p.communicate()[0].splitlines() if len(output) > 2: sizes = output[-1].split()[0:4]
@@ -62,18 +62,18 @@ class Report: r = Report(filename, title) path = os.path.dirname(filename) - p = Popen("ls " + path + "/*.o | grep -v built-in.o", + p = Popen("ls " + str(path) + "/*.o | grep -v built-in.o", shell=True, stdout=PIPE, stderr=PIPE) glob = ' '.join(p.communicate()[0].splitlines()) - oreport = Report(glob, path + "/*.o") - oreport.sizes.title = path + "/*.o" + oreport = Report(glob, str(path) + "/*.o") + oreport.sizes.title = str(path) + "/*.o" r.parts.append(oreport) if subglob: p = Popen("ls " + subglob, shell=True, stdout=PIPE, stderr=PIPE) for f in p.communicate()[0].splitlines(): path = os.path.dirname(f) - r.parts.append(Report.create(f, path, path + "/*/built-in.o")) + r.parts.append(Report.create(f, path, str(path) + "/*/built-in.o")) r.parts.sort(reverse=True) for b in r.parts:
@@ -116,6 +116,13 @@ class Report: self.deltas["data"], self.deltas["bss"])) print("\n") + def __lt__(this, that): + if that is None: + return 1 + if not isinstance(that, Report): + raise TypeError + return this.sizes.total < that.sizes.total + def __cmp__(this, that): if that is None: return 1
scripts/tiny/ksum.py new file +168 -0
168 lines not on this page · raw message
Signature · 1 line
2.6.6
PATCH v2 7/7 systemd-boot.bbclass: Fix SYSYTEMD_BOOT_CFG creation
In reply to Alejandro HernandezThis patch makes sure the directory which will contain the systemd configuration (loader.conf) is created before the configuration file is written, fixing errors when it tried to write it to a non-existent directory
--- meta/classes/systemd-boot.bbclass | 3 +++ 1 file changed, 3 insertions(+)
meta/classes/systemd-boot.bbclass +3 -0
@@ -72,6 +72,9 @@ python build_efi_cfg() { return cfile = d.getVar('SYSTEMD_BOOT_CFG') + cdir = os.path.dirname(cfile) + if not os.path.exists(cdir): + os.makedirs(cdir) try: cfgfile = open(cfile, 'w') except OSError:
Signature · 1 line
2.6.6