Difference between revisions of "ODROID U2"

From Funtoo
Jump to: navigation, search
(No difference)

Latest revision as of 17:05, 4 June 2013

The ODROID U2 is an ARM development board, featuring a 1.7 GHz quad-core CPU (ARMv7a). This document contains notes about installing Funtoo Linux on this device.

Cross-compiler installation

To compile a suitable Linux kernel and bootloader for the ODROID U2, you need to install an ARMv7a hardfloat toolchain on your system.

# emerge crossdev
# crossdev -v -t armv7a-hardfloat-linux-gnueabi

Warning: In the following sections, replace /dev/sdX with the actual device node of your SD card.

U-boot bootloader

The ODROID-U2 needs U-boot as a bootloader. The ODROID U2 vendor provides a git repository with all what is needed to build and install U-boot on the SD-card that will be used to boot the device.

# mkdir ~/odroid_u2
# cd ~/odroid_u2
# git clone https://github.com/hardkernel/u-boot.git
# cd u-boot
# make smdk4412_config
# make ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi-

If U-boot does not build with your ARM toolchain, see the troubleshooting section. It may happen that U-boot does not build with a recent toolchain.

Now, the following will install U-boot on the beginning sectors of your SD card.

# cd sd_fuse
# ./sd_fusing.sh /dev/sdX


Warning: The bootloader takes a bit more space than usual. You must keep about 5 MB (10240 sectors for example) of free space before the first partition.

You may now partition your SD card to fit your needs. However, U-boot expects to find a FAT32 boot partition (first or second). Also, U-boot needs free space before the first partition.

Partition Table for /dev/sdX

               First       Last
 # Type       Sector      Sector   Offset    Length   Filesystem Type (ID) Flag
-- ------- ----------- ----------- ------ ----------- -------------------- ----
   Pri/Log           0       10239*     0#      10240*Free Space           None
 1 Primary       10240*     215039*     0      204800*W95 FAT32 (0B)       None
 2 Primary      215040*    2214599*     0     1999560*Linux swap / So (82) None
 3 Primary     2214600*   15269887*     0    13055288*Linux (83)           None

Now, format your partitions, e.g.

# mkfs.vfat /dev/sdX1
# mkswap /dev/sdX2
# mkfs.ext4 /dev/sdX3

Funtoo Linux Installation

Follow the guide from Funtoo Linux Installation on ARM to begin the installation of Funtoo on the root filesystem. Note that once you are finished, you will not be able to boot the ODROID U2 until you complete the next sections.

Kernel and modules

The ODROID U2 vendor provides kernel sources and default .config files for the ODROID U2. In this example, we clone the git repository, use the default branch, and build the default ubuntu kernel config. Note that other branches exist, some of them provide default configurations for the U2, others not.

Warning: As in Funtoo Linux Installation on ARM, we consider that the root partition is mounted in /mnt/SD_root. Also, we consider that the boot partition is /dev/sdX1.
# cd ~/odroid_u2
# git clone https://github.com/hardkernel/linux.git
# cd linux
# ARCH=arm make odroidu2_ubuntu_defconfig
# ARCH=arm CROSS_COMPILE=/usr/bin/armv7a-hardfloat-linux-gnueabi- make -j8 (adapt depending on the number of cores available on the build machine)
# mount /dev/sdX1 /mnt/SD_root/boot
# ARCH=arm CROSS_COMPILE=/usr/bin/armv7a-hardfloat-linux-gnueabi- make modules_install INSTALL_MOD_PATH=/mnt/SD_root
# cp arch/arm/boot/zImage /mnt/SD_root/boot

Boot partition setup

You now have a kernel in /mnt/SD_root/boot. The only missing part is a file named boot.scr, which will be read by U-boot.

First, create a boot.txt file on the boot partition.

# cd /mnt/SD_root/boot
# touch boot.txt

Modify this file to contain the following :

setenv initrd_high "0xffffffff"
setenv fdt_high "0xffffffff"
setenv fb_x_res "1920"
setenv fb_y_res "1080"
setenv hdmi_phy_res "1080"
setenv bootcmd "fatload mmc 0:1 0x40008000 zImage; bootm 0x40008000"
setenv bootargs "console=tty1 console=ttySAC1,115200n8 fb_x_res=${fb_x_res} fb_y_res=${fb_y_res} hdmi_phy_res=${hdmi_phy_res} root=/dev/mmcblk0p3 rootwait ro mem=2047M"
Warning: Modify the screen resolution to fit your needs. Also, modify /dev/mmcblk0p3 for the correct device of your root partition. /dev/mmcblk0p3 is the third partition of the SD-card. Modify the last digit to fit your partitioning scheme.

Now, install u-boot-tools that provides mkimage and create boot.scr.

# emerge u-boot-tools
# mkimage -A arm -T script -C none -n "Boot.scr for odroid-u2" -d boot.txt boot.scr

Further configuration


/dev/mmcblk0p1		/boot		vfat		noauto,noatime	1 2
/dev/mmcblk0p2		none		swap		sw		0 0
/dev/mmcblk0p3		/		ext4		noatime		0 0

Note: We disable fsck checking of some devices as it may fail because of the missing hardware clock on the device.


If you have USB/UART debugging hardware, you may want to change /etc/inittab the following way :

# SERIAL CONSOLESs0:12345:respawn:/sbin/agetty 115200 ttySAC1 vt100


Error: selected processor does not support ARM mode `smc 0'

--- board/samsung/smdk4212/smc.c.orig	2013-04-30 17:34:16.556093458 -0400
+++ board/samsung/smdk4212/smc.c	2013-04-30 17:34:50.422095103 -0400
@@ -90,6 +90,7 @@
 	register u32 reg3 __asm__("r3") = arg3;

  	__asm__ volatile (
+		".arch_extension sec\n"
 		"smc	0\n"
 		: "+r"(reg0), "+r"(reg1), "+r"(reg2), "+r"(reg3) 

@@ -104,6 +105,7 @@
 	register u32 reg1 __asm__("r1") = 0;
  	__asm__ volatile (
+		".arch_extension sec\n" 		"smc	0\n"
 		: "+r"(reg0), "+r"(reg1)

Source :http://forum.insignal.co.kr/viewtopic.php?f=10&t=118

armv7a-hardfloat-linux-gnueabi-ld: error: /usr/lib/gcc/armv7a-hardfloat-linux-gnueabi/4.7.2/libgcc.a(bpabi.o) uses VFP register arguments, u-boot does not

--- arch/arm/cpu/armv7/config.mk.orig	2013-04-30 17:40:20.842111160 -0400
+++ arch/arm/cpu/armv7/config.mk	2013-04-30 17:40:52.368112692 -0400
@@ -20,7 +20,7 @@ 
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
-PLATFORM_RELFLAGS += -fno-common -ffixed-r8 -msoft-float
+PLATFORM_RELFLAGS += -fno-common -ffixed-r8 -mfloat-abi=hard -mfpu=vfpv3  

 # Make ARMv5 to allow more compilers to work, even though its v7a.
 PLATFORM_CPPFLAGS += -march=armv7-a

Source : https://code.google.com/p/chromium/issues/detail?id=213120