cancel
Showing results for 
Search instead for 
Did you mean: 

How To apply patches when installing the kernel? (Developer Package)

SigmaPrime
Senior

Hello Everyone

I am using the README.HOW_TO.txt file to install the kernel. IN section 3 it is stated that I must apply some patches:

1-Section 3 patch application

if there is some patch, please apply it on source code
    $> for p in `ls -1 *.patch`; sudo do patch -p1 < $p; done
 
mehdi@LAPTOP-CP6QP7G9:~/DevPack/stm32mp1-openstlinux-5-4-dunfell-mp1-20-11-12/sources/arm-ostl-linux-gnueabi/linux-stm32mp-5.4.56-r0$ for p in *.patch; do sudo patch --strip=1 < $p; done
can't find file to patch at input line 16
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|From 4556074b66971918536ed27d52f5f4f6337f0646 Mon Sep 17 00:00:00 2001
|From: Lionel VITTE <lionel.vitte@st.com>
|Date: Mon, 5 Oct 2020 13:19:40 +0200
|Subject: [PATCH 01/22] ARM-stm32mp1-r2-rc8-MACHINE
|
|---
| arch/arm/kernel/time.c         | 2 ++
| arch/arm/mach-stm32/Kconfig    | 1 +
| arch/arm/mach-stm32/board-dt.c | 2 ++
| 3 files changed, 5 insertions(+)
|
|diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
|index b996b2cf07038..dddc7ebf4db44 100644
|--- a/arch/arm/kernel/time.c
|+++ b/arch/arm/kernel/time.c
--------------------------
File to patch: 0018-ARM-stm32mp1-r2-SOUND.patch
patching file 0018-ARM-stm32mp1-r2-SOUND.patch
Hunk #1 FAILED at 9.
Hunk #2 FAILED at 107.
2 out of 2 hunks FAILED -- saving rejects to file 0018-ARM-stm32mp1-r2-SOUND.patch.rej
can't find file to patch at input line 35
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/arch/arm/mach-stm32/Kconfig b/arch/arm/mach-stm32/Kconfig
|index 57699bd8f1075..8f9fd1da9ea05 100644
|--- a/arch/arm/mach-stm32/Kconfig
|+++ b/arch/arm/mach-stm32/Kconfig
--------------------------

How do I do that ? Can you give me an example?

I am working in the following directory which contains patches that I will link in a picture.

Directory :

~/DevPack/stm32mp1-openstlinux-5-4-dunfell-mp1-20-11-12/sources/arm-ostl-linux-gnueabi/linux-stm32mp-5.4.56-r0

0693W000006EdLjQAK.png----------------------------------------------------------------------------------------------------------------------------------

2- section 4: have a better management of the kernel

Now coming to section 4 of the .txt file. It is written that I have to:

test -d .git || git init . && git add . && git commit -m "new kernel" && git gc

But I get the following error even with sudo:

/home/mehdi/DevPack/stm32mp1-openstlinux-5-4-dunfell-mp1-20-11-12/sources/arm-ostl-linux-gnueabi/linux-stm32mp-5.4.56-r0/.git: Permission denied

Best regards 😀

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @SigmaPrime​ ,

Are you using a git repository now ?

You have to choose one way of working : either from web source package using patch -p1 or either using git repository and git am $p

Can you please clarify ?

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

10 REPLIES 10
Olivier GALLIEN
ST Employee

Hi @SigmaPrime​ ,

You need to be in subdirectory linux-5.4.56 ( where are located source on which patch applied and call following command :

$>for p in `ls -1 ../*.patch`; do patch -p1 < $p; done

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

What an error of mine... I was confused when I read directory to kernel source code.

Works fine thanks

Hello

in the 4th step I have to

 for p in `ls -1 <path to patch>/*.patch`; do git am $p; done

What is meant by <path to patch> ?

when I am in linux-5.4.56 and do

 for p in `ls -1 ../*.patch`; do git am $p; done

I get this

Applying: ARM-stm32mp1-r2-rc8-MACHINE
warning: arch/arm/kernel/time.c has type 100755, expected 100644
error: patch failed: arch/arm/kernel/time.c:9
error: arch/arm/kernel/time.c: patch does not apply
warning: arch/arm/mach-stm32/Kconfig has type 100755, expected 100644
error: patch failed: arch/arm/mach-stm32/Kconfig:46
error: arch/arm/mach-stm32/Kconfig: patch does not apply
warning: arch/arm/mach-stm32/board-dt.c has type 100755, expected 100644
error: patch failed: arch/arm/mach-stm32/board-dt.c:17
error: arch/arm/mach-stm32/board-dt.c: patch does not apply
Patch failed at 0001 ARM-stm32mp1-r2-rc8-MACHINE
Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.

Hi @SigmaPrime​ ,

Are you using a git repository now ?

You have to choose one way of working : either from web source package using patch -p1 or either using git repository and git am $p

Can you please clarify ?

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Oh ! then I have to skip step 4.1 and 4.2 and go to 5 cause I already did step 3. Is that right ?

Yes that's it ! 😊

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Also is there a difference between <directory to kernel source code> (the linux-5.4.56) and <directory to kernel standard source code>

No it point to the same directory linux-5.4.56.

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Solved