mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
80f8be7af0
bin2c was, as its name implies, introduced to convert a binary file to C code. However, I did not see any good reason ever for using this tool because using the .incbin directive is much faster, and often results in simpler code. Most of the uses of bin2c have been killed, for example: -13610aa908
("kernel/configs: use .incbin directive to embed config_data.gz") -4c0f032d49
("s390/purgatory: Omit use of bin2c") security/tomoyo/Makefile has even less reason for using bin2c because the policy files are text data. So, sed is enough for converting them to C string literals, and what is nicer, generates human-readable builtin-policy.h. This is the last user of bin2c. After this commit lands, bin2c will be removed. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> [penguin-kernel: Update sed script to also escape backslash and quote ] Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
20 lines
807 B
Makefile
20 lines
807 B
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
obj-y = audit.o common.o condition.o domain.o environ.o file.o gc.o group.o load_policy.o memory.o mount.o network.o realpath.o securityfs_if.o tomoyo.o util.o
|
|
|
|
targets += builtin-policy.h
|
|
|
|
quiet_cmd_policy = POLICY $@
|
|
cmd_policy = { \
|
|
$(foreach x, profile exception_policy domain_policy manager stat, \
|
|
printf 'static char tomoyo_builtin_$x[] __initdata =\n'; \
|
|
sed -e 's/\\/\\\\/g' -e 's/\"/\\"/g' -e 's/\(.*\)/\t"\1\\n"/' -- $(firstword $(filter %/$x.conf %/$x.conf.default, $^) /dev/null); \
|
|
printf '\t"";\n';) \
|
|
} > $@
|
|
|
|
$(obj)/builtin-policy.h: $(wildcard $(obj)/policy/*.conf $(srctree)/$(src)/policy/*.conf.default) FORCE
|
|
$(call if_changed,policy)
|
|
|
|
ifndef CONFIG_SECURITY_TOMOYO_INSECURE_BUILTIN_SETTING
|
|
$(obj)/common.o: $(obj)/builtin-policy.h
|
|
endif
|