Skip to content

Commit d8357e3

Browse files
masahir0ypalmer-dabbelt
authored andcommitted
riscv/purgatory: Omit use of bin2c
The .incbin assembler directive is much faster than bin2c + $(CC). Do similar refactoring as in commit 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 64BIT). Signed-off-by: Masahiro Yamada <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 788177e commit d8357e3

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed

arch/riscv/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,6 @@ config KEXEC_FILE
494494

495495
config ARCH_HAS_KEXEC_PURGATORY
496496
def_bool KEXEC_FILE
497-
select BUILD_BIN2C
498497
depends on CRYPTO=y
499498
depends on CRYPTO_SHA256=y
500499

arch/riscv/purgatory/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
purgatory.chk
33
purgatory.ro
4-
kexec-purgatory.c

arch/riscv/purgatory/Makefile

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

87-
targets += kexec-purgatory.c
88-
89-
quiet_cmd_bin2c = BIN2C $@
90-
cmd_bin2c = $(objtree)/scripts/bin2c kexec_purgatory < $< > $@
91-
92-
$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro $(obj)/purgatory.chk FORCE
93-
$(call if_changed,bin2c)
87+
$(obj)/kexec-purgatory.o: $(obj)/purgatory.ro $(obj)/purgatory.chk
9488

9589
obj-y += kexec-purgatory.o
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/riscv/purgatory/purgatory.ro"
9+
.Lkexec_purgatroy_end:
10+
11+
.align 8
12+
kexec_purgatory_size:
13+
.globl kexec_purgatory_size
14+
.quad .Lkexec_purgatroy_end - kexec_purgatory

scripts/remove-stale-files

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ if [ -n "${building_out_of_srctree}" ]; then
4040
done
4141
fi
4242

43+
rm -f arch/riscv/purgatory/kexec-purgatory.c
44+
4345
rm -f scripts/extract-cert
4446

4547
rm -f arch/x86/purgatory/kexec-purgatory.c

0 commit comments

Comments
 (0)