Search code examples
imageyocto

Yocto - failed to buid hddimg. Error: do_bootimg


I am working on yocto,dunfell, am trying to build .hddimg image for a genericx86-64 machine. I inherit image-live, add hhdimg to IMAGE_FSTYPES and everything works fine with iso, wic and ... But when I add hddimg I get this error:

ERROR: test-image-1.0-r0 do_bootimg: /path/build/tmp/work/genericx86_64-poky-linux/test-image/1.0-r0/test-image-1.0/hddimg/rootfs.img rootfs size is greather than or equal to 4GB,
ERROR: test-image-1.0-r0 do_bootimg: and this doesn't work on a FAT filesystem. You can either:
ERROR: test-image-1.0-r0 do_bootimg: 1) Reduce the size of rootfs.img, or,
ERROR: test-image-1.0-r0 do_bootimg: 2) Use wic, vmdk or vdi instead of hddimg

ERROR: test-image-1.0-r0 do_bootimg: Error executing a python function in exec_python_func() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:do_bootimg(d)
     0003:
File: '/path/layers/poky/meta/classes/image-live.bbclass', lineno: 257, function: do_bootimg
     0253:    if d.getVar("PCBIOS") == "1":
     0254:        bb.build.exec_func('build_syslinux_cfg', d)
     0255:    if d.getVar("EFI") == "1":
     0256:        bb.build.exec_func('build_efi_cfg', d)
 *** 0257:    bb.build.exec_func('build_hddimg', d)
     0258:    bb.build.exec_func('build_iso', d)
     0259:    bb.build.exec_func('create_symlinks', d)
     0260:}
     0261:do_bootimg[subimages] = "hddimg iso"
File: '/path/layers/poky/bitbake/lib/bb/build.py', lineno: 251, function: exec_func
     0247:    with bb.utils.fileslocked(lockfiles):
     0248:        if ispython:
     0249:            exec_func_python(func, d, runfile, cwd=adir)
     0250:        else:
 *** 0251:            exec_func_shell(func, d, runfile, cwd=adir)
     0252:
     0253:    try:
     0254:        curcwd = os.getcwd()
     0255:    except:
File: '/path/layers/poky/bitbake/lib/bb/build.py', lineno: 452, function: exec_func_shell
     0448:    with open(fifopath, 'r+b', buffering=0) as fifo:
     0449:        try:
     0450:            bb.debug(2, "Executing shell function %s" % func)
     0451:            with open(os.devnull, 'r+') as stdin, logfile:
 *** 0452:                bb.process.run(cmd, shell=False, stdin=stdin, log=logfile, extrafiles=[(fifo,readfifo)])
     0453:        finally:
     0454:            os.unlink(fifopath)
     0455:
     0456:    bb.debug(2, "Shell function %s finished" % func)
File: '/path/layers/poky/bitbake/lib/bb/process.py', lineno: 182, function: run
     0178:        if not stderr is None:
     0179:            stderr = stderr.decode("utf-8")
     0180:
     0181:    if pipe.returncode != 0:
 *** 0182:        raise ExecutionError(cmd, pipe.returncode, stdout, stderr)
     0183:    return stdout, stderr
Exception: bb.process.ExecutionError: Execution of '/path/build/tmp/work/genericx86_64-poky-linux/test-image/1.0-r0/temp/run.build_hddimg.18514' failed with exit code 1:
WARNING: exit code 1 from a shell command.


ERROR: Logfile of failure stored in: /path/build/tmp/work/genericx86_64-poky-linux/test-image/1.0-r0/temp/log.do_bootimg.18514
ERROR: Task (/path/layers/meta-ammsc2/recipes-core/images/test-image.bb:do_bootimg) failed with exit code '1'``` 

Solution

  • Your rootfs for test-image is larger than 4GB, which is the maximum filesystem size for FAT partitions (the default used by the .hddimg image type).

    The error already contains two solutions:

    1. Reduce the image size, by removing packages
    2. Use the wic format (vmdk and vdi are for virtual machine engines)

    To use the wic format, simply add wic to IMAGE_FSTYPES and Yocto will build a .wic image and place it in the deploy/images directory. You can flash this to your disk using dd or bmaptool, and boot it.

    These images are built from a template specified by WKS_FILE, which defaults to genericx86.wks.in for the the genericx86-64 machine. This default template creates a partition table and installs an EFI bootloader (Grub).

    If you'd like to manually generate the wic images or modify the templates, check out the documentation for Creating Partitioned Images Using Wic.