mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-29 23:24:11 +08:00
3b24b83763
- add a shell script to get Clang version - improve portability of build scripts - drop always-enabled CONFIG_THIN_ARCHIVE and remove unused code - rename built-in.o which is now thin archive to built-in.a - process clean/build targets one by one to get along with -j option - simplify ld-option - improve building with CONFIG_TRIM_UNUSED_KSYMS - define KBUILD_MODNAME even for objects shared among multiple modules - avoid linking multiple instances of same objects from composite objects - move <linux/compiler_types.h> to c_flags to include it only for C files - clean-up various Makefiles -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJaw6eWAAoJED2LAQed4NsGrK8QAJmbYg83TTNoOgQRK/7Lg+sj KL1+RGFxmdHRVOqG5n18L7Q4LmTD19tUFNQImrQTTrKrbH2vbMSTF2PfzdmDRwMz R5vW5+wsagfhSttOce/GR4p9+bM9XEclzEa3liqNVQxijOFXmkV14pn0x5anYfeB ABthxFFHcVn3exP/q3lmq048x1yNE71wUU5WQIWf6V/ZKf+++wQU8r7HpnATWYeO vtf8gZq+xyLLjhxoJF6n6olSZXI7Yhz4jV2G68/VroS312AUFWPogK+cSshWGlSw zGixM1q55oj9CXjZ37nR6pTzQhSZLf/uHX5beatlpeoJ4Hho6HlIABvx2oEnat7b o5RW64RB0gVJqlYZdKxL29HNrovr9tlWPTaIPGFRvWDpl3c1w+rMKXE+5hwu8jMJ 2jgxd5FZCgBaDsAKojmeQR7PAo2ffAdUO0Dj/SuAaMOpuHWHcnJk9kIN2PUrC+Sf d/H2soT9x+60KbQmtCEo5VfEN8bvNP3+ZSnadEG/gRN2IIa5FZAUQykU+i50gAvj tuKAokdRGZHvXM+buYFBfN6RbhVCXzBF/fAG7r37QVR2u1zaUszmgFOUqERhTQfm RNnyeAs9G9rljtna/AD7cIOdKTg8oETPISxt8Y6EzNMpI8PhF0aGoxso3yD19oH1 M+fq55RigsR48Kic40hY =N5BL -----END PGP SIGNATURE----- Merge tag 'kbuild-v4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild Pull Kbuild updates from Masahiro Yamada: - add a shell script to get Clang version - improve portability of build scripts - drop always-enabled CONFIG_THIN_ARCHIVE and remove unused code - rename built-in.o which is now thin archive to built-in.a - process clean/build targets one by one to get along with -j option - simplify ld-option - improve building with CONFIG_TRIM_UNUSED_KSYMS - define KBUILD_MODNAME even for objects shared among multiple modules - avoid linking multiple instances of same objects from composite objects - move <linux/compiler_types.h> to c_flags to include it only for C files - clean-up various Makefiles * tag 'kbuild-v4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (29 commits) kbuild: get <linux/compiler_types.h> out of <linux/kconfig.h> kbuild: clean up link rule of composite modules kbuild: clean up archive rule of built-in.a kbuild: remove partial section mismatch detection for built-in.a net: liquidio: clean up Makefile for simpler composite object handling lib: zstd: clean up Makefile for simpler composite object handling kbuild: link $(real-obj-y) instead of $(obj-y) into built-in.a kbuild: rename real-objs-y/m to real-obj-y/m kbuild: move modname and modname-multi close to modname_flags kbuild: simplify modname calculation kbuild: fix modname for composite modules kbuild: define KBUILD_MODNAME even if multiple modules share objects kbuild: remove unnecessary $(subst $(obj)/, , ...) in modname-multi kbuild: Use ls(1) instead of stat(1) to obtain file size kbuild: link vmlinux only once for CONFIG_TRIM_UNUSED_KSYMS kbuild: move include/config/ksym/* to include/ksym/* kbuild: move CONFIG_TRIM_UNUSED_KSYMS code unneeded for external module kbuild: restore autoksyms.h touch to the top Makefile kbuild: move 'scripts' target below kbuild: remove wrong 'touch' in adjust_autoksyms.sh ...
65 lines
1.8 KiB
Bash
Executable File
65 lines
1.8 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# XIP kernel .data segment compressor
|
|
#
|
|
# Created by: Nicolas Pitre, August 2017
|
|
# Copyright: (C) 2017 Linaro Limited
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License version 2 as
|
|
# published by the Free Software Foundation.
|
|
|
|
# This script locates the start of the .data section in xipImage and
|
|
# substitutes it with a compressed version. The needed offsets are obtained
|
|
# from symbol addresses in vmlinux. It is expected that .data extends to
|
|
# the end of xipImage.
|
|
|
|
set -e
|
|
|
|
VMLINUX="$1"
|
|
XIPIMAGE="$2"
|
|
|
|
DD="dd status=none"
|
|
|
|
# Use "make V=1" to debug this script.
|
|
case "$KBUILD_VERBOSE" in
|
|
*1*)
|
|
set -x
|
|
;;
|
|
esac
|
|
|
|
sym_val() {
|
|
# extract hex value for symbol in $1
|
|
local val=$($NM "$VMLINUX" 2>/dev/null | sed -n "/ $1\$/{s/ .*$//p;q}")
|
|
[ "$val" ] || { echo "can't find $1 in $VMLINUX" 1>&2; exit 1; }
|
|
# convert from hex to decimal
|
|
echo $((0x$val))
|
|
}
|
|
|
|
__data_loc=$(sym_val __data_loc)
|
|
_edata_loc=$(sym_val _edata_loc)
|
|
base_offset=$(sym_val _xiprom)
|
|
|
|
# convert to file based offsets
|
|
data_start=$(($__data_loc - $base_offset))
|
|
data_end=$(($_edata_loc - $base_offset))
|
|
|
|
# Make sure data occupies the last part of the file.
|
|
file_end=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" "$XIPIMAGE")
|
|
if [ "$file_end" != "$data_end" ]; then
|
|
printf "end of xipImage doesn't match with _edata_loc (%#x vs %#x)\n" \
|
|
$(($file_end + $base_offset)) $_edata_loc 1>&2
|
|
exit 1;
|
|
fi
|
|
|
|
# be ready to clean up
|
|
trap 'rm -f "$XIPIMAGE.tmp"; exit 1' 1 2 3
|
|
|
|
# substitute the data section by a compressed version
|
|
$DD if="$XIPIMAGE" count=$data_start iflag=count_bytes of="$XIPIMAGE.tmp"
|
|
$DD if="$XIPIMAGE" skip=$data_start iflag=skip_bytes |
|
|
gzip -9 >> "$XIPIMAGE.tmp"
|
|
|
|
# replace kernel binary
|
|
mv -f "$XIPIMAGE.tmp" "$XIPIMAGE"
|