spz: (Default)

While looking online for a cable for my husband (I have the credit card, I get to order stuff online), I happened upon the bonebox from adafruit, and decided that it was too cute and I should get one.

With content, of course.

Things bought so far:

  • BeagleBone Black board (comes with a normal-to-mini USB cable that also serves as power supply)
  • bonebox
  • power supply (for when I connect a USB disk or other things that draw more power than USB will deliver)
  • 32G microSDXC-card (I bought a SanDisk, others are probably fine too)
  • micro-HDMI to DVI cable (has yet to arrive)

What I didn't have to buy because we already had one extra was a
uftdi0 at uhub7 port 1
uftdi0: FTDI C232HM-DDHSL-0, rev 2.00/9.00, addr 2
ucom0 at uftdi0 portno 1

USB to a bunch of single pole connectors (to connect single wires to a pin header). Mine is a 10 pole 3.3V MPSSE cable. A Raspberry PI console cable should be readily available and does the same (and you wouldn't have to bind back 7 cables you aren't using to keep the setup neat). To connect it to the board, ground goes to the pin tagged J1 (for this cable, black), TCK (orange, output) goes on pin 4 and TDI (yellow, input) on pin 5. Since the bonebox doesn't expect a serial console to get connected (Linux uses the USB device port for console, too), it lacks an opening for that cable. I drilled a 4mm hole into the upper cover with a hand drill with a wood drill bit (if you use electric, go slow). 4.5mm would have made fitting the third connector through easier.

Next comes preparing software for it. It comes with Angstrom Linux and I'm sure that's a deserving OS and all that, but I'm a NetBSD developer and want to use NetBSD wherever compatible with the purpose of the device (which this thing hasn't yet besides being cute, so definitely, NetBSD goes on it). This precipitates one of the most difficult decisions to be made: choosing its name. All my devices are named after lesser constellations. Studying the list of constellation names yields *drumroll* pyxis, the compass box.

With this decision made, I can create a custom kernel config for pyxis, named PYXIS, in sys/arch/evbarm/conf:
# PYXIS' config

include "arch/evbarm/conf/BEAGLEBONE"

options IPSEC

no options COMPAT_50
no options COMPAT_40
no options COMPAT_30

file-system KERNFS
file-system PROCFS

no config netbsd
config netbsd root on ld0a type ffs

As you can see, this is just adjusting for local preferences and in fact I'll be building the BEAGLEBONE kernel as well. I'll first get the general software built from a -current src tree as can be gotten e.g. by
cvs -q -d anoncvs@anoncvs..netbsd.org:/cvsroot get -PA src
by running build.sh from the src directory, like so:
./build.sh -x -U -m evbearmv7hf-el release
This means: I want to build X11 (-x), I want to build unprivileged and create an owner and permissions map instead (-U) since the image build will need it, and the architecture to build is evbarm with little-endian earm v7 and hard float ABI, yielding
===> NetBSD version:      6.99.28
===> MACHINE:             evbarm
===> MACHINE_ARCH:        earmv7hf
===> Build platform:      NetBSD 6.99.28 amd64
I'm building on a pretty -current NetBSD/amd64, but any other Unix from this century with a development suite (compiler and a few tools) installed should serve as well. Cygwin might do as well.
Time for coffee and my mother's Quarkstollen.

Note I could also just get a daily build for evbarm-earmhf at e.g. http://nyftp.netbsd.org/pub/NetBSD-daily/HEAD/201312270850Z/evbarm-earmhf/ if my Internet connection was faster than my laptop, and that would work as well.

Then I build the kernel I want to use:
./build.sh -x -U -m evbearmv7hf-el kernel=PYXIS

The release build has created an image file in .../release/evbarm/binary/gzimg called beagleboard.img.gz
This gets unpacked and dd'd to the sdcard:
gzcat beagleboard.img.gz | dd of=/dev/rld0d obs=64k

When this is done,
disklabel ld0
# /dev/rld0d:
type: SCSI
label: fictitious
flags: removable
bytes/sector: 512
sectors/track: 32
tracks/cylinder: 64
sectors/cylinder: 2048
cylinders: 622
total sectors: 1275808
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 

8 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:    890784    385024     4.2BSD      0     0     0  # (Cyl.    188 -    622*)
 b:    262144    122880       swap                     # (Cyl.     60 -    187)
 c:   1275808         0     unused      0     0        # (Cyl.      0 -    622*)
 d:   1275808         0     unused      0     0        # (Cyl.      0 -    622*)
 e:    114688      8192      MSDOS                     # (Cyl.      4 -     59)

I mount /dev/ld0e /mnt to copy the kernel I built, .../compile/PYXIS/netbsd.ub to /mnt as pyxis.ub, and to edit uEnv.txt to boot pyxis.ub instead of bboard.ub or the also present bbone.ub.
Alas, the msdos filesystem is broken (the joys of -current ... I'll check what goes wrong there later), so I re-format it and copy the kernel image onto it and create a new uEnv.txt.

The uEnv.txt I use is:
uenvcmd=mmc dev 0; mmc rescan; mmc dev 1; mmc rescan; fatload mmc 0:1 82000000 pyxis.ub; bootm 82000000

Kudos to John Klos and his mail to port-arm in July which provided invaluable pointers; it's 4 months later and booting directly off the sdcard works now, and getting it partitioned etc is much easier now too.

umount, sdcard from laptop to pyxis, boot ..
SD/MMC found on device 0
reading uEnv.txt
120 bytes read in 3 ms (39.1 KiB/s)
Loaded environment from uEnv.txt
Importing environment from mmc ...
Running uenvcmd ...
mmc0 is current device
mmc1(part 0) is current device
mmc_send_cmd : timeout: No status update
reading pyxis.ub
3356864 bytes read in 406 ms (7.9 MiB/s)
## Booting kernel from Legacy Image at 82000000 ...
   Image Name:   NetBSD/beagle 6.99.28
   Image Type:   ARM NetBSD Kernel Image (uncompressed)
   Data Size:    3356800 Bytes = 3.2 MiB
   Load Address: 80300000
   Entry Point:  80300000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
## Transferring control to NetBSD stage-2 loader (at address 80300000) ...
uboot arg = 0x9f238fe0, 0, 0x9f3a1235, 0x9f240648
[ Kernel symbol table missing! ]
Loaded initial symtab at 0x805a4f50, strtab at 0x805cfde0, # entries 10965
pmap_postinit: Allocated 35 static L1 descriptor tables
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 6.99.28 (PYXIS) #1: Sun Dec 29 13:21:59 CET 2013
total memory = 512 MB
avail memory = 498 MB
sysctl_createv: sysctl_create(machine_arch) returned 17
timecounter: Timecounters tick every 10.000 msec
mainbus0 (root)
cpu0 at mainbus0 core 0: 550 MHz Cortex-A8 r3p2 (Cortex V7A core)
cpu0: DC enabled IC enabled WB disabled EABT branch prediction enabled
cpu0: isar: [0]=0x101111 [1]=0x13112111 [2]=0x21232031 [3]=0x11112131, [4]=0x11142, [5]=0
cpu0: mmfr: [0]=0x1100003 [1]=0x20000000 [2]=0x1202000 [3]=0x211
cpu0: pfr: [0]=0x1131 [1]=0x11
cpu0: 32KB/64B 4-way L1 Instruction cache
cpu0: 32KB/64B 4-way write-back-locking-C L1 Data cache
cpu0: 256KB/64B 8-way write-through L2 Unified cache
vfp0 at cpu0: NEON MPE (VFP 3.0+)
vfp0: mvfr: [0]=0x11110222 [1]=0x11111
obio0 at mainbus0 base 0x44000000-0x4fffffff: On-Board IO
omapicu0 at obio0 addr 0x48200000-0x48200fff intrbase 0
prcm0 at obio0 addr 0x44e00000-0x44e01fff: Power, Reset and Clock Management
sitaracm0 at obio0 addr 0x44e10000-0x44e11fff: control module, rev 1.0
gpmc0 at mainbus0 base 0x50000000: General Purpose Memory Controller, rev 6.0
gpmc0: CS#0 valid, addr 0x08000000, size 256MB
com0 at obio0 addr 0x44e09000-0x44e09fff intr 72: ns16550a, working fifo
com0: console
sdhc0 at obio0 addr 0x48060100-0x48060fff intr 64: SDHC controller
sdhc0: SD Host Specification 2.0, rev.49
sdmmc0 at sdhc0 slot 0
sdhc1 at obio0 addr 0x481d8100-0x481d8fff intr 28: SDHC controller
sdhc1: SD Host Specification 2.0, rev.49
sdmmc1 at sdhc1 slot 0
tiiic0 at obio0 addr 0x44e0b000-0x44e0bfff intr 70: rev 0.11
iic0 at tiiic0: I2C bus
seeprom0 at iic0 addr 0x50: AT24Cxx or compatible EEPROM: size 32768
tps65217pmic0 at iic0 addr 0x24: TPS65217C Power Management Multi-Channel IC (rev 1.2)
tps65217pmic0: power sources USB max 1300 mA, [AC] max 2500 mA
tps65217pmic0: [LDO1: 1800 mV] [LDO2: 3300 mV] [LDO3: 1800 mV] [LDO4: 3300 mV] [DCDC1: 1500 mV] [DCDC2: 1100 mV] [DCDC3: 1100 mV] 
omapdmtimer0 at obio0 addr 0x48040000-0x48040fff intr 68: DMTIMER2
omapdmtimer1 at obio0 addr 0x44e31000-0x44e31fff intr 67: DMTIMER1ms
omapdmtimer2 at obio0 addr 0x48044000-0x48044fff intr 92: DMTIMER4
omapwdt32k0 at obio0 addr 0x44e35000-0x44e35fff: rev 0.1
cpsw0 at obio0 addr 0x4a100000-0x4a107fff intrbase 40: TI CPSW Ethernet
cpsw0: Ethernet address 90:59:af:cen:sor:ed
ukphy0 at cpsw0 phy 0WARNING: module error: vfs load failed for `miiverbose', error 45
: OUI 0x00800f, model 0x000f, rev. 1
ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0
timecounter: Timecounter "dmtimer" frequency 24000000 Hz quality 100
IPsec: Initialized Security Association Processing.
ld1 at sdmmc1: <0xfe:0x014e:MMC02G:0x00:0x5581cc4e:0x000>
ld1: 1832 MB, 930 cyl, 64 head, 63 sec, 512 bytes/sect x 3751936 sectors
ld1: 4-bit width, bus clock 52.000 MHz
ld0 at sdmmc0: <0x03:0x5344:SU32G:0x80:0x22ae1589:0x0db>
ld0: 30436 MB, 7729 cyl, 128 head, 63 sec, 512 bytes/sect x 62333952 sectors
ld0: 4-bit width, bus clock 25.000 MHz
NetBSD/evbarm (beagleboard) (console)


At present only 622MB of the sdcard are in use and the root filesystem is pretty full, and the sdcard is significantly larger, so I'll grow the root filesystem using the recipy from the ports/evbarm/beaglebone wiki page.

This done, reboot, and getting pyxis set up like any other NetBSD: editing rc.conf, creating users, building and installing packages, ...

A lot of devices the BeagleBone Black contains aren't yet supported; progress reports on that is going to be subject to a later post.

spz: (Default)

I have a new server, a DL120 G7.
I originally installed a standard NetBSD/amd64 6.1 on it; it's main purpose is to have lots of disk.
It currently has two physical disks which are mirrored using raidframe, since the built-in "simple" SATA raid controller won't serve disks larger than 2TB. For that reason, also, its bootblock is on a USB memory stick - boot.cfg and kernel etc are already read from RAID.

Lately, an extra use for it offered itself, so I:

  • grabbed the NetBSD Xen Howto
  • installed 6.1.2 (just out, get it while it's fresh)
  • installed a XEN3_DOM0 kernel
  • installed xenkernel42 and xentools42 (with its stately procession of dependencies. perl, python AND ocaml ..)
  • added a Xen line to its boot.cfg (the man page has an example)
  • rebooted to Xen. Lo and behold, a Xen dom0 (that was easy)

Since there's little point in a dom0 all by itself, on to preparing a guest:

Since it's a xen*42, /usr/pkg/share/examples/rc.d/ had xencommons, xend, xendomains and xen-watchdog; I copied these to /etc/rc.d and put xencommons=YES, xend=YES and xendomains="$guestname" into rc.conf.

I had partitioned the disk to reserve some space for potential package bulk building, and made these partitions into their extra raidframe instances. I now used one of these to turn raid3e into raid3a and a bit of swap.

newfs raid3a, mount it to /mnt, unpack sets and the XEN3_DOMU kernel to it, MAKEDEV in /mnt/dev and give /mnt/etc a few licks (normally one'd use sysinst for all of that), umount /mnt.

On to creating the Xen guest description file: I copied /usr/pkg/share/examples/xen/xmexample1 to /usr/pkg/etc/xen/$guestname, and ended up kicking out most of the entries. I retained kernel, memory, name, cpus, vcpus, vif and disk.

For vif, some more work on the dom0 was necessary: I created bridge0 and "brconfig bridge0 add"'ed the physical ethernet interface, set the bridge "up" and made it all reboot-safe.

xm create -c $guestname, some head-scratching, a correction of the disk line syntax (/var/log/xen/* had hints what it didn't like; it wanted: "disk = [ 'phy:/dev/raid3a,0x1,w' ]") and I had a running guest.

Some more administrative niceties like installing a few packages on it, making sure it knows where to send root mail, etc pp, and it's ready for business.

Things to find out some other time, for another guest: mount a partition of the dom0 readonly?

And todo (there is always at least one todo left): update the NetBSD Xen Howto to reflect the availability of xenkernel42 and xentools42.


spz: (Default)

January 2015

12131415 161718


RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated 2017-06-28 01:59
Powered by Dreamwidth Studios