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

Spearitch

Member
Joined
Oct 14, 2020
Messages
45
Reaction score
6
Credits
475
Hello Everyone

I am trying to install the Developer Package from ST. It uses OpenSTLinux which is based on Yocto.

I am using the README.HOW_TO.txt (Provided under) file to install the kernel. In section 3 it is stated that I must apply some patches: Here is what it says:

Code:
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 <[email protected]>
|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

patches.PNG



Best regards
 

Attachments

  • README.HOW_TO.txt
    15.1 KB · Views: 397
Last edited:


All of the instructions are clearly written right there in black and white in that text file.
See the section entitled "3. Prepare kernel source:"

1. Put the patches in a directory somewhere - it doesn't really matter where.
2. un-pack the linux kernel source-code.
3. cd into the root of the kernel source tree.
4. Use a simple terminal one-liner to apply the patches via the patch command.

The example command in the instruction text is:
Bash:
for p in `ls -1 ../*.patch`; do patch -p1 < $p; done
Which assumes that ALL of the patches are in the parent directory of the current directory.

If you have put the patches somewhere in your home directory, use that path in the ls command enclosed in the back-ticks.

So for example, if you put them in your home directory in a sub-directory called "linux-patches" you would do something like this:
Bash:
for p in `ls -1 "$HOME/linux-patches/*.patch"`; do patch -p1 < "$p"; done
The example above just gets the paths/filenames of ALL .patch files in the linux-patches sub-directory of your home directory ($HOME is an environment variable, which stores the path to /home/yourusername).

NOTE: If you've put your patches in a different directory, substitute "$HOME/linux-patches/" with the path to the directory you actually have the patches stored in.

Also note:
The command I've used looks a little different to the original because when dereferencing shell variables, I always use double quotes to avoid any problems with globbing, or special characters in file-names that might need to be escaped, to prevent them being misinterpreted by the shell.
 
All of the instructions are clearly written right there in black and white in that text file.
See the section entitled "3. Prepare kernel source:"

1. Put the patches in a directory somewhere - it doesn't really matter where.
2. un-pack the linux kernel source-code.
3. cd into the root of the kernel source tree.
4. Use a simple terminal one-liner to apply the patches via the patch command.

The example command in the instruction text is:
Bash:
for p in `ls -1 ../*.patch`; do patch -p1 < $p; done
Which assumes that ALL of the patches are in the parent directory of the current directory.

If you have put the patches somewhere in your home directory, use that path in the ls command enclosed in the back-ticks.

So for example, if you put them in your home directory in a sub-directory called "linux-patches" you would do something like this:
Bash:
for p in `ls -1 "$HOME/linux-patches/*.patch"`; do patch -p1 < "$p"; done
The example above just gets the paths/filenames of ALL .patch files in the linux-patches sub-directory of your home directory ($HOME is an environment variable, which stores the path to /home/yourusername).

NOTE: If you've put your patches in a different directory, substitute "$HOME/linux-patches/" with the path to the directory you actually have the patches stored in.

Also note:
The command I've used looks a little different to the original because when dereferencing shell variables, I always use double quotes to avoid any problems with globbing, or special characters in file-names that might need to be escaped, to prevent them being misinterpreted by the shell.

Yep The patches directory as you stated it was moved (my bad maybe). I used a lot of copy and access commands that's why I got confused and didn't notice that the main diretory where to run the command was the directory to kernel source code.

Thank you
 

Members online


Latest posts

Top