aboutsummaryrefslogtreecommitdiffstats
diff options
-rw-r--r--0001-Kbuild-provide-a-common-kernel-installation-script.patch1085
-rw-r--r--series1
2 files changed, 1086 insertions, 0 deletions
diff --git a/0001-Kbuild-provide-a-common-kernel-installation-script.patch b/0001-Kbuild-provide-a-common-kernel-installation-script.patch
new file mode 100644
index 00000000000000..0dbd744adf46d6
--- /dev/null
+++ b/0001-Kbuild-provide-a-common-kernel-installation-script.patch
@@ -0,0 +1,1085 @@
+From b5f96fdf4fa53462a63219ac354b73b961b6df5f Mon Sep 17 00:00:00 2001
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Date: Sat, 3 Apr 2021 18:15:28 +0200
+Subject: [PATCH] Kbuild: provide a common kernel installation script
+
+All arches seem to do almost exactly the same thing, so unify them all
+into a single script that can be much easier to maintain.
+
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/arm/boot/Makefile | 6 -
+ arch/arm/boot/install.sh | 66 --------------------
+ arch/arm64/boot/Makefile | 4 -
+ arch/arm64/boot/install.sh | 60 ------------------
+ arch/ia64/Makefile | 2
+ arch/ia64/install.sh | 40 ------------
+ arch/m68k/Makefile | 2
+ arch/m68k/install.sh | 52 ---------------
+ arch/nds32/boot/Makefile | 4 -
+ arch/nios2/boot/Makefile | 2
+ arch/nios2/boot/install.sh | 52 ---------------
+ arch/parisc/Makefile | 4 -
+ arch/parisc/boot/Makefile | 2
+ arch/parisc/boot/install.sh | 65 -------------------
+ arch/parisc/install.sh | 66 --------------------
+ arch/powerpc/boot/Makefile | 4 -
+ arch/powerpc/boot/install.sh | 55 ----------------
+ arch/riscv/boot/Makefile | 4 -
+ arch/riscv/boot/install.sh | 60 ------------------
+ arch/s390/boot/Makefile | 2
+ arch/s390/boot/install.sh | 30 ---------
+ arch/sh/boot/compressed/install.sh | 56 ----------------
+ arch/sparc/boot/Makefile | 2
+ arch/sparc/boot/install.sh | 50 ---------------
+ arch/x86/boot/Makefile | 2
+ arch/x86/boot/install.sh | 59 -----------------
+ scripts/install.sh | 122 +++++++++++++++++++++++++++++++++++++
+ 27 files changed, 142 insertions(+), 731 deletions(-)
+ delete mode 100644 arch/arm/boot/install.sh
+ delete mode 100644 arch/arm64/boot/install.sh
+ delete mode 100644 arch/ia64/install.sh
+ delete mode 100644 arch/m68k/install.sh
+ delete mode 100644 arch/nios2/boot/install.sh
+ delete mode 100644 arch/parisc/boot/install.sh
+ delete mode 100644 arch/parisc/install.sh
+ delete mode 100644 arch/powerpc/boot/install.sh
+ delete mode 100644 arch/riscv/boot/install.sh
+ delete mode 100644 arch/s390/boot/install.sh
+ delete mode 100644 arch/sh/boot/compressed/install.sh
+ delete mode 100644 arch/sparc/boot/install.sh
+ delete mode 100644 arch/x86/boot/install.sh
+ create mode 100755 scripts/install.sh
+
+--- a/arch/arm/boot/Makefile
++++ b/arch/arm/boot/Makefile
+@@ -104,15 +104,15 @@ initrd:
+ (echo You must specify INITRD; exit -1)
+
+ install:
+- $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \
++ $(CONFIG_SHELL) $(srctree)/scripts/install.sh "$(KERNELRELEASE)" \
+ $(obj)/Image System.map "$(INSTALL_PATH)"
+
+ zinstall:
+- $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \
++ $(CONFIG_SHELL) $(srctree)/scripts/install.sh "$(KERNELRELEASE)" \
+ $(obj)/zImage System.map "$(INSTALL_PATH)"
+
+ uinstall:
+- $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \
++ $(CONFIG_SHELL) $(srctree)/scripts/install.sh "$(KERNELRELEASE)" \
+ $(obj)/uImage System.map "$(INSTALL_PATH)"
+
+ subdir- := bootp compressed dts
+--- a/arch/arm/boot/install.sh
++++ /dev/null
+@@ -1,66 +0,0 @@
+-#!/bin/sh
+-#
+-# arch/arm/boot/install.sh
+-#
+-# This file is subject to the terms and conditions of the GNU General Public
+-# License. See the file "COPYING" in the main directory of this archive
+-# for more details.
+-#
+-# Copyright (C) 1995 by Linus Torvalds
+-#
+-# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
+-# Adapted from code in arch/i386/boot/install.sh by Russell King
+-#
+-# "make install" script for arm architecture
+-#
+-# Arguments:
+-# $1 - kernel version
+-# $2 - kernel image file
+-# $3 - kernel map file
+-# $4 - default install path (blank if root directory)
+-#
+-
+-verify () {
+- if [ ! -f "$1" ]; then
+- echo "" 1>&2
+- echo " *** Missing file: $1" 1>&2
+- echo ' *** You need to run "make" before "make install".' 1>&2
+- echo "" 1>&2
+- exit 1
+- fi
+-}
+-
+-# Make sure the files actually exist
+-verify "$2"
+-verify "$3"
+-
+-# User may have a custom install script
+-if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
+-if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
+-
+-if [ "$(basename $2)" = "zImage" ]; then
+-# Compressed install
+- echo "Installing compressed kernel"
+- base=vmlinuz
+-else
+-# Normal install
+- echo "Installing normal kernel"
+- base=vmlinux
+-fi
+-
+-if [ -f $4/$base-$1 ]; then
+- mv $4/$base-$1 $4/$base-$1.old
+-fi
+-cat $2 > $4/$base-$1
+-
+-# Install system map file
+-if [ -f $4/System.map-$1 ]; then
+- mv $4/System.map-$1 $4/System.map-$1.old
+-fi
+-cp $3 $4/System.map-$1
+-
+-if [ -x /sbin/loadmap ]; then
+- /sbin/loadmap
+-else
+- echo "You have to install it yourself"
+-fi
+--- a/arch/arm64/boot/Makefile
++++ b/arch/arm64/boot/Makefile
+@@ -37,9 +37,9 @@ $(obj)/Image.lzo: $(obj)/Image FORCE
+ $(call if_changed,lzo)
+
+ install:
+- $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
++ $(CONFIG_SHELL) $(srctree)/scripts/install.sh $(KERNELRELEASE) \
+ $(obj)/Image System.map "$(INSTALL_PATH)"
+
+ zinstall:
+- $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
++ $(CONFIG_SHELL) $(srctree)/scripts/install.sh $(KERNELRELEASE) \
+ $(obj)/Image.gz System.map "$(INSTALL_PATH)"
+--- a/arch/arm64/boot/install.sh
++++ /dev/null
+@@ -1,60 +0,0 @@
+-#!/bin/sh
+-#
+-# arch/arm64/boot/install.sh
+-#
+-# This file is subject to the terms and conditions of the GNU General Public
+-# License. See the file "COPYING" in the main directory of this archive
+-# for more details.
+-#
+-# Copyright (C) 1995 by Linus Torvalds
+-#
+-# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
+-# Adapted from code in arch/i386/boot/install.sh by Russell King
+-#
+-# "make install" script for the AArch64 Linux port
+-#
+-# Arguments:
+-# $1 - kernel version
+-# $2 - kernel image file
+-# $3 - kernel map file
+-# $4 - default install path (blank if root directory)
+-#
+-
+-verify () {
+- if [ ! -f "$1" ]; then
+- echo "" 1>&2
+- echo " *** Missing file: $1" 1>&2
+- echo ' *** You need to run "make" before "make install".' 1>&2
+- echo "" 1>&2
+- exit 1
+- fi
+-}
+-
+-# Make sure the files actually exist
+-verify "$2"
+-verify "$3"
+-
+-# User may have a custom install script
+-if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
+-if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
+-
+-if [ "$(basename $2)" = "Image.gz" ]; then
+-# Compressed install
+- echo "Installing compressed kernel"
+- base=vmlinuz
+-else
+-# Normal install
+- echo "Installing normal kernel"
+- base=vmlinux
+-fi
+-
+-if [ -f $4/$base-$1 ]; then
+- mv $4/$base-$1 $4/$base-$1.old
+-fi
+-cat $2 > $4/$base-$1
+-
+-# Install system map file
+-if [ -f $4/System.map-$1 ]; then
+- mv $4/System.map-$1 $4/System.map-$1.old
+-fi
+-cp $3 $4/System.map-$1
+--- a/arch/ia64/Makefile
++++ b/arch/ia64/Makefile
+@@ -77,7 +77,7 @@ archheaders:
+ CLEAN_FILES += vmlinux.gz
+
+ install: vmlinux.gz
+- sh $(srctree)/arch/ia64/install.sh $(KERNELRELEASE) $< System.map "$(INSTALL_PATH)"
++ sh $(srctree)/scripts/install.sh $(KERNELRELEASE) $< System.map "$(INSTALL_PATH)"
+
+ define archhelp
+ echo '* compressed - Build compressed kernel image'
+--- a/arch/ia64/install.sh
++++ /dev/null
+@@ -1,40 +0,0 @@
+-#!/bin/sh
+-#
+-# arch/ia64/install.sh
+-#
+-# This file is subject to the terms and conditions of the GNU General Public
+-# License. See the file "COPYING" in the main directory of this archive
+-# for more details.
+-#
+-# Copyright (C) 1995 by Linus Torvalds
+-#
+-# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
+-#
+-# "make install" script for ia64 architecture
+-#
+-# Arguments:
+-# $1 - kernel version
+-# $2 - kernel image file
+-# $3 - kernel map file
+-# $4 - default install path (blank if root directory)
+-#
+-
+-# User may have a custom install script
+-
+-if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
+-if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
+-
+-# Default install - same as make zlilo
+-
+-if [ -f $4/vmlinuz ]; then
+- mv $4/vmlinuz $4/vmlinuz.old
+-fi
+-
+-if [ -f $4/System.map ]; then
+- mv $4/System.map $4/System.old
+-fi
+-
+-cat $2 > $4/vmlinuz
+-cp $3 $4/System.map
+-
+-test -x /usr/sbin/elilo && /usr/sbin/elilo
+--- a/arch/m68k/Makefile
++++ b/arch/m68k/Makefile
+@@ -143,4 +143,4 @@ archheaders:
+ $(Q)$(MAKE) $(build)=arch/m68k/kernel/syscalls all
+
+ install:
+- sh $(srctree)/arch/m68k/install.sh $(KERNELRELEASE) vmlinux.gz System.map "$(INSTALL_PATH)"
++ sh $(srctree)/scripts/install.sh $(KERNELRELEASE) vmlinux.gz System.map "$(INSTALL_PATH)"
+--- a/arch/m68k/install.sh
++++ /dev/null
+@@ -1,52 +0,0 @@
+-#!/bin/sh
+-#
+-# This file is subject to the terms and conditions of the GNU General Public
+-# License. See the file "COPYING" in the main directory of this archive
+-# for more details.
+-#
+-# Copyright (C) 1995 by Linus Torvalds
+-#
+-# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
+-#
+-# "make install" script for m68k architecture
+-#
+-# Arguments:
+-# $1 - kernel version
+-# $2 - kernel image file
+-# $3 - kernel map file
+-# $4 - default install path (blank if root directory)
+-#
+-
+-verify () {
+- if [ ! -f "$1" ]; then
+- echo "" 1>&2
+- echo " *** Missing file: $1" 1>&2
+- echo ' *** You need to run "make" before "make install".' 1>&2
+- echo "" 1>&2
+- exit 1
+- fi
+-}
+-
+-# Make sure the files actually exist
+-verify "$2"
+-verify "$3"
+-
+-# User may have a custom install script
+-
+-if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
+-if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
+-
+-# Default install - same as make zlilo
+-
+-if [ -f $4/vmlinuz ]; then
+- mv $4/vmlinuz $4/vmlinuz.old
+-fi
+-
+-if [ -f $4/System.map ]; then
+- mv $4/System.map $4/System.old
+-fi
+-
+-cat $2 > $4/vmlinuz
+-cp $3 $4/System.map
+-
+-sync
+--- a/arch/nds32/boot/Makefile
++++ b/arch/nds32/boot/Makefile
+@@ -8,9 +8,9 @@ $(obj)/Image.gz: $(obj)/Image FORCE
+ $(call if_changed,gzip)
+
+ install: $(obj)/Image
+- $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
++ $(CONFIG_SHELL) $(srctree)/scripts/install.sh $(KERNELRELEASE) \
+ $(obj)/Image System.map "$(INSTALL_PATH)"
+
+ zinstall: $(obj)/Image.gz
+- $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
++ $(CONFIG_SHELL) $(srctree)/scripts/install.sh $(KERNELRELEASE) \
+ $(obj)/Image.gz System.map "$(INSTALL_PATH)"
+--- a/arch/nios2/boot/Makefile
++++ b/arch/nios2/boot/Makefile
+@@ -32,4 +32,4 @@ $(obj)/compressed/vmlinux: $(obj)/vmlinu
+ $(Q)$(MAKE) $(build)=$(obj)/compressed $@
+
+ install:
+- sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
++ sh $(srctree)/scripts/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
+--- a/arch/nios2/boot/install.sh
++++ /dev/null
+@@ -1,52 +0,0 @@
+-#!/bin/sh
+-#
+-# This file is subject to the terms and conditions of the GNU General Public
+-# License. See the file "COPYING" in the main directory of this archive
+-# for more details.
+-#
+-# Copyright (C) 1995 by Linus Torvalds
+-#
+-# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
+-#
+-# "make install" script for nios2 architecture
+-#
+-# Arguments:
+-# $1 - kernel version
+-# $2 - kernel image file
+-# $3 - kernel map file
+-# $4 - default install path (blank if root directory)
+-#
+-
+-verify () {
+- if [ ! -f "$1" ]; then
+- echo "" 1>&2
+- echo " *** Missing file: $1" 1>&2
+- echo ' *** You need to run "make" before "make install".' 1>&2
+- echo "" 1>&2
+- exit 1
+- fi
+-}
+-
+-# Make sure the files actually exist
+-verify "$2"
+-verify "$3"
+-
+-# User may have a custom install script
+-
+-if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
+-if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
+-
+-# Default install - same as make zlilo
+-
+-if [ -f $4/vmlinuz ]; then
+- mv $4/vmlinuz $4/vmlinuz.old
+-fi
+-
+-if [ -f $4/System.map ]; then
+- mv $4/System.map $4/System.old
+-fi
+-
+-cat $2 > $4/vmlinuz
+-cp $3 $4/System.map
+-
+-sync
+--- a/arch/parisc/Makefile
++++ b/arch/parisc/Makefile
+@@ -164,10 +164,10 @@ vmlinuz: vmlinux
+ endif
+
+ install:
+- $(CONFIG_SHELL) $(srctree)/arch/parisc/install.sh \
++ $(CONFIG_SHELL) $(srctree)/scripts/install.sh \
+ $(KERNELRELEASE) vmlinux System.map "$(INSTALL_PATH)"
+ zinstall:
+- $(CONFIG_SHELL) $(srctree)/arch/parisc/install.sh \
++ $(CONFIG_SHELL) $(srctree)/scripts/install.sh \
+ $(KERNELRELEASE) vmlinuz System.map "$(INSTALL_PATH)"
+
+ CLEAN_FILES += lifimage
+--- a/arch/parisc/boot/Makefile
++++ b/arch/parisc/boot/Makefile
+@@ -17,5 +17,5 @@ $(obj)/compressed/vmlinux: FORCE
+ $(Q)$(MAKE) $(build)=$(obj)/compressed $@
+
+ install: $(CONFIGURE) $(obj)/bzImage
+- sh -x $(srctree)/$(obj)/install.sh $(KERNELRELEASE) $(obj)/bzImage \
++ sh -x $(srctree)/scripts/install.sh $(KERNELRELEASE) $(obj)/bzImage \
+ System.map "$(INSTALL_PATH)"
+--- a/arch/parisc/boot/install.sh
++++ /dev/null
+@@ -1,65 +0,0 @@
+-#!/bin/sh
+-#
+-# arch/parisc/install.sh, derived from arch/i386/boot/install.sh
+-#
+-# This file is subject to the terms and conditions of the GNU General Public
+-# License. See the file "COPYING" in the main directory of this archive
+-# for more details.
+-#
+-# Copyright (C) 1995 by Linus Torvalds
+-#
+-# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
+-#
+-# "make install" script for i386 architecture
+-#
+-# Arguments:
+-# $1 - kernel version
+-# $2 - kernel image file
+-# $3 - kernel map file
+-# $4 - default install path (blank if root directory)
+-#
+-
+-verify () {
+- if [ ! -f "$1" ]; then
+- echo "" 1>&2
+- echo " *** Missing file: $1" 1>&2
+- echo ' *** You need to run "make" before "make install".' 1>&2
+- echo "" 1>&2
+- exit 1
+- fi
+-}
+-
+-# Make sure the files actually exist
+-
+-verify "$2"
+-verify "$3"
+-
+-# User may have a custom install script
+-
+-if [ -n "${INSTALLKERNEL}" ]; then
+- if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
+- if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
+-fi
+-
+-# Default install
+-
+-if [ "$(basename $2)" = "zImage" ]; then
+-# Compressed install
+- echo "Installing compressed kernel"
+- base=vmlinuz
+-else
+-# Normal install
+- echo "Installing normal kernel"
+- base=vmlinux
+-fi
+-
+-if [ -f $4/$base-$1 ]; then
+- mv $4/$base-$1 $4/$base-$1.old
+-fi
+-cat $2 > $4/$base-$1
+-
+-# Install system map file
+-if [ -f $4/System.map-$1 ]; then
+- mv $4/System.map-$1 $4/System.map-$1.old
+-fi
+-cp $3 $4/System.map-$1
+--- a/arch/parisc/install.sh
++++ /dev/null
+@@ -1,66 +0,0 @@
+-#!/bin/sh
+-#
+-# arch/parisc/install.sh, derived from arch/i386/boot/install.sh
+-#
+-# This file is subject to the terms and conditions of the GNU General Public
+-# License. See the file "COPYING" in the main directory of this archive
+-# for more details.
+-#
+-# Copyright (C) 1995 by Linus Torvalds
+-#
+-# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
+-#
+-# "make install" script for i386 architecture
+-#
+-# Arguments:
+-# $1 - kernel version
+-# $2 - kernel image file
+-# $3 - kernel map file
+-# $4 - default install path (blank if root directory)
+-#
+-
+-verify () {
+- if [ ! -f "$1" ]; then
+- echo "" 1>&2
+- echo " *** Missing file: $1" 1>&2
+- echo ' *** You need to run "make" before "make install".' 1>&2
+- echo "" 1>&2
+- exit 1
+- fi
+-}
+-
+-# Make sure the files actually exist
+-
+-verify "$2"
+-verify "$3"
+-
+-# User may have a custom install script
+-
+-if [ -n "${INSTALLKERNEL}" ]; then
+- if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
+- if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
+-fi
+-
+-# Default install
+-
+-if [ "$(basename $2)" = "vmlinuz" ]; then
+-# Compressed install
+- echo "Installing compressed kernel"
+- base=vmlinuz
+-else
+-# Normal install
+- echo "Installing normal kernel"
+- base=vmlinux
+-fi
+-
+-if [ -f $4/$base-$1 ]; then
+- mv $4/$base-$1 $4/$base-$1.old
+-fi
+-cat $2 > $4/$base-$1
+-
+-# Install system map file
+-if [ -f $4/System.map-$1 ]; then
+- mv $4/System.map-$1 $4/System.map-$1.old
+-fi
+-cp $3 $4/System.map-$1
+-
+--- a/arch/powerpc/boot/Makefile
++++ b/arch/powerpc/boot/Makefile
+@@ -442,11 +442,11 @@ $(obj)/zImage.initrd: $(addprefix $(obj)
+
+ # Only install the vmlinux
+ install: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
+- sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)"
++ sh -x $(srctree)/scripts/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)"
+
+ # Install the vmlinux and other built boot targets.
+ zInstall: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
+- sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $^
++ sh -x $(srctree)/scripts/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $^
+
+ PHONY += install zInstall
+
+--- a/arch/powerpc/boot/install.sh
++++ /dev/null
+@@ -1,55 +0,0 @@
+-#!/bin/sh
+-#
+-# This file is subject to the terms and conditions of the GNU General Public
+-# License. See the file "COPYING" in the main directory of this archive
+-# for more details.
+-#
+-# Copyright (C) 1995 by Linus Torvalds
+-#
+-# Blatantly stolen from in arch/i386/boot/install.sh by Dave Hansen
+-#
+-# "make install" script for ppc64 architecture
+-#
+-# Arguments:
+-# $1 - kernel version
+-# $2 - kernel image file
+-# $3 - kernel map file
+-# $4 - default install path (blank if root directory)
+-# $5 and more - kernel boot files; zImage*, uImage, cuImage.*, etc.
+-#
+-
+-# Bail with error code if anything goes wrong
+-set -e
+-
+-# User may have a custom install script
+-
+-if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
+-if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
+-
+-# Default install
+-
+-# this should work for both the pSeries zImage and the iSeries vmlinux.sm
+-image_name=`basename $2`
+-
+-if [ -f $4/$image_name ]; then
+- mv $4/$image_name $4/$image_name.old
+-fi
+-
+-if [ -f $4/System.map ]; then
+- mv $4/System.map $4/System.old
+-fi
+-
+-cat $2 > $4/$image_name
+-cp $3 $4/System.map
+-
+-# Copy all the bootable image files
+-path=$4
+-shift 4
+-while [ $# -ne 0 ]; do
+- image_name=`basename $1`
+- if [ -f $path/$image_name ]; then
+- mv $path/$image_name $path/$image_name.old
+- fi
+- cat $1 > $path/$image_name
+- shift
+-done;
+--- a/arch/riscv/boot/Makefile
++++ b/arch/riscv/boot/Makefile
+@@ -47,9 +47,9 @@ $(obj)/loader.bin: $(obj)/loader FORCE
+ $(call if_changed,objcopy)
+
+ install:
+- $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
++ $(CONFIG_SHELL) $(srctree)/scripts/install.sh $(KERNELRELEASE) \
+ $(obj)/Image System.map "$(INSTALL_PATH)"
+
+ zinstall:
+- $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
++ $(CONFIG_SHELL) $(srctree)/scripts/install.sh $(KERNELRELEASE) \
+ $(obj)/Image.gz System.map "$(INSTALL_PATH)"
+--- a/arch/riscv/boot/install.sh
++++ /dev/null
+@@ -1,60 +0,0 @@
+-#!/bin/sh
+-#
+-# arch/riscv/boot/install.sh
+-#
+-# This file is subject to the terms and conditions of the GNU General Public
+-# License. See the file "COPYING" in the main directory of this archive
+-# for more details.
+-#
+-# Copyright (C) 1995 by Linus Torvalds
+-#
+-# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
+-# Adapted from code in arch/i386/boot/install.sh by Russell King
+-#
+-# "make install" script for the RISC-V Linux port
+-#
+-# Arguments:
+-# $1 - kernel version
+-# $2 - kernel image file
+-# $3 - kernel map file
+-# $4 - default install path (blank if root directory)
+-#
+-
+-verify () {
+- if [ ! -f "$1" ]; then
+- echo "" 1>&2
+- echo " *** Missing file: $1" 1>&2
+- echo ' *** You need to run "make" before "make install".' 1>&2
+- echo "" 1>&2
+- exit 1
+- fi
+-}
+-
+-# Make sure the files actually exist
+-verify "$2"
+-verify "$3"
+-
+-# User may have a custom install script
+-if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
+-if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
+-
+-if [ "$(basename $2)" = "Image.gz" ]; then
+-# Compressed install
+- echo "Installing compressed kernel"
+- base=vmlinuz
+-else
+-# Normal install
+- echo "Installing normal kernel"
+- base=vmlinux
+-fi
+-
+-if [ -f $4/$base-$1 ]; then
+- mv $4/$base-$1 $4/$base-$1.old
+-fi
+-cat $2 > $4/$base-$1
+-
+-# Install system map file
+-if [ -f $4/System.map-$1 ]; then
+- mv $4/System.map-$1 $4/System.map-$1.old
+-fi
+-cp $3 $4/System.map-$1
+--- a/arch/s390/boot/Makefile
++++ b/arch/s390/boot/Makefile
+@@ -71,5 +71,5 @@ $(obj)/startup.a: $(OBJECTS) FORCE
+ $(call if_changed,ar)
+
+ install:
+- sh -x $(srctree)/$(obj)/install.sh $(KERNELRELEASE) $(obj)/bzImage \
++ sh -x $(srctree)/scripts/install.sh $(KERNELRELEASE) $(obj)/bzImage \
+ System.map "$(INSTALL_PATH)"
+--- a/arch/s390/boot/install.sh
++++ /dev/null
+@@ -1,30 +0,0 @@
+-#!/bin/sh
+-# SPDX-License-Identifier: GPL-2.0
+-#
+-# arch/s390x/boot/install.sh
+-#
+-# Copyright (C) 1995 by Linus Torvalds
+-#
+-# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
+-#
+-# "make install" script for s390 architecture
+-#
+-# Arguments:
+-# $1 - kernel version
+-# $2 - kernel image file
+-# $3 - kernel map file
+-# $4 - default install path (blank if root directory)
+-#
+-
+-# User may have a custom install script
+-
+-if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
+-if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
+-
+-echo "Warning: '${INSTALLKERNEL}' command not available - additional " \
+- "bootloader config required" >&2
+-if [ -f $4/vmlinuz-$1 ]; then mv $4/vmlinuz-$1 $4/vmlinuz-$1.old; fi
+-if [ -f $4/System.map-$1 ]; then mv $4/System.map-$1 $4/System.map-$1.old; fi
+-
+-cat $2 > $4/vmlinuz-$1
+-cp $3 $4/System.map-$1
+--- a/arch/sh/boot/compressed/install.sh
++++ /dev/null
+@@ -1,56 +0,0 @@
+-#!/bin/sh
+-#
+-# arch/sh/boot/install.sh
+-#
+-# This file is subject to the terms and conditions of the GNU General Public
+-# License. See the file "COPYING" in the main directory of this archive
+-# for more details.
+-#
+-# Copyright (C) 1995 by Linus Torvalds
+-#
+-# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
+-# Adapted from code in arch/i386/boot/install.sh by Russell King
+-# Adapted from code in arch/arm/boot/install.sh by Stuart Menefy
+-#
+-# "make install" script for sh architecture
+-#
+-# Arguments:
+-# $1 - kernel version
+-# $2 - kernel image file
+-# $3 - kernel map file
+-# $4 - default install path (blank if root directory)
+-#
+-
+-# User may have a custom install script
+-
+-if [ -x /sbin/${INSTALLKERNEL} ]; then
+- exec /sbin/${INSTALLKERNEL} "$@"
+-fi
+-
+-if [ "$2" = "zImage" ]; then
+-# Compressed install
+- echo "Installing compressed kernel"
+- if [ -f $4/vmlinuz-$1 ]; then
+- mv $4/vmlinuz-$1 $4/vmlinuz.old
+- fi
+-
+- if [ -f $4/System.map-$1 ]; then
+- mv $4/System.map-$1 $4/System.old
+- fi
+-
+- cat $2 > $4/vmlinuz-$1
+- cp $3 $4/System.map-$1
+-else
+-# Normal install
+- echo "Installing normal kernel"
+- if [ -f $4/vmlinux-$1 ]; then
+- mv $4/vmlinux-$1 $4/vmlinux.old
+- fi
+-
+- if [ -f $4/System.map ]; then
+- mv $4/System.map $4/System.old
+- fi
+-
+- cat $2 > $4/vmlinux-$1
+- cp $3 $4/System.map
+-fi
+--- a/arch/sparc/boot/Makefile
++++ b/arch/sparc/boot/Makefile
+@@ -72,5 +72,5 @@ $(obj)/tftpboot.img: $(obj)/image $(obj)
+ $(call if_changed,piggy)
+
+ install:
+- sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(obj)/zImage \
++ sh $(srctree)/scripts/install.sh $(KERNELRELEASE) $(obj)/zImage \
+ System.map "$(INSTALL_PATH)"
+--- a/arch/sparc/boot/install.sh
++++ /dev/null
+@@ -1,50 +0,0 @@
+-#!/bin/sh
+-#
+-# This file is subject to the terms and conditions of the GNU General Public
+-# License. See the file "COPYING" in the main directory of this archive
+-# for more details.
+-#
+-# Copyright (C) 1995 by Linus Torvalds
+-#
+-# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
+-#
+-# "make install" script for SPARC architecture
+-#
+-# Arguments:
+-# $1 - kernel version
+-# $2 - kernel image file
+-# $3 - kernel map file
+-# $4 - default install path (blank if root directory)
+-#
+-
+-verify () {
+- if [ ! -f "$1" ]; then
+- echo "" 1>&2
+- echo " *** Missing file: $1" 1>&2
+- echo ' *** You need to run "make" before "make install".' 1>&2
+- echo "" 1>&2
+- exit 1
+- fi
+-}
+-
+-# Make sure the files actually exist
+-verify "$2"
+-verify "$3"
+-
+-# User may have a custom install script
+-
+-if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
+-if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
+-
+-# Default install - same as make zlilo
+-
+-if [ -f $4/vmlinuz ]; then
+- mv $4/vmlinuz $4/vmlinuz.old
+-fi
+-
+-if [ -f $4/System.map ]; then
+- mv $4/System.map $4/System.old
+-fi
+-
+-cat $2 > $4/vmlinuz
+-cp $3 $4/System.map
+--- a/arch/x86/boot/Makefile
++++ b/arch/x86/boot/Makefile
+@@ -157,5 +157,5 @@ bzlilo:
+ if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
+
+ install:
+- sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(obj)/bzImage \
++ sh $(srctree)/scripts/install.sh $(KERNELRELEASE) $(obj)/bzImage \
+ System.map "$(INSTALL_PATH)"
+--- a/arch/x86/boot/install.sh
++++ /dev/null
+@@ -1,59 +0,0 @@
+-#!/bin/sh
+-#
+-# This file is subject to the terms and conditions of the GNU General Public
+-# License. See the file "COPYING" in the main directory of this archive
+-# for more details.
+-#
+-# Copyright (C) 1995 by Linus Torvalds
+-#
+-# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
+-#
+-# "make install" script for i386 architecture
+-#
+-# Arguments:
+-# $1 - kernel version
+-# $2 - kernel image file
+-# $3 - kernel map file
+-# $4 - default install path (blank if root directory)
+-#
+-
+-verify () {
+- if [ ! -f "$1" ]; then
+- echo "" 1>&2
+- echo " *** Missing file: $1" 1>&2
+- echo ' *** You need to run "make" before "make install".' 1>&2
+- echo "" 1>&2
+- exit 1
+- fi
+-}
+-
+-# Make sure the files actually exist
+-verify "$2"
+-verify "$3"
+-
+-# User may have a custom install script
+-
+-if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
+-if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
+-
+-# Default install - same as make zlilo
+-
+-if [ -f $4/vmlinuz ]; then
+- mv $4/vmlinuz $4/vmlinuz.old
+-fi
+-
+-if [ -f $4/System.map ]; then
+- mv $4/System.map $4/System.old
+-fi
+-
+-cat $2 > $4/vmlinuz
+-cp $3 $4/System.map
+-
+-if [ -x /sbin/lilo ]; then
+- /sbin/lilo
+-elif [ -x /etc/lilo/install ]; then
+- /etc/lilo/install
+-else
+- sync
+- echo "Cannot find LILO."
+-fi
+--- /dev/null
++++ b/scripts/install.sh
+@@ -0,0 +1,122 @@
++#!/bin/sh
++# SPDX-License-Identifier: GPL-2.0
++#
++# Copyright (C) 1995 Linus Torvalds
++# Copyright (C) 2021 Greg Kroah-Hartman
++#
++# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
++# Adapted from code in arch/i386/boot/install.sh by Russell King
++#
++# "make install" script for the kernel
++#
++# Arguments:
++# $1 - kernel version
++# $2 - kernel image file
++# $3 - kernel map file
++# $4 - default install path (blank if root directory)
++#
++# Installs the built kernel image and map and symbol file in the specified
++# install location. If no install path is selected, the files will be placed
++# in the root directory.
++#
++# The name of the kernel image will be "vmlinux-VERSION" for uncompressed
++# kernels or "vmlinuz-VERSION' for compressed kernels.
++#
++# The kernel map file will be named "System.map-VERSION"
++#
++# If there is currently a kernel image or kernel map file present with the name
++# of the file to be copied to the location, it will be renamed to contain a
++# ".old" suffix.
++#
++# If ~/bin/${INSTALLKERNEL} or /sbin/${INSTALLKERNEL} is executable, execution
++# will be passed to that program instead of this one to allow for distro or
++# system specific installation scripts to be used.
++
++verify () {
++ if [ ! -f "${1}" ]; then
++ echo "" 1>&2
++ echo " *** Missing file: ${1}" 1>&2
++ echo ' *** You need to run "make" before "make install".' 1>&2
++ echo "" 1>&2
++ exit 1
++ fi
++}
++
++install () {
++ install_source=${1}
++ install_target=${2}
++
++ echo "installing '${install_source}' to '${install_target}'"
++
++ # if the target is already present, move it to a .old filename
++ if [ -f "${install_target}" ]; then
++ mv "${install_target}" "${install_target}".old
++ fi
++ cat "${install_source}" > "${install_target}"
++}
++
++# Make sure the files actually exist
++verify "${2}"
++verify "${3}"
++
++# User may have a custom install script, if so, call that instead.
++if [ -x ~/bin/"${INSTALLKERNEL}" ]; then exec ~/bin/"${INSTALLKERNEL}" "$@"; fi
++if [ -x /sbin/"${INSTALLKERNEL}" ]; then exec /sbin/"${INSTALLKERNEL}" "$@"; fi
++
++base=$(basename "${2}")
++if [ "${base}" = "zImage" ] ||
++ [ "${base}" = "Image.gz" ] ||
++ [ "${base}" = "bzImage" ]; then
++ # Compressed install
++ echo "Installing compressed kernel"
++ base=vmlinuz
++else
++ # Normal install
++ echo "Installing normal kernel"
++ base=vmlinux
++fi
++
++# Install kernel image
++install "${2}" "${4}"/"${base}"-"${1}"
++
++# Install system map file
++install "${3}" "${4}"/System.map-"${1}"
++
++sync
++
++# Odd arch specific stuff here when needed:
++case "${ARCH}" in
++ arm)
++ if [ -x /sbin/loadmap ]; then
++ /sbin/loadmap
++ else
++ echo "You have to install it yourself"
++ fi
++ ;;
++ ia64)
++ if [ -x /usr/sbin/elilo ]; then
++ /usr/sbin/elilo
++ fi
++ ;;
++ powerpc)
++ # powerpc installation can list other boot targets after the
++ # install path that should be copied to the correct location
++ path=$4
++ shift 4
++ while [ $# -ne 0 ]; do
++ image_name=$(basename "${1}")
++ install "${1}" "${path}"/"${image_name}"
++ shift
++ done;
++ sync
++ ;;
++ x86)
++ if [ -x /sbin/lilo ]; then
++ /sbin/lilo
++ elif [ -x /etc/lilo/install ]; then
++ /etc/lilo/install
++ else
++ echo "Cannot find LILO, ensure your bootloader knows of the new kernel image."
++ fi
++ ;;
++esac
diff --git a/series b/series
index 8bea784c2ec9fb..650e0af1418f4e 100644
--- a/series
+++ b/series
@@ -1,4 +1,5 @@
#
+0001-Kbuild-provide-a-common-kernel-installation-script.patch
0001-x86-tools-relocs-add-__printf-attribute-to-die.patch
0001-driver-core-aux-test-code.patch
copying.patch