diff options
| -rw-r--r-- | meta/classes-recipe/barebox.bbclass | 155 | ||||
| -rw-r--r-- | meta/conf/distro/include/maintainers.inc | 1 | ||||
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/distrodata.py | 2 | ||||
| -rw-r--r-- | meta/recipes-bsp/barebox/barebox_2024.08.0.bb | 15 |
4 files changed, 172 insertions, 1 deletions
diff --git a/meta/classes-recipe/barebox.bbclass b/meta/classes-recipe/barebox.bbclass new file mode 100644 index 0000000000..413a78f18c --- /dev/null +++ b/meta/classes-recipe/barebox.bbclass | |||
| @@ -0,0 +1,155 @@ | |||
| 1 | # | ||
| 2 | # Copyright OpenEmbedded Contributors | ||
| 3 | # | ||
| 4 | # SPDX-License-Identifier: MIT | ||
| 5 | # | ||
| 6 | |||
| 7 | inherit kernel-arch deploy cml1 pkgconfig | ||
| 8 | |||
| 9 | LICENSE ?= "GPL-2.0-only" | ||
| 10 | |||
| 11 | PROVIDES += "virtual/bootloader" | ||
| 12 | |||
| 13 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
| 14 | |||
| 15 | DEPENDS += "bison-native flex-native" | ||
| 16 | |||
| 17 | S = "${WORKDIR}/barebox-${PV}" | ||
| 18 | B = "${WORKDIR}/build" | ||
| 19 | |||
| 20 | require conf/image-uefi.conf | ||
| 21 | |||
| 22 | # For some platforms and configuration, the barebox build process will require | ||
| 23 | # additional host tools that can be activated/deactivated here. | ||
| 24 | PACKAGECONFIG ??= "openssl libusb fit" | ||
| 25 | |||
| 26 | PACKAGECONFIG[openssl] = ",,openssl-native" | ||
| 27 | PACKAGECONFIG[libusb] = ",,libusb1-native" | ||
| 28 | PACKAGECONFIG[fit] = ",,u-boot-tools-native dtc-native" | ||
| 29 | |||
| 30 | export KBUILD_BUILD_USER ?= "oe-user" | ||
| 31 | export KBUILD_BUILD_HOST ?= "oe-host" | ||
| 32 | |||
| 33 | # unlike the kernel, barebox may build against host tools like openssl | ||
| 34 | export HOST_EXTRACFLAGS | ||
| 35 | |||
| 36 | def get_layer_rev(path): | ||
| 37 | try: | ||
| 38 | rev, _ = bb.process.run("git describe --match='' --always --dirty --broken", cwd=path) | ||
| 39 | except bb.process.ExecutionError: | ||
| 40 | rev = "" | ||
| 41 | return rev.strip() | ||
| 42 | |||
| 43 | BAREBOX_BUILDSYSTEM_VERSION[doc] = "Build system version to add to the barebox image. By default this is the git description of the containing layer." | ||
| 44 | BAREBOX_BUILDSYSTEM_VERSION ??= "${@get_layer_rev(os.path.dirname(d.getVar('FILE')))}" | ||
| 45 | |||
| 46 | BAREBOX_FIRMWARE_DIR[doc] = "Overwrite barebox' firmware blobs search directory (CONFIG_EXTRA_FIRMWARE_DIR) with this path, default ${B}/firmware" | ||
| 47 | BAREBOX_FIRMWARE_DIR ??= "${B}/firmware" | ||
| 48 | |||
| 49 | EXTRA_OEMAKE = " \ | ||
| 50 | CROSS_COMPILE=${TARGET_PREFIX} -C ${S} O=${B} \ | ||
| 51 | BUILDSYSTEM_VERSION=${BAREBOX_BUILDSYSTEM_VERSION} \ | ||
| 52 | CONFIG_EXTRA_FIRMWARE_DIR=${BAREBOX_FIRMWARE_DIR} \ | ||
| 53 | PKG_CONFIG=pkg-config-native \ | ||
| 54 | CROSS_PKG_CONFIG=pkg-config \ | ||
| 55 | " | ||
| 56 | |||
| 57 | BAREBOX_CONFIG[doc] = "The barebox kconfig defconfig file. Not used if a file called defconfig is added to the SRC_URI." | ||
| 58 | BAREBOX_CONFIG ?= "" | ||
| 59 | |||
| 60 | # prevent from acting as non-buildable provider | ||
| 61 | python () { | ||
| 62 | bareboxconfig = d.getVar('BAREBOX_CONFIG') | ||
| 63 | bareboxdefconfig = 'file://defconfig' in d.getVar('SRC_URI') | ||
| 64 | |||
| 65 | if not bareboxconfig and not bareboxdefconfig: | ||
| 66 | raise bb.parse.SkipRecipe("BAREBOX_CONFIG must be set in the %s machine configuration or file://defconfig must be given in SRC_URI." % d.getVar("MACHINE")) | ||
| 67 | } | ||
| 68 | |||
| 69 | barebox_do_configure() { | ||
| 70 | if [ -e ${UNPACKDIR}/defconfig ]; then | ||
| 71 | cp ${UNPACKDIR}/defconfig ${B}/.config | ||
| 72 | else | ||
| 73 | if [ -n "${BAREBOX_CONFIG}" ]; then | ||
| 74 | oe_runmake ${BAREBOX_CONFIG} | ||
| 75 | else | ||
| 76 | bbfatal "No defconfig given. Either add file 'file://defconfig' to SRC_URI or set BAREBOX_CONFIG" | ||
| 77 | fi | ||
| 78 | fi | ||
| 79 | |||
| 80 | ${S}/scripts/kconfig/merge_config.sh -m .config ${@" ".join(find_cfgs(d))} | ||
| 81 | cml1_do_configure | ||
| 82 | } | ||
| 83 | |||
| 84 | BAREBOX_ENV_DIR[doc] = "Overlay the barebox built-in environment with the environment provided by the BSP if specified." | ||
| 85 | BAREBOX_ENV_DIR ??= "${UNPACKDIR}/env/" | ||
| 86 | |||
| 87 | barebox_do_compile () { | ||
| 88 | export userccflags="${TARGET_LDFLAGS}${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" | ||
| 89 | unset LDFLAGS | ||
| 90 | unset CFLAGS | ||
| 91 | unset CPPFLAGS | ||
| 92 | unset CXXFLAGS | ||
| 93 | unset MACHINE | ||
| 94 | # Allow to use ${UNPACKDIR} in kconfig options to include additionally fetched files | ||
| 95 | export UNPACKDIR=${UNPACKDIR} | ||
| 96 | |||
| 97 | if [ -d ${BAREBOX_ENV_DIR} ]; then | ||
| 98 | BAREBOX_DEFAULT_ENV="$(grep ^CONFIG_DEFAULT_ENVIRONMENT_PATH .config | cut -d '=' -f 2 | tr -d '"')" | ||
| 99 | oe_runmake CONFIG_DEFAULT_ENVIRONMENT_PATH="\"${BAREBOX_DEFAULT_ENV} ${BAREBOX_ENV_DIR}\"" | ||
| 100 | else | ||
| 101 | oe_runmake | ||
| 102 | fi | ||
| 103 | } | ||
| 104 | |||
| 105 | BAREBOX_BINARY[doc] = "Specify the barebox binary to install. If not specified all barebox artifacts are installed." | ||
| 106 | BAREBOX_BINARY ??= "${@'barebox.efi' if d.getVar('EFI_PROVIDER') == 'barebox' else ''}" | ||
| 107 | BAREBOX_SUFFIX[doc] = "Specify the suffix for ${BAREBOX_IMAGE}." | ||
| 108 | BAREBOX_SUFFIX ??= "img" | ||
| 109 | BAREBOX_IMAGE[doc] = "A unique barebox image name. Unused if ${BAREBOX_BINARY} is not set." | ||
| 110 | BAREBOX_IMAGE_DEFAULT ?= "${PN}-${MACHINE}-${PV}-${PR}.${BAREBOX_SUFFIX}" | ||
| 111 | BAREBOX_IMAGE ?= "${@'${EFI_BOOT_IMAGE}' if d.getVar('EFI_PROVIDER') == 'barebox' else '${BAREBOX_IMAGE_DEFAULT}'}" | ||
| 112 | |||
| 113 | BAREBOX_INSTALL_PATH ?= "${@'${EFI_FILES_PATH}' if d.getVar('EFI_PROVIDER') == 'barebox' else '/boot'}" | ||
| 114 | |||
| 115 | barebox_do_install () { | ||
| 116 | if [ -n "${BAREBOX_BINARY}" ]; then | ||
| 117 | |||
| 118 | BAREBOX_BIN=${B}/${BAREBOX_BINARY} | ||
| 119 | if [ ! -f "${BAREBOX_BIN}" ]; then | ||
| 120 | BAREBOX_BIN=${B}/images/${BAREBOX_BINARY} | ||
| 121 | fi | ||
| 122 | if [ ! -f "${BAREBOX_BIN}" ]; then | ||
| 123 | bbfatal "Failed to locate ${BAREBOX_BINARY}" | ||
| 124 | fi | ||
| 125 | |||
| 126 | install -D -m 644 ${BAREBOX_BIN} ${D}${BAREBOX_INSTALL_PATH}/${BAREBOX_IMAGE} | ||
| 127 | ln -sf ${BAREBOX_IMAGE} ${D}${BAREBOX_INSTALL_PATH}/${BAREBOX_BINARY} | ||
| 128 | else | ||
| 129 | install -d ${D}${BAREBOX_INSTALL_PATH}/ | ||
| 130 | for image in $(cat ${B}/barebox-flash-images); do | ||
| 131 | install -m 644 ${B}/${image} ${D}${BAREBOX_INSTALL_PATH}/ | ||
| 132 | done | ||
| 133 | fi | ||
| 134 | } | ||
| 135 | FILES:${PN} = "${BAREBOX_INSTALL_PATH}" | ||
| 136 | |||
| 137 | barebox_do_deploy () { | ||
| 138 | if [ -n "${BAREBOX_BINARY}" ]; then | ||
| 139 | |||
| 140 | BAREBOX_BIN=${B}/${BAREBOX_BINARY} | ||
| 141 | if [ ! -f "${BAREBOX_BIN}" ]; then | ||
| 142 | BAREBOX_BIN=${B}/images/${BAREBOX_BINARY} | ||
| 143 | fi | ||
| 144 | |||
| 145 | install -D -m 644 ${BAREBOX_BIN} ${DEPLOYDIR}/${BAREBOX_IMAGE} | ||
| 146 | ln -sf ${BAREBOX_IMAGE} ${DEPLOYDIR}/${BAREBOX_BINARY} | ||
| 147 | else | ||
| 148 | for image in $(cat ${B}/barebox-flash-images); do | ||
| 149 | cp ${B}/${image} ${DEPLOYDIR} | ||
| 150 | done | ||
| 151 | fi | ||
| 152 | } | ||
| 153 | addtask deploy after do_compile | ||
| 154 | |||
| 155 | EXPORT_FUNCTIONS do_configure do_compile do_install do_deploy | ||
diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc index b86c91c5d6..0fd6c14658 100644 --- a/meta/conf/distro/include/maintainers.inc +++ b/meta/conf/distro/include/maintainers.inc | |||
| @@ -54,6 +54,7 @@ RECIPE_MAINTAINER:pn-automake = "Robert Yang <liezhi.yang@windriver.com>" | |||
| 54 | RECIPE_MAINTAINER:pn-avahi = "Yi Zhao <yi.zhao@windriver.com>" | 54 | RECIPE_MAINTAINER:pn-avahi = "Yi Zhao <yi.zhao@windriver.com>" |
| 55 | RECIPE_MAINTAINER:pn-babeltrace = "Alexander Kanavin <alex.kanavin@gmail.com>" | 55 | RECIPE_MAINTAINER:pn-babeltrace = "Alexander Kanavin <alex.kanavin@gmail.com>" |
| 56 | RECIPE_MAINTAINER:pn-babeltrace2 = "Alexander Kanavin <alex.kanavin@gmail.com>" | 56 | RECIPE_MAINTAINER:pn-babeltrace2 = "Alexander Kanavin <alex.kanavin@gmail.com>" |
| 57 | RECIPE_MAINTAINER:pn-barebox = "Enrico Jörns <yocto@pengutronix.de>" | ||
| 57 | RECIPE_MAINTAINER:pn-baremetal-helloworld = "Alejandro Hernandez <alejandro@enedino.org>" | 58 | RECIPE_MAINTAINER:pn-baremetal-helloworld = "Alejandro Hernandez <alejandro@enedino.org>" |
| 58 | RECIPE_MAINTAINER:pn-base-files = "Anuj Mittal <anuj.mittal@intel.com>" | 59 | RECIPE_MAINTAINER:pn-base-files = "Anuj Mittal <anuj.mittal@intel.com>" |
| 59 | RECIPE_MAINTAINER:pn-base-passwd = "Anuj Mittal <anuj.mittal@intel.com>" | 60 | RECIPE_MAINTAINER:pn-base-passwd = "Anuj Mittal <anuj.mittal@intel.com>" |
diff --git a/meta/lib/oeqa/selftest/cases/distrodata.py b/meta/lib/oeqa/selftest/cases/distrodata.py index 7771a42e2b..1e88ea82e6 100644 --- a/meta/lib/oeqa/selftest/cases/distrodata.py +++ b/meta/lib/oeqa/selftest/cases/distrodata.py | |||
| @@ -56,7 +56,7 @@ but their recipes claim otherwise by setting UPSTREAM_VERSION_UNKNOWN. Please re | |||
| 56 | 56 | ||
| 57 | def is_maintainer_exception(entry): | 57 | def is_maintainer_exception(entry): |
| 58 | exceptions = ["musl", "newlib", "picolibc", "linux-yocto", "linux-dummy", "mesa-gl", "libgfortran", "libx11-compose-data", | 58 | exceptions = ["musl", "newlib", "picolibc", "linux-yocto", "linux-dummy", "mesa-gl", "libgfortran", "libx11-compose-data", |
| 59 | "cve-update-nvd2-native",] | 59 | "cve-update-nvd2-native", "barebox"] |
| 60 | for i in exceptions: | 60 | for i in exceptions: |
| 61 | if i in entry: | 61 | if i in entry: |
| 62 | return True | 62 | return True |
diff --git a/meta/recipes-bsp/barebox/barebox_2024.08.0.bb b/meta/recipes-bsp/barebox/barebox_2024.08.0.bb new file mode 100644 index 0000000000..98e8aa053b --- /dev/null +++ b/meta/recipes-bsp/barebox/barebox_2024.08.0.bb | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | SUMMARY = "barebox is a bootloader designed for embedded systems. It runs on a variety of architectures including x86, ARM, MIPS, PowerPC and others." | ||
| 2 | DESCRIPTION = "barebox aims to be a versatile and flexible bootloader not only for booting embedded Linux systems, \ | ||
| 3 | but also for initial hardware bringup and development. \ | ||
| 4 | Users should feel right at home with a shell with UNIX-like virtual file system access to hardware, \ | ||
| 5 | Linux kernel driver API for making driver porting easier, \ | ||
| 6 | and a subset of the POSIX C library for writing more command-line utilities." | ||
| 7 | HOMEPAGE = "https://barebox.org/" | ||
| 8 | SECTION = "bootloaders" | ||
| 9 | |||
| 10 | LIC_FILES_CHKSUM = "file://COPYING;md5=f5125d13e000b9ca1f0d3364286c4192" | ||
| 11 | |||
| 12 | inherit barebox | ||
| 13 | |||
| 14 | SRC_URI = "https://barebox.org/download/barebox-${PV}.tar.bz2" | ||
| 15 | SRC_URI[sha256sum] = "b08a762da8d63dd18b4f2d9f5d0a8da001b6e608d1b3eff6dcebc6a2e575d535" | ||
