mirror of
https://github.com/dynup/kpatch
synced 2025-04-25 20:48:01 +00:00
kpatch-build: Fix indentation
Replace stray spaces with tabs, except in the usage output where tabs don't make much sense. Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
This commit is contained in:
parent
15cdcc8b5f
commit
862327db3e
@ -174,6 +174,7 @@ find_core_symvers() {
|
|||||||
gcc_version_from_file() {
|
gcc_version_from_file() {
|
||||||
readelf -p .comment "$1" | grep -o 'GCC:.*'
|
readelf -p .comment "$1" | grep -o 'GCC:.*'
|
||||||
}
|
}
|
||||||
|
|
||||||
gcc_version_check() {
|
gcc_version_check() {
|
||||||
local c="$TEMPDIR/test.c" o="$TEMPDIR/test.o"
|
local c="$TEMPDIR/test.c" o="$TEMPDIR/test.o"
|
||||||
local out gccver kgccver
|
local out gccver kgccver
|
||||||
@ -207,26 +208,26 @@ gcc_version_check() {
|
|||||||
|
|
||||||
find_special_section_data_ppc64le() {
|
find_special_section_data_ppc64le() {
|
||||||
SPECIAL_VARS="$(readelf -wi "$VMLINUX" |
|
SPECIAL_VARS="$(readelf -wi "$VMLINUX" |
|
||||||
gawk --non-decimal-data '
|
gawk --non-decimal-data '
|
||||||
BEGIN { f = b = e = 0 }
|
BEGIN { f = b = e = 0 }
|
||||||
|
|
||||||
# Set state if name matches
|
# Set state if name matches
|
||||||
f == 0 && /DW_AT_name.* fixup_entry[[:space:]]*$/ {f = 1; next}
|
f == 0 && /DW_AT_name.* fixup_entry[[:space:]]*$/ {f = 1; next}
|
||||||
b == 0 && /DW_AT_name.* bug_entry[[:space:]]*$/ {b = 1; next}
|
b == 0 && /DW_AT_name.* bug_entry[[:space:]]*$/ {b = 1; next}
|
||||||
e == 0 && /DW_AT_name.* exception_table_entry[[:space:]]*$/ {e = 1; next}
|
e == 0 && /DW_AT_name.* exception_table_entry[[:space:]]*$/ {e = 1; next}
|
||||||
|
|
||||||
# Reset state unless this abbrev describes the struct size
|
# Reset state unless this abbrev describes the struct size
|
||||||
f == 1 && !/DW_AT_byte_size/ { f = 0; next }
|
f == 1 && !/DW_AT_byte_size/ { f = 0; next }
|
||||||
b == 1 && !/DW_AT_byte_size/ { b = 0; next }
|
b == 1 && !/DW_AT_byte_size/ { b = 0; next }
|
||||||
e == 1 && !/DW_AT_byte_size/ { e = 0; next }
|
e == 1 && !/DW_AT_byte_size/ { e = 0; next }
|
||||||
|
|
||||||
# Now that we know the size, stop parsing for it
|
# Now that we know the size, stop parsing for it
|
||||||
f == 1 {printf("export FIXUP_STRUCT_SIZE=%d\n", $4); a = 2}
|
f == 1 {printf("export FIXUP_STRUCT_SIZE=%d\n", $4); a = 2}
|
||||||
b == 1 {printf("export BUG_STRUCT_SIZE=%d\n", $4); b = 2}
|
b == 1 {printf("export BUG_STRUCT_SIZE=%d\n", $4); b = 2}
|
||||||
e == 1 {printf("export EX_STRUCT_SIZE=%d\n", $4); e = 2}
|
e == 1 {printf("export EX_STRUCT_SIZE=%d\n", $4); e = 2}
|
||||||
|
|
||||||
# Bail out once we have everything
|
# Bail out once we have everything
|
||||||
f == 2 && b == 2 && e == 2 {exit}')"
|
f == 2 && b == 2 && e == 2 {exit}')"
|
||||||
|
|
||||||
[[ -n "$SPECIAL_VARS" ]] && eval "$SPECIAL_VARS"
|
[[ -n "$SPECIAL_VARS" ]] && eval "$SPECIAL_VARS"
|
||||||
|
|
||||||
@ -245,29 +246,29 @@ find_special_section_data() {
|
|||||||
|
|
||||||
[[ "$CONFIG_PARAVIRT" -eq 0 ]] && AWK_OPTIONS="-vskip_p=1"
|
[[ "$CONFIG_PARAVIRT" -eq 0 ]] && AWK_OPTIONS="-vskip_p=1"
|
||||||
SPECIAL_VARS="$(readelf -wi "$VMLINUX" |
|
SPECIAL_VARS="$(readelf -wi "$VMLINUX" |
|
||||||
gawk --non-decimal-data $AWK_OPTIONS '
|
gawk --non-decimal-data $AWK_OPTIONS '
|
||||||
BEGIN { a = b = p = e = 0 }
|
BEGIN { a = b = p = e = 0 }
|
||||||
|
|
||||||
# Set state if name matches
|
# Set state if name matches
|
||||||
a == 0 && /DW_AT_name.* alt_instr[[:space:]]*$/ {a = 1; next}
|
a == 0 && /DW_AT_name.* alt_instr[[:space:]]*$/ {a = 1; next}
|
||||||
b == 0 && /DW_AT_name.* bug_entry[[:space:]]*$/ {b = 1; next}
|
b == 0 && /DW_AT_name.* bug_entry[[:space:]]*$/ {b = 1; next}
|
||||||
p == 0 && /DW_AT_name.* paravirt_patch_site[[:space:]]*$/ {p = 1; next}
|
p == 0 && /DW_AT_name.* paravirt_patch_site[[:space:]]*$/ {p = 1; next}
|
||||||
e == 0 && /DW_AT_name.* exception_table_entry[[:space:]]*$/ {e = 1; next}
|
e == 0 && /DW_AT_name.* exception_table_entry[[:space:]]*$/ {e = 1; next}
|
||||||
|
|
||||||
# Reset state unless this abbrev describes the struct size
|
# Reset state unless this abbrev describes the struct size
|
||||||
a == 1 && !/DW_AT_byte_size/ { a = 0; next }
|
a == 1 && !/DW_AT_byte_size/ { a = 0; next }
|
||||||
b == 1 && !/DW_AT_byte_size/ { b = 0; next }
|
b == 1 && !/DW_AT_byte_size/ { b = 0; next }
|
||||||
p == 1 && !/DW_AT_byte_size/ { p = 0; next }
|
p == 1 && !/DW_AT_byte_size/ { p = 0; next }
|
||||||
e == 1 && !/DW_AT_byte_size/ { e = 0; next }
|
e == 1 && !/DW_AT_byte_size/ { e = 0; next }
|
||||||
|
|
||||||
# Now that we know the size, stop parsing for it
|
# Now that we know the size, stop parsing for it
|
||||||
a == 1 {printf("export ALT_STRUCT_SIZE=%d\n", $4); a = 2}
|
a == 1 {printf("export ALT_STRUCT_SIZE=%d\n", $4); a = 2}
|
||||||
b == 1 {printf("export BUG_STRUCT_SIZE=%d\n", $4); b = 2}
|
b == 1 {printf("export BUG_STRUCT_SIZE=%d\n", $4); b = 2}
|
||||||
p == 1 {printf("export PARA_STRUCT_SIZE=%d\n", $4); p = 2}
|
p == 1 {printf("export PARA_STRUCT_SIZE=%d\n", $4); p = 2}
|
||||||
e == 1 {printf("export EX_STRUCT_SIZE=%d\n", $4); e = 2}
|
e == 1 {printf("export EX_STRUCT_SIZE=%d\n", $4); e = 2}
|
||||||
|
|
||||||
# Bail out once we have everything
|
# Bail out once we have everything
|
||||||
a == 2 && b == 2 && (p == 2 || skip_p) && e == 2 {exit}')"
|
a == 2 && b == 2 && (p == 2 || skip_p) && e == 2 {exit}')"
|
||||||
|
|
||||||
[[ -n "$SPECIAL_VARS" ]] && eval "$SPECIAL_VARS"
|
[[ -n "$SPECIAL_VARS" ]] && eval "$SPECIAL_VARS"
|
||||||
|
|
||||||
@ -353,17 +354,17 @@ module_name_string() {
|
|||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "usage: $(basename "$0") [options] <patch1 ... patchN>" >&2
|
echo "usage: $(basename "$0") [options] <patch1 ... patchN>" >&2
|
||||||
echo " patchN Input patchfile(s)" >&2
|
echo " patchN Input patchfile(s)" >&2
|
||||||
echo " -h, --help Show this help message" >&2
|
echo " -h, --help Show this help message" >&2
|
||||||
echo " -r, --sourcerpm Specify kernel source RPM" >&2
|
echo " -r, --sourcerpm Specify kernel source RPM" >&2
|
||||||
echo " -s, --sourcedir Specify kernel source directory" >&2
|
echo " -s, --sourcedir Specify kernel source directory" >&2
|
||||||
echo " -c, --config Specify kernel config file" >&2
|
echo " -c, --config Specify kernel config file" >&2
|
||||||
echo " -v, --vmlinux Specify original vmlinux" >&2
|
echo " -v, --vmlinux Specify original vmlinux" >&2
|
||||||
echo " -j, --jobs Specify the number of make jobs" >&2
|
echo " -j, --jobs Specify the number of make jobs" >&2
|
||||||
echo " -t, --target Specify custom kernel build targets" >&2
|
echo " -t, --target Specify custom kernel build targets" >&2
|
||||||
echo " -n, --name Specify the name of the kpatch module" >&2
|
echo " -n, --name Specify the name of the kpatch module" >&2
|
||||||
echo " -o, --output Specify output folder" >&2
|
echo " -o, --output Specify output folder" >&2
|
||||||
echo " -d, --debug Keep scratch files in /tmp" >&2
|
echo " -d, --debug Keep scratch files in /tmp" >&2
|
||||||
echo " --skip-cleanup Skip post-build cleanup" >&2
|
echo " --skip-cleanup Skip post-build cleanup" >&2
|
||||||
echo " --skip-gcc-check Skip gcc version matching check" >&2
|
echo " --skip-gcc-check Skip gcc version matching check" >&2
|
||||||
echo " (not recommended)" >&2
|
echo " (not recommended)" >&2
|
||||||
@ -489,7 +490,7 @@ elif [[ "$DISTRO" = ubuntu ]] || [[ "$DISTRO" = debian ]]; then
|
|||||||
if [[ "$DISTRO" = ubuntu ]]; then
|
if [[ "$DISTRO" = ubuntu ]]; then
|
||||||
[[ -e "$VMLINUX" ]] || die "linux-image-$ARCHVERSION-dbgsym not installed"
|
[[ -e "$VMLINUX" ]] || die "linux-image-$ARCHVERSION-dbgsym not installed"
|
||||||
|
|
||||||
elif [[ "$DISTRO" = debian ]]; then
|
elif [[ "$DISTRO" = debian ]]; then
|
||||||
[[ -e "$VMLINUX" ]] || die "linux-image-$ARCHVERSION-dbg not installed"
|
[[ -e "$VMLINUX" ]] || die "linux-image-$ARCHVERSION-dbg not installed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ TOOLCHAINCMD="$1"
|
|||||||
shift
|
shift
|
||||||
|
|
||||||
if [[ -z "$KPATCH_GCC_TEMPDIR" ]]; then
|
if [[ -z "$KPATCH_GCC_TEMPDIR" ]]; then
|
||||||
exec "$TOOLCHAINCMD" "$@"
|
exec "$TOOLCHAINCMD" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
declare -a args=("$@")
|
declare -a args=("$@")
|
||||||
|
Loading…
Reference in New Issue
Block a user