树莓派的设备树驱动内核 [英] Device tree driven kernel for raspberry pi

查看:919
本文介绍了树莓派的设备树驱动内核的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用设备树驱动的linux内核启动树莓派,有什么特别的方法吗?

I'd like to boot the raspberry pi with a device-tree-driven linux kernel, is there anything special to do to do that?

任何人都可以指出为树莓派设置基于设备树的内核启动所需的内容.

Can anyone point what are required to set up a device-tree-based kernel boot up for the raspberry pi.

我可能需要树莓派pi内核源,其中设备驱动程序应与设备树兼容.如果是这样,我在哪里可以找到Raspberry Pi的此类内核源代码?

I may need to have raspberry pi kernel source where drivers for devices should be compatible with device tree. If so, where can I find such kernel sources for Raspberry Pi?

推荐答案

Raspberry Pi上的设备树支持

Raspberry Pi嵌入了ARM11 SoC: Broadcom BCM2835 .设备树(DT)对ARM的支持是相当新的,但似乎已经进入了Raspberry Pi CPU.您可以在arch/arm/boot/dts/bcm2835.dts*中找到Raspberry Pi的DT.

Device-Tree support on Raspberry Pi

Raspberry Pi embeds an ARM11 SoC: Broadcom BCM2835. Device Tree (DT) support for ARM is fairly new, but it seems that it has made its way to the Raspberry Pi CPU. You can find a DT for the Raspberry Pi in arch/arm/boot/dts/bcm2835.dts*.

但是默认配置文件bcm2835_defconfig不会启用设备树:

However the default config file bcm2835_defconfig does not enable device tree:

$ grep DT arch/arm/configs/bcm2835_defconfig
<nothing interesting>

我期望像CONFIG_OF*=yCONFIG_USE_OF=y这样的东西.坏消息:这将是艰难而漫长的(3 noob.month?).

I expected something like CONFIG_OF*=y or CONFIG_USE_OF=y. Bad news: that is going to be tough and long (3 noob.month ?).

有什么特别的做吗?

is there anything special to do to do that?

这取决于您当前的Linux内核版本.可能是您当前的linux已经使用了设备树(linux-3.7或更高版本?).

It depends on your current linux kernel version. Chances are that your current linux already uses the device-tree (linux-3.7 or later ?).

如果没有,则需要进行广泛的更改:

If not, there are wide changes that you need to study:

设备树完全改变了Linux内核启动的方式.它会影响:

  1. 您的引导程序(例如u-boot.bin). U-Boot必须知道如何来处理设备树.旧的U型靴不知道什么是设备树...
  2. Linux内核映像(例如zImage). Linux 必须知道,它必须在设备树中获取其硬件描述.
  3. 闪存/SD卡分区布局.您需要为设备树文件本身腾出空间.
  1. your bootloader (e.g. u-boot.bin). U-Boot must know how to handle device-tree. Old U-Boots do not know what a device-tree is...
  2. the Linux kernel image (e.g. zImage). Linux must know that it has to fetch its hardware description in the device-tree.
  3. the flash/SD card partition layout. You need to make room for the device tree file itself.

Impact意味着:您需要一种对这些映像进行编译/编程的方法:完整源代码,构建环境,UART访问,可能的JTAG硬件.在没有JTAG的情况下更改引导加载程序通常会自杀,除非(今天)您可以安全地从板外对SD卡进行重新编程.

Impact means: you need a way to compile/program these images: full-source, build environment, UART access, potentially JTAG hardware. Changing the bootloader without JTAG is usually suicide, except (today) you can reprogram your SD card off the board safely.

在谈论设备树时,您可能会找到对 OpenFirmware(OF)的引用.在选择设备树"约定之前,OpenFirmware是IBM PowerPC上的原始规范.在Linux中,与设备树相关的代码以of_为前缀.不直观,我知道...

You might find references to OpenFirmware (OF) when talking about device tree. OpenFirmware was the original specification on IBM PowerPC before the Device Tree convention was chosen. Code related to device-tree is prefixed with of_ in linux. Not intuitive, I know...

请阅读:

  1. http://devicetree.org/Main_Page
  2. Documentation/devicetree

如何生成设备树二进制文件(.dtb)?

使用buildroot在PowerPC板上的示例:

How to generate the Device-Tree Binary (.dtb)?

Example on a PowerPC board using buildroot:


/usr/bin/make -j5 HOSTCC="/usr/bin/gcc" HOSTCFLAGS="" ARCH=powerpc INSTALL_MOD_PATH=/home/evigier/buildroot/output/target CROSS_COMPILE=" /home/evigier/buildroot/output/host/usr/bin/powerpc-buildroot-linux-gnu-" DEPMOD=/home/evigier/buildroot/output/host/sbin/depmod -C /home/evigier/buildroot/output/build/linux-master mpc8347.dtb

在PowerPC板上的示例U-Boot控制台输出:

Example U-Boot console output on a PowerPC board:

Uncompressing Kernel Image ... OK
kernel loaded at 0x00000000, end = 0x006f8780
## cmdline at 0x0ff1b900 ... 0x0ff1b925
## initrd_high = 0xffffffff, copy_to_ram = 1
ramdisk load start = 0x00000000, ramdisk load end = 0x00000000
## device tree at 00780000 ... 00781f57 (len=20312 [0x4F58])
Loading Device Tree to 0ff16000, end 0ff1af57 ... OK
## Transferring control to Linux (at address 00000000) ...
Booting using OF flat tree..

快乐黑客:-)

这篇关于树莓派的设备树驱动内核的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆