简体   繁体   English

为Linux内核创建补丁文件

[英]Creating patch file for linux kernel

I am trying to create a patch file, for the modifications I have done in linux kernel. 我正在尝试创建补丁文件,以进行在Linux内核中所做的修改。 The original directory is /usr/src/linux.vanilla and the new kernel is /usr/src/linux-master . 原始目录为/usr/src/linux.vanilla ,新内核为/ usr / src / linux-master The command I used is 我使用的命令是

h@ubuntu:/usr/src$ sudo diff -rupN  linux-master/ linux.vanilla/ > original.patch 

However I get an error stating 但是我得到一个错误说明

bash: original.patch: Permission denied

Can anyone point out where I am going wrong. 谁能指出我要去哪里了。 I am using Ubuntu and linux kernel version 3.15.0. 我正在使用Ubuntu和Linux内核版本3.15.0。

Thanks. 谢谢。

The command you typed into the terminal is this: 您在终端中键入的命令是这样的:

sudo diff -rupN  linux-master/ linux.vanilla/ > original.patch 

This will run as root: 这将以root身份运行:

diff -rupN  linux-master/ linux.vanilla/

And then as your normal user account , it will write the output into 然后以您的普通用户帐户将输出写入

original.patch

However, you don't have write permissions to original.patch . 但是,您没有对original.patch写入权限。

Fix 1 修复1

Do the work under a root shell. 在root shell下进行工作。

sudo su
diff -rupN  linux-master/ linux.vanilla/ > original.patch 

Fix 2 修复2

Use tee to redirect to a file. 使用tee重定向到文件。

sudo diff -rupN  linux-master/ linux.vanilla/ | sudo tee original.patch 

Fix 3 修复3

Write the file to your home directory (or some other location that you have write permissions). 将文件写入主目录(或您具有写许可权的其他位置)。

sudo diff -rupN  linux-master/ linux.vanilla/ > ~/original.patch 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM