我研究了一些文章,其中我得到的信息是像 open() 这样的系统调用调用 glibc 中的包装函数,然后引发一个陷阱,将上下文从用户空间切换到内核空间,然后使用 cpu 寄存器来调用系统调用内核空间中的参数/参数。
但我仍然想我缺少系统调用调用的分步过程或详细序列。如果人们能够提供考虑 ARM arch 作为参考的步骤,那就太好了。提前致谢。
我试图弄清楚如何从“C”应用程序加载内核模块,我不想使用,finit_module因为我的系统上没有用于此系统调用的 glibc 包装器。
这是我尝试过的:
#include <fcntl.h>
#include <sys/mman.h>
int init_module(void *module_image, unsigned long len,
const char *param_values);
int main() {
int res = 0;
void *buf = 0;
struct stat sb;
int rc = 0;
int fd = open("/tmp/my-test.ko", O_RDONLY|O_CLOEXEC);
if (fd < 0) {
rc = -1;
goto EXIT;
}
res = fstat(fd, &sb);
if (res == -1) {
rc = -2;
goto EXIT_CLOSE;
}
buf = mmap(0, sb.st_size, PROT_READ|PROT_EXEC, MAP_PRIVATE, fd, 0);
if (buf == 0) …Run Code Online (Sandbox Code Playgroud) U-boot 传递内核命令行参数。根据我的要求,我想在内核源代码树中编辑这些参数,并且不想更改 U-boot 代码。我使用的是2.6.35内核。
因此,请指导我必须检查内核源代码的哪一部分。
我刚刚开始使用 yocto 项目,并尝试为 x86 架构构建一个映像,以便使用 QEMU 模拟器(在 Ubuntu 16.04 上运行)进行模拟。在构建操作系统映像时,我收到以下错误。
ERROR: core-image-sato-1.0-r0 do_rootfs: Error executing a python function in exec_python_func() autogenerated:
The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:do_rootfs(d)
0003:
File: '/home/rahul/poky/poky/meta/classes/image.bbclass', lineno: 258, function: do_rootfs
0254: progress_reporter.next_stage()
0255:
0256: # generate rootfs
0257: d.setVarFlag('REPRODUCIBLE_TIMESTAMP_ROOTFS', 'export', '1')
*** 0258: create_rootfs(d, progress_reporter=progress_reporter, logcatcher=logcatcher)
0259:
0260: progress_reporter.finish()
0261:}
0262:do_rootfs[dirs] = "${TOPDIR}"
File: '/home/rahul/poky/poky/meta/lib/oe/rootfs.py', lineno: 1010, function: create_rootfs
1006: …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Buildroot 构建一个在 PocketBeagle 上运行的嵌入式 Linux;并按照 ( source1。然后将生成的图像复制到 USB 卡。\n将 USB 卡插入 Pocketbeagle 并通过串行连接监视启动过程时;我收到以下错误:
\n\nNo filesystem could mount root, tried: \next4\nKernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,1)\n---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,1).\nRun Code Online (Sandbox Code Playgroud)\n\n使用的资源是:\nBuildroot:2018.02
\n文件系统:ext4
\nBootloader:U-Boot(自定义版本2018.01)
\n内核版本:4.14.24 \n应用上面源中所述的所有补丁,可以在( source2
)中找到:\n- 0001-Stripped-back-pocketbeagle-devicetree.patch \n- 0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch \n- 0002-U-Boot-BeagleBone-Cape-Manager.patch \n - 0003-pocketbeagle-tweaks.patch
运行构建会产生以下文件和映像:
\nMLO:第一阶段引导加载程序
\nU-boot.img:第二阶段引导加载程序
\nuEnv.txt:U-boot 环境
\nzImage:Linux 内核映像
\nam335x-pocketbeagle.dtb:Linux内核设备树 Blob
\nrootfs.ext4:根文件系统映像
uEnv.txt如下:
\n\nfdtfile=am335x-pocketbeagle.dtb …Run Code Online (Sandbox Code Playgroud) 我正在使用GitHub 上的protobuf-c。当我运行 make 时出现此错误。
$ git clone https://github.com/protobuf-c/protobuf-c.git
Cloning into 'protobuf-c'...
$ cd protobuf-c
$ ./autogen.sh
...
Run Code Online (Sandbox Code Playgroud)
进而:
$ ./configure
...
checking whether g++ supports C++11 features with -std=c++11... yes
checking for protobuf... no
checking for protobuf... no
configure: error: Package requirements (libprotobuf-c >= 1.0.1) were not met:
No package 'libprotobuf-c' found
Consider adjusting the `PKG_CONFIG_PATH` environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables `libprotobuf_c_CFLAGS`
and `libprotobuf_c_LIBS` to avoid …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 CPU cortex m4 模拟 STM32 机器的时钟控制。STM32参考手册中规定,向内核提供的时钟是由HCLK提供的。
RCC 为 Cortex 系统定时器 (SysTick) 的外部时钟提供除以 8 的 AHB 时钟 (HCLK)。SysTick 可以使用此时钟或 Cortex 时钟 (HCLK) 工作,可在 SysTick 控制和状态寄存器中进行配置。
现在 Cortex m4 已经由 QEMU 模拟,我正在使用相同的 STM32 模拟。我的困惑是我应该提供我为STM32开发的“HCLK”时钟频率以将时钟脉冲发送到cortex m4还是cortex -m4本身设法拥有自己的时钟,HCLK时钟频率为168MHz?或者时钟频率不同?
如果我必须将此频率传递给皮层 m4,我该怎么做?
我使用的代码如下所示
if (strcmp(oid, ".1.3.6.1.4.1.53864.1.1.0") == 0)
{
return 1;
}
else if (strcmp(oid, ".1.3.6.1.4.1.53864.1.2.0") == 0)
{
return 2;
}
...
else if (strcmp(oid, ".1.3.6.1.4.1.53864.1.n.0") == 0)
{
return n;
}
Run Code Online (Sandbox Code Playgroud)
现在的问题是更新n值是250。任何人都可以给我任何想法来减少这个else if声明吗?
我尝试在 StackOverflow 上搜索,但这些答案与其他语言相关,我想要一个可以用 C 语言实现的想法。
我试图在继承自动工具后使用yocto构建我的库。我需要在最终映像中打包“ .so”文件,因为我的应用程序在运行时会动态链接该库。但是我在最终图像中找不到我的.so文件,相反,我可以看到“ .so.0”和“ .so.0.0.0”。因此,我尝试在食谱中添加以下规则。
FILES_SOLIBSDEV = ""
FILES_${PN} += "${libdir}/"
Run Code Online (Sandbox Code Playgroud)
加上这个给我一个错误。
ERROR: QA Issue: non -dev/-dbg/-nativesdk package contains symlink .so:
Run Code Online (Sandbox Code Playgroud)
我可以理解“ .so”文件是符号链接,我无法将它们打包在映像中,因为它们是供开发人员软件包使用的。但是我不知何故需要目标图像中的“ .so”文件。有没有出路?
注意:可以将应用程序源代码修改为采用“ .so.0.0.0”,但这是最不推荐的选择。
我的覆盆子pi为零,在开发过程中我花了很多时间弹出SD卡并重新闪存.SD卡映像是在Buildroot中准备的,因此它包括带内核的引导分区,设备树覆盖和rootfs分区.是否有更简单的方法重新刷SD卡?例如通过网络?我知道U-boot可以通过tftp加载内核,但是如果我不仅需要内核,而是整个图像(设备树覆盖非常重要)?
embedded-linux ×10
linux ×5
c ×3
u-boot ×3
buildroot ×2
linux-kernel ×2
yocto ×2
autoconf ×1
autotools ×1
beagleboard ×1
boot ×1
build ×1
cortex-m ×1
embedded ×1
flash-memory ×1
pkg-config ×1
qemu ×1
sd-card ×1
stm32 ×1
ubuntu-16.04 ×1