Skip to content

Commit 606ed72

Browse files
committed
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
2 parents a1a0db3 + b46dcfa commit 606ed72

File tree

8 files changed

+71
-30
lines changed

8 files changed

+71
-30
lines changed

arch/xtensa/Makefile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,7 @@ endif
9393

9494
boot := arch/xtensa/boot
9595

96-
all: zImage
97-
98-
bzImage : zImage
99-
100-
zImage: vmlinux
96+
all Image zImage uImage: vmlinux
10197
$(Q)$(MAKE) $(build)=$(boot) $@
10298

10399
%.dtb:
@@ -107,6 +103,8 @@ dtbs: scripts
107103
$(Q)$(MAKE) $(build)=$(boot)/dts
108104

109105
define archhelp
106+
@echo '* Image - Kernel ELF image with reset vector'
110107
@echo '* zImage - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
108+
@echo '* uImage - U-Boot wrapped image'
111109
@echo ' dtbs - Build device tree blobs for enabled boards'
112110
endef

arch/xtensa/boot/Makefile

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,17 @@ subdir-y := lib
2121

2222
# Subdirs for the boot loader(s)
2323

24-
bootdir-$(CONFIG_XTENSA_PLATFORM_ISS) += boot-elf
25-
bootdir-$(CONFIG_XTENSA_PLATFORM_XT2000) += boot-redboot boot-elf boot-uboot
26-
bootdir-$(CONFIG_XTENSA_PLATFORM_XTFPGA) += boot-redboot boot-elf boot-uboot
24+
boot-$(CONFIG_XTENSA_PLATFORM_ISS) += Image
25+
boot-$(CONFIG_XTENSA_PLATFORM_XT2000) += Image zImage uImage
26+
boot-$(CONFIG_XTENSA_PLATFORM_XTFPGA) += Image zImage uImage
2727

28-
zImage Image: $(bootdir-y)
28+
all: $(boot-y)
29+
Image: boot-elf
30+
zImage: boot-redboot
31+
uImage: $(obj)/uImage
2932

30-
$(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \
31-
$(addprefix $(obj)/,$(host-progs))
33+
boot-elf boot-redboot: $(addprefix $(obj)/,$(subdir-y)) \
34+
$(addprefix $(obj)/,$(host-progs))
3235
$(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS)
3336

3437
OBJCOPYFLAGS = --strip-all -R .comment -R .note.gnu.build-id -O binary
@@ -41,4 +44,10 @@ vmlinux.bin.gz: vmlinux.bin FORCE
4144

4245
boot-elf: vmlinux.bin
4346
boot-redboot: vmlinux.bin.gz
44-
boot-uboot: vmlinux.bin.gz
47+
48+
UIMAGE_LOADADDR = $(CONFIG_KERNEL_LOAD_ADDRESS)
49+
UIMAGE_COMPRESSION = gzip
50+
51+
$(obj)/uImage: vmlinux.bin.gz FORCE
52+
$(call if_changed,uimage)
53+
$(Q)$(kecho) ' Kernel: $@ is ready'

arch/xtensa/boot/boot-elf/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ $(obj)/../Image.elf: $(obj)/Image.o $(obj)/boot.lds
3131
-o $@ $(obj)/Image.o
3232
$(Q)$(kecho) ' Kernel: $@ is ready'
3333

34-
zImage: $(obj)/../Image.elf
34+
all Image: $(obj)/../Image.elf

arch/xtensa/boot/boot-redboot/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ $(obj)/../zImage.redboot: $(obj)/zImage.elf
3232
$(Q)$(OBJCOPY) -S -O binary $< $@
3333
$(Q)$(kecho) ' Kernel: $@ is ready'
3434

35-
zImage: $(obj)/../zImage.redboot
35+
all zImage: $(obj)/../zImage.redboot

arch/xtensa/boot/boot-uboot/Makefile

Lines changed: 0 additions & 14 deletions
This file was deleted.

arch/xtensa/include/asm/vectors.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ static inline unsigned long xtensa_get_kio_paddr(void)
6767
#endif /* CONFIG_MMU */
6868

6969
#define RESET_VECTOR1_VADDR (XCHAL_RESET_VECTOR1_VADDR)
70+
#ifdef CONFIG_VECTORS_OFFSET
7071
#define VECBASE_VADDR (KERNELOFFSET - CONFIG_VECTORS_OFFSET)
72+
#else
73+
#define VECBASE_VADDR _vecbase
74+
#endif
7175

7276
#if defined(XCHAL_HAVE_VECBASE) && XCHAL_HAVE_VECBASE
7377

arch/xtensa/kernel/setup.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ static int __init parse_tag_initrd(const bp_tag_t* tag)
126126

127127
__tagtable(BP_TAG_INITRD, parse_tag_initrd);
128128

129+
#endif /* CONFIG_BLK_DEV_INITRD */
130+
129131
#ifdef CONFIG_OF
130132

131133
static int __init parse_tag_fdt(const bp_tag_t *tag)
@@ -138,8 +140,6 @@ __tagtable(BP_TAG_FDT, parse_tag_fdt);
138140

139141
#endif /* CONFIG_OF */
140142

141-
#endif /* CONFIG_BLK_DEV_INITRD */
142-
143143
static int __init parse_tag_cmdline(const bp_tag_t* tag)
144144
{
145145
strlcpy(command_line, (char *)(tag->data), COMMAND_LINE_SIZE);
@@ -334,6 +334,7 @@ void __init setup_arch(char **cmdline_p)
334334

335335
mem_reserve(__pa(&_stext), __pa(&_end));
336336

337+
#ifdef CONFIG_VECTORS_OFFSET
337338
mem_reserve(__pa(&_WindowVectors_text_start),
338339
__pa(&_WindowVectors_text_end));
339340

@@ -370,6 +371,8 @@ void __init setup_arch(char **cmdline_p)
370371
__pa(&_Level6InterruptVector_text_end));
371372
#endif
372373

374+
#endif /* CONFIG_VECTORS_OFFSET */
375+
373376
#ifdef CONFIG_SMP
374377
mem_reserve(__pa(&_SecondaryResetVector_text_start),
375378
__pa(&_SecondaryResetVector_text_end));

arch/xtensa/kernel/vmlinux.lds.S

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ jiffies = jiffies_64;
5959
* garbage.)
6060
*/
6161

62+
#ifdef CONFIG_VECTORS_OFFSET
6263
#define SECTION_VECTOR(sym, section, addr, max_prevsec_size, prevsec) \
6364
section addr : AT((MIN(LOADADDR(prevsec) + max_prevsec_size, \
6465
LOADADDR(prevsec) + SIZEOF(prevsec)) + 3) & ~ 3) \
@@ -68,6 +69,11 @@ jiffies = jiffies_64;
6869
*(section) \
6970
sym ## _end = ABSOLUTE(.); \
7071
}
72+
#else
73+
#define SECTION_VECTOR(section, addr) \
74+
. = addr; \
75+
*(section)
76+
#endif
7177

7278
/*
7379
* Mapping of input sections to output sections when linking.
@@ -85,6 +91,37 @@ SECTIONS
8591
{
8692
/* The HEAD_TEXT section must be the first section! */
8793
HEAD_TEXT
94+
95+
#ifndef CONFIG_VECTORS_OFFSET
96+
. = ALIGN(PAGE_SIZE);
97+
_vecbase = .;
98+
99+
SECTION_VECTOR (.WindowVectors.text, WINDOW_VECTORS_VADDR)
100+
#if XCHAL_EXCM_LEVEL >= 2
101+
SECTION_VECTOR (.Level2InterruptVector.text, INTLEVEL2_VECTOR_VADDR)
102+
#endif
103+
#if XCHAL_EXCM_LEVEL >= 3
104+
SECTION_VECTOR (.Level3InterruptVector.text, INTLEVEL3_VECTOR_VADDR)
105+
#endif
106+
#if XCHAL_EXCM_LEVEL >= 4
107+
SECTION_VECTOR (.Level4InterruptVector.text, INTLEVEL4_VECTOR_VADDR)
108+
#endif
109+
#if XCHAL_EXCM_LEVEL >= 5
110+
SECTION_VECTOR (.Level5InterruptVector.text, INTLEVEL5_VECTOR_VADDR)
111+
#endif
112+
#if XCHAL_EXCM_LEVEL >= 6
113+
SECTION_VECTOR (.Level6InterruptVector.text, INTLEVEL6_VECTOR_VADDR)
114+
#endif
115+
SECTION_VECTOR (.DebugInterruptVector.literal, DEBUG_VECTOR_VADDR - 4)
116+
SECTION_VECTOR (.DebugInterruptVector.text, DEBUG_VECTOR_VADDR)
117+
SECTION_VECTOR (.KernelExceptionVector.literal, KERNEL_VECTOR_VADDR - 4)
118+
SECTION_VECTOR (.KernelExceptionVector.text, KERNEL_VECTOR_VADDR)
119+
SECTION_VECTOR (.UserExceptionVector.literal, USER_VECTOR_VADDR - 4)
120+
SECTION_VECTOR (.UserExceptionVector.text, USER_VECTOR_VADDR)
121+
SECTION_VECTOR (.DoubleExceptionVector.literal, DOUBLEEXC_VECTOR_VADDR - 48)
122+
SECTION_VECTOR (.DoubleExceptionVector.text, DOUBLEEXC_VECTOR_VADDR)
123+
#endif
124+
88125
TEXT_TEXT
89126
VMLINUX_SYMBOL(__sched_text_start) = .;
90127
*(.sched.literal .sched.text)
@@ -132,6 +169,7 @@ SECTIONS
132169
. = ALIGN(16);
133170
__boot_reloc_table_start = ABSOLUTE(.);
134171

172+
#ifdef CONFIG_VECTORS_OFFSET
135173
RELOCATE_ENTRY(_WindowVectors_text,
136174
.WindowVectors.text);
137175
#if XCHAL_EXCM_LEVEL >= 2
@@ -164,6 +202,7 @@ SECTIONS
164202
.DoubleExceptionVector.text);
165203
RELOCATE_ENTRY(_DebugInterruptVector_text,
166204
.DebugInterruptVector.text);
205+
#endif
167206
#if defined(CONFIG_SMP)
168207
RELOCATE_ENTRY(_SecondaryResetVector_text,
169208
.SecondaryResetVector.text);
@@ -186,6 +225,7 @@ SECTIONS
186225
. = ALIGN(4);
187226
.dummy : { LONG(0) }
188227

228+
#ifdef CONFIG_VECTORS_OFFSET
189229
/* The vectors are relocated to the real position at startup time */
190230

191231
SECTION_VECTOR (_WindowVectors_text,
@@ -277,6 +317,7 @@ SECTIONS
277317

278318
. = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3;
279319

320+
#endif
280321
#if defined(CONFIG_SMP)
281322

282323
SECTION_VECTOR (_SecondaryResetVector_text,

0 commit comments

Comments
 (0)