From 1e0db73a4813c68c4acfb8e6b75f1cd967aa68e1 Mon Sep 17 00:00:00 2001 From: Naoki Hamada Date: Fri, 1 Aug 2014 09:16:53 +0900 Subject: [PATCH] Add files from master. --- arch/x86/tools/mcreboot-attached-mic.sh | 112 ++++++++++++++++++++++ arch/x86/tools/mcreboot.1 | 36 +++++++ arch/x86/tools/mcshutdown-attached-mic.sh | 16 ++++ 3 files changed, 164 insertions(+) create mode 100644 arch/x86/tools/mcreboot-attached-mic.sh create mode 100644 arch/x86/tools/mcreboot.1 create mode 100644 arch/x86/tools/mcshutdown-attached-mic.sh diff --git a/arch/x86/tools/mcreboot-attached-mic.sh b/arch/x86/tools/mcreboot-attached-mic.sh new file mode 100644 index 00000000..8b08584a --- /dev/null +++ b/arch/x86/tools/mcreboot-attached-mic.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# \file arch/x86/tools/mcreboot-attached-mic.sh.in +# License details are found in the file LICENSE. +# \brief +# mckernel boot script +# \author Masamichi Takagi \par +# Copyright (C) 2013 NEC Corporation +# \author Tomoki Shirasawa \par +# Copyright (C) 2012 - 2013 Hitachi, Ltd. + +# HISTORY: +# + +prefix="/opt/ppos" +BINDIR="/opt/ppos/bin" +SBINDIR="/opt/ppos/sbin" +KMODDIR="/opt/ppos/kmod" +KERNDIR="/opt/ppos/attached/kernel" + +if ! lspci | grep 'Co-processor.*Intel Corporation' > /dev/null 2>&1; then + echo No Intel co-processor found. >&2 + exit 1 +fi + +echo "removing kernel modules..." >&2 +modules_were_loaded="0" + +if [ "`service mpss status 2> /dev/null`" != "mpss is stopped" ]; then + modules_were_loaded="1" + sudo service mpss stop +fi +if lsmod | awk 'BEGIN{rc=1}$1 == "mic"{rc=0}END{exit(rc)}'; then + modules_were_loaded="1" + sudo service mpss unload +fi + +"$SBINDIR/ihkosctl" 0 shutdown + +for mod_name in mcctrl ihk_mic ihk; do + if lsmod | awk 'BEGIN{rc=1}$1 == "'"$mod_name"'"{rc=0}END{exit(rc)}'; then + modules_were_loaded="1" + echo "rmmod $mod_name" >&2 + if rmmod $mod_name; then + echo "$mod_name removed succesfully" >&2 + sleep 1 + else + echo "ERROR: couldn't remove $mod_name" >&2 + exit 1 + fi + fi +done + +echo "removing kernel modules done" >&2 + +if [ "$1" == "-u" ]; then + exit +fi + +wait_time=10 + +if [ "$modules_were_loaded" == "1" ]; then + echo "waiting for ${wait_time} seconds: " >&2 + while [ "$wait_time" != 0 ]; do + echo -n "$wait_time " >&2 + sleep 1 + let wait_time=(${wait_time}-1) + done + echo "" >&2 +fi + +if [ "$1" == "-w" ]; then + shift 1 + echo "press enter to continue" >&2 + read enter_press +fi + + +for mod_path in "$KMODDIR/ihk.ko" "$KMODDIR/ihk_mic.ko" "$KMODDIR/mcctrl.ko"; do + if insmod $mod_path; then + sleep 1 + echo "$mod_path inserted succesfully" >&2 + else + echo "ERROR: couldn't insert $mod_path" >&2 + exit 1 + fi + + if [ "$mod_path" == "$KMODDIR/ihk_mic.ko" ]; then + echo "creating OS device" >&2 + sleep 1 + "$SBINDIR/ihkconfig" 0 create + sleep 1 + fi + + if [ "$mod_path" == "$KMODDIR/mcctrl.ko" ]; then + if [ $# -gt 0 ]; then + echo "setting kernel parameter to: \"$1\"" >&2 + "$SBINDIR/ihkosctl" 0 kargs "$1" + sleep 1 + else + echo "setting kernel parameter to: \"hidos\"" >&2 + "$SBINDIR/ihkosctl" 0 kargs "hidos" + sleep 1 + fi + echo "using kernel image: $KERNDIR/mckernel.img" >&2 + "$SBINDIR/ihkosctl" 0 load "$KERNDIR/mckernel.img" + sleep 1 + echo "booting OS 0" >&2 + "$SBINDIR/ihkosctl" 0 boot + sleep 1 + fi +done diff --git a/arch/x86/tools/mcreboot.1 b/arch/x86/tools/mcreboot.1 new file mode 100644 index 00000000..95790d62 --- /dev/null +++ b/arch/x86/tools/mcreboot.1 @@ -0,0 +1,36 @@ +.\" Man page for McKernel +.\" mcreboot +.\" +.\" Copyright (C) 2013 The University of Tokyo, Japan +.\" Written by Yutaka Ishikawa +.\" +.TH MCREBOOT 1 "2013-11-18" "Version 0.9.0" MCKERNEL 0.9.0" +.SH NAME +mcreboot \- a script to boot/reboot the McKernel environment +.\" + +.\" ---------------------------- SYNOPSIS ---------------------------- +.SH SYNOPSIS +mcreboot + +.BR +.\" ---------------------------- DESCRIPTION ---------------------------- +.SH DESCRIPTION +The mcreboot command, executed by the root privileged mode, shutdowns +the MPSS environment if it is running, and then initializes the +McKernel environment. + +.\" ---------------------------- FILES ---------------------------- +.SH FILES +.LP +.I mcctrl, +.I ihk_mic, +.I ihk + +.\" ---------------------------- SEE ALSO ---------------------------- +.SH SEE ALSO +ihkosctl (1) + +.\" ---------------------------- AUTHORS ---------------------------- +.SH AUTHORS +Copyright (C) 2013 McKernel Development Team, The University of Tokyo, Japan diff --git a/arch/x86/tools/mcshutdown-attached-mic.sh b/arch/x86/tools/mcshutdown-attached-mic.sh new file mode 100644 index 00000000..4b08bac3 --- /dev/null +++ b/arch/x86/tools/mcshutdown-attached-mic.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# \file arch/x86/tools/mcshutdown-attached-mic.sh.in +# License details are found in the file LICENSE. +# \brief +# mckernel shutdown script +# +# \author McKernel Development Team +# + +prefix="/opt/ppos" +BINDIR="/opt/ppos/bin" +SBINDIR="/opt/ppos/sbin" +KMODDIR="/opt/ppos/kmod" +KERNDIR="/opt/ppos/attached/kernel" + +"$SBINDIR/ihkosctl" 0 shutdown