Skip to content

Commit 1a13de6

Browse files
oohalmpe
authored andcommitted
powerpc/boot: Add sed script
The powerpc boot wrapper is potentially compiled with a separate toolchain and/or toolchain flags than the rest of the kernel. The usual case is a 64-bit big endian kernel builds a 32-bit big endian wrapper. The main problem with this is that the wrapper does not have access to the kernel headers (without a lot of gross hacks). To get around this the required headers are copied into the build directory via several sed scripts which rewrite problematic includes. This patch moves these fixups out of the makefile into a separate .sed script file to clean up makefile slightly. Signed-off-by: Oliver O'Halloran <[email protected]> [mpe: Reword first paragraph of change log a little] Signed-off-by: Michael Ellerman <[email protected]>
1 parent 96c4470 commit 1a13de6

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

arch/powerpc/boot/Makefile

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,23 +125,17 @@ obj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib))))
125125
obj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat))))
126126
obj-plat: $(libfdt)
127127

128-
quiet_cmd_copy_zlib = COPY $@
129-
cmd_copy_zlib = sed "s@__used@@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
130-
131-
quiet_cmd_copy_zlibheader = COPY $@
132-
cmd_copy_zlibheader = sed "s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
133-
# stddef.h for NULL
134-
quiet_cmd_copy_zliblinuxheader = COPY $@
135-
cmd_copy_zliblinuxheader = sed "s@<linux/string.h>@\"string.h\"@;s@<linux/kernel.h>@<stddef.h>@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
128+
quiet_cmd_copy_kern_src = COPY $@
129+
cmd_copy_kern_src = sed -f $(srctree)/arch/powerpc/boot/fixup-headers.sed $< > $@
136130

137131
$(addprefix $(obj)/,$(zlib)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
138-
$(call cmd,copy_zlib)
132+
$(call cmd,copy_kern_src)
139133

140134
$(addprefix $(obj)/,$(zlibheader)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
141-
$(call cmd,copy_zlibheader)
135+
$(call cmd,copy_kern_src)
142136

143137
$(addprefix $(obj)/,$(zliblinuxheader)): $(obj)/%: $(srctree)/include/linux/%
144-
$(call cmd,copy_zliblinuxheader)
138+
$(call cmd,copy_kern_src)
145139

146140
quiet_cmd_copy_libfdt = COPY $@
147141
cmd_copy_libfdt = cp $< $@

arch/powerpc/boot/fixup-headers.sed

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright 2016 IBM Corporation.
2+
#
3+
# This program is free software; you can redistribute it and/or modify it
4+
# under the terms of the GNU General Public License version 2 or later as
5+
# published by the Free Software Foundation.
6+
7+
s@#include <linux/decompress/mm\.h>@@;
8+
s@\"zlib_inflate/\([^\"]*\).*@"\1"@;
9+
s@<linux/kernel.h>@<stddef.h>@;
10+
11+
s@__used@@;
12+
s@<linux/\([^>]*\).*@"\1"@;

0 commit comments

Comments
 (0)