Skip to content

Commit e282e27

Browse files
committed
Add u-boot build targets
1 parent 228b68c commit e282e27

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

Makefile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,46 @@ rootfs_clean:
341341
$(SUDO) rm -f $(CPIO_FILE)
342342
$(SUDO) rm -f $(ROOTFS)
343343

344+
##
345+
## U-Boot
346+
##
347+
348+
# Note: We're reusing the TARGET variable from the Linux build section
349+
350+
UBOOT_SRC := $(ROOT_DIR)/u-boot
351+
UBOOT_OUT := $(OUT_DIR)/uboot/$(ARCH)
352+
UBOOT_CONFIG := $(UBOOT_OUT)/.config
353+
UBOOT_BIN := $(UBOOT_OUT)/u-boot.bin
354+
355+
ifeq ($(ARCH),x86_64)
356+
UBOOT_DEFCONFIG=qemu-x86_64_defconfig
357+
else ifeq ($(ARCH),i386)
358+
UBOOT_DEFCONFIG=qemu-x86_defconfig
359+
else ifeq ($(ARCH),arm64)
360+
UBOOT_DEFCONFIG=qemu_arm64_defconfig
361+
endif
362+
363+
UBOOT_MAKE := \
364+
PATH=$(CLANG_DIR)/bin:$(PATH) \
365+
$(MAKE) \
366+
-C $(UBOOT_SRC) \
367+
HOSTCC=clang \
368+
O=$(UBOOT_OUT) \
369+
-j `nproc`
370+
371+
.PHONY: uboot_defconfig
372+
uboot_defconfig $(UBOOT_CONFIG): | $(CLANG_DIR)
373+
+ $(UBOOT_MAKE) $(UBOOT_DEFCONFIG)
374+
375+
.PHONY: uboot
376+
uboot $(UBOOT_BIN): $(UBOOT_CONFIG) | $(CLANG_DIR)
377+
+ $(UBOOT_MAKE) CROSS_COMPILE=$(TARGET)- CC=clang
378+
cd $(UBOOT_SRC) && ./scripts/gen_compile_commands.py -d $(UBOOT_OUT)
379+
380+
.PHONY: uboot_clean
381+
uboot_clean:
382+
+ $(UBOOT_MAKE) mrproper
383+
344384
##
345385
## Run QEMU
346386
##

0 commit comments

Comments
 (0)