DirtOS notes

booting

IMPORTANT always use an external power source that can supply at least 10W!
I had MMC (SD card) detection issues in u-boot when I ran my Cubieboard2 off just the micro-USB port.

Allwinner A20 (Cubieboard2)

use u-boot config Cubieboard2_defconfig
I don't have a suitable power connector for this board, so I've switched to my A10 board for now.

Allwinner A10 (OLinuXino Lime)

u-boot

  1. choose a release
  2. download
    1. wget "ftp://ftp.denx.de/pub/u-boot/u-boot-2017.01.tar.bz2" (about 12MB in size)
    2. wget "ftp://ftp.denx.de/pub/u-boot/u-boot-2017.01.tar.bz2.sig"
    3. gpg --verify --keyring ./uboot-keyring.gpg ./u-boot-2017.01.tar.bz2.sig
  3. extract
    1. tar xf u-boot-2017.01.tar.bz2
    2. cd u-boot-2017.01
  4. configure
    1. make CROSS_COMPILE=arm-none-eabi- A10-OLinuXino-Lime_defconfig
      • configurations can be listed with ls ./configs/
  5. build
    1. install build-essential, arm-none-eabi toolchain, bc, device-tree-compiler
    2. make CROSS_COMPILE=arm-none-eabi- -j4
  6. test
    1. connect the USB serial device to the Allwinner device
      • only connect the TX, RX, and GND lines, do not connect the power line!
      • connect USB serial TX to Allwinner RX
      • connect USB serial RX to Allwinner TX
    2. screen /dev/ttyUSB0 115200
    3. sunxi-fel uboot ./u-boot-sunxi-with-spl.bin
    4. check for u-boot messages in the serial console

OEM u-boot image for the Cubieboard2 is here but it's really old (2014.01-rc1-09154-gfb357b4)

fun u-boot commands:

USB

prerequisites:

steps:

  1. set up the board to boot into FEL mode
    • don't use a board with NAND
      • maybe a blank NAND would work
    • remove any SD cards
  2. connect USB
  3. send u-boot
    • u-boot only
      • sunxi-fel uboot ./u-boot-sunxi-with-spl.bin
    • u-boot with Linux kernel
      • sunxi-fel -v uboot u-boot-sunxi-with-spl.bin write 0x42000000 uImage write 0x43100000 boot.scr
        • TODO confirm this

SD

layout (from sunxi wiki):

formatting steps:

  1. clear the beginning of the SD card
    1. sudo dd if=/dev/zero of=${SDCARD} bs=1M count=4
  2. partition the SD card
    1. sudo parted ${SDCARD}
      1. mklabel msdos
      2. mkpart primary fat32 1M 100%
        • 1M value comes from the layout table above
      3. quit
  3. format the partition
    1. sudo mkfs --type vfat -F 32 ${SDCARDp1}
  4. write u-boot to the SD card
    1. sudo dd if=./u-boot-sunxi-with-spl.bin of=${SDCARD} bs=1K seek=8
  5. flush disk cache
    1. sync
  6. check that the FAT32 partition wasn't clobbered
    1. sudo fsck -t vfat -M -N ${SDCARDp1}
  7. eject SD card

linux stuff:

user program

ELF

Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  y (purecode), p (processor specific)

static ELF, not stripped

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text.startup.mai PROGBITS        40000000 010000 000088 00  AX  0   0  4
  [ 2] .rodata.main.str1 PROGBITS        40000088 010088 000008 01 AMS  0   0  4
  [ 3] .debug_info       PROGBITS        00000000 010090 00033c 00      0   0  1
  [ 4] .debug_abbrev     PROGBITS        00000000 0103cc 0001d5 00      0   0  1
  [ 5] .debug_loc        PROGBITS        00000000 0105a1 000081 00      0   0  1
  [ 6] .debug_aranges    PROGBITS        00000000 010622 000030 00      0   0  1
  [ 7] .debug_ranges     PROGBITS        00000000 010652 000048 00      0   0  1
  [ 8] .debug_line       PROGBITS        00000000 01069a 000083 00      0   0  1
  [ 9] .debug_str        PROGBITS        00000000 01071d 00026a 01  MS  0   0  1
  [10] .comment          PROGBITS        00000000 010987 00001a 01  MS  0   0  1
  [11] .ARM.attributes   ARM_ATTRIBUTES  00000000 0109a1 00003b 00      0   0  1
  [12] .debug_frame      PROGBITS        00000000 0109dc 000044 00      0   0  4
  [13] .symtab           SYMTAB          00000000 010a20 000130 10     14  18  4
  [14] .strtab           STRTAB          00000000 010b50 000013 00      0   0  1
  [15] .shstrtab         STRTAB          00000000 010b63 0000c1 00      0   0  1

static ELF, stripped

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text.startup.mai PROGBITS        40000000 010000 000088 00  AX  0   0  4
  [ 2] .rodata.main.str1 PROGBITS        40000088 010088 000008 01 AMS  0   0  4
  [ 3] .comment          PROGBITS        00000000 010090 00001a 01  MS  0   0  1
  [ 4] .ARM.attributes   ARM_ATTRIBUTES  00000000 0100aa 00003b 00      0   0  1
  [ 5] .shstrtab         STRTAB          00000000 0100e5 00004b 00      0   0  1

protection

CPU features

ARMv7

ARMv8

QEMU machine selection

ARM machines that might have vsync interrupt support:

PXA270 looks to be the best supported

other OS APIs

might as well cherry-pick useful API calls from existing OSs/kernels

MS-DOS API

from the MS-DOS API Wikipedia article and Barry ???

PlayStation Portable kernel API

From PPSSPP source code

asynchronous call interface ideas

notes: