How to change build order about vmlinux

I want to build bbl package

include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk

PKG_NAME:=bbl
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/riscv/riscv-pk.git
PKG_SOURCE_VERSION:=0179115bfbd1f8070f7c1bb0bbfd5123ef9f8bd8

include $(INCLUDE_DIR)/package.mk

define Package/bbl
 SECTION:=boot
 CATEGORY:=Boot Loaders
 DEPENDS:=@TARGET_riscv64
 DEFAULT:=y
 TITLE:=Berkeley boot loader
endef

define Package/bbl/description
        Berkeley boot loader
endef

define Package/bbl/install
        echo BBL install ok
endef

define Build/Prepare
        $(call Build/Prepare/Default)
        mkdir -p $(PKG_BUILD_DIR)/build
endef

define Build/Configure
        cd $(PKG_BUILD_DIR)/build; \
                ../configure --host=riscv64-linux --with-payload=$(KERNEL_BUILD_DIR)/vmlinux
endef

define Build/Compile
        $(MAKE) -C $(PKG_BUILD_DIR)/build
endef

$(eval $(call BuildPackage,bbl))

bbl must have a vmlinux
--with-payload=$(KERNEL_BUILD_DIR)/vmlinux

How can I fix it?

I hope to be able to establish vmlinux and then establish bbl

What device? What version buildroot? what error are you getting?

Unfortunately you cannot simply change build order of vmlinux, as this behaviour is deeply rooted in the build system. The only solution I see is compiling bbl with a dummy payload, then perform the final linkage of the payload in the image build recipe, similar to how e.g. lzma-loader is handled in Image/Prepare of target/linux/brcm47xx/image/Makefile.

1 Like