diff options
author | zhxihu <zhxihu@marvell.com> | 2015-11-09 21:10:59 -0800 |
---|---|---|
committer | Mohammed Habibulla <moch@google.com> | 2015-11-16 15:43:49 -0800 |
commit | b343ecee0444a17c89e61c9ede1f11cd8ca9a862 (patch) | |
tree | 7345523e93a9841b72aea929a6f2012b365dd980 | |
parent | d3a00a2f7e321203e5bd1cdf0e462dd34154f2ed (diff) | |
download | marvell-b343ecee0444a17c89e61c9ede1f11cd8ca9a862.tar.gz |
Fix the building issue of boot image, and add zImage booting support.
Changes:
1) zImage entry point switches EL2-aarch64 to EL1-aarch32 instead of
kernel entry point.
2) Set ZRELADDR of mach-mmp/Makefile.boot to 8MB.
3) Fix buggy TTBCR setup in arch/arm/boot/compressed/head.S Bits
[2:0] and not [1:0] should be set to 0 as TTBCR.N is a 3-bit field
and non-0 value would result in truncated TTB space and thus limited
virtual space accessible.
4) Kernel defconfig: enable CONFIG_APPENDED_DTB and related settings.
5) Disable stack protector on atags-to-fdt function.
The reason is -fstack-protector-strong generates a stack canary code in
atags_to_fdt(), which accesses __stack_chk_guard in .bss. This violates
the assumption that atags_to_fdt does not access any globals as
explicitly stated in comments before the function invocation in head.S.
The function is called before GOT relocations are performed, thus
__stack_chk_guard is accessed by offset in GOT, not an actual relocated
address. That this might work on many platforms that have accessible
memory at low addresses (similar to a NULL pointer access),but On iap140
the lowest 8MB of physical address space is not accessible to
Non-Security, therefore __stack_chk_guard results in exception.
BUG=25393413
BUG=25421621
Change-Id: I72164e43b2dc400ae7db0e3403e5ae78cd6e5a34
-rw-r--r-- | arch/arm/boot/compressed/Makefile | 8 | ||||
-rw-r--r-- | arch/arm/boot/compressed/head.S | 14 | ||||
-rw-r--r-- | arch/arm/configs/armadillo_edge_defconfig | 8 | ||||
-rw-r--r-- | arch/arm/kernel/head.S | 2 | ||||
-rw-r--r-- | arch/arm/mach-mmp/Makefile.boot | 2 |
5 files changed, 28 insertions, 6 deletions
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index 68c918362b7..128ee0b16eb 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -124,6 +124,14 @@ endif ccflags-y := -fpic -mno-single-pic-base -fno-builtin -I$(obj) asflags-y := -DZIMAGE +ifeq ($(CONFIG_ARM_ATAG_DTB_COMPAT),y) +CFLAGS_atags_to_fdt.o := -fno-stack-protector +CFLAGS_fdt.o := -fno-stack-protector +CFLAGS_fdt_ro.o := -fno-stack-protector +CFLAGS_fdt_rw.o := -fno-stack-protector +CFLAGS_fdt_wip.o := -fno-stack-protector +endif + # Supply kernel BSS size to the decompressor via a linker symbol. KBSS_SZ = $(shell $(CROSS_COMPILE)size $(obj)/../../../../vmlinux | \ awk 'END{print $$3}') diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index c0d3977b138..96c0581184c 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -11,6 +11,10 @@ #include <linux/linkage.h> #include <asm/assembler.h> +#ifdef CONFIG_CPU_PXA1908 +#include "../../kernel/entry-el2.S" +#endif + .arch armv7-a /* * Debugging stuff @@ -122,7 +126,12 @@ .arm @ Always enter in ARM state start: .type start,#function +#ifdef CONFIG_CPU_PXA1908 + .word 0x1400000c @ b 1f (0x30 forward) + .rept 6 +#else .rept 7 +#endif mov r0, r0 .endr ARM( mov r0, r0 ) @@ -135,6 +144,9 @@ start: .word _edata @ zImage end address THUMB( .thumb ) 1: +#ifdef CONFIG_CPU_PXA1908 + el2_setup +#endif ARM_BE8( setend be ) @ go BE8 if compiled for BE8 mrs r9, cpsr #ifdef CONFIG_ARM_VIRT_EXT @@ -738,7 +750,7 @@ __armv7_mmu_cache_on: orrne r0, r0, #1 @ MMU enabled movne r1, #0xfffffffd @ domain 0 = client bic r6, r6, #1 << 31 @ 32-bit translation system - bic r6, r6, #3 << 0 @ use only ttbr0 + bic r6, r6, #7 << 0 @ use only ttbr0 mcrne p15, 0, r3, c2, c0, 0 @ load page table pointer mcrne p15, 0, r0, c8, c7, 0 @ flush I,D TLBs mcr p15, 0, r0, c7, c5, 4 @ ISB diff --git a/arch/arm/configs/armadillo_edge_defconfig b/arch/arm/configs/armadillo_edge_defconfig index 744535e167c..27e695badd6 100644 --- a/arch/arm/configs/armadillo_edge_defconfig +++ b/arch/arm/configs/armadillo_edge_defconfig @@ -1,4 +1,4 @@ -# + # Automatically generated file; DO NOT EDIT. # Linux/arm 3.14.35 Kernel Configuration # @@ -496,10 +496,12 @@ CONFIG_IOMMU_HELPER=y CONFIG_USE_OF=y CONFIG_ATAGS=y # CONFIG_DEPRECATED_PARAM_STRUCT is not set -# CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE is not set +CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE=y +CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE_NAMES="pxa1908-dkb" CONFIG_ZBOOT_ROM_TEXT=0 CONFIG_ZBOOT_ROM_BSS=0 -# CONFIG_ARM_APPENDED_DTB is not set +CONFIG_ARM_APPENDED_DTB=y +CONFIG_ARM_ATAG_DTB_COMPAT=y CONFIG_CMDLINE="rdinit=/busybox/rdinit console=ttyS0,115200 mem=512M earlyprintk uart_dma" CONFIG_CMDLINE_FROM_BOOTLOADER=y # CONFIG_CMDLINE_EXTEND is not set diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index 845b69ae315..ef60f81183b 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S @@ -83,7 +83,7 @@ __HEAD ENTRY(stext) -#ifdef CONFIG_CPU_PXA1908 +#if defined(CONFIG_CPU_PXA1908) && !defined(CONFIG_ARM_APPENDED_DTB) head_arm64_arg_fix el2_setup #endif diff --git a/arch/arm/mach-mmp/Makefile.boot b/arch/arm/mach-mmp/Makefile.boot index 257194382f5..e928f86ae4d 100644 --- a/arch/arm/mach-mmp/Makefile.boot +++ b/arch/arm/mach-mmp/Makefile.boot @@ -1,5 +1,5 @@ -__ADDRBASE := 0x00000000 +__ADDRBASE := 0x00800000 __ZRELADDR := $(shell /bin/bash -c 'printf "0x%08x" \ $$[$(TEXT_OFFSET) + $(__ADDRBASE)]') |