How to use Device Tree in Samsung Origen

Device tree is a process by which the Linux kernel initializes itself based on the hardware platform. Device tree allows a single kernel image to run on multiple hardware platforms. A device tree file, named *.dts, is a text file that describes the hardware platform. It is compiled into a device tree blob, *.dtb, which is loaded into memory before the Linux kernel is started. The Linux kernel then uses that device tree blob to initialize itself at runtime.

Default Device Trees for Origen

A default device tree is provided in the Linux tree at arch/arm/boot/dts/exynos4210-origen.dts

How to make Device Tree Kernel

Platform Selection

$ make exynos4_defconfig

Select DT Menu

CONFIG_USE_OF=y            # Booting
CONFIG_MACH_EXYNOS4_DT=y   # System Type --> SAMSUNG EXYNOS SoCs Support --> Samsung Exynos4 Machine using device Tree
CONFIG_PROC_DEVICETREE=y   # Device Driver --> Device Tree and Open Firmware support

Please make sure

In .config file, in the BOOTCMD line, change ttySAC1 to ttySAC2.
ystem Type -> S3C UART to use for low-level messages : Set it to 2.
And in menuconfig, Kernel hacking -> Kernel low-level debugging port -> Select port 2.

Compiling it

Make kernel image

$ make -j9 uImage

Make DTB

The device tree compiler is located in the Linux kernel tree in the scripts/dtc directory and the output will become

$ make exynos4210-origen.dtb
DTC  arch/arm/boot/exynos4210-origen.dtb
DTC: dts->dtb  on file "arch/arm/boot/dts/exynos4210-origen.dts"

How to use DTB file in U-boot

Check DT congfiguration in U-boot

1)  Open "u-boot-samsung/include/configs/origen.h"
2)  Add "#define CONFIG_OF_LIBFDT"

How to run DT image

Here, it is recommended that you use CRAMFS file at first because DT related to SD/MMC is on the way to mainline kernel.

If you have a kernel image and device tree blob somewhere in system memory, then all you need to boot the system is the bootm command. With Origen kernel image at address 0x40007000 and the device tree blob at address 0x40004000 then you can boot this image with the following command:

$u-boot>  bootm  40007000 - 40004000

Parameter to Kernel for CRAMFS

The following shows bootags in u-boot.

bootargs=mem=256M initrd=0x40800000,64M root=/dev/ram0 ramdisk=65536 ramdisk_size=700000 console=ttySAC2,115200
init=/linuxrc bootcmd=mmc read 0x40007000 441 2000; mmc read 0x40800000 2441 20000; bootm 40007000

History

--init

--12/01/2012, Added CRAMFS parameter of u-boot


CategoryHowTo

Boards/Origen/DeviceTree (last modified 2012-01-12 13:27:59)