Difference between revisions of "Kernel-with-device-tree"
(→u-boot) |
|||
Line 30: | Line 30: | ||
For example, for u-boot 2012.04 on apf27, it's: buildroot/target/devg=ice/armadeus/apf27/apf27-u-boot-2012.04.h | For example, for u-boot 2012.04 on apf27, it's: buildroot/target/devg=ice/armadeus/apf27/apf27-u-boot-2012.04.h | ||
+ | |||
+ | Nothing else needs to be done, because the u-boot image is build by the armadeus SDK with the command "make". | ||
NOTE: on u-boot 2012.04, the command bootm with device tree is broken. If you want to use it, | NOTE: on u-boot 2012.04, the command bootm with device tree is broken. If you want to use it, | ||
Line 46: | Line 48: | ||
* imx28 (apf28) : no | * imx28 (apf28) : no | ||
− | + | The configuration file should have: | |
− | + | * CONFIG_MACH_IMX27_DT (on apf27) | |
+ | * CONFIG_MACH_IMX51_DT (on apf51) | ||
+ | * CONFIG_SERIAL_IMX | ||
+ | * CONFIG_SERIAL_IMX_CONSOLE | ||
+ | |||
+ | Nothing else needs to be done, because the kernel image is build by the armadeus SDK with the command "make". | ||
+ | |||
+ | ==dtb== | ||
+ | |||
+ | A dtb (Device Tree Binary) file is created from a dts (Device Tree Source) file. | ||
+ | |||
+ | The kernel has already the support of device tree for imx27 (apf27) and imx51 (apf51). | ||
+ | |||
+ | But both board (apf27 and apf51) hasn't a dts file. So a file <board>.dts must be added | ||
+ | to in the directory arch/arm/boot/dts of the linux kernel. | ||
+ | |||
+ | The armadeus SDK don't have support for dtb image generation. So you have to do it yourself. | ||
+ | * go to the directory buildroot/output/build/linux-<version> | ||
+ | * add the file <soc>-<board>.dts the directory arch/arm/boot/dts/ | ||
+ | * build the dtb with the command: make ARCH=arm <soc>-<board>.dtb | ||
− | + | The file <soc>-<board>.dtb should appear in arch/arm/boot | |
=Running= | =Running= |
Revision as of 21:43, 16 June 2012
Background
The idea behind device tree is quite simple. When the kernel start he needs to initialize the driver for the device on the board. But often on embedded, device can't be discover at running time. In this case, the linux kernel has a c file that initialize the driver for the board. So the kernel must be modified/compiled for each board.
Another way is to provide a small file that describe the board to the linux kernel. When the kernel start, it reads this file (called dtb for Device Tree Binary) to know the device on the board, and initialize usefull drivers.
Some information on device tree may be found here:
- http://elinux.org/Device_Trees
- http://devicetree.org/Main_Page
- https://wiki.linaro.org/Boards/Origen/DeviceTree
- http://elinux.org/images/4/48/Experiences_With_Device_Tree_Support_Development_For_ARM-Based_SOC%27s.pdf
Compilation
To use device tree on arm both bootloader (u-boot) and kernel should be compiled with the support of device tree.
u-boot
To enable device tree on u-boot, it's quite simple:
- change the MACH_TYPE to ~0 (change "#define CONFIG_MACH_TYPE 1698" to "#define CONFIG_MACH_TYPE ~0") in the u-boot configuration file (include/configs/<board>.h)
- add "#define CONFIG_OF_LIBFDT" in the u-boot configuration file (include/configs/<board>.h).
On armadeus SDK, this file is in this directory: buildroot/target/device/armadeus/<board>/<board>-u-boot-<version>.h
For example, for u-boot 2012.04 on apf27, it's: buildroot/target/devg=ice/armadeus/apf27/apf27-u-boot-2012.04.h
Nothing else needs to be done, because the u-boot image is build by the armadeus SDK with the command "make".
NOTE: on u-boot 2012.04, the command bootm with device tree is broken. If you want to use it,
you need to fix it with the following patch: http://git.denx.de/?p=u-boot.git;a=commit;h=1723997610ace497252d6f9a44ec76c06951ae43
NOTE2: it's fixed on u-boot 2012.04.01
kernel
The kernel 3.4 has already the support of some arm SoC.
- imxl (apf9328) : no
- imx27 (apf27) : yes
- imx51 (apf51) : yes
- imx28 (apf28) : no
The configuration file should have:
- CONFIG_MACH_IMX27_DT (on apf27)
- CONFIG_MACH_IMX51_DT (on apf51)
- CONFIG_SERIAL_IMX
- CONFIG_SERIAL_IMX_CONSOLE
Nothing else needs to be done, because the kernel image is build by the armadeus SDK with the command "make".
dtb
A dtb (Device Tree Binary) file is created from a dts (Device Tree Source) file.
The kernel has already the support of device tree for imx27 (apf27) and imx51 (apf51).
But both board (apf27 and apf51) hasn't a dts file. So a file <board>.dts must be added to in the directory arch/arm/boot/dts of the linux kernel.
The armadeus SDK don't have support for dtb image generation. So you have to do it yourself.
- go to the directory buildroot/output/build/linux-<version>
- add the file <soc>-<board>.dts the directory arch/arm/boot/dts/
- build the dtb with the command: make ARCH=arm <soc>-<board>.dtb
The file <soc>-<board>.dtb should appear in arch/arm/boot