LoongArch: Adjust the 'make install' operation
v3 cover LoongArch: Adjust the 'make install' operation
Changelog:
v3:
* Add a copy of the kernel config file.
* Some minor adjustments.
v2:
* Adjust the patch sequence.
* Adjust the title information.
* Distinguish between vmlinux.efi and vmlinux.elf in install.sh
* Correct minor mistakes.
Youling Tang (3):
LoongArch: Add a default install.sh
LoongArch: Using generic scripts/install.sh in make install
LoongArch: Add some annotations in archhelp
arch/loongarch/Makefile | 11 ++++--- arch/loongarch/boot/install.sh | 56 ++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 4 deletions(-) create mode 100755 arch/loongarch/boot/install.sh
Signature · 1 line
2.38.1
PATCH v3 1/3 LoongArch: Add a default install.sh
From: Youling Tang <[email protected]>
As specified in scripts/install.sh, the priority order is as follows (from highest to lowest):
~/bin/installkernel
/sbin/installkernel
arch/loongarch/boot/install.sh
Fallback to default install.sh if installkernel is not found.
--- arch/loongarch/boot/install.sh | 56 ++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 arch/loongarch/boot/install.sh
arch/loongarch/boot/install.sh new file +56 -0
@@ -0,0 +1,56 @@ +#!/bin/sh +# +# This file is subject to the terms and conditions of the GNU General Public +# License. See the file "COPYING" in the main directory of this archive +# for more details. +# +# Copyright (C) 1995 by Linus Torvalds +# +# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin +# Adapted from code in arch/i386/boot/install.sh by Russell King +# +# "make install" script for the LoongArch Linux port +# +# Arguments: +# $1 - kernel version +# $2 - kernel image file +# $3 - kernel map file +# $4 - default install path (blank if root directory) + +set -e + +case "${2##*/}" in +vmlinux.elf) + echo "Installing uncompressed vmlinux.elf kernel" + base=vmlinux + ;; +vmlinux.efi) + echo "Installing uncompressed vmlinux.efi kernel" + base=vmlinux + ;; +vmlinuz.efi) + echo "Installing gzip/zstd compressed vmlinuz.efi kernel" + base=vmlinuz + ;; +*) + echo "Warning: Unexpected kernel type" + exit 1 + ;; +esac + +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 + +# Install kernel config file +if [ -f $4/config-$1 ]; then + mv $4/config-$1 $4/config-$1.old +fi +cp .config $4/config-$1
Signature · 1 line
2.38.1
PATCH v3 2/3 LoongArch: Using generic scripts/install.sh in `make install`
In reply to Youling TangFrom: Youling Tang <[email protected]>
Use the generic script/install.sh to perform the make install operation. This will automatically generate the initrd file and modify the grub.cfg without manual intervention (The previous kernel image, config file and System.map will also be generated), similar to other architectures.
--- arch/loongarch/Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/loongarch/Makefile +1 -3
@@ -181,9 +181,7 @@ vmlinux.elf vmlinux.efi vmlinuz.efi: vmlinux $(Q)$(MAKE) $(build)=$(boot) $(bootvars-y) $(boot)/$@ install: - $(Q)install -D -m 755 $(KBUILD_IMAGE) $(INSTALL_PATH)/$(image-name-y)-$(KERNELRELEASE) - $(Q)install -D -m 644 .config $(INSTALL_PATH)/config-$(KERNELRELEASE) - $(Q)install -D -m 644 System.map $(INSTALL_PATH)/System.map-$(KERNELRELEASE) + $(call cmd,install) define archhelp echo ' install - install kernel into $(INSTALL_PATH)'
Signature · 1 line
2.38.1
PATCH v3 3/3 LoongArch: Add some annotations in archhelp
In reply to Youling TangFrom: Youling Tang <[email protected]>
- Add annotations to the kernel image.
- Modify the annotations of make insatll.
--- arch/loongarch/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/loongarch/Makefile +6 -1
@@ -184,6 +184,11 @@ install: $(call cmd,install) define archhelp - echo ' install - install kernel into $(INSTALL_PATH)' + echo ' vmlinux.elf - Uncompressed ELF kernel image (arch/loongarch/boot/vmlinux.elf)' + echo ' vmlinux.efi - Uncompressed EFI kernel image (arch/loongarch/boot/vmlinux.efi)' + echo ' vmlinuz.efi - GZIP/ZSTD-compressed EFI kernel image (arch/loongarch/boot/vmlinuz.efi)' + echo ' Default when CONFIG_EFI_ZBOOT=y' + echo ' install - Install kernel using (your) ~/bin/$(INSTALLKERNEL) or' + echo ' (distribution) /sbin/$(INSTALLKERNEL) or install.sh to $$(INSTALL_PATH)' echo endef
Signature · 1 line
2.38.1
Applied, thanks.
Huacai
Quoted 25 lines · Youling Tang
Changelog:
v3:
* Add a copy of the kernel config file.
* Some minor adjustments.v2:
* Adjust the patch sequence.
* Adjust the title information.
* Distinguish between vmlinux.efi and vmlinux.elf ininstall.sh
* Correct minor mistakes.Youling Tang (3):
LoongArch: Add a defaultinstall.sh
LoongArch: Using genericscripts/install.shinmake install
LoongArch: Add some annotations in archhelparch/loongarch/Makefile | 11 ++++--- arch/loongarch/boot/install.sh | 56 ++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 4 deletions(-) create mode 100755 arch/loongarch/boot/install.sh--
2.38.1