Add reboot and shutdown script for builtin-x86
It decides the number of cores for McKernel by looking into the "SHIMOS: CPU Status:" line of dmesg. It sets the amount of memory for McKernel to one urth of the total memory obtained by "free -g".
This commit is contained in:
17
Makefile.in
17
Makefile.in
@ -27,13 +27,26 @@ install::
|
||||
exit 1 \
|
||||
;; \
|
||||
esac
|
||||
if [ "$(TARGET)" = attached-mic ]; then \
|
||||
@case "$(TARGET)" in \
|
||||
attached-mic) \
|
||||
mkdir -p -m 755 $(SBINDIR); \
|
||||
install -m 755 arch/x86/tools/mcreboot-attached-mic.sh $(SBINDIR)/mcreboot; \
|
||||
install -m 755 arch/x86/tools/mcshutdown-attached-mic.sh $(SBINDIR)/mcshutdown; \
|
||||
mkdir -p -m 755 $(MANDIR)/man1; \
|
||||
install -m 644 arch/x86/tools/mcreboot.1 $(MANDIR)/man1/mcreboot.1; \
|
||||
fi
|
||||
;; \
|
||||
builtin-x86) \
|
||||
mkdir -p -m 755 $(SBINDIR); \
|
||||
install -m 755 arch/x86/tools/mcreboot-builtin-x86.sh $(SBINDIR)/mcreboot; \
|
||||
install -m 755 arch/x86/tools/mcshutdown-builtin-x86.sh $(SBINDIR)/mcshutdown; \
|
||||
mkdir -p -m 755 $(MANDIR)/man1; \
|
||||
install -m 644 arch/x86/tools/mcreboot.1 $(MANDIR)/man1/mcreboot.1; \
|
||||
;; \
|
||||
*) \
|
||||
echo "unknown target $(TARGET)" >&2 \
|
||||
exit 1 \
|
||||
;; \
|
||||
esac
|
||||
|
||||
clean::
|
||||
@(cd executer/kernel; make clean)
|
||||
|
||||
46
arch/x86/tools/mcreboot-builtin-x86.sh.in
Executable file
46
arch/x86/tools/mcreboot-builtin-x86.sh.in
Executable file
@ -0,0 +1,46 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
# \file arch/x86/tools/mcreboot-builtin-x86.sh.in
|
||||
# License details are found in the file LICENSE.
|
||||
# \brief
|
||||
# mckernel boot script
|
||||
# \author Masamichi Takagi <masamichi.takagi@riken.jp> \par
|
||||
# Copyright (C) 2014 RIKEN AICS
|
||||
|
||||
# HISTORY:
|
||||
#
|
||||
|
||||
prefix="@prefix@"
|
||||
BINDIR="@BINDIR@"
|
||||
SBINDIR="@SBINDIR@"
|
||||
KMODDIR="@KMODDIR@"
|
||||
KERNDIR="@KERNDIR@"
|
||||
|
||||
ps axg -opid,comm | awk '$2 == "mcexec"{print $1}' | while read i; do kill -9 $i; done
|
||||
if lsmod | grep mcctrl > /dev/null 2>&1; then
|
||||
rmmod mcctrl || exit 1
|
||||
fi
|
||||
if lsmod | grep dcfa > /dev/null 2>&1; then
|
||||
rmmod dcfa || exit 1
|
||||
fi
|
||||
if lsmod | grep ihk_builtin > /dev/null 2>&1; then
|
||||
rmmod ihk_builtin || exit 1
|
||||
fi
|
||||
if lsmod | grep ihk > /dev/null 2>&1; then
|
||||
rmmod ihk || exit 1
|
||||
fi
|
||||
insmod "$KMODDIR/ihk.ko" &&
|
||||
insmod "$KMODDIR/ihk_builtin.ko" &&
|
||||
"$SBINDIR/ihkconfig" 0 create &&
|
||||
NCORE=`dmesg | grep -E 'SHIMOS: CPU Status:'|awk '{split($0,a," "); for (i = 1; i <= length(a); i++) { if(a[i] ~ /2/) {count++}} print count;}'`
|
||||
MEM=`free -g | grep -E 'Mem:' | awk '{print int($2/4)}'`
|
||||
"$SBINDIR/ihkosctl" 0 alloc "$NCORE" "$MEM"g &&
|
||||
"$SBINDIR/ihkosctl" 0 load "$KERNDIR/mckernel.img" &&
|
||||
"$SBINDIR/ihkosctl" 0 kargs hidos osnum=0 &&
|
||||
"$SBINDIR/ihkosctl" 0 boot &&
|
||||
sleep 1 &&
|
||||
"$SBINDIR/ihkosctl" 0 kmsg &&
|
||||
insmod "$KMODDIR/mcctrl.ko" &&
|
||||
sleep 1 &&
|
||||
"$SBINDIR/ihkosctl" 0 kmsg &&
|
||||
exit 0
|
||||
16
arch/x86/tools/mcshutdown-builtin-x86.sh.in
Normal file
16
arch/x86/tools/mcshutdown-builtin-x86.sh.in
Normal file
@ -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="@prefix@"
|
||||
BINDIR="@BINDIR@"
|
||||
SBINDIR="@SBINDIR@"
|
||||
KMODDIR="@KMODDIR@"
|
||||
KERNDIR="@KERNDIR@"
|
||||
|
||||
"$SBINDIR/ihkosctl" 0 shutdown
|
||||
@ -145,6 +145,8 @@ AC_CONFIG_FILES([
|
||||
kernel/Makefile.build
|
||||
arch/x86/tools/mcreboot-attached-mic.sh
|
||||
arch/x86/tools/mcshutdown-attached-mic.sh
|
||||
arch/x86/tools/mcreboot-builtin-x86.sh
|
||||
arch/x86/tools/mcshutdown-builtin-x86.sh
|
||||
arch/x86/tools/mcreboot.1:arch/x86/tools/mcreboot.1in
|
||||
])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user