Skip to contentSkip to conversation

allow any PHONY in if_changed_dep

KBUILD In review Milton Miller 3 participants 10 messages Jul 1, 2006 – Jul 7, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

While all the if_changed family filter $(PHONY) from the list of newer files, if_changed_dep was only filtering FORCE from the list of all dependents. This resulted in forced recompile every time.

---

Sam,

I have been working on some cleanups in arch/powerpc/boot/Makefile, switching to if_changed and friends. There are rules to copy headers from the kernel environment to the boot environment, applying slight cleanups.

Currently a subset of the c files depend on the headers, and there is a manual dependency on the headers. I was trying to get if_changed_dep to depend only on the headers actually used, but copy all needed headers before compiling any C files in the zImage code.

Does the following patch look ok to you? It removes all PHONY targets
from the list of all dependents, not just FORCE. I'm thinking the clause is to catch files haven't been generated and therefore are not newer but are still required. If you want to build every time you can just call cmd.

milton

Two excerpts from the proposed makefile follow:

Review

Quoted 9 lines

-$(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader))

(quoted diff) +1 -1
-#$(addprefix $(obj)/,main.o): $(addprefix $(obj)/,zlib.h)
+linuxheader := zlib.h zconf.h zutil.h

[ $(obj-boot): %.o: %.c ]

+$(obj-boot): COPYHEADERS

(quoted diff) +2 -0
+COPYHEADERS:	$(addprefix $(obj)/,$(linuxheader) $(zlibheader))
+PHONY	+= COPYHEADERS
scripts/Kbuild.include +1 -1
Index: kernel/scripts/Kbuild.include
===================================================================
@@ -131,7 +131,7 @@ if_changed = $(if $(strip $(filter-out $
 # execute the command and also postprocess generated .d dependencies
 # file
 if_changed_dep = $(if $(strip $(filter-out $(PHONY),$?)  \
-		$(filter-out FORCE $(wildcard $^),$^)    \
+		$(filter-out $(PHONY) $(wildcard $^),$^)    \
 	$(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),     \
 	@set -e; \
 	$(echo-cmd) $(cmd_$(1)); \
#1 lore raw
Quoted 3 lines · Milton Miller

While all the if_changed family filter $(PHONY) from the list of newer files, if_changed_dep was only filtering FORCE from the list of all dependents. This resulted in forced recompile every time.

I see where you are heading with this. But on the principle of minimal suprise this is not good. Why does it not include file.o in the link when I mark it phony?

The root cause is buried in the powerpc/boot/Makefile restructuring. I do not see what is wrong with current approch if you do a simple s/cmd/if_changed/g and then assign targets += <relevant targets>

You need to post a full diff of the Makefile before I can give better feedback.

Sam

#2 lore raw
Quoted 8 lines · Sam Ravnborg
Quoted 3 lines · Milton Miller

While all the if_changed family filter $(PHONY) from the list of newer files, if_changed_dep was only filtering FORCE from the list of all dependents. This resulted in forced recompile every time.

I see where you are heading with this. But on the principle of minimal suprise this is not good. Why does it not include file.o in the link when I mark it phony?

This is your suprise argument, right? (Not my current problem).

Actually this is only changing weither file.o gets considered in causing the build command to be executed.

Quoted 4 lines

The root cause is buried in the powerpc/boot/Makefile restructuring. I do not see what is wrong with current approch if you do a simple s/cmd/if_changed/g and then assign targets += <relevant targets>

The issue is I need headers copied for some of the files. The current approach is any file that might need a copied header gets a dependency on all of the copied .h files. I was planning on coping some more headers used in different files. if_changed_dep

The issue is specifically COPYFILES. The .o can not be built until its dependencys are met, but it never exists itself. The actual .h files a given source will be detected by if_changed_dep and fixdep.

Quoted 3 lines

You need to post a full diff of the Makefile before I can give better feedback.

Sure. I'm reposting the series, I'll cc you and copy the makefile
patch to linux-kernel, its 3/5. That patch is independent of 1 and 2 while 4 and 5 require them. The full series is available on the linuxppc-dev mailing list.

milton

#3 lore raw

cover boot: create zImage.kexec #2

What follows is a series of 5 patches that take the existing zImge code from the arch/powerpc/boot directory and add an alternative image that will boot with a device tree struct but not with a prom interface callback.

It searches the flat device tree (read-only) to find the memory size, reserved ranges, and rtas. Messages are sent through rtas to eiher the new for cell put-term-char or display-character interfaces.

Status: I changed more of the makefile to if_changed_dep. I updated the rules to not do if_changed and cmd when changing the same file.

Patches 4 and 5 have been rediffed and __ENTRY__ and __BASE__ are now caps instead of lowercase in patch 5.

Unfornately I could not get my test and build machines talking due to network problems, and thereefore was unable to regression test the output. Therefore the state is still 'it worked before I moved code among the files' and 'display-character untested'.

Without [KBUILD] allow any PHONY in if_changed_dep it causes all the files in boot to be built each time, unless we do some alternative, either make COPYHEADERS a real dummy that we touch if it doesn't exist, or just say rebuild all sources when any .h in the kernel tree changes and collapse the dependency.

Its this fragment:

+$(obj-boot): COPYHEADERS
+COPYHEADERS: $(addprefix $(obj)/,$(linuxheader) $(zlibheader))
+PHONY += COPYHEADERS

[1/5][POWERPC] boot: prepare for zImage.kexec
I tried to keep the changes to main.c and prom.h minimal.

[2/5][POWERPC] boot: Add kexec callable zImage wrapper
The actual code and crt0 for this method.

[3/5][POWERPC] boot: use more Kbuild rules
I had a bit of trouble with rebuilds. This trys to get some rules more right.

It also renames zliblinuxheader to linuxheader as the next patch will add stringify.h to the list, and renames OBJCOPYFLAGS to allow usage of the $(objcopy) rule.

[4/5][POWERPC] boot: Makefile and linker scripts for zImage.kexec
Delta to above and inker scripts for the existing link. zImage.kexec is 32 bit, there is also altnernate link that pretends to be 64 bit which allows kexec-tools to load it without writing ompat code.

[5/5][POWERPC] boot: generate lds file from lds.S
An alterative file ploferations, generate the lds from .S using the Kbuild rule. If you like this patch then I can avoid creating two files that are immediately removed.
milton

#4 lore raw

PATCH 1/5 boot: prepare for zImage.kexec

This patch moves the initializations of prom variables to boot/prom.c
to allow it to be replaced for kexec. Kexec does not care about
the stdout handle, but will care about the location of the device tree and will search for RTAS.

It also checks if we stop trying to claim so that we print an error instead of storing to address -1.

arch/powerpc/boot/main.c +6 -12
Index: kernel/arch/powerpc/boot/main.c
===================================================================
@@ -17,14 +17,12 @@
 #include "prom.h"
 #include "zlib.h"
 
-extern void flush_cache(void *, unsigned long);
-
-
 /* Value picked to match that used by yaboot */
 #define PROG_START	0x01400000	/* only used on 64-bit systems */
-#define RAM_END		(512<<20)	/* Fixme: use OF */
 #define	ONE_MB		0x100000
 
+unsigned long ram_end;		/* end of usable memory, set by init_prom */
+
 extern char _start[];
 extern char __bss_start[];
 extern char _end[];
@@ -119,7 +117,7 @@ static unsigned long try_claim(unsigned 
 {
 	unsigned long addr = 0;
 
-	for(; claim_base < RAM_END; claim_base += ONE_MB) {
+	for(; claim_base < ram_end; claim_base += ONE_MB) {
 #ifdef DEBUG
 		printf("    trying: 0x%08lx\n\r", claim_base);
 #endif
@@ -127,7 +125,7 @@ static unsigned long try_claim(unsigned 
 		if ((void *)addr != (void *)-1)
 			break;
 	}
-	if (addr == 0)
+	if ((addr == 0) || (void *)addr == (void *)-1)
 		return 0;
 	claim_base = PAGE_ALIGN(claim_base + size);
 	return addr;
@@ -211,12 +209,7 @@ void start(unsigned long a1, unsigned lo
 
 	memset(__bss_start, 0, _end - __bss_start);
 
-	prom = (int (*)(void *)) promptr;
-	chosen_handle = finddevice("/chosen");
-	if (chosen_handle == (void *) -1)
-		exit();
-	if (getprop(chosen_handle, "stdout", &stdout, sizeof(stdout)) != 4)
-		exit();
+	init_prom(a1, a2, promptr);
 
 	printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r", _start, sp);
 
@@ -297,6 +290,7 @@ void start(unsigned long a1, unsigned lo
 	vmlinux.addr += elfoffset;
 
 	flush_cache((void *)vmlinux.addr, vmlinux.size);
+	prom_smp_hook(vmlinux.addr);
 
 	kernel_entry = (kernel_entry_t)vmlinux.addr;
 #ifdef DEBUG
arch/powerpc/boot/prom.c +16 -0
Index: kernel/arch/powerpc/boot/prom.c
===================================================================
@@ -16,6 +16,22 @@ int (*prom)(void *);
 phandle chosen_handle;
 ihandle stdout;
 
+void init_prom(unsigned long a1, unsigned long a2, void *p)
+{
+	prom = (int (*)(void *)) p;
+	chosen_handle = finddevice("/chosen");
+	if (chosen_handle == (void *) -1)
+		exit();
+	if (getprop(chosen_handle, "stdout", &stdout, sizeof(stdout)) != 4)
+		exit();
+	ram_end = (512<<20);	/* Fixme: use OF */
+}
+
+void prom_smp_hook(unsigned long kernel_start)
+{
+	return;
+}
+
 int call_prom(const char *service, int nargs, int nret, ...)
 {
 	int i;
arch/powerpc/boot/prom.h +9 -2
Index: kernel/arch/powerpc/boot/prom.h
===================================================================
@@ -12,8 +12,10 @@ int	call_prom(const char *service, int n
 int	call_prom_ret(const char *service, int nargs, int nret,
 		      unsigned int *rets, ...);
 
-extern int write(void *handle, void *ptr, int nb);
-extern void *claim(unsigned long virt, unsigned long size, unsigned long aln);
+void init_prom(unsigned long a1, unsigned long a2, void *p);
+void prom_smp_hook(unsigned long kernel_start);
+int write(void *handle, void *ptr, int nb);
+void *claim(unsigned long virt, unsigned long size, unsigned long aln);
 
 static inline void exit(void)
 {
@@ -31,4 +33,9 @@ static inline int getprop(void *phandle,
 	return call_prom("getprop", 4, 1, phandle, name, buf, buflen);
 }
 
+
+extern unsigned long ram_end;		/* end of usable memory */
+
+extern void flush_cache(void *, unsigned long);
+
 #endif				/* _PPC_BOOT_PROM_H_ */
#5 lore raw

Re: [1/5][POWERPC] boot: prepare for zImage.kexec

Quoted 4 lines · Milton Miller

This patch moves the initializations of prom variables to boot/prom.c
to allow it to be replaced for kexec. Kexec does not care about
the stdout handle, but will care about the location of the device tree and will search for RTAS.

Unfortunately it doesn't apply now because of other changes to boot.h. Please respin the series against the powerpc.git tree.

Thanks,
Paul.

#6 lore raw

PATCH 2/5 boot: Add kexec callable zImage wrapper

In reply to Milton Miller

This code creates a 32 bit zImage wrapper for a 32 or 64 bit PowerPC
Linux kernel. It does not support initrd at present. What it does
give you is a compressed kernel image that is expanded when used.

Limitations:

The memory node off the root with a name starting with "memory" must contain enough free memory (not in the reserved ranges) in the first reg range to uncompress the the kenrel with padding.

The claim allocator does not record its handouts.

arch/powerpc/boot/kexec.c new file +476 -0
Index: kernel/arch/powerpc/boot/kexec.c
===================================================================
@@ -0,0 +1,476 @@
+/*
+ * Copyright (C) 1997 Paul Mackerras 1997.
+ * Copyright (C) 2006 Milton Miller, IBM Corportation.
+ * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corportation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#include <stdarg.h>
+#include <stddef.h>
+#include "string.h"
+#include "stdio.h"
+#include "prom.h"
+#include "page.h"
+#include "dt.h"
+#include "stringify.h"
+
+#define BUG_ON(x) if (x) { printf("zImage BUG %s\n\r", __stringify(x)); exit();}
+
+extern unsigned int gohere;	/* slaves poll and branch when told */
+
+int (*prom)(void *);
+phandle chosen_handle;
+ihandle stdout;
+
+#define MAX_MEM 0x80000000
+static unsigned int memsize;
+static unsigned int na=2, ns=1;
+
+
+static struct boot_param_header *initial_boot_params;
+
+static int (*rtas)(void *, void *);
+static void *rtas_data;
+static int rtas_put_term_char;
+static int rtas_display_char;
+
+int call_rtas(int token, int nargs, int nret, ...)
+{
+	int i;
+	struct rtas_args {
+		int token;
+		int nargs;
+		int nret;
+		unsigned int args[12];
+	} args;
+	va_list list;
+
+	if (!rtas || !token)
+		return -1;	/* Hardware error */
+	if (nargs + nret > 12)
+		return -1;	/* Hardware error */
+
+	args.token = token;
+	args.nargs = nargs;
+	args.nret = nret;
+
+	va_start(list, nret);
+	for (i = 0; i < nargs; i++)
+		args.args[i] = va_arg(list, unsigned int);
+	va_end(list);
+
+	for (i = 0; i < nret; i++)
+		args.args[nargs+i] = 0;
+
+	rtas(&args, rtas_data);
+
+	return args.args[nargs];
+}
+
+
+int write(void *handle, void *ptr, int nb)
+{
+	int i=0;
+	int err;
+	char *p;
+
+	p = ptr;
+	err = 0;
+
+	if (rtas_put_term_char)
+		for (; i < nb && !err; i++)
+			err = call_rtas(rtas_put_term_char, 1, 1, p[i]);
+#if 0
+	/* not tested, doesn't check line limits, do we care? */
+	else if (rtas_display_char)
+		for (; i < nb && !err; i++)
+			err = call_rtas(rtas_put_term_char, 1, 1, p[i]);
+#endif
+
+	return i-1;
+}
+
+
+/* returns true if s2 is a prefix of s1 */
+static int string_match(const char *s1, const char *s2)
+{
+	for (; *s2; ++s2)
+		if (*s1++ != *s2)
+			return 0;
+	return 1;
+}
+
+
+/* return -1 on fail, address on success */
+void *claim(unsigned long virt, unsigned long size, unsigned long align)
+{
+
+	unsigned long al = align ? align : 1;
+	unsigned long try = _ALIGN_UP(virt, al);
+	unsigned int *r;
+
+#if 0 /* Debug */
+
+	printf("claim: request %lx size %lx align %lx, aligned %p ",
+			virt, size, align,  (void *)try);
+
+
+#define BUSY(s) printf("%s\n\r", s), ((void *)(-1))
+#define RANGE_PRINT printf("range %08x %08x ",r[1], r[3]);
+#define RANGE_CLEAR printf("is clear\n\r");
+#else
+#define BUSY(s) ((void *)(-1))
+#define RANGE_PRINT do {} while(0)
+#define RANGE_CLEAR do {} while(0)
+#endif
+
+
+	if (try + size < try)
+		return BUSY("wraps");
+
+	if (memsize && try + size > memsize)
+		return BUSY("overflows");
+
+	for (r = (unsigned int *)(((unsigned long)initial_boot_params)
+				+ initial_boot_params->off_mem_rsvmap);
+				r[2] || r[3]; r += 4) {
+
+		if (r[0] || r[1] > try + size)
+			continue;		/* starts after */
+		if (r[2] || r[1]+r[3] < r[1])
+			return BUSY("BEYOND");	/* extends beyond */
+		if (r[1] + r[3] < try)
+			continue;		/* contained before */
+
+		RANGE_PRINT;
+		return BUSY("overlaps");		/* overlaps */
+	}
+
+	/*
+	 * XXX: Fixme: we should keep track here and not hand out the
+	 * same address again.
+	 */
+
+	RANGE_CLEAR;
+	return (void *)(try);
+}
+
+
+
+/* code lifted from arch/powerpc/kernel/prom.c */
+
+static inline char *find_flat_dt_string(u32 offset)
+{
+	return ((char *)initial_boot_params) +
+		initial_boot_params->off_dt_strings + offset;
+}
+
+/**
+ * This function is used to scan the flattened device-tree, it is
+ * used to extract the memory informations at boot before we can
+ * unflatten the tree
+ */
+int of_scan_flat_dt(int (*it)(unsigned long node,
+				     const char *uname, int depth,
+				     void *data),
+			   void *data)
+{
+	unsigned long p = ((unsigned long)initial_boot_params) +
+		initial_boot_params->off_dt_struct;
+	int rc = 0;
+	int depth = -1;
+
+	do {
+		u32 tag = *((u32 *)p);
+		char *pathp;
+
+		p += 4;
+		if (tag == OF_DT_END_NODE) {
+			depth --;
+			continue;
+		}
+		if (tag == OF_DT_NOP)
+			continue;
+		if (tag == OF_DT_END)
+			break;
+		if (tag == OF_DT_PROP) {
+			u32 sz = *((u32 *)p);
+			p += 8;
+			if (initial_boot_params->version < 0x10)
+				p = _ALIGN(p, sz >= 8 ? 8 : 4);
+			p += sz;
+			p = _ALIGN(p, 4);
+			continue;
+		}
+		if (tag != OF_DT_BEGIN_NODE) {
+			printf("Invalid tag %x scanning flattened"
+			       " device tree !\n\r", tag);
+			return -1;
+		}
+		depth++;
+		pathp = (char *)p;
+		p = _ALIGN(p + strlen(pathp) + 1, 4);
+		if ((*pathp) == '/') {
+			char *lp, *np;
+			for (lp = NULL, np = pathp; *np; np++)
+				if ((*np) == '/')
+					lp = np+1;
+			if (lp != NULL)
+				pathp = lp;
+		}
+		rc = it(p, pathp, depth, data);
+		if (rc != 0)
+			break;
+	} while(1);
+
+	return rc;
+}
+
+unsigned long of_get_flat_dt_root(void)
+{
+	unsigned long p = ((unsigned long)initial_boot_params) +
+		initial_boot_params->off_dt_struct;
+
+	while(*((u32 *)p) == OF_DT_NOP)
+		p += 4;
+	BUG_ON (*((u32 *)p) != OF_DT_BEGIN_NODE);
+	p += 4;
+	return _ALIGN(p + strlen((char *)p) + 1, 4);
+}
+
+/**
+ * This  function can be used within scan_flattened_dt callback to get
+ * access to properties
+ */
+void* of_get_flat_dt_prop(unsigned long node, const char *name,
+				 unsigned long *size)
+{
+	unsigned long p = node;
+
+	do {
+		u32 tag = *((u32 *)p);
+		u32 sz, noff;
+		const char *nstr;
+
+		p += 4;
+		if (tag == OF_DT_NOP)
+			continue;
+		if (tag != OF_DT_PROP)
+			return NULL;
+
+		sz = *((u32 *)p);
+		noff = *((u32 *)(p + 4));
+		p += 8;
+		if (initial_boot_params->version < 0x10)
+			p = _ALIGN(p, sz >= 8 ? 8 : 4);
+
+		nstr = find_flat_dt_string(noff);
+		if (nstr == NULL) {
+			printf("Can't find property index"
+			       " name !\n\r");
+			return NULL;
+		}
+		if (strcmp(name, nstr) == 0) {
+			if (size)
+				*size = sz;
+			return (void *)p;
+		}
+		p += sz;
+		p = _ALIGN(p, 4);
+	} while(1);
+}
+
+/* end code lifted from arch/powerpc/kernel/prom.c */
+
+
+/* This only handles device nodes directly off of the root node
+ * and will return on any partial name match
+ */
+static int match_device_node(unsigned long node, const char *uname,
+				int depth, void *data)
+{
+	if (depth == 1 && string_match(uname, data))
+		return node;
+	return 0;
+}
+
+/* Find Real Memory (offset) region.   The first reg, size pair of the
+ * memory node defines the memory that is accessable in real mode on
+ * PPC64 LPAR systems.  Assume that will be enough everywhere.
+ */
+static int find_rmo(unsigned long node, const char *uname, int depth,
+		     void *data)
+{
+	if (match_device_node(node, uname, depth, data)) {
+		unsigned long size;
+		unsigned int *reg;
+		int i;
+
+		reg = of_get_flat_dt_prop(node, "reg", &size);
+		if (!reg || (size < (na + ns)*4)) {
+			printf("Warning: Can't parse reg property on %s\n\r",
+					uname);
+			return 0;
+		}
+
+		/* ignore if not address 0 */
+		for (i=0; i < na; i++)
+			if (reg[i])
+				return 0;
+
+		/* if more than 1 cell then MAX_MEM */
+		for (i=0; i < ns-1; i++)
+			if (reg[na+i])
+				return MAX_MEM;
+
+		/* else return size of first reg */
+		return reg[na+i];
+	}
+
+	return 0;
+}
+
+/* dummy prom that recognises the services used by elsewhere */
+int call_prom(const char *service, int nargs, int nret, ...)
+{
+	va_list list;
+
+	if (string_match(service, "finddevice")) {
+		char *path;
+
+		if ((nargs != 1) || (nret != 1)) {
+			printf("finddevice: unexpected arg counts %d %d\n\r",
+					nargs, nret);
+			return -1;
+		}
+		va_start(list, nret);
+		path = (void *)va_arg(list, unsigned int);
+		va_end(list);
+
+		if (path[0] == '/')
+			path++;
+
+		return (int) of_scan_flat_dt(match_device_node, path);
+
+	} else if (string_match(service, "getprop")) {
+		unsigned long node;
+		char *prop;
+		char *buf;
+		unsigned int len;
+		va_list list;
+		char *ret;
+		unsigned long size;
+
+		if ((nargs != 4) || (nret != 1)) {
+			printf("getprop: unexpected arg counts %d %d\n\r",
+					nargs, nret);
+			return -1;
+		}
+
+		va_start(list, nret);
+		node = va_arg(list, unsigned int);
+		prop = (void *)va_arg(list, unsigned int);
+		buf = (void *)va_arg(list, unsigned int);
+		len = va_arg(list, unsigned int);
+		va_end(list);
+
+		ret = of_get_flat_dt_prop(node, prop, &size);
+		if  (ret) {
+			memcpy(buf, ret, len < size ? len : size);
+		}
+		return size;
+	} else if (!string_match(service, "exit")) {
+		printf("Unimplemented prom service %s(%d, %d) called\n\r",
+			service, nargs, nret);
+		/* fall through */
+	}
+	for(;;)
+		;	/* Forever */
+}
+
+void init_prom(unsigned long a1, unsigned long a2, void *p)
+{
+	unsigned long node;
+
+	if (p)		/* this version doesn't support a prom interface */
+		exit();
+
+	initial_boot_params = (void *) a1;
+
+	BUG_ON(initial_boot_params->magic != OF_DT_HEADER);
+	BUG_ON(initial_boot_params->last_comp_version > 0x10);
+
+	chosen_handle = finddevice("/chosen");
+	if (chosen_handle == (void *) -1)
+		exit();
+
+	node = of_scan_flat_dt(match_device_node, "rtas");
+
+	if (node) {
+		unsigned int *p;
+		p = of_get_flat_dt_prop(node,
+				"linux,rtas-base", NULL);
+		if (p)
+			rtas_data = (void *)*p;
+		p = of_get_flat_dt_prop(node,
+				"linux,rtas-entry", NULL);
+		if (p)
+			rtas = (void *)*p;
+		p = of_get_flat_dt_prop(node,
+				"put-term-char", NULL);
+		if (p)
+			rtas_put_term_char = *p;
+		p = of_get_flat_dt_prop(node,
+				"display-character", NULL);
+		if (p)
+			rtas_display_char = *p;
+	}
+
+	node = of_get_flat_dt_root();
+	if (node) {
+		unsigned long tmp;
+		void *p;
+
+		p = of_get_flat_dt_prop(node, "#addr-cells", &tmp);
+		if (tmp == 4)
+			na = *(int *)p;
+		else
+			printf("Warning, could't find or parse #addr-cells\n\r");
+		p = of_get_flat_dt_prop(node, "#size-cells", &tmp);
+		if (tmp == 4)
+			ns = *(int *)p;
+		else
+			printf("Warning, could't find or parse #size-cells\n\r");
+	}
+
+	memsize = of_scan_flat_dt(find_rmo, "memory");
+
+	if (!memsize)
+		BUG_ON("Couldn't find RMO memory size\n\r");
+
+	if (memsize > MAX_MEM)
+		memsize = MAX_MEM;
+
+	printf("Can use %x bytes of memory in RMO\n\r", memsize);
+
+	ram_end = memsize;
+}
+
+/*
+ * Kexec smp hook:
+ * copy 0x100 bytes from the kernel entry point down to address zero,
+ * flush, then tell any slaves to branch down to address 0x60.
+ */
+void prom_smp_hook(unsigned long kernel_start)
+{
+	char *kern = (char *)kernel_start;
+	char *zero = (char *)0;
+
+	memcpy(zero, kern, 0x100);
+	flush_cache(zero, 0x100);
+
+	gohere = 0x60;
+}
arch/powerpc/boot/crt0_kexec.S new file +156 -0

156 lines not on this page · raw message

arch/powerpc/boot/dt.h new file +46 -0

46 lines not on this page · raw message

#7 lore raw

PATCH 3/5 boot: use more Kbuild rules

In reply to Milton Miller

Switch to if_changed_dep for bootcc, cmd for known rebuilds without deps, and if_changed for other commands. Add FORCE for all if_changed rule uses. Make sure targets includes all generated files.

Move clean-files to targets for if_changed files.

Rename OBJCOPYFLAGS to OBJCOPY_SEC_FLAGS so we can use $(objcopy) rule.

Rename zliblinuxheader to linuxheader

Change from explicit dependency of main and zlib files and zlib headers to generate all headers before compiling the source. fixdep will give us the exact headers, but not on a clean compile.

Note: the obj-sec .c files are created/touched when the content file changes.

arch/powerpc/boot/Makefile +59 -40
Index: kernel/arch/powerpc/boot/Makefile
===================================================================
@@ -25,16 +25,13 @@ HOSTCC		:= gcc
 BOOTCFLAGS	:= $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \
 		   $(shell $(CROSS32CC) -print-file-name=include) -fPIC
 BOOTAFLAGS	:= -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
-OBJCOPYFLAGS    := contents,alloc,load,readonly,data
+OBJCOPY_SEC_FLAGS := contents,alloc,load,readonly,data
 OBJCOPY_COFF_ARGS := -O aixcoff-rs6000 --set-start 0x500000
 OBJCOPY_MIB_ARGS  := -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
 
 zlib       := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c
 zlibheader := infblock.h infcodes.h inffast.h inftrees.h infutil.h
-zliblinuxheader := zlib.h zconf.h zutil.h
-
-$(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader))
-#$(addprefix $(obj)/,main.o): $(addprefix $(obj)/,zlib.h)
+linuxheader := zlib.h zconf.h zutil.h
 
 src-boot := crt0.S string.S prom.c stdio.c main.c div64.S
 src-boot += $(zlib)
@@ -48,20 +45,23 @@ quiet_cmd_copy_zlib = COPY    $@
 
 quiet_cmd_copy_zlibheader = COPY    $@
       cmd_copy_zlibheader = sed "s@<linux/\([^>]\+\).*@\"\1\"@" $< > $@
+
 # stddef.h for NULL
-quiet_cmd_copy_zliblinuxheader = COPY    $@
-      cmd_copy_zliblinuxheader = sed "s@<linux/string.h>@\"string.h\"@;s@<linux/kernel.h>@<stddef.h>@;s@<linux/\([^>]\+\).*@\"\1\"@" $< > $@
+quiet_cmd_copy_linuxheader = COPY    $@
+      cmd_copy_linuxheader = sed "s@<linux/string.h>@\"string.h\"@;s@<linux/kernel.h>@<stddef.h>@;s@<linux/\([^>]\+\).*@\"\1\"@" $< > $@
 
-$(addprefix $(obj)/,$(zlib)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
-	$(call cmd,copy_zlib)
+$(addprefix $(obj)/,$(zlib)): $(obj)/%: $(srctree)/lib/zlib_inflate/% FORCE
+	$(call if_changed,copy_zlib)
 
-$(addprefix $(obj)/,$(zlibheader)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
-	$(call cmd,copy_zlibheader)
+$(addprefix $(obj)/,$(zlibheader)): $(obj)/%: $(srctree)/lib/zlib_inflate/% \
+		FORCE
+	$(call if_changed,copy_zlibheader)
 
-$(addprefix $(obj)/,$(zliblinuxheader)): $(obj)/%: $(srctree)/include/linux/%
-	$(call cmd,copy_zliblinuxheader)
+$(addprefix $(obj)/,$(linuxheader)): $(obj)/%: $(srctree)/include/linux/% FORCE
+	$(call if_changed,copy_linuxheader)
 
-clean-files := $(zlib) $(zlibheader) $(zliblinuxheader)
+targets += $(zlib) $(zlibheader) $(linuxheader)
+targets += $(patsubst $(obj)/%,%, $(obj-boot))
 
 
 quiet_cmd_bootcc = BOOTCC  $@
@@ -73,11 +73,16 @@ quiet_cmd_bootas = BOOTAS  $@
 quiet_cmd_bootld = BOOTLD  $@
       cmd_bootld = $(CROSS32LD) -T $(srctree)/$(src)/$(3) -o $@ $(2)
 
-$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c
+$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE
 	$(call if_changed_dep,bootcc)
-$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S
+
+$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE
 	$(call if_changed_dep,bootas)
 
+$(obj-boot):  COPYHEADERS
+COPYHEADERS:	$(addprefix $(obj)/,$(linuxheader) $(zlibheader))
+PHONY	+= COPYHEADERS
+
 #-----------------------------------------------------------
 # ELF sections within the zImage bootloader/wrapper
 #-----------------------------------------------------------
@@ -104,18 +109,20 @@ quiet_cmd_ramdisk = RAMDISK $@
 quiet_cmd_stripvm = STRIP   $@
       cmd_stripvm = $(STRIP) -s -R .comment $< -o $@
 
-vmlinux.strip: vmlinux
+vmlinux.strip: vmlinux FORCE
 	$(call if_changed,stripvm)
-$(obj)/vmlinux.initrd: vmlinux.strip $(obj)/addRamDisk $(obj)/ramdisk.image.gz
+$(obj)/vmlinux.initrd: vmlinux.strip $(obj)/addRamDisk \
+		$(obj)/ramdisk.image.gz FORCE
 	$(call if_changed,ramdisk)
 
 quiet_cmd_addsection = ADDSEC  $@
       cmd_addsection = $(CROSS32OBJCOPY) $@ \
 		--add-section=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $@))=$(patsubst %.o,%.gz, $@) \
-		--set-section-flags=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $@))=$(OBJCOPYFLAGS)
+		--set-section-flags=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $@))=$(OBJCOPY_SEC_FLAGS)
 
 quiet_cmd_addnote = ADDNOTE $@
-      cmd_addnote = $(obj)/addnote $@
+      cmd_addnote = @cp -f $< $@ && \
+		    $(obj)/addnote $@
 
 quiet_cmd_gen-miboot = GEN     $@
       cmd_gen-miboot = $(OBJCOPY) $(OBJCOPY_MIB_ARGS) \
@@ -125,7 +132,19 @@ quiet_cmd_gencoff = COFF    $@
       cmd_gencoff = $(OBJCOPY) $(OBJCOPY_COFF_ARGS) $@ && \
 		    $(obj)/hack-coff $@
 
-$(call gz-sec, $(required)): $(obj)/kernel-%.gz: %
+# a single rule so that we can do if_changed correctly
+define rule_ldcoff
+	$(call echo-cmd,bootld) $(cmd_bootld);			  \
+	$(call echo-cmd,gencoff) $(cmd_gencoff)
+endef
+
+# $(required) is built in $(objtree) not $(obj) so read cmd files manually
+cmd_files := $(wildcard $(foreach f,$(required),$(dir $(f)).$(notdir $(f)).cmd))
+ifneq ($(cmd_files),)
+  include $(cmd_files)
+endif
+
+$(call gz-sec, $(required)): $(obj)/kernel-%.gz: % FORCE
 	$(call if_changed,gzip)
 
 $(obj)/kernel-initrd.gz: $(obj)/ramdisk.image.gz
@@ -135,16 +154,16 @@ $(call src-sec, $(required) $(initrd)): 
 	@touch $@
 
 $(call obj-sec, $(required) $(initrd)): $(obj)/kernel-%.o: $(obj)/kernel-%.c
-	$(call if_changed_dep,bootcc)
+	$(call cmd,bootcc)
 	$(call cmd,addsection)
 
 $(obj)/zImage.vmode $(obj)/zImage.coff: obj-boot += $(call obj-sec, $(required))
-$(obj)/zImage.vmode: $(call obj-sec, $(required)) $(obj-boot) $(srctree)/$(src)/zImage.lds
-	$(call cmd,bootld,$(obj-boot),zImage.lds)
+$(obj)/zImage.vmode: $(call obj-sec, $(required)) $(obj-boot) $(srctree)/$(src)/zImage.lds FORCE
+	$(call if_changed,bootld,$(obj-boot),zImage.lds)
 
 $(obj)/zImage.initrd.vmode $(obj)/zImage.initrd.coff: obj-boot += $(call obj-sec, $(required) $(initrd))
-$(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(srctree)/$(src)/zImage.lds
-	$(call cmd,bootld,$(obj-boot),zImage.lds)
+$(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(srctree)/$(src)/zImage.lds FORCE
+	$(call if_changed,bootld,$(obj-boot),zImage.lds)
 
 # For 32-bit powermacs, build the COFF and miboot images
 # as well as the ELF images.
@@ -154,30 +173,29 @@ mibootimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PP
 mibrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32)  := $(obj)/miboot.initrd.image
 
 $(obj)/zImage: $(obj)/zImage.vmode $(obj)/addnote $(coffimage-y-y) \
-			$(mibootimg-y-y)
-	@cp -f $< $@
+			$(mibootimg-y-y) FORCE
 	$(call if_changed,addnote)
+	@true
 
 $(obj)/zImage.initrd: $(obj)/zImage.initrd.vmode $(obj)/addnote \
-			$(coffrdimg-y-y) $(mibrdimg-y-y)
-	@cp -f $< $@
+			$(coffrdimg-y-y) $(mibrdimg-y-y) FORCE
 	$(call if_changed,addnote)
+	@true
 
 $(obj)/zImage.coff: $(call obj-sec, $(required)) $(obj-boot) \
-			$(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff
-	$(call cmd,bootld,$(obj-boot),zImage.coff.lds)
-	$(call cmd,gencoff)
+			$(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff FORCE
+	$(call if_changed_rule,ldcoff,$(obj-boot),zImage.coff.lds)
 
 $(obj)/zImage.initrd.coff: $(call obj-sec, $(required) $(initrd)) $(obj-boot) \
-			   $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff
-	$(call cmd,bootld,$(obj-boot),zImage.coff.lds)
-	$(call cmd,gencoff)
+			   $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff \
+			   FORCE
+	$(call if_changed_rule,ldcoff,$(obj-boot),zImage.coff.lds)
 
-$(obj)/miboot.image: $(obj)/dummy.o $(obj)/vmlinux.gz
-	$(call cmd,gen-miboot,image)
+$(obj)/miboot.image: $(obj)/dummy.o $(obj)/vmlinux.gz FORCE
+	$(call if_changed,gen-miboot,image)
 
-$(obj)/miboot.initrd.image: $(obj)/miboot.image $(images)/ramdisk.image.gz
-	$(call cmd,gen-miboot,initrd)
+$(obj)/miboot.initrd.image: $(obj)/miboot.image $(images)/ramdisk.image.gz FORCE
+	$(call if_changed,gen-miboot,initrd)
 
 #-----------------------------------------------------------
 # build u-boot images
@@ -199,6 +217,7 @@ extra-y		+= vmlinux.bin vmlinux.gz
 
 $(obj)/vmlinux.bin: vmlinux FORCE
 	$(call if_changed,objbin)
+	@true
 
 $(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
 	$(call if_changed,mygzip)
#8 lore raw

PATCH 4/5 boot: Makefile and linker scripts for zImage.kexec

In reply to Milton Miller

The Makefile and linker script changes to build zImage.kexec

This patch is based after the if_changed_dep patch.

arch/powerpc/boot/Makefile +46 -8
Index: kernel/arch/powerpc/boot/Makefile
===================================================================
@@ -32,12 +32,22 @@ OBJCOPY_MIB_ARGS  := -O aixcoff-rs6000 -
 zlib       := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c
 zlibheader := infblock.h infcodes.h inffast.h inftrees.h infutil.h
 linuxheader := zlib.h zconf.h zutil.h
+linuxheader += stringify.h
 
-src-boot := crt0.S string.S prom.c stdio.c main.c div64.S
-src-boot += $(zlib)
+src-common := string.S stdio.c main.c div64.S
+src-common += $(zlib)
+
+src-boot := crt0.S prom.c  $(src-common)
 src-boot := $(addprefix $(obj)/, $(src-boot))
 obj-boot := $(addsuffix .o, $(basename $(src-boot)))
 
+src-kexec := crt0_kexec.S kexec.c $(src-common)
+src-kexec := $(addprefix $(obj)/, $(src-kexec))
+obj-kexec := $(addsuffix .o, $(basename $(src-kexec)))
+
+src-mult := $(sort $(src-boot) $(src-kexec))
+obj-mult := $(sort $(obj-boot) $(obj-kexec))
+
 BOOTCFLAGS	+= -I$(obj) -I$(srctree)/$(obj)
 
 quiet_cmd_copy_zlib = COPY    $@
@@ -61,7 +71,7 @@ $(addprefix $(obj)/,$(linuxheader)): $(o
 	$(call if_changed,copy_linuxheader)
 
 targets += $(zlib) $(zlibheader) $(linuxheader)
-targets += $(patsubst $(obj)/%,%, $(obj-boot))
+targets += $(patsubst $(obj)/%,%, $(obj-mult))
 
 
 quiet_cmd_bootcc = BOOTCC  $@
@@ -73,10 +83,10 @@ quiet_cmd_bootas = BOOTAS  $@
 quiet_cmd_bootld = BOOTLD  $@
       cmd_bootld = $(CROSS32LD) -T $(srctree)/$(src)/$(3) -o $@ $(2)
 
-$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE
+$(patsubst %.c,%.o, $(filter %.c, $(src-mult))): %.o: %.c FORCE
 	$(call if_changed_dep,bootcc)
 
-$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE
+$(patsubst %.S,%.o, $(filter %.S, $(src-mult))): %.o: %.S FORCE
 	$(call if_changed_dep,bootas)
 
 $(obj-boot):  COPYHEADERS
@@ -97,6 +107,7 @@ hostprogs-y		:= addnote addRamDisk hack-
 
 targets += zImage.vmode zImage.initrd.vmode zImage zImage.initrd \
 	   zImage.coff zImage.initrd.coff miboot.image miboot.initrd.image \
+	   zImage.kexec zImage.kexec.3264 zImage.kexec64 \
 	   $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \
 	   $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \
 	   $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \
@@ -121,7 +132,7 @@ quiet_cmd_addsection = ADDSEC  $@
 		--set-section-flags=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $@))=$(OBJCOPY_SEC_FLAGS)
 
 quiet_cmd_addnote = ADDNOTE $@
-      cmd_addnote = @cp -f $< $@ && \
+      cmd_addnote = cp -f $< $@ && \
 		    $(obj)/addnote $@
 
 quiet_cmd_gen-miboot = GEN     $@
@@ -172,8 +183,35 @@ coffrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PP
 mibootimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/miboot.image
 mibrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32)  := $(obj)/miboot.initrd.image
 
+# The kexec entry point is valid for all kernels.  This zImage should work
+# on all loaders (kexec or firmware) that do not use an openfirmware prom
+# callback, assuming the memory node constraints are met.
+#
+# Build if CONFIG_KEXEC=y or on master make zImage.kexec.
+#
+kexecimg-$(CONFIG_KEXEC)-$(CONFIG_PPC64) += $(obj)/zImage.kexec64
+kexecimg-$(CONFIG_KEXEC)-y               += $(obj)/zImage.kexec
+
+# Build 64 bit and 32 bit package when 64 bit kernel is being built
+$(obj)/zImage.kexec: $(filter-out $(obj)/zImage.kexec, $(kexecimg-y-y))
+
+$(obj)/zImage.kexec: obj-kexec += $(call obj-sec, $(required))
+$(obj)/zImage.kexec: $(obj-kexec) $(srctree)/$(src)/zImage.kexec.lds \
+		$(call obj-sec, $(required)) FORCE
+	$(call if_changed,bootld,$(obj-kexec),zImage.kexec.lds)
+	@true
+
+$(obj)/zImage.kexec.3264: obj-kexec += $(call obj-sec, $(required))
+$(obj)/zImage.kexec.3264: $(obj-kexec) $(srctree)/$(src)/zImage.kexec64.lds \
+		$(call obj-sec, $(required)) FORCE
+	$(call if_changed,bootld,$(obj-kexec),zImage.kexec64.lds)
+
+OBJCOPYFLAGS_zImage.kexec64 := -I elf32-powerpc -O elf64-powerpc
+$(obj)/zImage.kexec64: $(obj)/zImage.kexec.3264 FORCE
+	$(call if_changed,objcopy,$< $@)
+
 $(obj)/zImage: $(obj)/zImage.vmode $(obj)/addnote $(coffimage-y-y) \
-			$(mibootimg-y-y) FORCE
+			$(mibootimg-y-y) $(kexecimg-y-y) FORCE
 	$(call if_changed,addnote)
 	@true
 
@@ -231,4 +269,4 @@ $(obj)/uImage: $(obj)/vmlinux.gz
 install: $(CONFIGURE) $(BOOTIMAGE)
 	sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" "$(BOOTIMAGE)"
 
-clean-files += $(addprefix $(objtree)/, $(obj-boot) vmlinux.strip)
+clean-files += $(addprefix $(objtree)/, $(obj-mult) vmlinux.strip)
arch/powerpc/Makefile +1 -1
Index: kernel/arch/powerpc/Makefile
===================================================================
@@ -147,7 +147,7 @@ all: $(KBUILD_IMAGE)
 
 CPPFLAGS_vmlinux.lds	:= -Upowerpc
 
-BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm uImage vmlinux.bin
+BOOT_TARGETS = zImage zImage.initrd zImage.kexec znetboot znetboot.initrd vmlinux.sm uImage vmlinux.bin
 
 PHONY += $(BOOT_TARGETS)
 
arch/powerpc/boot/zImage.kexec.lds new file +51 -0

51 lines not on this page · raw message

arch/powerpc/boot/zImage.kexec64.lds new file +52 -0

52 lines not on this page · raw message

#9 lore raw

PATCH 5/5 boot: generate lds file from lds.S

In reply to Milton Miller

The zImage.kexec and zImage.kexec64 linker files are almost identical to
the base elf file. Use the lds.S -> ld rule to share the source.

Tell the linker the fils is in $(obj) not $(srctree)/$(src) zImage.coff.lds is different, it links the initrd and kernel in .data rather than as a seperate section and without alignment, keep it seperate for now.

arch/powerpc/boot/Makefile +22 -8
Index: kernel/arch/powerpc/boot/Makefile
===================================================================
@@ -81,7 +81,7 @@ quiet_cmd_bootas = BOOTAS  $@
       cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
 
 quiet_cmd_bootld = BOOTLD  $@
-      cmd_bootld = $(CROSS32LD) -T $(srctree)/$(src)/$(3) -o $@ $(2)
+      cmd_bootld = $(CROSS32LD) -T $(obj)/$(3) -o $@ $(2)
 
 $(patsubst %.c,%.o, $(filter %.c, $(src-mult))): %.o: %.c FORCE
 	$(call if_changed_dep,bootcc)
@@ -108,6 +108,7 @@ hostprogs-y		:= addnote addRamDisk hack-
 targets += zImage.vmode zImage.initrd.vmode zImage zImage.initrd \
 	   zImage.coff zImage.initrd.coff miboot.image miboot.initrd.image \
 	   zImage.kexec zImage.kexec.3264 zImage.kexec64 \
+	   zImage.lds zImage.kexec.lds zImage.kexec64.lds zImage.coff.lds \
 	   $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \
 	   $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \
 	   $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \
@@ -168,12 +169,26 @@ $(call obj-sec, $(required) $(initrd)): 
 	$(call cmd,bootcc)
 	$(call cmd,addsection)
 
+lds-fl := -P -C -Upowerpc
+CPPFLAGS_zImage.coff.lds	:= $(lds-fl)
+CPPFLAGS_zImage.lds		:= $(lds-fl) -D__ENTRY__=_zimage_start
+CPPFLAGS_zImage.lds			+= -D__BASE__="4*1024*1024"
+CPPFLAGS_zImage.kexec.lds	:= $(lds-fl) -D__ENTRY__=master -D__BASE__=0
+CPPFLAGS_zImage.kexec64.lds	:= $(lds-fl) -D__ENTRY__=_master64 -D__BASE__=0
+
+$(addprefix $(obj)/, zImage.lds zImage.kexec.lds zImage.kexec64.lds): \
+		$(srctree)/$(src)/zImage.lds.S FORCE
+	$(call if_changed_dep,cpp_lds_S)
+
+$(obj)/zImage.coff.lds:  $(srctree)/$(src)/$zImage.coff.lds.S FORCE
+	$(call if_changed_dep,cpp_lds_S)
+
 $(obj)/zImage.vmode $(obj)/zImage.coff: obj-boot += $(call obj-sec, $(required))
-$(obj)/zImage.vmode: $(call obj-sec, $(required)) $(obj-boot) $(srctree)/$(src)/zImage.lds FORCE
+$(obj)/zImage.vmode: $(call obj-sec, $(required)) $(obj-boot) $(obj)/zImage.lds FORCE
 	$(call if_changed,bootld,$(obj-boot),zImage.lds)
 
 $(obj)/zImage.initrd.vmode $(obj)/zImage.initrd.coff: obj-boot += $(call obj-sec, $(required) $(initrd))
-$(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(srctree)/$(src)/zImage.lds FORCE
+$(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(obj)/zImage.lds FORCE
 	$(call if_changed,bootld,$(obj-boot),zImage.lds)
 
 # For 32-bit powermacs, build the COFF and miboot images
@@ -196,13 +211,13 @@ kexecimg-$(CONFIG_KEXEC)-y              
 $(obj)/zImage.kexec: $(filter-out $(obj)/zImage.kexec, $(kexecimg-y-y))
 
 $(obj)/zImage.kexec: obj-kexec += $(call obj-sec, $(required))
-$(obj)/zImage.kexec: $(obj-kexec) $(srctree)/$(src)/zImage.kexec.lds \
+$(obj)/zImage.kexec: $(obj-kexec) $(obj)/zImage.kexec.lds \
 		$(call obj-sec, $(required)) FORCE
 	$(call if_changed,bootld,$(obj-kexec),zImage.kexec.lds)
 	@true
 
 $(obj)/zImage.kexec.3264: obj-kexec += $(call obj-sec, $(required))
-$(obj)/zImage.kexec.3264: $(obj-kexec) $(srctree)/$(src)/zImage.kexec64.lds \
+$(obj)/zImage.kexec.3264: $(obj-kexec) $(obj)/zImage.kexec64.lds \
 		$(call obj-sec, $(required)) FORCE
 	$(call if_changed,bootld,$(obj-kexec),zImage.kexec64.lds)
 
@@ -221,12 +236,11 @@ $(obj)/zImage.initrd: $(obj)/zImage.init
 	@true
 
 $(obj)/zImage.coff: $(call obj-sec, $(required)) $(obj-boot) \
-			$(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff FORCE
+			$(obj)/zImage.coff.lds $(obj)/hack-coff FORCE
 	$(call if_changed_rule,ldcoff,$(obj-boot),zImage.coff.lds)
 
 $(obj)/zImage.initrd.coff: $(call obj-sec, $(required) $(initrd)) $(obj-boot) \
-			   $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff \
-			   FORCE
+			   $(obj)/zImage.coff.lds $(obj)/hack-coff FORCE
 	$(call if_changed_rule,ldcoff,$(obj-boot),zImage.coff.lds)
 
 $(obj)/miboot.image: $(obj)/dummy.o $(obj)/vmlinux.gz FORCE
arch/powerpc/boot/zImage.coff.lds deleted +0 -46

46 lines not on this page · raw message

arch/powerpc/boot/zImage.coff.lds.S new file +46 -0

46 lines not on this page · raw message

arch/powerpc/boot/zImage.kexec.lds deleted +0 -51

51 lines not on this page · raw message

arch/powerpc/boot/zImage.kexec64.lds deleted +0 -52

52 lines not on this page · raw message

arch/powerpc/boot/zImage.lds deleted +0 -46

46 lines not on this page · raw message

arch/powerpc/boot/zImage.lds.S new file +51 -0

51 lines not on this page · raw message