【发布时间】:2018-01-23 18:45:33
【问题描述】:
我的目标是在 linux 内核中实现一个系统调用来启用/禁用 CPU 内核。
首先,我实现了一个在 4 核系统中禁用 CPU3 的系统调用。
系统调用代码如下:
#include <linux/kernel.h>
#include <linux/slab.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
#include <linux/cpumask.h>
#include <linux/smp.h>
asmlinkage long sys_new_syscall(void)
{
unsigned int cpu3;
set_cpu_online (cpu3, false) ; /* clears the CPU in the cpumask */
printk ("CPU%u is offline\n", cpu3);
return 0;
}
系统调用已在内核中正确注册,并且我在内核配置期间启用了“cpu hotplug”功能。看图
但是,内核在最后阶段编译失败,我得到了这个错误:
gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.6.7-rt13-v7+ with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
arch/arm/boot/Makefile:99: recipe for target 'install' failed
make[1]: *** [install] Error 1
arch/arm/Makefile:333: recipe for target 'install' failed
make: *** [install] Error 2
我做错了什么?
【问题讨论】:
标签: linux linux-kernel arm kernel system-calls