diff options
author | jmbills <jason.m.bills@intel.com> | 2021-08-03 01:45:08 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-03 01:45:08 +0300 |
commit | 10ad77d5bc86709d8ff7f95e7040e39f1c153903 (patch) | |
tree | 307cedb87f4c0a329740c55ac364ed489d1d8fc2 /poky/meta/classes | |
parent | c6b1c6ba7a01b7987d65d61c262c44c320193108 (diff) | |
parent | 67327ddc580cb9a85219a534844832a1682780d4 (diff) | |
download | openbmc-10ad77d5bc86709d8ff7f95e7040e39f1c153903.tar.xz |
Update
Diffstat (limited to 'poky/meta/classes')
40 files changed, 373 insertions, 257 deletions
diff --git a/poky/meta/classes/archiver.bbclass b/poky/meta/classes/archiver.bbclass index 858507b34..a3962306b 100644 --- a/poky/meta/classes/archiver.bbclass +++ b/poky/meta/classes/archiver.bbclass @@ -118,7 +118,7 @@ python () { d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_ar_patched' % pn) elif ar_src == "configured": # We can't use "addtask do_ar_configured after do_configure" since it - # will cause the deptask of do_populate_sysroot to run not matter what + # will cause the deptask of do_populate_sysroot to run no matter what # archives we need, so we add the depends here. # There is a corner case with "gcc-source-${PV}" recipes, they don't have @@ -163,7 +163,7 @@ python () { d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_ar_configured' % pn) } -# Take all the sources for a recipe and puts them in WORKDIR/archiver-work/. +# Take all the sources for a recipe and put them in WORKDIR/archiver-work/. # Files in SRC_URI are copied directly, anything that's a directory # (e.g. git repositories) is "unpacked" and then put into a tarball. python do_ar_original() { @@ -463,7 +463,7 @@ python do_unpack_and_patch() { ar_sysroot_native = d.getVar('STAGING_DIR_NATIVE') pn = d.getVar('PN') - # The kernel class functions require it to be on work-shared, so we dont change WORKDIR + # The kernel class functions require it to be on work-shared, so we don't change WORKDIR if not is_work_shared(d): # Change the WORKDIR to make do_unpack do_patch run in another dir. d.setVar('WORKDIR', ar_workdir) @@ -505,7 +505,7 @@ python do_unpack_and_patch() { # of the output file ensures that we create it each time the recipe # gets rebuilt, at least as long as a PR server is used. We also rely # on that mechanism to catch changes in the file content, because the -# file content is not part of of the task signature either. +# file content is not part of the task signature either. do_ar_recipe[vardepsexclude] += "BBINCLUDED" python do_ar_recipe () { """ diff --git a/poky/meta/classes/baremetal-image.bbclass b/poky/meta/classes/baremetal-image.bbclass index b0f5e885b..8708a5430 100644 --- a/poky/meta/classes/baremetal-image.bbclass +++ b/poky/meta/classes/baremetal-image.bbclass @@ -50,6 +50,10 @@ python do_rootfs(){ if os.path.lexists(manifest_link): os.remove(manifest_link) os.symlink(os.path.basename(manifest_name), manifest_link) + # A lot of postprocess commands assume the existence of rootfs/etc + sysconfdir = d.getVar("IMAGE_ROOTFS") + d.getVar('sysconfdir') + bb.utils.mkdirhier(sysconfdir) + execute_pre_post_process(d, d.getVar('ROOTFS_POSTPROCESS_COMMAND')) } @@ -73,7 +77,19 @@ QB_DEFAULT_KERNEL ?= "${IMAGE_LINK_NAME}.bin" QB_MEM ?= "-m 256" QB_DEFAULT_FSTYPE ?= "bin" QB_DTB ?= "" -QB_OPT_APPEND = "-nographic" +QB_OPT_APPEND_append = " -nographic" + +# RISC-V tunes set the BIOS, unset, and instruct QEMU to +# ignore the BIOS and boot from -kernel +QB_DEFAULT_BIOS_qemuriscv64 = "" +QB_OPT_APPEND_append_qemuriscv64 = " -bios none" + + +# Use the medium-any code model for the RISC-V 64 bit implementation, +# since medlow can only access addresses below 0x80000000 and RAM +# starts at 0x80000000 on RISC-V 64 +CFLAGS_append_qemuriscv64 = " -mcmodel=medany" + # This next part is necessary to trick the build system into thinking # its building an image recipe so it generates the qemuboot.conf diff --git a/poky/meta/classes/buildhistory.bbclass b/poky/meta/classes/buildhistory.bbclass index 49af61c9c..55b12d789 100644 --- a/poky/meta/classes/buildhistory.bbclass +++ b/poky/meta/classes/buildhistory.bbclass @@ -43,6 +43,7 @@ BUILDHISTORY_COMMIT ?= "1" BUILDHISTORY_COMMIT_AUTHOR ?= "buildhistory <buildhistory@${DISTRO}>" BUILDHISTORY_PUSH_REPO ?= "" BUILDHISTORY_TAG ?= "build" +BUILDHISTORY_PATH_PREFIX_STRIP ?= "" SSTATEPOSTINSTFUNCS_append = " buildhistory_emit_pkghistory" # We want to avoid influencing the signatures of sstate tasks - first the function itself: @@ -697,7 +698,7 @@ python buildhistory_write_sigs() { if hasattr(bb.parse.siggen, 'dump_siglist'): taskoutdir = os.path.join(d.getVar('BUILDHISTORY_DIR'), 'task') bb.utils.mkdirhier(taskoutdir) - bb.parse.siggen.dump_siglist(os.path.join(taskoutdir, 'tasksigs.txt')) + bb.parse.siggen.dump_siglist(os.path.join(taskoutdir, 'tasksigs.txt'), d.getVar("BUILDHISTORY_PATH_PREFIX_STRIP")) } def buildhistory_get_build_id(d): @@ -875,7 +876,7 @@ python buildhistory_eventhandler() { entries = [ x for x in os.listdir(rootdir) if not x.startswith('.') ] bb.utils.mkdirhier(olddir) for entry in entries: - os.rename(os.path.join(rootdir, entry), + bb.utils.rename(os.path.join(rootdir, entry), os.path.join(olddir, entry)) elif isinstance(e, bb.event.BuildCompleted): if reset: diff --git a/poky/meta/classes/buildstats.bbclass b/poky/meta/classes/buildstats.bbclass index 8e03039ae..8a1466d3f 100644 --- a/poky/meta/classes/buildstats.bbclass +++ b/poky/meta/classes/buildstats.bbclass @@ -104,7 +104,7 @@ def write_task_data(status, logfile, e, d): f.write("Status: FAILED \n") f.write("Ended: %0.2f \n" % e.time) -def write_host_data(logfile, e, d): +def write_host_data(logfile, e, d, type): import subprocess, os, datetime # minimum time allowed for each command to run, in seconds time_threshold = 0.5 @@ -112,15 +112,22 @@ def write_host_data(logfile, e, d): num_cmds = 0 # interval at which data will be logged interval = int(d.getVar("BB_HEARTBEAT_EVENT", False)) - # the commands to be run at each interval - cmds = d.getVar('BB_LOG_HOST_STAT_CMDS') - # if no commands are passed, issue a warning and return - if cmds is None: - d.setVar("BB_LOG_HOST_STAT_ON_INTERVAL", "0") - d.setVar("BB_LOG_HOST_STAT_ON_FAILURE", "0") - bb.warn("buildstats: Collecting host data failed. Set BB_LOG_HOST_STAT_CMDS=\"command1 ; command2 ; ... \" in conf/local.conf\n") - return - # find the total commands + msg = "" + if type == "interval": + cmds = d.getVar('BB_LOG_HOST_STAT_CMDS_INTERVAL') + msg = "Host Stats: Collecting data at interval.\n" + if cmds is None: + d.setVar("BB_LOG_HOST_STAT_ON_INTERVAL", "0") + bb.warn("buildstats: Collecting host data at intervals failed. Set BB_LOG_HOST_STAT_CMDS_INTERVAL=\"command1 ; command2 ; ... \" in conf/local.conf\n") + return + if type == "failure": + cmds = d.getVar('BB_LOG_HOST_STAT_CMDS_FAILURE') + msg = "Host Stats: Collecting data on failure.\n" + msg += "Failed at task " + e.task + "\n" + if cmds is None: + d.setVar("BB_LOG_HOST_STAT_ON_FAILURE", "0") + bb.warn("buildstats: Collecting host data on failure failed. Set BB_LOG_HOST_STAT_CMDS_FAILURE=\"command1 ; command2 ; ... \" in conf/local.conf\n") + return c_san = [] for cmd in cmds.split(";"): if len(cmd) == 0: @@ -147,6 +154,7 @@ def write_host_data(logfile, e, d): os.environ['PATH'] = path + ":" + opath + ":" + ospath with open(logfile, "a") as f: f.write("Event Time: %f\nDate: %s\n" % (e.time, datetime.datetime.now())) + f.write("%s" % msg) for c in c_san: try: output = subprocess.check_output(c.split(), stderr=subprocess.STDOUT, timeout=limit).decode('utf-8') @@ -171,7 +179,7 @@ python run_buildstats () { taskdir = os.path.join(bsdir, d.getVar('PF')) if isinstance(e, bb.event.HeartbeatEvent) and bb.utils.to_boolean(d.getVar("BB_LOG_HOST_STAT_ON_INTERVAL")): bb.utils.mkdirhier(bsdir) - write_host_data(os.path.join(bsdir, "host_stats"), e, d) + write_host_data(os.path.join(bsdir, "host_stats"), e, d, "interval") if isinstance(e, bb.event.BuildStarted): ######################################################################## @@ -247,7 +255,7 @@ python run_buildstats () { with open(build_status, "a") as f: f.write(d.expand("Failed at: ${PF} at task: %s \n" % e.task)) if bb.utils.to_boolean(d.getVar("BB_LOG_HOST_STAT_ON_FAILURE")): - write_host_data(build_status, e, d) + write_host_data(os.path.join(bsdir, "host_stats"), e, d, "failure") } addhandler run_buildstats diff --git a/poky/meta/classes/clutter.bbclass b/poky/meta/classes/clutter.bbclass deleted file mode 100644 index 24b53a13e..000000000 --- a/poky/meta/classes/clutter.bbclass +++ /dev/null @@ -1,18 +0,0 @@ -def get_minor_dir(v): - import re - m = re.match(r"^([0-9]+)\.([0-9]+)", v) - return "%s.%s" % (m.group(1), m.group(2)) - -def get_real_name(n): - import re - m = re.match(r"^([a-z]+(-[a-z]+)?)(-[0-9]+\.[0-9]+)?", n) - return "%s" % (m.group(1)) - -VERMINOR = "${@get_minor_dir("${PV}")}" -REALNAME = "${@get_real_name("${BPN}")}" - -SRC_URI = "${GNOME_MIRROR}/${REALNAME}/${VERMINOR}/${REALNAME}-${PV}.tar.xz;name=archive" -S = "${WORKDIR}/${REALNAME}-${PV}" - -CLUTTERBASEBUILDCLASS ??= "autotools" -inherit ${CLUTTERBASEBUILDCLASS} pkgconfig gtk-doc gettext diff --git a/poky/meta/classes/cmake.bbclass b/poky/meta/classes/cmake.bbclass index 8876ce5aa..f01db7480 100644 --- a/poky/meta/classes/cmake.bbclass +++ b/poky/meta/classes/cmake.bbclass @@ -149,16 +149,14 @@ addtask generate_toolchain_file after do_patch before do_configure CONFIGURE_FILES = "CMakeLists.txt" +do_configure[cleandirs] = "${@d.getVar('B') if d.getVar('S') != d.getVar('B') else ''}" + cmake_do_configure() { if [ "${OECMAKE_BUILDPATH}" ]; then bbnote "cmake.bbclass no longer uses OECMAKE_BUILDPATH. The default behaviour is now out-of-tree builds with B=WORKDIR/build." fi - if [ "${S}" != "${B}" ]; then - rm -rf ${B} - mkdir -p ${B} - cd ${B} - else + if [ "${S}" = "${B}" ]; then find ${B} -name CMakeFiles -or -name Makefile -or -name cmake_install.cmake -or -name CMakeCache.txt -delete fi diff --git a/poky/meta/classes/cpan-base.bbclass b/poky/meta/classes/cpan-base.bbclass index 867edf870..1fc3f0bcb 100644 --- a/poky/meta/classes/cpan-base.bbclass +++ b/poky/meta/classes/cpan-base.bbclass @@ -16,3 +16,12 @@ def is_target(d): PERLLIBDIRS = "${libdir}/perl5" PERLLIBDIRS_class-native = "${libdir}/perl5" + +def cpan_upstream_check_pattern(d): + for x in (d.getVar('SRC_URI') or '').split(' '): + if x.startswith("https://cpan.metacpan.org"): + _pattern = x.split('/')[-1].replace(d.getVar('PV'), '(?P<pver>\d+.\d+)') + return _pattern + return '' + +UPSTREAM_CHECK_REGEX ?= "${@cpan_upstream_check_pattern(d)}" diff --git a/poky/meta/classes/cross-canadian.bbclass b/poky/meta/classes/cross-canadian.bbclass index f5c9f6159..39b5bb93f 100644 --- a/poky/meta/classes/cross-canadian.bbclass +++ b/poky/meta/classes/cross-canadian.bbclass @@ -36,7 +36,7 @@ python () { return tos = d.getVar("TARGET_OS") - whitelist = [] + whitelist = ["mingw32"] extralibcs = [""] if "musl" in d.getVar("BASECANADIANEXTRAOS"): extralibcs.append("musl") @@ -155,7 +155,7 @@ libexecdir = "${exec_prefix}/libexec/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS} FILES_${PN} = "${prefix}" -export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${layout_libdir}/pkgconfig" +export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${exec_prefix}/lib/pkgconfig" export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}" do_populate_sysroot[stamp-extra-info] = "" diff --git a/poky/meta/classes/externalsrc.bbclass b/poky/meta/classes/externalsrc.bbclass index 54cc7edba..3d6b80bee 100644 --- a/poky/meta/classes/externalsrc.bbclass +++ b/poky/meta/classes/externalsrc.bbclass @@ -217,11 +217,10 @@ def srctree_hash_files(d, srcdir=None): env['GIT_INDEX_FILE'] = tmp_index.name subprocess.check_output(['git', 'add', '-A', '.'], cwd=s_dir, env=env) git_sha1 = subprocess.check_output(['git', 'write-tree'], cwd=s_dir, env=env).decode("utf-8") - submodule_helper = subprocess.check_output(['git', 'submodule', 'status'], cwd=s_dir, env=env).decode("utf-8") + submodule_helper = subprocess.check_output(['git', 'submodule--helper', 'list'], cwd=s_dir, env=env).decode("utf-8") for line in submodule_helper.splitlines(): - module_relpath = line.split()[1] - if not module_relpath.split('/')[0] == '..': - module_dir = os.path.join(s_dir, module_relpath) + module_dir = os.path.join(s_dir, line.rsplit(maxsplit=1)[1]) + if os.path.isdir(module_dir): proc = subprocess.Popen(['git', 'add', '-A', '.'], cwd=module_dir, env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) proc.communicate() proc = subprocess.Popen(['git', 'write-tree'], cwd=module_dir, env=env, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) diff --git a/poky/meta/classes/gi-docgen.bbclass b/poky/meta/classes/gi-docgen.bbclass new file mode 100644 index 000000000..5750f7028 --- /dev/null +++ b/poky/meta/classes/gi-docgen.bbclass @@ -0,0 +1,24 @@ +# gi-docgen is a new gnome documentation generator, which +# seems to be a successor to gtk-doc: +# https://gitlab.gnome.org/GNOME/gi-docgen + +# This variable is set to True if api-documentation is in +# DISTRO_FEATURES, and False otherwise. +GIDOCGEN_ENABLED ?= "${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'True', 'False', d)}" +# When building native recipes, disable gi-docgen, as it is not necessary, +# pulls in additional dependencies, and makes build times longer +GIDOCGEN_ENABLED_class-native = "False" +GIDOCGEN_ENABLED_class-nativesdk = "False" + +# meson: default option name to enable/disable gi-docgen. This matches most +# projects' configuration. In doubts - check meson_options.txt in project's +# source path. +GIDOCGEN_MESON_OPTION ?= 'gtk_doc' +GIDOCGEN_MESON_ENABLE_FLAG ?= 'true' +GIDOCGEN_MESON_DISABLE_FLAG ?= 'false' + +# Auto enable/disable based on GIDOCGEN_ENABLED +EXTRA_OEMESON_prepend = "-D${GIDOCGEN_MESON_OPTION}=${@bb.utils.contains('GIDOCGEN_ENABLED', 'True', '${GIDOCGEN_MESON_ENABLE_FLAG}', '${GIDOCGEN_MESON_DISABLE_FLAG}', d)} " + +DEPENDS_append = "${@' gi-docgen-native gi-docgen' if d.getVar('GIDOCGEN_ENABLED') == 'True' else ''}" + diff --git a/poky/meta/classes/gnomebase.bbclass b/poky/meta/classes/gnomebase.bbclass index efcb6caae..884b1a106 100644 --- a/poky/meta/classes/gnomebase.bbclass +++ b/poky/meta/classes/gnomebase.bbclass @@ -1,5 +1,6 @@ def gnome_verdir(v): - return oe.utils.trim_version(v, 2) + return ".".join(v.split(".")[:-1]) + GNOME_COMPRESS_TYPE ?= "xz" SECTION ?= "x11/gnome" diff --git a/poky/meta/classes/icecc.bbclass b/poky/meta/classes/icecc.bbclass index d095305ed..80943fcf0 100644 --- a/poky/meta/classes/icecc.bbclass +++ b/poky/meta/classes/icecc.bbclass @@ -138,10 +138,6 @@ def use_icecc(bb,d): if icecc_is_cross_canadian(bb, d): return "no" - if d.getVar('INHIBIT_DEFAULT_DEPS', False): - # We don't have a compiler, so no icecc - return "no" - pn = d.getVar('PN') bpn = d.getVar('BPN') @@ -362,7 +358,7 @@ set_icecc_env() { ICECC_WHICH_AS="${@bb.utils.which(os.getenv('PATH'), 'as')}" if [ ! -x "${ICECC_CC}" -o ! -x "${ICECC_CXX}" ] then - bbwarn "Cannot use icecc: could not get ICECC_CC or ICECC_CXX" + bbnote "Cannot use icecc: could not get ICECC_CC or ICECC_CXX" return fi diff --git a/poky/meta/classes/image-live.bbclass b/poky/meta/classes/image-live.bbclass index 8b08305cd..fd876ed8e 100644 --- a/poky/meta/classes/image-live.bbclass +++ b/poky/meta/classes/image-live.bbclass @@ -261,4 +261,4 @@ python do_bootimg() { do_bootimg[subimages] = "hddimg iso" do_bootimg[imgsuffix] = "." -addtask bootimg before do_image_complete +addtask bootimg before do_image_complete after do_rootfs diff --git a/poky/meta/classes/image-mklibs.bbclass b/poky/meta/classes/image-mklibs.bbclass deleted file mode 100644 index 68e11d436..000000000 --- a/poky/meta/classes/image-mklibs.bbclass +++ /dev/null @@ -1,56 +0,0 @@ -do_rootfs[depends] += "mklibs-native:do_populate_sysroot" - -IMAGE_PREPROCESS_COMMAND += "mklibs_optimize_image; " - -inherit linuxloader - -mklibs_optimize_image_doit() { - rm -rf ${WORKDIR}/mklibs - mkdir -p ${WORKDIR}/mklibs/dest - cd ${IMAGE_ROOTFS} - du -bs > ${WORKDIR}/mklibs/du.before.mklibs.txt - - # Build a list of dynamically linked executable ELF files. - # Omit libc/libpthread as a special case because it has an interpreter - # but is primarily what we intend to strip down. - for i in `find . -type f -executable ! -name 'libc-*' ! -name 'libpthread-*'`; do - file $i | grep -q ELF || continue - ${HOST_PREFIX}readelf -l $i | grep -q INTERP || continue - echo $i - done > ${WORKDIR}/mklibs/executables.list - - dynamic_loader=${@get_linuxloader(d)} - - mklibs -v \ - --ldlib ${dynamic_loader} \ - --libdir ${baselib} \ - --sysroot ${PKG_CONFIG_SYSROOT_DIR} \ - --gcc-options "--sysroot=${PKG_CONFIG_SYSROOT_DIR}" \ - --root ${IMAGE_ROOTFS} \ - --target `echo ${TARGET_PREFIX} | sed 's/-$//' ` \ - -d ${WORKDIR}/mklibs/dest \ - `cat ${WORKDIR}/mklibs/executables.list` - - cd ${WORKDIR}/mklibs/dest - for i in * - do - cp $i `find ${IMAGE_ROOTFS} -name $i` - done - - cd ${IMAGE_ROOTFS} - du -bs > ${WORKDIR}/mklibs/du.after.mklibs.txt - - echo rootfs size before mklibs optimization: `cat ${WORKDIR}/mklibs/du.before.mklibs.txt` - echo rootfs size after mklibs optimization: `cat ${WORKDIR}/mklibs/du.after.mklibs.txt` -} - -mklibs_optimize_image() { - for img in ${MKLIBS_OPTIMIZED_IMAGES} - do - if [ "${img}" = "${PN}" ] || [ "${img}" = "all" ] - then - mklibs_optimize_image_doit - break - fi - done -} diff --git a/poky/meta/classes/image.bbclass b/poky/meta/classes/image.bbclass index 013455f49..67603d958 100644 --- a/poky/meta/classes/image.bbclass +++ b/poky/meta/classes/image.bbclass @@ -38,7 +38,7 @@ IMAGE_FEATURES[validitems] += "debug-tweaks read-only-rootfs read-only-rootfs-de # Generate companion debugfs? IMAGE_GEN_DEBUGFS ?= "0" -# These pacackages will be installed as additional into debug rootfs +# These packages will be installed as additional into debug rootfs IMAGE_INSTALL_DEBUGFS ?= "" # These packages will be removed from a read-only rootfs after all other @@ -657,7 +657,7 @@ reproducible_final_image_task () { fi # Set mtime of all files to a reproducible value bbnote "reproducible_final_image_task: mtime set to $REPRODUCIBLE_TIMESTAMP_ROOTFS" - find ${IMAGE_ROOTFS} -exec touch -h --date=@$REPRODUCIBLE_TIMESTAMP_ROOTFS {} \; + find ${IMAGE_ROOTFS} -print0 | xargs -0 touch -h --date=@$REPRODUCIBLE_TIMESTAMP_ROOTFS fi } diff --git a/poky/meta/classes/image_types.bbclass b/poky/meta/classes/image_types.bbclass index 802869140..954d6739e 100644 --- a/poky/meta/classes/image_types.bbclass +++ b/poky/meta/classes/image_types.bbclass @@ -108,6 +108,11 @@ IMAGE_CMD_squashfs-xz = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME IMAGE_CMD_squashfs-lzo = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lzo ${EXTRA_IMAGECMD} -noappend -comp lzo" IMAGE_CMD_squashfs-lz4 = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-lz4 ${EXTRA_IMAGECMD} -noappend -comp lz4" +IMAGE_CMD_erofs = "mkfs.erofs ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs ${IMAGE_ROOTFS}" +IMAGE_CMD_erofs-lz4 = "mkfs.erofs -zlz4 ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs-lz4 ${IMAGE_ROOTFS}" +IMAGE_CMD_erofs-lz4hc = "mkfs.erofs -zlz4hc ${EXTRA_IMAGECMD} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.erofs-lz4hc ${IMAGE_ROOTFS}" + + IMAGE_CMD_TAR ?= "tar" # ignore return code 1 "file changed as we read it" as other tasks(e.g. do_image_wic) may be hardlinking rootfs IMAGE_CMD_tar = "${IMAGE_CMD_TAR} --sort=name --format=posix --numeric-owner -cf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.tar -C ${IMAGE_ROOTFS} . || [ $? -eq 1 ]" @@ -243,6 +248,9 @@ do_image_ubi[depends] += "mtd-utils-native:do_populate_sysroot" do_image_ubifs[depends] += "mtd-utils-native:do_populate_sysroot" do_image_multiubi[depends] += "mtd-utils-native:do_populate_sysroot" do_image_f2fs[depends] += "f2fs-tools-native:do_populate_sysroot" +do_image_erofs[depends] += "erofs-utils-native:do_populate_sysroot" +do_image_erofs_lz4[depends] += "erofs-utils-native:do_populate_sysroot" +do_image_erofs_lz4hc[depends] += "erofs-utils-native:do_populate_sysroot" # This variable is available to request which values are suitable for IMAGE_FSTYPES IMAGE_TYPES = " \ @@ -261,6 +269,7 @@ IMAGE_TYPES = " \ wic wic.gz wic.bz2 wic.lzma wic.zst \ container \ f2fs \ + erofs erofs-lz4 erofs-lz4hc \ " # Compression is a special case of conversion. The old variable @@ -269,7 +278,7 @@ IMAGE_TYPES = " \ # CONVERSION_CMD/DEPENDS. COMPRESSIONTYPES ?= "" -CONVERSIONTYPES = "gz bz2 lzma xz lz4 lzo zip zst sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum bmap u-boot vmdk vhd vhdx vdi qcow2 base64 ${COMPRESSIONTYPES}" +CONVERSIONTYPES = "gz bz2 lzma xz lz4 lzo zip zst sum md5sum sha1sum sha224sum sha256sum sha384sum sha512sum bmap u-boot vmdk vhd vhdx vdi qcow2 base64 gzsync zsync ${COMPRESSIONTYPES}" CONVERSION_CMD_lzma = "lzma -k -f -7 ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" CONVERSION_CMD_gz = "gzip -f -9 -n -c --rsyncable ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.gz" CONVERSION_CMD_bz2 = "pbzip2 -f -k ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" @@ -293,6 +302,8 @@ CONVERSION_CMD_vhd = "qemu-img convert -O vpc -o subformat=fixed ${IMAGE_NAME}${ CONVERSION_CMD_vdi = "qemu-img convert -O vdi ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.vdi" CONVERSION_CMD_qcow2 = "qemu-img convert -O qcow2 ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.qcow2" CONVERSION_CMD_base64 = "base64 ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} > ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.base64" +CONVERSION_CMD_zsync = "zsyncmake_curl ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" +CONVERSION_CMD_gzsync = "zsyncmake_curl -z ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" CONVERSION_DEPENDS_lzma = "xz-native" CONVERSION_DEPENDS_gz = "pigz-native" CONVERSION_DEPENDS_bz2 = "pbzip2-native" @@ -310,6 +321,8 @@ CONVERSION_DEPENDS_qcow2 = "qemu-system-native" CONVERSION_DEPENDS_base64 = "coreutils-native" CONVERSION_DEPENDS_vhdx = "qemu-system-native" CONVERSION_DEPENDS_vhd = "qemu-system-native" +CONVERSION_DEPENDS_zsync = "zsync-curl-native" +CONVERSION_DEPENDS_gzsync = "zsync-curl-native" RUNNABLE_IMAGE_TYPES ?= "ext2 ext3 ext4" RUNNABLE_MACHINE_PATTERNS ?= "qemu" diff --git a/poky/meta/classes/insane.bbclass b/poky/meta/classes/insane.bbclass index fa05fc055..763d5f1da 100644 --- a/poky/meta/classes/insane.bbclass +++ b/poky/meta/classes/insane.bbclass @@ -176,7 +176,7 @@ def package_qa_check_useless_rpaths(file, name, d, elf, messages): if rpath_eq(rpath, libdir) or rpath_eq(rpath, base_libdir): # The dynamic linker searches both these places anyway. There is no point in # looking there again. - package_qa_add_message(messages, "useless-rpaths", "%s: %s contains probably-redundant RPATH %s" % (name, package_qa_clean_path(file, d), rpath)) + package_qa_add_message(messages, "useless-rpaths", "%s: %s contains probably-redundant RPATH %s" % (name, package_qa_clean_path(file, d, name), rpath)) QAPATHTEST[dev-so] = "package_qa_check_dev" def package_qa_check_dev(path, name, d, elf, messages): @@ -185,8 +185,8 @@ def package_qa_check_dev(path, name, d, elf, messages): """ if not name.endswith("-dev") and not name.endswith("-dbg") and not name.endswith("-ptest") and not name.startswith("nativesdk-") and path.endswith(".so") and os.path.islink(path): - package_qa_add_message(messages, "dev-so", "non -dev/-dbg/nativesdk- package contains symlink .so: %s path '%s'" % \ - (name, package_qa_clean_path(path,d))) + package_qa_add_message(messages, "dev-so", "non -dev/-dbg/nativesdk- package %s contains symlink .so '%s'" % \ + (name, package_qa_clean_path(path, d, name))) QAPATHTEST[dev-elf] = "package_qa_check_dev_elf" def package_qa_check_dev_elf(path, name, d, elf, messages): @@ -196,8 +196,8 @@ def package_qa_check_dev_elf(path, name, d, elf, messages): install link-time .so files that are linker scripts. """ if name.endswith("-dev") and path.endswith(".so") and not os.path.islink(path) and elf: - package_qa_add_message(messages, "dev-elf", "-dev package contains non-symlink .so: %s path '%s'" % \ - (name, package_qa_clean_path(path,d))) + package_qa_add_message(messages, "dev-elf", "-dev package %s contains non-symlink .so '%s'" % \ + (name, package_qa_clean_path(path, d, name))) QAPATHTEST[staticdev] = "package_qa_check_staticdev" def package_qa_check_staticdev(path, name, d, elf, messages): @@ -210,7 +210,7 @@ def package_qa_check_staticdev(path, name, d, elf, messages): if not name.endswith("-pic") and not name.endswith("-staticdev") and not name.endswith("-ptest") and path.endswith(".a") and not path.endswith("_nonshared.a") and not '/usr/lib/debug-static/' in path and not '/.debug-static/' in path: package_qa_add_message(messages, "staticdev", "non -staticdev package contains static .a library: %s path '%s'" % \ - (name, package_qa_clean_path(path,d))) + (name, package_qa_clean_path(path,d, name))) QAPATHTEST[mime] = "package_qa_check_mime" def package_qa_check_mime(path, name, d, elf, messages): diff --git a/poky/meta/classes/kernel-fitimage.bbclass b/poky/meta/classes/kernel-fitimage.bbclass index 5cfd8af99..e363eeb64 100644 --- a/poky/meta/classes/kernel-fitimage.bbclass +++ b/poky/meta/classes/kernel-fitimage.bbclass @@ -217,13 +217,13 @@ fitimage_emit_section_boot_script() { bootscr_sign_keyname="${UBOOT_SIGN_KEYNAME}" cat << EOF >> ${1} - bootscr@${2} { + bootscr-${2} { description = "U-boot script"; data = /incbin/("${3}"); type = "script"; arch = "${UBOOT_ARCH}"; compression = "none"; - hash@1 { + hash-1 { algo = "${bootscr_csum}"; }; }; @@ -232,7 +232,7 @@ EOF if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "${bootscr_sign_keyname}" ] ; then sed -i '$ d' ${1} cat << EOF >> ${1} - signature@1 { + signature-1 { algo = "${bootscr_csum},${bootscr_sign_algo}"; key-name-hint = "${bootscr_sign_keyname}"; }; @@ -331,7 +331,7 @@ fitimage_emit_section_config() { conf_csum="${FIT_HASH_ALG}" conf_sign_algo="${FIT_SIGN_ALG}" - if [ -n "${UBOOT_SIGN_ENABLE}" ] ; then + if [ "${UBOOT_SIGN_ENABLE}" = "1" ] ; then conf_sign_keyname="${UBOOT_SIGN_KEYNAME}" fi @@ -383,7 +383,7 @@ fitimage_emit_section_config() { if [ -n "${bootscr_id}" ]; then conf_desc="${conf_desc}${sep}u-boot script" sep=", " - bootscr_line="bootscr = \"bootscr@${bootscr_id}\";" + bootscr_line="bootscr = \"bootscr-${bootscr_id}\";" fi if [ -n "${config_id}" ]; then @@ -667,7 +667,34 @@ do_assemble_fitimage_initramfs() { addtask assemble_fitimage_initramfs before do_deploy after do_bundle_initramfs -addtask generate_rsa_keys before do_assemble_fitimage after do_compile +do_kernel_generate_rsa_keys() { + if [ "${UBOOT_SIGN_ENABLE}" = "0" ] && [ "${FIT_GENERATE_KEYS}" = "1" ]; then + bbwarn "FIT_GENERATE_KEYS is set to 1 even though UBOOT_SIGN_ENABLE is set to 0. The keys will not be generated as they won't be used." + fi + + if [ "${UBOOT_SIGN_ENABLE}" = "1" ] && [ "${FIT_GENERATE_KEYS}" = "1" ]; then + + # Generate keys only if they don't already exist + if [ ! -f "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".key ] || \ + [ ! -f "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".crt ]; then + + # make directory if it does not already exist + mkdir -p "${UBOOT_SIGN_KEYDIR}" + + echo "Generating RSA private key for signing fitImage" + openssl genrsa ${FIT_KEY_GENRSA_ARGS} -out \ + "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".key \ + "${FIT_SIGN_NUMBITS}" + + echo "Generating certificate for signing fitImage" + openssl req ${FIT_KEY_REQ_ARGS} "${FIT_KEY_SIGN_PKCS}" \ + -key "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".key \ + -out "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".crt + fi + fi +} + +addtask kernel_generate_rsa_keys before do_assemble_fitimage after do_compile kernel_do_deploy[vardepsexclude] = "DATETIME" kernel_do_deploy_append() { @@ -718,13 +745,13 @@ kernel_do_deploy_append() { # - Removes do_assemble_fitimage. FIT generation is done through # do_assemble_fitimage_initramfs. do_assemble_fitimage is not needed # and should not be part of the tasks to be executed. -# - Since do_generate_rsa_keys is inserted by default +# - Since do_kernel_generate_rsa_keys is inserted by default # between do_compile and do_assemble_fitimage, this is -# not suitable in case of initramfs bundles. do_generate_rsa_keys +# not suitable in case of initramfs bundles. do_kernel_generate_rsa_keys # should be between do_bundle_initramfs and do_assemble_fitimage_initramfs. python () { if d.getVar('INITRAMFS_IMAGE_BUNDLE') == "1": bb.build.deltask('do_assemble_fitimage', d) - bb.build.deltask('generate_rsa_keys', d) - bb.build.addtask('generate_rsa_keys', 'do_assemble_fitimage_initramfs', 'do_bundle_initramfs', d) + bb.build.deltask('kernel_generate_rsa_keys', d) + bb.build.addtask('kernel_generate_rsa_keys', 'do_assemble_fitimage_initramfs', 'do_bundle_initramfs', d) } diff --git a/poky/meta/classes/kernel-yocto.bbclass b/poky/meta/classes/kernel-yocto.bbclass index 15c8dbb81..0df61cdef 100644 --- a/poky/meta/classes/kernel-yocto.bbclass +++ b/poky/meta/classes/kernel-yocto.bbclass @@ -113,6 +113,8 @@ do_kernel_metadata() { cd ${S} export KMETA=${KMETA} + bbnote "do_kernel_metadata: for summary/debug, set KCONF_AUDIT_LEVEL > 0" + # if kernel tools are available in-tree, they are preferred # and are placed on the path before any external tools. Unless # the external tools flag is set, in that case we do nothing. @@ -290,6 +292,21 @@ do_kernel_metadata() { fi fi fi + + if [ ${KCONF_AUDIT_LEVEL} -gt 0 ]; then + bbnote "kernel meta data summary for ${KMACHINE} (${LINUX_KERNEL_TYPE}):" + bbnote "======================================================================" + if [ -n "${KMETA_EXTERNAL_BSPS}" ]; then + bbnote "Non kernel-cache (external) bsp" + fi + bbnote "BSP entry point / definition: $bsp_definition" + if [ -n "$in_tree_defconfig" ]; then + bbnote "KBUILD_DEFCONFIG: ${KBUILD_DEFCONFIG}" + fi + bbnote "Fragments from SRC_URI: $sccs_from_src_uri" + bbnote "KERNEL_FEATURES: $KERNEL_FEATURES_FINAL" + bbnote "Final scc/cfg list: $sccs_defconfig $bsp_definition $sccs $KERNEL_FEATURES_FINAL" + fi } do_patch() { @@ -378,7 +395,7 @@ do_kernel_checkout() { # checkout and clobber any unimportant files git checkout -f ${machine_branch} } -do_kernel_checkout[dirs] = "${S}" +do_kernel_checkout[dirs] = "${S} ${WORKDIR}" addtask kernel_checkout before do_kernel_metadata after do_symlink_kernsrc addtask kernel_metadata after do_validate_branches do_unpack before do_patch @@ -614,7 +631,31 @@ do_validate_branches() { # if SRCREV is AUTOREV it shows up as AUTOINC there's nothing to # check and we can exit early if [ "${machine_srcrev}" = "AUTOINC" ]; then + linux_yocto_dev='${@oe.utils.conditional("PREFERRED_PROVIDER_virtual/kernel", "linux-yocto-dev", "1", "", d)}' + if [ -n "$linux_yocto_dev" ]; then + git checkout -q -f ${machine_branch} + ver=$(grep "^VERSION =" ${S}/Makefile | sed s/.*=\ *//) + patchlevel=$(grep "^PATCHLEVEL =" ${S}/Makefile | sed s/.*=\ *//) + sublevel=$(grep "^SUBLEVEL =" ${S}/Makefile | sed s/.*=\ *//) + kver="$ver.$patchlevel" + bbnote "dev kernel: performing version -> branch -> SRCREV validation" + bbnote "dev kernel: recipe version ${LINUX_VERSION}, src version: $kver" + echo "${LINUX_VERSION}" | grep -q $kver + if [ $? -ne 0 ]; then + version="$(echo ${LINUX_VERSION} | sed 's/\+.*$//g')" + versioned_branch="v$version/$machine_branch" + + machine_branch=$versioned_branch + force_srcrev="$(git rev-parse $machine_branch 2> /dev/null)" + if [ $? -ne 0 ]; then + bbfatal "kernel version mismatch detected, and no valid branch $machine_branch detected" + fi + + bbnote "dev kernel: adjusting branch to $machine_branch, srcrev to: $force_srcrev" + fi + else bbnote "SRCREV validation is not required for AUTOREV" + fi elif [ "${machine_srcrev}" = "" ]; then if [ "${SRCREV}" != "AUTOINC" ] && [ "${SRCREV}" != "INVALID" ]; then # SRCREV_machine_<MACHINE> was not set. This means that a custom recipe diff --git a/poky/meta/classes/kernel.bbclass b/poky/meta/classes/kernel.bbclass index 8693ab86b..379bed44f 100644 --- a/poky/meta/classes/kernel.bbclass +++ b/poky/meta/classes/kernel.bbclass @@ -714,7 +714,7 @@ do_sizecheck() { at_least_one_fits= for imageType in ${KERNEL_IMAGETYPES} ; do size=`du -ks ${B}/${KERNEL_OUTPUT_DIR}/$imageType | awk '{print $1}'` - if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then + if [ $size -gt ${KERNEL_IMAGE_MAXSIZE} ]; then bbwarn "This kernel $imageType (size=$size(K) > ${KERNEL_IMAGE_MAXSIZE}(K)) is too big for your device." else at_least_one_fits=y diff --git a/poky/meta/classes/license_image.bbclass b/poky/meta/classes/license_image.bbclass index c96b032eb..73cebb4d5 100644 --- a/poky/meta/classes/license_image.bbclass +++ b/poky/meta/classes/license_image.bbclass @@ -1,3 +1,5 @@ +ROOTFS_LICENSE_DIR = "${IMAGE_ROOTFS}/usr/share/common-licenses" + python write_package_manifest() { # Get list of installed packages license_image_dir = d.expand('${LICENSE_DIRECTORY}/${IMAGE_NAME}') @@ -104,8 +106,7 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True): copy_lic_manifest = d.getVar('COPY_LIC_MANIFEST') copy_lic_dirs = d.getVar('COPY_LIC_DIRS') if rootfs and copy_lic_manifest == "1": - rootfs_license_dir = os.path.join(d.getVar('IMAGE_ROOTFS'), - 'usr', 'share', 'common-licenses') + rootfs_license_dir = d.getVar('ROOTFS_LICENSE_DIR') bb.utils.mkdirhier(rootfs_license_dir) rootfs_license_manifest = os.path.join(rootfs_license_dir, os.path.split(license_manifest)[1]) @@ -143,12 +144,13 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True): continue # Make sure we use only canonical name for the license file - rootfs_license = os.path.join(rootfs_license_dir, "generic_%s" % generic_lic) + generic_lic_file = "generic_%s" % generic_lic + rootfs_license = os.path.join(rootfs_license_dir, generic_lic_file) if not os.path.exists(rootfs_license): oe.path.copyhardlink(pkg_license, rootfs_license) if not os.path.exists(pkg_rootfs_license): - os.symlink(os.path.join('..', lic), pkg_rootfs_license) + os.symlink(os.path.join('..', generic_lic_file), pkg_rootfs_license) else: if (oe.license.license_ok(canonical_license(d, lic), bad_licenses) == False or @@ -267,3 +269,13 @@ python do_populate_lic_deploy() { addtask populate_lic_deploy before do_build after do_image_complete do_populate_lic_deploy[recrdeptask] += "do_populate_lic do_deploy" +python license_qa_dead_symlink() { + import os + + for root, dirs, files in os.walk(d.getVar('ROOTFS_LICENSE_DIR')): + for file in files: + full_path = root + "/" + file + if os.path.islink(full_path) and not os.path.exists(full_path): + bb.error("broken symlink: " + full_path) +} +IMAGE_QA_COMMANDS += "license_qa_dead_symlink" diff --git a/poky/meta/classes/linuxloader.bbclass b/poky/meta/classes/linuxloader.bbclass index 30925ac87..4447c8847 100644 --- a/poky/meta/classes/linuxloader.bbclass +++ b/poky/meta/classes/linuxloader.bbclass @@ -40,6 +40,8 @@ def get_glibc_loader(d): dynamic_loader = "${base_libdir}/ld-linux-mipsn8.so.1" elif targetarch.startswith("mips"): dynamic_loader = "${base_libdir}/ld.so.1" + elif targetarch == "powerpc64le": + dynamic_loader = "${base_libdir}/ld64.so.2" elif targetarch == "powerpc64": dynamic_loader = "${base_libdir}/ld64.so.1" elif targetarch == "x86_64": @@ -52,6 +54,8 @@ def get_glibc_loader(d): dynamic_loader = "${base_libdir}/ld-linux-aarch64${ARMPKGSFX_ENDIAN_64}.so.1" elif targetarch.startswith("riscv64"): dynamic_loader = "${base_libdir}/ld-linux-riscv64-lp64${@['d', ''][d.getVar('TARGET_FPU') == 'soft']}.so.1" + elif targetarch.startswith("riscv32"): + dynamic_loader = "${base_libdir}/ld-linux-riscv32-ilp32${@['d', ''][d.getVar('TARGET_FPU') == 'soft']}.so.1" return dynamic_loader def get_linuxloader(d): diff --git a/poky/meta/classes/meson-routines.bbclass b/poky/meta/classes/meson-routines.bbclass new file mode 100644 index 000000000..be3aeedeb --- /dev/null +++ b/poky/meta/classes/meson-routines.bbclass @@ -0,0 +1,51 @@ +inherit siteinfo + +def meson_array(var, d): + items = d.getVar(var).split() + return repr(items[0] if len(items) == 1 else items) + +# Map our ARCH values to what Meson expects: +# http://mesonbuild.com/Reference-tables.html#cpu-families +def meson_cpu_family(var, d): + import re + arch = d.getVar(var) + if arch == 'powerpc': + return 'ppc' + elif arch == 'powerpc64' or arch == 'powerpc64le': + return 'ppc64' + elif arch == 'armeb': + return 'arm' + elif arch == 'aarch64_be': + return 'aarch64' + elif arch == 'mipsel': + return 'mips' + elif arch == 'mips64el': + return 'mips64' + elif re.match(r"i[3-6]86", arch): + return "x86" + elif arch == "microblazeel": + return "microblaze" + else: + return arch + +# Map our OS values to what Meson expects: +# https://mesonbuild.com/Reference-tables.html#operating-system-names +def meson_operating_system(var, d): + os = d.getVar(var) + if "mingw" in os: + return "windows" + # avoid e.g 'linux-gnueabi' + elif "linux" in os: + return "linux" + else: + return os + +def meson_endian(prefix, d): + arch, os = d.getVar(prefix + "_ARCH"), d.getVar(prefix + "_OS") + sitedata = siteinfo_data_for_machine(arch, os, d) + if "endian-little" in sitedata: + return "little" + elif "endian-big" in sitedata: + return "big" + else: + bb.fatal("Cannot determine endianism for %s-%s" % (arch, os)) diff --git a/poky/meta/classes/meson.bbclass b/poky/meta/classes/meson.bbclass index bf9b02e06..8ae0285f7 100644 --- a/poky/meta/classes/meson.bbclass +++ b/poky/meta/classes/meson.bbclass @@ -1,4 +1,4 @@ -inherit siteinfo python3native +inherit python3native meson-routines DEPENDS_append = " meson-native ninja-native" @@ -35,56 +35,6 @@ MESON_CROSS_FILE = "" MESON_CROSS_FILE_class-target = "--cross-file ${WORKDIR}/meson.cross" MESON_CROSS_FILE_class-nativesdk = "--cross-file ${WORKDIR}/meson.cross" -def meson_array(var, d): - items = d.getVar(var).split() - return repr(items[0] if len(items) == 1 else items) - -# Map our ARCH values to what Meson expects: -# http://mesonbuild.com/Reference-tables.html#cpu-families -def meson_cpu_family(var, d): - import re - arch = d.getVar(var) - if arch == 'powerpc': - return 'ppc' - elif arch == 'powerpc64' or arch == 'powerpc64le': - return 'ppc64' - elif arch == 'armeb': - return 'arm' - elif arch == 'aarch64_be': - return 'aarch64' - elif arch == 'mipsel': - return 'mips' - elif arch == 'mips64el': - return 'mips64' - elif re.match(r"i[3-6]86", arch): - return "x86" - elif arch == "microblazeel": - return "microblaze" - else: - return arch - -# Map our OS values to what Meson expects: -# https://mesonbuild.com/Reference-tables.html#operating-system-names -def meson_operating_system(var, d): - os = d.getVar(var) - if "mingw" in os: - return "windows" - # avoid e.g 'linux-gnueabi' - elif "linux" in os: - return "linux" - else: - return os - -def meson_endian(prefix, d): - arch, os = d.getVar(prefix + "_ARCH"), d.getVar(prefix + "_OS") - sitedata = siteinfo_data_for_machine(arch, os, d) - if "endian-little" in sitedata: - return "little" - elif "endian-big" in sitedata: - return "big" - else: - bb.fatal("Cannot determine endianism for %s-%s" % (arch, os)) - addtask write_config before do_configure do_write_config[vardeps] += "CC CXX LD AR NM STRIP READELF CFLAGS CXXFLAGS LDFLAGS" do_write_config() { diff --git a/poky/meta/classes/multilib.bbclass b/poky/meta/classes/multilib.bbclass index 9f726e453..2ef75c0d1 100644 --- a/poky/meta/classes/multilib.bbclass +++ b/poky/meta/classes/multilib.bbclass @@ -105,7 +105,6 @@ python __anonymous () { d.setVar("LINGUAS_INSTALL", "") # FIXME, we need to map this to something, not delete it! d.setVar("PACKAGE_INSTALL_ATTEMPTONLY", "") - bb.build.deltask('do_populate_sdk', d) bb.build.deltask('do_populate_sdk_ext', d) return } diff --git a/poky/meta/classes/native.bbclass b/poky/meta/classes/native.bbclass index a0838e41b..561cc23f6 100644 --- a/poky/meta/classes/native.bbclass +++ b/poky/meta/classes/native.bbclass @@ -119,6 +119,7 @@ python native_virtclass_handler () { pn = e.data.getVar("PN") if not pn.endswith("-native"): return + bpn = e.data.getVar("BPN") # Set features here to prevent appends and distro features backfill # from modifying native distro features @@ -146,7 +147,10 @@ python native_virtclass_handler () { elif "-cross-" in dep: newdeps.append(dep.replace("-cross", "-native")) elif not dep.endswith("-native"): - newdeps.append(dep.replace("-native", "") + "-native") + # Replace ${PN} with ${BPN} in the dependency to make sure + # dependencies on, e.g., ${PN}-foo become ${BPN}-foo-native + # rather than ${BPN}-native-foo-native. + newdeps.append(dep.replace(pn, bpn) + "-native") else: newdeps.append(dep) d.setVar(varname, " ".join(newdeps), parsing=True) @@ -166,7 +170,7 @@ python native_virtclass_handler () { if prov.find(pn) != -1: nprovides.append(prov) elif not prov.endswith("-native"): - nprovides.append(prov.replace(prov, prov + "-native")) + nprovides.append(prov + "-native") else: nprovides.append(prov) e.data.setVar("PROVIDES", ' '.join(nprovides)) diff --git a/poky/meta/classes/npm.bbclass b/poky/meta/classes/npm.bbclass index 55a6985fb..8f8712a02 100644 --- a/poky/meta/classes/npm.bbclass +++ b/poky/meta/classes/npm.bbclass @@ -247,8 +247,10 @@ python npm_do_compile() { # Add node-gyp configuration configs.append(("arch", d.getVar("NPM_ARCH"))) configs.append(("release", "true")) - sysroot = d.getVar("RECIPE_SYSROOT_NATIVE") - nodedir = os.path.join(sysroot, d.getVar("prefix_native").strip("/")) + nodedir = d.getVar("NPM_NODEDIR") + if not nodedir: + sysroot = d.getVar("RECIPE_SYSROOT_NATIVE") + nodedir = os.path.join(sysroot, d.getVar("prefix_native").strip("/")) configs.append(("nodedir", nodedir)) configs.append(("python", d.getVar("PYTHON"))) diff --git a/poky/meta/classes/package.bbclass b/poky/meta/classes/package.bbclass index e3f0a7060..cf30f33f3 100644 --- a/poky/meta/classes/package.bbclass +++ b/poky/meta/classes/package.bbclass @@ -1049,7 +1049,7 @@ python fixup_perms () { # Create path to move directory to, move it, and then setup the symlink bb.utils.mkdirhier(os.path.dirname(target)) #bb.note("Fixup Perms: Rename %s -> %s" % (dir, ptarget)) - os.rename(origin, target) + bb.utils.rename(origin, target) #bb.note("Fixup Perms: Link %s -> %s" % (dir, link)) os.symlink(link, origin) @@ -1967,7 +1967,7 @@ python package_do_shlibs() { for (old, new) in renames: bb.note("Renaming %s to %s" % (old, new)) - os.rename(old, new) + bb.utils.rename(old, new) pkgfiles[pkg].remove(old) shlibs_file = os.path.join(shlibswork_dir, pkg + ".list") diff --git a/poky/meta/classes/package_rpm.bbclass b/poky/meta/classes/package_rpm.bbclass index 84a9a6dd1..86706da84 100644 --- a/poky/meta/classes/package_rpm.bbclass +++ b/poky/meta/classes/package_rpm.bbclass @@ -684,8 +684,8 @@ python do_package_rpm () { cmd = cmd + " --define '_use_internal_dependency_generator 0'" cmd = cmd + " --define '_binaries_in_noarch_packages_terminate_build 0'" cmd = cmd + " --define '_build_id_links none'" - cmd = cmd + " --define '_binary_payload w6T.xzdio'" - cmd = cmd + " --define '_source_payload w6T.xzdio'" + cmd = cmd + " --define '_binary_payload w6T%d.xzdio'" % int(d.getVar("XZ_THREADS")) + cmd = cmd + " --define '_source_payload w6T%d.xzdio'" % int(d.getVar("XZ_THREADS")) cmd = cmd + " --define 'clamp_mtime_to_source_date_epoch 1'" cmd = cmd + " --define 'use_source_date_epoch_as_buildtime 1'" cmd = cmd + " --define '_buildhost reproducible'" diff --git a/poky/meta/classes/populate_sdk_base.bbclass b/poky/meta/classes/populate_sdk_base.bbclass index 33ba3fc3c..f8072a9d3 100644 --- a/poky/meta/classes/populate_sdk_base.bbclass +++ b/poky/meta/classes/populate_sdk_base.bbclass @@ -66,7 +66,7 @@ python () { SDK_RDEPENDS = "${TOOLCHAIN_TARGET_TASK} ${TOOLCHAIN_HOST_TASK}" SDK_DEPENDS = "virtual/fakeroot-native ${SDK_ARCHIVE_DEPENDS} cross-localedef-native nativesdk-qemuwrapper-cross ${@' '.join(["%s-qemuwrapper-cross" % m for m in d.getVar("MULTILIB_VARIANTS").split()])} qemuwrapper-cross" -PATH_prepend = "${STAGING_DIR_HOST}${SDKPATHNATIVE}${bindir}/crossscripts:${@":".join(all_multilib_tune_values(d, 'STAGING_BINDIR_CROSS').split())}:" +PATH_prepend = "${WORKDIR}/recipe-sysroot/${SDKPATHNATIVE}${bindir}/crossscripts:${@":".join(all_multilib_tune_values(d, 'STAGING_BINDIR_CROSS').split())}:" SDK_DEPENDS += "nativesdk-glibc-locale" # We want the MULTIARCH_TARGET_SYS to point to the TUNE_PKGARCH, not PACKAGE_ARCH as it diff --git a/poky/meta/classes/populate_sdk_ext.bbclass b/poky/meta/classes/populate_sdk_ext.bbclass index 84232ed9f..517b4e45f 100644 --- a/poky/meta/classes/populate_sdk_ext.bbclass +++ b/poky/meta/classes/populate_sdk_ext.bbclass @@ -165,7 +165,7 @@ def create_filtered_tasklist(d, sdkbasepath, tasklistfile, conf_initpath): shutil.rmtree(temp_sdkbasepath) except FileNotFoundError: pass - os.rename(sdkbasepath, temp_sdkbasepath) + bb.utils.rename(sdkbasepath, temp_sdkbasepath) cmdprefix = '. %s .; ' % conf_initpath logfile = d.getVar('WORKDIR') + '/tasklist_bb_log.txt' try: @@ -175,7 +175,7 @@ def create_filtered_tasklist(d, sdkbasepath, tasklistfile, conf_initpath): if 'attempted to execute unexpectedly and should have been setscened' in e.stdout: msg += '\n----------\n\nNOTE: "attempted to execute unexpectedly and should have been setscened" errors indicate this may be caused by missing sstate artifacts that were likely produced in earlier builds, but have been subsequently deleted for some reason.\n' bb.fatal(msg) - os.rename(temp_sdkbasepath, sdkbasepath) + bb.utils.rename(temp_sdkbasepath, sdkbasepath) # Clean out residue of running bitbake, which check_sstate_task_list() # will effectively do clean_esdk_builddir(d, sdkbasepath) @@ -397,6 +397,14 @@ python copy_buildsystem () { f.write('require conf/locked-sigs.inc\n') f.write('require conf/unlocked-sigs.inc\n') + # Copy multiple configurations if they exist in the users config directory + if d.getVar('BBMULTICONFIG') is not None: + bb.utils.mkdirhier(os.path.join(baseoutpath, 'conf', 'multiconfig')) + for mc in d.getVar('BBMULTICONFIG').split(): + dest_stub = "/conf/multiconfig/%s.conf" % (mc,) + if os.path.exists(builddir + dest_stub): + shutil.copyfile(builddir + dest_stub, baseoutpath + dest_stub) + if os.path.exists(builddir + '/cache/bb_unihashes.dat'): bb.parse.siggen.save_unitaskhashes() bb.utils.mkdirhier(os.path.join(baseoutpath, 'cache')) @@ -556,6 +564,9 @@ python copy_buildsystem () { # sdk_ext_postinst() below) thus the checksum we take here would always # be different. manifest_file_list = ['conf/*'] + if d.getVar('BBMULTICONFIG') is not None: + manifest_file_list.append('conf/multiconfig/*') + esdk_manifest_excludes = (d.getVar('ESDK_MANIFEST_EXCLUDES') or '').split() esdk_manifest_excludes_list = [] for exclude_item in esdk_manifest_excludes: @@ -564,7 +575,7 @@ python copy_buildsystem () { with open(manifest_file, 'w') as f: for item in manifest_file_list: for fn in glob.glob(os.path.join(baseoutpath, item)): - if fn == manifest_file: + if fn == manifest_file or os.path.isdir(fn): continue if fn in esdk_manifest_excludes_list: continue diff --git a/poky/meta/classes/ptest.bbclass b/poky/meta/classes/ptest.bbclass index 47611edea..466916299 100644 --- a/poky/meta/classes/ptest.bbclass +++ b/poky/meta/classes/ptest.bbclass @@ -20,6 +20,8 @@ RRECOMMENDS_${PN}-ptest += "ptest-runner" PACKAGES =+ "${@bb.utils.contains('PTEST_ENABLED', '1', '${PN}-ptest', '', d)}" +require conf/distro/include/ptest-packagelists.inc + do_configure_ptest() { : } @@ -116,4 +118,13 @@ python () { if not(d.getVar('PTEST_ENABLED') == "1"): for i in ['do_configure_ptest_base', 'do_compile_ptest_base', 'do_install_ptest_base']: bb.build.deltask(i, d) + + # This checks that ptest package is actually included + # in standard oe-core ptest images - only for oe-core recipes + if not 'meta/recipes' in d.getVar('FILE') or not(d.getVar('PTEST_ENABLED') == "1"): + return + + enabled_ptests = " ".join([d.getVar('PTESTS_FAST'),d.getVar('PTESTS_SLOW'), d.getVar('PTESTS_PROBLEMS')]).split() + if (d.getVar('PN') + "-ptest").replace(d.getVar('MLPREFIX'), '') not in enabled_ptests: + bb.error("Recipe %s supports ptests but is not included in oe-core's conf/distro/include/ptest-packagelists.inc" % d.getVar("PN")) } diff --git a/poky/meta/classes/qemuboot.bbclass b/poky/meta/classes/qemuboot.bbclass index 1f8012edc..2b50ddaa2 100644 --- a/poky/meta/classes/qemuboot.bbclass +++ b/poky/meta/classes/qemuboot.bbclass @@ -19,6 +19,9 @@ # QB_CPU_KVM: the similar to QB_CPU, but used when kvm, e.g., '-cpu kvm64', # set it when support kvm. # +# QB_SMP: amount of CPU cores inside qemu guest, each mapped to a thread on the host, +# e.g. "-smp 8". +# # QB_KERNEL_CMDLINE_APPEND: options to append to kernel's -append # option, e.g., "console=ttyS0 console=tty" # @@ -80,6 +83,7 @@ # See "runqemu help" for more info QB_MEM ?= "-m 256" +QB_SMP ?= "" QB_SERIAL_OPT ?= "-serial mon:stdio -serial null" QB_DEFAULT_KERNEL ?= "${KERNEL_IMAGETYPE}" QB_DEFAULT_FSTYPE ?= "ext4" diff --git a/poky/meta/classes/reproducible_build.bbclass b/poky/meta/classes/reproducible_build.bbclass index f06e00d70..278eeedc7 100644 --- a/poky/meta/classes/reproducible_build.bbclass +++ b/poky/meta/classes/reproducible_build.bbclass @@ -41,6 +41,9 @@ SDE_DIR = "${WORKDIR}/source-date-epoch" SDE_FILE = "${SDE_DIR}/__source_date_epoch.txt" SDE_DEPLOYDIR = "${WORKDIR}/deploy-source-date-epoch" +# Enable compiler warning when the __TIME__, __DATE__ and __TIMESTAMP__ macros are used. +TARGET_CC_ARCH_append_class-target = " -Wdate-time" + # A SOURCE_DATE_EPOCH of '0' might be misinterpreted as no SDE export SOURCE_DATE_EPOCH_FALLBACK ??= "1302044400" @@ -63,7 +66,7 @@ python do_deploy_source_date_epoch_setscene () { if os.path.exists(sde_file): target = d.getVar('SDE_FILE') bb.debug(1, "Moving setscene SDE file %s -> %s" % (sde_file, target)) - os.rename(sde_file, target) + bb.utils.rename(sde_file, target) else: bb.debug(1, "%s not found!" % sde_file) } @@ -77,17 +80,16 @@ python create_source_date_epoch_stamp() { import oe.reproducible epochfile = d.getVar('SDE_FILE') - # If it exists we need to regenerate as the sources may have changed - if os.path.isfile(epochfile): - bb.debug(1, "Deleting existing SOURCE_DATE_EPOCH from: %s" % epochfile) - os.remove(epochfile) + tmp_file = "%s.new" % epochfile source_date_epoch = oe.reproducible.get_source_date_epoch(d, d.getVar('S')) bb.debug(1, "SOURCE_DATE_EPOCH: %d" % source_date_epoch) bb.utils.mkdirhier(d.getVar('SDE_DIR')) - with open(epochfile, 'w') as f: + with open(tmp_file, 'w') as f: f.write(str(source_date_epoch)) + + os.rename(tmp_file, epochfile) } def get_source_date_epoch_value(d): @@ -97,7 +99,7 @@ def get_source_date_epoch_value(d): epochfile = d.getVar('SDE_FILE') source_date_epoch = int(d.getVar('SOURCE_DATE_EPOCH_FALLBACK')) - if os.path.isfile(epochfile): + try: with open(epochfile, 'r') as f: s = f.read() try: @@ -110,7 +112,7 @@ def get_source_date_epoch_value(d): bb.warn("SOURCE_DATE_EPOCH value '%s' is invalid. Reverting to SOURCE_DATE_EPOCH_FALLBACK" % s) source_date_epoch = int(d.getVar('SOURCE_DATE_EPOCH_FALLBACK')) bb.debug(1, "SOURCE_DATE_EPOCH: %d" % source_date_epoch) - else: + except FileNotFoundError: bb.debug(1, "Cannot find %s. SOURCE_DATE_EPOCH will default to %d" % (epochfile, source_date_epoch)) d.setVar('__CACHED_SOURCE_DATE_EPOCH', str(source_date_epoch)) diff --git a/poky/meta/classes/sanity.bbclass b/poky/meta/classes/sanity.bbclass index 894f0e310..e907a3566 100644 --- a/poky/meta/classes/sanity.bbclass +++ b/poky/meta/classes/sanity.bbclass @@ -392,9 +392,12 @@ def check_connectivity(d): msg = data.getVar('CONNECTIVITY_CHECK_MSG') or "" if len(msg) == 0: msg = "%s.\n" % err - msg += " Please ensure your host's network is configured correctly,\n" - msg += " or set BB_NO_NETWORK = \"1\" to disable network access if\n" - msg += " all required sources are on local disk.\n" + msg += " Please ensure your host's network is configured correctly.\n" + msg += " If your ISP or network is blocking the above URL,\n" + msg += " try with another domain name, for example by setting:\n" + msg += " CONNECTIVITY_CHECK_URIS = \"https://www.yoctoproject.org/\"" + msg += " You could also set BB_NO_NETWORK = \"1\" to disable network\n" + msg += " access if all required sources are on local disk.\n" retval = msg return retval @@ -882,13 +885,18 @@ def check_sanity_everybuild(status, d): except: pass - oeroot = d.getVar('COREBASE') - if oeroot.find('+') != -1: - status.addresult("Error, you have an invalid character (+) in your COREBASE directory path. Please move the installation to a directory which doesn't include any + characters.") - if oeroot.find('@') != -1: - status.addresult("Error, you have an invalid character (@) in your COREBASE directory path. Please move the installation to a directory which doesn't include any @ characters.") - if oeroot.find(' ') != -1: - status.addresult("Error, you have a space in your COREBASE directory path. Please move the installation to a directory which doesn't include a space since autotools doesn't support this.") + for checkdir in ['COREBASE', 'TMPDIR']: + val = d.getVar(checkdir) + if val.find('..') != -1: + status.addresult("Error, you have '..' in your %s directory path. Please ensure the variable contains an absolute path as this can break some recipe builds in obtuse ways." % checkdir) + if val.find('+') != -1: + status.addresult("Error, you have an invalid character (+) in your %s directory path. Please move the installation to a directory which doesn't include any + characters." % checkdir) + if val.find('@') != -1: + status.addresult("Error, you have an invalid character (@) in your %s directory path. Please move the installation to a directory which doesn't include any @ characters." % checkdir) + if val.find(' ') != -1: + status.addresult("Error, you have a space in your %s directory path. Please move the installation to a directory which doesn't include a space since autotools doesn't support this." % checkdir) + if val.find('%') != -1: + status.addresult("Error, you have an invalid character (%) in your %s directory path which causes problems with python string formatting. Please move the installation to a directory which doesn't include any % characters." % checkdir) # Check the format of MIRRORS, PREMIRRORS and SSTATE_MIRRORS import re diff --git a/poky/meta/classes/sstate.bbclass b/poky/meta/classes/sstate.bbclass index 8e8efd18d..3a3f7cc24 100644 --- a/poky/meta/classes/sstate.bbclass +++ b/poky/meta/classes/sstate.bbclass @@ -319,6 +319,8 @@ def sstate_install(ss, d): if os.path.exists(i): with open(i, "r") as f: manifests = f.readlines() + # We append new entries, we don't remove older entries which may have the same + # manifest name but different versions from stamp/workdir. See below. if filedata not in manifests: with open(i, "a+") as f: f.write(filedata) @@ -401,7 +403,7 @@ def sstate_installpkgdir(ss, d): for state in ss['dirs']: prepdir(state[1]) - os.rename(sstateinst + state[0], state[1]) + bb.utils.rename(sstateinst + state[0], state[1]) sstate_install(ss, d) for plain in ss['plaindirs']: @@ -413,7 +415,7 @@ def sstate_installpkgdir(ss, d): dest = plain bb.utils.mkdirhier(src) prepdir(dest) - os.rename(src, dest) + bb.utils.rename(src, dest) return True @@ -664,7 +666,7 @@ def sstate_package(ss, d): continue bb.error("sstate found an absolute path symlink %s pointing at %s. Please replace this with a relative link." % (srcpath, link)) bb.debug(2, "Preparing tree %s for packaging at %s" % (state[1], sstatebuild + state[0])) - os.rename(state[1], sstatebuild + state[0]) + bb.utils.rename(state[1], sstatebuild + state[0]) workdir = d.getVar('WORKDIR') sharedworkdir = os.path.join(d.getVar('TMPDIR'), "work-shared") @@ -674,7 +676,7 @@ def sstate_package(ss, d): pdir = plain.replace(sharedworkdir, sstatebuild) bb.utils.mkdirhier(plain) bb.utils.mkdirhier(pdir) - os.rename(plain, pdir) + bb.utils.rename(plain, pdir) d.setVar('SSTATE_BUILDDIR', sstatebuild) d.setVar('SSTATE_INSTDIR', sstatebuild) @@ -704,6 +706,8 @@ def sstate_package(ss, d): return +sstate_package[vardepsexclude] += "SSTATE_SIG_KEY" + def pstaging_fetch(sstatefetch, d): import bb.fetch2 @@ -1183,11 +1187,21 @@ python sstate_eventhandler_reachablestamps() { i = d.expand("${SSTATE_MANIFESTS}/index-" + a) if not os.path.exists(i): continue + manseen = set() + ignore = [] with open(i, "r") as f: lines = f.readlines() - for l in lines: + for l in reversed(lines): try: (stamp, manifest, workdir) = l.split() + # The index may have multiple entries for the same manifest as the code above only appends + # new entries and there may be an entry with matching manifest but differing version in stamp/workdir. + # The last entry in the list is the valid one, any earlier entries with matching manifests + # should be ignored. + if manifest in manseen: + ignore.append(l) + continue + manseen.add(manifest) if stamp not in stamps and stamp not in preservestamps and stamp in machineindex: toremove.append(l) if stamp not in seen: @@ -1218,6 +1232,8 @@ python sstate_eventhandler_reachablestamps() { with open(i, "w") as f: for l in lines: + if l in ignore: + continue f.write(l) machineindex |= set(stamps) with open(mi, "w") as f: diff --git a/poky/meta/classes/testimage.bbclass b/poky/meta/classes/testimage.bbclass index e61375950..43de9d4d7 100644 --- a/poky/meta/classes/testimage.bbclass +++ b/poky/meta/classes/testimage.bbclass @@ -127,6 +127,11 @@ testimage_dump_host () { netstat -an } +testimage_dump_monitor () { + query-status + query-block +} + python do_testimage() { testimage_main(d) } @@ -320,6 +325,7 @@ def testimage_main(d): target_kwargs['powercontrol_extra_args'] = d.getVar("TEST_POWERCONTROL_EXTRA_ARGS") or "" target_kwargs['serialcontrol_cmd'] = d.getVar("TEST_SERIALCONTROL_CMD") or None target_kwargs['serialcontrol_extra_args'] = d.getVar("TEST_SERIALCONTROL_EXTRA_ARGS") or "" + target_kwargs['testimage_dump_monitor'] = d.getVar("testimage_dump_monitor") or "" target_kwargs['testimage_dump_target'] = d.getVar("testimage_dump_target") or "" def export_ssh_agent(d): diff --git a/poky/meta/classes/uboot-config.bbclass b/poky/meta/classes/uboot-config.bbclass index 3bba02828..451db0c65 100644 --- a/poky/meta/classes/uboot-config.bbclass +++ b/poky/meta/classes/uboot-config.bbclass @@ -71,6 +71,10 @@ UBOOT_MKIMAGE_SIGN ?= "${UBOOT_MKIMAGE}" UBOOT_MKIMAGE_SIGN_ARGS ?= "" SPL_MKIMAGE_SIGN_ARGS ?= "" +# Options to deploy the u-boot device tree +UBOOT_DTB ?= "" +UBOOT_DTB_BINARY ??= "" + python () { ubootmachine = d.getVar("UBOOT_MACHINE") ubootconfigflags = d.getVarFlags('UBOOT_CONFIG') diff --git a/poky/meta/classes/uboot-sign.bbclass b/poky/meta/classes/uboot-sign.bbclass index d11882f90..9671cf76a 100644 --- a/poky/meta/classes/uboot-sign.bbclass +++ b/poky/meta/classes/uboot-sign.bbclass @@ -196,10 +196,9 @@ concat_spl_dtb() { # signing, and kernel will deploy UBOOT_DTB_BINARY after signs it. install_helper() { if [ -f "${UBOOT_DTB_BINARY}" ]; then - install -d ${D}${datadir} # UBOOT_DTB_BINARY is a symlink to UBOOT_DTB_IMAGE, so we # need both of them. - install ${UBOOT_DTB_BINARY} ${D}${datadir}/${UBOOT_DTB_IMAGE} + install -Dm 0644 ${UBOOT_DTB_BINARY} ${D}${datadir}/${UBOOT_DTB_IMAGE} ln -sf ${UBOOT_DTB_IMAGE} ${D}${datadir}/${UBOOT_DTB_BINARY} else bbwarn "${UBOOT_DTB_BINARY} not found" @@ -209,14 +208,13 @@ install_helper() { # Install SPL dtb and u-boot nodtb to datadir, install_spl_helper() { if [ -f "${SPL_DIR}/${SPL_DTB_BINARY}" ]; then - install -d ${D}${datadir} - install ${SPL_DIR}/${SPL_DTB_BINARY} ${D}${datadir}/${SPL_DTB_IMAGE} + install -Dm 0644 ${SPL_DIR}/${SPL_DTB_BINARY} ${D}${datadir}/${SPL_DTB_IMAGE} ln -sf ${SPL_DTB_IMAGE} ${D}${datadir}/${SPL_DTB_BINARY} else bbwarn "${SPL_DTB_BINARY} not found" fi if [ -f "${UBOOT_NODTB_BINARY}" ] ; then - install ${UBOOT_NODTB_BINARY} ${D}${datadir}/${UBOOT_NODTB_IMAGE} + install -Dm 0644 ${UBOOT_NODTB_BINARY} ${D}${datadir}/${UBOOT_NODTB_IMAGE} ln -sf ${UBOOT_NODTB_IMAGE} ${D}${datadir}/${UBOOT_NODTB_BINARY} else bbwarn "${UBOOT_NODTB_BINARY} not found" @@ -255,32 +253,7 @@ do_install_append() { fi } -do_generate_rsa_keys() { - if [ "${UBOOT_SIGN_ENABLE}" = "0" ] && [ "${FIT_GENERATE_KEYS}" = "1" ]; then - bbwarn "FIT_GENERATE_KEYS is set to 1 even though UBOOT_SIGN_ENABLE is set to 0. The keys will not be generated as they won't be used." - fi - - if [ "${UBOOT_SIGN_ENABLE}" = "1" ] && [ "${FIT_GENERATE_KEYS}" = "1" ]; then - - # Generate keys only if they don't already exist - if [ ! -f "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".key ] || \ - [ ! -f "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".crt ]; then - - # make directory if it does not already exist - mkdir -p "${UBOOT_SIGN_KEYDIR}" - - echo "Generating RSA private key for signing fitImage" - openssl genrsa ${FIT_KEY_GENRSA_ARGS} -out \ - "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".key \ - "${FIT_SIGN_NUMBITS}" - - echo "Generating certificate for signing fitImage" - openssl req ${FIT_KEY_REQ_ARGS} "${FIT_KEY_SIGN_PKCS}" \ - -key "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".key \ - -out "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".crt - fi - fi - +do_uboot_generate_rsa_keys() { if [ "${SPL_SIGN_ENABLE}" = "0" ] && [ "${UBOOT_FIT_GENERATE_KEYS}" = "1" ]; then bbwarn "UBOOT_FIT_GENERATE_KEYS is set to 1 eventhough SPL_SIGN_ENABLE is set to 0. The keys will not be generated as they won't be used." fi @@ -308,7 +281,7 @@ do_generate_rsa_keys() { } -addtask generate_rsa_keys before do_uboot_assemble_fitimage after do_compile +addtask uboot_generate_rsa_keys before do_uboot_assemble_fitimage after do_compile # Create a ITS file for the U-boot FIT, for use when # we want to sign it so that the SPL can verify it diff --git a/poky/meta/classes/update-alternatives.bbclass b/poky/meta/classes/update-alternatives.bbclass index 8c2b66e7f..000e4d566 100644 --- a/poky/meta/classes/update-alternatives.bbclass +++ b/poky/meta/classes/update-alternatives.bbclass @@ -184,7 +184,7 @@ python apply_update_alternative_renames () { link_rename.append((alt_target, alt_target_rename)) else: bb.note('%s: Rename %s -> %s' % (pn, alt_target, alt_target_rename)) - os.rename(src, dest) + bb.utils.rename(src, dest) update_files(alt_target, alt_target_rename, pkg, d) else: bb.warn("%s: alternative target (%s or %s) does not exist, skipping..." % (pn, alt_target, alt_target_rename)) @@ -201,7 +201,7 @@ python apply_update_alternative_renames () { if os.path.lexists(link_target): # Ok, the link_target exists, we can rename bb.note('%s: Rename (link) %s -> %s' % (pn, alt_target, alt_target_rename)) - os.rename(src, dest) + bb.utils.rename(src, dest) else: # Try to resolve the broken link to link.${BPN} link_maybe = '%s.%s' % (os.readlink(src), pn) |