]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - arch/arm/boot/compressed/Makefile
ARM: decompressor: fix BSS size calculation
[mirror_ubuntu-bionic-kernel.git] / arch / arm / boot / compressed / Makefile
index d50430c40045dd3e43fe37abf63f11a011e4c687..9519ce3d2e1c14fe9c4aa613dc62a360efb9e5e1 100644 (file)
@@ -116,8 +116,11 @@ ccflags-y := -fpic -mno-single-pic-base -fno-builtin -I$(obj)
 asflags-y := -DZIMAGE
 
 # Supply kernel BSS size to the decompressor via a linker symbol.
-KBSS_SZ = $(shell $(CROSS_COMPILE)size $(obj)/../../../../vmlinux | \
-               awk 'END{print $$3}')
+KBSS_SZ = $(shell $(CROSS_COMPILE)nm $(obj)/../../../../vmlinux | \
+               perl -e 'while (<>) { \
+                       $$bss_start=hex($$1) if /^([[:xdigit:]]+) B __bss_start$$/; \
+                       $$bss_end=hex($$1) if /^([[:xdigit:]]+) B __bss_stop$$/; \
+               }; printf "%d\n", $$bss_end - $$bss_start;')
 LDFLAGS_vmlinux = --defsym _kernel_bss_size=$(KBSS_SZ)
 # Supply ZRELADDR to the decompressor via a linker symbol.
 ifneq ($(CONFIG_AUTO_ZRELADDR),y)