xref: /linux/arch/alpha/boot/compressed/Makefile (revision c437950dceb88a92ca526f5ce3afd327c4fce457)
1# SPDX-License-Identifier: GPL-2.0-only
2#
3# Create a self-extracting compressed vmlinux image from the original
4# vmlinux. aboot loads and enters it like a plain vmlinux.
5#
6
7OBJECTS := head.o misc.o trampoline.o piggy.o
8OBJECTS += memcpy.o memmove.o memset.o
9OBJECTS += __divqu.o __remqu.o __divlu.o __remlu.o
10targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz
11targets += $(OBJECTS)
12
13# The stub runs before the kernel has identified the CPU it booted on, so
14# build it for the base Alpha instruction set rather than inheriting the
15# kernel's -mcpu=.
16KBUILD_CFLAGS := -D__KERNEL__ -std=gnu11 -Os -fno-strict-aliasing
17KBUILD_CFLAGS += -fno-PIE -ffreestanding -fno-stack-protector
18KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
19KBUILD_CFLAGS += -pipe -mcpu=ev4 -mno-fp-regs -ffixed-8
20KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING -D__DISABLE_EXPORTS
21KBUILD_CFLAGS += $(CC_FLAGS_DIALECT)
22KBUILD_AFLAGS := -D__ASSEMBLY__ $(KBUILD_CFLAGS)
23
24# The stub has no sanitizer or coverage runtime. arch/alpha/lib/lib.a is
25# built with the kernel's instrumentation and -mcpu=, so build private
26# copies of the library routines the stub needs instead of linking it.
27UBSAN_SANITIZE := n
28GCOV_PROFILE := n
29
30$(obj)/memcpy.o: $(srctree)/arch/alpha/lib/memcpy.c FORCE
31	$(call if_changed_dep,cc_o_c)
32
33$(obj)/memmove.o: $(srctree)/arch/alpha/lib/memmove.S FORCE
34	$(call if_changed_dep,as_o_S)
35
36$(obj)/memset.o: $(srctree)/arch/alpha/lib/memset.S FORCE
37	$(call if_changed_dep,as_o_S)
38
39AFLAGS___divqu.o := -DDIV
40AFLAGS___remqu.o := -DREM
41AFLAGS___divlu.o := -DDIV -DINTSIZE
42AFLAGS___remlu.o := -DREM -DINTSIZE
43
44$(addprefix $(obj)/,__divqu.o __remqu.o __divlu.o __remlu.o): $(srctree)/arch/alpha/lib/divide.S FORCE
45	$(call if_changed_dep,as_o_S)
46
47LDFLAGS_vmlinux := -X --orphan-handling=warn -T
48$(obj)/vmlinux: $(obj)/vmlinux.lds $(addprefix $(obj)/, $(OBJECTS)) FORCE
49	$(call if_changed,ld)
50
51OBJCOPYFLAGS_vmlinux.bin := -R .comment -R .note -S
52$(obj)/vmlinux.bin: vmlinux FORCE
53	$(call if_changed,objcopy)
54
55suffix-$(CONFIG_KERNEL_GZIP)	:= gz
56
57$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
58	$(call if_changed,gzip)
59
60LDFLAGS_piggy.o := -r --format binary --oformat elf64-alpha -T
61$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE
62	$(call if_changed,ld)
63