Jak zautomatyzować program patch na linuxie?

Hej, jak patchuje kernela 4.0

patch -p1 < /usr/src/patch-4.0

To mam mase zapytań w stylu

patching file Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]

Jak moge ustwić aby domyślnie poprawiało pliki kernela, bez setek pytań?

 

 

I dobrze patchuje? Bo nie jestem pewiwn polecenia

patch -p1 < /usr/src/patch-4.0

??

Użyj flagę -s (–quiet).

Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
1 out of 1 hunk ignored -- saving rejects to file drivers/tty/serial/of_serial.c.rej
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
2 out of 2 hunks ignored -- saving rejects to file drivers/tty/serial/uartlite.c.rej
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
3 out of 3 hunks ignored -- saving rejects to file drivers/tty/serial/xilinx_uartps.c.rej
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
3 out of 3 hunks ignored -- saving rejects to file drivers/usb/chipidea/otg_fsm.c.rej
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
1 out of 1 hunk ignored -- saving rejects to file drivers/usb/class/cdc-acm.c.rej
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
5 out of 5 hunks ignored -- saving rejects to file drivers/usb/class/cdc-wdm.c.rej
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
1 out of 1 hunk ignored -- saving rejects to file drivers/usb/core/hub.c.rej
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
1 out of 1 hunk ignored -- saving rejects to file drivers/usb/dwc2/hcd.c.rej
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
1 out of 1 hunk ignored -- saving rejects to file drivers/usb/gadget/legacy/printer.c.rej
Reversed (or previously applied) patch detected!  Assume -R? [n]

patch wypytuje o każdą modyfikcje, jak dam domyśle na TAK ??

 

dobrze patchuje:

patch -p1 < /usr/src/patch-4.0

??? dobre polecenie uzywam?

Jeśli jesteś pewien że wiesz co robisz to dodaj parametr -f (–force)

Użyć patcha w odpowiedniej wersji dla posiadanej wersji źródeł.

 

Te komunikaty nie wyświetlają się bez powodu.

Chowanie ich pod dywan to głupi pomysł.

Instaluje patcha na jądro linux-4.0 i chce wgrać wszyskie poprawki po to one są. A że mnie pyta o każdy plik to jest monotonne. Ja chce tylko wgrac poprawki, na błedy. Wiadomo że tylko te dobre, przecież poprawki mają naprawiać niedociągniecią???

 

To co powiedziłem patch jest po to by naprawiał a nie psuł? czy sie myle?

Pyta się o każdy plik bo masz nieodpowiedni patch.

Najwięcej niedociągnięć nie poprawi bezmyślne nakładanie przypadkowych łatek, a lektura:

 

https://www.kernel.org/doc/Documentation/applying-patches.txt

man patch

To zależy czy się używa przy tym głowy.

Komunikat, jaki otrzymujesz, sugeruje wyraźnie, że patch, który próbujesz zaaplikować, został już wcześniej włączony do głównego źródła. Przy poprawnym nałożeniu patcha nie musisz niczego potwierdzać, otrzymasz tylko komunikat, że coś tam zostało “spaczowane”. 

 

Prawidłowo nałożone patche wyglądają mniej więcej tak:

 

==> Patching with UKSM
patching file Documentation/vm/00-INDEX
patching file Documentation/vm/uksm.txt
patching file fs/exec.c
patching file fs/proc/meminfo.c
patching file include/asm-generic/pgtable.h
patching file include/linux/ksm.h
patching file include/linux/mm_types.h
patching file include/linux/mmzone.h
patching file include/linux/sradix-tree.h
patching file include/linux/uksm.h
patching file kernel/fork.c
patching file lib/Makefile
patching file lib/sradix-tree.c
patching file mm/Kconfig
patching file mm/Makefile
patching file mm/memory.c
patching file mm/mmap.c
patching file mm/rmap.c
patching file mm/uksm.c
patching file mm/vmstat.c
==> Patching source with BFS v0.462
patching file arch/powerpc/platforms/cell/spufs/sched.c
patching file Documentation/scheduler/sched-BFS.txt
patching file Documentation/sysctl/kernel.txt
patching file fs/proc/base.c
patching file include/linux/init_task.h
patching file include/linux/ioprio.h
patching file include/linux/sched.h
Hunk #1 succeeded at 337 (offset 8 lines).
Hunk #2 succeeded at 1288 (offset 8 lines).
Hunk #3 succeeded at 1300 (offset 8 lines).
Hunk #4 succeeded at 1440 (offset 8 lines).
Hunk #5 succeeded at 1740 (offset 8 lines).
Hunk #6 succeeded at 2291 (offset 8 lines).
Hunk #7 succeeded at 3087 (offset 8 lines).
patching file init/Kconfig
patching file init/main.c
patching file kernel/delayacct.c
patching file kernel/exit.c
patching file kernel/sysctl.c
patching file lib/Kconfig.debug
patching file include/linux/jiffies.h
patching file drivers/cpufreq/cpufreq.c
patching file drivers/cpufreq/cpufreq_ondemand.c
patching file kernel/sched/bfs.c
patching file include/uapi/linux/sched.h
patching file kernel/stop_machine.c
patching file drivers/cpufreq/cpufreq_conservative.c
patching file kernel/time/Kconfig
patching file kernel/sched/Makefile
patching file kernel/sched/bfs_sched.h
patching file kernel/sched/stats.c
patching file arch/x86/Kconfig
patching file include/linux/sched/prio.h
patching file drivers/cpufreq/intel_pstate.c
patching file kernel/sched/idle.c
patching file kernel/time/posix-cpu-timers.c
patching file kernel/trace/trace_selftest.c
==> Patch source with ck-hz patches
==>  /home/lucjan/Pobrane/linux-bridge-pl/src/hz-default_1000.patch
patching file kernel/Kconfig.hz
==>  /home/lucjan/Pobrane/linux-bridge-pl/src/hz-no_default_250.patch
patching file kernel/Kconfig.hz
==> Patching source with bfs462 fix patches
==>  /home/lucjan/Pobrane/linux-bridge-pl/src/bfs462-nosubmit.patch
patching file kernel/sched/bfs.c
Hunk #1 succeeded at 3512 with fuzz 1 (offset -8 lines).
==>  /home/lucjan/Pobrane/linux-bridge-pl/src/bfs462-rtmn-fix.patch
patching file kernel/sched/bfs.c
==>  /home/lucjan/Pobrane/linux-bridge-pl/src/bfs462-update_inittask.patch
patching file include/linux/init_task.h
==> Patching source with BFQ patches
==>  /home/lucjan/Pobrane/linux-bridge-pl/src/0001-block-cgroups-kconfig-build-bits-for-BFQ-v7r7-4.0.patch
patching file block/Kconfig.iosched
patching file block/Makefile
patching file include/linux/cgroup_subsys.h
==>  /home/lucjan/Pobrane/linux-bridge-pl/src/0002-block-introduce-the-BFQ-v7r7-I-O-sched-for-4.0.patch
patching file block/bfq-cgroup.c
patching file block/bfq-ioc.c
patching file block/bfq-iosched.c
patching file block/bfq-sched.c
patching file block/bfq.h
==>  /home/lucjan/Pobrane/linux-bridge-pl/src/0003-block-bfq-add-Early-Queue-Merge-EQM-to-BFQ-v7r7-for-4.0.0.patch
patching file block/bfq-iosched.c
patching file block/bfq-sched.c
patching file block/bfq.h
==> Patching source with gcc patch to enable more cpus types
patching file arch/x86/include/asm/module.h
patching file arch/x86/Kconfig.cpu
patching file arch/x86/Makefile
Hunk #1 succeeded at 85 (offset -7 lines).
patching file arch/x86/Makefile_32.cpu

Nieco przydługi przykład (za co przepraszam :D), ale może to posłużyć jako dowód. 

 

Musisz poczytać dokładnie dokumentację, bo póki co, nie radziłbym zabierać się za kompilowanie kernela, jak gubisz wątek na poziomie patchowania. A jeśli już chcesz się bawić, to zostaw sobie “awaryjny” kernel w systemie, pozwoli to uniknąć przykrych wpadek. 

 

P.S: W jakim celu nakładasz patch-4.0 na linux-4.0? To akurat nie ma większego sensu…Bo ten patch przeznaczony jest dla kernela 3.19 :stuck_out_tongue: