Skip to contentSkip to conversation

kbuild: unify the install.sh script usage

PATCH In review Greg Kroah-Hartman 9 participants 60 messages Apr 7, 2021 – Aug 27, 2021

Subsystems (14)
Arm (32-bit) x86 PowerPC Kbuild +10 more subsystems
lore
Share & tools
lore
#0 lore raw

cover kbuild: unify the install.sh script usage

Almost every architecture has copied the "install.sh" script that originally came with i386, and modified it in very tiny ways. This patch series unifies all of these scripts into one single script to allow people to understand how to correctly install a kernel, and fixes up some issues regarding trying to install a kernel to a path with spaces in it.

Note that not all architectures actually seem to have any type of way to install a kernel, they must rely on external scripts or tools which feels odd as everything should be included here in the main repository. I'll work on trying to figure out the missing architecture issues afterward.

Note the cc: list here is crazy, due to touching arch-specific code in a number of different arches in the same patch series. I've cc:ed individual arch maintainers on this 00/20 patch, and on their individual arch-specific patch as well, but not the whole thing.

thanks,

greg k-h

Greg Kroah-Hartman (20):
kbuild: move x86 install script to scripts/install.sh
kbuild: scripts/install.sh: properly quote all variables
kbuild: scripts/install.sh: provide a "install" function
kbuild: scripts/install.sh: call sync before calling the bootloader
installer
kbuild: scripts/install.sh: prepare for arch-specific bootloaders
kbuild: scripts/install.sh: handle compressed/uncompressed kernel
images
kbuild: scripts/install.sh: allow for the version number
kbuild: riscv: use common install script
kbuild: arm64: use common install script
kbuild: arm: use common install script
kbuild: ia64: use common install script
kbuild: m68k: use common install script
kbuild: nds32: convert to use the common install scripts
kbuild: nios2: use common install script
kbuild: parisc: use common install script
kbuild: powerpc: use common install script
kbuild: s390: use common install script
kbuild: sh: remove unused install script
kbuild: sparc: use common install script
kbuild: scripts/install.sh: update documentation

 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                 | 136 +++++++++++++++++++++++++++++
 27 files changed, 156 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 100644 scripts/install.sh

base-commit: e49d033bddf5b565044e2abe4241353959bc9120

Signature · 1 line
2.31.1
#1 lore raw

PATCH 1/20 kbuild: move x86 install script to scripts/install.sh

To unify the different architecture kernel installation scripts, start out with the one they all were based on, the x86 script. Move it from arch/x86/boot/ into scripts/ so that all architectures can call it in the future.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Borislav Petkov <[email protected]>
---
 arch/x86/boot/Makefile                | 2 +-
 {arch/x86/boot => scripts}/install.sh | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename {arch/x86/boot => scripts}/install.sh (100%)
arch/x86/boot/Makefile +1 -1
index fe605205b4ce..17c7718c1a4a 100644
@@ -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)"
scripts/install.sh renamed from arch/x86/boot/install.sh +0 -0
similarity index 100%
rename from arch/x86/boot/install.sh
rename to scripts/install.sh
Signature · 1 line
2.31.1
Reviewed-by on v1 1/20
#2 lore raw

Re: [PATCH 01/20] kbuild: move x86 install script to scripts/install.sh

Quoted 10 lines · Greg Kroah-Hartman

To unify the different architecture kernel installation scripts, start out with the one they all were based on, the x86 script. Move it from arch/x86/boot/ into scripts/ so that all architectures can call it in the future.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Borislav Petkov <[email protected]>
Signature · 1 line
Kees Cook
#3 lore raw

PATCH 2/20 kbuild: scripts/install.sh: properly quote all variables

In reply to Greg Kroah-Hartman

A few variables are quoted to handle spaces in directory names, but not all of them. Properly quote everything so that the kernel build can handle working correctly with directory names with spaces.

This change makes the script "shellcheck" clean now.

---
 scripts/install.sh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
scripts/install.sh +8 -8
index d13ec1c38640..c183d6ddd00c 100644
@@ -33,21 +33,21 @@ 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 [ -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
+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
+if [ -f "$4"/System.map ]; then
+	mv "$4"/System.map "$4"/System.old
 fi
 
-cat $2 > $4/vmlinuz
-cp $3 $4/System.map
+cat "$2" > "$4"/vmlinuz
+cp "$3" "$4"/System.map
 
 if [ -x /sbin/lilo ]; then
        /sbin/lilo
Signature · 1 line
2.31.1
#4 lore raw

Re: [PATCH 02/20] kbuild: scripts/install.sh: properly quote all variables

Quoted 22 lines · Greg Kroah-Hartman

A few variables are quoted to handle spaces in directory names, but not all of them. Properly quote everything so that the kernel build can handle working correctly with directory names with spaces.

This change makes the script "shellcheck" clean now.

---
 scripts/install.sh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
scripts/install.sh +0 -2
index d13ec1c38640..c183d6ddd00c 100644
@@ -33,21 +33,21 @@ 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

scripts/install.sh verify "$3" · line 43

Quoted 10 lines
scripts/install.sh +4 -2
+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
+if [ -f "$4"/vmlinuz ]; then
+       mv "$4"/vmlinuz "$4"/vmlinuz.old
 fi

Another way of quoting is doing like this:

if [ -f "$4/vmlinuz" ]; then

       mv "$4/vmlinuz" "$4/vmlinuz.old"

fi

shellcheck is still satisfied.

Because you will add more quotes,
quoting the whole of each parameter might be cleaner.

See my comment in 07/20.

Quoted 14 lines
scripts/install.sh +4 -5
-if [ -f $4/System.map ]; then
-       mv $4/System.map $4/System.old
+if [ -f "$4"/System.map ]; then
+       mv "$4"/System.map "$4"/System.old
 fi
 
-cat $2 > $4/vmlinuz
-cp $3 $4/System.map
+cat "$2" > "$4"/vmlinuz
+cp "$3" "$4"/System.map
 
 if [ -x /sbin/lilo ]; then
        /sbin/lilo
--
Quoted 2 lines

2.31.1

--
Best Regards
Masahiro Yamada

#5 lore raw

PATCH 3/20 kbuild: scripts/install.sh: provide a "install" function

In reply to Greg Kroah-Hartman

Instead of open-coding the "test for file, if present make a backup, then copy the file to the new location" in multiple places, make a single function, install(), to do all of this in one place.

Note, this does change the default x86 kernel map file saved name from "System.old" to "System.map.old". This brings it into unification with the other architectures as to what they call their backup file for the kernel map file. As this is a text file, and nothing parses this from a backup file, there should not be any operational differences.

---
 scripts/install.sh | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)
scripts/install.sh +15 -11
index c183d6ddd00c..af36c0a82f01 100644
@@ -27,6 +27,19 @@ verify () {
  	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"
@@ -37,17 +50,8 @@ 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
+install "$2" "$4"/vmlinuz
+install "$3" "$4"/System.map
 
 if [ -x /sbin/lilo ]; then
        /sbin/lilo
Signature · 1 line
2.31.1
#6 lore raw

Re: [PATCH 03/20] kbuild: scripts/install.sh: provide a "install" function

Quoted 21 lines · Greg Kroah-Hartman

Instead of open-coding the "test for file, if present make a backup, then copy the file to the new location" in multiple places, make a single function, install(), to do all of this in one place.

Note, this does change the default x86 kernel map file saved name from "System.old" to "System.map.old". This brings it into unification with the other architectures as to what they call their backup file for the kernel map file. As this is a text file, and nothing parses this from a backup file, there should not be any operational differences.

---
 scripts/install.sh | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)
scripts/install.sh +0 -0
index c183d6ddd00c..af36c0a82f01 100644

scripts/install.sh verify () { · line 32

Quoted 6 lines
scripts/install.sh +3 -0
@@ -27,6 +27,19 @@ verify () {
        fi
 }
 
+install () {
+       install_source=${1}
+       install_target=${2}

You double-quoted all variables in 02/20.

For consistency and safety here,

           install_source="${1}"

or

           install_source="$1"

so that it will work even if $1 contains spaces.

Quoted 34 lines
scripts/install.sh +12 -12
+
+       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"
@@ -37,17 +50,8 @@ 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
+install "$2" "$4"/vmlinuz
+install "$3" "$4"/System.map
 
 if [ -x /sbin/lilo ]; then
        /sbin/lilo
--
Quoted 2 lines

2.31.1

--
Best Regards

Masahiro Yamada

#7 lore raw

PATCH 4/20 kbuild: scripts/install.sh: call sync before calling the bootloader installer

In reply to Greg Kroah-Hartman

It's good to ensure that the files are written out before calling the bootloader installer, as other architectures do, so call sync after doing the copying of the kernel and system map files.

---
 scripts/install.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/install.sh +1 -1
index af36c0a82f01..92d0d2ade414 100644
@@ -52,12 +52,12 @@ if [ -x /sbin/"${INSTALLKERNEL}" ]; then exec /sbin/"${INSTALLKERNEL}" "$@"; fi
 # Default install - same as make zlilo
 install "$2" "$4"/vmlinuz
 install "$3" "$4"/System.map
+sync
 
 if [ -x /sbin/lilo ]; then
        /sbin/lilo
 elif [ -x /etc/lilo/install ]; then
        /etc/lilo/install
 else
-       sync
        echo "Cannot find LILO."
 fi
Signature · 1 line
2.31.1
#8 lore raw

Re: [PATCH 04/20] kbuild: scripts/install.sh: call sync before calling the bootloader installer

Quoted 4 lines · Greg Kroah-Hartman

It's good to ensure that the files are written out before calling the bootloader installer, as other architectures do, so call sync after doing the copying of the kernel and system map files.

I see 3 architectures that call 'sync' from install.sh

masahiro@grover:~/ref/linux$ find . -name install.sh  | xargs grep sync
./arch/nios2/boot/install.sh:sync
./arch/x86/boot/install.sh:       sync
./arch/m68k/install.sh:sync

As for nios2 and m68k, they do not call any bootloader-specific setups.

Quoted 24 lines
---
 scripts/install.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/install.sh +1 -2
index af36c0a82f01..92d0d2ade414 100644
@@ -52,12 +52,12 @@ if [ -x /sbin/"${INSTALLKERNEL}" ]; then exec /sbin/"${INSTALLKERNEL}" "$@"; fi
 # Default install - same as make zlilo
 install "$2" "$4"/vmlinuz
 install "$3" "$4"/System.map
+sync
 
 if [ -x /sbin/lilo ]; then
        /sbin/lilo
 elif [ -x /etc/lilo/install ]; then
        /etc/lilo/install
 else
-       sync
        echo "Cannot find LILO."
 fi
--
Quoted 2 lines

2.31.1

Why do we need 'sync' before lilo invocation?

If you want to ensure everything is flushed to a disk before this scripts exits, adding 'sync' at the end of the script makes more sense, in my opinion.

if [ -x /sbin/lilo ]; then
/sbin/lilo
elif [ -x /etc/lilo/install ]; then
/etc/lilo/install
else
echo "Cannot find LILO."
fi

sync

This goes aligned with nios2 and m68k.

--
Best Regards

Masahiro Yamada

#9 lore raw

PATCH 5/20 kbuild: scripts/install.sh: prepare for arch-specific bootloaders

In reply to Greg Kroah-Hartman

Despite the last release of LILO being in 2015, it seems that it is still the default x86 bootloader and wants to be called to "install" the new kernel image when it has been replaced on the disk. To allow arch-specific programs like this to be called in future changes, move the logic to an arch-specific test now.

---
 scripts/install.sh | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
scripts/install.sh +12 -7
index 92d0d2ade414..2adcb993efa2 100644
@@ -54,10 +54,15 @@ install "$2" "$4"/vmlinuz
 install "$3" "$4"/System.map
 sync
 
-if [ -x /sbin/lilo ]; then
-       /sbin/lilo
-elif [ -x /etc/lilo/install ]; then
-       /etc/lilo/install
-else
-       echo "Cannot find LILO."
-fi
+# Some architectures like to call specific bootloader "helper" programs:
+case "${ARCH}" in
+	x86)
+		if [ -x /sbin/lilo ]; then
+			/sbin/lilo
+		elif [ -x /etc/lilo/install ]; then
+			/etc/lilo/install
+		else
+			echo "Cannot find LILO."
+		fi
+		;;
+esac
Signature · 1 line
2.31.1
Reviewed-by on v1 5/20
#10 lore raw

Re: [PATCH 05/20] kbuild: scripts/install.sh: prepare for arch-specific bootloaders

Quoted 7 lines · Greg Kroah-Hartman

Despite the last release of LILO being in 2015, it seems that it is still the default x86 bootloader and wants to be called to "install" the new kernel image when it has been replaced on the disk. To allow arch-specific programs like this to be called in future changes, move the logic to an arch-specific test now.

Signature · 1 line
Kees Cook
#11 lore raw

PATCH 6/20 kbuild: scripts/install.sh: handle compressed/uncompressed kernel images

In reply to Greg Kroah-Hartman

For x86, the default kernel image is compressed, but other architectures allowed both compressed and uncompressed kernel images to be built. Add a test to detect which one this is, and either name the output file "vmlinuz" for a compressed image, or "vmlinux" for an uncompressed image.

For x86 this change is a no-op, but other architectures depend on this.

---
 scripts/install.sh | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
scripts/install.sh +12 -2
index 2adcb993efa2..72dc4c81013e 100644
@@ -49,8 +49,18 @@ verify "$3"
 if [ -x ~/bin/"${INSTALLKERNEL}" ]; then exec ~/bin/"${INSTALLKERNEL}" "$@"; fi
 if [ -x /sbin/"${INSTALLKERNEL}" ]; then exec /sbin/"${INSTALLKERNEL}" "$@"; fi
 
-# Default install - same as make zlilo
-install "$2" "$4"/vmlinuz
+base=$(basename "$2")
+if [ "$base" = "bzImage" ]; then
+	# Compressed install
+	echo "Installing compressed kernel"
+	base=vmlinuz
+else
+	# Normal install
+	echo "Installing normal kernel"
+	base=vmlinux
+fi
+
+install "$2" "$4"/"$base"
 install "$3" "$4"/System.map
 sync
 
Signature · 1 line
2.31.1
#12 lore raw

Re: [PATCH 06/20] kbuild: scripts/install.sh: handle compressed/uncompressed kernel images

Quoted 19 lines · Greg Kroah-Hartman

For x86, the default kernel image is compressed, but other architectures allowed both compressed and uncompressed kernel images to be built. Add a test to detect which one this is, and either name the output file "vmlinuz" for a compressed image, or "vmlinux" for an uncompressed image.

For x86 this change is a no-op, but other architectures depend on this.

---
 scripts/install.sh | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
scripts/install.sh +0 -0
index 2adcb993efa2..72dc4c81013e 100644

scripts/install.sh verify "$3" · line 55

Quoted 9 lines
scripts/install.sh +4 -2
@@ -49,8 +49,18 @@ verify "$3"
 if [ -x ~/bin/"${INSTALLKERNEL}" ]; then exec ~/bin/"${INSTALLKERNEL}" "$@"; fi
 if [ -x /sbin/"${INSTALLKERNEL}" ]; then exec /sbin/"${INSTALLKERNEL}" "$@"; fi
 
-# Default install - same as make zlilo
-install "$2" "$4"/vmlinuz
+base=$(basename "$2")
+if [ "$base" = "bzImage" ]; then
+       # Compressed install
+       echo "Installing compressed kernel"

After applying this series, I think the excessive
"Installing ..." messages are a bit annoying.

masahiro@grover:~/workspace/linux-kbuild$ make INSTALL_PATH=~/foo install
sh ./scripts/install.sh 5.12.0-rc3+ arch/x86/boot/bzImage \
System.map "/home/masahiro/foo"
Installing compressed kernel
installing 'arch/x86/boot/bzImage' to '/home/masahiro/foo/vmlinuz'
installing 'System.map' to '/home/masahiro/foo/System.map'
Cannot find LILO, ensure your bootloader knows of the new kernel image.

Since 03/20 added a new log in the 'install' function, can we drop this "Installing compressed kernel" message?

scripts/install.sh verify "$3" · line 59

Quoted 4 lines
scripts/install.sh +4 -0
+       base=vmlinuz
+else
+       # Normal install
+       echo "Installing normal kernel"

Same here.

This message tends to be wrong.
For example, arch/arm/boot/uImage is gzip-compressed, but it says "Installing normal kernel".

Quoted 10 lines
scripts/install.sh +4 -1
+       base=vmlinux
+fi
+
+install "$2" "$4"/"$base"
 install "$3" "$4"/System.map
 sync
 
--

2.31.1

--
Best Regards

Masahiro Yamada

#13 lore raw

PATCH 7/20 kbuild: scripts/install.sh: allow for the version number

In reply to Greg Kroah-Hartman

Some architectures put the version number by default at the end of the files that are copied, so add support for this to be set by arch type.

Odds are one day we should change this for x86, but let's not break anyone's systems just yet.

---
 scripts/install.sh | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
scripts/install.sh +13 -2
index 72dc4c81013e..934619f81119 100644
@@ -60,8 +60,19 @@ else
 	base=vmlinux
 fi
 
-install "$2" "$4"/"$base"
-install "$3" "$4"/System.map
+# Some architectures name their files based on version number, and
+# others do not.  Call out the ones that do not to make it obvious.
+case "${ARCH}" in
+	x86)
+		version=""
+		;;
+	*)
+		version="-${1}"
+		;;
+esac
+
+install "$2" "$4"/"$base""$version"
+install "$3" "$4"/System.map"$version"
 sync
 
 # Some architectures like to call specific bootloader "helper" programs:
Signature · 1 line
2.31.1
#14 lore raw

Re: [PATCH 07/20] kbuild: scripts/install.sh: allow for the version number

Quoted 24 lines · Greg Kroah-Hartman

Some architectures put the version number by default at the end of the files that are copied, so add support for this to be set by arch type.

Odds are one day we should change this for x86, but let's not break anyone's systems just yet.

---
 scripts/install.sh | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
scripts/install.sh +2 -2
index 72dc4c81013e..934619f81119 100644
@@ -60,8 +60,19 @@ else
        base=vmlinux
 fi
 
-install "$2" "$4"/"$base"
-install "$3" "$4"/System.map
+# Some architectures name their files based on version number, and
+# others do not.  Call out the ones that do not to make it obvious.

scripts/install.sh else · line 74

Quoted 10 lines
scripts/install.sh +10 -0
+case "${ARCH}" in
+       x86)
+               version=""
+               ;;
+       *)
+               version="-${1}"
+               ;;
+esac
+
+install "$2" "$4"/"$base""$version"

Too many quotes are eye sore.

    install "$2" "$4/$base$version"

looks cleaner in my opinion.

Shell correctly understands the end of each
variable because a slash or a dollar
cannot be a part of a variable name.

Quoted 7 lines
scripts/install.sh +1 -1
+install "$3" "$4"/System.map"$version"
 sync
 
 # Some architectures like to call specific bootloader "helper" programs:
--

2.31.1

--
Best Regards

Masahiro Yamada

#15 lore raw

Re: [PATCH 07/20] kbuild: scripts/install.sh: allow for the version number

Quoted 41 lines · Masahiro Yamada
Quoted 24 lines · Greg Kroah-Hartman

Some architectures put the version number by default at the end of the files that are copied, so add support for this to be set by arch type.

Odds are one day we should change this for x86, but let's not break anyone's systems just yet.

---
 scripts/install.sh | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
scripts/install.sh +2 -2
index 72dc4c81013e..934619f81119 100644
@@ -60,8 +60,19 @@ else
        base=vmlinux
 fi
 
-install "$2" "$4"/"$base"
-install "$3" "$4"/System.map
+# Some architectures name their files based on version number, and
+# others do not.  Call out the ones that do not to make it obvious.

scripts/install.sh else · line 74

Quoted 10 lines
scripts/install.sh +10 -0
+case "${ARCH}" in
+       x86)
+               version=""
+               ;;
+       *)
+               version="-${1}"
+               ;;
+esac
+
+install "$2" "$4"/"$base""$version"

Too many quotes are eye sore.

Quoted 7 lines
    install "$2" "$4/$base$version"

looks cleaner in my opinion.

Shell correctly understands the end of each
variable because a slash or a dollar
cannot be a part of a variable name.

Good idea, I usually just default to "quote everything!" when dealing with bash variables. I'll fix this up.

Oh, any preference for "$2" vs. "${2}"? I don't care either way but I couldn't tell what is the normal kernel style these days.

thanks for all of the review, much appreciated!

greg k-h

#16 lore raw

Re: [PATCH 07/20] kbuild: scripts/install.sh: allow for the version number

Quoted 51 lines · Greg Kroah-Hartman
Quoted 41 lines · Masahiro Yamada
Quoted 24 lines · Greg Kroah-Hartman

Some architectures put the version number by default at the end of the files that are copied, so add support for this to be set by arch type.

Odds are one day we should change this for x86, but let's not break anyone's systems just yet.

---
 scripts/install.sh | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
scripts/install.sh +2 -2
index 72dc4c81013e..934619f81119 100644
@@ -60,8 +60,19 @@ else
        base=vmlinux
 fi
 
-install "$2" "$4"/"$base"
-install "$3" "$4"/System.map
+# Some architectures name their files based on version number, and
+# others do not.  Call out the ones that do not to make it obvious.

scripts/install.sh else · line 74

Quoted 10 lines
scripts/install.sh +10 -0
+case "${ARCH}" in
+       x86)
+               version=""
+               ;;
+       *)
+               version="-${1}"
+               ;;
+esac
+
+install "$2" "$4"/"$base""$version"

Too many quotes are eye sore.

Quoted 7 lines
    install "$2" "$4/$base$version"

looks cleaner in my opinion.

Shell correctly understands the end of each
variable because a slash or a dollar
cannot be a part of a variable name.

Quoted 5 lines

Good idea, I usually just default to "quote everything!" when dealing with bash variables. I'll fix this up.

Oh, any preference for "$2" vs. "${2}"? I don't care either way but I couldn't tell what is the normal kernel style these days.

I do not see a well-defined coding style guideline for shell scripts.

If you want to know my personal preference,
I use "$2" without braces.

Thanks.

Quoted 2 lines

thanks for all of the review, much appreciated!

My pleasure.

Quoted 2 lines

greg k-h

Signature · 2 lines
Best Regards
Masahiro Yamada
#17 lore raw

PATCH 8/20 kbuild: riscv: use common install script

In reply to Greg Kroah-Hartman

The common scripts/install.sh script will now work for riscv, all that is needed is to add the compressed image type to it. So add that file type check and remove the riscv-only version of the file.

---
 arch/riscv/boot/Makefile   |  4 +--
 arch/riscv/boot/install.sh | 60 --------------------------------------
 scripts/install.sh         |  3 +-
 3 files changed, 4 insertions(+), 63 deletions(-)
 delete mode 100644 arch/riscv/boot/install.sh
arch/riscv/boot/Makefile +2 -2
index 03404c84f971..4ba33aec4ccb 100644
@@ -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)"
arch/riscv/boot/install.sh deleted +0 -60

60 lines not on this page · raw message

scripts/install.sh +2 -1
index 934619f81119..9c8a22d96255 100644
@@ -50,7 +50,8 @@ if [ -x ~/bin/"${INSTALLKERNEL}" ]; then exec ~/bin/"${INSTALLKERNEL}" "$@"; fi
 if [ -x /sbin/"${INSTALLKERNEL}" ]; then exec /sbin/"${INSTALLKERNEL}" "$@"; fi
 
 base=$(basename "$2")
-if [ "$base" = "bzImage" ]; then
+if [ "$base" = "bzImage" ] ||
+   [ "$base" = "Image.gz" ] ; then
 	# Compressed install
 	echo "Installing compressed kernel"
 	base=vmlinuz
Signature · 1 line
2.31.1
Reviewed-by on v1 8/20
#18 lore raw

Re: [PATCH 08/20] kbuild: riscv: use common install script

Quoted 9 lines · Greg Kroah-Hartman

The common scripts/install.sh script will now work for riscv, all that is needed is to add the compressed image type to it. So add that file type check and remove the riscv-only version of the file.

Signature · 1 line
Kees Cook
#19 lore raw

PATCH 9/20 kbuild: arm64: use common install script

In reply to Greg Kroah-Hartman

The common scripts/install.sh script will now work for arm65, no changes needed so convert the arm64 boot Makefile to call it instead of the arm64-only version of the file and remove the now unused file.

---
 arch/arm64/boot/Makefile   |  4 +--
 arch/arm64/boot/install.sh | 60 --------------------------------------
 2 files changed, 2 insertions(+), 62 deletions(-)
 delete mode 100644 arch/arm64/boot/install.sh
arch/arm64/boot/Makefile +2 -2
index cd3414898d10..08c56332dde2 100644
@@ -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)"
arch/arm64/boot/install.sh deleted +0 -60

60 lines not on this page · raw message

Signature · 1 line
2.31.1
maintainer Acked-by on v1 9/20
#20 lore raw

Re: [PATCH 09/20] kbuild: arm64: use common install script

Quoted 8 lines · Greg Kroah-Hartman

The common scripts/install.sh script will now work for arm65, no changes needed so convert the arm64 boot Makefile to call it instead of the arm64-only version of the file and remove the now unused file.

Assuming that it does the same thing (it seems to from a quick look):

Reviewed-by on v1 9/20
#21 lore raw

Re: [PATCH 09/20] kbuild: arm64: use common install script

In reply to Greg Kroah-Hartman
Quoted 1 line · Greg Kroah-Hartman

The common scripts/install.sh script will now work for arm65, no changes

nit: arm64

Quoted 7 lines

needed so convert the arm64 boot Makefile to call it instead of the arm64-only version of the file and remove the now unused file.

With that fixed:

Signature · 1 line
Kees Cook
#22 lore raw

Re: [PATCH 09/20] kbuild: arm64: use common install script

Quoted 4 lines · Kees Cook
Quoted 1 line · Greg Kroah-Hartman

The common scripts/install.sh script will now work for arm65, no changes

nit: arm64

Hah!

Thanks for the reviews, I'll be doing a new series soon based on Masahiro's reviews.

thanks,

greg k-h

#23 lore raw

PATCH 10/20 kbuild: arm: use common install script

In reply to Greg Kroah-Hartman

The common scripts/install.sh script will now work for arm, all that is needed is to add the compressed image type to it. So add that file type check and the ability to call /sbin/loadmap after copying the kernel. With that we can remove the arm-only version of the file.

---
 arch/arm/boot/Makefile   |  6 ++--
 arch/arm/boot/install.sh | 66 ----------------------------------------
 scripts/install.sh       | 10 +++++-
 3 files changed, 12 insertions(+), 70 deletions(-)
 delete mode 100644 arch/arm/boot/install.sh
arch/arm/boot/Makefile +3 -3
index 0b3cd7a33a26..053187f0b714 100644
@@ -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
arch/arm/boot/install.sh deleted +0 -66

66 lines not on this page · raw message

scripts/install.sh +9 -1
index 9c8a22d96255..73067b535ea0 100644
@@ -51,7 +51,8 @@ if [ -x /sbin/"${INSTALLKERNEL}" ]; then exec /sbin/"${INSTALLKERNEL}" "$@"; fi
 
 base=$(basename "$2")
 if [ "$base" = "bzImage" ] ||
-   [ "$base" = "Image.gz" ] ; then
+   [ "$base" = "Image.gz" ] ||
+   [ "$base" = "zImage" ] ; then
 	# Compressed install
 	echo "Installing compressed kernel"
 	base=vmlinuz
@@ -78,6 +79,13 @@ sync
 
 # Some architectures like to call specific bootloader "helper" programs:
 case "${ARCH}" in
+	arm)
+		if [ -x /sbin/loadmap ]; then
+			/sbin/loadmap
+		else
+			echo "You have to install it yourself"
+		fi
+		;;
 	x86)
 		if [ -x /sbin/lilo ]; then
 			/sbin/lilo
Signature · 1 line
2.31.1
Reviewed-by on v1 10/20
#24 lore raw

Re: [PATCH 10/20] kbuild: arm: use common install script

Quoted 9 lines · Greg Kroah-Hartman

The common scripts/install.sh script will now work for arm, all that is needed is to add the compressed image type to it. So add that file type check and the ability to call /sbin/loadmap after copying the kernel. With that we can remove the arm-only version of the file.

Signature · 1 line
Kees Cook
#25 lore raw

PATCH 11/20 kbuild: ia64: use common install script

In reply to Greg Kroah-Hartman

The common scripts/install.sh script will now work for ia64, all that is needed is to add the compressed image type to it. So add that file type check and the ability to call /usr/sbin/elilo after copying the kernel. With that we can remove the ia64-only version of the file.

---
 arch/ia64/Makefile   |  2 +-
 arch/ia64/install.sh | 40 ----------------------------------------
 scripts/install.sh   |  8 +++++++-
 3 files changed, 8 insertions(+), 42 deletions(-)
 delete mode 100644 arch/ia64/install.sh
arch/ia64/Makefile +1 -1
index 467b7e7f967c..19e20e99f487 100644
@@ -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'
arch/ia64/install.sh deleted +0 -40
deleted file mode 100644
index 0e932f5dcd1a..000000000000
@@ -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
scripts/install.sh +7 -1
index 73067b535ea0..b6ca2a0f0983 100644
@@ -52,6 +52,7 @@ if [ -x /sbin/"${INSTALLKERNEL}" ]; then exec /sbin/"${INSTALLKERNEL}" "$@"; fi
 base=$(basename "$2")
 if [ "$base" = "bzImage" ] ||
    [ "$base" = "Image.gz" ] ||
+   [ "$base" = "vmlinux.gz" ] ||
    [ "$base" = "zImage" ] ; then
 	# Compressed install
 	echo "Installing compressed kernel"
@@ -65,7 +66,7 @@ fi
 # Some architectures name their files based on version number, and
 # others do not.  Call out the ones that do not to make it obvious.
 case "${ARCH}" in
-	x86)
+	ia64 | x86)
 		version=""
 		;;
 	*)
@@ -86,6 +87,11 @@ case "${ARCH}" in
 			echo "You have to install it yourself"
 		fi
 		;;
+	ia64)
+		if [ -x /usr/sbin/elilo ]; then
+			/usr/sbin/elilo
+		fi
+		;;
 	x86)
 		if [ -x /sbin/lilo ]; then
 			/sbin/lilo
Signature · 1 line
2.31.1
Reviewed-by on v1 11/20
#26 lore raw

Re: [PATCH 11/20] kbuild: ia64: use common install script

Quoted 7 lines · On Wed, 7 Apr 2021 07:34:10 +0200 Greg Kroah-Hartman…

The common scripts/install.sh script will now work for ia64, all that is needed is to add the compressed image type to it. So add that file type check and the ability to call /usr/sbin/elilo after copying the kernel. With that we can remove the ia64-only version of the file.

Quoted 102 lines
---
 arch/ia64/Makefile   |  2 +-
 arch/ia64/install.sh | 40 ----------------------------------------
 scripts/install.sh   |  8 +++++++-
 3 files changed, 8 insertions(+), 42 deletions(-)
 delete mode 100644 arch/ia64/install.sh
arch/ia64/Makefile +1 -1
index 467b7e7f967c..19e20e99f487 100644
@@ -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'
arch/ia64/install.sh deleted +0 -40
deleted file mode 100644
index 0e932f5dcd1a..000000000000
@@ -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
scripts/install.sh +7 -1
index 73067b535ea0..b6ca2a0f0983 100644
@@ -52,6 +52,7 @@ if [ -x /sbin/"${INSTALLKERNEL}" ]; then exec /sbin/"${INSTALLKERNEL}" "$@"; fi
 base=$(basename "$2")
 if [ "$base" = "bzImage" ] ||
    [ "$base" = "Image.gz" ] ||
+   [ "$base" = "vmlinux.gz" ] ||
    [ "$base" = "zImage" ] ; then
 	# Compressed install
 	echo "Installing compressed kernel"
@@ -65,7 +66,7 @@ fi
 # Some architectures name their files based on version number, and
 # others do not.  Call out the ones that do not to make it obvious.
 case "${ARCH}" in
-	x86)
+	ia64 | x86)
 		version=""
 		;;
 	*)
@@ -86,6 +87,11 @@ case "${ARCH}" in
 			echo "You have to install it yourself"
 		fi
 		;;
+	ia64)
+		if [ -x /usr/sbin/elilo ]; then
+			/usr/sbin/elilo
+		fi
+		;;
 	x86)
 		if [ -x /sbin/lilo ]; then
 			/sbin/lilo
Signature · 1 line
2.31.1
Signature · 1 line
  Sergei
Reviewed-by on v1 11/20
#27 lore raw

Re: [PATCH 11/20] kbuild: ia64: use common install script

In reply to Greg Kroah-Hartman
Quoted 7 lines · Greg Kroah-Hartman

The common scripts/install.sh script will now work for ia64, all that is needed is to add the compressed image type to it. So add that file type check and the ability to call /usr/sbin/elilo after copying the kernel. With that we can remove the ia64-only version of the file.

Signature · 1 line
Kees Cook
#28 lore raw

PATCH 12/20 kbuild: m68k: use common install script

In reply to Greg Kroah-Hartman

The common scripts/install.sh script will now work for m68k, all that is needed is to add it to the list of arches that do not put the version number in the installed file name.

With that we can remove the m68k-only version of the install script.

---
 arch/m68k/Makefile   |  2 +-
 arch/m68k/install.sh | 52 --------------------------------------------
 scripts/install.sh   |  2 +-
 3 files changed, 2 insertions(+), 54 deletions(-)
 delete mode 100644 arch/m68k/install.sh
arch/m68k/Makefile +1 -1
index ea14f2046fb4..e56abf79c313 100644
@@ -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)"
arch/m68k/install.sh deleted +0 -52

52 lines not on this page · raw message

scripts/install.sh +1 -1
index b6ca2a0f0983..a61a5ce28cad 100644
@@ -66,7 +66,7 @@ fi
 # Some architectures name their files based on version number, and
 # others do not.  Call out the ones that do not to make it obvious.
 case "${ARCH}" in
-	ia64 | x86)
+	ia64 | m68k | x86)
 		version=""
 		;;
 	*)
Signature · 1 line
2.31.1
maintainer Acked-by on v1 12/20
#29 lore raw

Re: [PATCH 12/20] kbuild: m68k: use common install script

Hi Greg,

Quoted 9 lines · Greg Kroah-Hartman

The common scripts/install.sh script will now work for m68k, all that is needed is to add it to the list of arches that do not put the version number in the installed file name.

With that we can remove the m68k-only version of the install script.

Thanks for your patch!

I guess it would "work" with the version number, too.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Reviewed-by on v1 12/20
#30 lore raw

Re: [PATCH 12/20] kbuild: m68k: use common install script

In reply to Greg Kroah-Hartman
Quoted 9 lines · Greg Kroah-Hartman

The common scripts/install.sh script will now work for m68k, all that is needed is to add it to the list of arches that do not put the version number in the installed file name.

With that we can remove the m68k-only version of the install script.

Signature · 1 line
Kees Cook
#31 lore raw

PATCH 13/20 kbuild: nds32: convert to use the common install scripts

In reply to Greg Kroah-Hartman

It seems that no one ever checked in the nds32 install script so trying to build a nds32 kernel would never quite work properly as 'make install' would fail to run.

Fix that up by having nds32 call the common install.sh script.

Cc Nick Hu <[email protected]>
Cc Greentime Hu <[email protected]>
Cc Vincent Chen <[email protected]>
---
 arch/nds32/boot/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/nds32/boot/Makefile +2 -2
index c4cc0c2689f7..8371e02f6091 100644
@@ -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)"
Signature · 1 line
2.31.1
#32 lore raw

Re: [PATCH 13/20] kbuild: nds32: convert to use the common install scripts

Quoted 32 lines · Greg Kroah-Hartman

It seems that no one ever checked in the nds32 install script so trying to build a nds32 kernel would never quite work properly as 'make install' would fail to run.

Fix that up by having nds32 call the common install.sh script.

Cc Nick Hu <[email protected]>
Cc Greentime Hu <[email protected]>
Cc Vincent Chen <[email protected]>
---
 arch/nds32/boot/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/nds32/boot/Makefile +2 -3
index c4cc0c2689f7..8371e02f6091 100644
@@ -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)"
--
Quoted 2 lines

2.31.1

Even with this patch, the 'install' target does not work.

$ make ARCH=nds32 install
make: *** No rule to make target 'install'.  Stop.

If you really want to fix it, you need
to add something like follows:

arch/nds32/Makefile +3 -0
index ccdca7142020..3486b78da9ca 100644
@@ -53,6 +53,9 @@ core-y += $(boot)/dts/
 Image: vmlinux
        $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
 
+PHONY += install zinstall
+install zinstall:
+       $(Q)$(MAKE) $(build)=$(boot) $@
 
 PHONY += vdso_install
 vdso_install:

Anyway, I agree that nds32 installation targets are terribly broken.

--
Best Regards
Masahiro Yamada

#33 lore raw

PATCH 14/20 kbuild: nios2: use common install script

In reply to Greg Kroah-Hartman

The common scripts/install.sh script will now work for nios2, all that is needed is to add it to the list of arches that do not put the version number in the installed file name.

With that we can remove the nios2-only version of the install script.

---
 arch/nios2/boot/Makefile   |  2 +-
 arch/nios2/boot/install.sh | 52 --------------------------------------
 scripts/install.sh         |  2 +-
 3 files changed, 2 insertions(+), 54 deletions(-)
 delete mode 100644 arch/nios2/boot/install.sh
arch/nios2/boot/Makefile +1 -1
index 37dfc7e584bc..b8d8a3be156a 100644
@@ -32,4 +32,4 @@ $(obj)/compressed/vmlinux: $(obj)/vmlinux.gz FORCE
 	$(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)"
arch/nios2/boot/install.sh deleted +0 -52

52 lines not on this page · raw message

scripts/install.sh +1 -1
index a61a5ce28cad..407ffa65062c 100644
@@ -66,7 +66,7 @@ fi
 # Some architectures name their files based on version number, and
 # others do not.  Call out the ones that do not to make it obvious.
 case "${ARCH}" in
-	ia64 | m68k | x86)
+	ia64 | m68k | nios2 | x86)
 		version=""
 		;;
 	*)
Signature · 1 line
2.31.1
Reviewed-by on v1 14/20
#34 lore raw

Re: [PATCH 14/20] kbuild: nios2: use common install script

Quoted 8 lines · Greg Kroah-Hartman

The common scripts/install.sh script will now work for nios2, all that is needed is to add it to the list of arches that do not put the version number in the installed file name.

With that we can remove the nios2-only version of the install script.

Signature · 1 line
Kees Cook
#35 lore raw

PATCH 15/20 kbuild: parisc: use common install script

In reply to Greg Kroah-Hartman

The common scripts/install.sh script will now work for parisc, all that is needed is to add the compressed image type to it. So add that file type check, and then we can remove the two different copies of the parisc install.sh script that were only different by one line and have the arch call the common install script.

Cc "James E.J. Bottomley" <[email protected]>
Cc Helge Deller <[email protected]>
---
 arch/parisc/Makefile        |  4 +--
 arch/parisc/boot/Makefile   |  2 +-
 arch/parisc/boot/install.sh | 65 ------------------------------------
 arch/parisc/install.sh      | 66 -------------------------------------
 scripts/install.sh          |  1 +
 5 files changed, 4 insertions(+), 134 deletions(-)
 delete mode 100644 arch/parisc/boot/install.sh
 delete mode 100644 arch/parisc/install.sh
arch/parisc/Makefile +2 -2
index 7d9f71aa829a..296d8ab8e2aa 100644
@@ -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
arch/parisc/boot/Makefile +1 -1
index 61f44142cfe1..ad2611929aee 100644
@@ -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)"
arch/parisc/boot/install.sh deleted +0 -65

65 lines not on this page · raw message

arch/parisc/install.sh deleted +0 -66

66 lines not on this page · raw message

scripts/install.sh +1 -0
index 407ffa65062c..e0ffb95737d4 100644
@@ -53,6 +53,7 @@ base=$(basename "$2")
 if [ "$base" = "bzImage" ] ||
    [ "$base" = "Image.gz" ] ||
    [ "$base" = "vmlinux.gz" ] ||
+   [ "$base" = "vmlinuz" ] ||
    [ "$base" = "zImage" ] ; then
 	# Compressed install
 	echo "Installing compressed kernel"
Signature · 1 line
2.31.1
#36 lore raw

Re: [PATCH 15/20] kbuild: parisc: use common install script

Quoted 43 lines · Greg Kroah-Hartman

The common scripts/install.sh script will now work for parisc, all that is needed is to add the compressed image type to it. So add that file type check, and then we can remove the two different copies of the parisc install.sh script that were only different by one line and have the arch call the common install script.

Cc "James E.J. Bottomley" <[email protected]>
Cc Helge Deller <[email protected]>
---
 arch/parisc/Makefile        |  4 +--
 arch/parisc/boot/Makefile   |  2 +-
 arch/parisc/boot/install.sh | 65 ------------------------------------
 arch/parisc/install.sh      | 66 -------------------------------------
 scripts/install.sh          |  1 +
 5 files changed, 4 insertions(+), 134 deletions(-)
 delete mode 100644 arch/parisc/boot/install.sh
 delete mode 100644 arch/parisc/install.sh
arch/parisc/Makefile +2 -2
index 7d9f71aa829a..296d8ab8e2aa 100644
@@ -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
arch/parisc/boot/Makefile +0 -0
index 61f44142cfe1..ad2611929aee 100644

arch/parisc/boot/Makefile $(obj)/compressed/vmlinux: FORCE · line 21

Quoted 6 lines
arch/parisc/boot/Makefile +1 -1
@@ -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)"

As far as I understood, there is no way to invoke this 'install' target in arch/parisc/boot/Makefile since everything is done
by arch/parisc/Makefile.

Can we remove this 'install' rule entirely?

Quoted 156 lines
arch/parisc/boot/install.sh deleted +0 -65
deleted file mode 100644
index 8f7c365fad83..000000000000
@@ -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
arch/parisc/install.sh deleted +0 -66
deleted file mode 100644
index 056d588befdd..000000000000
@@ -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
-
scripts/install.sh +1 -1
index 407ffa65062c..e0ffb95737d4 100644
@@ -53,6 +53,7 @@ base=$(basename "$2")
 if [ "$base" = "bzImage" ] ||
    [ "$base" = "Image.gz" ] ||
    [ "$base" = "vmlinux.gz" ] ||
+   [ "$base" = "vmlinuz" ] ||
    [ "$base" = "zImage" ] ; then
        # Compressed install
        echo "Installing compressed kernel"
--
Quoted 2 lines

2.31.1

--
Best Regards
Masahiro Yamada

maintainer
#37 lore raw

Re: [PATCH 15/20] kbuild: parisc: use common install script

Quoted 58 lines · Masahiro Yamada
Quoted 43 lines · Greg Kroah-Hartman

The common scripts/install.sh script will now work for parisc, all that is needed is to add the compressed image type to it. So add that file type check, and then we can remove the two different copies of the parisc install.sh script that were only different by one line and have the arch call the common install script.

Cc "James E.J. Bottomley" <[email protected]>
Cc Helge Deller <[email protected]>
---
  arch/parisc/Makefile        |  4 +--
  arch/parisc/boot/Makefile   |  2 +-
  arch/parisc/boot/install.sh | 65 ------------------------------------
  arch/parisc/install.sh      | 66 -------------------------------------
  scripts/install.sh          |  1 +
  5 files changed, 4 insertions(+), 134 deletions(-)

delete mode 100644 arch/parisc/boot/install.sh
delete mode 100644 arch/parisc/install.sh

arch/parisc/Makefile +2 -2
index 7d9f71aa829a..296d8ab8e2aa 100644
@@ -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
arch/parisc/boot/Makefile +0 -0
index 61f44142cfe1..ad2611929aee 100644

arch/parisc/boot/Makefile $(obj)/compressed/vmlinux: FORCE · line 21

Quoted 6 lines
arch/parisc/boot/Makefile +1 -1
@@ -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)"

As far as I understood, there is no way to invoke this 'install' target in arch/parisc/boot/Makefile since everything is done
by arch/parisc/Makefile.

Quoted 1 line

Can we remove this 'install' rule entirely?

Yes, I think it can go in arch/parisc/boot/Makefile.

Helge

#38 lore raw

Re: [PATCH 15/20] kbuild: parisc: use common install script

Quoted 59 lines · Helge Deller
Quoted 58 lines · Masahiro Yamada
Quoted 43 lines · Greg Kroah-Hartman

The common scripts/install.sh script will now work for parisc, all that is needed is to add the compressed image type to it. So add that file type check, and then we can remove the two different copies of the parisc install.sh script that were only different by one line and have the arch call the common install script.

Cc "James E.J. Bottomley" <[email protected]>
Cc Helge Deller <[email protected]>
---
  arch/parisc/Makefile        |  4 +--
  arch/parisc/boot/Makefile   |  2 +-
  arch/parisc/boot/install.sh | 65 ------------------------------------
  arch/parisc/install.sh      | 66 -------------------------------------
  scripts/install.sh          |  1 +
  5 files changed, 4 insertions(+), 134 deletions(-)

delete mode 100644 arch/parisc/boot/install.sh
delete mode 100644 arch/parisc/install.sh

arch/parisc/Makefile +2 -2
index 7d9f71aa829a..296d8ab8e2aa 100644
@@ -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
arch/parisc/boot/Makefile +0 -0
index 61f44142cfe1..ad2611929aee 100644

arch/parisc/boot/Makefile $(obj)/compressed/vmlinux: FORCE · line 21

Quoted 6 lines
arch/parisc/boot/Makefile +1 -1
@@ -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)"

As far as I understood, there is no way to invoke this 'install' target in arch/parisc/boot/Makefile since everything is done
by arch/parisc/Makefile.

Quoted 3 lines
Quoted 1 line

Can we remove this 'install' rule entirely?

Yes, I think it can go in arch/parisc/boot/Makefile.

It's already there today, so I'll delete the rule from arch/parisc/Makefile in my next round.

thanks,

greg k-h

#39 lore raw

PATCH 16/20 kbuild: powerpc: use common install script

In reply to Greg Kroah-Hartman

The common scripts/install.sh script will now work for powerpc, all that is needed is to add it to the list of arches that do not put the version number in the installed file name.

After the kernel is installed, powerpc also likes to install a few random files, so provide the ability to do that as well.

With that we can remove the powerpc-only version of the install script.

---
 arch/powerpc/boot/Makefile   |  4 +--
 arch/powerpc/boot/install.sh | 55 ------------------------------------
 scripts/install.sh           | 14 ++++++++-
 3 files changed, 15 insertions(+), 58 deletions(-)
 delete mode 100644 arch/powerpc/boot/install.sh
arch/powerpc/boot/Makefile +2 -2
index 2b8da923ceca..bbfcbd33e0b7 100644
@@ -442,11 +442,11 @@ $(obj)/zImage.initrd:	$(addprefix $(obj)/, $(initrd-y))
 
 # 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
 
arch/powerpc/boot/install.sh deleted +0 -55

55 lines not on this page · raw message

scripts/install.sh +13 -1
index e0ffb95737d4..67c0a5f74af2 100644
@@ -67,7 +67,7 @@ fi
 # Some architectures name their files based on version number, and
 # others do not.  Call out the ones that do not to make it obvious.
 case "${ARCH}" in
-	ia64 | m68k | nios2 | x86)
+	ia64 | m68k | nios2 | powerpc | x86)
 		version=""
 		;;
 	*)
@@ -93,6 +93,18 @@ case "${ARCH}" in
 			/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
Signature · 1 line
2.31.1
#40 lore raw

Re: [PATCH 16/20] kbuild: powerpc: use common install script

Quoted 25 lines · Greg Kroah-Hartman

The common scripts/install.sh script will now work for powerpc, all that is needed is to add it to the list of arches that do not put the version number in the installed file name.

After the kernel is installed, powerpc also likes to install a few random files, so provide the ability to do that as well.

With that we can remove the powerpc-only version of the install script.

---
 arch/powerpc/boot/Makefile   |  4 +--
 arch/powerpc/boot/install.sh | 55 ------------------------------------
 scripts/install.sh           | 14 ++++++++-
 3 files changed, 15 insertions(+), 58 deletions(-)
 delete mode 100644 arch/powerpc/boot/install.sh
arch/powerpc/boot/Makefile +0 -0
index 2b8da923ceca..bbfcbd33e0b7 100644

arch/powerpc/boot/Makefile $(obj)/zImage.initrd: $(addprefix $(obj)/, $(initrd-y)) · line 449

Quoted 10 lines
arch/powerpc/boot/Makefile +2 -2
@@ -442,11 +442,11 @@ $(obj)/zImage.initrd:     $(addprefix $(obj)/, $(initrd-y))
 
 # 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)" $^

I want comments from the ppc maintainers
because this code is already broken.

This 'zInstall' target is unreachable.

See commit c913e5f95e546d8d3a9f99ba9908f7e095cbc1fb

It added the new target 'zInstall', but it is not hooked anywhere. It is completely useless for 6 years, and nobody has pointed it out. So, I think nobody is caring about this broken code.

One more thing, Kbuild does not recognize it as an installation target because the 'I' in 'zInstall' is a capital letter.

The name of the installation target must be '*install', all letters in lower cases.

Quoted 77 lines
arch/powerpc/boot/Makefile +0 -0
 PHONY += install zInstall
 
arch/powerpc/boot/install.sh deleted +0 -55
deleted file mode 100644
index b6a256bc96ee..000000000000
@@ -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;
scripts/install.sh +1 -1
index e0ffb95737d4..67c0a5f74af2 100644
@@ -67,7 +67,7 @@ fi
 # Some architectures name their files based on version number, and
 # others do not.  Call out the ones that do not to make it obvious.
 case "${ARCH}" in
-       ia64 | m68k | nios2 | x86)
+       ia64 | m68k | nios2 | powerpc | x86)
                version=""
                ;;
        *)

scripts/install.sh case "${ARCH}" in · line 98

Quoted 6 lines
scripts/install.sh +3 -0
@@ -93,6 +93,18 @@ case "${ARCH}" in
                        /usr/sbin/elilo
                fi
                ;;
+       powerpc)
+               # powerpc installation can list other boot targets after the
+               # install path that should be copied to the correct location

Perhaps, we can remove this if the ppc maintainers approve it ?

Quoted 13 lines
scripts/install.sh +9 -1
+               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
--
Quoted 2 lines

2.31.1

--
Best Regards
Masahiro Yamada

#41 lore raw

PATCH 17/20 kbuild: s390: use common install script

In reply to Greg Kroah-Hartman

The common scripts/install.sh script will now work for s390, no changes needed. So call that instead and delete the s390-only install script.

Cc Heiko Carstens <[email protected]>
Cc Vasily Gorbik <[email protected]>
Cc Christian Borntraeger <[email protected]>
---
 arch/s390/boot/Makefile   |  2 +-
 arch/s390/boot/install.sh | 30 ------------------------------
 2 files changed, 1 insertion(+), 31 deletions(-)
 delete mode 100644 arch/s390/boot/install.sh
arch/s390/boot/Makefile +1 -1
index 41a64b8dce25..5e3058d6e59b 100644
@@ -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)"
arch/s390/boot/install.sh deleted +0 -30
deleted file mode 100644
index 515b27a996b3..000000000000
@@ -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
Signature · 1 line
2.31.1
maintainer Acked-by on v1 17/20
#42 lore raw

Re: [PATCH 17/20] kbuild: s390: use common install script

Quoted 8 lines · Greg Kroah-Hartman

The common scripts/install.sh script will now work for s390, no changes needed. So call that instead and delete the s390-only install script.

Cc Heiko Carstens <[email protected]>
Cc Vasily Gorbik <[email protected]>
Cc Christian Borntraeger <[email protected]>
Quoted 5 lines
---
 arch/s390/boot/Makefile   |  2 +-
 arch/s390/boot/install.sh | 30 ------------------------------
 2 files changed, 1 insertion(+), 31 deletions(-)
 delete mode 100644 arch/s390/boot/install.sh
Reviewed-by on v1 17/20
#43 lore raw

Re: [PATCH 17/20] kbuild: s390: use common install script

In reply to Greg Kroah-Hartman
Quoted 8 lines · Greg Kroah-Hartman

The common scripts/install.sh script will now work for s390, no changes needed. So call that instead and delete the s390-only install script.

Cc Heiko Carstens <[email protected]>
Cc Vasily Gorbik <[email protected]>
Cc Christian Borntraeger <[email protected]>
Signature · 1 line
Kees Cook
#44 lore raw

PATCH 18/20 kbuild: sh: remove unused install script

In reply to Greg Kroah-Hartman

The sh arch has a install.sh script, but no Makefile actually calls it. Remove it to keep anyone from accidentally calling it in the future.

---
 arch/sh/boot/compressed/install.sh | 56 ------------------------------
 1 file changed, 56 deletions(-)
 delete mode 100644 arch/sh/boot/compressed/install.sh
arch/sh/boot/compressed/install.sh deleted +0 -56
deleted file mode 100644
index f9f41818b17e..000000000000
@@ -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
Signature · 1 line
2.31.1
Reviewed-by on v1 18/20
#45 lore raw

Re: [PATCH 18/20] kbuild: sh: remove unused install script

Quoted 7 lines · Greg Kroah-Hartman

The sh arch has a install.sh script, but no Makefile actually calls it. Remove it to keep anyone from accidentally calling it in the future.

Signature · 1 line
Kees Cook
#46 lore raw

Re: [PATCH 18/20] kbuild: sh: remove unused install script

In reply to Greg Kroah-Hartman
Quoted 76 lines · Greg Kroah-Hartman

The sh arch has a install.sh script, but no Makefile actually calls it. Remove it to keep anyone from accidentally calling it in the future.

---
 arch/sh/boot/compressed/install.sh | 56 ------------------------------
 1 file changed, 56 deletions(-)
 delete mode 100644 arch/sh/boot/compressed/install.sh
arch/sh/boot/compressed/install.sh deleted +0 -57
deleted file mode 100644
index f9f41818b17e..000000000000
@@ -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
--
Quoted 2 lines

2.31.1

This one is applicable independently.

Applied to linux-kbuild. Thanks.

Signature · 2 lines
Best Regards
Masahiro Yamada
#47 lore raw

Re: [PATCH 18/20] kbuild: sh: remove unused install script

Quoted 84 lines · Masahiro Yamada
Quoted 76 lines · Greg Kroah-Hartman

The sh arch has a install.sh script, but no Makefile actually calls it. Remove it to keep anyone from accidentally calling it in the future.

---
 arch/sh/boot/compressed/install.sh | 56 ------------------------------
 1 file changed, 56 deletions(-)
 delete mode 100644 arch/sh/boot/compressed/install.sh
arch/sh/boot/compressed/install.sh deleted +0 -57
deleted file mode 100644
index f9f41818b17e..000000000000
@@ -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
--
Quoted 2 lines

2.31.1

This one is applicable independently.

Quoted 1 line

Applied to linux-kbuild. Thanks.

Hey, nice, thanks!

I'll work on the rest of the patches in this series after the next merge window is over...

greg k-h

#48 lore raw

PATCH 19/20 kbuild: sparc: use common install script

In reply to Greg Kroah-Hartman

The common scripts/install.sh script will now work for sparc, all that is needed is to add it to the list of arches that do not put the version number in the installed file name.

With that we can remove the sparc-only version of the install script.

---
 arch/sparc/boot/Makefile   |  2 +-
 arch/sparc/boot/install.sh | 50 --------------------------------------
 scripts/install.sh         |  2 +-
 3 files changed, 2 insertions(+), 52 deletions(-)
 delete mode 100644 arch/sparc/boot/install.sh
arch/sparc/boot/Makefile +1 -1
index 380e2b018992..952f8e7a40ec 100644
@@ -72,5 +72,5 @@ $(obj)/tftpboot.img: $(obj)/image $(obj)/piggyback System.map $(ROOT_IMG) FORCE
 	$(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)"
arch/sparc/boot/install.sh deleted +0 -50

50 lines not on this page · raw message

scripts/install.sh +1 -1
index 67c0a5f74af2..225b19bbbfa6 100644
@@ -67,7 +67,7 @@ fi
 # Some architectures name their files based on version number, and
 # others do not.  Call out the ones that do not to make it obvious.
 case "${ARCH}" in
-	ia64 | m68k | nios2 | powerpc | x86)
+	ia64 | m68k | nios2 | powerpc | sparc | x86)
 		version=""
 		;;
 	*)
Signature · 1 line
2.31.1
Reviewed-by on v1 19/20
#49 lore raw

Re: [PATCH 19/20] kbuild: sparc: use common install script

Quoted 9 lines · Greg Kroah-Hartman

The common scripts/install.sh script will now work for sparc, all that is needed is to add it to the list of arches that do not put the version number in the installed file name.

With that we can remove the sparc-only version of the install script.

Signature · 1 line
Kees Cook
#50 lore raw

PATCH 20/20 kbuild: scripts/install.sh: update documentation

In reply to Greg Kroah-Hartman

Add a proper SPDX line and document the install.sh file a lot better, explaining exactly what it does, and update the copyright notice and provide a better message about the lack of LILO being present or not as really, no one should be using that anymore...

---
 scripts/install.sh | 33 ++++++++++++++++++++++++++-------
 1 file changed, 26 insertions(+), 7 deletions(-)
scripts/install.sh +26 -7
index 225b19bbbfa6..dd86fb9971e9 100644
@@ -1,14 +1,14 @@
 #!/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.
+# SPDX-License-Identifier: GPL-2.0
 #
 # Copyright (C) 1995 by 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
+# Adapted from code in arch/arm/boot/install.sh by Stuart Menefy
 #
-# "make install" script for i386 architecture
+# "make install" script for Linux to be used by all architectures.
 #
 # Arguments:
 #   $1 - kernel version
@@ -16,6 +16,26 @@
 #   $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"
+#
+# Note, not all architectures seem to like putting the VERSION number in the
+# file name, see below in the script for a list of those that do not.  For
+# those that do not the "-VERSION" will not be present in the file name.
+#
+# 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
@@ -45,7 +65,6 @@ 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
 
@@ -111,7 +130,7 @@ case "${ARCH}" in
 		elif [ -x /etc/lilo/install ]; then
 			/etc/lilo/install
 		else
-			echo "Cannot find LILO."
+			echo "Cannot find LILO, ensure your bootloader knows of the new kernel image."
 		fi
 		;;
 esac
Signature · 1 line
2.31.1
#51 lore raw

Re: [PATCH 20/20] kbuild: scripts/install.sh: update documentation

Quoted 18 lines · Greg Kroah-Hartman

Add a proper SPDX line and document the install.sh file a lot better, explaining exactly what it does, and update the copyright notice and provide a better message about the lack of LILO being present or not as really, no one should be using that anymore...

---
 scripts/install.sh | 33 ++++++++++++++++++++++++++-------
 1 file changed, 26 insertions(+), 7 deletions(-)
scripts/install.sh +0 -1
index 225b19bbbfa6..dd86fb9971e9 100644
@@ -1,14 +1,14 @@
 #!/bin/sh
-#

scripts/install.sh line 8

Quoted 10 lines
scripts/install.sh +3 -3
-# 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.
+# SPDX-License-Identifier: GPL-2.0
 #
 # Copyright (C) 1995 by 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

Perhaps, this line can go to
"10/20 kbuild: arm: use common install script" ?

scripts/install.sh line 9

Quoted 1 line
scripts/install.sh +1 -0
+# Adapted from code in arch/arm/boot/install.sh by Stuart Menefy

I think this line came from 18/20,
but do we need to keep it?

You removed arch/sh/boot/compressed/install.sh entirely.

Quoted 42 lines
scripts/install.sh +21 -2
 #
-# "make install" script for i386 architecture
+# "make install" script for Linux to be used by all architectures.
 #
 # Arguments:
 #   $1 - kernel version
@@ -16,6 +16,26 @@
 #   $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"
+#
+# Note, not all architectures seem to like putting the VERSION number in the
+# file name, see below in the script for a list of those that do not.  For
+# those that do not the "-VERSION" will not be present in the file name.
+#
+# 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
@@ -45,7 +65,6 @@ 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
 

scripts/install.sh case "${ARCH}" in · line 133

Quoted 5 lines
scripts/install.sh +1 -1
@@ -111,7 +130,7 @@ case "${ARCH}" in
                elif [ -x /etc/lilo/install ]; then
                        /etc/lilo/install
                else
-                       echo "Cannot find LILO."
+                       echo "Cannot find LILO, ensure your bootloader knows of the new kernel image."

Since you soften the message, I guess this is not a warning message. I assume it is intentional to put it in stdout instead of stderr.

Quoted 6 lines
scripts/install.sh +0 -1
                fi
                ;;
 esac
--

2.31.1

Signature · 2 lines
Best Regards
Masahiro Yamada
#52 lore raw
In reply to Greg Kroah-Hartman

Hi Greg,

Thanks for your series!

Quoted 7 lines · Greg Kroah-Hartman

Almost every architecture has copied the "install.sh" script that originally came with i386, and modified it in very tiny ways. This patch series unifies all of these scripts into one single script to allow people to understand how to correctly install a kernel, and fixes up some issues regarding trying to install a kernel to a path with spaces in it.

Quoted 5 lines

Note that not all architectures actually seem to have any type of way to install a kernel, they must rely on external scripts or tools which feels odd as everything should be included here in the main repository. I'll work on trying to figure out the missing architecture issues afterward.

I'll bite ;-)

Does anyone actually use these scripts (outside of x86)?
I assume the architectures that have them, only have them because they were copied from x86 while doing the initial ports ("oh, a file I don't have to modify at all.").
But installing the kernel can be very platform-specific.
Do you need the vmlinux, vmlinux.gz, Image, zImage, uImage, ...? With separate or appended DTB?

Even on x86, the script will bail out with "Cannot find LILO." if you're using Grub.

Anyway, having less of them is good.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#53 lore raw
Quoted 19 lines · Geert Uytterhoeven

Hi Greg,

Thanks for your series!

Quoted 7 lines · Greg Kroah-Hartman

Almost every architecture has copied the "install.sh" script that originally came with i386, and modified it in very tiny ways. This patch series unifies all of these scripts into one single script to allow people to understand how to correctly install a kernel, and fixes up some issues regarding trying to install a kernel to a path with spaces in it.

Quoted 5 lines

Note that not all architectures actually seem to have any type of way to install a kernel, they must rely on external scripts or tools which feels odd as everything should be included here in the main repository. I'll work on trying to figure out the missing architecture issues afterward.

Quoted 3 lines

I'll bite ;-)

Does anyone actually use these scripts (outside of x86)?

I think so, if not then what do they use?

Ok, I'll answer that, Before this week, I used my own script, a horrible hack I've drug along for years:
https://github.com/gregkh/gregkh-linux/blob/master/scripts/install

but for almost everyone else, they just use /sbin/installkernel that is provided by their distro. But this feels really odd given that we should include the logic to install the kernel in the kernel source itself, otherwise everyone has to rely on an external package that no one knows where it is.

Quoted 6 lines

I assume the architectures that have them, only have them because they were copied from x86 while doing the initial ports ("oh, a file I don't have to modify at all.").
But installing the kernel can be very platform-specific.
Do you need the vmlinux, vmlinux.gz, Image, zImage, uImage, ...? With separate or appended DTB?

That seems handled already by the arch/ARCH/boot/Makefile logic today, so I do not think we need to change that.

Quoted 2 lines

Even on x86, the script will bail out with "Cannot find LILO." if you're using Grub.

The last change in this series tries to "soften" that language so that isn't really an issue anymore.

I want to turn this into something that everyone can use, so we do not have to rely on distro-specific or other external programs, as trying to explain how to install a kernel to someone new to kernel development is a real pain.

Quoted 1 line

Anyway, having less of them is good.

Agreed, thanks for the review :)

greg k-h

#54 lore raw
Quoted 20 lines · Greg Kroah-Hartman
Quoted 19 lines · Geert Uytterhoeven

Hi Greg,

Thanks for your series!

Quoted 12 lines · Greg Kroah-Hartman

Almost every architecture has copied the "install.sh" script that originally came with i386, and modified it in very tiny ways. This patch series unifies all of these scripts into one single script to allow people to understand how to correctly install a kernel, and fixes up some issues regarding trying to install a kernel to a path with spaces in it.

Note that not all architectures actually seem to have any type of way to install a kernel, they must rely on external scripts or tools which feels odd as everything should be included here in the main repository. I'll work on trying to figure out the missing architecture issues afterward.

Quoted 3 lines
Quoted 3 lines

I'll bite ;-)

Does anyone actually use these scripts (outside of x86)?

Yes, every time I build a kernel. My kernel build system involves typing "kbuild <flags> <dirname> <machines...>" and the kernel gets built in ../build/<dirname>. When the build completes, it gets installed into ~/systems/<dirname>, tar'd up, and copied to the destination machines, unpacked, installed as appropriate, and the machine rebooted if requested.

The installation step is done via the ~/bin/installkernel script.

Quoted 6 lines
Quoted 6 lines

I assume the architectures that have them, only have them because they were copied from x86 while doing the initial ports ("oh, a file I don't have to modify at all.").
But installing the kernel can be very platform-specific.
Do you need the vmlinux, vmlinux.gz, Image, zImage, uImage, ...? With separate or appended DTB?

My scripts deal with all that.

However, I haven't been able to review the changes that are being made because I have no visibility of the common "scripts" version. Provided it offers exactly the same functionality as the arm32 version, I'm happy. If it doesn't, it may cause a regression, and I will be reporting that.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
#55 lore raw
Quoted 25 lines · Russell King - ARM Linux admin
Quoted 20 lines · Greg Kroah-Hartman
Quoted 19 lines · Geert Uytterhoeven

Hi Greg,

Thanks for your series!

Quoted 12 lines · Greg Kroah-Hartman

Almost every architecture has copied the "install.sh" script that originally came with i386, and modified it in very tiny ways. This patch series unifies all of these scripts into one single script to allow people to understand how to correctly install a kernel, and fixes up some issues regarding trying to install a kernel to a path with spaces in it.

Note that not all architectures actually seem to have any type of way to install a kernel, they must rely on external scripts or tools which feels odd as everything should be included here in the main repository. I'll work on trying to figure out the missing architecture issues afterward.

Quoted 3 lines
Quoted 3 lines

I'll bite ;-)

Does anyone actually use these scripts (outside of x86)?

Quoted 8 lines

Yes, every time I build a kernel. My kernel build system involves typing "kbuild <flags> <dirname> <machines...>" and the kernel gets built in ../build/<dirname>. When the build completes, it gets installed into ~/systems/<dirname>, tar'd up, and copied to the destination machines, unpacked, installed as appropriate, and the machine rebooted if requested.

The installation step is done via the ~/bin/installkernel script.

So you don't use install.sh at all except to invoke your local script.

Quoted 7 lines
Quoted 6 lines
Quoted 6 lines

I assume the architectures that have them, only have them because they were copied from x86 while doing the initial ports ("oh, a file I don't have to modify at all.").
But installing the kernel can be very platform-specific.
Do you need the vmlinux, vmlinux.gz, Image, zImage, uImage, ...? With separate or appended DTB?

Quoted 7 lines

My scripts deal with all that.

However, I haven't been able to review the changes that are being made because I have no visibility of the common "scripts" version. Provided it offers exactly the same functionality as the arm32 version, I'm happy. If it doesn't, it may cause a regression, and I will be reporting that.

It should be identical, if I got something wrong please let me know.

thanks,

greg k-h

#56 lore raw
Quoted 33 lines · Greg Kroah-Hartman
Quoted 32 lines · Russell King - ARM Linux admin
Quoted 20 lines · Greg Kroah-Hartman
Quoted 19 lines · Geert Uytterhoeven

Hi Greg,

Thanks for your series!

Quoted 12 lines · Greg Kroah-Hartman

Almost every architecture has copied the "install.sh" script that originally came with i386, and modified it in very tiny ways. This patch series unifies all of these scripts into one single script to allow people to understand how to correctly install a kernel, and fixes up some issues regarding trying to install a kernel to a path with spaces in it.

Note that not all architectures actually seem to have any type of way to install a kernel, they must rely on external scripts or tools which feels odd as everything should be included here in the main repository. I'll work on trying to figure out the missing architecture issues afterward.

Quoted 3 lines
Quoted 3 lines

I'll bite ;-)

Does anyone actually use these scripts (outside of x86)?

Yes, every time I build a kernel. My kernel build system involves typing "kbuild <flags> <dirname> <machines...>" and the kernel gets built in ../build/<dirname>. When the build completes, it gets installed into ~/systems/<dirname>, tar'd up, and copied to the destination machines, unpacked, installed as appropriate, and the machine rebooted if requested.

Quoted 3 lines
Quoted 1 line

The installation step is done via the ~/bin/installkernel script.

So you don't use install.sh at all except to invoke your local script.

It depends where the kernel is being built; it has been used in the past (one will notice that the arm32 version is not a direct copy of the x86 version, and never was - it was modified from day 1.) It's placement and naming of the files in /boot is still used today, which is slightly different from the x86 version.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
#57 lore raw
Quoted 36 lines · Russell King - ARM Linux admin
Quoted 35 lines · Greg Kroah-Hartman
Quoted 33 lines · Russell King - ARM Linux admin
Quoted 20 lines · Greg Kroah-Hartman
Quoted 19 lines · Geert Uytterhoeven

Hi Greg,

Thanks for your series!

Quoted 12 lines · Greg Kroah-Hartman

Almost every architecture has copied the "install.sh" script that originally came with i386, and modified it in very tiny ways. This patch series unifies all of these scripts into one single script to allow people to understand how to correctly install a kernel, and fixes up some issues regarding trying to install a kernel to a path with spaces in it.

Note that not all architectures actually seem to have any type of way to install a kernel, they must rely on external scripts or tools which feels odd as everything should be included here in the main repository. I'll work on trying to figure out the missing architecture issues afterward.

Quoted 3 lines
Quoted 3 lines

I'll bite ;-)

Does anyone actually use these scripts (outside of x86)?

Yes, every time I build a kernel. My kernel build system involves typing "kbuild <flags> <dirname> <machines...>" and the kernel gets built in ../build/<dirname>. When the build completes, it gets installed into ~/systems/<dirname>, tar'd up, and copied to the destination machines, unpacked, installed as appropriate, and the machine rebooted if requested.

The installation step is done via the ~/bin/installkernel script.

Quoted 7 lines
Quoted 1 line

So you don't use install.sh at all except to invoke your local script.

It depends where the kernel is being built; it has been used in the past (one will notice that the arm32 version is not a direct copy of the x86 version, and never was - it was modified from day 1.) It's placement and naming of the files in /boot is still used today, which is slightly different from the x86 version.

The placement depends on the caller to the script, so that's not an issue here. The name for the output does differ from x86, but the "common" script handles all of that (or it should, if not I messed up.)

Attached below is the common scripts/install.sh that this patch series produces at the end of it, if you want to check to see if I missed anything for your arch.

thanks,

greg k-h

#58 lore raw
Quoted 50 lines · Greg Kroah-Hartman
Quoted 36 lines · Russell King - ARM Linux admin
Quoted 35 lines · Greg Kroah-Hartman
Quoted 33 lines · Russell King - ARM Linux admin
Quoted 20 lines · Greg Kroah-Hartman
Quoted 19 lines · Geert Uytterhoeven

Hi Greg,

Thanks for your series!

Quoted 12 lines · Greg Kroah-Hartman

Almost every architecture has copied the "install.sh" script that originally came with i386, and modified it in very tiny ways. This patch series unifies all of these scripts into one single script to allow people to understand how to correctly install a kernel, and fixes up some issues regarding trying to install a kernel to a path with spaces in it.

Note that not all architectures actually seem to have any type of way to install a kernel, they must rely on external scripts or tools which feels odd as everything should be included here in the main repository. I'll work on trying to figure out the missing architecture issues afterward.

Quoted 3 lines
Quoted 3 lines

I'll bite ;-)

Does anyone actually use these scripts (outside of x86)?

Yes, every time I build a kernel. My kernel build system involves typing "kbuild <flags> <dirname> <machines...>" and the kernel gets built in ../build/<dirname>. When the build completes, it gets installed into ~/systems/<dirname>, tar'd up, and copied to the destination machines, unpacked, installed as appropriate, and the machine rebooted if requested.

The installation step is done via the ~/bin/installkernel script.

Quoted 7 lines
Quoted 1 line

So you don't use install.sh at all except to invoke your local script.

It depends where the kernel is being built; it has been used in the past (one will notice that the arm32 version is not a direct copy of the x86 version, and never was - it was modified from day 1.) It's placement and naming of the files in /boot is still used today, which is slightly different from the x86 version.

The placement depends on the caller to the script, so that's not an issue here. The name for the output does differ from x86, but the "common" script handles all of that (or it should, if not I messed up.)

Quoted 7 lines

Attached below is the common scripts/install.sh that this patch series produces at the end of it, if you want to check to see if I missed anything for your arch.

thanks,

greg k-h

Thanks for nice cleanups!

I will give some nit-picking comments to individual patches. Overall, this series looks nice.

Signature · 2 lines
Best Regards
Masahiro Yamada
#59 lore raw
In reply to Greg Kroah-Hartman
Quoted 6 lines · Greg Kroah-Hartman

Almost every architecture has copied the "install.sh" script that originally came with i386, and modified it in very tiny ways. This patch series unifies all of these scripts into one single script to allow people to understand how to correctly install a kernel, and fixes up some issues regarding trying to install a kernel to a path with spaces in it.

Yay consolidation! Thanks for digging into this.

I sent Reviewed-by:s for a bunch of these, and agree with the things Masahiro has suggested with regard to quoting, etc. I look forward to v2.

-Kees

Signature · 1 line
Kees Cook