Diff for /wikisrc/ports/evbarm/odroid-c1.mdwn between versions 1.8 and 1.31

version 1.8, 2015/03/22 14:01:40 version 1.31, 2021/02/19 22:02:03
Line 1 Line 1
 [[!meta title="NetBSD/evbarm on Hardkernel ODROID-C1"]]  [[!meta title="NetBSD/evbarm on Hardkernel ODROID-C1 and ODROID-C1+"]]
   
   [ODROID-C1](https://www.hardkernel.com/shop/odroid-c1-2/) 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+](https://www.hardkernel.com/shop/odroid-c1/), which is supported by the same NetBSD kernel.
   
 [[!toc levels=2]]  [[!toc levels=2]]
   
Line 8 Line 10
    - SMP supported     - SMP supported
    - PL310 L2 cache controller     - PL310 L2 cache controller
  - GIC   - GIC
  - A5 watchdog timer  
  - A5 global timer   - A5 global timer
  - SD/MMC controller (DMA)   - Watchdog timer
    - "SDHC" and "SDIO" SD/MMC controllers (DMA)
  - Serial console   - Serial console
  - Framebuffer console   - Framebuffer console
  - USB host (OTG)   - USB host (OTG)
  - Gigabit Ethernet (GMAC)   - Gigabit Ethernet (GMAC)
    - RTL8211F PHY     - RTL8211F PHY
  - Hardware random number generator   - Hardware random number generator
    - RTC
    - GPIO
   
 # TODO  # TODO
  - USB device mode   - USB device mode
  - Simultaneous SD card and eMMC usage  
  - SD/MMC UHS-I support (needs sdmmc(4) changes)  
  - IR receiver   - IR receiver
  - GPIO  
  - I2C   - I2C
  - Audio   - Audio
   
 # Installation  # Installation (NetBSD 8.0 and later)
   
 * Start with an ARMv7 image from *evbarm-earmv7hf/binary/gzimg/* such as *beagleboard.img*  * Start with an ARMv7 image from *evbarm-earmv7hf/binary/gzimg/* such as *armv7.img*, the latest is [[here|https://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/latest/evbarm-earmv7hf/binary/gzimg/armv7.img]].
 * Build U-Boot for ODROID-C1 <https://github.com/hardkernel/u-boot/tree/odroidc-v2011.03>  * Build U-Boot for ODROID-C1 <https://github.com/hardkernel/u-boot/tree/odroidc-v2011.03>
   * Pre-built binaries here: <http://ftp.netbsd.org/pub/NetBSD/misc/jmcneill/odroidc1/u-boot-odroidc-v2011.03-20150308.tar.gz>    * Pre-built binaries here: <http://ftp.netbsd.org/pub/NetBSD/misc/jmcneill/odroidc1/u-boot-odroidc-v2011.03-20150308.tar.gz>
 * Note the location and size of the FFS partition in the *beagleboard.img* disklabel:  * Write the bootloader to the empty space at the start of the base image:
 [[!template  id=programlisting text="""  [[!template  id=programlisting text="""
 # $TOOLDIR/bin/nbdisklabel -M evbarm -B le beagleboard.img  # dd if=bl1.bin.hardkernel of=armv7.img bs=1 count=442 conv=notrunc
   # dd if=bl1.bin.hardkernel of=armv7.img bs=512 skip=1 seek=1 conv=notrunc
   # dd if=u-boot.bin of=armv7.img bs=512 seek=64 conv=notrunc
   """]]
   * Write the image to an SD card.
   * Edit *boot.ini* on the MS-DOS partition. Note that the default boot.ini has `console=fb` in `bootargs`, which you should remove if you want serial console:
   [[!template  id=programlisting text="""
   ODROIDC-UBOOT-CONFIG
   
   setenv bootargs "root=ld0a awge0.mac-address=${ethaddr} console=fb"
   setenv bootcmd "fatload mmc 0:1 0x21000000 netbsd-ODROID-C1.ub; bootm 0x21000000"
   run bootcmd
   """]] 
   
   # Installation (NetBSD 7.0/7.1)
   
   * Start with an ARMv7 image from *evbarm-earmv7hf/binary/gzimg/* such as *armv7.img*
   * Build U-Boot for ODROID-C1 <https://github.com/hardkernel/u-boot/tree/odroidc-v2011.03>
     * Pre-built binaries here: <http://ftp.netbsd.org/pub/NetBSD/misc/jmcneill/odroidc1/u-boot-odroidc-v2011.03-20150308.tar.gz>
   * Note the location and size of the FFS partition in the *armv7.img* disklabel:
   [[!template  id=programlisting text="""
   # $TOOLDIR/bin/nbdisklabel -M evbarm -B le armv7.img
 ...  ...
 8 partitions:  8 partitions:
 #        size    offset     fstype [fsize bsize cpg/sgs]  #        size    offset     fstype [fsize bsize cpg/sgs]
Line 46 Line 68
 """]]  """]]
 * Write the bootloader to the empty space at the start of the base image:  * Write the bootloader to the empty space at the start of the base image:
 [[!template  id=programlisting text="""  [[!template  id=programlisting text="""
 # dd if=bl1.bin.hardkernel of=beagleboard.img bs=1 count=442 conv=notrunc  # dd if=bl1.bin.hardkernel of=armv7.img bs=1 count=442 conv=notrunc
 # dd if=bl1.bin.hardkernel of=beagleboard.img bs=512 skip=1 seek=1 conv=notrunc  # dd if=bl1.bin.hardkernel of=armv7.img bs=512 skip=1 seek=1 conv=notrunc
 # dd if=u-boot.bin of=beagleboard.img bs=512 seek=64 conv=notrunc  # dd if=u-boot.bin of=armv7.img bs=512 seek=64 conv=notrunc
 """]]  """]]
 * Since the bootloader has overwritten the disklabel, we need to re-add partition "a" from the disklabel to the MBR partition table:  * Since the bootloader has overwritten the disklabel, we need to re-add partition "a" from the disklabel to the MBR partition table:
 [[!template  id=programlisting text="""  [[!template  id=programlisting text="""
 # $TOOLDIR/bin/armv7--netbsdelf-eabihf-fdisk -u beagleboard.img  # $TOOLDIR/bin/armv7--netbsdelf-eabihf-fdisk -u armv7.img
 ...  ...
 Which partition do you want to change?: [none] 1  Which partition do you want to change?: [none] 1
 The data for partition 1 is:  The data for partition 1 is:
Line 66  Which partition do you want to change?:  Line 88  Which partition do you want to change?: 
 Should we write new partition table? [n] y  Should we write new partition table? [n] y
 """]]  """]]
 * Write the image to an SD card.  * Write the image to an SD card.
 * Copy the kernel (netbsd.ub) for your board to the root of the MS-DOS partition on the SD card.  * Edit *boot.ini* on the MS-DOS partition. Note that the default boot.ini has `console=fb` in `bootargs`, which you should remove if you want serial console:
 * Create or edit boot.ini on the MS-DOS partition:  
 [[!template  id=programlisting text="""  [[!template  id=programlisting text="""
 ODROIDC-UBOOT-CONFIG  ODROIDC-UBOOT-CONFIG
   
 setenv m "1080p"  setenv bootargs "root=ld0f awge0.mac-address=${ethaddr} console=fb"
 setenv vout_mode "hdmi"  
 setenv m_bpp "32"  
 setenv disableuhs "disableuhs"  
 setenv bootargs "root=ld0f awge0.mac-address=${ethaddr}"  
 setenv bootcmd "fatload mmc 0:1 0x21000000 netbsd.ub; bootm 0x21000000"  setenv bootcmd "fatload mmc 0:1 0x21000000 netbsd.ub; bootm 0x21000000"
 run bootcmd  run bootcmd
 """]]  """]] 
   
 * On first boot, it will stop because of the wrong device in /etc/fstab. Take this opportunity to grow the root file-system:  * On first boot, it will stop because of the wrong device in /etc/fstab. Take this opportunity to grow the root file-system:
 [[!template  id=programlisting text="""  [[!template  id=programlisting text="""
 # fdisk -u ld0  # fdisk -u ld0
Line 112  EOF Line 130  EOF
 # reboot  # reboot
 """]]  """]]
   
 # Overscan compensation  # HDMI
   
   ## Framebuffer console
   
   Simply add **console=fb** to the *bootargs* variable in *boot.ini*.
   
   ## Video mode
   
   HDMI video mode can be selected in U-Boot with the *video* command, e.g.:
   
   [[!template  id=programlisting text="""
   odroidc#video dev open 1080P
   """]]
   
   To make this change permanent, add it to the *bootcmd* variable in *boot.ini*:
   
   [[!template  id=programlisting text="""
   setenv bootcmd "video dev open 1080P; fatload mmc 0:1 0x21000000 netbsd.ub; bootm 0x21000000"
   """]]
   
   ## 16 or 24 bpp?
   
   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>.
   
   ## Overscan compensation
   
 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.:  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.:
   
Line 124  Setting *scale* to 100 disables scaling, Line 166  Setting *scale* to 100 disables scaling,
   
 To set this value at boot, you can add **fb.scale=95** to the kernel cmdline options in *boot.ini*.  To set this value at boot, you can add **fb.scale=95** to the kernel cmdline options in *boot.ini*.
   
   # SYS_LED
   
   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*:
   
   [[!template  id=programlisting text="""
   gpio4 13 set out sys_led
   """]]
   
   After rebooting, the LED state can be controlled with [[!template id=man name="gpioctl" section="8"]].
   
   [[!template  id=programlisting text="""
   # turn the light on
   gpioctl gpio4 sys_led on
   
   # turn the light off
   gpioctl gpio4 sys_led off
   
   # toggle the light state
   gpioctl gpio4 sys_led toggle
   """]]
   
   # U-Boot Environment
   
   To read/write U-Boot environment variables from NetBSD, download and compile the following program: <http://ftp.netbsd.org/pub/NetBSD/misc/jmcneill/odroidc1/uenv.c>
   
   # Automatically booting a backup kernel
   
   *These instructions assume the kernels live on eMMC. Adjust devices accordingly for SD card setup.*
   
   To setup an ODROID-C1 to fall back to a recovery kernel in the event of a boot failure, install the recovery kernel as /boot/onetbsd.ub.
   
   Create /boot/boot.ini as follows:
   [[!template  id=programlisting text="""
   ODROIDC-UBOOT-CONFIG
   setenv bootargs "root=ld0f awge0.mac-address=${ethaddr}"
   fatload mmc 0:1 0x22000000 boot.scr
   source 0x22000000
   """]]
   
   Create /boot/boot.txt:
   [[!template  id=programlisting text="""
   # regenerate with:
   #  mkubootimage -A arm -C none -O netbsd -T script -a 0 -n "NetBSD/odroidc1 boot" boot.txt boot.scr
   
   setenv rescue_kernel "onetbsd.ub"
   setenv kernel "netbsd.ub"
   
   if test ${boot_rescue} = false; then
     setenv boot_rescue true
     saveenv
     fatload mmc 0:1 0x21000000 ${kernel}
     mw.l c1109900 0f08ffff        # arm watchdog
     bootm 0x21000000
   else
     fatload mmc 0:1 0x21000000 ${rescue_kernel}
     bootm 0x21000000
   fi
   """]]
   
   Generate boot.scr from boot.txt:
   [[!template  id=programlisting text="""
   mkubootimage -A arm -C none -O netbsd -T script -a 0 -n "NetBSD/odroidc1 boot" /boot/boot.txt /boot/boot.scr
   """]]
   
   Install the **uenv** tool from above and add the following to root's crontab:
   [[!template  id=programlisting text="""
   @reboot                                 /usr/local/sbin/uenv ld0 boot_rescue false
   """]]
   
   # Documentation
   
   Amlogic S805 datasheet: <http://dn.odroid.com/S805/Datasheet/S805_Datasheet%20V0.8%2020150126.pdf>
   
 # ODROID-C1 UART pins  # ODROID-C1 UART pins
   
 From [ODROID Forum](http://forum.odroid.com/viewtopic.php?f=115&t=7684):  From [ODROID Forum](http://forum.odroid.com/viewtopic.php?f=115&t=7684):
Line 138  From [ODROID Forum](http://forum.odroid. Line 253  From [ODROID Forum](http://forum.odroid.
   
 3.3V LVTTL  3.3V LVTTL
 """]]  """]]
   

Removed from v.1.8  
changed lines
  Added in v.1.31


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