Skip to contentSkip to conversation

riscv: Add install target to Makefile.

PATCH Superseded Shea Levy 2 participants 3 messages Feb 20, 2018 – Feb 24, 2018 RISC-V

lore
Share & tools
lore

Shea Levy

author
#0 lore raw

PATCH 1/1 riscv: Add install target to Makefile.

---
 arch/riscv/Makefile   |  4 ++++
 arch/riscv/install.sh | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)
 create mode 100644 arch/riscv/install.sh
arch/riscv/Makefile +4 -0
index 6719dd30ec5b..26892daefa05 100644
@@ -70,3 +70,7 @@ core-y += arch/riscv/kernel/ arch/riscv/mm/
 libs-y += arch/riscv/lib/
 
 all: vmlinux
+
+PHONY += install
+install: vmlinux
+	sh $(srctree)/arch/riscv/install.sh $(KERNELRELEASE) $< System.map "$(INSTALL_PATH)"
arch/riscv/install.sh new file +39 -0
new file mode 100644
index 000000000000..8b3155a11a4a
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# arch/riscv/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/ia64/Makefile by Shea Levy
+#
+# "make install" script for riscv 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 - no bootloader configuration (yet?)
+base=$(basename $2)
+
+if [ -f $4/$base ]; then
+	mv $4/$base $4/$base.old
+fi
+
+if [ -f $4/System.map ]; then
+	mv $4/System.map $4/System.old
+fi
+
+cat $2 > $4/$base
+cp $3 $4/System.map
Signature · 1 line
2.16.1
author
#1 lore raw

PATCH v2 1/1 riscv: Add install target to Makefile.

v2: Fix copy-paste error in comment.

---
 arch/riscv/Makefile   |  4 ++++
 arch/riscv/install.sh | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)
 create mode 100644 arch/riscv/install.sh
arch/riscv/Makefile +4 -0
index 6719dd30ec5b..26892daefa05 100644
@@ -70,3 +70,7 @@ core-y += arch/riscv/kernel/ arch/riscv/mm/
 libs-y += arch/riscv/lib/
 
 all: vmlinux
+
+PHONY += install
+install: vmlinux
+	sh $(srctree)/arch/riscv/install.sh $(KERNELRELEASE) $< System.map "$(INSTALL_PATH)"
arch/riscv/install.sh new file +39 -0
new file mode 100644
index 000000000000..b98c1db899f1
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# arch/riscv/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/ia64/install.sh by Shea Levy
+#
+# "make install" script for riscv 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 - no bootloader configuration (yet?)
+base=$(basename $2)
+
+if [ -f $4/$base ]; then
+	mv $4/$base $4/$base.old
+fi
+
+if [ -f $4/System.map ]; then
+	mv $4/System.map $4/System.old
+fi
+
+cat $2 > $4/$base
+cp $3 $4/System.map
Signature · 1 line
2.16.1
#2 lore raw

PATCH v2 1/1 riscv: Add install target to Makefile.

Quoted 56 lines · shea at shealevy.com

v2: Fix copy-paste error in comment.

---
 arch/riscv/Makefile   |  4 ++++
 arch/riscv/install.sh | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)
 create mode 100644 arch/riscv/install.sh
arch/riscv/Makefile +4 -0
index 6719dd30ec5b..26892daefa05 100644
@@ -70,3 +70,7 @@ core-y += arch/riscv/kernel/ arch/riscv/mm/
 libs-y += arch/riscv/lib/
 
 all: vmlinux
+
+PHONY += install
+install: vmlinux
+	sh $(srctree)/arch/riscv/install.sh $(KERNELRELEASE) $< System.map "$(INSTALL_PATH)"
arch/riscv/install.sh new file +29 -0
new file mode 100644
index 000000000000..b98c1db899f1
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# arch/riscv/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/ia64/install.sh by Shea Levy
+#
+# "make install" script for riscv 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 - no bootloader configuration (yet?)
+base=$(basename $2)
+

arch/riscv/install.sh line 39

Quoted 10 lines
arch/riscv/install.sh new file +10 -0
+if [ -f $4/$base ]; then
+	mv $4/$base $4/$base.old
+fi
+
+if [ -f $4/System.map ]; then
+	mv $4/System.map $4/System.old
+fi
+
+cat $2 > $4/$base
+cp $3 $4/System.map

Thanks. I'm targeting this for linux-next now.