summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/barebox.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2025-11-07 13:31:53 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-11-07 13:31:53 +0000
commit8c22ff0d8b70d9b12f0487ef696a7e915b9e3173 (patch)
treeefdc32587159d0050a69009bdf2330a531727d95 /meta/classes-recipe/barebox.bbclass
parentd412d2747595c1cc4a5e3ca975e3adc31b2f7891 (diff)
downloadpoky-8c22ff0d8b70d9b12f0487ef696a7e915b9e3173.tar.gz
The poky repository master branch is no longer being updated.
You can either: a) switch to individual clones of bitbake, openembedded-core, meta-yocto and yocto-docs b) use the new bitbake-setup You can find information about either approach in our documentation: https://docs.yoctoproject.org/ Note that "poky" the distro setting is still available in meta-yocto as before and we continue to use and maintain that. Long live Poky! Some further information on the background of this change can be found in: https://lists.openembedded.org/g/openembedded-architecture/message/2179 Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe/barebox.bbclass')
-rw-r--r--meta/classes-recipe/barebox.bbclass162
1 files changed, 0 insertions, 162 deletions
diff --git a/meta/classes-recipe/barebox.bbclass b/meta/classes-recipe/barebox.bbclass
deleted file mode 100644
index 73615999aa..0000000000
--- a/meta/classes-recipe/barebox.bbclass
+++ /dev/null
@@ -1,162 +0,0 @@
1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7inherit kernel-arch deploy cml1 pkgconfig
8
9LICENSE ?= "GPL-2.0-only"
10
11PROVIDES += "virtual/bootloader"
12
13PACKAGE_ARCH = "${MACHINE_ARCH}"
14
15DEPENDS += "bison-native flex-native lz4-native"
16
17S = "${UNPACKDIR}/barebox-${PV}"
18B = "${WORKDIR}/build"
19KBUILD_OUTPUT = "${B}"
20OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
21
22require conf/image-uefi.conf
23
24# For some platforms and configuration, the barebox build process will require
25# additional host tools that can be activated/deactivated here.
26PACKAGECONFIG ??= "openssl libusb fit"
27
28PACKAGECONFIG[openssl] = ",,openssl-native"
29PACKAGECONFIG[libusb] = ",,libusb1-native"
30PACKAGECONFIG[fit] = ",,u-boot-tools-native dtc-native"
31
32export KBUILD_BUILD_USER ?= "oe-user"
33export KBUILD_BUILD_HOST ?= "oe-host"
34
35# unlike the kernel, barebox may build against host tools like openssl
36export HOST_EXTRACFLAGS
37
38def get_layer_rev(path):
39 try:
40 rev, _ = bb.process.run("git describe --match='' --always --dirty --broken", cwd=path)
41 except bb.process.ExecutionError:
42 rev = ""
43 return rev.strip()
44
45BAREBOX_BUILDSYSTEM_VERSION[doc] = "Build system version to add to the barebox image. By default this is the git description of the containing layer."
46BAREBOX_BUILDSYSTEM_VERSION ??= "${@get_layer_rev(os.path.dirname(d.getVar('FILE')))}"
47
48BAREBOX_FIRMWARE_DIR[doc] = "Overwrite barebox' firmware blobs search directory (CONFIG_EXTRA_FIRMWARE_DIR) with this path, default ${B}/firmware"
49BAREBOX_FIRMWARE_DIR ??= "${B}/firmware"
50
51EXTRA_OEMAKE = " \
52 CROSS_COMPILE=${TARGET_PREFIX} -C ${S} O=${B} \
53 BUILDSYSTEM_VERSION=${BAREBOX_BUILDSYSTEM_VERSION} \
54 CONFIG_EXTRA_FIRMWARE_DIR=${BAREBOX_FIRMWARE_DIR} \
55 PKG_CONFIG=pkg-config-native \
56 CROSS_PKG_CONFIG=pkg-config \
57"
58
59BAREBOX_CONFIG[doc] = "The barebox kconfig defconfig file. Not used if a file called defconfig is added to the SRC_URI."
60BAREBOX_CONFIG ?= ""
61
62# set sensible default configs for some of oe-core's QEMU MACHINEs
63BAREBOX_CONFIG:qemuarm = "multi_v7_defconfig"
64BAREBOX_CONFIG:qemuarm64 = "multi_v8_defconfig"
65BAREBOX_CONFIG:qemux86-64 = "efi_defconfig"
66
67# prevent from acting as non-buildable provider
68python () {
69 bareboxconfig = d.getVar('BAREBOX_CONFIG')
70 bareboxdefconfig = 'file://defconfig' in d.getVar('SRC_URI')
71
72 if not bareboxconfig and not bareboxdefconfig:
73 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"))
74}
75
76barebox_do_configure() {
77 if [ -e ${UNPACKDIR}/defconfig ]; then
78 cp ${UNPACKDIR}/defconfig ${B}/.config
79 else
80 if [ -n "${BAREBOX_CONFIG}" ]; then
81 oe_runmake ${BAREBOX_CONFIG}
82 else
83 bbfatal "No defconfig given. Either add file 'file://defconfig' to SRC_URI or set BAREBOX_CONFIG"
84 fi
85 fi
86
87 ${S}/scripts/kconfig/merge_config.sh -m .config ${@" ".join(find_cfgs(d))}
88 cml1_do_configure
89}
90
91BAREBOX_ENV_DIR[doc] = "Overlay the barebox built-in environment with the environment provided by the BSP if specified."
92BAREBOX_ENV_DIR ??= "${UNPACKDIR}/env/"
93
94barebox_do_compile () {
95 export userccflags="${TARGET_LDFLAGS}${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
96 unset LDFLAGS
97 unset CFLAGS
98 unset CPPFLAGS
99 unset CXXFLAGS
100 unset MACHINE
101 # Allow to use ${UNPACKDIR} in kconfig options to include additionally fetched files
102 export UNPACKDIR=${UNPACKDIR}
103
104 if [ -d ${BAREBOX_ENV_DIR} ]; then
105 BAREBOX_DEFAULT_ENV="$(grep ^CONFIG_DEFAULT_ENVIRONMENT_PATH .config | cut -d '=' -f 2 | tr -d '"')"
106 oe_runmake CONFIG_DEFAULT_ENVIRONMENT_PATH="\"${BAREBOX_DEFAULT_ENV} ${BAREBOX_ENV_DIR}\""
107 else
108 oe_runmake
109 fi
110}
111
112BAREBOX_BINARY[doc] = "Specify the barebox binary to install. If not specified all barebox artifacts are installed."
113BAREBOX_BINARY ??= "${@'barebox.efi' if d.getVar('EFI_PROVIDER') == 'barebox' else ''}"
114BAREBOX_SUFFIX[doc] = "Specify the suffix for ${BAREBOX_IMAGE}."
115BAREBOX_SUFFIX ??= "img"
116BAREBOX_IMAGE[doc] = "A unique barebox image name. Unused if ${BAREBOX_BINARY} is not set."
117BAREBOX_IMAGE_DEFAULT ?= "${PN}-${MACHINE}-${PV}-${PR}.${BAREBOX_SUFFIX}"
118BAREBOX_IMAGE ?= "${@'${EFI_BOOT_IMAGE}' if d.getVar('EFI_PROVIDER') == 'barebox' else '${BAREBOX_IMAGE_DEFAULT}'}"
119
120BAREBOX_INSTALL_PATH ?= "${@'${EFI_FILES_PATH}' if d.getVar('EFI_PROVIDER') == 'barebox' else '/boot'}"
121
122barebox_do_install () {
123 if [ -n "${BAREBOX_BINARY}" ]; then
124
125 BAREBOX_BIN=${B}/${BAREBOX_BINARY}
126 if [ ! -f "${BAREBOX_BIN}" ]; then
127 BAREBOX_BIN=${B}/images/${BAREBOX_BINARY}
128 fi
129 if [ ! -f "${BAREBOX_BIN}" ]; then
130 bbfatal "Failed to locate ${BAREBOX_BINARY}"
131 fi
132
133 install -D -m 644 ${BAREBOX_BIN} ${D}${BAREBOX_INSTALL_PATH}/${BAREBOX_IMAGE}
134 ln -sf ${BAREBOX_IMAGE} ${D}${BAREBOX_INSTALL_PATH}/${BAREBOX_BINARY}
135 else
136 install -d ${D}${BAREBOX_INSTALL_PATH}/
137 for image in $(cat ${B}/barebox-flash-images); do
138 install -m 644 ${B}/${image} ${D}${BAREBOX_INSTALL_PATH}/
139 done
140 fi
141}
142FILES:${PN} = "${BAREBOX_INSTALL_PATH}"
143
144barebox_do_deploy () {
145 if [ -n "${BAREBOX_BINARY}" ]; then
146
147 BAREBOX_BIN=${B}/${BAREBOX_BINARY}
148 if [ ! -f "${BAREBOX_BIN}" ]; then
149 BAREBOX_BIN=${B}/images/${BAREBOX_BINARY}
150 fi
151
152 install -D -m 644 ${BAREBOX_BIN} ${DEPLOYDIR}/${BAREBOX_IMAGE}
153 ln -sf ${BAREBOX_IMAGE} ${DEPLOYDIR}/${BAREBOX_BINARY}
154 else
155 for image in $(cat ${B}/barebox-flash-images); do
156 cp ${B}/${image} ${DEPLOYDIR}
157 done
158 fi
159}
160addtask deploy after do_compile
161
162EXPORT_FUNCTIONS do_configure do_compile do_install do_deploy