Attention!
Please use arm/Allwinner instead.
The information here is deprecated and kept only for historical reasons.
FreeBSD on Cubieboard(1,2)
Cubieboard is a developer board that is based on the Allwinner A10/A20 System-On-Chip (SoC).
The full technical details for the Cubieboard are available at the sunxi wiki.
Since Cubieboard SD controller is not supported by FreeBSD yet, to boot the system on Cubieboard, you'll need some complex setup:
- microSD card with u-boot loader and msdos filesystem containing FreeBSD kernel.
- USB memory stick with FreeBSD root filesystem.
When Cubieboard is booted with microSD inserted, it tries to boot from it before NAND, so it'll run uboot from SD which in turn will load and run kernel. As said, lacking SD controller support, kernel has no access to microSD, so root is mounted from USB stick instead.
Build FreeBSD
1. Get FreeBSD head
2. Compile kernel and world. Install world to USB Flash (replace da0 with your usb storage device). CUBIEBOARD should be changed to CUBIEBOARD2 if you have Cubieboard2 (Please note: Change da0s2 to da0 in kernel config).
# truncate -s 1024M cubie.img # mdconfig -f cubie.img -u0 # newfs /dev/md0 # mount /dev/md0 /mnt # make TARGET_ARCH=armv6 kernel-toolchain # make TARGET_ARCH=armv6 KERNCONF=CUBIEBOARD buildkernel # make TARGET_ARCH=armv6 buildworld # make TARGET_ARCH=armv6 DESTDIR=/mnt installworld distribution # umount /mnt # mdconfig -d -u0 # sysctl kern.geom.debugflags=16 # dd if=cubie.img of=/dev/da0 bs=4096k
Prepare SD card
1. For Cubieboard1, get SPL file from here, for Cubieboard2, get SPL file from http://files.androtab.info/allwinner/cubieboard2/sunxi-spl.bin
2. For Cubieboard1, get U-Boot binary from here, for Cubieboard2, get U-Boot binary from here
3. Write binaries (replace da4 with your device). CUBIEBOARD should be changed to CUBIEBOARD2 if you have Cubieboard2.
# dd if=/dev/zero of=a10.img bs=1m count=1 # dd if=sunxi-spl.bin conv=notrunc of=a10.img bs=1024 seek=8 # dd if=u-boot.bin conv=notrunc of=a10.img bs=1024 seek=32 # dd if=a10.img of=/dev/da4 bs=1m # gpart create -s MBR /dev/da4 # gpart add -b 1m -s 24m -t '\!12' /dev/da4 # gpart set -a active -i 1 /dev/da4 # newfs_msdos -L boot -F 16 /dev/da4s1 # mount_msdosfs /dev/da4s1 /mnt # cp /usr/obj/arm.armv6/usr/src/sys/CUBIEBOARD/kernel /mnt # umount /mnt
Boot
1. Put SD card and USB flash to Cubieboard.
2. Connect by using serial console cable and speed 115200
# cu -l /dev/ttyU0 -s 115200
3. Power ON your board and set boot command
sun4i# fatload mmc 0 0x40200000 kernel; go 0x40200100
Automated boot
For boot to not require user interaction, proceed with the following:
1. Install devel/uboot-mkimage port
2. Write a script named boot.cmd with above mentioned loader commands:
fatload mmc 0 0x40200000 kernel go 0x40200100
3. Use mkimage to convert this script to boot.scr which uboot understands:
mkimage -C none -A arm -T script -d boot.cmd boot.scr
4. Place generated boot.scr onto filesystem on microSD card. Now uboot will execute commands from your script instead of bailing into prompt, so kernel will be run automatically
Details are available here