Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/purgatory: Omit use of bin2c

The .incbin assembler directive is much faster than bin2c + $(CC).

Do similar refactoring as in

4c0f032d4963 ("s390/purgatory: Omit use of bin2c").

Please note the .quad directive matches to size_t in C (both 8
byte) because the purgatory is compiled only for the 64-bit kernel.
(KEXEC_FILE depends on X86_64).

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20220725020812.622255-2-masahiroy@kernel.org

authored by

Masahiro Yamada and committed by
Borislav Petkov
2d17bd24 61922d3f

+17 -10
-2
arch/x86/.gitignore
··· 3 3 tools/test_get_len 4 4 tools/insn_sanity 5 5 tools/insn_decoder_test 6 - purgatory/kexec-purgatory.c 7 6 purgatory/purgatory.ro 8 -
-1
arch/x86/Kconfig
··· 2032 2032 config KEXEC_FILE 2033 2033 bool "kexec file based system call" 2034 2034 select KEXEC_CORE 2035 - select BUILD_BIN2C 2036 2035 depends on X86_64 2037 2036 depends on CRYPTO=y 2038 2037 depends on CRYPTO_SHA256=y
+1 -7
arch/x86/purgatory/Makefile
··· 73 73 $(obj)/purgatory.chk: $(obj)/purgatory.ro FORCE 74 74 $(call if_changed,ld) 75 75 76 - targets += kexec-purgatory.c 77 - 78 - quiet_cmd_bin2c = BIN2C $@ 79 - cmd_bin2c = $(objtree)/scripts/bin2c kexec_purgatory < $< > $@ 80 - 81 - $(obj)/kexec-purgatory.c: $(obj)/purgatory.ro $(obj)/purgatory.chk FORCE 82 - $(call if_changed,bin2c) 76 + $(obj)/kexec-purgatory.o: $(obj)/purgatory.ro $(obj)/purgatory.chk 83 77 84 78 obj-y += kexec-purgatory.o
+14
arch/x86/purgatory/kexec-purgatory.S
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + 3 + .section .rodata, "a" 4 + 5 + .align 8 6 + kexec_purgatory: 7 + .globl kexec_purgatory 8 + .incbin "arch/x86/purgatory/purgatory.ro" 9 + .Lkexec_purgatory_end: 10 + 11 + .align 8 12 + kexec_purgatory_size: 13 + .globl kexec_purgatory_size 14 + .quad .Lkexec_purgatory_end - kexec_purgatory
+2
scripts/remove-stale-files
··· 41 41 fi 42 42 43 43 rm -f scripts/extract-cert 44 + 45 + rm -f arch/x86/purgatory/kexec-purgatory.c