Makefile: Move Linux kernel and Device Tree paths to Kconfig

Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
This commit is contained in:
ivoszbg 2022-06-14 21:50:15 +03:00
parent c038c7839c
commit e246a8d60a
2 changed files with 33 additions and 16 deletions

36
Kconfig
View File

@ -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"

View File

@ -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