18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci#
38c2ecf20Sopenharmony_ci# Author: Huacai Chen <chenhuacai@loongson.cn>
48c2ecf20Sopenharmony_ci# Copyright (C) 2020 Loongson Technology Corporation Limited
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#
78c2ecf20Sopenharmony_ci# Drop some uninteresting sections in the kernel.
88c2ecf20Sopenharmony_ci# This is only relevant for ELF kernels but doesn't hurt a.out
98c2ecf20Sopenharmony_ci#
108c2ecf20Sopenharmony_ciOBJECT_FILES_NON_STANDARD	:= y
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_cidrop-sections := .comment .note .options
138c2ecf20Sopenharmony_cistrip-flags   := $(addprefix --remove-section=,$(drop-sections))
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_cisuffix-y			:= bin
168c2ecf20Sopenharmony_cisuffix-$(CONFIG_KERNEL_GZIP)	:= gz
178c2ecf20Sopenharmony_cisuffix-$(CONFIG_KERNEL_BZIP2)	:= bz2
188c2ecf20Sopenharmony_cisuffix-$(CONFIG_KERNEL_LZMA)	:= lzma
198c2ecf20Sopenharmony_cisuffix-$(CONFIG_KERNEL_LZO)	:= lzo
208c2ecf20Sopenharmony_cisuffix-$(CONFIG_KERNEL_LZ4)	:= lz4
218c2ecf20Sopenharmony_cisuffix-$(CONFIG_KERNEL_ZSTD)	:= zst
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_citargets += vmlinux.bin
248c2ecf20Sopenharmony_ciquiet_cmd_bin = OBJCOPY $@
258c2ecf20Sopenharmony_ci      cmd_bin = $(OBJCOPY) -O binary $(strip-flags) $(VMLINUX) $@
268c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin: $(VMLINUX) FORCE
278c2ecf20Sopenharmony_ci	$(call if_changed,bin)
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#
308c2ecf20Sopenharmony_ci# Compressed vmlinux images
318c2ecf20Sopenharmony_ci#
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ciextra-y += vmlinux.bin.gz
348c2ecf20Sopenharmony_ciextra-y += vmlinux.bin.bz2
358c2ecf20Sopenharmony_ciextra-y += vmlinux.bin.lzma
368c2ecf20Sopenharmony_ciextra-y += vmlinux.bin.lzo
378c2ecf20Sopenharmony_ciextra-y += vmlinux.bin.lz4
388c2ecf20Sopenharmony_ciextra-y += vmlinux.bin.zst
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
418c2ecf20Sopenharmony_ci	$(call if_changed,bzip2)
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
448c2ecf20Sopenharmony_ci	$(call if_changed,gzip)
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
478c2ecf20Sopenharmony_ci	$(call if_changed,lzma)
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE
508c2ecf20Sopenharmony_ci	$(call if_changed,lzo)
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin.lz4: $(obj)/vmlinux.bin FORCE
538c2ecf20Sopenharmony_ci	$(call if_changed,lz4)
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin.zst: $(obj)/vmlinux.bin FORCE
568c2ecf20Sopenharmony_ci	$(call if_changed,zst22)
57