Skip to content

Commit 2d17bd2

Browse files
masahir0ysuryasaimadhu
authored andcommitted
x86/purgatory: Omit use of bin2c
The .incbin assembler directive is much faster than bin2c + $(CC). Do similar refactoring as in 4c0f032 ("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 <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 61922d3 commit 2d17bd2

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

arch/x86/.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@ boot/compressed/vmlinux
33
tools/test_get_len
44
tools/insn_sanity
55
tools/insn_decoder_test
6-
purgatory/kexec-purgatory.c
76
purgatory/purgatory.ro
8-

arch/x86/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2032,7 +2032,6 @@ config KEXEC
20322032
config KEXEC_FILE
20332033
bool "kexec file based system call"
20342034
select KEXEC_CORE
2035-
select BUILD_BIN2C
20362035
depends on X86_64
20372036
depends on CRYPTO=y
20382037
depends on CRYPTO_SHA256=y

arch/x86/purgatory/Makefile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,6 @@ $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE
7373
$(obj)/purgatory.chk: $(obj)/purgatory.ro FORCE
7474
$(call if_changed,ld)
7575

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
8377

8478
obj-y += kexec-purgatory.o

arch/x86/purgatory/kexec-purgatory.S

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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

scripts/remove-stale-files

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,5 @@ if [ -n "${building_out_of_srctree}" ]; then
4141
fi
4242

4343
rm -f scripts/extract-cert
44+
45+
rm -f arch/x86/purgatory/kexec-purgatory.c

0 commit comments

Comments
 (0)