2009-10-14 06:12:16 -04:00
|
|
|
#
|
|
|
|
# This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
# License.
|
|
|
|
#
|
|
|
|
# Adapted for MIPS Pete Popov, Dan Malek
|
|
|
|
#
|
|
|
|
# Copyright (C) 1994 by Linus Torvalds
|
|
|
|
# Adapted for PowerPC by Gary Thomas
|
|
|
|
# modified by Cort (cort@cs.nmt.edu)
|
|
|
|
#
|
|
|
|
# Copyright (C) 2009 Lemote Inc. & DSLab, Lanzhou University
|
2010-01-04 04:16:51 -05:00
|
|
|
# Author: Wu Zhangjin <wuzhangjin@gmail.com>
|
2009-10-14 06:12:16 -04:00
|
|
|
#
|
|
|
|
|
2015-03-16 17:43:08 -04:00
|
|
|
include $(srctree)/arch/mips/Kbuild.platforms
|
|
|
|
|
2009-10-14 06:12:16 -04:00
|
|
|
# set the default size of the mallocing area for decompressing
|
|
|
|
BOOT_HEAP_SIZE := 0x400000
|
|
|
|
|
|
|
|
# Disable Function Tracer
|
2016-12-26 13:57:52 -05:00
|
|
|
KBUILD_CFLAGS := $(filter-out -pg, $(KBUILD_CFLAGS))
|
2009-10-14 06:12:16 -04:00
|
|
|
|
2013-07-01 05:38:30 -04:00
|
|
|
KBUILD_CFLAGS := $(filter-out -fstack-protector, $(KBUILD_CFLAGS))
|
|
|
|
|
2016-11-25 07:36:18 -05:00
|
|
|
KBUILD_CFLAGS := $(KBUILD_CFLAGS) -D__KERNEL__ \
|
2010-01-26 04:04:02 -05:00
|
|
|
-DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) -D"VMLINUX_LOAD_ADDRESS_ULL=$(VMLINUX_LOAD_ADDRESS)ull"
|
2009-10-14 06:12:16 -04:00
|
|
|
|
2016-11-25 07:36:18 -05:00
|
|
|
KBUILD_AFLAGS := $(KBUILD_AFLAGS) -D__ASSEMBLY__ \
|
2010-01-26 04:04:02 -05:00
|
|
|
-DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \
|
2013-08-30 11:42:41 -04:00
|
|
|
-DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS)
|
2009-10-14 06:12:16 -04:00
|
|
|
|
2019-12-09 07:37:07 -05:00
|
|
|
# Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
|
|
|
|
KCOV_INSTRUMENT := n
|
|
|
|
|
2010-05-30 10:28:03 -04:00
|
|
|
# decompressor objects (linked with vmlinuz)
|
2021-07-02 10:28:37 -04:00
|
|
|
vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o $(obj)/bswapsi.o
|
2009-10-14 06:12:16 -04:00
|
|
|
|
2010-01-31 07:39:40 -05:00
|
|
|
ifdef CONFIG_DEBUG_ZBOOT
|
2010-12-25 10:11:49 -05:00
|
|
|
vmlinuzobjs-$(CONFIG_DEBUG_ZBOOT) += $(obj)/dbg.o
|
2010-05-30 10:28:03 -04:00
|
|
|
vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o
|
2015-12-10 04:57:21 -05:00
|
|
|
vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART_PROM) += $(obj)/uart-prom.o
|
2010-07-15 15:45:04 -04:00
|
|
|
vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY) += $(obj)/uart-alchemy.o
|
2016-01-26 03:38:29 -05:00
|
|
|
vmlinuzobjs-$(CONFIG_ATH79) += $(obj)/uart-ath79.o
|
2010-01-31 07:39:40 -05:00
|
|
|
endif
|
2009-10-14 06:12:16 -04:00
|
|
|
|
2016-01-26 03:38:29 -05:00
|
|
|
extra-y += uart-ath79.c
|
|
|
|
$(obj)/uart-ath79.c: $(srctree)/arch/mips/ath79/early_printk.c
|
|
|
|
$(call cmd,shipped)
|
|
|
|
|
2021-07-02 10:28:37 -04:00
|
|
|
vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o
|
2015-12-10 04:57:20 -05:00
|
|
|
|
2018-04-11 03:50:18 -04:00
|
|
|
extra-y += ashldi3.c
|
|
|
|
$(obj)/ashldi3.c: $(obj)/%.c: $(srctree)/lib/%.c FORCE
|
|
|
|
$(call if_changed,shipped)
|
|
|
|
|
|
|
|
extra-y += bswapsi.c
|
|
|
|
$(obj)/bswapsi.c: $(obj)/%.c: $(srctree)/arch/mips/lib/%.c FORCE
|
|
|
|
$(call if_changed,shipped)
|
2015-12-10 04:57:20 -05:00
|
|
|
|
|
|
|
targets := $(notdir $(vmlinuzobjs-y))
|
2013-09-11 06:51:41 -04:00
|
|
|
|
2010-05-30 10:28:03 -04:00
|
|
|
targets += vmlinux.bin
|
2009-10-14 06:12:16 -04:00
|
|
|
OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S
|
2010-05-30 10:28:03 -04:00
|
|
|
$(obj)/vmlinux.bin: $(KBUILD_IMAGE) FORCE
|
2009-10-14 06:12:16 -04:00
|
|
|
$(call if_changed,objcopy)
|
|
|
|
|
|
|
|
tool_$(CONFIG_KERNEL_GZIP) = gzip
|
|
|
|
tool_$(CONFIG_KERNEL_BZIP2) = bzip2
|
2013-09-16 11:55:20 -04:00
|
|
|
tool_$(CONFIG_KERNEL_LZ4) = lz4
|
2009-10-14 06:12:16 -04:00
|
|
|
tool_$(CONFIG_KERNEL_LZMA) = lzma
|
2010-01-15 07:34:46 -05:00
|
|
|
tool_$(CONFIG_KERNEL_LZO) = lzo
|
2013-09-11 06:51:41 -04:00
|
|
|
tool_$(CONFIG_KERNEL_XZ) = xzkern
|
2010-05-30 10:28:03 -04:00
|
|
|
|
2010-06-02 04:35:24 -04:00
|
|
|
targets += vmlinux.bin.z
|
|
|
|
$(obj)/vmlinux.bin.z: $(obj)/vmlinux.bin FORCE
|
2009-10-14 06:12:16 -04:00
|
|
|
$(call if_changed,$(tool_y))
|
|
|
|
|
2015-12-10 04:57:20 -05:00
|
|
|
targets += piggy.o dummy.o
|
2010-06-02 04:35:24 -04:00
|
|
|
OBJCOPYFLAGS_piggy.o := --add-section=.image=$(obj)/vmlinux.bin.z \
|
2013-01-22 06:59:30 -05:00
|
|
|
--set-section-flags=.image=contents,alloc,load,readonly,data
|
2010-06-02 04:35:24 -04:00
|
|
|
$(obj)/piggy.o: $(obj)/dummy.o $(obj)/vmlinux.bin.z FORCE
|
2010-05-30 10:28:03 -04:00
|
|
|
$(call if_changed,objcopy)
|
2009-10-14 06:12:16 -04:00
|
|
|
|
2019-06-19 10:08:18 -04:00
|
|
|
HOSTCFLAGS_calc_vmlinuz_load_addr.o += $(LINUXINCLUDE)
|
|
|
|
|
2010-06-02 04:35:25 -04:00
|
|
|
# Calculate the load address of the compressed kernel image
|
|
|
|
hostprogs-y := calc_vmlinuz_load_addr
|
|
|
|
|
2015-03-16 17:43:08 -04:00
|
|
|
ifneq ($(zload-y),)
|
|
|
|
VMLINUZ_LOAD_ADDRESS := $(zload-y)
|
2012-03-30 10:48:05 -04:00
|
|
|
else
|
2010-06-02 04:35:25 -04:00
|
|
|
VMLINUZ_LOAD_ADDRESS = $(shell $(obj)/calc_vmlinuz_load_addr \
|
2020-05-06 01:52:45 -04:00
|
|
|
$(obj)/vmlinux.bin $(LINKER_LOAD_ADDRESS))
|
2012-03-30 10:48:05 -04:00
|
|
|
endif
|
2016-10-31 10:19:55 -04:00
|
|
|
UIMAGE_LOADADDR = $(VMLINUZ_LOAD_ADDRESS)
|
2010-06-02 04:35:25 -04:00
|
|
|
|
|
|
|
vmlinuzobjs-y += $(obj)/piggy.o
|
|
|
|
|
2015-08-18 10:03:10 -04:00
|
|
|
quiet_cmd_zld = LD $@
|
2018-08-23 19:20:39 -04:00
|
|
|
cmd_zld = $(LD) $(KBUILD_LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T $< $(vmlinuzobjs-y) -o $@
|
2013-01-22 06:59:30 -05:00
|
|
|
quiet_cmd_strip = STRIP $@
|
2010-06-16 03:52:21 -04:00
|
|
|
cmd_strip = $(STRIP) -s $@
|
2010-06-02 04:35:25 -04:00
|
|
|
vmlinuz: $(src)/ld.script $(vmlinuzobjs-y) $(obj)/calc_vmlinuz_load_addr
|
|
|
|
$(call cmd,zld)
|
2010-06-16 03:52:21 -04:00
|
|
|
$(call cmd,strip)
|
2009-10-14 06:12:16 -04:00
|
|
|
|
|
|
|
#
|
|
|
|
# Some DECstations need all possible sections of an ECOFF executable
|
|
|
|
#
|
|
|
|
ifdef CONFIG_MACH_DECSTATION
|
2010-05-30 10:28:03 -04:00
|
|
|
e2eflag := -a
|
2009-10-14 06:12:16 -04:00
|
|
|
endif
|
|
|
|
|
|
|
|
# elf2ecoff can only handle 32bit image
|
2010-06-02 04:35:25 -04:00
|
|
|
hostprogs-y += ../elf2ecoff
|
2009-10-14 06:12:16 -04:00
|
|
|
|
|
|
|
ifdef CONFIG_32BIT
|
|
|
|
VMLINUZ = vmlinuz
|
|
|
|
else
|
|
|
|
VMLINUZ = vmlinuz.32
|
|
|
|
endif
|
|
|
|
|
2010-05-30 10:28:03 -04:00
|
|
|
quiet_cmd_32 = OBJCOPY $@
|
|
|
|
cmd_32 = $(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@
|
2009-10-14 06:12:16 -04:00
|
|
|
vmlinuz.32: vmlinuz
|
2010-05-30 10:28:03 -04:00
|
|
|
$(call cmd,32)
|
2009-10-14 06:12:16 -04:00
|
|
|
|
2013-01-22 06:59:30 -05:00
|
|
|
quiet_cmd_ecoff = ECOFF $@
|
2010-05-30 10:28:03 -04:00
|
|
|
cmd_ecoff = $< $(VMLINUZ) $@ $(e2eflag)
|
2009-10-14 06:12:16 -04:00
|
|
|
vmlinuz.ecoff: $(obj)/../elf2ecoff $(VMLINUZ)
|
2010-05-30 10:28:03 -04:00
|
|
|
$(call cmd,ecoff)
|
2009-10-14 06:12:16 -04:00
|
|
|
|
2009-12-10 09:55:13 -05:00
|
|
|
OBJCOPYFLAGS_vmlinuz.bin := $(OBJCOPYFLAGS) -O binary
|
2009-10-14 06:12:16 -04:00
|
|
|
vmlinuz.bin: vmlinuz
|
2010-05-30 10:28:03 -04:00
|
|
|
$(call cmd,objcopy)
|
2009-10-14 06:12:16 -04:00
|
|
|
|
2009-12-10 09:55:13 -05:00
|
|
|
OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFLAGS) -S -O srec
|
2009-10-14 06:12:16 -04:00
|
|
|
vmlinuz.srec: vmlinuz
|
2010-05-30 10:28:03 -04:00
|
|
|
$(call cmd,objcopy)
|
2009-10-14 06:12:16 -04:00
|
|
|
|
2016-10-31 10:19:55 -04:00
|
|
|
uzImage.bin: vmlinuz.bin FORCE
|
|
|
|
$(call if_changed,uimage,none)
|
|
|
|
|
2018-01-16 16:38:24 -05:00
|
|
|
clean-files += $(objtree)/vmlinuz
|
|
|
|
clean-files += $(objtree)/vmlinuz.32
|
|
|
|
clean-files += $(objtree)/vmlinuz.ecoff
|
|
|
|
clean-files += $(objtree)/vmlinuz.bin
|
|
|
|
clean-files += $(objtree)/vmlinuz.srec
|