1 # 1 # 2 # This file is subject to the terms and condit !! 2 # linux/arch/i386/boot/compressed/Makefile 3 # License. << 4 # 3 # 5 # Adapted for MIPS Pete Popov, Dan Malek !! 4 # create a compressed vmlinux image from the original vmlinux 6 # 5 # 7 # Copyright (C) 1994 by Linus Torvalds << 8 # Adapted for PowerPC by Gary Thomas << 9 # modified by Cort (cort@cs.nmt.edu) << 10 # << 11 # Copyright (C) 2009 Lemote Inc. & DSLab, Lanz << 12 # Author: Wu Zhangjin <wuzhangjin@gmail.com> << 13 # << 14 << 15 include $(srctree)/arch/mips/Kbuild.platforms << 16 << 17 # set the default size of the mallocing area f << 18 BOOT_HEAP_SIZE := 0x400000 << 19 << 20 # Disable Function Tracer << 21 KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_FTRAC << 22 << 23 KBUILD_CFLAGS := $(filter-out -fstack-protecto << 24 << 25 # Disable lq/sq in zboot << 26 ifdef CONFIG_CPU_LOONGSON64 << 27 KBUILD_CFLAGS := $(filter-out -march=loongson3 << 28 endif << 29 << 30 KBUILD_CFLAGS := $(KBUILD_CFLAGS) -D__KERNEL__ << 31 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) -D" << 32 << 33 KBUILD_AFLAGS := $(KBUILD_AFLAGS) -D__ASSEMBLY << 34 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \ << 35 -DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS << 36 << 37 # decompressor objects (linked with vmlinuz) << 38 vmlinuzobjs-y := $(obj)/head.o $(obj)/decompre << 39 << 40 ifdef CONFIG_DEBUG_ZBOOT << 41 vmlinuzobjs-$(CONFIG_DEBUG_ZBOOT) << 42 vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16 << 43 vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART_P << 44 vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY) << 45 vmlinuzobjs-$(CONFIG_ATH79) << 46 endif << 47 << 48 vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashl << 49 << 50 vmlinuzobjs-$(CONFIG_KERNEL_ZSTD) += $(obj)/bs << 51 << 52 targets := $(notdir $(vmlinuzobjs-y)) << 53 << 54 targets += vmlinux.bin << 55 << 56 OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O << 57 << 58 $(obj)/vmlinux.bin: $(KBUILD_IMAGE) FORCE << 59 $(call if_changed,objcopy) << 60 << 61 tool_$(CONFIG_KERNEL_GZIP) = gzip << 62 tool_$(CONFIG_KERNEL_BZIP2) = bzip2_with_siz << 63 tool_$(CONFIG_KERNEL_LZ4) = lz4_with_size << 64 tool_$(CONFIG_KERNEL_LZMA) = lzma_with_size << 65 tool_$(CONFIG_KERNEL_LZO) = lzo_with_size << 66 tool_$(CONFIG_KERNEL_XZ) = xzkern_with_si << 67 tool_$(CONFIG_KERNEL_ZSTD) = zstd22_with_si << 68 << 69 targets += vmlinux.bin.z << 70 << 71 $(obj)/vmlinux.bin.z: $(obj)/vmlinux.bin FORCE << 72 $(call if_changed,$(tool_y)) << 73 << 74 targets += piggy.o dummy.o << 75 6 76 OBJCOPYFLAGS_piggy.o := --add-section=.image=$ !! 7 HEAD = head.o 77 --set-section-flags=.i !! 8 SYSTEM = $(TOPDIR)/vmlinux 78 9 79 $(obj)/piggy.o: $(obj)/dummy.o $(obj)/vmlinux. !! 10 OBJECTS = $(HEAD) misc.o 80 $(call if_changed,objcopy) << 81 11 82 HOSTCFLAGS_calc_vmlinuz_load_addr.o += $(LINUX !! 12 ZLDFLAGS = -e startup_32 83 << 84 # Calculate the load address of the compressed << 85 hostprogs := calc_vmlinuz_load_addr << 86 << 87 ifneq (0x0,$(CONFIG_ZBOOT_LOAD_ADDRESS)) << 88 zload-y = $(CONFIG_ZBOOT_LOAD_ADDRESS) << 89 endif << 90 << 91 ifneq ($(zload-y),) << 92 VMLINUZ_LOAD_ADDRESS := $(zload-y) << 93 else << 94 VMLINUZ_LOAD_ADDRESS = $(shell $(obj)/calc_vml << 95 $(obj)/vmlinux.bin $(LINKER_LO << 96 endif << 97 UIMAGE_LOADADDR = $(VMLINUZ_LOAD_ADDRESS) << 98 << 99 vmlinuzobjs-y += $(obj)/piggy.o << 100 << 101 targets += ../../../../vmlinuz << 102 << 103 quiet_cmd_zld = LD $@ << 104 cmd_zld = $(LD) $(KBUILD_LDFLAGS) -Ttext << 105 quiet_cmd_strip = STRIP $@ << 106 cmd_strip = $(STRIP) -s $@ << 107 << 108 $(objtree)/vmlinuz: $(src)/ld.script $(vmlinuz << 109 $(call cmd,zld) << 110 $(call cmd,strip) << 111 << 112 objboot := $(objtree)/arch/mips/boot << 113 << 114 $(objboot)/vmlinuz: $(objtree)/vmlinuz FORCE << 115 13 116 # 14 # 117 # Some DECstations need all possible sections !! 15 # ZIMAGE_OFFSET is the load offset of the compression loader >> 16 # BZIMAGE_OFFSET is the load offset of the high loaded compression loader 118 # 17 # 119 ifdef CONFIG_MACH_DECSTATION !! 18 ZIMAGE_OFFSET = 0x1000 120 e2eflag := -a !! 19 BZIMAGE_OFFSET = 0x100000 121 endif << 122 << 123 # elf2ecoff can only handle 32bit image << 124 hostprogs += ../elf2ecoff << 125 << 126 ifdef CONFIG_32BIT << 127 VMLINUZ = $(objtree)/vmlinuz << 128 else << 129 VMLINUZ = $(objboot)/vmlinuz.32 << 130 endif << 131 20 132 targets += ../vmlinuz.32 !! 21 ZLINKFLAGS = -Ttext $(ZIMAGE_OFFSET) $(ZLDFLAGS) >> 22 BZLINKFLAGS = -Ttext $(BZIMAGE_OFFSET) $(ZLDFLAGS) 133 23 134 quiet_cmd_32 = OBJCOPY $@ !! 24 all: vmlinux 135 cmd_32 = $(OBJCOPY) -O $(32bit-bfd) $(OB << 136 25 137 $(objboot)/vmlinuz.32: $(objtree)/vmlinuz !! 26 vmlinux: piggy.o $(OBJECTS) 138 $(call cmd,32) !! 27 $(LD) $(ZLINKFLAGS) -o vmlinux $(OBJECTS) piggy.o 139 28 140 targets += ../vmlinuz.ecoff !! 29 bvmlinux: piggy.o $(OBJECTS) >> 30 $(LD) $(BZLINKFLAGS) -o bvmlinux $(OBJECTS) piggy.o 141 31 142 quiet_cmd_ecoff = ECOFF $@ !! 32 head.o: head.S 143 cmd_ecoff = $< $(VMLINUZ) $@ $(e2eflag) !! 33 $(CC) $(AFLAGS) -traditional -c head.S 144 34 145 $(objboot)/vmlinuz.ecoff: $(objboot)/elf2ecoff !! 35 comma := , 146 $(call cmd,ecoff) << 147 36 148 targets += ../vmlinuz.bin !! 37 misc.o: misc.c 149 !! 38 $(CC) $(CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c misc.c 150 OBJCOPYFLAGS_vmlinuz.bin := $(OBJCOPYFLAGS) -O << 151 << 152 $(objboot)/vmlinuz.bin: $(objtree)/vmlinuz << 153 $(call cmd,objcopy) << 154 << 155 targets += ../vmlinuz.srec << 156 << 157 OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFLAGS) - << 158 << 159 $(objboot)/vmlinuz.srec: $(objtree)/vmlinuz << 160 $(call cmd,objcopy) << 161 << 162 targets += ../uzImage.bin << 163 << 164 $(objboot)/uzImage.bin: $(objboot)/vmlinuz.bin << 165 $(call if_changed,uimage,none) << 166 << 167 # << 168 # Flattened Image Tree (.itb) image << 169 # << 170 39 171 ifeq ($(ADDR_BITS),32) !! 40 piggy.o: $(SYSTEM) 172 itb_addr_cells = 1 !! 41 tmppiggy=_tmp_$$$$piggy; \ 173 endif !! 42 rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk; \ 174 ifeq ($(ADDR_BITS),64) !! 43 $(OBJCOPY) $(SYSTEM) $$tmppiggy; \ 175 itb_addr_cells = 2 !! 44 gzip -f -9 < $$tmppiggy > $$tmppiggy.gz; \ 176 endif !! 45 echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $$tmppiggy.lnk; \ 177 !! 46 $(LD) -r -o piggy.o -b binary $$tmppiggy.gz -b elf32-i386 -T $$tmppiggy.lnk; \ 178 targets += ../vmlinuz.its.S !! 47 rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk 179 << 180 quiet_cmd_its_cat = CAT $@ << 181 cmd_its_cat = cat $(real-prereqs) >$@ << 182 << 183 $(objboot)/vmlinuz.its.S: $(addprefix $(srctre << 184 $(call if_changed,its_cat) << 185 << 186 targets += ../vmlinuz.its << 187 << 188 quiet_cmd_cpp_its_S = ITS $@ << 189 cmd_cpp_its_S = $(CPP) -P -C -o $@ $< \ << 190 -DKERNEL_NAME="\"Linux << 191 -DVMLINUX_BINARY="\"$( << 192 -DVMLINUX_COMPRESSION= << 193 -DVMLINUX_LOAD_ADDRESS << 194 -DVMLINUX_ENTRY_ADDRES << 195 -DADDR_BITS=$(ADDR_BIT << 196 -DADDR_CELLS=$(itb_add << 197 << 198 $(objboot)/vmlinuz.its: $(objboot)/vmlinuz.its << 199 $(call if_changed,cpp_its_S,vmlinuz.bi << 200 << 201 targets += ../vmlinuz.itb << 202 << 203 quiet_cmd_itb-image = ITB $@ << 204 cmd_itb-image = \ << 205 env PATH="$(objtree)/scripts/d << 206 $(BASH) $(MKIMAGE) \ << 207 -D "-I dts -O dtb -p 500 \ << 208 --include $(objtree)/a << 209 --warning no-unit_addr << 210 -f $(2) $@ << 211 48 212 $(objboot)/vmlinuz.itb: $(objboot)/vmlinuz.its !! 49 clean: 213 $(call if_changed,itb-image,$<) !! 50 rm -f vmlinux bvmlinux _tmp_*
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.