Pyon's Diary
2007-06-27 舊 平成拾玖年皐月拾參日 (水・晴) [長年日記]
KURO-BOX/PRO (No.20) miconapl に附いて見てみた。(參)
きのふ miconapl の使はれ方を診てゐたが、何もコマンドライン・オプションを指定してゐ無い時にどうなるかは見てゐ無かつたので、何も附けずに實行してみた。
# ./miconapl
Usage: miconapl ver.1.11(Dec 4 2006) OPTION
for OPTION
-d{0,1,2,3} : set debug level
bit0:function trace
bit1:pakcet trace
-i FILE : communication device(/dev/ttyS0)
-l : for local debug
-p : micon watch daemon
-f : no fork for micon watch daemon
デバッグ・モードが在つたので其れを附けて温度を取得してみた。
# miconapl -d 3 -a temp_get >SetDeviceName >Initialize:/dev/ttyS1 >AdvisoryLock (1) >argCmd: argc=1 argv[0]=temp_get argv[1]=(null) >argCmd: opecode:0x37, opesize:1, write:0, read:1 >ComGetTemp: opecode:0x37, command_name:temp_get >SendCmd: cmd=0x80 ope=0x37 len=0 >CreatePacket >CalcChecksum:len=2 checksum=0xb7 ------- (SendCmd) len=3 ------- 000: 80( ) 37(7) 49(I) header:0x80 0x37: cmd=01 len=00 ope=37 -- >Output (len=3) ------- (Output) len=3 ------- 000: 80( ) 37(7) 49(I) >Output write result:3 >RecvPacket ------- (Input) len=4 ------- 000: 81( ) 37(7) 23(#) 25(%) >Input:len=4 ------- (RecvPacket) len=4 ------- 000: 81( ) 37(7) 23(#) 25(%) header:0x81 0x37: cmd=01 len=01 ope=37 -- >RecvPacket:len=4 >AnalyzeRecvPacket:Compare Command 0x
結果を診ると、
- マイコンとの遣り取りには /dev/ttyS1 が使用されてゐる。
- 最初にマイコンに對して「80 37 49」を送信。
- 其れからマイコンから「81 37 23 25」を受信。
してゐる模樣。最初にマイコンに對して送信した 3 bytes の 16 進數は「KUROBOX/PRO マイコン通信仕樣 Rev.1.0」を診ると、
- 0x80 -- マイコンからのデータ讀出し指示(bit7 が「1」)でデータは無し(データ・ペイロードの長さが「0」)。
- 0x37 -- 温度を取得するコマンド。
- 0x49 -- パリティ(0x00 - (0x80 + 0x37) = 0x00 - 0xB7 = 0x49)。
と成つてゐて大體説明書の通り。受信データの方も、
- 0x81 -- マイコンからのデータ讀出し指示(bit7 が「1」)に對する應答で、1 byte のデータが在る(データ・ペイロードの長さが「1」)。
- 0x37 -- 送信されたコマンド(温度取得コマンド 0x37)。
- 0x23 -- 返信された温度(0x23 は 10 進數で「35」。即ち現在の温度は攝氏三拾五度。)。
- 0x25 -- パリティ(0x00 - (0x81 + 0x37 + 0x23) = 0x00 - 0xDA = 0x25)。
と成つてゐて大體説明書の通り。
だとすると「KUROBOX/PRO マイコン通信仕樣 Rev.1.0」で解説されゐるコマンドを /dev/ttyS1 に書込んで、戻つて來たデータを解析すれば、自分でも温度の取得、空冷扇の制御等が出來るかも知れ無い。
KURO-BOX/PRO (No.21) ファームウェアの初期化を試した。
色々弄つた後でファームウェアの初期化を行つて失敗すると衝撃が大きいので、今の内に一囘試して置いた。
作業に當たつて以下のものを用意した。
- KURO-BOX/PRO (玄箱 PRO) (含内臟 HDD)
- SCON-KIT/PRO
- Gateway MX6924j
- TFTP サーバプログラム TFTPD (1.0.1)
- ファームウェア書換キット
母艦と KURO-BOX/PRO とをクロスケーブルで結び、TFTP サーバは WinXP 上で動かした。
一方、SCON-KIT/PRO を使つてシリアル - USB でも結び、此方は VMware Server の上で動かしてゐる Gentoo で minicom を使つて操作した。
「シリアルコンソールを使用したファームウェア書き換へ手順」(PDF)に随つて母艦のネットワークの設定を行ひ、TFTP サーバのデータフォルダにファームウェア書換キットに含まれてゐる、
- uImage.buffalo
- initrd.buffalo
を置いて KURO-BOX/PRO を再起動した。
hit any key to switch tftp boot. Hit any key to stop autoboot:
と出力された處で適當なキーを打ち込むと、ERROR 燈が點滅し「ぴーぽー」と云ふ警告音が鳴り響いたが其之儘無視して大丈夫だつた(最初は驚いて reset して了つた)。
以下に全ての出力を載せた。
Orion1 CPU = Low
=== KURO U-Boot. ===
** LOADER **
** KUROBOX BOARD: KURO_BOX LE (CFG_ENV_ADDR=fffff000)
U-Boot 1.1.1 (Apr 10 2007 - 18:10:08) Marvell version: 1.12.1 - TINY
DRAM CS[0] base 0x00000000 size 128MB
DRAM Total size 128MB
[256kB@fffc0000] Flash: 256 kB
Addresses 20M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (20M - 16M): Done
NAND: 256 MB
Soc: 88F5182 A2
CPU: ARM926 (Rev 0) running @ 500Mhz
Orion 1 streaming disabled
SysClock = 250Mhz , TClock = 166Mhz
USB 0: host mode
USB 1: host mode
PCI 0: PCI Express Root Complex Interface
PCI 1: Conventional PCI, speed = 33000000
Net: egiga0 [PRIME]
Using 88E1118 phy
Found boot image
hit any key to switch tftp boot.
Hit any key to stop autoboot: 0
switched to TFTP boot.
<<system_bootend>>
<<system_bootend>>
Hit any key to stop autoboot: 0
Marvell>> reset
Marvell>> Orion1 CPU = Low
=== KURO U-Boot. ===
** LOADER **
** KUROBOX BOARD: KURO_BOX LE (CFG_ENV_ADDR=fffff000)
U-Boot 1.1.1 (Apr 10 2007 - 18:10:08) Marvell version: 1.12.1 - TINY
DRAM CS[0] base 0x00000000 size 128MB
DRAM Total size 128MB
[256kB@fffc0000] Flash: 256 kB
Addresses 20M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (20M - 16M): Done
NAND: 256 MB
Soc: 88F5182 A2
CPU: ARM926 (Rev 0) running @ 500Mhz
Orion 1 streaming disabled
SysClock = 250Mhz , TClock = 166Mhz
USB 0: host mode
USB 1: host mode
PCI 0: PCI Express Root Complex Interface
PCI 1: Conventional PCI, speed = 33000000
Net: egiga0 [PRIME]
Using 88E1118 phy
Found boot image
hit any key to switch tftp boot.
Hit any key to stop autoboot: 0
switched to TFTP boot.
<<system_bootend>>
<<system_bootend>>
Hit any key to stop autoboot: 0
Using egiga0 device
TFTP from server 192.168.11.1; our IP address is 192.168.11.150
Filename 'uImage.buffalo'.
Load address: 0x100000
Loading: T T
Retry count exceeded; starting again
Using egiga0 device
TFTP from server 192.168.11.1; our IP address is 192.168.11.150
Filename 'uImage.buffalo'.
Load address: 0x100000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
###############
done
Bytes transferred = 1736612 (1a7fa4 hex)
Using egiga0 device
TFTP from server 192.168.11.1; our IP address is 192.168.11.150
Filename 'initrd.buffalo'.
Load address: 0x2000000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
##############################################################
done
Bytes transferred = 19286756 (1264ae4 hex)
<<stop_sound>>
## Booting image at 00100000 ...
Image Name: Linux-2.6.12.6-arm1
Created: 2007-04-10 13:45:13 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1736548 Bytes = 1.7 MB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
OK
## Loading Ramdisk Image at 02000000 ...
Image Name: initrd
Created: 2007-04-10 13:46:52 UTC
Image Type: ARM Linux RAMDisk Image (gzip compressed)
Data Size: 19286692 Bytes = 18.4 MB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
Starting kernel ...
arg:console=ttyS0,115200 root=/dev/mtdblock2 rw panic=5 rw initrd=0x02000040,20M panic=5 BOOTVER=1.091
CONFIG_KUROBOX_PLATFORM CONFIG_KUROBOX_KUROBOX ---
Uncompressing Linux................................................................................................................. done, booting the kernel.
Linux version 2.6.12.6-arm1 (root@dev-hara) (gcc version 3.4.4 (release) (CodeSourcery ARM 2005q3-2)) #27 Tue Apr 10 22:47:16 JST 2007
CPU: ARM926EJ-Sid(wb) [41069260] revision 0 (ARMv5TEJ)
CPU0: D VIVT write-back cache
CPU0: I cache: 32768 bytes, associativity 1, 32 byte lines, 1024 sets
CPU0: D cache: 32768 bytes, associativity 1, 32 byte lines, 1024 sets
Machine: MV-88fxx81
Using UBoot passing parameters structure
Sys Clk = 250000000, Tclk = 166664740
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists
Kernel command line: console=ttyS0,115200 root=/dev/mtdblock2 rw panic=5 rw initrd=0x02000040,20M panic=5 BOOTVER=1.091
PID hash table entries: 1024 (order: 10, 16384 bytes)
Console: colour dummy device 80x30
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 128MB 0MB 0MB 0MB = 128MB total
Memory: 105600KB available (3037K code, 426K data, 112K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
checking if image is initramfs...it isn't (no cpio magic); looks like an initrd
Freeing initrd memory: 20480K
NET: Registered protocol family 16
serial_initialize_ttyS1 (Debug): ttyS1 is initialized.
config_device_cs Error : Unknown board
CPU Interface
-------------
SDRAM_CS0 ....base 00000000, size 128MB
SDRAM_CS1 ....disable
SDRAM_CS2 ....disable
SDRAM_CS3 ....disable
PEX0_MEM ....base e0000000, size 128MB
PEX0_IO ....base f2000000, size 1MB
PCI0_MEM ....base e8000000, size 128MB
PCI0_IO ....base f2100000, size 1MB
INTER_REGS ....base f1000000, size 1MB
DEVICE_CS0 ....base fa000000, size 2MB
DEVICE_CS1 ....base f4000000, size 32MB
DEVICE_CS2 ....base fa800000, size 1MB
DEV_BOOCS ....base ff800000, size 8MB
CRYPTO ENG ....no such
Flash bankwidth 1, base ff800000, size 400000
KUROBOX FLASH size 4096[KB]
Marvell Development Board (LSP Version 1.10.3.patch5_DB_NAS)-- KUROBOX_BOARD_KUROBOX Soc: 88F5182 A2
Detected Tclk 166664740 and SysClk 250000000
Marvell USB EHCI Host controller #0: c3403bc0
Marvell USB EHCI Host controller #1: c3403a40
pexBarOverlapDetect: winNum 2 overlap current 0
mvPexInit:Warning :Bar 2 size is illigal
it will be disabled
please check Pex and CPU windows configuration
PCI: bus0: Fast back to back transfers enabled
PCI: bus1: Fast back to back transfers enabled
SCSI subsystem initialized
usbcore: registered new driver usbfs
usbcore: registered new driver hub
Use the XOR engines (offloading) for enhancing the following functions:
o RAID 5 Xor calculation
o kernel memcpy
o kenrel memzero
o copy user to/from kernel buffers
Number of XOR engines to use: chmann.
inotify device minor=63
JFFS2 version 2.2. (NAND) (C) 2001-2003 Red Hat, Inc.
SGI XFS with no debug enabled
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled
ttyS0 at MMIO 0x0 (irq = 3) is a 16550A
ttyS1 at MMIO 0x0 (irq = 4) is a 16550A
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered
RAMDISK driver initialized: 3 RAM disks of 32768K size 1024 blocksize
loop: loaded (max 8 devices)
Marvell Gigabit Ethernet Driver 'egiga':
o Ethernet descriptors in DRAM
o DRAM SW cache-coherency
o Checksum offload enabled
o Loading network interface ** egiga_init_module (10)
'eth0'
Intergrated Sata device found
scsi0 : Marvell SCSI to SATA adapter
scsi1 : Marvell SCSI to SATA adapter
Vendor: Hitachi Model: HDS721680PLA380 Rev: P21O
Type: Direct-Access ANSI SCSI revision: 03
SCSI device sda: 160836480 512-byte hdwr sectors (82348 MB)
SCSI device sda: drive cache: write back
SCSI device sda: 160836480 512-byte hdwr sectors (82348 MB)
SCSI device sda: drive cache: write back
sda: sda1 sda2 sda3 sda4
Attached scsi disk sda at scsi0, channel 0, id 0, lun 0
Attached scsi generic sg0 at scsi0, channel 0, id 0, lun 0, type 0
physmap flash device: 400000 at ff800000
Found: SST 39LF020
phys_mapped_flash: Found 1 x8 devices at 0x0 in 8-bit bank
number of JEDEC chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
RedBoot partition parsing not available
Debug nand_scan : nand_flash_ids[i].pagesize is exist
Debug nand_scan : mtd->erasesize=0x00020000
Debug nand_scan : mtd->oobblock=0x00000800
Debug nand_scan : mtd->oobsize=0x00000040
NAND device: Manufacturer ID: 0x20, Chip ID: 0xda (ST Micro NAND 256MiB 3,3V 8-bit)
Scanning device for bad blocks
Using static partition definition
Creating 3 MTD partitions on "nand_mtd":
0x00000000-0x00400000 : "uImage"
0x00400000-0x04400000 : "rootfs"
0x04400000-0x10000000 : "extra"
usbmon: debugs is not available
ehci_platform ehci_platform.4523: EHCI Host Controller
ehci_platform ehci_platform.4523: new USB bus registered, assigned bus number 1
ehci_platform ehci_platform.4523: irq 17, io mem 0x00000000
ehci_platform ehci_platform.4523: park 0
ehci_platform ehci_platform.4523: USB 0.0 initialized, EHCI 1.00, driver 10 Dec 2004
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
ehci_platform ehci_platform.16781: EHCI Host Controller
ehci_platform ehci_platform.16781: new USB bus registered, assigned bus number 2
ehci_platform ehci_platform.16781: irq 12, io mem 0x00000000
ehci_platform ehci_platform.16781: park 0
ehci_platform ehci_platform.16781: USB 0.0 initialized, EHCI 1.00, driver 10 Dec 2004
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
USB Universal Host Controller Interface driver v2.2
Initializing USB Mass Storage driver...
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
usbcore: registered new driver usbhid
drivers/usb/input/hid-core.c: v2.01:USB HID core driver
mice: PS/2 mouse device common for all mice
md: raid0 personality registered as nr 2
md: raid1 personality registered as nr 3
md: raid5 personality registered as nr 4
raid5: measuring checksumming speed
arm4regs : 308.800 MB/sec
8regs : 217.600 MB/sec
32regs : 252.400 MB/sec
raid5: using function: arm4regs (308.800 MB/sec)
md: md driver 0.90.1 MAX_MD_DEVS=256, MD_SB_DISKS=27
Buffalo Platform Linux Driver(Light) 0.01 installed.
IP: routing cache hash table of 1024 buckets, 8Kbytes
TCP established hash table entries: 8192 (order: 4, 65536 bytes)
TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
NET: Registered protocol family 1
NET: Registered protocol family 17
md: Autodetecting RAID arrays.
md: autorun ...
md: ... autorun DONE.
RAMDISK: Compressed image found at block 0
VFS: Mounted root (ext2 filesystem).
---- in linuxrc ---
proc mount success
libbuffalo mount success
-RamdiskRoot-
-- linuxrc finished. --
Freeing init memory: 112K
init started: BusyBox v1.2.2 (2007.01.15-11:18+0000) multi-call binary
Starting pid 242, console /dev/ttyS0: '/etc/init.d/rcS'
--- rcStart (initrd) ---
===== Starting MountSystemFolders =====
mounting procfs ... [Success]
mounting sysfs ... [Success]
remounting rootfs ... [Success]
mounting all devices ... [Success]
--MountNandDevice--
===== Starting Kevent.sh =====
[Success]
===== Starting networking.sh =====
Deconfiguration network interface: lo eth0
killall: dhcpcd: no process killed
create network files..
IP=[dhcp], netmask=[], dgw=[], dns1=[], dns2=[]
killall: dhcpcd: no process killed
route: SIOC[ADD|DEL]RT: No such process
Configuration network interface: lo eth0
requesting DHCP tout=30[s]
eth0: link down
eth0: link up<5>, full duplex<5>, speed 100 Mbps<5>
** dhcp fail
** setting default ip
eth0: link down
route: SIOC[ADD|DEL]RT: No such process
/etc/dhcpc/dhcpcd.exe ::: down
dhcpcd.exe: interface eth0 has been brought down
eth0: link up<5>, full duplex<5>, speed 100 Mbps<5>
add default if
hostname is setted to KUROBOX-PRO
[Success]
===== Starting sethostname.sh =====
hostname is setted to KUROBOX-PRO
[Success]
===== Starting clientUtil_servd.sh =====
Starting clientUtil_server:starting on eth0
start at debug mode
clientUtil_server Ver.1.01
[Success]
listen device name = eth0
Starting pid 546, console /dev/ttyS0: '/sbin/getty'
KUROBOX-PRO login:
無事にファイルを轉送出来た模樣。ログインすると次の樣なメッセージが出力された。
KUROBOX-PRO login: root Password: login[546]: root login on `ttyS0' BusyBox v1.2.2 (2007.01.15-11:18+0000) Built-in shell (ash) Enter 'help' for a list of built-in commands.
「シリアルコンソールを使用したファームウェア書き換へ手順」(PDF)に随つて、NAND フラッシュの書換コマンドを實行した。
# update_mtd.sh all ***** Cleaning and collect badlist /dev/mtd1 ***** ***** copying /boot/uImage.buffalo to /dev/mtd1 ***** ***** Cleaning /dev/mtdchar2 ***** ***** Writing /boot/nandrootfs.jffs2 to /dev/mtdchar2 ***** ***** copying /boot/u-boot.bin to /dev/mtd0 ***** 480+1 records in 480+1 records out ***** Cleaning /dev/mtdchar3 ***** Done.
書換も無事終了したのでクロスケーブルを外して再起動すると無事 Flash 起動環境が立ち上がつた。
「プログラミング」が出來無い。
と或る日記を眺めてゐて、はてな匿名ダイアリーに以下の樣な書込みが在つた事を知つた。
「プログラミング」は教はつたり、自宅で復習したりするものなのだろうか。
慥かに世間を眺めると色々「プログラミング」を教へてゐる處が在るので教はつてゐる人も多いのだろうけど、
- 書籍を讀んで取敢へず書いて在る事を打ち込んで見て、
- 後は判ら無い處を人に訊くなり、Google で檢索するなり、
すれば何とか成るものでは無いのだろうか。其れだけだと獨り善がりな癖が附いて了ふかも知れ無いから、矢張り誰か上手な人と一緒に仕事をするのが一番良いのだと思ふが。
後、仕事では「プログラミング」は手段であつて目的では無い。目的は「システムを構築して稼働、運用する事」。だから「プログラミング」が手段として必要な目的を見附けて了へば良いのでは、と思ふ。必要性が無いのにものを憶えるのは苦痛だから。
取敢へず仕事に就いて仕舞へば良いのに。