File:  [NetBSD Developer Wiki] / wikisrc / ports / evbarm / odroid-c1.mdwn
Revision 1.20: download - view: text, annotated - select for diffs
Wed Oct 28 18:05:41 2015 UTC (5 years, 6 months ago) by wiki
Branches: MAIN
CVS tags: HEAD
web commit by riz: beagleboard.img is armv7.img these days

    1: [[!meta title="NetBSD/evbarm on Hardkernel ODROID-C1"]]
    2: 
    3: [ODROID-C1](http://www.hardkernel.com/main/products/prdt_info.php?g_code=G141578608433&tab_idx=1) was a $35 quad-core SBC from Hardkernel. ODROID-C1 support was introduced in NetBSD 7.0.  It has been succeeded by the [ODROID-C1+](http://www.hardkernel.com/main/products/prdt_info.php?g_code=G143703355573), which is supported by the same NetBSD kernel.
    4: 
    5: [[!toc levels=2]]
    6: 
    7: # Supported hardware
    8:  - CPU: Cortex-A5: Amlogic S805 (4-core) at 1.5GHz
    9:    - CPU frequency scaling is supported with machdep.cpu sysctl tree
   10:    - SMP supported
   11:    - PL310 L2 cache controller
   12:  - GIC
   13:  - A5 watchdog timer
   14:  - A5 global timer
   15:  - "SDHC" and "SDIO" SD/MMC controllers (DMA)
   16:  - Serial console
   17:  - Framebuffer console
   18:  - USB host (OTG)
   19:  - Gigabit Ethernet (GMAC)
   20:    - RTL8211F PHY
   21:  - Hardware random number generator
   22:  - RTC
   23:  - GPIO
   24: 
   25: # TODO
   26:  - USB device mode
   27:  - IR receiver
   28:  - I2C
   29:  - Audio
   30: 
   31: # Installation
   32: 
   33: * Start with an ARMv7 image from *evbarm-earmv7hf/binary/gzimg/* such as *armv7.img*
   34: * Build U-Boot for ODROID-C1 <https://github.com/hardkernel/u-boot/tree/odroidc-v2011.03>
   35:   * Pre-built binaries here: <http://ftp.netbsd.org/pub/NetBSD/misc/jmcneill/odroidc1/u-boot-odroidc-v2011.03-20150308.tar.gz>
   36: * Note the location and size of the FFS partition in the * armv7.img* disklabel:
   37: [[!template  id=programlisting text="""
   38: # $TOOLDIR/bin/nbdisklabel -M evbarm -B le armv7.img
   39: ...
   40: 8 partitions:
   41: #        size    offset     fstype [fsize bsize cpg/sgs]
   42:  a:   1359312    385024     4.2BSD      0     0     0  # (Cyl.    188 -    851*)
   43:  b:    262144    122880       swap                     # (Cyl.     60 -    187)
   44:  c:   1744336         0     unused      0     0        # (Cyl.      0 -    851*)
   45:  d:   1744336         0     unused      0     0        # (Cyl.      0 -    851*)
   46:  e:    114688      8192      MSDOS                     # (Cyl.      4 -     59)
   47: """]]
   48: * Write the bootloader to the empty space at the start of the base image:
   49: [[!template  id=programlisting text="""
   50: # dd if=bl1.bin.hardkernel of=armv7.img bs=1 count=442 conv=notrunc
   51: # dd if=bl1.bin.hardkernel of=armv7.img bs=512 skip=1 seek=1 conv=notrunc
   52: # dd if=u-boot.bin of=armv7.img bs=512 seek=64 conv=notrunc
   53: """]]
   54: * Since the bootloader has overwritten the disklabel, we need to re-add partition "a" from the disklabel to the MBR partition table:
   55: [[!template  id=programlisting text="""
   56: # $TOOLDIR/bin/armv7--netbsdelf-eabihf-fdisk -u armv7.img
   57: ...
   58: Which partition do you want to change?: [none] 1
   59: The data for partition 1 is:
   60: <UNUSED>
   61: sysid: [0..255 default: 169] 
   62: start: [0..109cyl default: 63, 0cyl, 0MB] 385024
   63: size: [0..85cyl default: 1359312, 85cyl, 664MB] 1359312
   64: ...
   65: Which partition do you want to change?: [none] 
   66: ...
   67: Should we write new partition table? [n] y
   68: """]]
   69: * Write the image to an SD card.
   70: * Copy the kernel (netbsd.ub) for your board to the root of the MS-DOS partition on the SD card.
   71: * Create or edit *boot.ini* on the MS-DOS partition:
   72: [[!template  id=programlisting text="""
   73: ODROIDC-UBOOT-CONFIG
   74: 
   75: setenv bootargs "root=ld0f awge0.mac-address=${ethaddr}"
   76: setenv bootcmd "fatload mmc 0:1 0x21000000 netbsd.ub; bootm 0x21000000"
   77: run bootcmd
   78: """]]
   79: * On first boot, it will stop because of the wrong device in /etc/fstab. Take this opportunity to grow the root file-system:
   80: [[!template  id=programlisting text="""
   81: # fdisk -u ld0
   82: ...
   83: Which partition do you want to change?: [none] 1
   84: The data for partition 1 is:
   85: NetBSD (sysid 169)
   86:     start 385024, size 1359312 (664 MB, Cyls 23/246/32-108/147/55)
   87:         PBR is not bootable: All bytes are identical (0x00)
   88: sysid: [0..255 default: 169]
   89: start: [0..966cyl default: 385024, 24cyl, 188MB]
   90: size: [0..942cyl default: 1359312, 85cyl, 664MB] $
   91: ...
   92: Which partition do you want to change?: [none]
   93: ...
   94: Should we write new partition table? [n] y
   95: # resize_ffs -y /dev/rld0f
   96: # reboot
   97: """]]
   98: * Next boot, create a new /etc/fstab:
   99: [[!template  id=programlisting text="""
  100: # mount -u -o rw /dev/ld0f /
  101: # cat > /etc/fstab << EOF
  102: /dev/ld0f       /               ffs     rw      1 1
  103: /dev/ld0e       /boot           msdos   rw      1 1
  104: kernfs          /kern           kernfs  rw
  105: ptyfs           /dev/pts        ptyfs   rw
  106: procfs          /proc           procfs  rw
  107: tmpfs           /var/shm        tmpfs   rw,-m1777,-sram%25
  108: EOF
  109: # reboot
  110: """]]
  111: 
  112: # HDMI
  113: 
  114: ## Framebuffer console
  115: 
  116: Simply add **console=fb** to the *bootargs* variable in *boot.ini*.
  117: 
  118: ## Video mode
  119: 
  120: HDMI video mode can be selected in U-Boot with the *video* command, e.g.:
  121: 
  122: [[!template  id=programlisting text="""
  123: odroidc#video dev open 1080P
  124: """]]
  125: 
  126: To make this change permanent, add it to the *bootcmd* variable in *boot.ini*:
  127: 
  128: [[!template  id=programlisting text="""
  129: setenv bootcmd "video dev open 1080P; fatload mmc 0:1 0x21000000 netbsd.ub; bootm 0x21000000"
  130: """]]
  131: 
  132: ## 16 or 24 bpp?
  133: 
  134: ODROID-C1 defaults to 16bpp. If you want to try 24bpp, add **fb.depth=24** to the kernel cmdline options in *boot.ini*. There are some issues with 24bpp mode and Xorg; see <http://gnats.netbsd.org/49812>.
  135: 
  136: ## Overscan compensation
  137: 
  138: If you have ODROID-C1 plugged into a TV, the edges of the screen may not be visible. You can scale down the framebuffer console with the **hw.genfb0.scale** sysctl, e.g.:
  139: 
  140: [[!template  id=programlisting text="""
  141: # sysctl -w hw.genfb0.scale=95
  142: """]]
  143: 
  144: Setting *scale* to 100 disables scaling, any other value enables the scaler. Values between 10 and 100 are allowed.
  145: 
  146: To set this value at boot, you can add **fb.scale=95** to the kernel cmdline options in *boot.ini*.
  147: 
  148: # SYS_LED
  149: 
  150: The blue SYS_LED on the board is wired to GPIOAO_13. To control the LED from userland, set **gpio=YES** in rc.conf and add this to */etc/gpio.conf*:
  151: 
  152: [[!template  id=programlisting text="""
  153: gpio4 13 set out sys_led
  154: """]]
  155: 
  156: After rebooting, the LED state can be controlled with [[!template id=man name="gpioctl" section="8"]].
  157: 
  158: [[!template  id=programlisting text="""
  159: # turn the light on
  160: gpioctl gpio4 sys_led on
  161: 
  162: # turn the light off
  163: gpioctl gpio4 sys_led off
  164: 
  165: # toggle the light state
  166: gpioctl gpio4 sys_led toggle
  167: """]]
  168: 
  169: # Documentation
  170: 
  171: Amlogic S805 datasheet: <http://dn.odroid.com/S805/Datasheet/S805_Datasheet%20V0.8%2020150126.pdf>
  172: 
  173: # ODROID-C1 UART pins
  174: 
  175: From [ODROID Forum](http://forum.odroid.com/viewtopic.php?f=115&t=7684):
  176: 
  177: [[!template  id=programlisting text="""
  178:  ___UART____
  179: |Pin 4 - GND|
  180: |Pin 3 - RXD|
  181: |Pin 2 - TXD|
  182: |Pin 1 - VCC|
  183: \___________|
  184: 
  185: 3.3V LVTTL
  186: """]]

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