* [PATCH 00/13] images: add barebox FIT image target
@ 2025-01-12 8:34 Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 01/13] ARM: dts: add device trees for the QEMU Virt machine Ahmad Fatoum
` (14 more replies)
0 siblings, 15 replies; 19+ messages in thread
From: Ahmad Fatoum @ 2025-01-12 8:34 UTC (permalink / raw)
To: barebox; +Cc: Felix Singer
The generic barebox-dt-2nd.img depends on the user to fish out
the correct device tree from arch/${SRCARCH}/dts and to instruct
the preceding boot stage to pass that device tree to the barebox image.
To make this easier, especially with an eye towards using this as a
coreboot payload, let's have the barebox build system produce a FIT
image combining barebox-dt-2nd.img and all the enabled device trees.
As this introduces a python3 and python3-libfdt dependency that wasn't
there before, this is only built by default if CONFIG_BOARD_GENERIC_FIT
is enabled or make barebox.fit is explicitly invoked.
Ahmad Fatoum (13):
ARM: dts: add device trees for the QEMU Virt machine
treewide: collect the name of all board device trees
kbuild: collect available device trees in dtbs-list
scripts: add new scripts_dtc target
kbuild: restrict dtbs target to enabled DTs by default
kbuild: improve make help description
kbuild: allow dependency on any file in images/
arch: maintain Linux kernel and mkimage ARCH mapping in Kconfig
arch: make BOARD_GENERIC_DT a user-selectable option across archs
images: add barebox FIT image target
MAKEALL: rename target in symbols to more appropiate defconfig
MAKEALL: add support for building arbitrary targets
ci: container: add python3-libfdt dependency for barebox.fit
.gitignore | 1 +
Documentation/devicetree/index.rst | 4 +-
Documentation/user/barebox.rst | 31 +-
MAKEALL | 76 ++---
Makefile | 47 ++-
arch/Kconfig | 43 +++
arch/arm/Kconfig | 15 +-
arch/arm/configs/multi_v5_v6_defconfig | 2 +-
arch/arm/configs/rockchip_v7a_defconfig | 2 +-
arch/arm/configs/rockchip_v8_defconfig | 2 +-
arch/arm/configs/rpi_defconfig | 2 +-
arch/arm/configs/stm32mp_defconfig | 2 +-
arch/arm/dts/Makefile | 3 +
arch/arm/dts/qemu-virt32.dts | 402 +++++++++++++++++++++++
arch/arm/dts/qemu-virt64.dts | 403 ++++++++++++++++++++++++
arch/kvx/dts/Makefile | 4 +-
arch/mips/Kconfig | 9 +
arch/openrisc/Kconfig | 4 +
arch/openrisc/dts/Makefile | 2 +-
arch/powerpc/Kconfig | 8 +
arch/riscv/Kconfig | 19 +-
arch/riscv/Kconfig.socs | 2 +-
arch/riscv/configs/rv64i_defconfig | 2 +-
arch/sandbox/Kconfig | 4 +
arch/sandbox/dts/Makefile | 2 +-
arch/x86/Kconfig | 10 +
drivers/of/Kconfig | 11 +
images/Makefile | 9 +
scripts/Kbuild.include | 6 +
scripts/Makefile | 3 +-
scripts/Makefile.build | 11 +
scripts/Makefile.dtbs | 32 ++
scripts/Makefile.lib | 20 ++
scripts/make_fit.py | 331 +++++++++++++++++++
test/Containerfile | 1 +
35 files changed, 1429 insertions(+), 96 deletions(-)
create mode 100644 arch/arm/dts/qemu-virt32.dts
create mode 100644 arch/arm/dts/qemu-virt64.dts
create mode 100644 scripts/Makefile.dtbs
create mode 100755 scripts/make_fit.py
--
2.39.5
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 01/13] ARM: dts: add device trees for the QEMU Virt machine
2025-01-12 8:34 [PATCH 00/13] images: add barebox FIT image target Ahmad Fatoum
@ 2025-01-12 8:34 ` Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 02/13] treewide: collect the name of all board device trees Ahmad Fatoum
` (13 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Ahmad Fatoum @ 2025-01-12 8:34 UTC (permalink / raw)
To: barebox; +Cc: Felix Singer, Ahmad Fatoum
QEMU assembles a device tree at runtime and passes it to the booted
kernel per Linux boot convention. The barebox-dt-2nd.img looks like a
Linux kernel and so we didn't need to ship our own device tree.
Things are different though if we want to run barebox second stage after
another bootloader, e.g. coreboot. Coreboot doesn't currently pass along
the QEMU device tree and because we have no barebox binary with the QEMU
device tree embedded, there is no image suitable for use as coreboot
payload.
A later commit will add an optional FIT image target that contains
barebox-dt-2nd.img along with all enabled device trees. To make that FIT
image bootable on QEMU Virt, let's dump the QEMU device trees with:
alias MAKEALL='scripts/container.sh ./MAKEALL'
MAKEALL -a arm test/arm/virt@multi_v7_defconfig.yaml --dump-dtb
MAKEALL -a arm test/arm/virt@multi_v8_defconfig.yaml --dump-dtb
and pretty them up with labels and binding macros.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/dts/Makefile | 3 +
arch/arm/dts/qemu-virt32.dts | 402 ++++++++++++++++++++++++++++++++++
arch/arm/dts/qemu-virt64.dts | 403 +++++++++++++++++++++++++++++++++++
3 files changed, 808 insertions(+)
create mode 100644 arch/arm/dts/qemu-virt32.dts
create mode 100644 arch/arm/dts/qemu-virt64.dts
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index b1c73b47aa40..13d8b0b04320 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -222,6 +222,9 @@ lwl-$(CONFIG_MACH_XILINX_ZCU102) += zynqmp-zcu102-revA.dtb.o zynqmp-zcu102-revB.
lwl-$(CONFIG_MACH_XILINX_ZCU104) += zynqmp-zcu104-revA.dtb.o
lwl-$(CONFIG_MACH_XILINX_ZCU106) += zynqmp-zcu106-revA.dtb.o
+lwl-$(CONFIG_MACH_VIRT) += qemu-virt32.dtb.o
+lwl-$(CONFIG_ARCH_ARM64_VIRT) += qemu-virt64.dtb.o
+
lwl-$(CONFIG_MACH_ZII_IMX7D_DEV) += imx7d-zii-rpu2.dtb.o imx7d-zii-rmu2.dtb.o
lwl-$(CONFIG_MACH_WAGO_PFC_AM35XX) += am35xx-pfc-750_820x.dtb.o
lwl-$(CONFIG_MACH_LS1028ARDB) += fsl-ls1028a-rdb.dtb.o
diff --git a/arch/arm/dts/qemu-virt32.dts b/arch/arm/dts/qemu-virt32.dts
new file mode 100644
index 000000000000..053fcc242df7
--- /dev/null
+++ b/arch/arm/dts/qemu-virt32.dts
@@ -0,0 +1,402 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/input/linux-event-codes.h>
+
+/dts-v1/;
+
+/ {
+ compatible = "linux,dummy-virt";
+ model = "linux,dummy-virt";
+ interrupt-parent = <&gic>;
+ #address-cells = <2>;
+ #size-cells = <2>;
+
+ chosen {
+ stdout-path = &uart0;
+ };
+
+ psci {
+ compatible = "arm,psci-1.0", "arm,psci-0.2", "arm,psci";
+ method = "hvc";
+ migrate = <0x84000005>;
+ cpu_on = <0x84000003>;
+ cpu_off = <0x84000002>;
+ cpu_suspend = <0x84000001>;
+ };
+
+ memory@40000000 {
+ reg = <0x0 0x40000000 0x0 0x40000000>;
+ device_type = "memory";
+ };
+
+ flash@0 {
+ compatible = "cfi-flash";
+ reg = <0x0 0x0 0x0 0x4000000>, <0x0 0x4000000 0x0 0x4000000>;
+ bank-width = <4>;
+ };
+
+ clk_24mhz: apb-pclk {
+ compatible = "fixed-clock";
+ clock-frequency = <24000000>;
+ clock-output-names = "clk24mhz";
+ #clock-cells = <0>;
+ };
+
+ platform-bus@c000000 {
+ compatible = "qemu,platform", "simple-bus";
+ ranges = <0x0 0x0 0xc000000 0x2000000>;
+ interrupt-parent = <&gic>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+ };
+
+ fw-cfg@9020000 {
+ compatible = "qemu,fw-cfg-mmio";
+ reg = <0x0 0x9020000 0x0 0x18>;
+ dma-coherent;
+ };
+
+ gpio-keys {
+ compatible = "gpio-keys";
+
+ poweroff {
+ gpios = <&gpio 3 GPIO_ACTIVE_HIGH>;
+ linux,code = <KEY_POWER>;
+ label = "GPIO Key Poweroff";
+ };
+ };
+
+ gpio: pl061@9030000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0x0 0x9030000 0x0 0x1000>;
+ clock-names = "apb_pclk";
+ clocks = <&clk_24mhz>;
+ interrupts = <GIC_SPI 0x07 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ };
+
+ pcie@10000000 {
+ compatible = "pci-host-ecam-generic";
+ device_type = "pci";
+ interrupt-map-mask = <0x1800 0x0 0x0 0x07>;
+ interrupt-map = <0x0000 0 0 1 &gic 0 0 GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
+ <0x0000 0 0 2 &gic 0 0 GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
+ <0x0000 0 0 3 &gic 0 0 GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>,
+ <0x0000 0 0 4 &gic 0 0 GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
+ <0x0800 0 0 1 &gic 0 0 GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
+ <0x0800 0 0 2 &gic 0 0 GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>,
+ <0x0800 0 0 3 &gic 0 0 GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
+ <0x0800 0 0 4 &gic 0 0 GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
+ <0x1000 0 0 1 &gic 0 0 GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>,
+ <0x1000 0 0 2 &gic 0 0 GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
+ <0x1000 0 0 3 &gic 0 0 GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
+ <0x1000 0 0 4 &gic 0 0 GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
+ <0x1800 0 0 1 &gic 0 0 GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
+ <0x1800 0 0 2 &gic 0 0 GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
+ <0x1800 0 0 3 &gic 0 0 GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
+ <0x1800 0 0 4 &gic 0 0 GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>;
+ #interrupt-cells = <1>;
+ ranges = <0x1000000 0 0 0 0x3eff0000 0 0x10000>,
+ <0x2000000 0 0x10000000 0 0x10000000 0 0x2eff0000>,
+ <0x3000000 0x80 0x0 0x80 0x0 0x80 0x0>;
+ reg = <0x40 0x10000000 0x0 0x10000000>;
+ msi-map = <0x0 &gic_its 0x0 0x10000>;
+ dma-coherent;
+ bus-range = <0 0xff>;
+ linux,pci-domain = <0>;
+ #address-cells = <3>;
+ #size-cells = <2>;
+ };
+
+ pl031@9010000 {
+ compatible = "arm,pl031", "arm,primecell";
+ reg = <0x0 0x9010000 0x0 0x1000>;
+ clock-names = "apb_pclk";
+ clocks = <&clk_24mhz>;
+ interrupts = <GIC_SPI 0x02 IRQ_TYPE_LEVEL_HIGH>;
+ };
+
+ uart0: pl011@9000000 {
+ compatible = "arm,pl011", "arm,primecell";
+ reg = <0x0 0x9000000 0x0 0x1000>;
+ clock-names = "uartclk", "apb_pclk";
+ clocks = <&clk_24mhz>, <&clk_24mhz>;
+ interrupts = <GIC_SPI 0x01 IRQ_TYPE_LEVEL_HIGH>;
+ };
+
+ pmu {
+ };
+
+ gic: intc@8000000 {
+ compatible = "arm,cortex-a15-gic";
+ reg = <0x0 0x8000000 0x0 0x10000>, <0x0 0x8010000 0x0 0x10000>;
+ ranges;
+ interrupt-controller;
+ #interrupt-cells = <3>;
+ #address-cells = <2>;
+ #size-cells = <2>;
+
+ gic_its: v2m@8020000 {
+ compatible = "arm,gic-v2m-frame";
+ reg = <0x0 0x8020000 0x0 0x1000>;
+ msi-controller;
+ };
+ };
+
+ cpus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ cpu0: cpu@0 {
+ compatible = "arm,cortex-a7";
+ device_type = "cpu";
+ reg = <0>;
+ };
+
+ cpu-map {
+ socket0 {
+ cluster0 {
+ core0 {
+ cpu = <&cpu0>;
+ };
+ };
+ };
+ };
+ };
+
+ timer {
+ compatible = "arm,armv7-timer";
+ interrupts = <GIC_PPI 0x0d (GIC_CPU_MASK_RAW(1) | IRQ_TYPE_LEVEL_HIGH)>,
+ <GIC_PPI 0x0e (GIC_CPU_MASK_RAW(1) | IRQ_TYPE_LEVEL_HIGH)>,
+ <GIC_PPI 0x0b (GIC_CPU_MASK_RAW(1) | IRQ_TYPE_LEVEL_HIGH)>,
+ <GIC_PPI 0x0a (GIC_CPU_MASK_RAW(1) | IRQ_TYPE_LEVEL_HIGH)>;
+ always-on;
+ };
+
+ virtio_mmio@a000000 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa000000 0x0 0x200>;
+ interrupts = <GIC_SPI 0x10 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a000200 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa000200 0x0 0x200>;
+ interrupts = <GIC_SPI 0x11 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a000400 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa000400 0x0 0x200>;
+ interrupts = <GIC_SPI 0x12 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a000600 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa000600 0x0 0x200>;
+ interrupts = <GIC_SPI 0x13 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a000800 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa000800 0x0 0x200>;
+ interrupts = <GIC_SPI 0x14 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a000a00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa000a00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x15 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a000c00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa000c00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x16 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a000e00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa000e00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x17 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a001000 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa001000 0x0 0x200>;
+ interrupts = <GIC_SPI 0x18 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a001200 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa001200 0x0 0x200>;
+ interrupts = <GIC_SPI 0x19 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a001400 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa001400 0x0 0x200>;
+ interrupts = <GIC_SPI 0x1a IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a001600 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa001600 0x0 0x200>;
+ interrupts = <GIC_SPI 0x1b IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a001800 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa001800 0x0 0x200>;
+ interrupts = <GIC_SPI 0x1c IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a001a00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa001a00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x1d IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a001c00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa001c00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x1e IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a001e00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa001e00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x1f IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a002000 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa002000 0x0 0x200>;
+ interrupts = <GIC_SPI 0x20 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a002200 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa002200 0x0 0x200>;
+ interrupts = <GIC_SPI 0x21 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a002400 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa002400 0x0 0x200>;
+ interrupts = <GIC_SPI 0x22 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a002600 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa002600 0x0 0x200>;
+ interrupts = <GIC_SPI 0x23 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a002800 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa002800 0x0 0x200>;
+ interrupts = <GIC_SPI 0x24 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a002a00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa002a00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x25 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a002c00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa002c00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x26 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a002e00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa002e00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x27 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a003000 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa003000 0x0 0x200>;
+ interrupts = <GIC_SPI 0x28 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a003200 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa003200 0x0 0x200>;
+ interrupts = <GIC_SPI 0x29 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a003400 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa003400 0x0 0x200>;
+ interrupts = <GIC_SPI 0x2a IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a003600 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa003600 0x0 0x200>;
+ interrupts = <GIC_SPI 0x2b IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a003800 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa003800 0x0 0x200>;
+ interrupts = <GIC_SPI 0x2c IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a003a00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa003a00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x2d IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a003c00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa003c00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x2e IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a003e00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa003e00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x2f IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+};
diff --git a/arch/arm/dts/qemu-virt64.dts b/arch/arm/dts/qemu-virt64.dts
new file mode 100644
index 000000000000..0fc98c22cd5f
--- /dev/null
+++ b/arch/arm/dts/qemu-virt64.dts
@@ -0,0 +1,403 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/input/linux-event-codes.h>
+
+/dts-v1/;
+
+/ {
+ compatible = "linux,dummy-virt";
+ model = "linux,dummy-virt";
+ interrupt-parent = <&gic>;
+ #address-cells = <2>;
+ #size-cells = <2>;
+
+ chosen {
+ stdout-path = &uart0;
+ };
+
+ psci {
+ compatible = "arm,psci-1.0", "arm,psci-0.2", "arm,psci";
+ method = "hvc";
+ migrate = <0xc4000005>;
+ cpu_on = <0xc4000003>;
+ cpu_off = <0x84000002>;
+ cpu_suspend = <0xc4000001>;
+ };
+
+ memory@40000000 {
+ reg = <0x0 0x40000000 0x0 0x40000000>;
+ device_type = "memory";
+ };
+
+ flash@0 {
+ compatible = "cfi-flash";
+ reg = <0x0 0x0 0x0 0x4000000>, <0x0 0x4000000 0x0 0x4000000>;
+ bank-width = <4>;
+ };
+
+ clk_24mhz: apb-pclk {
+ compatible = "fixed-clock";
+ clock-frequency = <24000000>;
+ clock-output-names = "clk24mhz";
+ #clock-cells = <0>;
+ };
+
+ platform-bus@c000000 {
+ compatible = "qemu,platform", "simple-bus";
+ ranges = <0x0 0x0 0xc000000 0x2000000>;
+ interrupt-parent = <&gic>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+ };
+
+ fw-cfg@9020000 {
+ compatible = "qemu,fw-cfg-mmio";
+ reg = <0x0 0x9020000 0x0 0x18>;
+ dma-coherent;
+ };
+
+ gpio-keys {
+ compatible = "gpio-keys";
+
+ poweroff {
+ gpios = <&gpio 3 GPIO_ACTIVE_HIGH>;
+ linux,code = <KEY_POWER>;
+ label = "GPIO Key Poweroff";
+ };
+ };
+
+ gpio: pl061@9030000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0x0 0x9030000 0x0 0x1000>;
+ clock-names = "apb_pclk";
+ clocks = <&clk_24mhz>;
+ interrupts = <GIC_SPI 0x07 IRQ_TYPE_LEVEL_HIGH>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ };
+
+ pcie@10000000 {
+ compatible = "pci-host-ecam-generic";
+ device_type = "pci";
+ interrupt-map-mask = <0x1800 0x0 0x0 0x07>;
+ interrupt-map = <0x0000 0 0 1 &gic 0 0 GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
+ <0x0000 0 0 2 &gic 0 0 GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
+ <0x0000 0 0 3 &gic 0 0 GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>,
+ <0x0000 0 0 4 &gic 0 0 GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
+ <0x0800 0 0 1 &gic 0 0 GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
+ <0x0800 0 0 2 &gic 0 0 GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>,
+ <0x0800 0 0 3 &gic 0 0 GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
+ <0x0800 0 0 4 &gic 0 0 GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
+ <0x1000 0 0 1 &gic 0 0 GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>,
+ <0x1000 0 0 2 &gic 0 0 GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
+ <0x1000 0 0 3 &gic 0 0 GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
+ <0x1000 0 0 4 &gic 0 0 GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
+ <0x1800 0 0 1 &gic 0 0 GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
+ <0x1800 0 0 2 &gic 0 0 GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
+ <0x1800 0 0 3 &gic 0 0 GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
+ <0x1800 0 0 4 &gic 0 0 GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>;
+ #interrupt-cells = <1>;
+ ranges = <0x1000000 0 0 0 0x3eff0000 0 0x10000>,
+ <0x2000000 0 0x10000000 0 0x10000000 0 0x2eff0000>;
+ reg = <0x0 0x3f000000 0x0 0x1000000>;
+ msi-map = <0x0 &gic_its 0x0 0x10000>;
+ dma-coherent;
+ bus-range = <0 0xf>;
+ linux,pci-domain = <0>;
+ #address-cells = <3>;
+ #size-cells = <2>;
+ };
+
+ pl031@9010000 {
+ compatible = "arm,pl031", "arm,primecell";
+ reg = <0x0 0x9010000 0x0 0x1000>;
+ clock-names = "apb_pclk";
+ clocks = <&clk_24mhz>;
+ interrupts = <GIC_SPI 0x02 IRQ_TYPE_LEVEL_HIGH>;
+ };
+
+ uart0: pl011@9000000 {
+ compatible = "arm,pl011", "arm,primecell";
+ reg = <0x0 0x9000000 0x0 0x1000>;
+ clock-names = "uartclk", "apb_pclk";
+ clocks = <&clk_24mhz>, <&clk_24mhz>;
+ interrupts = <GIC_SPI 0x01 IRQ_TYPE_LEVEL_HIGH>;
+ };
+
+ pmu {
+ compatible = "arm,armv8-pmuv3";
+ interrupts = <GIC_PPI 0x07 (GIC_CPU_MASK_RAW(1) | IRQ_TYPE_LEVEL_HIGH)>;
+ };
+
+ gic: intc@8000000 {
+ compatible = "arm,cortex-a15-gic";
+ reg = <0x0 0x8000000 0x0 0x10000>, <0x0 0x8010000 0x0 0x10000>;
+ ranges;
+ interrupt-controller;
+ #interrupt-cells = <3>;
+ #address-cells = <2>;
+ #size-cells = <2>;
+
+ gic_its: v2m@8020000 {
+ compatible = "arm,gic-v2m-frame";
+ reg = <0x0 0x8020000 0x0 0x1000>;
+ msi-controller;
+ };
+ };
+
+ cpus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ cpu0: cpu@0 {
+ compatible = "arm,cortex-a57";
+ device_type = "cpu";
+ reg = <0>;
+ };
+
+ cpu-map {
+ socket0 {
+ cluster0 {
+ core0 {
+ cpu = <&cpu0>;
+ };
+ };
+ };
+ };
+ };
+
+ timer {
+ compatible = "arm,armv8-timer", "arm,armv7-timer";
+ interrupts = <GIC_PPI 0x0d (GIC_CPU_MASK_RAW(1) | IRQ_TYPE_LEVEL_HIGH)>,
+ <GIC_PPI 0x0e (GIC_CPU_MASK_RAW(1) | IRQ_TYPE_LEVEL_HIGH)>,
+ <GIC_PPI 0x0b (GIC_CPU_MASK_RAW(1) | IRQ_TYPE_LEVEL_HIGH)>,
+ <GIC_PPI 0x0a (GIC_CPU_MASK_RAW(1) | IRQ_TYPE_LEVEL_HIGH)>;
+ always-on;
+ };
+
+ virtio_mmio@a000000 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa000000 0x0 0x200>;
+ interrupts = <GIC_SPI 0x10 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a000200 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa000200 0x0 0x200>;
+ interrupts = <GIC_SPI 0x11 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a000400 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa000400 0x0 0x200>;
+ interrupts = <GIC_SPI 0x12 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a000600 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa000600 0x0 0x200>;
+ interrupts = <GIC_SPI 0x13 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a000800 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa000800 0x0 0x200>;
+ interrupts = <GIC_SPI 0x14 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a000a00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa000a00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x15 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a000c00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa000c00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x16 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a000e00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa000e00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x17 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a001000 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa001000 0x0 0x200>;
+ interrupts = <GIC_SPI 0x18 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a001200 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa001200 0x0 0x200>;
+ interrupts = <GIC_SPI 0x19 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a001400 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa001400 0x0 0x200>;
+ interrupts = <GIC_SPI 0x1a IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a001600 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa001600 0x0 0x200>;
+ interrupts = <GIC_SPI 0x1b IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a001800 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa001800 0x0 0x200>;
+ interrupts = <GIC_SPI 0x1c IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a001a00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa001a00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x1d IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a001c00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa001c00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x1e IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a001e00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa001e00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x1f IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a002000 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa002000 0x0 0x200>;
+ interrupts = <GIC_SPI 0x20 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a002200 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa002200 0x0 0x200>;
+ interrupts = <GIC_SPI 0x21 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a002400 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa002400 0x0 0x200>;
+ interrupts = <GIC_SPI 0x22 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a002600 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa002600 0x0 0x200>;
+ interrupts = <GIC_SPI 0x23 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a002800 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa002800 0x0 0x200>;
+ interrupts = <GIC_SPI 0x24 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a002a00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa002a00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x25 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a002c00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa002c00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x26 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a002e00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa002e00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x27 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a003000 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa003000 0x0 0x200>;
+ interrupts = <GIC_SPI 0x28 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a003200 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa003200 0x0 0x200>;
+ interrupts = <GIC_SPI 0x29 IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a003400 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa003400 0x0 0x200>;
+ interrupts = <GIC_SPI 0x2a IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a003600 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa003600 0x0 0x200>;
+ interrupts = <GIC_SPI 0x2b IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a003800 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa003800 0x0 0x200>;
+ interrupts = <GIC_SPI 0x2c IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a003a00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa003a00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x2d IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a003c00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa003c00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x2e IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+
+ virtio_mmio@a003e00 {
+ compatible = "virtio,mmio";
+ reg = <0x0 0xa003e00 0x0 0x200>;
+ interrupts = <GIC_SPI 0x2f IRQ_TYPE_EDGE_RISING>;
+ dma-coherent;
+ };
+};
--
2.39.5
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 02/13] treewide: collect the name of all board device trees
2025-01-12 8:34 [PATCH 00/13] images: add barebox FIT image target Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 01/13] ARM: dts: add device trees for the QEMU Virt machine Ahmad Fatoum
@ 2025-01-12 8:34 ` Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 03/13] kbuild: collect available device trees in dtbs-list Ahmad Fatoum
` (12 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Ahmad Fatoum @ 2025-01-12 8:34 UTC (permalink / raw)
To: barebox; +Cc: Felix Singer, Ahmad Fatoum
Linux collects device trees by adding them to dtb-y, but in barebox we
just add them normally to obj- or pbl- (or lwl-) and have rules matching
the .dtb.o extension take care of invoking the device tree compiler.
In preparation for assembling a list of all enabled device trees, let's
introduce dtb- and dtb-y variables like in Linux, which will hold the
list of enabled device trees.
As we are not interested in the device trees added by unit tests, we
will ignore any device trees outside of pbl-y and lwl-y and change
existing board device trees for non-PBL platforms to use lwl- instead.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/kvx/dts/Makefile | 4 ++--
arch/openrisc/dts/Makefile | 2 +-
arch/sandbox/dts/Makefile | 2 +-
scripts/Makefile.lib | 3 +++
4 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/arch/kvx/dts/Makefile b/arch/kvx/dts/Makefile
index 41613033ce81..597b905624de 100644
--- a/arch/kvx/dts/Makefile
+++ b/arch/kvx/dts/Makefile
@@ -6,9 +6,9 @@ obj- += dummy.o
BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_NAME))
ifneq ($(BUILTIN_DTB),)
-obj-$(CONFIG_BUILTIN_DTB) += $(BUILTIN_DTB).dtb.o
+lwl-$(CONFIG_BUILTIN_DTB) += $(BUILTIN_DTB).dtb.o
endif
-obj-$(CONFIG_BOARD_K200) += k200.dtb.o
+lwl-$(CONFIG_BOARD_K200) += k200.dtb.o
clean-files := *.dtb *.dtb.S .*.dtc .*.pre .*.dts *.dtb.z
diff --git a/arch/openrisc/dts/Makefile b/arch/openrisc/dts/Makefile
index 6778abe1b4fd..01cb2195fda3 100644
--- a/arch/openrisc/dts/Makefile
+++ b/arch/openrisc/dts/Makefile
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_NAME))
-obj-$(CONFIG_BUILTIN_DTB) += $(BUILTIN_DTB).dtb.o
+lwl-$(CONFIG_BUILTIN_DTB) += $(BUILTIN_DTB).dtb.o
clean-files := *.dtb *.dtb.S .*.dtc .*.pre .*.dts *.dtb.z
diff --git a/arch/sandbox/dts/Makefile b/arch/sandbox/dts/Makefile
index 79625b103eba..5eb6aeeb14cb 100644
--- a/arch/sandbox/dts/Makefile
+++ b/arch/sandbox/dts/Makefile
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
-obj-$(CONFIG_OFTREE) += \
+lwl-$(CONFIG_OFTREE) += \
sandbox.dtb.o
# just to build a built-in.o. Otherwise compilation fails when no devicetree is
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index c32adf07cc51..0dfb496777dd 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -35,6 +35,9 @@ else
obj-y += $(lwl-y)
endif
+dtb- += $(patsubst %.dtb.o,%.dtb,$(filter %.dtb.o,$(pbl-) $(lwl-)))
+dtb-y += $(patsubst %.dtb.o,%.dtb,$(filter %.dtb.o,$(pbl-y) $(lwl-y)))
+
obj-y += $(obj-pbl-y)
pbl-y += $(obj-pbl-y)
--
2.39.5
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 03/13] kbuild: collect available device trees in dtbs-list
2025-01-12 8:34 [PATCH 00/13] images: add barebox FIT image target Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 01/13] ARM: dts: add device trees for the QEMU Virt machine Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 02/13] treewide: collect the name of all board device trees Ahmad Fatoum
@ 2025-01-12 8:34 ` Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 04/13] scripts: add new scripts_dtc target Ahmad Fatoum
` (11 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Ahmad Fatoum @ 2025-01-12 8:34 UTC (permalink / raw)
To: barebox; +Cc: Felix Singer, Ahmad Fatoum
Now that we have a dtb-y variable containing all board device trees,
let's import some Linux Kbuild code, so barebox can also maintain a list
of built device trees in arch/$ARCH/dts/dtbs-list.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
.gitignore | 1 +
Makefile | 1 +
scripts/Makefile.build | 11 +++++++++++
scripts/Makefile.dtbs | 32 ++++++++++++++++++++++++++++++++
4 files changed, 45 insertions(+)
create mode 100644 scripts/Makefile.dtbs
diff --git a/.gitignore b/.gitignore
index 5e1b0c2b68ff..0bee67af4881 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,6 +36,7 @@
*.tab.[ch]
binary.0
Module.symvers
+dtbs-list
*.dtb
*.dtb.*
*.dtbo
diff --git a/Makefile b/Makefile
index d5d02f4efe15..5f5f830af5d2 100644
--- a/Makefile
+++ b/Makefile
@@ -1238,6 +1238,7 @@ clean: archclean $(clean-dirs)
\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
-o -name '*lex.c' -o -name '.tab.[ch]' \
+ -o -name 'dtbs-list' \
-o -name '*.symtypes' -o -name '*.bbenv.*' -o -name "*.bbenv" \) \
-type f -print | xargs rm -f
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 1c511d38a12b..591da3d750ec 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -56,12 +56,23 @@ ifneq ($(userprogs),)
include scripts/Makefile.userprogs
endif
+ifneq ($(need-dtbslist)$(dtb-y)$(dtb-)$(filter %.dtb %.dtb.o %.dtbo.o,$(targets)),)
+include $(srctree)/scripts/Makefile.dtbs
+endif
+
ifndef obj
$(warning kbuild: Makefile.build is included improperly)
endif
# ===========================================================================
+# This is a list of build artifacts from the current Makefile and its
+# sub-directories. The timestamp should be updated when any of the member files.
+
+cmd_gen_order = { $(foreach m, $(real-prereqs), \
+ $(if $(filter %/$(notdir $@), $m), cat $m, echo $m);) :; } \
+ > $@
+
ifneq ($(strip $(lib-y) $(lib-m) $(lib-n) $(lib-)),)
lib-target := $(obj)/lib.a
endif
diff --git a/scripts/Makefile.dtbs b/scripts/Makefile.dtbs
new file mode 100644
index 000000000000..046361c20a6a
--- /dev/null
+++ b/scripts/Makefile.dtbs
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+# If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
+dtb-$(CONFIG_OF_ALL_DTBS) += $(dtb-)
+
+# Composite DTB (i.e. DTB constructed by overlay)
+multi-dtb-y := $(call multi-search, $(dtb-y), .dtb, -dtbs)
+# Primitive DTB compiled from *.dts
+real-dtb-y := $(call real-search, $(dtb-y), .dtb, -dtbs)
+# Base DTB that overlay is applied onto
+base-dtb-y := $(filter %.dtb, $(call real-search, $(multi-dtb-y), .dtb, -dtbs))
+
+dtb-y := $(addprefix $(obj)/, $(dtb-y))
+multi-dtb-y := $(addprefix $(obj)/, $(multi-dtb-y))
+real-dtb-y := $(addprefix $(obj)/, $(real-dtb-y))
+
+always-y += $(dtb-y)
+targets += $(real-dtb-y)
+
+# dtbs-list
+# ---------------------------------------------------------------------------
+
+ifdef need-dtbslist
+subdir-dtbslist := $(addsuffix /dtbs-list, $(subdir-ym))
+dtb-y += $(subdir-dtbslist)
+always-y += $(obj)/dtbs-list
+endif
+
+$(subdir-dtbslist): $(obj)/%/dtbs-list: $(obj)/% ;
+
+$(obj)/dtbs-list: $(dtb-y) FORCE
+ $(call if_changed,gen_order)
--
2.39.5
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 04/13] scripts: add new scripts_dtc target
2025-01-12 8:34 [PATCH 00/13] images: add barebox FIT image target Ahmad Fatoum
` (2 preceding siblings ...)
2025-01-12 8:34 ` [PATCH 03/13] kbuild: collect available device trees in dtbs-list Ahmad Fatoum
@ 2025-01-12 8:34 ` Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 05/13] kbuild: restrict dtbs target to enabled DTs by default Ahmad Fatoum
` (10 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Ahmad Fatoum @ 2025-01-12 8:34 UTC (permalink / raw)
To: barebox; +Cc: Felix Singer, Ahmad Fatoum
Later commit will add a target for building all enabled device trees.
For this to work, we need to build the device tree compiler first, but
there is only a scripts target, which builds many extra tools
unnecessary for a mere device tree compilation.
Therefore, let's split that up and add a new scripts_dtc target that can
be depended on separately.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Makefile | 6 +++++-
scripts/Makefile | 3 +--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index 5f5f830af5d2..82f90373cbbd 100644
--- a/Makefile
+++ b/Makefile
@@ -1032,7 +1032,7 @@ include/config/kernel.release: FORCE
# Carefully list dependencies so we do not try to build scripts twice
# in parallel
PHONY += scripts
-scripts: scripts_basic include/generated/utsrelease.h
+scripts: scripts_basic scripts_dtc include/generated/utsrelease.h
$(Q)$(MAKE) $(build)=$(@)
# Things we need to do before we recursively start building the kernel
@@ -1121,6 +1121,10 @@ dtbs: $(all_dtbs)
endif
+PHONY += scripts_dtc
+scripts_dtc: scripts_basic
+ $(Q)$(MAKE) $(build)=scripts/dtc
+
# ---------------------------------------------------------------------------
# Modules
diff --git a/scripts/Makefile b/scripts/Makefile
index a780f05bd90f..6d89af7d4f35 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -62,8 +62,7 @@ userccflags += -I $(srctree)/$(src)/include -isystem $(srctree)/scripts/include
subdir-y += mod
subdir-y += imx
-subdir-$(CONFIG_DTC) += dtc
subdir-$(CONFIG_ARCH_TEGRA) += tegra
# Let clean descend into subdirs
-subdir- += basic kconfig
+subdir- += basic dtc kconfig
--
2.39.5
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 05/13] kbuild: restrict dtbs target to enabled DTs by default
2025-01-12 8:34 [PATCH 00/13] images: add barebox FIT image target Ahmad Fatoum
` (3 preceding siblings ...)
2025-01-12 8:34 ` [PATCH 04/13] scripts: add new scripts_dtc target Ahmad Fatoum
@ 2025-01-12 8:34 ` Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 06/13] kbuild: improve make help description Ahmad Fatoum
` (9 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Ahmad Fatoum @ 2025-01-12 8:34 UTC (permalink / raw)
To: barebox; +Cc: Felix Singer, Ahmad Fatoum
Our existing dtbs target is fairly primitive and builds just all device
trees in the architecture folder without regard to whether they are even
wired in the Makefile or not.
Now that we have a list of all device trees in the form of dtbs-list,
let's rework the dtbs target to make use of it. The old behavior of
building all device trees can still be achieved by enabling
CONFIG_OF_ALL_DTBS.
In order to have dtbs-list updated always, it's also added to the
dependencies of the images target. That way, a FIT image target that
will be added in a later commit can reliably depend on that file to be
available.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Makefile | 22 +++++++++++++++++-----
drivers/of/Kconfig | 11 +++++++++++
2 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 82f90373cbbd..75e994e5ac1a 100644
--- a/Makefile
+++ b/Makefile
@@ -1114,10 +1114,22 @@ endif
ifneq ($(dtstree),)
-PHONY += dtbs
-all_dtbs += $(patsubst $(srctree)/%.dts,$(objtree)/%.dtb,$(wildcard $(srctree)/$(dtstree)/*.dts))
-targets += $(all_dtbs)
-dtbs: $(all_dtbs)
+%.dtb: dtbs_prepare
+ $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
+
+%.dtbo: dtbs_prepare
+ $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
+
+PHONY += dtbs dtbs_prepare
+dtbs: dtbs_prepare
+ $(Q)$(MAKE) $(build)=$(dtstree) need-dtbslist=1
+
+dtbs_prepare: include/config/kernel.release scripts_dtc
+
+ifdef CONFIG_OFDEVICE
+images: dtbs
+images/%: dtbs
+endif
endif
@@ -1322,7 +1334,7 @@ help:
@echo ''
@$(if $(dtstree), \
echo ' Devicetree:'; \
- echo ' * dtbs - Build device tree blobs for all boards'; \
+ echo ' * dtbs - Build device tree blobs for enabled boards'; \
echo '')
@$(if $(boards), \
$(foreach b, $(boards), \
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index 6c9aedf355b4..ebc8842f5e38 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -3,6 +3,17 @@ config OFTREE
select DTC
bool
+config OF_ALL_DTBS
+ bool "Build all Device Tree Blobs"
+ depends on OFTREE && COMPILE_TEST
+ select DTC
+ help
+ This option builds all possible Device Tree Blobs (DTBs) for the
+ current architecture.
+
+ If unsure, say N here, but this option is safe to enable.
+
+
config OFTREE_MEM_GENERIC
depends on OFTREE
depends on PPC || ARM || EFI_PAYLOAD || OPENRISC || SANDBOX || RISCV || KVX
--
2.39.5
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 06/13] kbuild: improve make help description
2025-01-12 8:34 [PATCH 00/13] images: add barebox FIT image target Ahmad Fatoum
` (4 preceding siblings ...)
2025-01-12 8:34 ` [PATCH 05/13] kbuild: restrict dtbs target to enabled DTs by default Ahmad Fatoum
@ 2025-01-12 8:34 ` Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 07/13] kbuild: allow dependency on any file in images/ Ahmad Fatoum
` (8 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Ahmad Fatoum @ 2025-01-12 8:34 UTC (permalink / raw)
To: barebox; +Cc: Felix Singer, Ahmad Fatoum
The help text was taken from Linux' Kbuild and isn't up-to-date with
what's supported in barebox. Before extending it further, let's align it
with what's actually supported in barebox.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Makefile | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 75e994e5ac1a..a86f1084cd5c 100644
--- a/Makefile
+++ b/Makefile
@@ -1316,18 +1316,19 @@ help:
@echo ''
@echo 'Other generic targets:'
@echo ' all - Build all targets marked with [*]'
- @echo '* barebox - Build the bare kernel'
+ @echo '* barebox - Build the barebox proper binary'
+ifdef CONFIG_PBL_IMAGE
+ @echo '* images - Build final prebootloader-prefixed images'
+endif
@echo ' dir/ - Build all files in dir and below'
@echo ' dir/file.[ois] - Build specified target only'
@echo ' dir/file.ko - Build module including final link'
+ @echo ' compile_commands.json'
+ @echo ' - Generate compilation database for IDEs/LSP'
@echo ' tags/TAGS - Generate tags file for editors'
@echo ' cscope - Generate cscope index'
@echo ' (default: $(INSTALL_HDR_PATH))'
@echo ''
- @echo 'Static analysers'
- @echo ' checkstack - Generate a list of stack hogs'
- @echo ' namespacecheck - Name space analysis on compiled kernel'
- @echo ''
@echo 'Architecture specific targets ($(SRCARCH)):'
@$(if $(archhelp),$(archhelp),\
echo ' No architecture specific help defined for $(SRCARCH)')
--
2.39.5
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 07/13] kbuild: allow dependency on any file in images/
2025-01-12 8:34 [PATCH 00/13] images: add barebox FIT image target Ahmad Fatoum
` (5 preceding siblings ...)
2025-01-12 8:34 ` [PATCH 06/13] kbuild: improve make help description Ahmad Fatoum
@ 2025-01-12 8:34 ` Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 08/13] arch: maintain Linux kernel and mkimage ARCH mapping in Kconfig Ahmad Fatoum
` (7 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Ahmad Fatoum @ 2025-01-12 8:34 UTC (permalink / raw)
To: barebox; +Cc: Felix Singer, Ahmad Fatoum
The multi defconfigs build a lot of images, which is nice for coverage,
but users may only be interested in the second stage barebox-dt-2nd.img
for example.
To allow them to build only that one without having to wade through
menuconfig, let's allow specifying the image directly, e.g.:
make images/barebox-dt-2nd.img
And only that image will be built.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index a86f1084cd5c..81a89d1c0ad4 100644
--- a/Makefile
+++ b/Makefile
@@ -789,7 +789,7 @@ barebox-flash-images: $(KBUILD_IMAGE)
images: barebox.bin FORCE
$(Q)$(MAKE) $(build)=images $@
-images/%.s: barebox.bin FORCE
+images/%: barebox.bin FORCE
$(Q)$(MAKE) $(build)=images $@
ifdef CONFIG_EFI_STUB
--
2.39.5
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 08/13] arch: maintain Linux kernel and mkimage ARCH mapping in Kconfig
2025-01-12 8:34 [PATCH 00/13] images: add barebox FIT image target Ahmad Fatoum
` (6 preceding siblings ...)
2025-01-12 8:34 ` [PATCH 07/13] kbuild: allow dependency on any file in images/ Ahmad Fatoum
@ 2025-01-12 8:34 ` Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 09/13] arch: make BOARD_GENERIC_DT a user-selectable option across archs Ahmad Fatoum
` (6 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Ahmad Fatoum @ 2025-01-12 8:34 UTC (permalink / raw)
To: barebox; +Cc: Felix Singer, Ahmad Fatoum
How barebox calls the architectures it supports differs from both the
names used in the Linux kernel and in mkimage.
For easier interoperability with the two, especially in scripts, add
config options that hold the relevant names.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/Kconfig | 8 ++++++++
arch/arm/Kconfig | 9 +++++++++
arch/mips/Kconfig | 9 +++++++++
arch/openrisc/Kconfig | 4 ++++
arch/powerpc/Kconfig | 8 ++++++++
arch/riscv/Kconfig | 9 +++++++++
arch/sandbox/Kconfig | 4 ++++
arch/x86/Kconfig | 10 ++++++++++
8 files changed, 61 insertions(+)
diff --git a/arch/Kconfig b/arch/Kconfig
index 671e6a0e979d..f6ac75eafd11 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -21,3 +21,11 @@ config ARCH_DMA_DEFAULT_COHERENT
config ARCH_HAS_ASAN_FIBER_API
bool
+
+config ARCH_LINUX_NAME
+ string
+ default "$(SRCARCH)"
+
+config ARCH_MKIMAGE_NAME
+ string
+ default "invalid"
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f2c0f44e7487..df730b96b815 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -16,6 +16,15 @@ config ARM
select USE_COMPRESSED_DTB
default y
+config ARCH_LINUX_NAME
+ string
+ default "arm" if ARM32
+ default "arm64" if ARM64
+
+config ARCH_MKIMAGE_NAME
+ string
+ default ARCH_LINUX_NAME
+
config ARM32
def_bool CPU_32
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 14062dee3471..769949a91085 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -14,6 +14,15 @@ config MIPS
select ELF
default y
+config ARCH_LINUX_NAME
+ string
+ default "mips64" if CPU_SUPPORTS_64BIT_KERNEL
+ default "mips"
+
+config ARCH_MKIMAGE_NAME
+ string
+ default ARCH_LINUX_NAME
+
config SYS_SUPPORTS_BIG_ENDIAN
bool
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 102071686e4f..6b64b299b391 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -10,6 +10,10 @@ config OPENRISC
select HAS_DEBUG_LL
default y
+config ARCH_MKIMAGE_NAME
+ string
+ default "or1k"
+
# not used
config ARCH_TEXT_BASE
hex
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index ba875767b2f8..6346594173ac 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -11,6 +11,14 @@ config PPC
select ARCH_HAS_SJLJ
default y
+config ARCH_LINUX_NAME
+ string
+ default "ppc"
+
+config ARCH_MKIMAGE_NAME
+ string
+ default "powerpc"
+
choice
prompt "Processor type"
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 8f2cd089a213..ad724565d7bb 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -18,6 +18,15 @@ config RISCV
select RISCV_TIMER if RISCV_SBI
select HW_HAS_PCI
+config ARCH_LINUX_NAME
+ string
+ default "riscv" if ARCH_RV32I
+ default "riscv64" if ARCH_RV64I
+
+config ARCH_MKIMAGE_NAME
+ string
+ default "riscv"
+
config ARCH_TEXT_BASE
hex
default 0x0
diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig
index d5b37de1843b..0b6cc75098be 100644
--- a/arch/sandbox/Kconfig
+++ b/arch/sandbox/Kconfig
@@ -22,6 +22,10 @@ config SANDBOX
select BAREBOX_CMDLINE
default y
+config ARCH_LINUX_NAME
+ string
+ default "um"
+
config ARCH_TEXT_BASE
hex
default 0x00000000
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index aab0c3c63261..cea8e25b81f0 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -9,6 +9,16 @@ config X86
select HAVE_EFI_PAYLOAD
default y
+config ARCH_LINUX_NAME
+ string
+ default "i386" if X86_32
+ default "x86_64" if X86_64
+
+config ARCH_MKIMAGE_NAME
+ string
+ default "x86" if X86_32
+ default "x86_64" if X86_64
+
config ARCH_TEXT_BASE
hex
default 0x0
--
2.39.5
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 09/13] arch: make BOARD_GENERIC_DT a user-selectable option across archs
2025-01-12 8:34 [PATCH 00/13] images: add barebox FIT image target Ahmad Fatoum
` (7 preceding siblings ...)
2025-01-12 8:34 ` [PATCH 08/13] arch: maintain Linux kernel and mkimage ARCH mapping in Kconfig Ahmad Fatoum
@ 2025-01-12 8:34 ` Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 10/13] images: add barebox FIT image target Ahmad Fatoum
` (5 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Ahmad Fatoum @ 2025-01-12 8:34 UTC (permalink / raw)
To: barebox; +Cc: Felix Singer, Ahmad Fatoum
Instead of having one option per architecture, let's give the existing
BOARD_GENERIC_DT option a prompt and make architecture specific options,
if any, depend on it instead.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Documentation/devicetree/index.rst | 4 ++--
Documentation/user/barebox.rst | 6 +++---
arch/Kconfig | 18 ++++++++++++++++++
arch/arm/Kconfig | 6 +++---
arch/arm/configs/multi_v5_v6_defconfig | 2 +-
arch/arm/configs/rockchip_v7a_defconfig | 2 +-
arch/arm/configs/rockchip_v8_defconfig | 2 +-
arch/arm/configs/rpi_defconfig | 2 +-
arch/arm/configs/stm32mp_defconfig | 2 +-
arch/riscv/Kconfig | 10 +---------
arch/riscv/Kconfig.socs | 2 +-
arch/riscv/configs/rv64i_defconfig | 2 +-
12 files changed, 34 insertions(+), 24 deletions(-)
diff --git a/Documentation/devicetree/index.rst b/Documentation/devicetree/index.rst
index f85ce6608d14..cd9270da1d21 100644
--- a/Documentation/devicetree/index.rst
+++ b/Documentation/devicetree/index.rst
@@ -120,7 +120,7 @@ from the `Device-Tree Compiler`_ project.
.. _Device-Tree Compiler: https://git.kernel.org/pub/scm/utils/dtc/dtc.git
These utilities are built as part of the barebox build process. Additionally,
-libfdt is compiled once more as part of the ``CONFIG_BOARD_ARM_GENERIC_DT``
+libfdt is compiled once more as part of the ``CONFIG_BOARD_GENERIC_DT``
if selected.
Steps to update ``scripts/dtc``:
@@ -129,7 +129,7 @@ Steps to update ``scripts/dtc``:
directory of your barebox ``git-checkout``.
* Run ``scripts/dtc/update-dtc-source.sh`` from the top-level barebox directory.
* Wait till ``dtc`` build, test, install and commit conclude.
-* Compile-test with ``CONFIG_BOARD_ARM_GENERIC_DT=y``.
+* Compile-test with ``CONFIG_BOARD_GENERIC_DT=y``.
* If ``scripts/dtc/Makefile`` or barebox include file changes are necessary,
apply them manually in a commit preceding the ``dtc`` update.
diff --git a/Documentation/user/barebox.rst b/Documentation/user/barebox.rst
index 43e5a631ba1a..c6969ae3de1d 100644
--- a/Documentation/user/barebox.rst
+++ b/Documentation/user/barebox.rst
@@ -204,9 +204,9 @@ Bringing barebox to a board for the first time is highly board specific, see you
board documentation for initial bringup.
For ARM and RISC-V, the barebox build can additionally generate a generic DT image
-(enable ``CONFIG_BOARD_ARM_GENERIC_DT`` or ``CONFIG_BOARD_RISCV_GENERIC_DT``,
-respectively). The resulting ``images/barebox-dt-2nd.img`` can be booted just
-like a Linux kernel that is passed an external device tree. For example:
+(enable ``CONFIG_BOARD_GENERIC_DT``). The resulting ``images/barebox-dt-2nd.img``
+can be booted just like a Linux kernel that is passed an external device tree.
+For example:
.. code-block:: console
diff --git a/arch/Kconfig b/arch/Kconfig
index f6ac75eafd11..e1c08bcd7b99 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -29,3 +29,21 @@ config ARCH_LINUX_NAME
config ARCH_MKIMAGE_NAME
string
default "invalid"
+
+config HAVE_ARCH_BOARD_GENERIC_DT
+ bool
+
+menu "General architecture-dependent options"
+
+config BOARD_GENERIC_DT
+ depends on HAVE_ARCH_BOARD_GENERIC_DT
+ bool "Build generic device tree 2nd stage image"
+ default y
+ help
+ This enables compilation of a generic image that can be started 2nd
+ stage from qemu, barebox, or other bootloaders. It picks up a device
+ tree passed by the Linux kernel's boot convention for the given
+ architecture and thus can be used anywhere that a Kernel image could be used.
+ The image will be called images/barebox-dt-2nd.img
+
+endmenu
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index df730b96b815..1bf30a126dc5 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -14,6 +14,7 @@ config ARM
select RELOCATABLE
select PBL_RELOCATABLE
select USE_COMPRESSED_DTB
+ select HAVE_ARCH_BOARD_GENERIC_DT if OFDEVICE
default y
config ARCH_LINUX_NAME
@@ -269,15 +270,14 @@ source "arch/arm/mach-zynqmp/Kconfig"
config BOARD_ARM_VIRT
bool
- select BOARD_ARM_GENERIC_DT
+ select BOARD_GENERIC_DT
select BOARD_QEMU_VIRT
select OF_OVERLAY
config BOARD_ARM_GENERIC_DT
- select BOARD_GENERIC_DT
+ def_bool BOARD_GENERIC_DT
select ARM_AMBA
depends on OFDEVICE
- bool "Build generic ARM device tree 2nd stage image"
help
This enables compilation of a generic image that can be started 2nd
stage from barebox or from qemu. It picks up a device tree passed
diff --git a/arch/arm/configs/multi_v5_v6_defconfig b/arch/arm/configs/multi_v5_v6_defconfig
index d668ad6a8c22..7748ec43b0ce 100644
--- a/arch/arm/configs/multi_v5_v6_defconfig
+++ b/arch/arm/configs/multi_v5_v6_defconfig
@@ -8,7 +8,7 @@ CONFIG_MACH_PCA100=y
CONFIG_MACH_PCM038=y
CONFIG_IMX_IIM=y
CONFIG_IMX_IIM_FUSE_BLOW=y
-CONFIG_BOARD_ARM_GENERIC_DT=y
+CONFIG_BOARD_GENERIC_DT=y
CONFIG_AEABI=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
diff --git a/arch/arm/configs/rockchip_v7a_defconfig b/arch/arm/configs/rockchip_v7a_defconfig
index 5dc41bff3556..378ceb0e43f4 100644
--- a/arch/arm/configs/rockchip_v7a_defconfig
+++ b/arch/arm/configs/rockchip_v7a_defconfig
@@ -2,7 +2,7 @@ CONFIG_ARCH_ROCKCHIP=y
CONFIG_CACHE_L2X0=y
CONFIG_MACH_RADXA_ROCK=y
CONFIG_MACH_PHYTEC_SOM_RK3288=y
-CONFIG_BOARD_ARM_GENERIC_DT=y
+CONFIG_BOARD_GENERIC_DT=y
CONFIG_THUMB2_BAREBOX=y
CONFIG_ARM_BOARD_APPEND_ATAG=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
diff --git a/arch/arm/configs/rockchip_v8_defconfig b/arch/arm/configs/rockchip_v8_defconfig
index 6dbfd9a49c7f..83799ac492e7 100644
--- a/arch/arm/configs/rockchip_v8_defconfig
+++ b/arch/arm/configs/rockchip_v8_defconfig
@@ -7,7 +7,7 @@ CONFIG_MACH_PROTONIC_MECSBC=y
CONFIG_MACH_RADXA_ROCK3=y
CONFIG_MACH_RADXA_ROCK5=y
CONFIG_MACH_RADXA_CM3=y
-CONFIG_BOARD_ARM_GENERIC_DT=y
+CONFIG_BOARD_GENERIC_DT=y
CONFIG_64BIT=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_PSCI_CLIENT=y
diff --git a/arch/arm/configs/rpi_defconfig b/arch/arm/configs/rpi_defconfig
index 500c92a8218e..b280704ff187 100644
--- a/arch/arm/configs/rpi_defconfig
+++ b/arch/arm/configs/rpi_defconfig
@@ -3,7 +3,7 @@ CONFIG_MACH_RPI=y
CONFIG_MACH_RPI2=y
CONFIG_MACH_RPI3=y
CONFIG_MACH_RPI_CM3=y
-CONFIG_BOARD_ARM_GENERIC_DT=y
+CONFIG_BOARD_GENERIC_DT=y
CONFIG_AEABI=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
diff --git a/arch/arm/configs/stm32mp_defconfig b/arch/arm/configs/stm32mp_defconfig
index 6ca11e5c2d7a..41e6540c55a2 100644
--- a/arch/arm/configs/stm32mp_defconfig
+++ b/arch/arm/configs/stm32mp_defconfig
@@ -7,7 +7,7 @@ CONFIG_MACH_STM32MP15X_EV1=y
CONFIG_MACH_PROTONIC_STM32MP1=y
CONFIG_MACH_PROTONIC_STM32MP13=y
CONFIG_MACH_PHYTEC_PHYCORE_STM32MP1=y
-CONFIG_BOARD_ARM_GENERIC_DT=y
+CONFIG_BOARD_GENERIC_DT=y
CONFIG_THUMB2_BAREBOX=y
CONFIG_ARM_BOARD_APPEND_ATAG=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index ad724565d7bb..be2146b3facb 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -17,6 +17,7 @@ config RISCV
select HAS_KALLSYMS
select RISCV_TIMER if RISCV_SBI
select HW_HAS_PCI
+ select HAVE_ARCH_BOARD_GENERIC_DT
config ARCH_LINUX_NAME
string
@@ -71,15 +72,6 @@ config 64BIT
select ARCH_DMA_ADDR_T_64BIT
select PHYS_ADDR_T_64BIT
-config BOARD_RISCV_GENERIC_DT
- select BOARD_GENERIC_DT
- bool "Build generic RISC-V device tree 2nd stage image"
- help
- This enables compilation of a generic image that can be started 2nd
- stage from barebox or from qemu. It picks up a device tree passed
- in a1 like the Kernel does, so it could be used anywhere where a Kernel
- image could be used. The image will be called images/barebox-dt-2nd.img
-
menu "RISC-V specific settings"
config RISCV_OPTIMZED_STRING_FUNCTIONS
diff --git a/arch/riscv/Kconfig.socs b/arch/riscv/Kconfig.socs
index cef9cd52300c..ccda688faf6d 100644
--- a/arch/riscv/Kconfig.socs
+++ b/arch/riscv/Kconfig.socs
@@ -18,7 +18,7 @@ config BOARD_ERIZO_GENERIC
config SOC_VIRT
bool "QEMU Virt Machine"
select RISCV_S_MODE
- select BOARD_RISCV_GENERIC_DT
+ select BOARD_GENERIC_DT
select HAS_CACHE
select HAS_DEBUG_LL
help
diff --git a/arch/riscv/configs/rv64i_defconfig b/arch/riscv/configs/rv64i_defconfig
index 53c367c5e415..7f18ec08f37a 100644
--- a/arch/riscv/configs/rv64i_defconfig
+++ b/arch/riscv/configs/rv64i_defconfig
@@ -7,7 +7,7 @@ CONFIG_BOARD_ALLWINNER_D1=y
CONFIG_BOARD_BEAGLEV=y
CONFIG_BOARD_BEAGLEV_BETA=y
CONFIG_BOARD_HIFIVE=y
-CONFIG_BOARD_RISCV_GENERIC_DT=y
+CONFIG_BOARD_GENERIC_DT=y
CONFIG_RISCV_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_STACK_SIZE=0x20000
CONFIG_MALLOC_SIZE=0x0
--
2.39.5
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 10/13] images: add barebox FIT image target
2025-01-12 8:34 [PATCH 00/13] images: add barebox FIT image target Ahmad Fatoum
` (8 preceding siblings ...)
2025-01-12 8:34 ` [PATCH 09/13] arch: make BOARD_GENERIC_DT a user-selectable option across archs Ahmad Fatoum
@ 2025-01-12 8:34 ` Ahmad Fatoum
2025-01-17 8:32 ` Sascha Hauer
2025-01-12 8:34 ` [PATCH 11/13] MAKEALL: rename target in symbols to more appropiate defconfig Ahmad Fatoum
` (4 subsequent siblings)
14 siblings, 1 reply; 19+ messages in thread
From: Ahmad Fatoum @ 2025-01-12 8:34 UTC (permalink / raw)
To: barebox; +Cc: Felix Singer, Ahmad Fatoum
The generic barebox-dt-2nd.img depends on the user to fish out
the correct device tree from arch/${SRCARCH}/dts and to instruct
the preceding boot stage to pass that device tree to the barebox image.
To make this easier, especially with an eye towards using this as a
coreboot payload, let's have the barebox build system produce a FIT
image combining barebox-dt-2nd.img and all the enabled device trees.
As this introduces a python3 and python3-libfdt dependency that wasn't
there before, this is only built by default if the relevant CONFIG
option is enabled or if the target is explicitly built.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Documentation/user/barebox.rst | 25 +--
Makefile | 5 +
arch/Kconfig | 17 ++
images/Makefile | 9 +
scripts/Kbuild.include | 6 +
scripts/Makefile.lib | 17 ++
scripts/make_fit.py | 331 +++++++++++++++++++++++++++++++++
7 files changed, 392 insertions(+), 18 deletions(-)
create mode 100755 scripts/make_fit.py
diff --git a/Documentation/user/barebox.rst b/Documentation/user/barebox.rst
index c6969ae3de1d..338c2f5d03c0 100644
--- a/Documentation/user/barebox.rst
+++ b/Documentation/user/barebox.rst
@@ -215,20 +215,10 @@ For example:
U-Boot: bootz $kernel_addr - $fdt_addr # On 32-bit ARM
U-Boot: booti $kernel_addr - $fdt_addr # for other platforms
-Another option is to generate a FIT image containing the generic DT image and a
-matching device tree with ``mkimage``:
-
-.. code-block:: console
-
- sh: mkimage --architecture arm \
- --os linux \
- --type kernel \
- --fit auto \
- --load-address $kernel_addr_r \
- --compression none \
- --image images/barebox-dt-2nd.img \
- --device-tree arch/${ARCH}/dts/my-board.dtb \
- barebox-dt-2nd.fit
+The barebox build can also generate a FIT image combining ``barebox-dt-2nd.img``
+and all enabled device trees. This image requires python3 and python3-libfdt
+and is thus only built by default if ``CONFIG_BOARD_GENERIC_FIT`` is enabled
+or the FIT image target is explicitly invoked: ``make barebox.fit``.
This FIT image can then be loaded by U-Boot and executed just like a regular
Linux kernel:
@@ -238,10 +228,9 @@ Linux kernel:
U-Boot: tftp $fit_addr barebox-dt-2nd.fit
U-Boot: bootm $fit_addr
-Make sure that the address in ``$fit_addr`` is different from the
-``$kernel_addr_r`` passed to ``mkimage`` as the load address of the Kernel
-image. Otherwise U-Boot may attempt to overwrite the FIT image with the barebox
-image contained within.
+The FIT image has a kernel type of ``kernel_noload``, instructing the bootloader
+to ignore the load address. The first stage bootloader must thus either support
+``kernel_noload`` or always ignore load addresses.
For non-DT enabled-bootloaders or other architectures, often the normal barebox
binaries can also be used as they are designed to be startable second stage
diff --git a/Makefile b/Makefile
index 81a89d1c0ad4..9a2fdf0c68d2 100644
--- a/Makefile
+++ b/Makefile
@@ -1005,6 +1005,9 @@ barebox: $(BAREBOX_LDS) $(BAREBOX_OBJS) $(kallsyms.o) FORCE
$(call if_changed_rule,barebox__)
$(Q)rm -f .old_version
+barebox.fit: images/barebox-$(CONFIG_ARCH_LINUX_NAME).fit
+ $(Q)ln -fsn $< $@
+
barebox.srec: barebox
$(OBJCOPY) -O srec $< $@
@@ -1110,6 +1113,7 @@ include/generated/utsrelease.h: include/config/kernel.release FORCE
ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/dts/),)
dtstree := arch/$(SRCARCH)/dts
+export dtstree
endif
ifneq ($(dtstree),)
@@ -1319,6 +1323,7 @@ help:
@echo '* barebox - Build the barebox proper binary'
ifdef CONFIG_PBL_IMAGE
@echo '* images - Build final prebootloader-prefixed images'
+ @echo '* barebox.fit - Build 2nd stage barebox with device trees FIT image'
endif
@echo ' dir/ - Build all files in dir and below'
@echo ' dir/file.[ois] - Build specified target only'
diff --git a/arch/Kconfig b/arch/Kconfig
index e1c08bcd7b99..aee5375dc70c 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -46,4 +46,21 @@ config BOARD_GENERIC_DT
architecture and thus can be used anywhere that a Kernel image could be used.
The image will be called images/barebox-dt-2nd.img
+config BOARD_GENERIC_FIT
+ depends on BOARD_GENERIC_DT
+ bool "Build generic device tree 2nd stage FIT image"
+ help
+ This enables compilation of a generic FIT image that combines
+ barebox-dt-2nd.img as well as all enabled device trees.
+ This single image is the bootable from coreboot, barebox, or any other
+ bootloader capable of booting a Linux kernel out of FIT images.
+ The image will be called images/barebox-$(CONFIG_ARCH_LINUX_NAME).fit
+
+ The image can be built manually, even without enabling this option
+ by running make barebox.fit, which will create a barebox.fit symlink
+ pointing at the built image.
+
+ Note that this option requires python3 and its libfdt module to be
+ installed on the build host.
+
endmenu
diff --git a/images/Makefile b/images/Makefile
index e0e3e5c537cc..4e5cb693e40a 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -123,6 +123,10 @@ cmd_itb = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) \
$(obj)/%.itb: $(obj)/%.its FORCE
$(call if_changed,itb)
+.SECONDEXPANSION:
+$(obj)/%.fit: $(obj)/$$(FILE_$$(@F)) $(dtstree)/dtbs-list FORCE
+ $(call if_changed,fit)
+
$(obj)/piggy.o: $(obj)/barebox.z FORCE
$(obj)/sha_sum.o: $(obj)/barebox.sha.bin FORCE
@@ -187,6 +191,11 @@ pblb-$(CONFIG_BOARD_GENERIC_DT) += start_dt_2nd
FILE_barebox-dt-2nd.img = start_dt_2nd.pblb
image-$(CONFIG_BOARD_GENERIC_DT) += barebox-dt-2nd.img
+fit-image = barebox-$(call remove_quotes,$(CONFIG_ARCH_LINUX_NAME)).fit
+FILE_$(fit-image) = barebox-dt-2nd.img
+image-$(CONFIG_BOARD_GENERIC_FIT) += $(fit-image)
+targets += $(fit-name)
+
ifdef CONFIG_ARM
pblb-$(CONFIG_PBL_SINGLE_IMAGE) += start_pbl
FILE_barebox.img = start_pbl.pblb
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 8c311b997e24..e905b5466371 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -60,6 +60,12 @@ escsq = $(subst $(squote),'\$(squote)',$1)
# Quote a string to pass it to C files. foo => '"foo"'
stringify = $(squote)$(quote)$1$(quote)$(squote)
+###
+# Remove the quotes in the argument
+define remove_quotes
+$(strip $(subst $(quote),,$(1)))
+endef
+
###
# The path to Kbuild or Makefile. Kbuild has precedence over Makefile.
kbuild-file = $(or $(wildcard $(src)/Kbuild),$(src)/Makefile)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 0dfb496777dd..4e8e1254833e 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -311,6 +311,23 @@ quiet_cmd_sha256bin ?= SHA-BIN $@
quiet_cmd_sha256sum ?= SHA $@
cmd_sha256sum ?= sha256sum $2 > $@
+# Flat Image Tree (FIT)
+# This allows for packaging of barebox and all devicetrees files, using
+# compression.
+# ---------------------------------------------------------------------------
+
+MAKE_FIT := $(srctree)/scripts/make_fit.py
+
+# Use this to override the compression algorithm of the DTBs
+FIT_COMPRESSION ?= none
+
+quiet_cmd_fit = FIT $@
+ cmd_fit = $(MAKE_FIT) -o $@ --arch $(CONFIG_ARCH_MKIMAGE_NAME) --os linux \
+ --name 'barebox-$(KERNELRELEASE)' \
+ $(if $(findstring 1,$(KBUILD_VERBOSE)),-v) \
+ $(if $(FIT_DECOMPOSE_DTBS),--decompose-dtbs) \
+ --dtb-compress $(FIT_COMPRESSION) -k $< @$(word 2,$^)
+
# Decompressor for barebox proper binary when using PBL
# ---------------------------------------------------------------------------
diff --git a/scripts/make_fit.py b/scripts/make_fit.py
new file mode 100755
index 000000000000..075b7c258ff2
--- /dev/null
+++ b/scripts/make_fit.py
@@ -0,0 +1,331 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright 2024 Google LLC
+# Written by Simon Glass <sjg@chromium.org>
+#
+
+"""Build a FIT containing a lot of devicetree files
+
+Usage:
+ make_fit.py -A arm64 -n 'Linux-6.6' -O linux
+ -o arch/arm64/boot/image.fit -k /tmp/kern/arch/arm64/boot/image.itk
+ @arch/arm64/boot/dts/dtbs-list -E -c gzip
+
+Creates a FIT containing the supplied kernel and a set of devicetree files,
+either specified individually or listed in a file (with an '@' prefix).
+
+Use -E to generate an external FIT (where the data is placed after the
+FIT data structure). This allows parsing of the data without loading
+the entire FIT.
+
+Use -c to compress the data, using bzip2, gzip, lz4, lzma, lzo and
+zstd algorithms.
+
+Use -D to decompose "composite" DTBs into their base components and
+deduplicate the resulting base DTBs and DTB overlays. This requires the
+DTBs to be sourced from the kernel build directory, as the implementation
+looks at the .cmd files produced by the kernel build.
+
+The resulting FIT can be booted by bootloaders which support FIT, such
+as U-Boot, Linuxboot, Tianocore, etc.
+
+Note that this tool does not yet support adding a ramdisk / initrd.
+"""
+
+import argparse
+import collections
+import os
+import subprocess
+import sys
+import tempfile
+import time
+
+import libfdt
+
+
+# Tool extension and the name of the command-line tools
+CompTool = collections.namedtuple('CompTool', 'ext,tools')
+
+COMP_TOOLS = {
+ 'bzip2': CompTool('.bz2', 'bzip2'),
+ 'gzip': CompTool('.gz', 'pigz,gzip'),
+ 'lz4': CompTool('.lz4', 'lz4'),
+ 'lzma': CompTool('.lzma', 'lzma'),
+ 'lzo': CompTool('.lzo', 'lzop'),
+ 'zstd': CompTool('.zstd', 'zstd'),
+}
+
+
+def parse_args():
+ """Parse the program ArgumentParser
+
+ Returns:
+ Namespace object containing the arguments
+ """
+ epilog = 'Build a FIT from a directory tree containing .dtb files'
+ parser = argparse.ArgumentParser(epilog=epilog, fromfile_prefix_chars='@')
+ parser.add_argument('-A', '--arch', type=str, required=True,
+ help='Specifies the architecture')
+ parser.add_argument('--dtb-compress', type=str, default='none',
+ help='Specifies the compression of the DTBs')
+ parser.add_argument('-D', '--decompose-dtbs', action='store_true',
+ help='Decompose composite DTBs into base DTB and overlays')
+ parser.add_argument('-E', '--external', action='store_true',
+ help='Convert the FIT to use external data')
+ parser.add_argument('-n', '--name', type=str, required=True,
+ help='Specifies the name')
+ parser.add_argument('-o', '--output', type=str, required=True,
+ help='Specifies the output file (.fit)')
+ parser.add_argument('-O', '--os', type=str, required=True,
+ help='Specifies the operating system')
+ parser.add_argument('-k', '--kernel', type=str, required=True,
+ help='Specifies the (uncompressed) kernel input file (.itk)')
+ parser.add_argument('-v', '--verbose', action='store_true',
+ help='Enable verbose output')
+ parser.add_argument('dtbs', type=str, nargs='*',
+ help='Specifies the devicetree files to process')
+
+ return parser.parse_args()
+
+
+def setup_fit(fsw, name):
+ """Make a start on writing the FIT
+
+ Outputs the root properties and the 'images' node
+
+ Args:
+ fsw (libfdt.FdtSw): Object to use for writing
+ name (str): Name of kernel image
+ """
+ fsw.INC_SIZE = 65536
+ fsw.finish_reservemap()
+ fsw.begin_node('')
+ fsw.property_string('description', f'{name} with devicetree set')
+ fsw.property_u32('#address-cells', 1)
+
+ fsw.property_u32('timestamp', int(time.time()))
+ fsw.begin_node('images')
+
+
+def write_kernel(fsw, data, args):
+ """Write out the kernel image
+
+ Writes a kernel node along with the required properties
+
+ Args:
+ fsw (libfdt.FdtSw): Object to use for writing
+ data (bytes): Data to write (possibly compressed)
+ args (Namespace): Contains necessary strings:
+ arch: FIT architecture, e.g. 'arm64'
+ fit_os: Operating Systems, e.g. 'linux'
+ name: Name of OS, e.g. 'Linux-6.6.0-rc7'
+ compress: Compression algorithm to use, e.g. 'gzip'
+ """
+ with fsw.add_node('kernel'):
+ fsw.property_string('description', args.name)
+ fsw.property_string('type', 'kernel_noload')
+ fsw.property_string('arch', args.arch)
+ fsw.property_string('os', args.os)
+ fsw.property_string('compression', 'none')
+ fsw.property('data', data)
+ fsw.property_u32('load', 0)
+ fsw.property_u32('entry', 0)
+
+
+def finish_fit(fsw, entries):
+ """Finish the FIT ready for use
+
+ Writes the /configurations node and subnodes
+
+ Args:
+ fsw (libfdt.FdtSw): Object to use for writing
+ entries (list of tuple): List of configurations:
+ str: Description of model
+ str: Compatible stringlist
+ """
+ fsw.end_node()
+ seq = 0
+ with fsw.add_node('configurations'):
+ for model, compat, files in entries:
+ seq += 1
+ with fsw.add_node(f'conf-{seq}'):
+ fsw.property('compatible', bytes(compat))
+ fsw.property_string('description', model)
+ fsw.property('fdt', bytes(''.join(f'fdt-{x}\x00' for x in files), "ascii"))
+ fsw.property_string('kernel', 'kernel')
+ fsw.end_node()
+
+
+def compress_data(inf, compress):
+ """Compress data using a selected algorithm
+
+ Args:
+ inf (IOBase): Filename containing the data to compress
+ compress (str): Compression algorithm, e.g. 'gzip'
+
+ Return:
+ bytes: Compressed data
+ """
+ if compress == 'none':
+ return inf.read()
+
+ comp = COMP_TOOLS.get(compress)
+ if not comp:
+ raise ValueError(f"Unknown compression algorithm '{compress}'")
+
+ with tempfile.NamedTemporaryFile() as comp_fname:
+ with open(comp_fname.name, 'wb') as outf:
+ done = False
+ for tool in comp.tools.split(','):
+ try:
+ subprocess.call([tool, '-c'], stdin=inf, stdout=outf)
+ done = True
+ break
+ except FileNotFoundError:
+ pass
+ if not done:
+ raise ValueError(f'Missing tool(s): {comp.tools}\n')
+ with open(comp_fname.name, 'rb') as compf:
+ comp_data = compf.read()
+ return comp_data
+
+
+def output_dtb(fsw, seq, fname, arch, compress):
+ """Write out a single devicetree to the FIT
+
+ Args:
+ fsw (libfdt.FdtSw): Object to use for writing
+ seq (int): Sequence number (1 for first)
+ fname (str): Filename containing the DTB
+ arch: FIT architecture, e.g. 'arm64'
+ compress (str): Compressed algorithm, e.g. 'gzip'
+ """
+ with fsw.add_node(f'fdt-{seq}'):
+ fsw.property_string('description', os.path.basename(fname))
+ fsw.property_string('type', 'flat_dt')
+ fsw.property_string('arch', arch)
+ fsw.property_string('compression', compress)
+
+ with open(fname, 'rb') as inf:
+ compressed = compress_data(inf, compress)
+ fsw.property('data', compressed)
+
+
+def process_dtb(fname, args):
+ """Process an input DTB, decomposing it if requested and is possible
+
+ Args:
+ fname (str): Filename containing the DTB
+ args (Namespace): Program arguments
+ Returns:
+ tuple:
+ str: Model name string
+ str: Root compatible string
+ files: list of filenames corresponding to the DTB
+ """
+ # Get the compatible / model information
+ with open(fname, 'rb') as inf:
+ data = inf.read()
+ fdt = libfdt.FdtRo(data)
+ model = fdt.getprop(0, 'model').as_str()
+ compat = fdt.getprop(0, 'compatible')
+
+ if args.decompose_dtbs:
+ # Check if the DTB needs to be decomposed
+ path, basename = os.path.split(fname)
+ cmd_fname = os.path.join(path, f'.{basename}.cmd')
+ with open(cmd_fname, 'r', encoding='ascii') as inf:
+ cmd = inf.read()
+
+ if 'scripts/dtc/fdtoverlay' in cmd:
+ # This depends on the structure of the composite DTB command
+ files = cmd.split()
+ files = files[files.index('-i') + 1:]
+ else:
+ files = [fname]
+ else:
+ files = [fname]
+
+ return (model, compat, files)
+
+def build_fit(args):
+ """Build the FIT from the provided files and arguments
+
+ Args:
+ args (Namespace): Program arguments
+
+ Returns:
+ tuple:
+ bytes: FIT data
+ int: Number of configurations generated
+ size: Total uncompressed size of data
+ """
+ seq = 0
+ size = 0
+ fsw = libfdt.FdtSw()
+ setup_fit(fsw, args.name)
+ entries = []
+ fdts = {}
+
+ # Handle the kernel
+ with open(args.kernel, 'rb') as inf:
+ comp_data = compress_data(inf, 'none')
+ size += os.path.getsize(args.kernel)
+ write_kernel(fsw, comp_data, args)
+
+ for fname in args.dtbs:
+ # Ignore non-DTB (*.dtb) files
+ if os.path.splitext(fname)[1] != '.dtb':
+ continue
+
+ (model, compat, files) = process_dtb(fname, args)
+
+ for fn in files:
+ if fn not in fdts:
+ seq += 1
+ size += os.path.getsize(fn)
+ output_dtb(fsw, seq, fn, args.arch, args.dtb_compress)
+ fdts[fn] = seq
+
+ files_seq = [fdts[fn] for fn in files]
+
+ entries.append([model, compat, files_seq])
+
+ finish_fit(fsw, entries)
+
+ # Include the kernel itself in the returned file count
+ return fsw.as_fdt().as_bytearray(), seq + 1, size
+
+
+def run_make_fit():
+ """Run the tool's main logic"""
+ args = parse_args()
+
+ out_data, count, size = build_fit(args)
+ with open(args.output, 'wb') as outf:
+ outf.write(out_data)
+
+ ext_fit_size = None
+ if args.external:
+ mkimage = os.environ.get('MKIMAGE', 'mkimage')
+ subprocess.check_call([mkimage, '-E', '-F', args.output],
+ stdout=subprocess.DEVNULL)
+
+ with open(args.output, 'rb') as inf:
+ data = inf.read()
+ ext_fit = libfdt.FdtRo(data)
+ ext_fit_size = ext_fit.totalsize()
+
+ if args.verbose:
+ comp_size = len(out_data)
+ print(f'FIT size {comp_size:#x}/{comp_size / 1024 / 1024:.1f} MB',
+ end='')
+ if ext_fit_size:
+ print(f', header {ext_fit_size:#x}/{ext_fit_size / 1024:.1f} KB',
+ end='')
+ print(f', {count} files, uncompressed {size / 1024 / 1024:.1f} MB')
+
+
+if __name__ == "__main__":
+ sys.exit(run_make_fit())
--
2.39.5
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 11/13] MAKEALL: rename target in symbols to more appropiate defconfig
2025-01-12 8:34 [PATCH 00/13] images: add barebox FIT image target Ahmad Fatoum
` (9 preceding siblings ...)
2025-01-12 8:34 ` [PATCH 10/13] images: add barebox FIT image target Ahmad Fatoum
@ 2025-01-12 8:34 ` Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 12/13] MAKEALL: add support for building arbitrary targets Ahmad Fatoum
` (3 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Ahmad Fatoum @ 2025-01-12 8:34 UTC (permalink / raw)
To: barebox; +Cc: Felix Singer, Ahmad Fatoum
The script uses target to mean either defconfig or build step.
In preparation for adding the ability to specify actual make targets
that should be run besides the default of `all', let's rename all
instances of target otherwise.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
MAKEALL | 68 ++++++++++++++++++++++++++++-----------------------------
1 file changed, 34 insertions(+), 34 deletions(-)
diff --git a/MAKEALL b/MAKEALL
index b43a134b06bc..65cc41824cd8 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -33,7 +33,7 @@ usage() {
echo "The cross-compiler can be specify via"
echo " CROSS_COMPILE default"
echo " CROSS_COMPILE_<arch> arch default"
- echo " CROSS_COMPILE_<target> defconfig specific"
+ echo " CROSS_COMPILE_<defconfig> defconfig specific"
echo ""
echo "it will be evaluated in the invert order"
echo ""
@@ -95,8 +95,8 @@ check_pipe_status() {
}
with_logs_collected() {
- local log_report="${logdir}/${target}/report.log"
- local log_err="${logdir}/${target}/errors.log"
+ local log_report="${logdir}/${defconfig}/report.log"
+ local log_err="${logdir}/${defconfig}/errors.log"
if [ -n "${logdir}" ]; then
"$@" 2>&1 > "${log_report}" | tee "${log_err}"
@@ -106,7 +106,7 @@ with_logs_collected() {
}
report() {
- local log_report="${logdir}/${target}/report.log"
+ local log_report="${logdir}/${defconfig}/report.log"
if [ -n "${logdir}" ]; then
printf "$@" | tee -a "${log_report}"
@@ -115,18 +115,18 @@ report() {
fi
}
-do_build_target() {
+do_build_defconfig() {
local arch=$1
- local target=$2
- local target_time_start=$(date +%s)
- local log_err="${logdir}/${target}/errors.log"
+ local defconfig=$2
+ local step_time_start=$(date +%s)
+ local log_err="${logdir}/${defconfig}/errors.log"
local err=0
[ "$INCREMENTAL" != "1" ] && rm -rf "${BUILDDIR}"
- [ -n "$logdir" ] && mkdir -p "${logdir}/${target}"
+ [ -n "$logdir" ] && mkdir -p "${logdir}/${defconfig}"
MAKE="make -j${JOBS} ARCH=${arch} O=${BUILDDIR}"
- ${MAKE} ${target} &>/dev/null
+ ${MAKE} ${defconfig} &>/dev/null
if [ ${arch} = "arm" ]; then
grep -q "CONFIG_ARM64=y" ${BUILDDIR}/.config
@@ -135,7 +135,7 @@ do_build_target() {
fi
fi
- tmp=$(echo "${target}" | tr - _)
+ tmp=$(echo "${defconfig}" | tr - _)
cross_compile=$(eval echo '$CROSS_COMPILE_'${tmp})
cross_compile_set=$(eval echo '${CROSS_COMPILE_'${tmp}'+set}')
@@ -151,9 +151,9 @@ do_build_target() {
[ -z "$V" ] && silent_flag=-s
- report "Building ${arch} ${target} \n" >&2
+ report "Building ${arch} ${defconfig} \n" >&2
MAKE="${MAKE} $silent_flag CROSS_COMPILE=${cross_compile}"
- with_logs_collected ${MAKE} ${target}
+ with_logs_collected ${MAKE} ${defconfig}
for i in ${KCONFIG_ADD}; do
with_logs_collected ./scripts/kconfig/merge_config.sh -m -O \
${BUILDDIR} ${BUILDDIR}/.config $i
@@ -173,14 +173,14 @@ do_build_target() {
check_pipe_status
compile_result="$?"
- report "Compile: " ${target}
+ report "Compile: " ${defconfig}
if [ "$compile_result" = "0" ]; then
report "OK \n"
else
report "FAILED \n"
nb_errors=$((nb_errors + 1))
- errors_list="${errors_list} ${target}"
+ errors_list="${errors_list} ${defconfig}"
err=1
exitcode=1
fi
@@ -194,7 +194,7 @@ do_build_target() {
if [ -n "$logdir" ]; then
if [ -s "${log_err}" ] ; then
nb_warnings=$((nb_warnings + 1))
- warnings_list="${warnings_list} ${target}"
+ warnings_list="${warnings_list} ${defconfig}"
else
rm "${log_err}"
fi
@@ -202,9 +202,9 @@ do_build_target() {
nb_defconfigs=$((nb_defconfigs + 1))
- target_time_stop=$(date +%s)
- target_time_diff=$((${target_time_stop} - ${target_time_start}))
- report "Compiled in %4is\n" ${target_time_diff}
+ step_time_stop=$(date +%s)
+ step_time_diff=$((${step_time_stop} - ${step_time_start}))
+ report "Compiled in %4is\n" ${step_time_diff}
return $err
}
@@ -213,11 +213,11 @@ if command -v labgrid-pytest >/dev/null; then
alias pytest=labgrid-pytest
fi
-do_test_target() {
+do_test_defconfig() {
local yaml=$1
- local target=$2
+ local defconfig=$2
shift 2
- local target_time_start=$(date +%s)
+ local step_time_start=$(date +%s)
local err=0
LG_BUILDDIR=$BUILDDIR with_logs_collected pytest --lg-env $yaml "$@"
@@ -239,9 +239,9 @@ do_test_target() {
nb_tests=$((nb_tests + 1))
- target_time_stop=$(date +%s)
- target_time_diff=$((${target_time_stop} - ${target_time_start}))
- report "Tested in %4is\n" ${target_time_diff}
+ step_time_stop=$(date +%s)
+ step_time_diff=$((${step_time_stop} - ${step_time_start}))
+ report "Tested in %4is\n" ${step_time_diff}
return $err
}
@@ -252,14 +252,14 @@ do_build() {
configs=$(find arch/${arch}/configs -name "${regex}_defconfig" | sort)
for i in ${configs}; do
- local target=$(basename $i)
+ local defconfig=$(basename $i)
- do_build_target ${arch} ${target}
+ do_build_defconfig ${arch} ${defconfig}
done
}
do_build_all() {
- local build_target=0
+ local nbuilds=0
for i in arch/*
do
@@ -268,11 +268,11 @@ do_build_all() {
if [ -d $i ]
then
do_build ${arch} "*"
- build_target=$((build_target + 1))
+ nbuilds=$((nbuilds + 1))
fi
done
- return $build_target
+ return $nbuilds
}
while getopts "hc:j:O:l:a:e:k:v:i" Option
@@ -365,7 +365,7 @@ then
do_build_all
if [ $? -eq 0 ]
then
- echo "You need to specify the ARCH or CROSS_COMPILE_<arch> or CROSS_COMPILE_<target> in your config file"
+ echo "You need to specify the ARCH or CROSS_COMPILE_<arch> or CROSS_COMPILE_<defconfig> in your config file"
usage
exit 1
fi
@@ -410,14 +410,14 @@ else
if [[ $i =~ ^.*/([^/]+)/([^@]*@|)([^.]+).yaml$ ]]; then
arch=${BASH_REMATCH[1]}
defconfig=${BASH_REMATCH[3]}
- do_build_target $arch $defconfig
+ do_build_defconfig $arch $defconfig
if [ $? -eq 0 ]; then
- do_test_target $config $defconfig "${pytest_opts[@]}"
+ do_test_defconfig $config $defconfig "${pytest_opts[@]}"
else
echo "Skipping test due to failed build"
fi
else
- do_build_target ${ARCH} $config
+ do_build_defconfig ${ARCH} $config
fi
done
fi
--
2.39.5
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 12/13] MAKEALL: add support for building arbitrary targets
2025-01-12 8:34 [PATCH 00/13] images: add barebox FIT image target Ahmad Fatoum
` (10 preceding siblings ...)
2025-01-12 8:34 ` [PATCH 11/13] MAKEALL: rename target in symbols to more appropiate defconfig Ahmad Fatoum
@ 2025-01-12 8:34 ` Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 13/13] ci: container: add python3-libfdt dependency for barebox.fit Ahmad Fatoum
` (2 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Ahmad Fatoum @ 2025-01-12 8:34 UTC (permalink / raw)
To: barebox; +Cc: Felix Singer, Ahmad Fatoum
The scripts currently only make the default target (all).
To make it more useful, let's add a new -t option to be able to
build other targets as well.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
MAKEALL | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/MAKEALL b/MAKEALL
index 65cc41824cd8..1966eedb4673 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -57,6 +57,7 @@ usage() {
echo "LOGDIR -l log dir"
echo "REGEX -e regex"
echo "KCONFIG_ADD -k kconfig fragment"
+ echo "TARGET -t Makefile target"
echo "V -v verbosity"
echo "INCREMENTAL -i"
echo ""
@@ -168,7 +169,7 @@ do_build_defconfig() {
if [ "$configure_result" = "0" ]; then
report "OK \n"
- with_logs_collected ${MAKE} $silent_flag
+ with_logs_collected ${MAKE} $silent_flag ${TARGET}
check_pipe_status
compile_result="$?"
@@ -275,7 +276,7 @@ do_build_all() {
return $nbuilds
}
-while getopts "hc:j:O:l:a:e:k:v:i" Option
+while getopts "hc:j:O:l:a:e:k:t:v:i" Option
do
case $Option in
a )
@@ -299,6 +300,9 @@ case $Option in
k )
KCONFIG_ADD="${KCONFIG_ADD} ${OPTARG}"
;;
+ t )
+ TARGET="${TARGET} ${OPTARG}"
+ ;;
v )
export V=${OPTARG}
;;
--
2.39.5
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 13/13] ci: container: add python3-libfdt dependency for barebox.fit
2025-01-12 8:34 [PATCH 00/13] images: add barebox FIT image target Ahmad Fatoum
` (11 preceding siblings ...)
2025-01-12 8:34 ` [PATCH 12/13] MAKEALL: add support for building arbitrary targets Ahmad Fatoum
@ 2025-01-12 8:34 ` Ahmad Fatoum
2025-01-14 8:18 ` [PATCH 00/13] images: add barebox FIT image target Sascha Hauer
2025-01-21 8:07 ` (subset) " Sascha Hauer
14 siblings, 0 replies; 19+ messages in thread
From: Ahmad Fatoum @ 2025-01-12 8:34 UTC (permalink / raw)
To: barebox; +Cc: Felix Singer, Ahmad Fatoum
The barebox FIT image isn't created by mkimage, but by a python script
by means of libfdt. Add the libfdt dependency to the conainer, so we can
in the future add a test that checks that barebox can chainload itself
from that image.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
test/Containerfile | 1 +
1 file changed, 1 insertion(+)
diff --git a/test/Containerfile b/test/Containerfile
index 1c4932f56a64..5aa04f7f4976 100644
--- a/test/Containerfile
+++ b/test/Containerfile
@@ -44,6 +44,7 @@ RUN apt-get update && apt-get install -y \
python3-pip \
python3-virtualenv \
python3-setuptools \
+ python3-libfdt \
virtualenv \
sudo \
u-boot-tools \
--
2.39.5
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 00/13] images: add barebox FIT image target
2025-01-12 8:34 [PATCH 00/13] images: add barebox FIT image target Ahmad Fatoum
` (12 preceding siblings ...)
2025-01-12 8:34 ` [PATCH 13/13] ci: container: add python3-libfdt dependency for barebox.fit Ahmad Fatoum
@ 2025-01-14 8:18 ` Sascha Hauer
2025-01-21 8:07 ` (subset) " Sascha Hauer
14 siblings, 0 replies; 19+ messages in thread
From: Sascha Hauer @ 2025-01-14 8:18 UTC (permalink / raw)
To: barebox, Ahmad Fatoum; +Cc: Felix Singer
On Sun, 12 Jan 2025 09:34:19 +0100, Ahmad Fatoum wrote:
> The generic barebox-dt-2nd.img depends on the user to fish out
> the correct device tree from arch/${SRCARCH}/dts and to instruct
> the preceding boot stage to pass that device tree to the barebox image.
>
> To make this easier, especially with an eye towards using this as a
> coreboot payload, let's have the barebox build system produce a FIT
> image combining barebox-dt-2nd.img and all the enabled device trees.
>
> [...]
Applied, thanks!
[01/13] ARM: dts: add device trees for the QEMU Virt machine
https://git.pengutronix.de/cgit/barebox/commit/?id=a22fce9bedf8 (link may not be stable)
[02/13] treewide: collect the name of all board device trees
https://git.pengutronix.de/cgit/barebox/commit/?id=bbd61ad6665f (link may not be stable)
[03/13] kbuild: collect available device trees in dtbs-list
https://git.pengutronix.de/cgit/barebox/commit/?id=dcffa72602bc (link may not be stable)
[04/13] scripts: add new scripts_dtc target
https://git.pengutronix.de/cgit/barebox/commit/?id=2ca6ebc73a12 (link may not be stable)
[05/13] kbuild: restrict dtbs target to enabled DTs by default
https://git.pengutronix.de/cgit/barebox/commit/?id=3c862a83f019 (link may not be stable)
[06/13] kbuild: improve make help description
https://git.pengutronix.de/cgit/barebox/commit/?id=40193e790f3a (link may not be stable)
[07/13] kbuild: allow dependency on any file in images/
https://git.pengutronix.de/cgit/barebox/commit/?id=9e503475b38a (link may not be stable)
[08/13] arch: maintain Linux kernel and mkimage ARCH mapping in Kconfig
https://git.pengutronix.de/cgit/barebox/commit/?id=afd870d029e4 (link may not be stable)
[09/13] arch: make BOARD_GENERIC_DT a user-selectable option across archs
https://git.pengutronix.de/cgit/barebox/commit/?id=5e65b8e19e49 (link may not be stable)
[10/13] images: add barebox FIT image target
https://git.pengutronix.de/cgit/barebox/commit/?id=9de7043299e4 (link may not be stable)
[11/13] MAKEALL: rename target in symbols to more appropiate defconfig
https://git.pengutronix.de/cgit/barebox/commit/?id=eb42ba0bd839 (link may not be stable)
[12/13] MAKEALL: add support for building arbitrary targets
https://git.pengutronix.de/cgit/barebox/commit/?id=942c985dee45 (link may not be stable)
[13/13] ci: container: add python3-libfdt dependency for barebox.fit
https://git.pengutronix.de/cgit/barebox/commit/?id=46696161387b (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 10/13] images: add barebox FIT image target
2025-01-12 8:34 ` [PATCH 10/13] images: add barebox FIT image target Ahmad Fatoum
@ 2025-01-17 8:32 ` Sascha Hauer
2025-01-17 9:03 ` Ahmad Fatoum
0 siblings, 1 reply; 19+ messages in thread
From: Sascha Hauer @ 2025-01-17 8:32 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox, Felix Singer
Hi Ahmad,
On Sun, Jan 12, 2025 at 09:34:29AM +0100, Ahmad Fatoum wrote:
> +MAKE_FIT := $(srctree)/scripts/make_fit.py
> +
> +# Use this to override the compression algorithm of the DTBs
> +FIT_COMPRESSION ?= none
> +
> +quiet_cmd_fit = FIT $@
> + cmd_fit = $(MAKE_FIT) -o $@ --arch $(CONFIG_ARCH_MKIMAGE_NAME) --os linux \
> + --name 'barebox-$(KERNELRELEASE)' \
> + $(if $(findstring 1,$(KBUILD_VERBOSE)),-v) \
> + $(if $(FIT_DECOMPOSE_DTBS),--decompose-dtbs) \
> + --dtb-compress $(FIT_COMPRESSION) -k $< @$(word 2,$^)
I had to drop this and the following patches from this series.
barebox already has a cmd_fit which you are overwriting with this patch.
The existing FIT target is used for the beagleplay board to build an
image to be started from U-Boot. I suspect we can just replace existing
FIT target with your version.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 10/13] images: add barebox FIT image target
2025-01-17 8:32 ` Sascha Hauer
@ 2025-01-17 9:03 ` Ahmad Fatoum
2025-01-20 7:19 ` Sascha Hauer
0 siblings, 1 reply; 19+ messages in thread
From: Ahmad Fatoum @ 2025-01-17 9:03 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox, Felix Singer
Hello Sascha,
On 17.01.25 09:32, Sascha Hauer wrote:
> Hi Ahmad,
>
> On Sun, Jan 12, 2025 at 09:34:29AM +0100, Ahmad Fatoum wrote:
>> +MAKE_FIT := $(srctree)/scripts/make_fit.py
>> +
>> +# Use this to override the compression algorithm of the DTBs
>> +FIT_COMPRESSION ?= none
>> +
>> +quiet_cmd_fit = FIT $@
>> + cmd_fit = $(MAKE_FIT) -o $@ --arch $(CONFIG_ARCH_MKIMAGE_NAME) --os linux \
>> + --name 'barebox-$(KERNELRELEASE)' \
>> + $(if $(findstring 1,$(KBUILD_VERBOSE)),-v) \
>> + $(if $(FIT_DECOMPOSE_DTBS),--decompose-dtbs) \
>> + --dtb-compress $(FIT_COMPRESSION) -k $< @$(word 2,$^)
>
> I had to drop this and the following patches from this series.
>
> barebox already has a cmd_fit which you are overwriting with this patch.
> The existing FIT target is used for the beagleplay board to build an
> image to be started from U-Boot. I suspect we can just replace existing
> FIT target with your version.
I renamed it to cmd_itb in this patch that you picked:
https://lore.kernel.org/all/20250106091935.3435710-1-a.fatoum@pengutronix.de/
Cheers,
Ahmad
>
> Sascha
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 10/13] images: add barebox FIT image target
2025-01-17 9:03 ` Ahmad Fatoum
@ 2025-01-20 7:19 ` Sascha Hauer
0 siblings, 0 replies; 19+ messages in thread
From: Sascha Hauer @ 2025-01-20 7:19 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox, Felix Singer
On Fri, Jan 17, 2025 at 10:03:20AM +0100, Ahmad Fatoum wrote:
> Hello Sascha,
>
> On 17.01.25 09:32, Sascha Hauer wrote:
> > Hi Ahmad,
> >
> > On Sun, Jan 12, 2025 at 09:34:29AM +0100, Ahmad Fatoum wrote:
> >> +MAKE_FIT := $(srctree)/scripts/make_fit.py
> >> +
> >> +# Use this to override the compression algorithm of the DTBs
> >> +FIT_COMPRESSION ?= none
> >> +
> >> +quiet_cmd_fit = FIT $@
> >> + cmd_fit = $(MAKE_FIT) -o $@ --arch $(CONFIG_ARCH_MKIMAGE_NAME) --os linux \
> >> + --name 'barebox-$(KERNELRELEASE)' \
> >> + $(if $(findstring 1,$(KBUILD_VERBOSE)),-v) \
> >> + $(if $(FIT_DECOMPOSE_DTBS),--decompose-dtbs) \
> >> + --dtb-compress $(FIT_COMPRESSION) -k $< @$(word 2,$^)
> >
> > I had to drop this and the following patches from this series.
> >
> > barebox already has a cmd_fit which you are overwriting with this patch.
> > The existing FIT target is used for the beagleplay board to build an
> > image to be started from U-Boot. I suspect we can just replace existing
> > FIT target with your version.
>
> I renamed it to cmd_itb in this patch that you picked:
> https://lore.kernel.org/all/20250106091935.3435710-1-a.fatoum@pengutronix.de/
I see. This patch was not on the branch I currently tested. I applied
10-13 on master now and it compiles fine.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: (subset) [PATCH 00/13] images: add barebox FIT image target
2025-01-12 8:34 [PATCH 00/13] images: add barebox FIT image target Ahmad Fatoum
` (13 preceding siblings ...)
2025-01-14 8:18 ` [PATCH 00/13] images: add barebox FIT image target Sascha Hauer
@ 2025-01-21 8:07 ` Sascha Hauer
14 siblings, 0 replies; 19+ messages in thread
From: Sascha Hauer @ 2025-01-21 8:07 UTC (permalink / raw)
To: barebox, Ahmad Fatoum; +Cc: Felix Singer
On Sun, 12 Jan 2025 09:34:19 +0100, Ahmad Fatoum wrote:
> The generic barebox-dt-2nd.img depends on the user to fish out
> the correct device tree from arch/${SRCARCH}/dts and to instruct
> the preceding boot stage to pass that device tree to the barebox image.
>
> To make this easier, especially with an eye towards using this as a
> coreboot payload, let's have the barebox build system produce a FIT
> image combining barebox-dt-2nd.img and all the enabled device trees.
>
> [...]
Applied, thanks!
[10/13] images: add barebox FIT image target
https://git.pengutronix.de/cgit/barebox/commit/?id=2b947570fa46 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2025-01-21 8:08 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-12 8:34 [PATCH 00/13] images: add barebox FIT image target Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 01/13] ARM: dts: add device trees for the QEMU Virt machine Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 02/13] treewide: collect the name of all board device trees Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 03/13] kbuild: collect available device trees in dtbs-list Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 04/13] scripts: add new scripts_dtc target Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 05/13] kbuild: restrict dtbs target to enabled DTs by default Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 06/13] kbuild: improve make help description Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 07/13] kbuild: allow dependency on any file in images/ Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 08/13] arch: maintain Linux kernel and mkimage ARCH mapping in Kconfig Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 09/13] arch: make BOARD_GENERIC_DT a user-selectable option across archs Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 10/13] images: add barebox FIT image target Ahmad Fatoum
2025-01-17 8:32 ` Sascha Hauer
2025-01-17 9:03 ` Ahmad Fatoum
2025-01-20 7:19 ` Sascha Hauer
2025-01-12 8:34 ` [PATCH 11/13] MAKEALL: rename target in symbols to more appropiate defconfig Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 12/13] MAKEALL: add support for building arbitrary targets Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 13/13] ci: container: add python3-libfdt dependency for barebox.fit Ahmad Fatoum
2025-01-14 8:18 ` [PATCH 00/13] images: add barebox FIT image target Sascha Hauer
2025-01-21 8:07 ` (subset) " Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox