命令用于为特定软件包打补丁linux patch命令,他使用diff命令对源文件进行操作。

基本命令句型:

patch[-R]{-p(n)}[--dry-run]<patch_file_name

p:为path的简写。

n:指将patch文件中的path第n条’/’及其右边部份取消。

-R:卸载patch包。

--dry-run:尝试patch软件linux patch命令linux环境配置linux怎么查看系统版本,并不真正更改软件。

使用实例:

linux patch命令_linux patch命令_linux patch命令

/home/sense/patch-2.6.19.1

=============================================================

diff--gita/arch/i386/kernel/acpi/boot.cb/arch/i386/kernel/acpi/boot.c

indexd12fb97..c8f96cf100644

—a/arch/i386/kernel/acpi/boot.c

+++b/arch/i386/kernel/acpi/boot.c

linux patch命令_linux patch命令_linux patch命令

@@-333,7+333,7@@acpi_parse_ioapic(acpi_table_entry_heade

/*

??*ParseInterruptSourceOverridefortheACPISCI

-staticvoidacpi_sci_ioapic_setup(u32bus_irq,u32gsi,u16polarity,u16trigger)

+staticvoidacpi_sci_ioapic_setup(u32gsi,u16polarity,u16trigger)

=============================================================

此patch文件的path=a/arch/i386/kernel/acpi

[sense@ssnsrc]$pwd

/usr/src

[sense@ssnsrc]$tree

`--a

`--arch

linux patch命令_linux patch命令_linux patch命令

和a/同目录时:

[sense@ssnsrc]$pwd

/usr/src

[sense@ssnsrc]$patch-p0</home/sense/patch-2.6.19.1??安装补丁

[sense@ssnsrc]$patch-p0-R</home/sense/patch-2.6.19.1??卸载补丁

和a/arch/同目录时:

[sense@ssnsrc]$pwd

/usr/src/a/

[sense@ssnsrc]$patch-p1</home/sense/patch-2.6.19.1??安装补丁

[sense@ssnsrc]$patch-p1-R</home/sense/patch-2.6.19.1??卸载补丁

和a/arch/i386/同目录时:

[sense@ssnsrc]$pwd

/usr/src/a/arch/

[sense@ssnsrc]$patch-p2</home/sense/patch-2.6.19.1??安装补丁

[sense@ssnsrc]$patch-p2-R</home/sense/patch-2.6.19.1??卸载补丁

Tagged:
Author

这篇优质的内容由TA贡献而来

刘遄

《Linux就该这么学》书籍作者,RHCA认证架构师,教育学(计算机专业硕士)。

发表回复