初期化/終了スクリプト

Debian TS-WXL

SoftwareDesign 2010/2 P144 リスト1のスクリプトをベースに、 TS-WXL 向けの修正を行う。

スクリプトの作成

tswxl:~# vi /etc/init.d/miconapl
	:
	:
tswxl:~# cat !$
cat /etc/init.d/miconapl
#!/bin/sh

[ -f /usr/local/sbin/miconapl ] || exit 0

case "$1" in
  start)
        ldconfig
        /usr/local/sbin/miconapl -b -a boot_flash_ok
        /usr/local/sbin/miconapl -a boot_end
        /usr/local/sbin/miconapl -a serialmode_console
        ;;
  stop)
        /usr/local/sbin/miconapl -a shutdown_wait
        /usr/local/sbin/miconapl -a lcd_set_dispitem off
        /usr/local/sbin/miconapl -a led_set_cpu_mcon off
        /usr/local/sbin/miconapl -a led_set_on_off off
        /usr/local/sbin/miconapl -a led_set_brink off
        ;;
  *)
        echo "Usage: $0 {start|stop}"
        exit 1
esac

exit 0

tswxl:~#

シンボリックリンク

起動時、終了時に実行されるよう、シンボリックリンクを張る。
SoftwareDesign 2010/2 P145 図11
tswxl:~# chmod +x !$
chmod +x /etc/init.d/miconapl
tswxl:~# cd /etc/rc0.d/
tswxl:/etc/rc0.d# ln -s ../init.d/miconapl /etc/rc0.d/K10miconapl
tswxl:/etc/rc0.d# ln -s ../init.d/miconapl /etc/rc6.d/K10miconapl
tswxl:/etc/rc0.d# ln -s ../init.d/miconapl /etc/rcS.d/S80miconapl
tswxl:/etc/rc0.d#

再起動

tswxl:/etc/rc0.d# shutdown -h now
	:
	:
電源ボタンを押して起動

シリアルコンソールからログイン

Debian GNU/Linux 5.0 tswxl ttyS0

tswxl login:
Debian GNU/Linux 5.0 tswxl ttyS0

tswxl login: root
Password:
Last login: Wed Apr  7 06:53:14 JST 2010 on ttyS0
Linux tswxl 2.6.22.18-mv78100 #134 Thu Feb 4 11:14:40 JST 2010 armv5tejl

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
1 failure since last login.
Last was Wed Apr  7 07:23:54 2010 on pts/0.
tswxl:~# tty
/dev/ttyS0
tswxl:~#

シャットダウン

tswxl:~# shutdown -h now
INIT: Sending processBuffaloGpio_ChangePowerStatus > Writing 0x02
Stopping internet superserver: inetd.
Saving the system clock.
Cannot access the Hardware Clock via any known method.
Use the --debug option to see the details of our search for an access method.
Stopping enhanced syslogd: rsyslogd.
Asking all remaining processes to terminate...done.
All processes ended within 1 seconds....done.
Deconfiguring network interfaces...eth0: stopped
done.
Cleaning up ifupdown....
Deactivating swap...done.
Unmounting local filesystems...done.
Will now halt.
md: stopping all md devices.
md: md1 still in use.
md: md10 switched to read-only mode.
md: md0 switched to read-only mode.
sd 0:0:0:0: [sda] Synchronizing SCSI cache
System halted.
BuffaloChangePowerStatusBeforeHalt > Check power status. MagicKey = 0x02
BuffaloGpio_ChangePowerStatus > Writing 0x7a
BuffaloChangePowerStatusBeforeHalt > Changed to 0x7a from 0x02
>miconCntl_PowerOff
>miconCntl_ShutdownWait
無事、落ちた。

TS-WXL
楽天市場
amazon
Yahoo ショッピング
Livedoor デパート


miconapl で終了処理(2)
ハックの記録
LinkStation/玄箱 をハックしよう

電源SWでシャットダウン

Copyright (C) 2003-2010 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市