Xtensa improvements for v4.11:

- clean up bootable image build targets: provide separate 'Image',
   'zImage' and 'uImage' make targets that only build corresponding
   image type. Make 'all' build all images appropriate for a platform;
 - allow merging vectors code into .text section as a preparation step
   for XIP support;
 - fix handling external FDT when the kernel is built without
   BLK_DEV_INITRD support.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJYucw+AAoJEFH5zJH4P6BE8VwP/1AXxAxh2z8P0lu4Ay5XsBFI
 sIFGgTow8Hw5NNyj3td3USLvLM/cHi/Bl1FE94P3XaezJn/lIMIJscY08GUqJhLQ
 cu6AfztQHW/Cl6E5YQRDCAgSETtz4P0gQSZn4TIf6APTdlGeQjNhCcwpqYASNU/a
 BFxoNNAJ6hlf7ahNAHK/wQdJbV9YKOd3T+HNXyOYEiyhk/flqk9NAKt+ObBCUT2r
 W09mpDu2WPNI2fQBua7txxx7Kq2R4HE1cnbGxB63v+inwkp/bPl94NAEBNCJsOaG
 QAAnqWfn+WM/IF0kiEVgrQMd0TrsDMwalhPd9iwl30Gc6Z/pNgIwVEEGv2N0PKcx
 WNwSAwojFdGmNozJRAJj76UDqDPfJIHnKBfOVOmq7unMm4i6SbW2zjS67ZEm6DKX
 Qyj+Y+evVbW6tsVU0hPR4Nevh9Ha15IvVkMm1T8MzwudKVJW2jrU4ZUUE9yGUwXH
 lD8rJT/dbPQrSnYM/ARsqCT5AiZ9vakaI92vqBc9L/exwsWIfxQdcUs/7FXYf8Yx
 cpJ36MkwRJ6n+4nDAX9xMOejO5FoRrnH7puYvpbgdr+uj5DvZawheLyVht4xZ6Ed
 ZWknak0rlJW0z4SqdCXOTRMTpgUXw06AKerzkrx49dosHa1FVKaeuekMYo5HYBDw
 hfJbvj1a1UgTnAmJG9wv
 =gihR
 -----END PGP SIGNATURE-----

Merge tag 'xtensa-20170303' of git://github.com/jcmvbkbc/linux-xtensa

Pull Xtensa updates from Max Filippov:

 - clean up bootable image build targets: provide separate 'Image',
   'zImage' and 'uImage' make targets that only build corresponding
   image type. Make 'all' build all images appropriate for a platform

 - allow merging vectors code into .text section as a preparation step
   for XIP support

 - fix handling external FDT when the kernel is built without
   BLK_DEV_INITRD support

* tag 'xtensa-20170303' of git://github.com/jcmvbkbc/linux-xtensa:
  xtensa: allow merging vectors into .text section
  xtensa: clean up bootable image build targets
  xtensa: move parse_tag_fdt out of #ifdef CONFIG_BLK_DEV_INITRD
This commit is contained in:
Linus Torvalds 2017-03-03 16:17:55 -08:00
commit 606ed721af
8 changed files with 71 additions and 30 deletions

View File

@ -93,11 +93,7 @@ endif
boot := arch/xtensa/boot boot := arch/xtensa/boot
all: zImage all Image zImage uImage: vmlinux
bzImage : zImage
zImage: vmlinux
$(Q)$(MAKE) $(build)=$(boot) $@ $(Q)$(MAKE) $(build)=$(boot) $@
%.dtb: %.dtb:
@ -107,6 +103,8 @@ dtbs: scripts
$(Q)$(MAKE) $(build)=$(boot)/dts $(Q)$(MAKE) $(build)=$(boot)/dts
define archhelp define archhelp
@echo '* Image - Kernel ELF image with reset vector'
@echo '* zImage - Compressed kernel image (arch/xtensa/boot/images/zImage.*)' @echo '* zImage - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
@echo '* uImage - U-Boot wrapped image'
@echo ' dtbs - Build device tree blobs for enabled boards' @echo ' dtbs - Build device tree blobs for enabled boards'
endef endef

View File

@ -21,14 +21,17 @@ subdir-y := lib
# Subdirs for the boot loader(s) # Subdirs for the boot loader(s)
bootdir-$(CONFIG_XTENSA_PLATFORM_ISS) += boot-elf boot-$(CONFIG_XTENSA_PLATFORM_ISS) += Image
bootdir-$(CONFIG_XTENSA_PLATFORM_XT2000) += boot-redboot boot-elf boot-uboot boot-$(CONFIG_XTENSA_PLATFORM_XT2000) += Image zImage uImage
bootdir-$(CONFIG_XTENSA_PLATFORM_XTFPGA) += boot-redboot boot-elf boot-uboot boot-$(CONFIG_XTENSA_PLATFORM_XTFPGA) += Image zImage uImage
zImage Image: $(bootdir-y) all: $(boot-y)
Image: boot-elf
zImage: boot-redboot
uImage: $(obj)/uImage
$(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \ boot-elf boot-redboot: $(addprefix $(obj)/,$(subdir-y)) \
$(addprefix $(obj)/,$(host-progs)) $(addprefix $(obj)/,$(host-progs))
$(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS) $(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS)
OBJCOPYFLAGS = --strip-all -R .comment -R .note.gnu.build-id -O binary OBJCOPYFLAGS = --strip-all -R .comment -R .note.gnu.build-id -O binary
@ -41,4 +44,10 @@ vmlinux.bin.gz: vmlinux.bin FORCE
boot-elf: vmlinux.bin boot-elf: vmlinux.bin
boot-redboot: vmlinux.bin.gz boot-redboot: vmlinux.bin.gz
boot-uboot: vmlinux.bin.gz
UIMAGE_LOADADDR = $(CONFIG_KERNEL_LOAD_ADDRESS)
UIMAGE_COMPRESSION = gzip
$(obj)/uImage: vmlinux.bin.gz FORCE
$(call if_changed,uimage)
$(Q)$(kecho) ' Kernel: $@ is ready'

View File

@ -31,4 +31,4 @@ $(obj)/../Image.elf: $(obj)/Image.o $(obj)/boot.lds
-o $@ $(obj)/Image.o -o $@ $(obj)/Image.o
$(Q)$(kecho) ' Kernel: $@ is ready' $(Q)$(kecho) ' Kernel: $@ is ready'
zImage: $(obj)/../Image.elf all Image: $(obj)/../Image.elf

View File

@ -32,4 +32,4 @@ $(obj)/../zImage.redboot: $(obj)/zImage.elf
$(Q)$(OBJCOPY) -S -O binary $< $@ $(Q)$(OBJCOPY) -S -O binary $< $@
$(Q)$(kecho) ' Kernel: $@ is ready' $(Q)$(kecho) ' Kernel: $@ is ready'
zImage: $(obj)/../zImage.redboot all zImage: $(obj)/../zImage.redboot

View File

@ -1,14 +0,0 @@
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
#
UIMAGE_LOADADDR = $(CONFIG_KERNEL_LOAD_ADDRESS)
UIMAGE_COMPRESSION = gzip
$(obj)/../uImage: vmlinux.bin.gz FORCE
$(call if_changed,uimage)
$(Q)$(kecho) ' Kernel: $@ is ready'
zImage: $(obj)/../uImage

View File

@ -67,7 +67,11 @@ static inline unsigned long xtensa_get_kio_paddr(void)
#endif /* CONFIG_MMU */ #endif /* CONFIG_MMU */
#define RESET_VECTOR1_VADDR (XCHAL_RESET_VECTOR1_VADDR) #define RESET_VECTOR1_VADDR (XCHAL_RESET_VECTOR1_VADDR)
#ifdef CONFIG_VECTORS_OFFSET
#define VECBASE_VADDR (KERNELOFFSET - CONFIG_VECTORS_OFFSET) #define VECBASE_VADDR (KERNELOFFSET - CONFIG_VECTORS_OFFSET)
#else
#define VECBASE_VADDR _vecbase
#endif
#if defined(XCHAL_HAVE_VECBASE) && XCHAL_HAVE_VECBASE #if defined(XCHAL_HAVE_VECBASE) && XCHAL_HAVE_VECBASE

View File

@ -126,6 +126,8 @@ static int __init parse_tag_initrd(const bp_tag_t* tag)
__tagtable(BP_TAG_INITRD, parse_tag_initrd); __tagtable(BP_TAG_INITRD, parse_tag_initrd);
#endif /* CONFIG_BLK_DEV_INITRD */
#ifdef CONFIG_OF #ifdef CONFIG_OF
static int __init parse_tag_fdt(const bp_tag_t *tag) static int __init parse_tag_fdt(const bp_tag_t *tag)
@ -138,8 +140,6 @@ __tagtable(BP_TAG_FDT, parse_tag_fdt);
#endif /* CONFIG_OF */ #endif /* CONFIG_OF */
#endif /* CONFIG_BLK_DEV_INITRD */
static int __init parse_tag_cmdline(const bp_tag_t* tag) static int __init parse_tag_cmdline(const bp_tag_t* tag)
{ {
strlcpy(command_line, (char *)(tag->data), COMMAND_LINE_SIZE); strlcpy(command_line, (char *)(tag->data), COMMAND_LINE_SIZE);
@ -334,6 +334,7 @@ void __init setup_arch(char **cmdline_p)
mem_reserve(__pa(&_stext), __pa(&_end)); mem_reserve(__pa(&_stext), __pa(&_end));
#ifdef CONFIG_VECTORS_OFFSET
mem_reserve(__pa(&_WindowVectors_text_start), mem_reserve(__pa(&_WindowVectors_text_start),
__pa(&_WindowVectors_text_end)); __pa(&_WindowVectors_text_end));
@ -370,6 +371,8 @@ void __init setup_arch(char **cmdline_p)
__pa(&_Level6InterruptVector_text_end)); __pa(&_Level6InterruptVector_text_end));
#endif #endif
#endif /* CONFIG_VECTORS_OFFSET */
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
mem_reserve(__pa(&_SecondaryResetVector_text_start), mem_reserve(__pa(&_SecondaryResetVector_text_start),
__pa(&_SecondaryResetVector_text_end)); __pa(&_SecondaryResetVector_text_end));

View File

@ -59,6 +59,7 @@ jiffies = jiffies_64;
* garbage.) * garbage.)
*/ */
#ifdef CONFIG_VECTORS_OFFSET
#define SECTION_VECTOR(sym, section, addr, max_prevsec_size, prevsec) \ #define SECTION_VECTOR(sym, section, addr, max_prevsec_size, prevsec) \
section addr : AT((MIN(LOADADDR(prevsec) + max_prevsec_size, \ section addr : AT((MIN(LOADADDR(prevsec) + max_prevsec_size, \
LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3) \ LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3) \
@ -68,6 +69,11 @@ jiffies = jiffies_64;
*(section) \ *(section) \
sym ## _end = ABSOLUTE(.); \ sym ## _end = ABSOLUTE(.); \
} }
#else
#define SECTION_VECTOR(section, addr) \
. = addr; \
*(section)
#endif
/* /*
* Mapping of input sections to output sections when linking. * Mapping of input sections to output sections when linking.
@ -85,6 +91,37 @@ SECTIONS
{ {
/* The HEAD_TEXT section must be the first section! */ /* The HEAD_TEXT section must be the first section! */
HEAD_TEXT HEAD_TEXT
#ifndef CONFIG_VECTORS_OFFSET
. = ALIGN(PAGE_SIZE);
_vecbase = .;
SECTION_VECTOR (.WindowVectors.text, WINDOW_VECTORS_VADDR)
#if XCHAL_EXCM_LEVEL >= 2
SECTION_VECTOR (.Level2InterruptVector.text, INTLEVEL2_VECTOR_VADDR)
#endif
#if XCHAL_EXCM_LEVEL >= 3
SECTION_VECTOR (.Level3InterruptVector.text, INTLEVEL3_VECTOR_VADDR)
#endif
#if XCHAL_EXCM_LEVEL >= 4
SECTION_VECTOR (.Level4InterruptVector.text, INTLEVEL4_VECTOR_VADDR)
#endif
#if XCHAL_EXCM_LEVEL >= 5
SECTION_VECTOR (.Level5InterruptVector.text, INTLEVEL5_VECTOR_VADDR)
#endif
#if XCHAL_EXCM_LEVEL >= 6
SECTION_VECTOR (.Level6InterruptVector.text, INTLEVEL6_VECTOR_VADDR)
#endif
SECTION_VECTOR (.DebugInterruptVector.literal, DEBUG_VECTOR_VADDR - 4)
SECTION_VECTOR (.DebugInterruptVector.text, DEBUG_VECTOR_VADDR)
SECTION_VECTOR (.KernelExceptionVector.literal, KERNEL_VECTOR_VADDR - 4)
SECTION_VECTOR (.KernelExceptionVector.text, KERNEL_VECTOR_VADDR)
SECTION_VECTOR (.UserExceptionVector.literal, USER_VECTOR_VADDR - 4)
SECTION_VECTOR (.UserExceptionVector.text, USER_VECTOR_VADDR)
SECTION_VECTOR (.DoubleExceptionVector.literal, DOUBLEEXC_VECTOR_VADDR - 48)
SECTION_VECTOR (.DoubleExceptionVector.text, DOUBLEEXC_VECTOR_VADDR)
#endif
TEXT_TEXT TEXT_TEXT
VMLINUX_SYMBOL(__sched_text_start) = .; VMLINUX_SYMBOL(__sched_text_start) = .;
*(.sched.literal .sched.text) *(.sched.literal .sched.text)
@ -132,6 +169,7 @@ SECTIONS
. = ALIGN(16); . = ALIGN(16);
__boot_reloc_table_start = ABSOLUTE(.); __boot_reloc_table_start = ABSOLUTE(.);
#ifdef CONFIG_VECTORS_OFFSET
RELOCATE_ENTRY(_WindowVectors_text, RELOCATE_ENTRY(_WindowVectors_text,
.WindowVectors.text); .WindowVectors.text);
#if XCHAL_EXCM_LEVEL >= 2 #if XCHAL_EXCM_LEVEL >= 2
@ -164,6 +202,7 @@ SECTIONS
.DoubleExceptionVector.text); .DoubleExceptionVector.text);
RELOCATE_ENTRY(_DebugInterruptVector_text, RELOCATE_ENTRY(_DebugInterruptVector_text,
.DebugInterruptVector.text); .DebugInterruptVector.text);
#endif
#if defined(CONFIG_SMP) #if defined(CONFIG_SMP)
RELOCATE_ENTRY(_SecondaryResetVector_text, RELOCATE_ENTRY(_SecondaryResetVector_text,
.SecondaryResetVector.text); .SecondaryResetVector.text);
@ -186,6 +225,7 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
.dummy : { LONG(0) } .dummy : { LONG(0) }
#ifdef CONFIG_VECTORS_OFFSET
/* The vectors are relocated to the real position at startup time */ /* The vectors are relocated to the real position at startup time */
SECTION_VECTOR (_WindowVectors_text, SECTION_VECTOR (_WindowVectors_text,
@ -277,6 +317,7 @@ SECTIONS
. = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3; . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3;
#endif
#if defined(CONFIG_SMP) #if defined(CONFIG_SMP)
SECTION_VECTOR (_SecondaryResetVector_text, SECTION_VECTOR (_SecondaryResetVector_text,