From e246a8d60adfa6fc301a2710226064ac3c086025 Mon Sep 17 00:00:00 2001 From: ivoszbg Date: Tue, 14 Jun 2022 21:50:15 +0300 Subject: [PATCH] Makefile: Move Linux kernel and Device Tree paths to Kconfig Signed-off-by: Ivaylo Ivanov --- Kconfig | 36 +++++++++++++++++++++++++++++------- Makefile | 13 ++++--------- 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/Kconfig b/Kconfig index ef9de79..081f552 100644 --- a/Kconfig +++ b/Kconfig @@ -4,13 +4,35 @@ # mainmenu "uniLoader Configuration" -config CROSS_COMPILE - string "Cross-compiler tool prefix" - help - Same as running 'make CROSS_COMPILE=prefix-' but stored for - default make runs in this kernel build directory. You don't - need to set this unless you want the configured kernel build - directory to select the cross-compiler automatically. +menu "Building options" + config CROSS_COMPILE + string "Cross-compiler tool prefix" + help + Same as running 'make CROSS_COMPILE=prefix-' but stored for + default make runs in this kernel build directory. You don't + need to set this unless you want the configured kernel build + directory to select the cross-compiler automatically. + + config EMBED_LINUX + bool "Embed linux kernel and device tree" + default y + help + Select this if you want uniLoader to load a linux kernel and device tree + + config KERNEL_PATH + string "Path to kernel image" + depends on EMBED_LINUX + default blob/Image + help + Path to the kernel, which is going to get embedded to uniLoader + + config DT_PATH + string "Path to device tree image" + depends on EMBED_LINUX + default blob/dtb + help + Path to the device tree, which is going to get embedded to uniLoader +endmenu source "lib/Kconfig" diff --git a/Makefile b/Makefile index ea86e84..1a3854a 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -# -# Defaut values -# -KERNEL_PATH?=blob/Image -DTB_PATH?=blob/dtb - # *DOCUMENTATION* # To see a list of typical targets execute "make help" # More info can be located in ./README @@ -106,6 +100,8 @@ VPATH := $(srctree) export srctree objtree VPATH CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%) +KERNEL_PATH ?= $(CONFIG_KERNEL_PATH:"%"=%) +DT_PATH ?= $(CONFIG_DT_PATH:"%"=%) KCONFIG_CONFIG ?= .config export KCONFIG_CONFIG @@ -362,7 +358,7 @@ quiet_cmd_uniLoader = LD $@.o cmd_uniLoader = $(LD) $(main-y) $(uniLoader-libs) -o $@.o --script=main/linker.lds main/linker.lds: main/linker.lds.S $(KERNEL_PATH) - $(CPP) $< -DKERNEL_PATH=$(KERNEL_PATH) -DDTB_PATH=$(DTB_PATH) -P -o $@ + $(CPP) $< -DKERNEL_PATH=$(KERNEL_PATH) -DDTB_PATH=$(DT_PATH) -P -o $@ uniLoader: $(uniLoader-all) $(call if_changed,uniLoader) @@ -385,7 +381,6 @@ PHONY += $(uniLoader-dirs) $(uniLoader-dirs): scripts_basic $(Q)$(MAKE) $(build)=$@ - ### # Cleaning is done on three levels. # make clean Delete most generated files @@ -416,7 +411,7 @@ clean: $(clean-dirs) $(call cmd,rmfiles) @find . $(RCS_FIND_IGNORE) \ \( -name '*.[oas]' -o -name '.*.cmd' \ - -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ + -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' -o -name '*.lds' \ -o -name modules.builtin -o -name '.tmp_*.o.*' \ -o -name '*.gcno' \) -type f -print | xargs rm -f