Skip to contentSkip to conversation

board: add support for Hardkernel ODROID-C2 Board

PATCH New Brian Kim 2 participants 2 messages Apr 19, 2016 – Apr 23, 2016

lore
Share & tools
lore

Brian Kim

author
#0 lore raw

PATCH v2 1/1 board: add support for Hardkernel ODROID-C2 Board

The ODROID-C2 is a 64-bit quad-core single board computer(SBC) that is one of the most cost-effective 64bit development boards available in the ARM world.

http://www.hardkernel.com/main/products/prdt_info.php?g_code=G145457216438

---
 board/hardkernel/odroidc2/boot.ini      | 22 ++++++++++++++
 board/hardkernel/odroidc2/genimage.cfg  | 27 +++++++++++++++++
 board/hardkernel/odroidc2/post-image.sh | 21 +++++++++++++
 board/hardkernel/odroidc2/readme.txt    | 53 +++++++++++++++++++++++++++++++++
 configs/odroidc2_defconfig              | 39 ++++++++++++++++++++++++
 5 files changed, 162 insertions(+)
 create mode 100644 board/hardkernel/odroidc2/boot.ini
 create mode 100644 board/hardkernel/odroidc2/genimage.cfg
 create mode 100755 board/hardkernel/odroidc2/post-image.sh
 create mode 100644 board/hardkernel/odroidc2/readme.txt
 create mode 100644 configs/odroidc2_defconfig
board/hardkernel/odroidc2/boot.ini new file +22 -0
new file mode 100644
index 0000000..8b67b5e
@@ -0,0 +1,22 @@
+ODROIDC2-UBOOT-CONFIG
+
+# HDMI mode
+setenv m "720p60hz" # Progressive 60Hz
+
+# HDMI BPP Mode
+setenv m_bpp "32"
+
+# Default Console Device Setting
+setenv condev "console=ttyS0,115200n8"	# Serial Console
+
+# Boot Arguments
+setenv bootargs "root=/dev/mmcblk0p2 rootwait ro ${condev} no_console_suspend hdmimode=${m} m_bpp=${m_bpp} vout=${vout} fsck.repair=yes net.ifnames=0 elevator=noop"
+
+# Load Images
+setenv loadaddr "0x11000000"
+setenv dtb_loadaddr "0x10000000"
+fatload mmc 0:1 ${loadaddr} Image
+fatload mmc 0:1 ${dtb_loadaddr} meson64_odroidc2.dtb
+
+# Booting
+booti ${loadaddr} - ${dtb_loadaddr}
board/hardkernel/odroidc2/genimage.cfg new file +27 -0
new file mode 100644
index 0000000..15f97d4
@@ -0,0 +1,27 @@
+image boot.vfat {
+	vfat {
+		files = {
+			"boot.ini",
+			"Image",
+			"meson64_odroidc2.dtb"
+		}
+	}
+	size = 32M
+}
+
+image sdcard.img {
+	hdimage {
+	}
+
+	partition vfat {
+		partition-type = 0xC
+		image = "boot.vfat"
+		offset = 1048576
+	}
+
+	partition rootfs {
+		partition-type = 0x83
+		image = "rootfs.ext4"
+		size = 512M
+	}
+}
board/hardkernel/odroidc2/post-image.sh new file +21 -0
new file mode 100755
index 0000000..b2a351f
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname $0)"
+GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg"
+GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+
+cp ${BOARD_DIR}/boot.ini ${BINARIES_DIR}/
+
+rm -rf "${GENIMAGE_TMP}"
+
+genimage                           \
+	--rootpath "${TARGET_DIR}"     \
+	--tmppath "${GENIMAGE_TMP}"    \
+	--inputpath "${BINARIES_DIR}"  \
+	--outputpath "${BINARIES_DIR}" \
+	--config "${GENIMAGE_CFG}"
+
+dd if=${BINARIES_DIR}/u-boot.bin of=${BINARIES_DIR}/sdcard.img bs=1 count=442 conv=sync,notrunc
+dd if=${BINARIES_DIR}/u-boot.bin of=${BINARIES_DIR}/sdcard.img bs=512 skip=1 seek=1 conv=fsync,notrunc
+
+exit $?
board/hardkernel/odroidc2/readme.txt new file +53 -0

53 lines not on this page · raw message

configs/odroidc2_defconfig new file +39 -0
new file mode 100644
index 0000000..4fe6bcd
@@ -0,0 +1,39 @@
+# Architecture
+BR2_aarch64=y
+BR2_ARM_ENABLE_NEON=y
+BR2_ARM_FPU_NEON=y
+
+BR2_TOOLCHAIN_BUILDROOT_CXX=y
+
+# System
+BR2_TARGET_GENERIC_HOSTNAME="odroidc2"
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/hardkernel/odroidc2/post-image.sh"
+
+# Kernel
+BR2_KERNEL_HEADERS_VERSION=y
+BR2_DEFAULT_KERNEL_VERSION="3.14.29"
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_3_14=y
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y
+BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/hardkernel/linux.git"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="odroidc2-3.14.y"
+BR2_LINUX_KERNEL_DEFCONFIG="odroidc2"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_BUILD_DEFAULT_DTS=y
+BR2_LINUX_KERNEL_USE_INTREE_DTS=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="meson64_odroidc2"
+BR2_LINUX_KERNEL_IMAGE=y
+
+# U-Boot
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_CUSTOM_GIT=y
+BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/hardkernel/u-boot.git"
+BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="odroidc2-v2015.01"
+BR2_TARGET_UBOOT_BOARDNAME="odroidc2"
+
+# Required tools to create the SD image
+BR2_PACKAGE_HOST_DOSFSTOOLS=y
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_PACKAGE_HOST_MTOOLS=y
Signature · 1 line
2.5.0
#1 lore raw

PATCH v2 1/1 board: add support for Hardkernel ODROID-C2 Board

Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Brian" == Brian Kim <[email protected]> writes:

The ODROID-C2 is a 64-bit quad-core single board computer(SBC) that is one of the most cost-effective 64bit development boards available in the ARM world.

http://www.hardkernel.com/main/products/prdt_info.php?g_code=G145457216438

Thanks!

See below for a few comments:

Quoted 33 lines
---
 board/hardkernel/odroidc2/boot.ini      | 22 ++++++++++++++
 board/hardkernel/odroidc2/genimage.cfg  | 27 +++++++++++++++++
 board/hardkernel/odroidc2/post-image.sh | 21 +++++++++++++
 board/hardkernel/odroidc2/readme.txt    | 53 +++++++++++++++++++++++++++++++++
 configs/odroidc2_defconfig              | 39 ++++++++++++++++++++++++
 5 files changed, 162 insertions(+)
 create mode 100644 board/hardkernel/odroidc2/boot.ini
 create mode 100644 board/hardkernel/odroidc2/genimage.cfg
 create mode 100755 board/hardkernel/odroidc2/post-image.sh
 create mode 100644 board/hardkernel/odroidc2/readme.txt
 create mode 100644 configs/odroidc2_defconfig
board/hardkernel/odroidc2/boot.ini new file +13 -0
new file mode 100644
index 0000000..8b67b5e
@@ -0,0 +1,22 @@
+ODROIDC2-UBOOT-CONFIG
+
+# HDMI mode
+setenv m "720p60hz" # Progressive 60Hz
+
+# HDMI BPP Mode
+setenv m_bpp "32"
+
+# Default Console Device Setting
+setenv condev "console=ttyS0,115200n8"	# Serial Console
+
+# Boot Arguments
+setenv bootargs "root=/dev/mmcblk0p2 rootwait ro ${condev}
Quoted 2 lines

no_console_suspend hdmimode=${m} m_bpp=${m_bpp} vout=${vout} fsck.repair=yes net.ifnames=0 elevator=noop"

What is fsck.repair and net.ifnames for? It sounds like user space stuff that doesn't apply to Buildroot.

Quoted 15 lines
board/hardkernel/odroidc2/post-image.sh new file +9 -0
new file mode 100755
index 0000000..b2a351f
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname $0)"
+GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg"
+GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+
+cp ${BOARD_DIR}/boot.ini ${BINARIES_DIR}/
+
+rm -rf "${GENIMAGE_TMP}"

board/hardkernel/odroidc2/post-image.sh line 19

Quoted 10 lines
board/hardkernel/odroidc2/post-image.sh new file +10 -0
+
+genimage                           \
+	--rootpath "${TARGET_DIR}"     \
+	--tmppath "${GENIMAGE_TMP}"    \
+	--inputpath "${BINARIES_DIR}"  \
+	--outputpath "${BINARIES_DIR}" \
+	--config "${GENIMAGE_CFG}"
+
+dd if=${BINARIES_DIR}/u-boot.bin of=${BINARIES_DIR}/sdcard.img bs=1 count=442 conv=sync,notrunc
+dd if=${BINARIES_DIR}/u-boot.bin of=${BINARIES_DIR}/sdcard.img bs=512 skip=1 seek=1 conv=fsync,notrunc

So amlogic uses the classic x86 bootsector for early startup code? Cute.

Fiddling with the output of genimage here isn't really nice, but I also don't really see how to do it otherwise - So OK.

board/hardkernel/odroidc2/post-image.sh line 21

Quoted 2 lines
board/hardkernel/odroidc2/post-image.sh new file +2 -0
+
+exit $?

This is the default anyway, so this can be dropped.

board/hardkernel/odroidc2/readme.txt line 48

Quoted 9 lines
board/hardkernel/odroidc2/readme.txt +7 -0
 
+How to write the SD card or eMMC
+================================
+
+Once the build process is finished you will have an image called "sdcard.img"
+in the output/images/ directory.
+
+Copy the bootable "sdcard.img" onto an SD card od eMMC with "dd":

s/od/or/

configs/odroidc2_defconfig line 4

Quoted 10 lines
configs/odroidc2_defconfig new file +4 -0
new file mode 100644
index 0000000..4fe6bcd
@@ -0,0 +1,39 @@
+# Architecture
+BR2_aarch64=y
+BR2_ARM_ENABLE_NEON=y
+BR2_ARM_FPU_NEON=y

We don't have neon options for aarch64 (as neon support is mandatory for aarch64).

configs/odroidc2_defconfig line 6

Quoted 2 lines
configs/odroidc2_defconfig new file +2 -0
+
+BR2_TOOLCHAIN_BUILDROOT_CXX=y

C++ support isn't needed, so this can be dropped.

configs/odroidc2_defconfig line 9

Quoted 3 lines
configs/odroidc2_defconfig new file +3 -0
+
+# System
+BR2_TARGET_GENERIC_HOSTNAME="odroidc2"

The board has a network interface, right? How about setting BR2_SYSTEM_DHCP="eth0"?

configs/odroidc2_defconfig line 21

Quoted 12 lines
configs/odroidc2_defconfig new file +12 -0
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/hardkernel/odroidc2/post-image.sh"
+
+# Kernel
+BR2_KERNEL_HEADERS_VERSION=y
+BR2_DEFAULT_KERNEL_VERSION="3.14.29"
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_3_14=y
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y
+BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/hardkernel/linux.git"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="odroidc2-3.14.y"

This is a name of a git branch. We want reproducable builds in Buildroot so REPO_VERSION should refer to a specific git hash or a tag name. I've changed it to the current top of that branch.

configs/odroidc2_defconfig line 33

Quoted 12 lines
configs/odroidc2_defconfig new file +12 -0
+BR2_LINUX_KERNEL_DEFCONFIG="odroidc2"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_BUILD_DEFAULT_DTS=y
+BR2_LINUX_KERNEL_USE_INTREE_DTS=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="meson64_odroidc2"
+BR2_LINUX_KERNEL_IMAGE=y
+
+# U-Boot
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_CUSTOM_GIT=y
+BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/hardkernel/u-boot.git"
+BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="odroidc2-v2015.01"

Same comment as for the Linux kernel.

Committed with these issues fixed, thanks. Please send a followup patch to add BR2_SYSTEM_DHCP / drop unneeded kernel commandline arguments if applicable.

Signature · 1 line
Bye, Peter Korsgaard