File:  [NetBSD Developer Wiki] / wikisrc / ports / evbarm / allwinner.mdwn
Revision 1.55: download - view: text, annotated - select for diffs
Thu Dec 10 08:00:19 2015 UTC (5 years, 5 months ago) by leot
Branches: MAIN
CVS tags: HEAD
regen the page (after I've apparently offended it via a comment).

XXX: maybe we can restrict the various problems appeared on the wiki with just
XXX: pages with comments? I'll keep an eye on those.

    1: [[!meta title="NetBSD/evbarm on Allwinner Technology SoCs"]]
    2: 
    3: NetBSD 7.0 has support for A20 and A31 SoCs. NetBSD -current adds support for A80 SoCs.
    4: 
    5: [[!toc levels=2]]
    6: 
    7: # Supported boards
    8:  - [Banana Pi](http://www.bananapi.org/p/product.html) (BPI)
    9:  - Cubieboard 2 (CUBIEBOARD)
   10:  - [Cubieboard 4](http://cubieboard.org/model/cb4/) (ALLWINNER_A80) *NetBSD-current*
   11:  - Cubietruck (CUBIETRUCK)
   12:  - [Merrii Hummingbird A31](http://www.merrii.com/en/pla_d.asp?id=172) (HUMMINGBIRD_A31)
   13: 
   14: # Supported hardware
   15:  - SoCs
   16:    - Cortex-A7: A20 (2-core), A31 (4-core), A80
   17:    - Cortex-A7/A15: A80 (4-core A7 + 4-core A15)
   18:  - SD/MMC controller (DMA)
   19:  - DMA controller
   20:  - GPIO
   21:    - Configuration using FEX scripts is supported
   22:  - UART
   23:  - I2C
   24:  - P2WI (A31) / RSB (A80)
   25:  - PMU
   26:    - AXP209 (A20)
   27:    - AXP221 (A31)
   28:    - AXP806 (A80)
   29:    - AXP809 (A80)
   30:  - Watchdog timer
   31:  - RTC
   32:    - A20/A31: integrated RTC, PCF8563
   33:    - A80: AC100
   34:  - Audio codec (A20/A31)
   35:  - USB host
   36:    - OHCI
   37:    - EHCI
   38:    - OTG (A20)
   39:  - SATA (A10/A20)
   40:  - Gigabit Ethernet (GMAC)
   41:  - HDMI
   42:    - DDC / EDID mode detection (A20/A31)
   43:    - Audio support (A20/A31)
   44:  - Framebuffer (A20/A31/A80)
   45:  - IR receiver (A20/A31/A80)
   46: 
   47: # TODO
   48:  - A10
   49:    - Interrupt controller
   50:    - EMAC
   51:  - A31
   52:    - OTG
   53:    - IR transmitter
   54:    - 3G module
   55:    - TV input
   56:  - A80
   57:    - MP
   58:    - big.LITTLE support
   59:    - USB3 (OTG and XHCI)
   60:    - IR transmitter
   61:    - HDMI (DDC and mode setting; currently relies on U-Boot for setup)
   62:    - Audio codec
   63:  - All
   64:    - USB device mode
   65:    - SDIO (Bluetooth / WiFi)
   66:    - NAND
   67:    - VGA (Cubietruck, Hummingbird A31, Cubieboard4)
   68: 
   69: # Installation
   70: 
   71: ## A20 / A31 based boards
   72: 
   73: * Start with an ARMv7 image from *evbarm-earmv7hf/binary/gzimg/armv7.img.gz* from
   74: NetBSD 7.0
   75: * Download a U-Boot build for your board
   76:   * Download the correct build from the linux-sunxi web site <http://dl.linux-sunxi.org/nightly/u-boot-sunxi/u-boot-sunxi-mainline/u-boot-sunxi-mainline-latest/>.
   77: * Decompress the image via [[!template id=man name="gunzip" section="1"]]:
   78: [[!template  id=programlisting text="""
   79: # gunzip armv7.img.gz
   80: """]]
   81: * Write the *u-boot-sunxi-with-spl.bin* loader to the empty space at the start of the base image:
   82: [[!template  id=programlisting text="""
   83: # dd if=u-boot-sunxi-with-spl.bin of=armv7.img bs=1k seek=8 conv=notrunc
   84: """]]
   85: * Write the image to an SD card (e.g.: if the SD card is recognised as *sd0* -
   86: please check the [[!template id=man name="dmesg" section="8"]] output to be
   87: sure!):
   88: [[!template  id=programlisting text="""
   89: # dd if=armv7.img of=/dev/rsd0d bs=1m
   90: """]]
   91: * Copy the kernel (*netbsd.ub*) for your board to the root of the MS-DOS
   92: partition on the SD card
   93: * Prepare a *boot.cmd* file for U-Boot boot loader containing the needed
   94: instructions regarding how to boot the kernel (basically the *bootargs* that are
   95: passed to the kernel and how to load the kernel from a device to the RAM and
   96: then boot it from the memory address):
   97: [[!template  id=programlisting text="""
   98: setenv kernel_addr      82000000
   99: setenv kernel           netbsd.ub
  100: setenv bootargs         "root=ld0a"
  101: 
  102: fatload mmc 0:1 ${kernel_addr} ${kernel}
  103: bootm ${kernel_addr}
  104: """]]
  105: * The *boot.cmd* text file should be converted in a script image - *boot.scr*
  106: for U-Boot via [[!template id=man name="mkubootimage" section="1"]]:
  107: [[!template  id=programlisting text="""
  108: # mkubootimage -A arm -n armv7 -T script boot.cmd boot.scr
  109: """]]
  110: * Copy the *boot.scr* to the MS-DOS partition of the SD card
  111: 
  112: ## A80 based boards
  113: 
  114: * Cubieboard 4 U-Boot for SD card: <http://ftp.netbsd.org/pub/NetBSD/misc/jmcneill/allwinner/a80/cubieboard4-uboot.tgz>
  115: [[!template  id=programlisting text="""
  116: # dd if=u-boot-spl.bin of=/dev/sdd bs=1k seek=8
  117: # dd if=u-boot-sun9iw1p1.bin of=/dev/sdd bs=1k seek=19096
  118: """]]
  119: * First partition needs to be at +20MB offset. Format it as MSDOS, copy 'netbsd.ub' to it as 'uImage'.
  120: 
  121: # Big (endian) fun
  122: 
  123: You can run this boards with a little endian (this is the default and implied by above install instructions)
  124: or with a big endian kernel and userland. However, kernel and userland endianness needs to match.
  125: 
  126: To build a big endian release (or sets) use 
  127: [[!template  id=programlisting text="""
  128: ./build.sh -m evbearmv7hf-eb 
  129: """]]
  130: where -eb means endianness big, hf is hardware floating point support, and earm is the modern "extended" ABI for ARM CPUs, and finally v7 is version 7 of the supported instruction set.
  131: 
  132: # FEX scripts
  133: 
  134: Board configuration scripts can be found here: <https://github.com/linux-sunxi/sunxi-boards/blob/master/sys_config>. You can compile them with the "fex2bin" tool found here: <https://github.com/linux-sunxi/sunxi-tools>.
  135: 
  136: To use, copy the compiled FEX to your MS-DOS partition, load it with U-Boot, and then tell the kernel where to find it with the "sysconfig=" boot option. For example, uEnv.txt on a Cubieboard2 might look like this:
  137: 
  138: [[!template  id=programlisting text="""
  139: bootargs=root=ld0a sysconfig=0x43000000
  140: uenvcmd=mmc dev 0; mmc rescan; fatload mmc 0:1 43000000 cubieboard2.bin; fatload mmc 0:1 82000000 netbsd.ub; bootm 82000000
  141: """]]
  142: 
  143: Some pre-compiled .bin files can be found here: <http://ftp.netbsd.org/pub/NetBSD/misc/jmcneill/allwinner/fex/>
  144: 
  145: # Framebuffer console
  146: 
  147: To use HDMI for the console device, add *console=fb* to bootargs in uEnv.txt.
  148: 
  149: If the connected display does not let you disable overscan, you can add a margin to the framebuffer by with the *fb.margin* bootargs option. For example, to set a 25-pixel margin around the screen, add *fb.margin=25* to uEnv.txt
  150: 
  151: # HDMI audio
  152: 
  153: The default audio device is the analog audio codec. To change the default device, use the *audiocfg* command:
  154: 
  155: [[!template  id=programlisting text="""
  156: a31# audiocfg list
  157: 0: [*] audio0 @ awinac0: Allwinner CODEC A31, 2 playback channels
  158: 1: [ ] audio1 @ awinhdmiaudio0: Allwinner HDMI 1.4, 2 playback channels
  159: a31# audiocfg default 1
  160: setting default audio device to audio1
  161: a31# audiocfg list
  162: 0: [ ] audio0 @ awinac0: Allwinner CODEC A31, 2 playback channels
  163: 1: [*] audio1 @ awinhdmiaudio0: Allwinner HDMI 1.4, 2 playback channels
  164: """]]
  165: 
  166: # MAC address
  167: 
  168: On boards where the ethernet MAC address cannot be determmined, a random MAC address will be generated every boot. You can override this behaviour by specifying a MAC address in *uEnv.txt*:
  169: [[!template  id=programlisting text="""
  170: bootargs=root=ld0a awge0.mac-address=02:a0:3d:88:1a:1e
  171: """]]
  172: 

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb