Skip to content

Commit 188a157

Browse files
committed
Add u-boot build targets
1 parent 65ec8e1 commit 188a157

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
@@ -344,6 +344,46 @@ rootfs_clean:
344344
$(SUDO) rm -f $(CPIO_FILE)
345345
$(SUDO) rm -f $(ROOTFS)
346346

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

0 commit comments

Comments
 (0)