source "boot/arm-trusted-firmware/Config.in"
source "boot/barebox/Config.in"
source "boot/beaglev-ddrlnit/Config.in"
+source "boot/beaglev-secondboot/Config.in"
source "boot/binaries-marvell/Config.in"
source "boot/boot-wrapper-aarch64/Config.in"
source "boot/grub2/Config.in"
--- /dev/null
+config BR2_TARGET_BEAGLEV_SECONDBOOT
+ bool "beaglev-secondboot"
+ depends on BR2_riscv
+ depends on BR2_HOSTARCH = "x86_64" # host-riscv64-elf-toolchain
+ help
+ This package builds the SecondBoot firmware used on the
+ BeagleV platform.
+
+ https://github.com/starfive-tech/beagle_secondBoot
--- /dev/null
+################################################################################
+#
+# beaglev-secondboot
+#
+################################################################################
+
+# Commit on the 'starfive' branch
+BEAGLEV_SECONDBOOT_VERSION = a4f0b4307f877890f998b3216cffcc9f27a5f993
+BEAGLEV_SECONDBOOT_SITE = $(call github,starfive-tech,beagle_secondBoot,$(BEAGLEV_SECONDBOOT_VERSION))
+BEAGLEV_SECONDBOOT_INSTALL_TARGET = NO
+BEAGLEV_SECONDBOOT_INSTALL_IMAGES = YES
+BEAGLEV_SECONDBOOT_DEPENDENCIES = host-riscv64-elf-toolchain
+# unfortunately, no real license file, but several sources files are
+# under GPL-2.0+, making the whole work GPL-2.0+
+BEAGLEV_SECONDBOOT_LICENSE = GPL-2.0+
+
+define BEAGLEV_SECONDBOOT_BUILD_CMDS
+ $(MAKE) -C $(@D)/build \
+ CROSSCOMPILE=$(HOST_DIR)/bin/riscv64-unknown-elf- \
+ SUFFIX=buildroot \
+ GIT_VERSION=$(BEAGLEV_SECONDBOOT_VERSION)
+endef
+
+define BEAGLEV_SECONDBOOT_INSTALL_IMAGES_CMDS
+ $(INSTALL) -D -m 0644 $(@D)/build/bootloader-BEAGLEV-buildroot.bin.out \
+ $(BINARIES_DIR)/bootloader-BEAGLEV-buildroot.bin.out
+endef
+
+$(eval $(generic-package))