Skip to content

Commit b0756b5

Browse files
committed
parisc: make "make install" not depend on vmlinux
Install targets (install, zinstall, uinstall) on parisc have a dependency to vmlinux. This may cause parts of the kernel to be rebuilt during installation. We must avoid this since this may run as root. Install targets "ABSOLUTELY MUST NOT MODIFY THE SOURCE TREE." as Linus emphasized this in: http://lkml.org/lkml/2013/7/10/600 So on parisc and maybe other archs we need the same as for x86: 1648e4f x86, kbuild: make "make install" not depend on vmlinux This parisc patch was inspired by: 19514fc arm, kbuild: make "make install" not depend on vmlinux Signed-off-by: Helge Deller <deller@gmx.de>
1 parent 527973c commit b0756b5

2 files changed

Lines changed: 51 additions & 15 deletions

File tree

‎arch/parisc/Makefile‎

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ PALOCONF := $(shell if [ -f $(src)/palo.conf ]; then echo $(src)/palo.conf; \
9494
else echo $(obj)/palo.conf; \
9595
fi)
9696

97-
palo: vmlinuz
97+
palo lifimage: vmlinuz
9898
@if test ! -x "$(PALO)"; then \
9999
echo 'ERROR: Please install palo first (apt-get install palo)';\
100100
echo 'or build it from source and install it somewhere in your $$PATH';\
@@ -109,16 +109,23 @@ palo: vmlinuz
109109
fi
110110
$(PALO) -f $(PALOCONF)
111111

112-
# Shorthands for known targets not supported by parisc, use vmlinux/vmlinuz as default
112+
BOOT_TARGETS = zImage Image palo lifimage
113+
INSTALL_TARGETS = zinstall install
114+
115+
PHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS)
116+
117+
bzImage zImage: vmlinuz
113118
Image: vmlinux
114-
zImage bzImage: vmlinuz
115119

116120
vmlinuz: vmlinux
117121
@gzip -cf -9 $< > $@
118122

119-
install: vmlinuz
120-
sh $(src)/arch/parisc/install.sh \
121-
$(KERNELRELEASE) $< System.map "$(INSTALL_PATH)"
123+
install:
124+
$(CONFIG_SHELL) $(src)/arch/parisc/install.sh \
125+
$(KERNELRELEASE) vmlinux System.map "$(INSTALL_PATH)"
126+
zinstall:
127+
$(CONFIG_SHELL) $(src)/arch/parisc/install.sh \
128+
$(KERNELRELEASE) vmlinuz System.map "$(INSTALL_PATH)"
122129

123130
CLEAN_FILES += lifimage
124131
MRPROPER_FILES += palo.conf
@@ -127,10 +134,11 @@ define archhelp
127134
@echo '* vmlinux - Uncompressed kernel image (./vmlinux)'
128135
@echo ' vmlinuz - Compressed kernel image (./vmlinuz)'
129136
@echo ' palo - Bootable image (./lifimage)'
130-
@echo ' install - Install kernel using'
137+
@echo ' install - Install uncompressed vmlinux kernel using'
131138
@echo ' (your) ~/bin/$(INSTALLKERNEL) or'
132139
@echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
133140
@echo ' copy to $$(INSTALL_PATH)'
141+
@echo ' zinstall - Install compressed vmlinuz kernel'
134142
endef
135143

136144
# we require gcc 3.3 or above to compile the kernel

‎arch/parisc/install.sh‎

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,48 @@
1919
# $4 - default install path (blank if root directory)
2020
#
2121

22+
verify () {
23+
if [ ! -f "$1" ]; then
24+
echo "" 1>&2
25+
echo " *** Missing file: $1" 1>&2
26+
echo ' *** You need to run "make" before "make install".' 1>&2
27+
echo "" 1>&2
28+
exit 1
29+
fi
30+
}
31+
32+
# Make sure the files actually exist
33+
34+
verify "$2"
35+
verify "$3"
36+
2237
# User may have a custom install script
2338

24-
if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
25-
if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
39+
if [ -n "${INSTALLKERNEL}" ]; then
40+
if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
41+
if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
42+
fi
2643

2744
# Default install
2845

29-
if [ -f $4/vmlinuz ]; then
30-
mv $4/vmlinuz $4/vmlinuz.old
46+
if [ "$(basename $2)" = "zImage" ]; then
47+
# Compressed install
48+
echo "Installing compressed kernel"
49+
base=vmlinuz
50+
else
51+
# Normal install
52+
echo "Installing normal kernel"
53+
base=vmlinux
54+
fi
55+
56+
if [ -f $4/$base-$1 ]; then
57+
mv $4/$base-$1 $4/$base-$1.old
3158
fi
59+
cat $2 > $4/$base-$1
3260

33-
if [ -f $4/System.map ]; then
34-
mv $4/System.map $4/System.old
61+
# Install system map file
62+
if [ -f $4/System.map-$1 ]; then
63+
mv $4/System.map-$1 $4/System.map-$1.old
3564
fi
65+
cp $3 $4/System.map-$1
3666

37-
cat $2 > $4/vmlinuz
38-
cp $3 $4/System.map

0 commit comments

Comments
 (0)