我正在尝试使用自己的U-Boot构建来在Jetson TK1板上启动Linux.当我们推动验证启动时,我使用平面图像树(统一内核映像,设备树blob,...)来描述我的系统.U-Boot可以加载ITB文件并尝试启动内核,但系统会在此消息后挂起.
我假设这是因为没有引导参数传递给内核(原始启动添加了参数的加载)但我对如何将参数传递给内核有点傻眼.我尝试设置bootargs环境变量,但这并没有改变这种情况.
使用ITB文件时如何将内核参数传递给内核?
命令行参数(取自示例extlinux.conf的APPEND命令):
console=ttyS0,115200n8 console=tty1 no_console_suspend=1
lp0_vec=2064@0xf46ff000 video=tegrafb mem=1862M@2048M memtype=255 ddr_die=2048M@2048M
section=256M pmuboard=0x0177:0x0000:0x02:0x43:0x00 vpr=151M@3945M tsec=32M@3913M
otf_key=c75e5bb91eb3bd947560357b64422f85 usbcore.old_scheme_first=1 core_edp_mv=1150
core_edp_ma=4000 tegraid=40.1.1.0.0 debug_uartport=lsport,3 power_supply=Adapter
audio_codec=rt5640 modem_id=0 android.kerneltype=normal usb_port_owner_info=0
fbcon=map:1 commchip_id=0 usb_port_owner_info=0 lane_owner_info=6 emc_max_dvfs=0
touch_id=0@0 tegra_fbmem=32899072@0xad012000 board_info=0x0177:0x0000:0x02:0x43:0x00
root=/dev/mmcblk0p1 rw rootwait tegraboot=sdmmc gpt
Run Code Online (Sandbox Code Playgroud)
ITS文件的内容:
/dts-v1/;
/ {
description = "Simple image with single Linux kernel and FDT blob";
#address-cells = <1>;
images {
kernel@1 {
description = "Vanilla Linux kernel";
data = /incbin/("./zImage");
type = "kernel";
arch = "arm";
os = "linux"; …Run Code Online (Sandbox Code Playgroud) 应该有一种独立于标准、主板和架构的方法来做到这一点,就像 initfamfs 一样,不是吗?
如果重要的话,我正在使用 powerpc 和 linux-3.10。如果以后有更好的设施,我很想听听。
如果有人知道目前正在工作的董事会,我可以将其用作参考,那也会有所帮助。
我一直在搜索和搜索,我找到了很多关于为什么 dts/dtb 存在的信息,大量关于它们是否有用的持续讨论,以及一些关于如何编写 dts 或使用现有 dts 的信息,但没有关于如何嵌入它们。
快速描述或相关文档的指针将非常感激。
我使用Yocto为Beaglebone Black创建一个小的linux映像.我想我的大部分工作都像我想要的那样,除了我需要访问UART 2和4.当我使用标准的Debian图像时,我用设备树覆盖和capemgr做了这个.但是,我发现使用Yocto构建的内核没有capemgr.
我的选择似乎是:
选项2似乎更容易.
UART的设备树覆盖在这里和这里.我已经尝试过以某种方式包含这些内容.
这两种方法都会产生如下错误:
Error: am335x-boneblack.dts:1.1-2 syntax error
FATAL ERROR: Unable to parse input tree
Run Code Online (Sandbox Code Playgroud)
但是,我注意到在尝试编译am335x-boneblack.dts时我得到了类似的错误,即使没有修改它,所以我可能甚至没有做到这一点.(使用命令dtc -I dts -O dtb -o result.dtb am335x-boneblack.dts)
显然我不知道我在做什么.我怀疑设备树覆盖必须以某种方式进行修改,以便在我尝试使用它们的方式中使用.或者也许我没有做包含权限(只需在文件顶部添加#include).
有没有人有任何想法我可能做错了什么?我正在努力做甚么可能吗?
在struct device \xef\xbc\x8c的定义中有一个fwnode字段\xef\xbc\x8c
\nstruct device {\n ...\n struct fwnode_handle *fwnode; /* firmware device node */\n ...\n}\nRun Code Online (Sandbox Code Playgroud)\n相应的文件位于include/linux/fwnode.h中:
\nstruct fwnode_reference_args {\n struct fwnode_handle *fwnode;\n unsigned int nargs;\n unsigned int args[NR_FWNODE_REFERENCE_ARGS];\n};\n...\nRun Code Online (Sandbox Code Playgroud)\n然后我在网站上搜索它,但找不到内核这部分(fwnode)的详细解释,那么这是什么意思?它有什么作用?\n你能提供一个文档以供参考吗?
\n当我使用 Yocto Kirkstone 为机器 beaglebone-yocto 构建核心映像时,我得到一个文件/boot/extlinux/extlinux.conf. 该文件如下所示:
default Yocto
label Yocto
kernel /zImage
fdtdir /
append root=PARTUUID=f8fbccd5-02 rootwait console=ttyS0,115200
Run Code Online (Sandbox Code Playgroud)
我可以在标签 a 内附加DEVICETREE /mycustom.dtb,它将在下次启动时加载 mycustom.dtb 作为设备树。我不知道如何将其包含在 Yocto 构建中,因此mycustm.dtsi会被编译并添加到 /boot 文件夹中。
我尝试过使用如下食谱mycustom.dts进行编译:mycustom.dtb
inherit devicetree
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
SRC_URI = " \
file://mycustom.dts;subdir=git/overlays \
"
S = "${WORKDIR}/git/overlays"
COMPATIBLE_MACHINE = ".*(beaglebone).*"
Run Code Online (Sandbox Code Playgroud)
它构建正确,但是当我在图像中使用它时,我收到错误:No match for argument: mycustom因为do_rootfs: Could not invoke dnf. 看起来 do_root 作为mycustom参数添加到命令中,导致命令失败。
我试图从DTS文件中了解以下代码段.
/dts-v1/;
/ {
model = "MPC8313ERDB";
compatible = "MPC8313ERDB", "MPC831xRDB", "MPC83xxRDB";
#address-cells = <1>;
#size-cells = <1>;
aliases {
ethernet0 = &enet0;
serial0 = &serial0;
serial1 = &serial1;
pci0 = &pci0;
};
Run Code Online (Sandbox Code Playgroud)
别名的作用是什么?
我的理解如下.
对于ethernet0,我们可以使用enet0.
但为什么serial0 =&serial0?
和serial1 =&serial1
有人可以请一下吗?
谢谢.
embedded operating-system embedded-linux systems-programming device-tree
为什么这个内核模块在加载它时什么都不做?
#include <linux/init.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#define DEVICE_NAME "hello-1.00.a"
#define DRIVER_NAME "hello"
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(struct platform_device *pdev){
printk(KERN_ALERT "Hello, world\n");
return 0;
}
static int hello_exit(struct platform_device *pdev){
printk(KERN_ALERT "Goodbye, cruel world\n");
return 0;
}
static const struct of_device_id myled_of_match[] =
{
{.compatible = DEVICE_NAME},
{},
};
MODULE_DEVICE_TABLE(of, myled_of_match);
static struct platform_driver hello_driver =
{
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
.of_match_table = myled_of_match
},
.probe = hello_init,
.remove = hello_exit
};
module_platform_driver(hello_driver);
Run Code Online (Sandbox Code Playgroud)
它必须打印 …
insmod kernel-module linux-device-driver linux-kernel device-tree
我有一个 i2c 设备(触摸控制器)。通常,当它连接到 SoC i2c 主机(在我的例子中是一个 tegra 芯片)时,我会像这样将它添加到 .dts 文件中:
i2c@7000c000 {
st1332: touchscreen@55 {
compatible = "sitronix,st1232";
reg = <0x55>;
interrupt-parent = <&gpio>;
interrupts = <189 IRQ_TYPE_EDGE_FALLING>;
};
};
Run Code Online (Sandbox Code Playgroud)
i2c@7000c000在 SoC 的 .dtsi 文件中定义了 i2c 控制器:
i2c1: i2c@7000c000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "nvidia,tegra124-i2c";
reg = <0x0 0x7000c000 0x0 0x100>;
interrupts = <0 38 0x04>;
scl-gpio = <&gpio 20 0>; /* gpio PC4 */
sda-gpio = <&gpio 21 0>; /* gpio PC5 */
nvidia,memory-clients …Run Code Online (Sandbox Code Playgroud) 我目前正在为Linux使用PowerPC编写设备驱动程序.
设备树条目如下:
// PPS Interrupt client
pps_hwirq {
compatible = "pps-hwirq";
interrupts = <17 0x02>; // IPIC 17 = IRQ1, 0x02 = falling edge
interrupt-parent = < &ipic >;
};
Run Code Online (Sandbox Code Playgroud)
0x02标志非常重要 - PPS与下降沿对齐,但这在GPS接收器上不是通用的,因此应该是可配置的.
在probe()驱动程序的功能中,获取IRQ编号很简单:
hwirq = irq_of_parse_and_map(np, 0);
if (hwirq == NO_IRQ) {
dev_err(&pdev->dev, "No interrupt found in the device tree\n");
return -EINVAL;
}
Run Code Online (Sandbox Code Playgroud)
但是如何将IRQ标志从设备树映射到驱动程序?
/* ****TODO****: Get the interrupt flags from the device tree
* For now, hard code to suit my problem, but since this …Run Code Online (Sandbox Code Playgroud) 设备树中的address-cell和size-cells是什么?难道reg是与address-cell和size-cell?如果是,那么如何?
例如:
memory: memory@20000000 {
#address-cells = <1>;
#size-cells = <1>;
device_type = "memory";
reg = <0x20000000 0x80000000>;
};
Run Code Online (Sandbox Code Playgroud)
什么是 0x20000000 ?我们从哪里可以得到这个?
device-tree ×10
linux-kernel ×9
embedded ×2
acpi ×1
arguments ×1
c ×1
insmod ×1
linux ×1
powerpc ×1
u-boot ×1
yocto ×1
yocto-layer ×1
yocto-recipe ×1