G-cluster 起動処理
U-boot
からの起動パラメータはこれかな。
crisprelease/buildroot/boot/uboot/2011-06/uboot-patch/uboot-2011.06-cavium-beijing.patch
35996行あたり
code:/crisprelease/buildroot/boot/uboot/2011-06/uboot-patch/uboot-2011.06-cavium-beijing.patch
+#elif (CONFIG_TARGET_NAME == CNC1800L_6611L)
+ /*hardware parameters*/
+
+ /*environment variables*/
+ #define CONFIG_BOOTARGS "root=/dev/mtdblock5 rw rootfstype=jffs2 console=ttyS0,115200 mtdparts=cnc_nand.0:1m(u-boot),3m(kernel),-(fs)" + #define CONFIG_BOOTCOMMAND "nand read 0x1000000 0x100000 0x300000;bootm 1000000" +
+ /*logo format*/
+
+ /*miscellaneous target specific macros*/
+ #define CONFIG_USB_ETHER_SMSC95XX code:代わりの設定
env set bootcmd 'dcache on;run ledon; run show_logo; run bootm_image; boots'
env set bootm_image 'nand read ${RAM} 2400000 18e0000; bootm ${RAM}'
U-boot の環境変数では RAM=4000000 が定義されている。
さて、カーネルが起動してからの
/etc/inittab の起動処理
code:/etc/inittab
# /etc/inittab
#
# Copyright (C) 2001 Erik Andersen <andersen@codepoet.org>
#
# Note: BusyBox init doesn't support runlevels. The runlevels field is
# completely ignored by BusyBox init. If you want runlevels, use
# sysvinit.
#
# Format for each entry: <id>:<runlevels>:<action>:<process>
#
# id == tty to run on, or empty for /dev/console
# runlevels == ignored
# action == one of sysinit, respawn, askfirst, wait, and once
# process == program to run
# Startup the system
::sysinit:/bin/mount -t tmpfs -o size=64k,mode=0755 none /dev
::sysinit:/bin/mkdir /dev/pts
::sysinit:/bin/mount -a
::sysinit:/bin/echo /sbin/mdev > /proc/sys/kernel/hotplug
::sysinit:/sbin/mdev -s
# now run any rc scripts
::sysinit:/etc/init.d/rcS
# Set up a couple of getty's
ttyS0::respawn:-/bin/sh -sc "stty cread -F /dev/ttyS0"
# Put a getty on the serial port
# Logging junk
# Stuff to do for the 3-finger salute
::ctrlaltdel:/sbin/reboot
# Stuff to do before rebooting
null::shutdown:/bin/umount -a -r
null::shutdown:/sbin/swapoff -a
/etc/init.d/rcS を起動
code:/etc/init.d/rcS
export PATH=\
/dlink:\
/bin:\
/sbin:\
/usr/bin:\
/usr/sbin:\
/usr/bin/X11:\
/usr/local/bin:\
/cavium/current_wifi_path/image:\
/cavium
mkdir -p /mnt/jffs2
mount -t jffs2 /dev/sed -n 's/mtd\(.*\):.*"filesystem"/mtdblock\1/p' /proc/mtd /mnt/jffs2
mkdir -p /mnt/jffs2/runconfig
ln -s /mnt/jffs2/runconfig /runconfig
hostname DSM232
wifiaddr=env get wifiaddr
source /etc/diagrc
else
FIRST_BOOT=env get FIRST_BOOT
env set wifimode ap
source setup-wlan.sh
ifconfig wlan0 up
sleep 2
wscan
then
source /etc/diagrc LOADED
else
source /etc/normalrc LOADED
source /etc/firstboot.sh
fi
else
source /etc/normalrc
fi
fi
通常起動だと、/etc/normalrc が呼び出される。
/etc/normalrc 内では
tvcenter デーモン? を起動
hdmi プラグするまで待つ
ウォッチドッグ起動
リモートデーモン? を起動
wifi起動
/usr/sbin/telnetd があれば telnet 起動
USBメモリに cameo_factory/factory.img があれば /dlink/usbupg でロード
などの処理が行われる
code:/etc/normalrc
# Tune Network Parameters
echo "12288 262140 262140" > /proc/sys/net/ipv4/tcp_rmem
echo "325632" > /proc/sys/net/core/rmem_max
ifconfig lo up
mkfifo /cavium/remotectl_pipe
mkfifo /cavium/fwup_pipe
mkfifo /cavium/hls_pipe
mkfifo /cavium/tvcenter_pipe
mkfifo /cavium/wlanmgr_pipe
mkfifo /cavium/gcc_pipe
/dlink/runcmd.sh &
break
else
usleep 100000
fi
done
/dlink/tvcenter &
FIRST_BOOT=env get FIRST_BOOT
COUNTRY=env get country
ln -sf /etc/Tokyo /etc/localtime
fi
# break
# usleep 100000
else
break
fi
else
usleep 100000
fi
done
watchdog -t 1 -T 2 /dev/watchdog
/dlink/remote/remote.sh &
cp -f /GCG/gcclient_setting.ini /runconfig
fi
/GCG/bootani
/dlink/keyext &
# startup wlan
source /cavium/setup-wlan.sh
else
rm -f /var/wscan.xml
fi
dnsd -d
cp -f $(cat /runconfig/wpa_cfg.curr) /runconfig/wpa_supplicant.conf
else
cp -f /runconfig/wpa_supplicant.conf /runconfig/wpa_cfg.1
echo "/runconfig/wpa_cfg.1" > /runconfig/wpa_cfg.curr
fi
fi
wlanmgr &
source /etc/telnetrc
fi
fi
usbupg -f
WIFIMODE=env get wifimode
echo 'firstboot 5' > /cavium/remotectl_pipe
fi
fi
一方これは ott/dlink/csgpio/csgpio.c 、ボタンを押す時間によって処理が変わる。
code:csgpio.c
if(sys_difftime(curr, sys_currtime()) <= 5000)//5sec
{
sprintf(cmd, "touch %s", WPS_FLAG);
system(cmd);
system("wpa_cli -i wlan0 wps_pbc any");
}
else if(sys_difftime(curr, sys_currtime()) > 5000 && sys_difftime(curr, sys_currtime()) <= 10000)// > 5sec <= 10sec
{
system("cd /dlink;./gcclient");
}
else if(sys_difftime(curr, sys_currtime()) > 10000 && sys_difftime(curr, sys_currtime()) <= 15000)// > 10sec <= 15sec
{
system("fwimg restore_fact;reboot");
}
else if(sys_difftime(curr, sys_currtime()) > 20000)//20sec
{
system("usbupg");
system("reboot");
}
ここから呼び出される usbupg は USBメモリ内に gcg_firmware/dsm232.img があればロードする
csgpio コマンドは tvcenter デーモンおよび リモートデーモン から呼び出されるようだ。そのほか hls_client コマンド内にも csgpio の文字があるが tvcenter やリモートデーモンのほか、http_caller からも呼ばれているようだ。
ここのリモートデーモンは /dlink/remote/remote.sh であるが実体は /dlink/remote/dsm232
しかしながら起動後のファイルシステム内に csgpio コマンドが無いのはどうした訳かな
また、 GPL ソースの ott/dlink/script/inittabに
ttyS0::respawn:-/bin/sh -sc "stty -cread -F /dev/ttyS0"
とあって、起動後にシリアルコンソールが効かなくなる処理が入っているのだが、起動後のファイルシステム内の /etc/inittab にはそれが無いのはどういうわけだろうか。