Commit 2bf118197cb4d9a5e7a9e45b5b007235fdc9f402
1 parent
4e6d816e51
Exists in
master
and in
7 other branches
[POWERPC] Create a "wrapper" script and use it in arch/powerpc/boot
This puts the knowledge of how to create various sorts of zImage wrappers into a script called "wrapper" that could be used outside of the kernel tree. This changes arch/powerpc/boot so it first builds the files that the wrapper script needs, then runs it to create whatever flavours of zImage are required. This version does uImages as well. The zImage names are changed slightly; zImage.pseries is the one with the PT_NOTE program header entry added, and zImage.pmac is the one without. If the zImage.pseries gets made, it will also get hardlinked to zImage; otherwise, if zImage.pmac is made, it gets hardlinked to zImage. Signed-off-by: Paul Mackerras <paulus@samba.org>
Showing 7 changed files with 391 additions and 227 deletions Inline Diff
arch/powerpc/Makefile
1 | # This file is included by the global makefile so that you can add your own | 1 | # This file is included by the global makefile so that you can add your own |
2 | # architecture-specific flags and dependencies. Remember to do have actions | 2 | # architecture-specific flags and dependencies. Remember to do have actions |
3 | # for "archclean" and "archdep" for cleaning up and making dependencies for | 3 | # for "archclean" and "archdep" for cleaning up and making dependencies for |
4 | # this architecture. | 4 | # this architecture. |
5 | # | 5 | # |
6 | # This file is subject to the terms and conditions of the GNU General Public | 6 | # This file is subject to the terms and conditions of the GNU General Public |
7 | # License. See the file "COPYING" in the main directory of this archive | 7 | # License. See the file "COPYING" in the main directory of this archive |
8 | # for more details. | 8 | # for more details. |
9 | # | 9 | # |
10 | # Copyright (C) 1994 by Linus Torvalds | 10 | # Copyright (C) 1994 by Linus Torvalds |
11 | # Changes for PPC by Gary Thomas | 11 | # Changes for PPC by Gary Thomas |
12 | # Rewritten by Cort Dougan and Paul Mackerras | 12 | # Rewritten by Cort Dougan and Paul Mackerras |
13 | # | 13 | # |
14 | 14 | ||
15 | HAS_BIARCH := $(call cc-option-yn, -m32) | 15 | HAS_BIARCH := $(call cc-option-yn, -m32) |
16 | 16 | ||
17 | # Set default 32 bits cross compilers for vdso and boot wrapper | 17 | # Set default 32 bits cross compilers for vdso and boot wrapper |
18 | CROSS32_COMPILE ?= | 18 | CROSS32_COMPILE ?= |
19 | 19 | ||
20 | CROSS32CC := $(CROSS32_COMPILE)gcc | 20 | CROSS32CC := $(CROSS32_COMPILE)gcc |
21 | CROSS32AS := $(CROSS32_COMPILE)as | 21 | CROSS32AS := $(CROSS32_COMPILE)as |
22 | CROSS32LD := $(CROSS32_COMPILE)ld | 22 | CROSS32LD := $(CROSS32_COMPILE)ld |
23 | CROSS32AR := $(CROSS32_COMPILE)ar | ||
23 | CROSS32OBJCOPY := $(CROSS32_COMPILE)objcopy | 24 | CROSS32OBJCOPY := $(CROSS32_COMPILE)objcopy |
24 | 25 | ||
25 | ifeq ($(HAS_BIARCH),y) | 26 | ifeq ($(HAS_BIARCH),y) |
26 | ifeq ($(CROSS32_COMPILE),) | 27 | ifeq ($(CROSS32_COMPILE),) |
27 | CROSS32CC := $(CC) -m32 | 28 | CROSS32CC := $(CC) -m32 |
28 | CROSS32AS := $(AS) -a32 | 29 | CROSS32AS := $(AS) -a32 |
29 | CROSS32LD := $(LD) -m elf32ppc | 30 | CROSS32LD := $(LD) -m elf32ppc |
30 | CROSS32OBJCOPY := $(OBJCOPY) | 31 | CROSS32OBJCOPY := $(OBJCOPY) |
32 | CROSS32AR := $(AR) | ||
31 | endif | 33 | endif |
32 | endif | 34 | endif |
33 | 35 | ||
34 | export CROSS32CC CROSS32AS CROSS32LD CROSS32OBJCOPY | 36 | export CROSS32CC CROSS32AS CROSS32LD CROSS32AR CROSS32OBJCOPY |
35 | 37 | ||
36 | KBUILD_DEFCONFIG := $(shell uname -m)_defconfig | 38 | KBUILD_DEFCONFIG := $(shell uname -m)_defconfig |
37 | 39 | ||
38 | ifeq ($(CONFIG_PPC64),y) | 40 | ifeq ($(CONFIG_PPC64),y) |
39 | OLDARCH := ppc64 | 41 | OLDARCH := ppc64 |
40 | SZ := 64 | 42 | SZ := 64 |
41 | 43 | ||
42 | new_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi) | 44 | new_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi) |
43 | 45 | ||
44 | ifeq ($(new_nm),y) | 46 | ifeq ($(new_nm),y) |
45 | NM := $(NM) --synthetic | 47 | NM := $(NM) --synthetic |
46 | endif | 48 | endif |
47 | 49 | ||
48 | else | 50 | else |
49 | OLDARCH := ppc | 51 | OLDARCH := ppc |
50 | SZ := 32 | 52 | SZ := 32 |
51 | endif | 53 | endif |
52 | 54 | ||
53 | UTS_MACHINE := $(OLDARCH) | 55 | UTS_MACHINE := $(OLDARCH) |
54 | 56 | ||
55 | ifeq ($(HAS_BIARCH),y) | 57 | ifeq ($(HAS_BIARCH),y) |
56 | override AS += -a$(SZ) | 58 | override AS += -a$(SZ) |
57 | override LD += -m elf$(SZ)ppc | 59 | override LD += -m elf$(SZ)ppc |
58 | override CC += -m$(SZ) | 60 | override CC += -m$(SZ) |
59 | endif | 61 | endif |
60 | 62 | ||
61 | LDFLAGS_vmlinux := -Bstatic | 63 | LDFLAGS_vmlinux := -Bstatic |
62 | 64 | ||
63 | # The -Iarch/$(ARCH)/include is temporary while we are merging | 65 | # The -Iarch/$(ARCH)/include is temporary while we are merging |
64 | CPPFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -Iarch/$(ARCH)/include | 66 | CPPFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -Iarch/$(ARCH)/include |
65 | AFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) | 67 | AFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) |
66 | CFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=none -mcall-aixdesc | 68 | CFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=none -mcall-aixdesc |
67 | CFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -ffixed-r2 -mmultiple | 69 | CFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -ffixed-r2 -mmultiple |
68 | CPPFLAGS += $(CPPFLAGS-y) | 70 | CPPFLAGS += $(CPPFLAGS-y) |
69 | AFLAGS += $(AFLAGS-y) | 71 | AFLAGS += $(AFLAGS-y) |
70 | CFLAGS += -msoft-float -pipe $(CFLAGS-y) | 72 | CFLAGS += -msoft-float -pipe $(CFLAGS-y) |
71 | CPP = $(CC) -E $(CFLAGS) | 73 | CPP = $(CC) -E $(CFLAGS) |
72 | # Temporary hack until we have migrated to asm-powerpc | 74 | # Temporary hack until we have migrated to asm-powerpc |
73 | LINUXINCLUDE-$(CONFIG_PPC32) := -Iarch/$(ARCH)/include | 75 | LINUXINCLUDE-$(CONFIG_PPC32) := -Iarch/$(ARCH)/include |
74 | LINUXINCLUDE += $(LINUXINCLUDE-y) | 76 | LINUXINCLUDE += $(LINUXINCLUDE-y) |
75 | 77 | ||
76 | CHECKFLAGS += -m$(SZ) -D__powerpc__ -D__powerpc$(SZ)__ | 78 | CHECKFLAGS += -m$(SZ) -D__powerpc__ -D__powerpc$(SZ)__ |
77 | 79 | ||
78 | ifeq ($(CONFIG_PPC64),y) | 80 | ifeq ($(CONFIG_PPC64),y) |
79 | GCC_BROKEN_VEC := $(shell if [ $(call cc-version) -lt 0400 ] ; then echo "y"; fi) | 81 | GCC_BROKEN_VEC := $(shell if [ $(call cc-version) -lt 0400 ] ; then echo "y"; fi) |
80 | 82 | ||
81 | ifeq ($(CONFIG_POWER4_ONLY),y) | 83 | ifeq ($(CONFIG_POWER4_ONLY),y) |
82 | ifeq ($(CONFIG_ALTIVEC),y) | 84 | ifeq ($(CONFIG_ALTIVEC),y) |
83 | ifeq ($(GCC_BROKEN_VEC),y) | 85 | ifeq ($(GCC_BROKEN_VEC),y) |
84 | CFLAGS += $(call cc-option,-mcpu=970) | 86 | CFLAGS += $(call cc-option,-mcpu=970) |
85 | else | 87 | else |
86 | CFLAGS += $(call cc-option,-mcpu=power4) | 88 | CFLAGS += $(call cc-option,-mcpu=power4) |
87 | endif | 89 | endif |
88 | else | 90 | else |
89 | CFLAGS += $(call cc-option,-mcpu=power4) | 91 | CFLAGS += $(call cc-option,-mcpu=power4) |
90 | endif | 92 | endif |
91 | else | 93 | else |
92 | CFLAGS += $(call cc-option,-mtune=power4) | 94 | CFLAGS += $(call cc-option,-mtune=power4) |
93 | endif | 95 | endif |
94 | endif | 96 | endif |
95 | 97 | ||
96 | # No AltiVec instruction when building kernel | 98 | # No AltiVec instruction when building kernel |
97 | CFLAGS += $(call cc-option,-mno-altivec) | 99 | CFLAGS += $(call cc-option,-mno-altivec) |
98 | 100 | ||
99 | # Enable unit-at-a-time mode when possible. It shrinks the | 101 | # Enable unit-at-a-time mode when possible. It shrinks the |
100 | # kernel considerably. | 102 | # kernel considerably. |
101 | CFLAGS += $(call cc-option,-funit-at-a-time) | 103 | CFLAGS += $(call cc-option,-funit-at-a-time) |
102 | 104 | ||
103 | ifndef CONFIG_FSL_BOOKE | 105 | ifndef CONFIG_FSL_BOOKE |
104 | CFLAGS += -mstring | 106 | CFLAGS += -mstring |
105 | endif | 107 | endif |
106 | 108 | ||
107 | ifeq ($(CONFIG_6xx),y) | 109 | ifeq ($(CONFIG_6xx),y) |
108 | CFLAGS += -mcpu=powerpc | 110 | CFLAGS += -mcpu=powerpc |
109 | endif | 111 | endif |
110 | 112 | ||
111 | cpu-as-$(CONFIG_4xx) += -Wa,-m405 | 113 | cpu-as-$(CONFIG_4xx) += -Wa,-m405 |
112 | cpu-as-$(CONFIG_6xx) += -Wa,-maltivec | 114 | cpu-as-$(CONFIG_6xx) += -Wa,-maltivec |
113 | cpu-as-$(CONFIG_POWER4) += -Wa,-maltivec | 115 | cpu-as-$(CONFIG_POWER4) += -Wa,-maltivec |
114 | cpu-as-$(CONFIG_E500) += -Wa,-me500 | 116 | cpu-as-$(CONFIG_E500) += -Wa,-me500 |
115 | cpu-as-$(CONFIG_E200) += -Wa,-me200 | 117 | cpu-as-$(CONFIG_E200) += -Wa,-me200 |
116 | 118 | ||
117 | AFLAGS += $(cpu-as-y) | 119 | AFLAGS += $(cpu-as-y) |
118 | CFLAGS += $(cpu-as-y) | 120 | CFLAGS += $(cpu-as-y) |
119 | 121 | ||
120 | head-y := arch/powerpc/kernel/head_32.o | 122 | head-y := arch/powerpc/kernel/head_32.o |
121 | head-$(CONFIG_PPC64) := arch/powerpc/kernel/head_64.o | 123 | head-$(CONFIG_PPC64) := arch/powerpc/kernel/head_64.o |
122 | head-$(CONFIG_8xx) := arch/powerpc/kernel/head_8xx.o | 124 | head-$(CONFIG_8xx) := arch/powerpc/kernel/head_8xx.o |
123 | head-$(CONFIG_4xx) := arch/powerpc/kernel/head_4xx.o | 125 | head-$(CONFIG_4xx) := arch/powerpc/kernel/head_4xx.o |
124 | head-$(CONFIG_44x) := arch/powerpc/kernel/head_44x.o | 126 | head-$(CONFIG_44x) := arch/powerpc/kernel/head_44x.o |
125 | head-$(CONFIG_FSL_BOOKE) := arch/powerpc/kernel/head_fsl_booke.o | 127 | head-$(CONFIG_FSL_BOOKE) := arch/powerpc/kernel/head_fsl_booke.o |
126 | 128 | ||
127 | head-$(CONFIG_PPC64) += arch/powerpc/kernel/entry_64.o | 129 | head-$(CONFIG_PPC64) += arch/powerpc/kernel/entry_64.o |
128 | head-$(CONFIG_PPC_FPU) += arch/powerpc/kernel/fpu.o | 130 | head-$(CONFIG_PPC_FPU) += arch/powerpc/kernel/fpu.o |
129 | 131 | ||
130 | core-y += arch/powerpc/kernel/ \ | 132 | core-y += arch/powerpc/kernel/ \ |
131 | arch/powerpc/mm/ \ | 133 | arch/powerpc/mm/ \ |
132 | arch/powerpc/lib/ \ | 134 | arch/powerpc/lib/ \ |
133 | arch/powerpc/sysdev/ \ | 135 | arch/powerpc/sysdev/ \ |
134 | arch/powerpc/platforms/ | 136 | arch/powerpc/platforms/ |
135 | core-$(CONFIG_MATH_EMULATION) += arch/powerpc/math-emu/ | 137 | core-$(CONFIG_MATH_EMULATION) += arch/powerpc/math-emu/ |
136 | core-$(CONFIG_XMON) += arch/powerpc/xmon/ | 138 | core-$(CONFIG_XMON) += arch/powerpc/xmon/ |
137 | 139 | ||
138 | drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/ | 140 | drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/ |
139 | 141 | ||
140 | # Default to zImage, override when needed | 142 | # Default to zImage, override when needed |
141 | defaultimage-y := zImage | 143 | defaultimage-y := zImage |
142 | defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux | 144 | defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux |
143 | defaultimage-$(CONFIG_DEFAULT_UIMAGE) := uImage | 145 | defaultimage-$(CONFIG_DEFAULT_UIMAGE) := uImage |
144 | KBUILD_IMAGE := $(defaultimage-y) | 146 | KBUILD_IMAGE := $(defaultimage-y) |
145 | all: $(KBUILD_IMAGE) | 147 | all: $(KBUILD_IMAGE) |
146 | 148 | ||
147 | CPPFLAGS_vmlinux.lds := -Upowerpc | 149 | CPPFLAGS_vmlinux.lds := -Upowerpc |
148 | 150 | ||
149 | BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm uImage vmlinux.bin | 151 | BOOT_TARGETS = zImage zImage.initrd uImage |
150 | 152 | ||
151 | PHONY += $(BOOT_TARGETS) | 153 | PHONY += $(BOOT_TARGETS) |
152 | 154 | ||
153 | boot := arch/$(ARCH)/boot | 155 | boot := arch/$(ARCH)/boot |
154 | 156 | ||
155 | $(BOOT_TARGETS): vmlinux | 157 | $(BOOT_TARGETS): vmlinux |
156 | $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@) | 158 | $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@) |
157 | 159 | ||
158 | define archhelp | 160 | define archhelp |
159 | @echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage.*)' | 161 | @echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage.*)' |
160 | @echo ' install - Install kernel using' | 162 | @echo ' install - Install kernel using' |
161 | @echo ' (your) ~/bin/installkernel or' | 163 | @echo ' (your) ~/bin/installkernel or' |
162 | @echo ' (distribution) /sbin/installkernel or' | 164 | @echo ' (distribution) /sbin/installkernel or' |
163 | @echo ' install to $$(INSTALL_PATH) and run lilo' | 165 | @echo ' install to $$(INSTALL_PATH) and run lilo' |
164 | @echo ' *_defconfig - Select default config from arch/$(ARCH)/configs' | 166 | @echo ' *_defconfig - Select default config from arch/$(ARCH)/configs' |
165 | endef | 167 | endef |
166 | 168 | ||
167 | archclean: | 169 | archclean: |
168 | $(Q)$(MAKE) $(clean)=$(boot) | 170 | $(Q)$(MAKE) $(clean)=$(boot) |
169 | 171 | ||
170 | archmrproper: | 172 | archmrproper: |
171 | $(Q)rm -rf arch/$(ARCH)/include | 173 | $(Q)rm -rf arch/$(ARCH)/include |
172 | 174 | ||
173 | archprepare: checkbin | 175 | archprepare: checkbin |
174 | 176 | ||
175 | ifeq ($(CONFIG_PPC32),y) | 177 | ifeq ($(CONFIG_PPC32),y) |
176 | # Temporary hack until we have migrated to asm-powerpc | 178 | # Temporary hack until we have migrated to asm-powerpc |
177 | include/asm: arch/$(ARCH)/include/asm | 179 | include/asm: arch/$(ARCH)/include/asm |
178 | arch/$(ARCH)/include/asm: FORCE | 180 | arch/$(ARCH)/include/asm: FORCE |
179 | $(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi | 181 | $(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi |
180 | $(Q)ln -fsn $(srctree)/include/asm-$(OLDARCH) arch/$(ARCH)/include/asm | 182 | $(Q)ln -fsn $(srctree)/include/asm-$(OLDARCH) arch/$(ARCH)/include/asm |
181 | endif | 183 | endif |
182 | 184 | ||
183 | # Use the file '.tmp_gas_check' for binutils tests, as gas won't output | 185 | # Use the file '.tmp_gas_check' for binutils tests, as gas won't output |
184 | # to stdout and these checks are run even on install targets. | 186 | # to stdout and these checks are run even on install targets. |
185 | TOUT := .tmp_gas_check | 187 | TOUT := .tmp_gas_check |
186 | # Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later for altivec | 188 | # Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later for altivec |
187 | # instructions. | 189 | # instructions. |
188 | # gcc-3.4 and binutils-2.14 are a fatal combination. | 190 | # gcc-3.4 and binutils-2.14 are a fatal combination. |
189 | 191 | ||
190 | checkbin: | 192 | checkbin: |
191 | @if test "$(call cc-version)" = "0304" ; then \ | 193 | @if test "$(call cc-version)" = "0304" ; then \ |
192 | if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \ | 194 | if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \ |
193 | echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \ | 195 | echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \ |
194 | echo 'correctly with gcc-3.4 and your version of binutils.'; \ | 196 | echo 'correctly with gcc-3.4 and your version of binutils.'; \ |
195 | echo '*** Please upgrade your binutils or downgrade your gcc'; \ | 197 | echo '*** Please upgrade your binutils or downgrade your gcc'; \ |
196 | false; \ | 198 | false; \ |
197 | fi ; \ | 199 | fi ; \ |
198 | fi | 200 | fi |
199 | @if ! /bin/echo dssall | $(AS) -many -o $(TOUT) >/dev/null 2>&1 ; then \ | 201 | @if ! /bin/echo dssall | $(AS) -many -o $(TOUT) >/dev/null 2>&1 ; then \ |
200 | echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build ' ; \ | 202 | echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build ' ; \ |
201 | echo 'correctly with old versions of binutils.' ; \ | 203 | echo 'correctly with old versions of binutils.' ; \ |
202 | echo '*** Please upgrade your binutils to 2.12.1 or newer' ; \ | 204 | echo '*** Please upgrade your binutils to 2.12.1 or newer' ; \ |
203 | false ; \ | 205 | false ; \ |
204 | fi | 206 | fi |
205 | 207 | ||
206 | CLEAN_FILES += $(TOUT) | 208 | CLEAN_FILES += $(TOUT) |
207 | 209 | ||
208 | 210 |
arch/powerpc/boot/Makefile
1 | # Makefile for making ELF bootable images for booting on CHRP | 1 | # Makefile for making ELF bootable images for booting on CHRP |
2 | # using Open Firmware. | 2 | # using Open Firmware. |
3 | # | 3 | # |
4 | # Geert Uytterhoeven September 1997 | 4 | # Geert Uytterhoeven September 1997 |
5 | # | 5 | # |
6 | # Based on coffboot by Paul Mackerras | 6 | # Based on coffboot by Paul Mackerras |
7 | # Simplified for ppc64 by Todd Inglett | 7 | # Simplified for ppc64 by Todd Inglett |
8 | # | 8 | # |
9 | # NOTE: this code is built for 32 bit in ELF32 format even though | 9 | # NOTE: this code is built for 32 bit in ELF32 format even though |
10 | # it packages a 64 bit kernel. We do this to simplify the | 10 | # it packages a 64 bit kernel. We do this to simplify the |
11 | # bootloader and increase compatibility with OpenFirmware. | 11 | # bootloader and increase compatibility with OpenFirmware. |
12 | # | 12 | # |
13 | # To this end we need to define BOOTCC, etc, as the tools | 13 | # To this end we need to define BOOTCC, etc, as the tools |
14 | # needed to build the 32 bit image. These are normally HOSTCC, | 14 | # needed to build the 32 bit image. These are normally HOSTCC, |
15 | # but may be a third compiler if, for example, you are cross | 15 | # but may be a third compiler if, for example, you are cross |
16 | # compiling from an intel box. Once the 64bit ppc gcc is | 16 | # compiling from an intel box. Once the 64bit ppc gcc is |
17 | # stable it will probably simply be a compiler switch to | 17 | # stable it will probably simply be a compiler switch to |
18 | # compile for 32bit mode. | 18 | # compile for 32bit mode. |
19 | # To make it easier to setup a cross compiler, | 19 | # To make it easier to setup a cross compiler, |
20 | # CROSS32_COMPILE is setup as a prefix just like CROSS_COMPILE | 20 | # CROSS32_COMPILE is setup as a prefix just like CROSS_COMPILE |
21 | # in the toplevel makefile. | 21 | # in the toplevel makefile. |
22 | 22 | ||
23 | all: $(obj)/zImage | ||
23 | 24 | ||
24 | HOSTCC := gcc | 25 | HOSTCC := gcc |
25 | BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \ | 26 | BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \ |
26 | $(shell $(CROSS32CC) -print-file-name=include) -fPIC | 27 | $(shell $(CROSS32CC) -print-file-name=include) -fPIC |
27 | BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc | 28 | BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc |
28 | OBJCOPYFLAGS := contents,alloc,load,readonly,data | ||
29 | OBJCOPY_COFF_ARGS := -O aixcoff-rs6000 --set-start 0x500000 | ||
30 | OBJCOPY_MIB_ARGS := -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment | ||
31 | 29 | ||
30 | ifeq ($(call cc-option-yn, -fstack-protector),y) | ||
31 | BOOTCFLAGS += -fno-stack-protector | ||
32 | endif | ||
33 | |||
34 | BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) | ||
35 | |||
32 | zlib := inffast.c inflate.c inftrees.c | 36 | zlib := inffast.c inflate.c inftrees.c |
33 | zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h | 37 | zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h |
34 | zliblinuxheader := zlib.h zconf.h zutil.h | 38 | zliblinuxheader := zlib.h zconf.h zutil.h |
35 | 39 | ||
36 | $(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) | 40 | $(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) \ |
37 | #$(addprefix $(obj)/,main.o): $(addprefix $(obj)/,zlib.h) | 41 | $(addprefix $(obj)/,$(zlibheader)) |
38 | 42 | ||
39 | src-boot-$(CONFIG_PPC_MULTIPLATFORM) := of.c | 43 | src-wlib := string.S stdio.c main.c div64.S $(zlib) |
40 | src-boot := crt0.S string.S stdio.c main.c div64.S $(src-boot-y) | 44 | src-plat := of.c |
41 | src-boot += $(zlib) | 45 | src-boot := crt0.S $(src-wlib) $(src-plat) empty.c |
46 | |||
42 | src-boot := $(addprefix $(obj)/, $(src-boot)) | 47 | src-boot := $(addprefix $(obj)/, $(src-boot)) |
43 | obj-boot := $(addsuffix .o, $(basename $(src-boot))) | 48 | obj-boot := $(addsuffix .o, $(basename $(src-boot))) |
49 | obj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib)))) | ||
50 | obj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat)))) | ||
44 | 51 | ||
45 | ifeq ($(call cc-option-yn, -fstack-protector),y) | ||
46 | BOOTCFLAGS += -fno-stack-protector | ||
47 | endif | ||
48 | |||
49 | BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) | ||
50 | |||
51 | quiet_cmd_copy_zlib = COPY $@ | 52 | quiet_cmd_copy_zlib = COPY $@ |
52 | cmd_copy_zlib = sed "s@__attribute_used__@@;s@<linux/\([^>]\+\).*@\"\1\"@" $< > $@ | 53 | cmd_copy_zlib = sed "s@__attribute_used__@@;s@<linux/\([^>]\+\).*@\"\1\"@" $< > $@ |
53 | 54 | ||
54 | quiet_cmd_copy_zlibheader = COPY $@ | 55 | quiet_cmd_copy_zlibheader = COPY $@ |
55 | cmd_copy_zlibheader = sed "s@<linux/\([^>]\+\).*@\"\1\"@" $< > $@ | 56 | cmd_copy_zlibheader = sed "s@<linux/\([^>]\+\).*@\"\1\"@" $< > $@ |
56 | # stddef.h for NULL | 57 | # stddef.h for NULL |
57 | quiet_cmd_copy_zliblinuxheader = COPY $@ | 58 | quiet_cmd_copy_zliblinuxheader = COPY $@ |
58 | cmd_copy_zliblinuxheader = sed "s@<linux/string.h>@\"string.h\"@;s@<linux/kernel.h>@<stddef.h>@;s@<linux/\([^>]\+\).*@\"\1\"@" $< > $@ | 59 | cmd_copy_zliblinuxheader = sed "s@<linux/string.h>@\"string.h\"@;s@<linux/kernel.h>@<stddef.h>@;s@<linux/\([^>]\+\).*@\"\1\"@" $< > $@ |
59 | 60 | ||
60 | $(addprefix $(obj)/,$(zlib)): $(obj)/%: $(srctree)/lib/zlib_inflate/% | 61 | $(addprefix $(obj)/,$(zlib)): $(obj)/%: $(srctree)/lib/zlib_inflate/% |
61 | $(call cmd,copy_zlib) | 62 | $(call cmd,copy_zlib) |
62 | 63 | ||
63 | $(addprefix $(obj)/,$(zlibheader)): $(obj)/%: $(srctree)/lib/zlib_inflate/% | 64 | $(addprefix $(obj)/,$(zlibheader)): $(obj)/%: $(srctree)/lib/zlib_inflate/% |
64 | $(call cmd,copy_zlibheader) | 65 | $(call cmd,copy_zlibheader) |
65 | 66 | ||
66 | $(addprefix $(obj)/,$(zliblinuxheader)): $(obj)/%: $(srctree)/include/linux/% | 67 | $(addprefix $(obj)/,$(zliblinuxheader)): $(obj)/%: $(srctree)/include/linux/% |
67 | $(call cmd,copy_zliblinuxheader) | 68 | $(call cmd,copy_zliblinuxheader) |
68 | 69 | ||
69 | clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) | 70 | $(obj)/empty.c: |
71 | @touch $@ | ||
70 | 72 | ||
73 | $(obj)/zImage.lds $(obj)/zImage.coff.lds: $(obj)/%: $(srctree)/$(src)/%.S | ||
74 | @cp $< $@ | ||
71 | 75 | ||
76 | clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \ | ||
77 | $(obj)/empty.c | ||
78 | |||
72 | quiet_cmd_bootcc = BOOTCC $@ | 79 | quiet_cmd_bootcc = BOOTCC $@ |
73 | cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $< | 80 | cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $< |
74 | 81 | ||
75 | quiet_cmd_bootas = BOOTAS $@ | 82 | quiet_cmd_bootas = BOOTAS $@ |
76 | cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< | 83 | cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< |
77 | 84 | ||
78 | quiet_cmd_bootld = BOOTLD $@ | 85 | quiet_cmd_bootar = BOOTAR $@ |
79 | cmd_bootld = $(CROSS32LD) -T $(srctree)/$(src)/$(3) -o $@ $(2) | 86 | cmd_bootar = $(CROSS32AR) -cr $@.$$$$ $^; mv $@.$$$$ $@ |
80 | 87 | ||
81 | $(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c | 88 | $(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c |
82 | $(call if_changed_dep,bootcc) | 89 | $(call if_changed_dep,bootcc) |
83 | $(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S | 90 | $(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S |
84 | $(call if_changed_dep,bootas) | 91 | $(call if_changed_dep,bootas) |
85 | 92 | ||
86 | #----------------------------------------------------------- | 93 | $(obj)/wrapper.a: $(obj-wlib) |
87 | # ELF sections within the zImage bootloader/wrapper | 94 | $(call cmd,bootar) |
88 | #----------------------------------------------------------- | ||
89 | required := vmlinux.strip | ||
90 | initrd := initrd | ||
91 | 95 | ||
92 | obj-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.o, $(section))) | 96 | hostprogs-y := addnote addRamDisk hack-coff |
93 | src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section))) | ||
94 | gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section))) | ||
95 | 97 | ||
96 | hostprogs-y := addnote addRamDisk hack-coff | 98 | extra-y := $(obj)/crt0.o $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \ |
99 | $(obj)/zImage.lds $(obj)/zImage.coff.lds | ||
97 | 100 | ||
98 | targets += zImage.vmode zImage.initrd.vmode zImage zImage.initrd \ | 101 | wrapper :=$(srctree)/$(src)/wrapper |
99 | zImage.coff zImage.initrd.coff miboot.image miboot.initrd.image \ | 102 | wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff) |
100 | $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \ | ||
101 | $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \ | ||
102 | $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \ | ||
103 | vmlinux.initrd dummy.o | ||
104 | extra-y := initrd.o | ||
105 | 103 | ||
106 | quiet_cmd_ramdisk = RAMDISK $@ | 104 | ############# |
107 | cmd_ramdisk = $(obj)/addRamDisk $(obj)/ramdisk.image.gz $< $@ | 105 | # Bits for building various flavours of zImage |
108 | 106 | ||
109 | quiet_cmd_stripvm = STRIP $@ | 107 | ifneq ($(CROSS32_COMPILE),) |
110 | cmd_stripvm = $(STRIP) -s -R .comment $< -o $@ | 108 | CROSSWRAP := -C $(CROSS32_COMPILE) |
109 | else | ||
110 | ifneq ($(CROSS_COMPILE),) | ||
111 | CROSSWRAP := -C $(CROSS_COMPILE) | ||
112 | endif | ||
113 | endif | ||
111 | 114 | ||
112 | vmlinux.strip: vmlinux | 115 | quiet_cmd_wrap = WRAP $@ |
113 | $(call if_changed,stripvm) | 116 | cmd_wrap =$(wrapper) -c -o $@ -p $2 $(CROSSWRAP) vmlinux |
114 | $(obj)/vmlinux.initrd: vmlinux.strip $(obj)/addRamDisk $(obj)/ramdisk.image.gz | 117 | quiet_cmd_wrap_initrd = WRAP $@ |
115 | $(call if_changed,ramdisk) | 118 | cmd_wrap_initrd =$(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \ |
119 | -i $(obj)/ramdisk.image.gz vmlinux | ||
116 | 120 | ||
117 | quiet_cmd_addsection = ADDSEC $@ | 121 | $(obj)/zImage.chrp: vmlinux $(wrapperbits) |
118 | cmd_addsection = $(CROSS32OBJCOPY) $@ \ | 122 | $(call cmd,wrap,chrp) |
119 | --add-section=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $@))=$(patsubst %.o,%.gz, $@) \ | ||
120 | --set-section-flags=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $@))=$(OBJCOPYFLAGS) | ||
121 | 123 | ||
122 | quiet_cmd_addnote = ADDNOTE $@ | 124 | $(obj)/zImage.initrd.chrp: vmlinux $(wrapperbits) |
123 | cmd_addnote = $(obj)/addnote $@ | 125 | $(call cmd,wrap_initrd,chrp) |
124 | 126 | ||
125 | quiet_cmd_gen-miboot = GEN $@ | 127 | $(obj)/zImage.pseries: vmlinux $(wrapperbits) |
126 | cmd_gen-miboot = $(OBJCOPY) $(OBJCOPY_MIB_ARGS) \ | 128 | $(call cmd,wrap,pseries) |
127 | --add-section=$1=$(word 2, $^) $< $@ | ||
128 | 129 | ||
129 | quiet_cmd_gencoff = COFF $@ | 130 | $(obj)/zImage.initrd.pseries: vmlinux $(wrapperbits) |
130 | cmd_gencoff = $(OBJCOPY) $(OBJCOPY_COFF_ARGS) $@ && \ | 131 | $(call cmd,wrap_initrd,pseries) |
131 | $(obj)/hack-coff $@ | ||
132 | 132 | ||
133 | $(call gz-sec, $(required)): $(obj)/kernel-%.gz: % | 133 | $(obj)/zImage.pmac: vmlinux $(wrapperbits) |
134 | $(call if_changed,gzip) | 134 | $(call cmd,wrap,pmac) |
135 | 135 | ||
136 | $(obj)/kernel-initrd.gz: $(obj)/ramdisk.image.gz | 136 | $(obj)/zImage.initrd.pmac: vmlinux $(wrapperbits) |
137 | cp -f $(obj)/ramdisk.image.gz $@ | 137 | $(call cmd,wrap_initrd,pmac) |
138 | 138 | ||
139 | $(call src-sec, $(required) $(initrd)): $(obj)/kernel-%.c: $(obj)/kernel-%.gz | 139 | $(obj)/zImage.coff: vmlinux $(wrapperbits) |
140 | @touch $@ | 140 | $(call cmd,wrap,pmaccoff) |
141 | 141 | ||
142 | $(call obj-sec, $(required) $(initrd)): $(obj)/kernel-%.o: $(obj)/kernel-%.c | 142 | $(obj)/zImage.initrd.coff: vmlinux $(wrapperbits) |
143 | $(call if_changed_dep,bootcc) | 143 | $(call cmd,wrap_initrd,pmaccoff) |
144 | $(call cmd,addsection) | ||
145 | 144 | ||
146 | $(obj)/zImage.vmode $(obj)/zImage.coff: obj-boot += $(call obj-sec, $(required)) | 145 | $(obj)/zImage.miboot: vmlinux $(wrapperbits) |
147 | $(obj)/zImage.vmode: $(call obj-sec, $(required)) $(obj-boot) $(srctree)/$(src)/zImage.lds | 146 | $(call cmd,wrap,miboot) |
148 | $(call cmd,bootld,$(obj-boot),zImage.lds) | ||
149 | 147 | ||
150 | $(obj)/zImage.initrd.vmode $(obj)/zImage.initrd.coff: obj-boot += $(call obj-sec, $(required) $(initrd)) | 148 | $(obj)/zImage.initrd.miboot: vmlinux $(wrapperbits) |
151 | $(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(srctree)/$(src)/zImage.lds | 149 | $(call cmd,wrap_initrd,miboot) |
152 | $(call cmd,bootld,$(obj-boot),zImage.lds) | ||
153 | 150 | ||
151 | $(obj)/uImage: vmlinux $(wrapperbits) | ||
152 | $(call cmd,wrap,uboot) | ||
153 | |||
154 | image-$(CONFIG_PPC_PSERIES) += zImage.pseries | ||
155 | image-$(CONFIG_PPC_MAPLE) += zImage.pseries | ||
156 | image-$(CONFIG_PPC_CELL) += zImage.pseries | ||
157 | image-$(CONFIG_PPC_CHRP) += zImage.chrp | ||
158 | image-$(CONFIG_PPC_PMAC) += zImage.pmac | ||
159 | image-$(CONFIG_DEFAULT_UIMAGE) += uImage | ||
160 | |||
154 | # For 32-bit powermacs, build the COFF and miboot images | 161 | # For 32-bit powermacs, build the COFF and miboot images |
155 | # as well as the ELF images. | 162 | # as well as the ELF images. |
156 | coffimage-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/zImage.coff | 163 | ifeq ($(CONFIG_PPC32),y) |
157 | coffrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/zImage.initrd.coff | 164 | image-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot |
158 | mibootimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/miboot.image | 165 | endif |
159 | mibrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/miboot.initrd.image | ||
160 | 166 | ||
161 | $(obj)/zImage: $(obj)/zImage.vmode $(obj)/addnote $(coffimage-y-y) \ | 167 | initrd-y := $(patsubst zImage%, zImage.initrd%, $(image-y)) |
162 | $(mibootimg-y-y) | ||
163 | @cp -f $< $@ | ||
164 | $(call if_changed,addnote) | ||
165 | 168 | ||
166 | $(obj)/zImage.initrd: $(obj)/zImage.initrd.vmode $(obj)/addnote \ | 169 | $(obj)/zImage: $(addprefix $(obj)/, $(image-y)) |
167 | $(coffrdimg-y-y) $(mibrdimg-y-y) | 170 | @rm -f $@; ln $< $@ |
168 | @cp -f $< $@ | 171 | $(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y)) |
169 | $(call if_changed,addnote) | 172 | @rm -f $@; ln $< $@ |
170 | 173 | ||
171 | $(obj)/zImage.coff: $(call obj-sec, $(required)) $(obj-boot) \ | 174 | install: $(CONFIGURE) $(image-y) |
172 | $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff | 175 | sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $< |
173 | $(call cmd,bootld,$(obj-boot),zImage.coff.lds) | ||
174 | $(call cmd,gencoff) | ||
175 | 176 | ||
176 | $(obj)/zImage.initrd.coff: $(call obj-sec, $(required) $(initrd)) $(obj-boot) \ | 177 | clean-files += $(addprefix $(objtree)/, $(obj-boot) vmlinux.strip.gz) |
177 | $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff | 178 | clean-files += $(addprefix $(objtree)/, $(obj-boot) vmlinux.bin.gz) |
178 | $(call cmd,bootld,$(obj-boot),zImage.coff.lds) | ||
179 | $(call cmd,gencoff) | ||
180 | |||
181 | $(obj)/miboot.image: $(obj)/dummy.o $(obj)/vmlinux.gz | ||
182 | $(call cmd,gen-miboot,image) | ||
183 | |||
184 | $(obj)/miboot.initrd.image: $(obj)/miboot.image $(images)/ramdisk.image.gz | ||
185 | $(call cmd,gen-miboot,initrd) | ||
186 | |||
187 | #----------------------------------------------------------- | ||
188 | # build u-boot images |
arch/powerpc/boot/wrapper
File was created | 1 | #!/bin/sh | |
2 | |||
3 | # Copyright (C) 2006 Paul Mackerras, IBM Corporation <paulus@samba.org> | ||
4 | # This program may be used under the terms of version 2 of the GNU | ||
5 | # General Public License. | ||
6 | |||
7 | # This script takes a kernel binary and optionally an initrd image | ||
8 | # and/or a device-tree blob, and creates a bootable zImage for a | ||
9 | # given platform. | ||
10 | |||
11 | # Options: | ||
12 | # -o zImage specify output file | ||
13 | # -p platform specify platform (links in $platform.o) | ||
14 | # -i initrd specify initrd file | ||
15 | # -d devtree specify device-tree blob | ||
16 | # -s tree.dts specify device-tree source file (needs dtc installed) | ||
17 | # -c cache $kernel.strip.gz (use if present & newer, else make) | ||
18 | # -C prefix specify command prefix for cross-building tools | ||
19 | # (strip, objcopy, ld) | ||
20 | # -D dir specify directory containing data files used by script | ||
21 | # (default ./arch/powerpc/boot) | ||
22 | # -W dir specify working directory for temporary files (default .) | ||
23 | |||
24 | # defaults | ||
25 | kernel= | ||
26 | ofile=zImage | ||
27 | platform=of | ||
28 | initrd= | ||
29 | dtb= | ||
30 | dts= | ||
31 | cacheit= | ||
32 | |||
33 | # cross-compilation prefix | ||
34 | CROSS= | ||
35 | |||
36 | # directory for object and other files used by this script | ||
37 | object=arch/powerpc/boot | ||
38 | |||
39 | # directory for working files | ||
40 | tmpdir=. | ||
41 | |||
42 | usage() { | ||
43 | echo 'Usage: wrapper [-o output] [-p platform] [-i initrd]' >&2 | ||
44 | echo ' [-d devtree] [-s tree.dts] [-c] [-C cross-prefix]' >&2 | ||
45 | echo ' [-D datadir] [-W workingdir] [vmlinux]' >&2 | ||
46 | exit 1 | ||
47 | } | ||
48 | |||
49 | while [ "$#" -gt 0 ]; do | ||
50 | case "$1" in | ||
51 | -o) | ||
52 | shift | ||
53 | [ "$#" -gt 0 ] || usage | ||
54 | ofile="$1" | ||
55 | ;; | ||
56 | -p) | ||
57 | shift | ||
58 | [ "$#" -gt 0 ] || usage | ||
59 | platform="$1" | ||
60 | ;; | ||
61 | -i) | ||
62 | shift | ||
63 | [ "$#" -gt 0 ] || usage | ||
64 | initrd="$1" | ||
65 | ;; | ||
66 | -d) | ||
67 | shift | ||
68 | [ "$#" -gt 0 ] || usage | ||
69 | dtb="$1" | ||
70 | ;; | ||
71 | -s) | ||
72 | shift | ||
73 | [ "$#" -gt 0 ] || usage | ||
74 | dts="$1" | ||
75 | ;; | ||
76 | -c) | ||
77 | cacheit=y | ||
78 | ;; | ||
79 | -C) | ||
80 | shift | ||
81 | [ "$#" -gt 0 ] || usage | ||
82 | CROSS="$1" | ||
83 | ;; | ||
84 | -D) | ||
85 | shift | ||
86 | [ "$#" -gt 0 ] || usage | ||
87 | object="$1" | ||
88 | ;; | ||
89 | -W) | ||
90 | shift | ||
91 | [ "$#" -gt 0 ] || usage | ||
92 | tmpdir="$1" | ||
93 | ;; | ||
94 | -?) | ||
95 | usage | ||
96 | ;; | ||
97 | *) | ||
98 | [ -z "$kernel" ] || usage | ||
99 | kernel="$1" | ||
100 | ;; | ||
101 | esac | ||
102 | shift | ||
103 | done | ||
104 | |||
105 | if [ -n "$dts" ]; then | ||
106 | if [ -z "$dtb" ]; then | ||
107 | dtb="$platform.dtb" | ||
108 | fi | ||
109 | dtc -O dtb -o "$dtb" -b 0 -V 16 "$dts" || exit 1 | ||
110 | fi | ||
111 | |||
112 | if [ -z "$kernel" ]; then | ||
113 | kernel=vmlinux | ||
114 | fi | ||
115 | |||
116 | platformo=$object/"$platform".o | ||
117 | lds=$object/zImage.lds | ||
118 | ext=strip | ||
119 | objflags=-S | ||
120 | tmp=$tmpdir/zImage.$$.o | ||
121 | ksection=.kernel:vmlinux.strip | ||
122 | isection=.kernel:initrd | ||
123 | |||
124 | case "$platform" in | ||
125 | pmac|pseries|chrp) | ||
126 | platformo=$object/of.o | ||
127 | ;; | ||
128 | pmaccoff) | ||
129 | platformo=$object/of.o | ||
130 | lds=$object/zImage.coff.lds | ||
131 | ;; | ||
132 | miboot|uboot) | ||
133 | # miboot and U-boot want just the bare bits, not an ELF binary | ||
134 | ext=bin | ||
135 | objflags="-O binary" | ||
136 | tmp="$ofile" | ||
137 | ksection=image | ||
138 | isection=initrd | ||
139 | ;; | ||
140 | esac | ||
141 | |||
142 | vmz="$tmpdir/`basename \"$kernel\"`.$ext" | ||
143 | if [ -z "$cacheit" -o ! -f "$vmz.gz" -o "$vmz.gz" -ot "$kernel" ]; then | ||
144 | ${CROSS}objcopy $objflags "$kernel" "$vmz.$$" | ||
145 | gzip -f -9 "$vmz.$$" | ||
146 | if [ -n "$cacheit" ]; then | ||
147 | mv -f "$vmz.$$.gz" "$vmz.gz" | ||
148 | else | ||
149 | vmz="$vmz.$$" | ||
150 | fi | ||
151 | fi | ||
152 | |||
153 | case "$platform" in | ||
154 | uboot) | ||
155 | rm -f "$ofile" | ||
156 | version=`${CROSS}strings "$kernel" | grep '^Linux version [-0-9.]' | \ | ||
157 | cut -d' ' -f3` | ||
158 | if [ -n "$version" ]; then | ||
159 | version="-n Linux-$version" | ||
160 | fi | ||
161 | mkimage -A ppc -O linux -T kernel -C gzip -a 00000000 -e 00000000 \ | ||
162 | $version -d "$vmz.gz" "$ofile" | ||
163 | if [ -z "$cacheit" ]; then | ||
164 | rm -f $vmz.gz | ||
165 | fi | ||
166 | exit 0 | ||
167 | ;; | ||
168 | esac | ||
169 | |||
170 | addsec() { | ||
171 | ${CROSS}objcopy $4 $1 \ | ||
172 | --add-section=$3="$2" \ | ||
173 | --set-section-flags=$3=contents,alloc,load,readonly,data | ||
174 | } | ||
175 | |||
176 | addsec $tmp "$vmz.gz" $ksection $object/empty.o | ||
177 | if [ -z "$cacheit" ]; then | ||
178 | rm -f "$vmz.gz" | ||
179 | fi | ||
180 | |||
181 | if [ -n "$initrd" ]; then | ||
182 | addsec $tmp "$initrd" initrd | ||
183 | fi | ||
184 | |||
185 | if [ -n "$dtb" ]; then | ||
186 | addsec $tmp "$dtb" dtb | ||
187 | fi | ||
188 | |||
189 | if [ "$platform" != "miboot" ]; then | ||
190 | ${CROSS}ld -m elf32ppc -T $lds -o "$ofile" \ | ||
191 | $object/crt0.o $platformo $tmp $object/wrapper.a | ||
192 | rm $tmp | ||
193 | fi | ||
194 | |||
195 | # post-processing needed for some platforms | ||
196 | case "$platform" in | ||
197 | pseries|chrp) | ||
198 | $object/addnote "$ofile" | ||
199 | ;; | ||
200 | pmaccoff) | ||
201 | ${CROSS}objcopy -O aixcoff-rs6000 --set-start 0x500000 "$ofile" | ||
202 | $object/hack-coff "$ofile" | ||
203 | ;; | ||
204 | esac | ||
205 |
arch/powerpc/boot/zImage.coff.lds
1 | OUTPUT_ARCH(powerpc:common) | File was deleted | |
2 | ENTRY(_start) | ||
3 | SECTIONS | ||
4 | { | ||
5 | . = (5*1024*1024); | ||
6 | _start = .; | ||
7 | .text : | ||
8 | { | ||
9 | *(.text) | ||
10 | *(.fixup) | ||
11 | } | ||
12 | _etext = .; | ||
13 | . = ALIGN(4096); | ||
14 | .data : | ||
15 | { | ||
16 | *(.rodata*) | ||
17 | *(.data*) | ||
18 | *(.sdata*) | ||
19 | __got2_start = .; | ||
20 | *(.got2) | ||
21 | __got2_end = .; | ||
22 | |||
23 | _vmlinux_start = .; | ||
24 | *(.kernel:vmlinux.strip) | ||
25 | _vmlinux_end = .; | ||
26 | |||
27 | _initrd_start = .; | ||
28 | *(.kernel:initrd) | ||
29 | _initrd_end = .; | ||
30 | } | ||
31 | |||
32 | . = ALIGN(4096); | ||
33 | _edata = .; | ||
34 | __bss_start = .; | ||
35 | .bss : | ||
36 | { | ||
37 | *(.sbss) | ||
38 | *(.bss) | ||
39 | } | ||
40 | _end = . ; | ||
41 | |||
42 | /DISCARD/ : | ||
43 | { | ||
44 | *(.comment) | ||
45 | } | ||
46 | } | ||
47 | 1 | OUTPUT_ARCH(powerpc:common) |
arch/powerpc/boot/zImage.coff.lds.S
File was created | 1 | OUTPUT_ARCH(powerpc:common) | |
2 | ENTRY(_start) | ||
3 | SECTIONS | ||
4 | { | ||
5 | . = (5*1024*1024); | ||
6 | _start = .; | ||
7 | .text : | ||
8 | { | ||
9 | *(.text) | ||
10 | *(.fixup) | ||
11 | } | ||
12 | _etext = .; | ||
13 | . = ALIGN(4096); | ||
14 | .data : | ||
15 | { | ||
16 | *(.rodata*) | ||
17 | *(.data*) | ||
18 | *(.sdata*) | ||
19 | __got2_start = .; | ||
20 | *(.got2) | ||
21 | __got2_end = .; | ||
22 | |||
23 | _vmlinux_start = .; | ||
24 | *(.kernel:vmlinux.strip) | ||
25 | _vmlinux_end = .; | ||
26 | |||
27 | _initrd_start = .; | ||
28 | *(.kernel:initrd) | ||
29 | _initrd_end = .; | ||
30 | } | ||
31 | |||
32 | . = ALIGN(4096); | ||
33 | _edata = .; | ||
34 | __bss_start = .; | ||
35 | .bss : | ||
36 | { | ||
37 | *(.sbss) | ||
38 | *(.bss) | ||
39 | } | ||
40 | _end = . ; | ||
41 | |||
42 | /DISCARD/ : | ||
43 | { | ||
44 | *(.comment) | ||
45 | } | ||
46 | } | ||
47 |
arch/powerpc/boot/zImage.lds
1 | OUTPUT_ARCH(powerpc:common) | File was deleted | |
2 | ENTRY(_zimage_start) | ||
3 | SECTIONS | ||
4 | { | ||
5 | . = (4*1024*1024); | ||
6 | _start = .; | ||
7 | .text : | ||
8 | { | ||
9 | *(.text) | ||
10 | *(.fixup) | ||
11 | } | ||
12 | _etext = .; | ||
13 | . = ALIGN(4096); | ||
14 | .data : | ||
15 | { | ||
16 | *(.rodata*) | ||
17 | *(.data*) | ||
18 | *(.sdata*) | ||
19 | __got2_start = .; | ||
20 | *(.got2) | ||
21 | __got2_end = .; | ||
22 | } | ||
23 | |||
24 | . = ALIGN(4096); | ||
25 | _vmlinux_start = .; | ||
26 | .kernel:vmlinux.strip : { *(.kernel:vmlinux.strip) } | ||
27 | _vmlinux_end = .; | ||
28 | |||
29 | . = ALIGN(4096); | ||
30 | _initrd_start = .; | ||
31 | .kernel:initrd : { *(.kernel:initrd) } | ||
32 | _initrd_end = .; | ||
33 | |||
34 | . = ALIGN(4096); | ||
35 | _edata = .; | ||
36 | |||
37 | . = ALIGN(4096); | ||
38 | __bss_start = .; | ||
39 | .bss : | ||
40 | { | ||
41 | *(.sbss) | ||
42 | *(.bss) | ||
43 | } | ||
44 | . = ALIGN(4096); | ||
45 | _end = . ; | ||
46 | } | ||
47 | 1 | OUTPUT_ARCH(powerpc:common) |
arch/powerpc/boot/zImage.lds.S
File was created | 1 | OUTPUT_ARCH(powerpc:common) | |
2 | ENTRY(_zimage_start) | ||
3 | SECTIONS | ||
4 | { | ||
5 | . = (4*1024*1024); | ||
6 | _start = .; | ||
7 | .text : | ||
8 | { | ||
9 | *(.text) | ||
10 | *(.fixup) | ||
11 | } | ||
12 | _etext = .; | ||
13 | . = ALIGN(4096); | ||
14 | .data : | ||
15 | { | ||
16 | *(.rodata*) | ||
17 | *(.data*) | ||
18 | *(.sdata*) | ||
19 | __got2_start = .; | ||
20 | *(.got2) | ||
21 | __got2_end = .; | ||
22 | } | ||
23 | |||
24 | . = ALIGN(4096); | ||
25 | _vmlinux_start = .; | ||
26 | .kernel:vmlinux.strip : { *(.kernel:vmlinux.strip) } | ||
27 | _vmlinux_end = .; | ||
28 | |||
29 | . = ALIGN(4096); | ||
30 | _initrd_start = .; | ||
31 | .kernel:initrd : { *(.kernel:initrd) } | ||
32 | _initrd_end = .; | ||
33 | |||
34 | . = ALIGN(4096); | ||
35 | _edata = .; | ||
36 | |||
37 | . = ALIGN(4096); | ||
38 | __bss_start = .; | ||
39 | .bss : | ||
40 | { | ||
41 | *(.sbss) | ||
42 | *(.bss) | ||
43 | } | ||
44 | . = ALIGN(4096); | ||
45 | _end = . ; | ||
46 | } | ||
47 |