162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci#
362306a36Sopenharmony_ci# linux/arch/arm/boot/bootp/Makefile
462306a36Sopenharmony_ci#
562306a36Sopenharmony_ci# This file is included by the global makefile so that you can add your own
662306a36Sopenharmony_ci# architecture-specific flags and dependencies.
762306a36Sopenharmony_ci#
862306a36Sopenharmony_ciGCOV_PROFILE	:= n
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ciifdef PHYS_OFFSET
1162306a36Sopenharmony_ciadd_hex = $(shell printf 0x%x $$(( $(1) + $(2) )) )
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci# If PHYS_OFFSET is set, INITRD_PHYS and PARAMS_PHYS can be derived,
1462306a36Sopenharmony_ci# otherwise they must be passed on the command line.
1562306a36Sopenharmony_ci#
1662306a36Sopenharmony_ci# Note: the following conditions must always be true:
1762306a36Sopenharmony_ci#   PARAMS_PHYS must be within 4MB of ZRELADDR
1862306a36Sopenharmony_ci#   INITRD_PHYS must be in RAM
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ciPARAMS_PHYS := $(call add_hex, $(PHYS_OFFSET), 0x100)
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci# guess an initrd location if possible
2362306a36Sopenharmony_ciinitrd_offset-$(CONFIG_ARCH_FOOTBRIDGE)	+= 0x00800000
2462306a36Sopenharmony_ciinitrd_offset-$(CONFIG_ARCH_SA1100)	+= 0x00800000
2562306a36Sopenharmony_ciinitrd_offset-$(CONFIG_ARCH_RPC)	+= 0x08000000
2662306a36Sopenharmony_ciINITRD_OFFSET := $(initrd_offset-y)
2762306a36Sopenharmony_ciifdef INITRD_OFFSET
2862306a36Sopenharmony_ciINITRD_PHYS := $(call add_hex, $(PHYS_OFFSET), $(INITRD_OFFSET))
2962306a36Sopenharmony_ciendif
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ciendif
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ciPHONY += initrd
3462306a36Sopenharmony_ciinitrd:
3562306a36Sopenharmony_ci	@test "$(PARAMS_PHYS)" != "" || \
3662306a36Sopenharmony_ci	(echo bootpImage: You must specify PHYS_OFFSET of PARAMS_PHYS ; exit -1)
3762306a36Sopenharmony_ci	@test "$(INITRD_PHYS)" != "" || \
3862306a36Sopenharmony_ci	(echo bootpImage: You must specify INITRD_OFFSET or INITRD_PHYS ; exit -1)
3962306a36Sopenharmony_ci	@test "$(INITRD)" != "" || \
4062306a36Sopenharmony_ci	(echo bootpImage: You must specify INITRD; exit -1)
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ciLDFLAGS_bootp	:= --no-undefined -X \
4362306a36Sopenharmony_ci		 --defsym initrd_phys=$(INITRD_PHYS) \
4462306a36Sopenharmony_ci		 --defsym params_phys=$(PARAMS_PHYS) -T
4562306a36Sopenharmony_ciAFLAGS_initrd.o :=-DINITRD=\"$(INITRD)\"
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_citargets	:= bootp init.o kernel.o initrd.o
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci# Note that bootp.lds picks up kernel.o and initrd.o
5062306a36Sopenharmony_ci$(obj)/bootp:	$(src)/bootp.lds $(addprefix $(obj)/,init.o kernel.o initrd.o) FORCE
5162306a36Sopenharmony_ci	$(call if_changed,ld)
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci# kernel.o and initrd.o includes a binary image using
5462306a36Sopenharmony_ci# .incbin, a dependency which is not tracked automatically
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci$(obj)/kernel.o: arch/arm/boot/zImage FORCE
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci$(obj)/initrd.o: initrd $(INITRD) FORCE
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ciPHONY += $(INITRD)
61