Skip to contentSkip to conversation

LoongArch: Adjust the 'make install' operation

PATCH Superseded Youling Tang 1 participant 4 messages Apr 21, 2025 LoongArch

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover LoongArch: Adjust the 'make install' operation

Changelog:
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 fallback install.sh
LoongArch: Using a generic scripts/install.sh in make install
LoongArch: Add some annotations in archhelp

 arch/loongarch/Makefile        | 11 ++++---
 arch/loongarch/boot/install.sh | 53 ++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 4 deletions(-)
 create mode 100755 arch/loongarch/boot/install.sh
Signature · 1 line
2.38.1
#1 lore raw

PATCH v2 1/3 LoongArch: Add fallback 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 not found.

---
 arch/loongarch/boot/install.sh | 53 ++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100755 arch/loongarch/boot/install.sh
arch/loongarch/boot/install.sh new file +53 -0
new file mode 100755
index 000000000000..7ce76810b8b7
@@ -0,0 +1,53 @@
+#!/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
+# Compressed install
+vmlinuz.efi)
+  echo "Installing compressed vmlinuz.efi kernel"
+  base=vmlinuz
+  ;;
+# Uncompressed install
+vmlinux.efi)
+  echo "Installing uncompressed vmlinux.efi kernel"
+  base=vmlinux
+  ;;
+vmlinux.elf)
+  echo "Installing uncompressed vmlinux.elf kernel"
+  base=vmlinux
+  ;;
+# Unexpected type
+*)
+ echo "Warning: Not expected 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
Signature · 1 line
2.38.1
#2 lore raw

PATCH v2 2/3 LoongArch: Using a generic scripts/install.sh in `make install`

In reply to Youling Tang

From: 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 grub.cfg without manual intervention (The previous image 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
index 0304eabbe606..64bdb52ddf7c 100644
@@ -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
#3 lore raw

PATCH v2 3/3 LoongArch: Add some annotations in archhelp

In reply to Youling Tang

From: Youling Tang <[email protected]>

- Add annotations to the kernel image.
- Modify the annotations of insatll.

---
 arch/loongarch/Makefile | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/loongarch/Makefile +6 -1
index 64bdb52ddf7c..5711fe0efa76 100644
@@ -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          - 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 (distribution)'
+	echo '                         /sbin/$(INSTALLKERNEL) or install.sh to $$(INSTALL_PATH)'
 	echo
 endef
Signature · 1 line
2.38.1