cod3fr3ak
August 28th, 2003, 01:59
I got my soekris board the other day and I was plesantly surprised.


However getting the OS onto the Compact Flash card is being a major pain. Someone here posted a link to a page with instructions on how to do it, and I found that it was not very helpful and a little vauge in some places. I downloaded the OpenSoekris.sh script of the Soekris webpage but after getting all the way to the end I run into another problem. I have a SanDisk SDCFH-256 256M Compact Flash card. the soekris board report the disk geometry as LBA 980-16-32 251 Mbyte, while OpenBSD reports geometry: 245/64/32 [501760 Sectors]. Both chs equal to the same number of sectors. In addition when I do a fdisk sd0[/code:1:976b744e32] I get this error message: [code]Aug 27 21:01:18 test /bsd: sd0: mode sense (4) returned nonsense; using fictitious geometry, and then: fdisk: sysctl(machdep.bios.diskinfo): Device not configured.
I tried setting the chs manually by doing a: fdisk -c 980 -h 16 -s 32 sd0, and the system seems to take the setting because I get this:

Disk: sd0 geometry: 980/16/32 [501760 Sectors]
Offset: 0 Signature: 0xAA55
Starting Ending LBA Info:
#: id C H S - C H S [ start: size ]
------------------------------------------------------------------------
0: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
1: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
3: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused

But I still get the using ficticious error.

Any suggestions????

elmore
August 28th, 2003, 02:15
hrmmm I've been using flashdist for mine. That's Chris Cappuchio's script. Works like a charm. You'll need a usb flash writer duh, the one I've had the best experience with is the sandisk image mate 2. Also sandisk compact flash cards also seem to work the best though viking compact flash cards do work as well.

I typically create a virtual image and then write that image to disk. so for a sandisk 64mb card I do:



dd if=/dev/zero of=flashimg bs=512 count=125440



That creates an empty file. and where the count is C*H*S

Then I use vnconfig so I can mount that file like a partition:



vnconfig -c snvd0 flashimg



then I run flashdist.sh or in your case the opensoekris stuff and write it to /dev/svnd0c

then remove the image file from the kernel


vnconfig -u svnd0


Now dd your file to the usb device.



dd if=flashimg of=/dev/sd0c bs=512



By doing it this way you have an image made so if you ever need it again you won;t have to go through all the steps.

Hope that helps.

cod3fr3ak
August 28th, 2003, 12:15
Thanks Elmore. I'll try that when I get home. I purchased a SanDis 256m card. Is that overkill?
For a standard router is 64m all that I need? I only want to put and IDS, pftop, and maybe ntp on the box. I use nfs or some other method of exporting the logs generated by pf.
Also with only 64m what would your partitions look like?

elmore
August 28th, 2003, 12:31
well everything is 1 big partition. Careful with an ids system as the soekris typically runs in ro mode. Too many writes to the flash will wear out the memory card.

I have my soekris at about 20 to 25 mb at current. I'm running a minimal install of OpenBSD with thttps for a webserver, a working crontab, php compiled in cli mode and stunnel which sits in front of thttpd for ssl.

If you want to keep things small statically compile your binaries so you can leave out lots of the libs.

I love the soekris stuff, it's been a passion of mine lately.

cod3fr3ak
August 28th, 2003, 14:30
Ok. I guess I need to do a little more reading on kernel compiling.

I still can not figure why the OBSD bios detection routines pickup the incorrect geometry for the CF card, though. I've been diving through google all morning with no end in sight.

cod3fr3ak
August 28th, 2003, 15:42
Just thought I'd post my dmesg:


test# dmesg
OpenBSD 3.3 (GENERIC) #44: Sat Mar 29 13:22:05 MST 2003
deraadt@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel Pentium III ("GenuineIntel" 686-class, 512KB L2 cache) 551 MHz
cpu0: FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SYS,MTRR,PGE,MC A,CMOV,PAT,PSE36,MMX,FXSR,SIMD
real mem = 268005376 (261724K)
avail mem = 242679808 (236992K)
using 3297 buffers containing 13504512 bytes (13188K) of memory
mainbus0 (root)
bios0 at mainbus0: AT/286+(83) BIOS, date 10/19/99, BIOS32 rev. 0 @ 0xf06b0
apm0 at bios0: Power Management spec V1.2
apm0: AC on, battery charge unknown
pcibios0 at bios0: rev. 2.1 @ 0xf0000/0xf12
pcibios0: PCI IRQ Routing Table rev. 1.0 @ 0xf0e70/160 (8 entries)
pcibios0: PCI Interrupt Router at 000:04:0 ("Intel 82371FB PCI-ISA" rev 0x00)
pcibios0: PCI bus #1 is the last bus
bios0: ROM list: 0xc0000/0x8000 0xc8000/0x4000! 0xcc000/0x800
pci0 at mainbus0 bus 0: configuration mode 1 (no bios)
pchb0 at pci0 dev 0 function 0 "Intel 82443BX PCI-AGP" rev 0x03
ppb0 at pci0 dev 1 function 0 "Intel 82443BX AGP" rev 0x03
pci1 at ppb0 bus 1
vga1 at pci1 dev 0 function 0 "3DFX Interactive Voodoo3" rev 0x01
wsdisplay0 at vga1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
pcib0 at pci0 dev 4 function 0 "Intel 82371AB PIIX4 ISA" rev 0x02
pciide0 at pci0 dev 4 function 1 "Intel 82371AB IDE" rev 0x01: DMA, channel 0 wired to compatibility, channel 1 wired to compatibility
wd0 at pciide0 channel 0 drive 0: <WDC AC34300L>
wd0: 16-sector PIO, LBA, 4104MB, 8896 cyl, 15 head, 63 sec, 8406720 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2
atapiscsi0 at pciide0 channel 1 drive 0
scsibus0 at atapiscsi0: 2 targets
cd0 at scsibus0 targ 0 lun 0: <LG, CD-ROM CRD-8322B, 1.04> SCSI0 5/cdrom removable
cd0(pciide0:1:0): using PIO mode 4, DMA mode 2
uhci0 at pci0 dev 4 function 2 "Intel 82371AB USB" rev 0x01: irq 9
usb0 at uhci0: USB revision 1.0
uhub0 at usb0
uhub0: vendor 0x0000 UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
"Intel 82371AB Power Mgmt" rev 0x02 at pci0 dev 4 function 3 not configured
fxp0 at pci0 dev 9 function 0 "Intel 82557" rev 0x02: irq 9, address 00:60:b0:6b:4d:49
inphy0 at fxp0 phy 1: i82555 10/100 media interface, rev. 0
xl0 at pci0 dev 10 function 0 "3Com 3c900B 10Mbps" rev 0x04: irq 9 address 00:50:04:72:32:24
"Conexant 56k Winmodem" rev 0x08 at pci0 dev 11 function 0 not configured
xl1 at pci0 dev 13 function 0 "3Com 3c905C 100Base-TX" rev 0x78: irq 9xl1: command never completed!
xl1: command never completed!
address 00:01:03:d5:c0:2a
exphy0 at xl1 phy 24: 3Com internal media interface
xl1: command never completed!
xl1: command never completed!
isa0 at pcib0
isadma0 at isa0
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pcppi0 at isa0 port 0x61
midi0 at pcppi0: <PC speaker>
sysbeep0 at pcppi0
lpt0 at isa0 port 0x378/4 irq 7
npx0 at isa0 port 0xf0/16: using exception 16
pccom0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
pccom1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec
biomask c240 netmask c240 ttymask c2c2
pctr: 686-class user-level performance counters enabled
mtrr: Pentium Pro MTRR support
dkcsum: wd0 matched BIOS disk 80
root on wd0a
rootdev=0x0 rrootdev=0x300 rawdev=0x302
umass0 at uhub0 port 1 configuration 1 interface 0
umass0: ----- Ltd. SPRING-Rev1.1, rev 1.10/0.12, addr 2
umass0: using SCSI over BBB-P
scsibus1 at umass0: 2 targets
sd0 at scsibus1 targ 1 lun 0: <SPRING, MultiCard Slot A, 0100> SCSI0 0/direct removable
sd0: 123MB, 438224 cyl, 4 head, 0 sec, 512 bytes/sec, 251904 sec total
uhidev0 at uhub0 port 2 configuration 1 interface 0
uhidev0: ATEN 4 Ports USB KVM A R1.31, rev 1.10/1.00, addr 3, iclass 3/1
ukbd0 at uhidev0: 8 modifier keys, 6 key codes
wskbd1 at ukbd0 mux 1
wskbd1: connecting to wsdisplay0
uhidev1 at uhub0 port 2 configuration 1 interface 1
uhidev1: ATEN 4 Ports USB KVM A R1.31, rev 1.10/1.00, addr 3, iclass 3/1
ums0 at uhidev1: 5 buttons and Z dir.
wsmouse0 at ums0 mux 0


This is with a 128 meg Lexar card I borrowed from a friend.

elmore
August 28th, 2003, 15:50
You're going to need to compile a custom kernel for sure or you'll have problems.

See here, this works better than OpenSoekris in my opinion:

http://www.nmedia.net/~chris/soekris/install.html

cod3fr3ak
August 28th, 2003, 15:51
Here is the output from the fdisk using the new card:


test# fdisk sd0
Aug 28 10:50:43 test /bsd: sd0: mode sense (4) returned nonsense; using fictitious geometry
Aug 28 10:50:43 test /bsd: sd0: mode sense (4) returned nonsense; using fictitious geometry
fdisk: sysctl(machdep.bios.diskinfo): Device not configured
Disk: sd0 geometry: 123/64/32 [251904 Sectors]
Offset: 0 Signature: 0xAA55
Starting Ending LBA Info:
#: id C H S - C H S [ start: size ]
------------------------------------------------------------------------
*0: 06 0 1 1 - 122 55 32 [ 32: 251616 ] DOS > 32MB
1: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
3: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused


Notice the chs: geometry: 123/64/32 [251904 Sectors]
The Soekris board reports the geometry as: Pri Mas LEXAR ATA FLASH LBA 984-8-32 126 Mbyte.
Both chs settings result in the same number of sectors: 251904?!?!?!?

So which is correct and how do I get OpenBSD to realize it?

cod3fr3ak
August 28th, 2003, 16:46
EUREKA!!!!

Elmore, the flashdist proggie worked like a charm!

Now that I have a working soekris I'll work on customizing it. Thanks.

elmore
August 28th, 2003, 17:03
glad it helped. I like it a lot better than the OpenSoekris at this point.

cod3fr3ak
August 29th, 2003, 20:15
The OpenSoekris script is a good idea. But he hardcoded a bunch of stuff that causes it to not work for me. I like the way that the flashdist program takes my geometry and ignores the bios information, and then writes to the card. Are there any good tutorials on building custom kernels out there?

Kernel_Killer
March 27th, 2005, 19:06
I've found one good reason to use OpenSoekris, and that's to get the working NSH out of it. Everything else about it I haven't found a use for.