aboutsummaryrefslogtreecommitdiff
path: root/Android.mk
blob: 0b0d3f41b2c1f5aa45b29e232ea5c792ece0ff4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#Android makefile to build u-boot as a part of Android Build

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

# Give other modules a nice, symbolic name to use as a dependent
# Yes, there are modules that cannot build unless uboot has
# been built. Typical (only?) example: linux kernel (needs mkimage program)
.phony: build-mkenvimg build-uboot clean-uboot

PRIVATE_UBOOT_ARGS := -C $(BOOT_PATH)/u-boot ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) O=$(abspath $(UBOOT_OUTPUT))
PRIVATE_OUT := $(abspath $(PRODUCT_OUT)/root)

# The next three assignments are for building mk_envimg host tool.
# BUILD_UBOOT_ENV_IMG_OUTPUT and BUILD_UBOOT_ENV_IMG_INPUT should be set
# in BoardConfig.mk and are, if they are set, added to the cmdline.
PRIVATE_UBOOT_MK_ENVIMG_ARGS := obj=$(abspath $(HOST_OUT_EXECUTABLES))/ -C $(BOOT_PATH)/u-boot/tools/mk_envimg

ifneq ($(BUILD_UBOOT_ENV_IMG_OUTPUT),)
PRIVATE_UBOOT_MK_ENVIMG_ARGS += OUTPUT=$(abspath $(BUILD_UBOOT_ENV_IMG_OUTPUT))
endif

ifneq ($(BUILD_UBOOT_ENV_IMG_INPUT),)
PRIVATE_UBOOT_MK_ENVIMG_ARGS += INPUT=$(abspath $(BUILD_UBOOT_ENV_IMG_INPUT))
endif

# If the U-boot splash image output path or input path needs to be changed this shall
# be done by updating both the UBOOT_SPLASH_IMAGE_OUTPUT variable in BoardConfig.mk (vendor/st-ericsson/uxx00)
# and also the copying of the splash image file in ste_uxx00.mk (vendor/st-ericsson/products)

include $(CLEAR_VARS)
UBOOT_LIBPATH := $(UBOOT_OUTPUT)
LOCAL_PATH := $(UBOOT_LIBPATH)
LOCAL_SRC_FILES := u-boot.bin
LOCAL_MODULE := $(LOCAL_SRC_FILES)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE_PATH := $(PRODUCT_OUT)

$(UBOOT_LIBPATH)/$(LOCAL_SRC_FILES) $(UBOOT_LIBPATH)/tools/mkimage: build-uboot
include $(BUILD_PREBUILT)

ifdef BUILD_UBOOT_ENV_IMG_OUTPUT
include $(CLEAR_VARS)
ENVIMG_LIBPATH := $(dir $(BUILD_UBOOT_ENV_IMG_OUTPUT))
LOCAL_PATH := $(ENVIMG_LIBPATH)
LOCAL_SRC_FILES := $(notdir $(BUILD_UBOOT_ENV_IMG_OUTPUT))
LOCAL_MODULE := $(LOCAL_SRC_FILES)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE_PATH := $(PRODUCT_OUT)

$(ENVIMG_LIBPATH)/$(LOCAL_SRC_FILES): build-mkenvimg
include $(BUILD_PREBUILT)
endif

# Configures, builds and installs uboot. UBOOT_DEFCONFIG usually
# comes from the BoardConfig.mk file, but can be overridden on the
# command line or by an environment variable.
# If UBOOT_DEFCONFIG is set to 'local', configuration is skipped.
# This is useful if you want to play with your own, custom configuration.

build-uboot:
ifeq ($(UBOOT_DEFCONFIG),local)
	@echo Skipping uboot configuration, UBOOT_DEFCONFIG set to local
else
	$(MAKE) $(PRIVATE_UBOOT_ARGS) $(UBOOT_DEFCONFIG)
endif
	$(MAKE) $(PRIVATE_UBOOT_ARGS)

build-mkenvimg: build-uboot
	$(MAKE) $(PRIVATE_UBOOT_MK_ENVIMG_ARGS) all

# An Android clean removes the files built for the current HW configuration,
# such as u8500,
# while a clobber removes all built files (rm -rf $(OUT_DIR)).

clean clobber: clean-uboot clean-mk_envimg

clean-uboot:
	$(MAKE) $(PRIVATE_UBOOT_ARGS) clean

clean-mk_envimg:
	$(MAKE) $(PRIVATE_UBOOT_MK_ENVIMG_ARGS) clean

installclean: installclean-uboot

installclean-uboot:
	rm -f u-boot.bin u-boot.map u-boot.srec