我发现如果我选择jffs或sd作为文件系统(而不是initramfs),内核大小将非常小(1.4 MB 与initramfs3.4 MB 相比)。这意味着initramfs需要相当大的空间。所以如果可以的话,我会完全删除它,因此内核会非常小,这正是我想要的。
我脑海中浮现的基本问题是:为什么我需要initramfs?没有任何初始文件系统,Linux 内核不能启动吗?
我的最终应用程序只会进行计算和通信 - 根本没有存储。所以没有文件系统的操作系统是有意义的——至少对我的应用程序来说是这样。
当我从 sd 卡运行 linux 并尝试挂载 sd 卡时 - 没问题,工作正常。但是当我从闪存运行 linux 时,我无法挂载我的 SD 卡:
# mount /dev/mmcblk0p1 /mnt/
mount: mounting /dev/mmcblk0p1 on /mnt/ failed: Invalid argument
Run Code Online (Sandbox Code Playgroud)
这个错误的基本原因是什么?
附加信息
root@Xilinx-ZC702-14_7:/# mount -t /dev/mmcblk0p1 /mnt
mount: can't find /mnt in /etc/fstab
root@Xilinx-ZC702-14_7:/var/volatile/log# ls
wtmp
root@Xilinx-ZC702-14_7:/var/volatile/log# dmesg
dmesg: klogctl: Function not implemented
Run Code Online (Sandbox Code Playgroud) 我知道printf需要操作系统的帮助才能完成其工作。
我也知道printf在 Linux 源代码中不起作用,因为没有库。所以我们必须printk进行调试。
printk当操作系统仍在启动时如何工作?
设备树和设备树 blob 究竟是什么?我在哪里可以获得特定 linux 版本的源代码?我在 xilinx 芯片(具有 ARM 9)上运行 linux 时发现了这样的名称,例如:here
U-Boot 2013.07 (Nov 21 2013 - 18:12:40)
Memory: ECC disabled
DRAM: 1 GiB
MMC: zynq_sdhci: 0
SF: Detected N25Q128A with page size 64 KiB, total 16 MiB
In: serial
Out: serial
Err: serial
Net: Gem.e000b000
Hit any key to stop autoboot: 0
SF: Detected N25Q128A with page size 64 KiB, total 16 MiB
SF: 11010048 bytes @ 0x520000 Read: OK
Wrong Image Format for bootm command
ERROR: can't get kernel image!
U-Boot-PetaLinux>
Run Code Online (Sandbox Code Playgroud)
然后我会输入run sdboot,它会从 sd 卡启动,我在其中放置了一个用于 sd 启动的图像。 …
我下载了 dos2unix 的 rpm 并像这样安装(在 RHEL 6、64 位上)
[root@xilinx Downloads]# rpm -ivh dos2unix-5.3.3-5.ram0.98.src.rpm
1:dos2unix warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
########################################### [100%]
[root@xilinx Downloads]#
Run Code Online (Sandbox Code Playgroud)
但是可以看出我收到了这些警告。为什么?
我怎么知道我的 dos2unix 安装成功了?
更新
[root@xilinx Downloads]# rpm -ivh dos2unix-5.3.3-5.ram0.98.src.rpm
1:dos2unix warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist …Run Code Online (Sandbox Code Playgroud) 以下是设备树文件中的代码片段:
flash@0 {
compatible = "n25q128";
reg = <0x0>;
spi-max-frequency = <50000000>;
#address-cells = <1>;
#size-cells = <1>;
partition@qspi-fsbl-uboot {
label = "qspi-fsbl-uboot";
reg = <0x0 0x100000>;
};
partition@qspi-linux {
label = "qspi-linux";
reg = <0x100000 0x500000>;
};
partition@qspi-device-tree {
label = "qspi-device-tree";
reg = <0x600000 0x20000>;
};
partition@qspi-rootfs {
label = "qspi-rootfs";
reg = <0x620000 0x5E0000>;
};
partition@qspi-bitstream {
label = "qspi-bitstream";
reg = <0xC00000 0x400000>;
};
};
Run Code Online (Sandbox Code Playgroud)
我的简单问题是 < > 中的两个值是什么?例如在 reg = <0x600000 0x20000>;
我认为它是 …
我有一个要使用 u-boot 启动的 zImage。
我认为 u-boot 不理解 zImage,因为在 uboot 执行后我收到以下错误:
Wrong Image Format for bootm command
ERROR: can't get kernel image!
U-Boot-cortex>
Run Code Online (Sandbox Code Playgroud)
是否有任何工具可以将 zImage 转换为 u-boot 理解的 uImage?
lspci在 petalinux 中没有实现。那么有没有其他选择呢?我可以读取lspci输出的任何文件?
我知道这个 make 文件的目的;它是一个驱动程序的 Makefile,它将从内核源代码调用内核的构建系统。但无法理解到底发生了什么。
# Makefile – makefile of our first driver
# if KERNELRELEASE is not defined, we've been called directly from the command line.
# Invoke the kernel build system.
ifeq (${KERNELRELEASE},)
KERNEL_SOURCE := /usr/src/linux
PWD := $(shell pwd)
default:
${MAKE} -C ${KERNEL_SOURCE} SUBDIRS=${PWD} modules
clean:
${MAKE} -C ${KERNEL_SOURCE} SUBDIRS=${PWD} clean
# Otherwise KERNELRELEASE is defined; we've been invoked from the
# kernel build system and can use its language.
else
obj-m := ofd.o
endif
Run Code Online (Sandbox Code Playgroud)
例如这里发生的事情:
`${MAKE} -C …Run Code Online (Sandbox Code Playgroud) 命令是什么:
ls | wc -l
Run Code Online (Sandbox Code Playgroud)
做?我知道
wc <filename>
Run Code Online (Sandbox Code Playgroud)
给出行、词和字符,以及
wc -l <filename>
Run Code Online (Sandbox Code Playgroud)
打印行数。但是它如何与 ls` 一起使用尚不清楚。它有什么作用?
我想在目录中搜索文本“启动内核”,所以我这样做了:
[root@xilinx petalinux-v2013.10-final]# grep -r "Starting kernel"
grep: warning: tools/packagemanager/lib/i686: recursive directory loop
grep: Xilinx-ZC702-14.7/build/linux/rootfs/targetroot/etc/init.d/functions: No such file or directory
grep: Xilinx-ZC702-14.7/build/linux/rootfs/targetroot/etc/rcS.d/S10flashdev: No such file or directory
grep: Xilinx-ZC702-14.7/build/linux/rootfs/targetroot/mnt/net: No such file or directory
grep: Xilinx-ZC702-14.7/build/linux/rootfs/targetroot/mnt/cf: No such file or directory
Binary file Xilinx-ZC702-14.7/pre-built/linux/images/u-boot.elf matches
Binary file Xilinx-ZC702-14.7/pre-built/linux/images/BOOT.BIN matches
Binary file Xilinx-ZC702-14.7/pre-built/linux/images/output.bin matches
Run Code Online (Sandbox Code Playgroud)
为什么要搜索不存在的文件?为什么我会收到这些“没有这样的文件或目录”消息?
另外,为什么当我给它 ASCII 字符时它会搜索二进制文件?二进制文件可以包含像我这样的字符串吗?