diff mbox series

[v4,2/7] barebox-tools: add initial barebox tools support

Message ID 20240910072006.3938401-3-ejo@pengutronix.de
State New
Headers show
Series Add barebox bootloader support (and testing) | expand

Commit Message

Enrico Jörns Sept. 10, 2024, 7:20 a.m. UTC
From: Marco Felsch <m.felsch@pengutronix.de>

Add initial support to build the barebox tools for the host and the
target.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
---
 meta/conf/distro/include/maintainers.inc      |  1 +
 .../barebox/barebox-tools_2024.08.0.bb        | 58 +++++++++++++++++++
 2 files changed, 59 insertions(+)
 create mode 100644 meta/recipes-bsp/barebox/barebox-tools_2024.08.0.bb

Comments

Alexander Kanavin Sept. 10, 2024, 8:37 a.m. UTC | #1
Can this be merged into the main barebox recipe? Does it need a separate recipe?


Alex

On Tue, 10 Sept 2024 at 09:21, Enrico Jörns via lists.openembedded.org
<ejo=pengutronix.de@lists.openembedded.org> wrote:
>
> From: Marco Felsch <m.felsch@pengutronix.de>
>
> Add initial support to build the barebox tools for the host and the
> target.
>
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
> ---
>  meta/conf/distro/include/maintainers.inc      |  1 +
>  .../barebox/barebox-tools_2024.08.0.bb        | 58 +++++++++++++++++++
>  2 files changed, 59 insertions(+)
>  create mode 100644 meta/recipes-bsp/barebox/barebox-tools_2024.08.0.bb
>
> diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc
> index 1b3d485e48..067c4af096 100644
> --- a/meta/conf/distro/include/maintainers.inc
> +++ b/meta/conf/distro/include/maintainers.inc
> @@ -55,6 +55,7 @@ RECIPE_MAINTAINER:pn-avahi = "Yi Zhao <yi.zhao@windriver.com>"
>  RECIPE_MAINTAINER:pn-babeltrace = "Alexander Kanavin <alex.kanavin@gmail.com>"
>  RECIPE_MAINTAINER:pn-babeltrace2 = "Alexander Kanavin <alex.kanavin@gmail.com>"
>  RECIPE_MAINTAINER:pn-barebox = "Enrico Jörns <yocto@pengutronix.de>"
> +RECIPE_MAINTAINER:pn-barebox-tools = "Enrico Jörns <yocto@pengutronix.de>"
>  RECIPE_MAINTAINER:pn-baremetal-helloworld = "Alejandro Hernandez <alejandro@enedino.org>"
>  RECIPE_MAINTAINER:pn-base-files = "Anuj Mittal <anuj.mittal@intel.com>"
>  RECIPE_MAINTAINER:pn-base-passwd = "Anuj Mittal <anuj.mittal@intel.com>"
> diff --git a/meta/recipes-bsp/barebox/barebox-tools_2024.08.0.bb b/meta/recipes-bsp/barebox/barebox-tools_2024.08.0.bb
> new file mode 100644
> index 0000000000..25f4998d4a
> --- /dev/null
> +++ b/meta/recipes-bsp/barebox/barebox-tools_2024.08.0.bb
> @@ -0,0 +1,58 @@
> +SUMMARY = "barebox bootloader tools"
> +HOMEPAGE = "https://barebox.org/"
> +
> +LICENSE = "GPL-2.0-only"
> +LIC_FILES_CHKSUM = "file://COPYING;md5=f5125d13e000b9ca1f0d3364286c4192"
> +
> +DEPENDS = "libusb1 bison-native flex-native"
> +
> +SRC_URI = "https://barebox.org/download/barebox-${PV}.tar.bz2"
> +SRC_URI[sha256sum] = "b08a762da8d63dd18b4f2d9f5d0a8da001b6e608d1b3eff6dcebc6a2e575d535"
> +
> +S = "${WORKDIR}/barebox-${PV}"
> +B = "${WORKDIR}/build"
> +
> +inherit pkgconfig
> +
> +EXTRA_OEMAKE = " \
> +  ARCH=sandbox \
> +  CROSS_COMPILE=${TARGET_PREFIX} -C ${S} O=${B} \
> +  CROSS_PKG_CONFIG=pkg-config \
> +  CC='${CC}' \
> +  LD='${LD}' \
> +  "
> +
> +do_compile:class-target () {
> +    export userccflags="${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
> +    export userldflags="${TARGET_LDFLAGS}${TOOLCHAIN_OPTIONS}"
> +    oe_runmake targettools_defconfig
> +    oe_runmake scripts
> +}
> +
> +do_compile:class-native () {
> +    oe_runmake hosttools_defconfig
> +    oe_runmake scripts
> +}
> +
> +BAREBOX_TOOLS = " \
> +         bareboxenv \
> +         bareboxcrc32 \
> +         kernel-install \
> +         bareboximd \
> +         omap3-usb-loader \
> +         omap4_usbboot \
> +         imx/imx-usb-loader \
> +         "
> +
> +BAREBOX_TOOLS_SUFFIX = ""
> +BAREBOX_TOOLS_SUFFIX:class-target = "-target"
> +
> +do_install () {
> +       install -d ${D}${bindir}
> +
> +       for tool in ${BAREBOX_TOOLS}; do
> +               install -m 0755 scripts/${tool}${BAREBOX_TOOLS_SUFFIX} ${D}${bindir}/${tool##*/}
> +       done
> +}
> +
> +BBCLASSEXTEND = "native nativesdk"
> --
> 2.39.2
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#204337): https://lists.openembedded.org/g/openembedded-core/message/204337
> Mute This Topic: https://lists.openembedded.org/mt/108370664/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Enrico Jörns Sept. 10, 2024, 8:45 a.m. UTC | #2
Hi Alex,

Am Dienstag, dem 10.09.2024 um 10:37 +0200 schrieb Alexander Kanavin:
> Can this be merged into the main barebox recipe? Does it need a separate recipe?

not only that it would complicate the main recipe (we had tried this before), but I really see no
point in doing and supporting barebox native builds (in contrast to barebox-tools).

And some of these tools might also be useful without using barebox.

I guess u-boot-tools is separate for similar reasons.

Regards, Enrico

> Alex
> 
> On Tue, 10 Sept 2024 at 09:21, Enrico Jörns via lists.openembedded.org
> <ejo=pengutronix.de@lists.openembedded.org> wrote:
> > 
> > From: Marco Felsch <m.felsch@pengutronix.de>
> > 
> > Add initial support to build the barebox tools for the host and the
> > target.
> > 
> > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
> > ---
> >  meta/conf/distro/include/maintainers.inc      |  1 +
> >  .../barebox/barebox-tools_2024.08.0.bb        | 58 +++++++++++++++++++
> >  2 files changed, 59 insertions(+)
> >  create mode 100644 meta/recipes-bsp/barebox/barebox-tools_2024.08.0.bb
> > 
> > diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc
> > index 1b3d485e48..067c4af096 100644
> > --- a/meta/conf/distro/include/maintainers.inc
> > +++ b/meta/conf/distro/include/maintainers.inc
> > @@ -55,6 +55,7 @@ RECIPE_MAINTAINER:pn-avahi = "Yi Zhao <yi.zhao@windriver.com>"
> >  RECIPE_MAINTAINER:pn-babeltrace = "Alexander Kanavin <alex.kanavin@gmail.com>"
> >  RECIPE_MAINTAINER:pn-babeltrace2 = "Alexander Kanavin <alex.kanavin@gmail.com>"
> >  RECIPE_MAINTAINER:pn-barebox = "Enrico Jörns <yocto@pengutronix.de>"
> > +RECIPE_MAINTAINER:pn-barebox-tools = "Enrico Jörns <yocto@pengutronix.de>"
> >  RECIPE_MAINTAINER:pn-baremetal-helloworld = "Alejandro Hernandez <alejandro@enedino.org>"
> >  RECIPE_MAINTAINER:pn-base-files = "Anuj Mittal <anuj.mittal@intel.com>"
> >  RECIPE_MAINTAINER:pn-base-passwd = "Anuj Mittal <anuj.mittal@intel.com>"
> > diff --git a/meta/recipes-bsp/barebox/barebox-tools_2024.08.0.bb b/meta/recipes-
> > bsp/barebox/barebox-tools_2024.08.0.bb
> > new file mode 100644
> > index 0000000000..25f4998d4a
> > --- /dev/null
> > +++ b/meta/recipes-bsp/barebox/barebox-tools_2024.08.0.bb
> > @@ -0,0 +1,58 @@
> > +SUMMARY = "barebox bootloader tools"
> > +HOMEPAGE = "https://barebox.org/"
> > +
> > +LICENSE = "GPL-2.0-only"
> > +LIC_FILES_CHKSUM = "file://COPYING;md5=f5125d13e000b9ca1f0d3364286c4192"
> > +
> > +DEPENDS = "libusb1 bison-native flex-native"
> > +
> > +SRC_URI = "https://barebox.org/download/barebox-${PV}.tar.bz2"
> > +SRC_URI[sha256sum] = "b08a762da8d63dd18b4f2d9f5d0a8da001b6e608d1b3eff6dcebc6a2e575d535"
> > +
> > +S = "${WORKDIR}/barebox-${PV}"
> > +B = "${WORKDIR}/build"
> > +
> > +inherit pkgconfig
> > +
> > +EXTRA_OEMAKE = " \
> > +  ARCH=sandbox \
> > +  CROSS_COMPILE=${TARGET_PREFIX} -C ${S} O=${B} \
> > +  CROSS_PKG_CONFIG=pkg-config \
> > +  CC='${CC}' \
> > +  LD='${LD}' \
> > +  "
> > +
> > +do_compile:class-target () {
> > +    export userccflags="${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
> > +    export userldflags="${TARGET_LDFLAGS}${TOOLCHAIN_OPTIONS}"
> > +    oe_runmake targettools_defconfig
> > +    oe_runmake scripts
> > +}
> > +
> > +do_compile:class-native () {
> > +    oe_runmake hosttools_defconfig
> > +    oe_runmake scripts
> > +}
> > +
> > +BAREBOX_TOOLS = " \
> > +         bareboxenv \
> > +         bareboxcrc32 \
> > +         kernel-install \
> > +         bareboximd \
> > +         omap3-usb-loader \
> > +         omap4_usbboot \
> > +         imx/imx-usb-loader \
> > +         "
> > +
> > +BAREBOX_TOOLS_SUFFIX = ""
> > +BAREBOX_TOOLS_SUFFIX:class-target = "-target"
> > +
> > +do_install () {
> > +       install -d ${D}${bindir}
> > +
> > +       for tool in ${BAREBOX_TOOLS}; do
> > +               install -m 0755 scripts/${tool}${BAREBOX_TOOLS_SUFFIX} ${D}${bindir}/${tool##*/}
> > +       done
> > +}
> > +
> > +BBCLASSEXTEND = "native nativesdk"
> > --
> > 2.39.2
> > 
> > 
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#204337): https://lists.openembedded.org/g/openembedded-core/message/204337
> > Mute This Topic: https://lists.openembedded.org/mt/108370664/1686489
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> > 
>
Alexander Kanavin Sept. 10, 2024, 8:49 a.m. UTC | #3
On Tue, 10 Sept 2024 at 10:45, Enrico Jörns <ejo@pengutronix.de> wrote:
> > Can this be merged into the main barebox recipe? Does it need a separate recipe?
>
> not only that it would complicate the main recipe (we had tried this before), but I really see no
> point in doing and supporting barebox native builds (in contrast to barebox-tools).
>
> And some of these tools might also be useful without using barebox.
>
> I guess u-boot-tools is separate for similar reasons.

Then you should put the common bits into barebox-common.inc, same as
u-boot does. Also there should be a good DESCRIPTION in there. Why
barebox, and not u-boot, for example?

Alex
Enrico Jörns Sept. 10, 2024, 9:02 a.m. UTC | #4
Am Dienstag, dem 10.09.2024 um 10:49 +0200 schrieb Alexander Kanavin:
> On Tue, 10 Sept 2024 at 10:45, Enrico Jörns <ejo@pengutronix.de> wrote:
> > > Can this be merged into the main barebox recipe? Does it need a separate recipe?
> > 
> > not only that it would complicate the main recipe (we had tried this before), but I really see
> > no
> > point in doing and supporting barebox native builds (in contrast to barebox-tools).
> > 
> > And some of these tools might also be useful without using barebox.
> > 
> > I guess u-boot-tools is separate for similar reasons.
> 
> Then you should put the common bits into barebox-common.inc, same as
> u-boot does.

My impression was that the actual amount of things to share would not justify another file.
It is mainly license information, SRC_URI and a bit of metadata where I found it more obvious to
have them in the respective recipe.

If having shared parts in a barebox-common.inc is actually preferable, I could rework this of
course.

> Also there should be a good DESCRIPTION in there. Why
> barebox, and not u-boot, for example?

Trying to outdo other projects was not my intention.
So I would like to omit such comparisons from the description.

My current summary:

  "barebox is a bootloader designed for embedded systems.
  It runs on a variety of architectures including x86, ARM, MIPS, PowerPC and others."

does not yet get the point of a bootloader?
I also thought that adding too much information would make the summary too long.
But in case something important is missing, I am open to further suggestions.


Thanks in advance an best regards

Enrico

> Alex
>
Alexander Kanavin Sept. 10, 2024, 9:22 a.m. UTC | #5
On Tue, 10 Sept 2024 at 11:02, Enrico Jörns <ejo@pengutronix.de> wrote:
> My impression was that the actual amount of things to share would not justify another file.
> It is mainly license information, SRC_URI and a bit of metadata where I found it more obvious to
> have them in the respective recipe.
>
> If having shared parts in a barebox-common.inc is actually preferable, I could rework this of
> course.

It is yes. They are the same between recipes, and so should be specified once.

> > Also there should be a good DESCRIPTION in there. Why
> > barebox, and not u-boot, for example?
>
> Trying to outdo other projects was not my intention.
> So I would like to omit such comparisons from the description.
>
> My current summary:
>
>   "barebox is a bootloader designed for embedded systems.
>   It runs on a variety of architectures including x86, ARM, MIPS, PowerPC and others."
>
> does not yet get the point of a bootloader?
> I also thought that adding too much information would make the summary too long.
> But in case something important is missing, I am open to further suggestions.

There's a SUMMARY (which is ok), but there's no DESCRIPTION, and they
are two different texts. We do require a DESCRIPTION that contains a
paragraph or two, with multiple sentences that properly introduce the
project. You don't have to directly compare to u-boot, but you do need
to highlight the best features and advantages of the component. Being
terse or generic in DESCRIPTION is not a good thing, and no
DESCRIPTION at all is even worse.

Alex
Enrico Jörns Sept. 10, 2024, 9:32 a.m. UTC | #6
Am Dienstag, dem 10.09.2024 um 11:22 +0200 schrieb Alexander Kanavin:
> On Tue, 10 Sept 2024 at 11:02, Enrico Jörns <ejo@pengutronix.de> wrote:
> > My impression was that the actual amount of things to share would not justify another file.
> > It is mainly license information, SRC_URI and a bit of metadata where I found it more obvious to
> > have them in the respective recipe.
> > 
> > If having shared parts in a barebox-common.inc is actually preferable, I could rework this of
> > course.
> 
> It is yes. They are the same between recipes, and so should be specified once.
> 
> > > Also there should be a good DESCRIPTION in there. Why
> > > barebox, and not u-boot, for example?
> > 
> > Trying to outdo other projects was not my intention.
> > So I would like to omit such comparisons from the description.

ok, will do.

> > My current summary:
> > 
> >   "barebox is a bootloader designed for embedded systems.
> >   It runs on a variety of architectures including x86, ARM, MIPS, PowerPC and others."
> > 
> > does not yet get the point of a bootloader?
> > I also thought that adding too much information would make the summary too long.
> > But in case something important is missing, I am open to further suggestions.
> 
> There's a SUMMARY (which is ok), but there's no DESCRIPTION, and they
> are two different texts. We do require a DESCRIPTION that contains a
> paragraph or two, with multiple sentences that properly introduce the
> project. You don't have to directly compare to u-boot, but you do need
> to highlight the best features and advantages of the component. Being
> terse or generic in DESCRIPTION is not a good thing, and no
> DESCRIPTION at all is even worse.

Sorry, maybe I got confused since the SUMMARY I had is as long as other recipes DESCRIPTION.
But you're right, it's not the same and the DESCRIPTION is missing.
My understanding so far was that SUMMARY is mandatory while DESCRIPTION isn't.
However having one is better than not having one.

I'll attempt to provide a more comprehensive DESCRIPTION.

Regards, Enrico

> Alex
>
diff mbox series

Patch

diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc
index 1b3d485e48..067c4af096 100644
--- a/meta/conf/distro/include/maintainers.inc
+++ b/meta/conf/distro/include/maintainers.inc
@@ -55,6 +55,7 @@  RECIPE_MAINTAINER:pn-avahi = "Yi Zhao <yi.zhao@windriver.com>"
 RECIPE_MAINTAINER:pn-babeltrace = "Alexander Kanavin <alex.kanavin@gmail.com>"
 RECIPE_MAINTAINER:pn-babeltrace2 = "Alexander Kanavin <alex.kanavin@gmail.com>"
 RECIPE_MAINTAINER:pn-barebox = "Enrico Jörns <yocto@pengutronix.de>"
+RECIPE_MAINTAINER:pn-barebox-tools = "Enrico Jörns <yocto@pengutronix.de>"
 RECIPE_MAINTAINER:pn-baremetal-helloworld = "Alejandro Hernandez <alejandro@enedino.org>"
 RECIPE_MAINTAINER:pn-base-files = "Anuj Mittal <anuj.mittal@intel.com>"
 RECIPE_MAINTAINER:pn-base-passwd = "Anuj Mittal <anuj.mittal@intel.com>"
diff --git a/meta/recipes-bsp/barebox/barebox-tools_2024.08.0.bb b/meta/recipes-bsp/barebox/barebox-tools_2024.08.0.bb
new file mode 100644
index 0000000000..25f4998d4a
--- /dev/null
+++ b/meta/recipes-bsp/barebox/barebox-tools_2024.08.0.bb
@@ -0,0 +1,58 @@ 
+SUMMARY = "barebox bootloader tools"
+HOMEPAGE = "https://barebox.org/"
+
+LICENSE = "GPL-2.0-only"
+LIC_FILES_CHKSUM = "file://COPYING;md5=f5125d13e000b9ca1f0d3364286c4192"
+
+DEPENDS = "libusb1 bison-native flex-native"
+
+SRC_URI = "https://barebox.org/download/barebox-${PV}.tar.bz2"
+SRC_URI[sha256sum] = "b08a762da8d63dd18b4f2d9f5d0a8da001b6e608d1b3eff6dcebc6a2e575d535"
+
+S = "${WORKDIR}/barebox-${PV}"
+B = "${WORKDIR}/build"
+
+inherit pkgconfig
+
+EXTRA_OEMAKE = " \
+  ARCH=sandbox \
+  CROSS_COMPILE=${TARGET_PREFIX} -C ${S} O=${B} \
+  CROSS_PKG_CONFIG=pkg-config \
+  CC='${CC}' \
+  LD='${LD}' \
+  "
+
+do_compile:class-target () {
+    export userccflags="${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
+    export userldflags="${TARGET_LDFLAGS}${TOOLCHAIN_OPTIONS}"
+    oe_runmake targettools_defconfig
+    oe_runmake scripts
+}
+
+do_compile:class-native () {
+    oe_runmake hosttools_defconfig
+    oe_runmake scripts
+}
+
+BAREBOX_TOOLS = " \
+         bareboxenv \
+         bareboxcrc32 \
+         kernel-install \
+         bareboximd \
+         omap3-usb-loader \
+         omap4_usbboot \
+         imx/imx-usb-loader \
+         "
+
+BAREBOX_TOOLS_SUFFIX = ""
+BAREBOX_TOOLS_SUFFIX:class-target = "-target"
+
+do_install () {
+	install -d ${D}${bindir}
+
+	for tool in ${BAREBOX_TOOLS}; do
+		install -m 0755 scripts/${tool}${BAREBOX_TOOLS_SUFFIX} ${D}${bindir}/${tool##*/}
+	done
+}
+
+BBCLASSEXTEND = "native nativesdk"