Annotation of wikisrc/ports/evbarm/odroid-c1.mdwn, revision 1.17

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

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