[OE-core] [PATCH] barebox: Add recipe

Eric Bénard eric at eukrea.com
Mon Jul 28 11:58:53 UTC 2014


Hi David,

Le Mon, 28 Jul 2014 11:55:04 +0200,
David Vincent <freesilicon at gmail.com> a écrit :

> 
> barebox (formerly known as u-boot-v2) is a bootloader that inherits the
> best of U-Boot and the Linux kernel. This commit adds the possibility to
> use it as a virtual/bootloader instead of U-Boot.
> 
> Signed-off-by: David Vincent <freesilicon at gmail.com>
> ---
>  meta/recipes-bsp/barebox/barebox.inc          |   73 +++++++++++++++++++++++++
>  meta/recipes-bsp/barebox/barebox_2014.07.0.bb |   15 +++++
>  2 files changed, 88 insertions(+)
>  create mode 100644 meta/recipes-bsp/barebox/barebox.inc
>  create mode 100644 meta/recipes-bsp/barebox/barebox_2014.07.0.bb
> 
> diff --git a/meta/recipes-bsp/barebox/barebox.inc b/meta/recipes-bsp/barebox/barebox.inc
> new file mode 100644
> index 0000000..68aeb68
> --- /dev/null
> +++ b/meta/recipes-bsp/barebox/barebox.inc
> @@ -0,0 +1,73 @@
> +SUMMARY = "The Barebox Bootloader"
> +DESCRIPTION = "Barebox (formerly known as u-boot-v2) is a bootloader that inherits the best of U-Boot and the Linux kernel: The size and look-and-feel of u-boot, with driver model and lots of design concepts from the kernel."
> +HOMEPAGE = "http://www.barebox.org"
> +SECTION = "bootloaders"
> +PROVIDES = "virtual/bootloader"
> +
> +inherit cml1 deploy kernel-arch
> +
> +EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}"'
> +
> +BAREBOX_BINARY ?= "barebox.bin"
> +BAREBOX_IMAGE ?= "barebox-${MACHINE}-${PV}-${PR}.bin"
> +BAREBOX_SYMLINK ?= "barebox-${MACHINE}.bin"
> +
> +do_configure () {
> +	# Copy defconfig to .config if .config does not exist. This allows
> +	# recipes to manage the .config themselves in do_configure_prepend().
> +	if [ -f "${WORKDIR}/defconfig" ] && [ ! -f "${B}/.config" ]; then
> +		cp "${WORKDIR}/defconfig" "${B}/.config"
> +	fi
> +
> +	# Use board default defconfig if .config does not exist. This allows
> +	# recipes to manage the .config themselves in do_configure_prepend().
> +	if [ ! -f "${B}/.config" ]; then
> +		oe_runmake_call ${BAREBOX_TARGET}
> +	fi
> +
> +	cml1_do_configure
> +}
> +
> +do_compile () {
> +	if [ "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', 'ld-is-gold', '', d)}" = "ld-is-gold" ] ; then
> +		sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' ${S}/Makefile
> +	fi
> +
I had to add that a few year ago : is that still needed ?

> +	unset CFLAGS CPPFLAGS LDFLAGS
> +	oe_runmake
> +}
> +
> +do_install () {
> +	install -d ${D}/boot
> +	install ${S}/barebox-flash-image ${D}/boot/${BAREBOX_IMAGE}
> +	ln -sf ${BAREBOX_IMAGE} ${D}/boot/${BAREBOX_BINARY}
> +
> +	# Install target tools if available
> +	install -d ${D}${sbindir}
> +
> +	if [ -e ${WORKDIR}/scripts/bareboxenv-target ]; then
> +		install -m 0755 ${WORKDIR}/scripts/bareboxenv-target ${D}${sbindir}/bareboxenv
> +	fi
> +
> +	if [ -e ${WORKDIR}/scripts/bareboxcrc32-target ]; then
> +		install -m 0755 ${WORKDIR}/scripts/bareboxcrc32-target ${D}${sbindir}/bareboxcrc32
> +	fi
> +
> +	if [ -e ${WORKDIR}/scripts/kernel-install-target ]; then
> +		install -m 0755 ${WORKDIR}/scripts/kernel-install-target ${D}${sbindir}/kernel-install
> +	fi
> +}
> +
> +FILES_${PN} = "/boot ${sbindir}"

Why not splitting the tools in their own package so that we can have
the tools on the target without having the binary in /boot ?

> +
> +do_deploy () {
> +	install -d ${DEPLOYDIR}
> +	install ${S}/barebox-flash-image ${DEPLOYDIR}/${BAREBOX_IMAGE}
> +
Why don't you use $BAREBOX_BINARY instead of hardcoding
barebox-flash-image which won't work on old versions of barebox where
barebox's binary is named barebox.bin ?

Best regards,
Eric



More information about the Openembedded-core mailing list