Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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:

1648e4f8 x86, kbuild: make "make install" not depend on vmlinux

This parisc patch was inspired by:

19514fc6 arm, kbuild: make "make install" not depend on vmlinux

Signed-off-by: Helge Deller <deller@gmx.de>

+51 -15
+15 -7
arch/parisc/Makefile
··· 94 94 else echo $(obj)/palo.conf; \ 95 95 fi) 96 96 97 - palo: vmlinuz 97 + palo lifimage: vmlinuz 98 98 @if test ! -x "$(PALO)"; then \ 99 99 echo 'ERROR: Please install palo first (apt-get install palo)';\ 100 100 echo 'or build it from source and install it somewhere in your $$PATH';\ ··· 109 109 fi 110 110 $(PALO) -f $(PALOCONF) 111 111 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 113 118 Image: vmlinux 114 - zImage bzImage: vmlinuz 115 119 116 120 vmlinuz: vmlinux 117 121 @gzip -cf -9 $< > $@ 118 122 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)" 122 129 123 130 CLEAN_FILES += lifimage 124 131 MRPROPER_FILES += palo.conf ··· 134 127 @echo '* vmlinux - Uncompressed kernel image (./vmlinux)' 135 128 @echo ' vmlinuz - Compressed kernel image (./vmlinuz)' 136 129 @echo ' palo - Bootable image (./lifimage)' 137 - @echo ' install - Install kernel using' 130 + @echo ' install - Install uncompressed vmlinux kernel using' 138 131 @echo ' (your) ~/bin/$(INSTALLKERNEL) or' 139 132 @echo ' (distribution) /sbin/$(INSTALLKERNEL) or' 140 133 @echo ' copy to $$(INSTALL_PATH)' 134 + @echo ' zinstall - Install compressed vmlinuz kernel' 141 135 endef 142 136 143 137 # we require gcc 3.3 or above to compile the kernel
+36 -8
arch/parisc/install.sh
··· 19 19 # $4 - default install path (blank if root directory) 20 20 # 21 21 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 + 22 37 # User may have a custom install script 23 38 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 26 43 27 44 # Default install 28 45 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 31 54 fi 32 55 33 - if [ -f $4/System.map ]; then 34 - mv $4/System.map $4/System.old 56 + if [ -f $4/$base-$1 ]; then 57 + mv $4/$base-$1 $4/$base-$1.old 35 58 fi 59 + cat $2 > $4/$base-$1 36 60 37 - cat $2 > $4/vmlinuz 38 - cp $3 $4/System.map 61 + # Install system map file 62 + if [ -f $4/System.map-$1 ]; then 63 + mv $4/System.map-$1 $4/System.map-$1.old 64 + fi 65 + cp $3 $4/System.map-$1 66 +