必要なファイルを準備する
u-bootを導入した玄箱にまずはDebian Lennyをセットアップする。カーネルを3.x系を導入し、最終的にはSqueezeを経てWheezyを目指す。
最初に必要なファイルを手に入れる。
- debian-lenny-kuroBOX-20090317.tgz
玄箱に Debian 5.0 (lenny) をインストールする - Revulo's Laboratory - linux-image-3.2.0.24-kurobox.tar.gz
linux-modules-3.2.0.24-kurobox.tar.gz
玄箱/玄箱HG 用 ubuntu 12.04 LTS image
(玄箱HGのEMモードのrootのパスワードはkuroadminとなってる。)
"/mnt"にHDDの下準備で作成したブート領域(/dev/hda1)をマウントする。
"/mnt2"にルート領域(/dev/hda3)をマウントする。
ダウンロードしたファイルをftpで"/mnt2"にアップロードする。# mount /dev/hda1 /mnt # mount /dev/hda3 /mnt2
# cd /mnt2 # ls -l -rwxrw-r-- 1 nobody nogroup 52163601 Oct 1 00:00 debian-lenny-kuroBOX-20090317.tgz -rwxrw-r-- 1 nobody nogroup 2430847 Oct 1 00:00 linux-image-3.2.0.24-kurobox.tar.gz -rwxrw-r-- 1 nobody nogroup 1084564 Oct 1 00:00 linux-modules-3.2.0.24-kurobox.tar.gz
ブート領域
"/mnt"にマウントした"/dev/hda1"へカーネルを展開する。# mkdir /mnt/boot # tar xvzf linux-image-3.2.0.24-kurobox.tar.gz -C /mnt/boot/
ルート領域
"/mnt2"にマウントした"/dev/hda3"へdebian Lennyのシステムファイルを展開する。カーネルモジュールファイルを展開する。# tar xvzf debian-lenny-kuroBOX-20090317.tgz -C /mnt2/
# tar xvzf linux-modules-3.2.0.24-kurobox.tar.gz -C /mnt2/
設定ファイル修正
カーネルの2.6.28以降、AVRという電源制御チップの場所が"/dev/ttyS1"から"/dev/ttyS0"に変更されているので今回導入した3.x系カーネルに合わせて修正する。ついでにSqueeze化に向けた設定ファイルの追記もしておく。
赤字の部分が加筆修正した部分。基本的には"ttyS1"と"ttyS0"の相互書き換え。
この修正をしないとコマンドから電源を落としたり、リブートすることが出来ない。(コンセントを引っこ抜くしかない。)
# vi /mnt2/etc/init.d/kuroevtd
#! /bin/sh
### BEGIN INIT INFO
# Provides: kuroevtd
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Default-Start: 2 4 5
# Default-Stop: 0 1 3 6
# Short-Description: Start/stop the KURO-BOX Event daemon
### END INIT INFO
# Start/stop the KURO-BOX Event Daemon.
test -f /usr/sbin/kuroevtd || exit 0
case "$1" in
start) echo -n "Starting KURO-BOX event daemon: kuroevtd"
start-stop-daemon --start --quiet --exec /usr/sbin/kuroevtd
echo "."
;;
stop) echo -n "Stopping KURO-BOX event daemon: kuroevtd"
start-stop-daemon --stop --quiet --exec /usr/sbin/kuroevtd
echo "."
;;
restart) echo -n "Restarting KURO-BOX event daemon: kuroevtd"
start-stop-daemon --stop --quiet --exec /usr/sbin/kuroevtd
start-stop-daemon --start --quiet --exec /usr/sbin/kuroevtd
echo "."
;;
reload|force-reload) echo -n "Reloading configuration files for KURO-BOX event daemon: kuroevtd"
# kuroevtd reloads automatically
echo "."
;;
*) echo "Usage: /etc/init.d/kuroevtd start|stop|restart|reload|force-reload"
exit 1
;;
esac
exit 0
# vi /mnt2/etc/init.d/kuro_boot
#! /bin/sh ### BEGIN INIT INFO # Provides: kuro_boot # Required-Start: $remote_fs $all # Required-Stop: # Default-Start: 2 4 5 # Default-Stop: 0 1 3 6 # Short-Description: Initialize the KUROBOX AVR ### END INIT INFO case "$1" in start|force-reload|restart|reload) echo -n "ttyS0 port init : " stty -F /dev/ttyS0 10:1:9f0d:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0 echo -n "AVR init string send" echo -n "AAAAFFFFJJJJ>>>>VVVV>>>>ZZZZVVVVKKKK" > /dev/ttyS0 echo "." ;; stop) ;; *) echo "Usage: /etc/init.d/$0 {start|stop|restart|reload|force-reload}" exit 1 esac exit 0
# vi /mnt2/etc/kuroevtd/fanlock
#! /bin/sh
echo -n "EEEE" > /dev/ttyS0
halt
# vi /mnt2/etc/kuroevtd/resetpress
#! /bin/sh
echo -n "gggg" > /dev/ttyS0
echo -n "NGNG" > /dev/mtdblock2
shutdown -h now
# vi /mnt2/etc/kuroevtd/haltreq
#! /bin/sh
echo -n "EEEE" > /dev/ttyS0
halt
# vi /mnt2/etc/kuroevtd/powerpress
#! /bin/sh
echo -n "EEEE" > /dev/ttyS0
shutdown -h now
# vi /mnt2/etc/init.d/halt
#! /bin/sh
### BEGIN INIT INFO
# Provides: halt
# Required-Start:
# Required-Stop:
# Default-Start:
# Default-Stop: 0
# Short-Description: Execute the halt command.
# Description:
### END INIT INFO
NETDOWN=yes
PATH=/sbin:/usr/sbin:/bin:/usr/bin
[ -f /etc/default/halt ] && . /etc/default/halt
. /lib/lsb/init-functions
do_stop () {
if [ "$INIT_HALT" = "" ]
then
case "$HALT" in
[Pp]*)
INIT_HALT=POWEROFF
;;
[Hh]*)
INIT_HALT=HALT
;;
*)
INIT_HALT=POWEROFF
;;
esac
fi
# See if we need to cut the power.
if [ "$INIT_HALT" = "POWEROFF" ] && [ -x /etc/init.d/ups-monitor ]
then
/etc/init.d/ups-monitor poweroff
fi
# Don't shut down drives if we're using RAID.
hddown="-h"
if grep -qs '^md.*active' /proc/mdstat
then
hddown=""
fi
# If INIT_HALT=HALT don't poweroff.
poweroff="-p"
if [ "$INIT_HALT" = "HALT" ]
then
poweroff=""
fi
# Make it possible to not shut down network interfaces,
# needed to use wake-on-lan
netdown="-i"
if [ "$NETDOWN" = "no" ]; then
netdown=""
fi
log_action_msg "Will now halt"
echo -n "EEEE" > /dev/ttyS0
halt -d -f $netdown $poweroff $hddown
}
case "$1" in
start)
# No-op
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
do_stop
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
:
# vi /mnt2/etc/init.d/reboot
#! /bin/sh
### BEGIN INIT INFO
# Provides: reboot
# Required-Start:
# Required-Stop:
# Default-Start:
# Default-Stop: 6
# Short-Description: Execute the reboot command.
# Description:
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
. /lib/lsb/init-functions
do_stop () {
# Message should end with a newline since kFreeBSD may
# print more stuff (see #323749)
log_action_msg "Will now restart"
echo -n "CCCC" > /dev/ttyS0
reboot -d -f -i
}
case "$1" in
start)
# No-op
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
do_stop
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
# vi /mnt2/etc/inittab
# /etc/inittab: init(8) configuration. # $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $ # The default runlevel. id:2:initdefault: # Boot-time system configuration/initialization script. # This is run first except when booting in emergency (-b) mode. si::sysinit:/etc/init.d/rcS # What to do in single-user mode. ~~:S:wait:/sbin/sulogin # /etc/init.d executes the S and K scripts upon change # of runlevel. # # Runlevel 0 is halt. # Runlevel 1 is single-user. # Runlevels 2-5 are multi-user. # Runlevel 6 is reboot. l0:0:wait:/etc/init.d/rc 0 l1:1:wait:/etc/init.d/rc 1 l2:2:wait:/etc/init.d/rc 2 l3:3:wait:/etc/init.d/rc 3 l4:4:wait:/etc/init.d/rc 4 l5:5:wait:/etc/init.d/rc 5 l6:6:wait:/etc/init.d/rc 6 # Normally not reached, but fallthrough in case of emergency. z6:6:respawn:/sbin/sulogin # What to do when CTRL-ALT-DEL is pressed. ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now # Action on special keypress (ALT-UpArrow). #kb::kbrequest:/bin/echo "Keyboard Request--edit /etc/inittab to let this work." # What to do when the power fails/returns. pf::powerwait:/etc/init.d/powerfail start pn::powerfailnow:/etc/init.d/powerfail now po::powerokwait:/etc/init.d/powerfail stop # /sbin/getty invocations for the runlevels. # # The "id" field MUST be the same as the last # characters of the device (after "tty"). # # Format: #: : : # # Note that on most Debian systems tty7 is used by the X Window System, # so if you want to add more getty's go ahead but skip tty7 if you run X. # 1:2345:off:/sbin/getty 38400 tty1 2:23:off:/sbin/getty 38400 tty2 3:23:off:/sbin/getty 38400 tty3 4:23:off:/sbin/getty 38400 tty4 5:23:off:/sbin/getty 38400 tty5 6:23:off:/sbin/getty 38400 tty6 # Example how to put a getty on a serial line (for a terminal) # #T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100 #T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100 # Example how to put a getty on a modem line. # #T3:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS3 con:2345:respawn:/sbin/getty 57600 ttyS1
fstabの修正
パーティションのマウント位置を修正する。パーティションをフォーマットした時のボリュームラベルで位置を示す。
# vi /mnt2/etc/fstab
# /etc/fstab: static file system information. # #<file system> <mount point> <type> <options> <dump> <pass> proc /proc proc defaults 0 0 LABEL=swap none swap sw 0 0 LABEL=root / ext3 defaults,noatime,errors=remount-ro 0 0 LABEL=mnt /mnt ext3 defaults,noatime 0 0
interfacesの設定
固定IPアドレス(192.168.0.100)が設定されている。環境に合わせて修正する。DHCPに設定した。
# vi /mnt2/etc/network/interfaces
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or # /usr/share/doc/ifupdown/examples for more information. iface eth0 inet dhcp iface lo inet loopback auto eth0 lo
0 件のコメント:
コメントを投稿