Friday, October 29, 2010

OpenBSD/OCTEON completely boots up from Compact Flash!

The problem was incomplete FPU emulation and baud rate on /etc/ttys, I just fixed it and now I can login and execute programs.
Next work will be SATA driver and SMP, and maybe some people contribute Ether and USB.


U-Boot 1.1.1  (Build time: Oct 23 2009 - 14:48:20)


CAPK-0100ND-CN50XX_1.8.1_294_V1.1.1


Hardware Monitor: W83792D initialized
CN3010_EVB_HS5 board revision major:0, minor:0, serial #: CAPK-0100ND
OCTEON CN5020-SCP pass 1.1, Core clock: 500 MHz, DDR clock: 265 MHz (530 Mhz data rate)
PAL rev: 0.00, MCU rev: 0.00, CPU voltage: 0.00
DRAM:  1024 MB
Flash:  8 MB
Clearing DRAM........ done
BIST check passed.
Starting PCI
PCI Status: PCI 32-bit
PCI BAR 0: 0x00000000, PCI BAR 1: Memory 0x00000000  PCI 0xf8000000
Net:   octeth0, octeth1, octeth2
 Bus 0 (CF Card): OK 


  ide 0: Model: CF 1GB Firm: 20060911 Ser#: TSS25013070129021908
            Type: Removable Hard Disk
            Capacity: 991.2 MB = 0.9 GB (2030112 x 512)
Octeon capk-0100nd# tftpboot
Interface 0 has 3 ports (RGMII)
*** Warning: no boot file name; using '0200A8C0.img'
Using octeth0 device
TFTP from server 192.168.0.1; our IP address is 192.168.0.2
Filename '0200A8C0.img'.
Load address: 0x20000000
Loading: octeth0: Up 1000 Mbps Full duplex (port  0)
#####################
done
Bytes transferred = 2992148 (2da814 hex), 4098 Kbytes/sec
Octeon capk-0100nd# bootoctlinux
ELF file is 64 bit
Attempting to allocate memory for ELF segment: addr: 0xffffffff81000000 (adjusted to: 0x0000000001000000), size 0x3225e0
Allocated memory for ELF segment: addr: 0xffffffff81000000, size 0x3225e0
Processing PHDR 0
  Loading 288a10 bytes at ffffffff81000000
  Clearing 99bd0 bytes at ffffffff81288a10
## Loading Linux kernel with entry point: 0xffffffff81000000 ...
Bootloader: Done loading app on coremask: 0x1
Bank 0 = 0x0000000001324000   ->  0x0000000006000000
mem_layout[0] page 0x00000000000004C9 -> 0x0000000000001800
Initial setup done, switching console.
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2010 OpenBSD. All rights reserved.  http://www.OpenBSD.org


OpenBSD 4.8-current (GENERIC) #4: Fri Oct 22 09:31:05 JST 2010
    root@openbsd.dokukino.com:/usr/src/sys/arch/octeon/compile/GENERIC
real mem = 80592896 (76MB)
avail mem = 79593472 (75MB)
mainbus0 at rootcpu0 at mainbus0: Cavium OCTEON CPU rev 0.1 500 MHz, Software FP emulation
cpu0: cache L1-I 32KB D 16KB 4 way, L2 128KB direct
clock0 at mainbus0: ticker on int5 using count register
obio0 at mainbus0
octcf0 at obio0 base 0x1d000800 irq 0:
octcf0: 1-sector PIO, CHS, 991MB, 2014 cyl, 16 head, 63 sec, 2030112 sectors
c: ns16550, no working fifo
com0: console
com1 at combus0 base 0x1180000000c00 irq 35: ns16550, no working fifo
/dev/ksyms: Symbol table not valid.
vscsi0 at root
scsibus0 at vscsi0: 256 targets
softraid0 at root
root device: octcf0c
swap device (default octcf0b): 
root on octcf0c swap on octcf0b dump on octcf0b
filesystem type 0 not known.. assuming ffs
WARNING: No TOD clock, believing file system.
WARNING: CHECK AND RESET THE DATE!
Automatic boot in progress: starting file system checks.
/dev/roctcf0c: file system is clean; not checking
setting tty flags
pf enabled
starting network
starting system logger
starting initial daemons:.
savecore: /bsd: kvm_openfiles: /bsd: No such file or directory
checking quotas: done.
building ps databases: kvmkvm_mkdb: can't open /dev/ksyms
kvm_mkdb: can't open /bsd: No such file or directory
 dev.
clearing /tmp
starting pre-securelevel daemons:.
setting kernel security level: kern.securelevel: 0 -> 1
creating runtime link editor directory cache.
preserving editor files.
starting network daemons: sshd sendmail inetd.
starting local daemons:.
standard daemons: cron.
Thu Oct 28 01:45:58 MDT 2010


OpenBSD/octeon (noname.my.domain) (console)


login: root
Password:
Last login: Thu Oct 28 01:34:18 on console
OpenBSD 4.8-current (GENERIC) #4: Fri Oct 22 09:31:05 JST 2010


You have mail.
# ps ax                                                                 
  PID TT  STAT       TIME COMMAND
    1 ??  Is      0:00.57 /sbin/init
14475 ??  Is      0:00.55 syslogd: [priv] (syslogd)
21253 ??  S       0:10.13 syslogd -a /var/www/dev/log -a /var/empty/dev/log
29090 ??  Is      0:00.30 pflogd: [priv] (pflogd)
21147 ??  S       0:00.13 pflogd: [running] -s 160 -i pflog0 -f /var/log/pflog 
 9892 ??  Is      0:00.40 /usr/sbin/sshd
  369 ??  Is      0:00.53 inetd
11242 ??  Is      0:00.74 cron
23431 ??  Ss      0:00.36 sendmail: accepting connections (sendmail)
26114 00  Ss      0:00.56 -ksh (ksh)
18534 00  R+      0:00.30 ps -ax
# ls 
.Xdefaults .cshrc     .klogin    .login     .profile   tmp
# cd /usr
# ls
bin     include libdata lkm     mdec    sbin    src
games   lib     libexec local   obj     share   xobj
# ls src/                                                                      
# ps ax
  PID TT  STAT       TIME COMMAND
    1 ??  Is      0:00.57 /sbin/init
14475 ??  Is      0:00.55 syslogd: [priv] (syslogd)
21253 ??  S       0:10.13 syslogd -a /var/www/dev/log -a /var/empty/dev/log
29090 ??  Is      0:00.30 pflogd: [priv] (pflogd)
21147 ??  S       0:00.13 pflogd: [running] -s 160 -i pflog0 -f /var/log/pflog 
 9892 ??  Is      0:00.40 /usr/sbin/sshd
  369 ??  Is      0:00.53 inetd
11242 ??  Is      0:00.74 cron
23431 ??  Ss      0:00.37 sendmail: accepting connections (sendmail)
26114 00  Ss      0:00.58 -ksh (ksh)
15405 00  R+      0:00.00 ps -ax
# top


load averages:  0.11,  0.26,  0.16                    noname.my.domain 01:51:25
11 processes:  10 idle, 1 on processor
CPU states:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
Memory: Real: 12M/31M act/tot  Free: 45M  Swap: 0K/0K used/tot


  PID USERNAME PRI NICE  SIZE   RES STATE     WAIT      TIME    CPU COMMAND
21253 _syslogd   2    0  736K 1104K idle      poll      0:10  0.00% syslogd
11242 root       2    0  768K 1296K idle      select    0:01  0.00% cron
19763 root      28    0  944K 2160K onproc    -         0:01  0.00% top
26114 root      18    0  944K  848K idle      pause     0:01  0.00% ksh
    1 root      10    0  576K  704K idle      wait      0:01  0.00% init
14475 root       2    0  720K 1152K idle      netio     0:01  0.00% syslogd
  369 root       2    0  528K 1152K idle      select    0:01  0.00% inetd
 9892 root       2    0 1008K 1696K idle      select    0:00  0.00% sshd
23431 root       2    0 1616K 2208K sleep     select    0:00  0.00% sendmail
29090 root       2    0  832K  864K idle      netio     0:00  0.00% pflogd
21147 _pflogd    4    0  896K  624K sleep     bpf       0:00  0.00% pflogd

Tuesday, October 26, 2010

OpenBSD/OCTEON (partially) boots up from Compact Flash

We don't have complete kernel base software FPU emulation code, therefore userland is very unstable for now, but multi user mode booted from Compact Flash anyway.
I had tried to implement CF driver as wdc(4), looks like there's the way to do that if it's acceptable to patch few codes on the generic wdc(4) code, but I had got unknown hangs, and I gave up it.
Then I implemented simple block device "octcf", just like FreeBSD/cavium's CF driver.
http://www.openbsd.org/cgi-bin/cvsweb/src/sys/arch/octeon/dev/octcf.c?rev=1.1;content-type=text/plain

U-Boot 1.1.1  (Build time: Oct 23 2009 - 14:48:20)


CAPK-0100ND-CN50XX_1.8.1_294_V1.1.1


Hardware Monitor: W83792D initialized
CN3010_EVB_HS5 board revision major:0, minor:0, serial #: CAPK-0100ND
OCTEON CN5020-SCP pass 1.1, Core clock: 500 MHz, DDR clock: 265 MHz (530 Mhz data rate)
PAL rev: 0.00, MCU rev: 0.00, CPU voltage: 0.00
DRAM:  1024 MB
Flash:  8 MB
Clearing DRAM........ done
BIST check passed.
Starting PCI
PCI Status: PCI 32-bit
PCI BAR 0: 0x00000000, PCI BAR 1: Memory 0x00000000  PCI 0xf8000000
Net:   octeth0, octeth1, octeth2
 Bus 0 (CF Card): OK 


  ide 0: Model: CF 1GB Firm: 20060911 Ser#: TSS25013070129021908
            Type: Removable Hard Disk
            Capacity: 991.2 MB = 0.9 GB (2030112 x 512)
Octeon capk-0100nd# tftpboot
Interface 0 has 3 ports (RGMII)
*** Warning: no boot file name; using '0200A8C0.img'
Using octeth0 device
TFTP from server 192.168.0.1; our IP address is 192.168.0.2
Filename '0200A8C0.img'.
Load address: 0x20000000
Loading: octeth0: Up 1000 Mbps Full duplex (port  0)
#####################
done
Bytes transferred = 2991844 (2da6e4 hex), 3264 Kbytes/sec
Octeon capk-0100nd# bootoctlinux
ELF file is 64 bit
Attempting to allocate memory for ELF segment: addr: 0xffffffff81000000 (adjusted to: 0x0000000001000000), size 0x3224b0
Allocated memory for ELF segment: addr: 0xffffffff81000000, size 0x3224b0
Processing PHDR 0
  Loading 2888e0 bytes at ffffffff81000000
  Clearing 99bd0 bytes at ffffffff812888e0
## Loading Linux kernel with entry point: 0xffffffff81000000 ...
Bootloader: Done loading app on coremask: 0x1
Bank 0 = 0x0000000001324000   ->  0x0000000006000000
mem_layout[0] page 0x00000000000004C9 -> 0x0000000000001800
Initial setup done, switching console.
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2010 OpenBSD. All rights reserved.  http://www.OpenBSD.org


OpenBSD 4.8-current (GENERIC) #61: Thu Oct 21 04:01:43 JST 2010
    root@openbsd.dokukino.com:/usr/src/sys/arch/octeon/compile/GENERIC
real mem = 80592896 (76MB)
avail mem = 79593472 (75MB)
mainbus0 at rootcpu0 at mainbus0: Cavium OCTEON CPU rev 0.1 500 MHz, Software FP emulation
cpu0: cache L1-I 32KB D 16KB 4 way, L2 128KB direct
clock0 at mainbus0: ticker on int5 using count register
obio0 at mainbus0
octcf0 at obio0 base 0x1d000800 irq 0:
octcf0: 1-sector PIO, CHS, 991MB, 2014 cyl, 16 head, 63 sec, 2030112 sectors
c: ns16550, no working fifo
com0: console
com1 at combus0 base 0x1180000000c00 irq 35: ns16550, no working fifo
/dev/ksyms: Symbol table not valid.
vscsi0 at root
scsibus0 at vscsi0: 256 targets
softraid0 at root
root device: octcf0c
swap device (default octcf0b): 
root on octcf0c swap on octcf0b dump on octcf0b
filesystem type 0 not known.. assuming ffs
WARNING: / was not properly unmounted
WARNING: No TOD clock, believing file system.
WARNING: CHECK AND RESET THE DATE!
Automatic boot in progress: starting file system checks.
/dev/roctcf0c: 16369 files, 229182 used, 270137 free (25 frags, 33764 blocks, 0.0% fragmentation)
/dev/roctcf0c: MARKING FILE SYSTEM CLEAN
setting tty flags
Illegal instruction (core dumped) 
pf enabled
starting network
Illegal instruction (core dumped) 
starting system logger
starting initial daemons:.
Illegal instruction (core dumped) 
checking quotas: done.
building ps databases: kvmkvm_mkdb: can't open /dev/ksyms
kvm_mkdb: can't open /bsd: No such file or directory
 dev.
clearing /tmp
starting pre-securelevel daemons:.
setting kernel security level: kern.securelevel: 0 -> 1
creating runtime link editor directory cache.
preserving editor files.
Illegal instruction (core dumped) 
ssh-keygen: generating new DSA host key... Illegal instruction (core dumped) 
failed.
ssh-keygen: generating new ECDSA host key... Illegal instruction (core dumped) 
failed.
ssh-keygen: generating new RSA host key... Illegal instruction (core dumped) 
failed.
ssh-keygen: generating new RSA1 host key... Illegal instruction (core dumped) 
failed.
starting network daemons: sshdCould not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_dsa_key
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Disabling protocol version 2. Could not load host key
sshd: no hostkeys available -- exiting.
 sendmail inetd.
starting local daemons:.
standard daemons: cron.
Illegal instruction (core dumped)