Approved version. Approved on: 09:01, 8 October 2019
You are viewing an old version of this page. Return to the latest version.
Difference between revisions of "Getting started/STM32MP1 boards/STM32MP157x-EV1/Develop on Arm® Cortex®-A7/Modify, rebuild and reload the Linux® kernel"
< Getting started | STM32MP1 boards | STM32MP157x-EV1 | Develop on Arm® Cortex®-A7Return to history page
← Getting started/STM32MP1 boards/STM32MP157x-EV1/Develop on Arm® Cortex®-A7/Modify, rebuild and reload the Linux® kernel
← Getting started/STM32MP1 boards/STM32MP157x-EV1/Develop on Arm® Cortex®-A7/Modify, rebuild and reload the Linux® kernel
[quality revision] | [quality revision] |
m
|
m
|
![]() |
||||||
Develop on Arm® Cortex®-A7 | Develop on Arm® Cortex®-M4 | |||||
![]() |
Install the SDK |
![]() |
Create a simple hello-world application |
![]() |
Modify, rebuild and reload the Linux® kernel |
![]() |
1 Overview[edit]
This stage explains how modify, rebuild and reload the Linux® kernel.
You will first be guided to install the Linux® kernel source code in the Developer Package directory. Then you will execute step by step procedures to modify, rebuild and reload the Linux® kernel.
2 Download the Linux® kernel source code[edit]
The software package is provided AS IS, and by downloading it, you agree to be bound to the terms of the software license agreement (SLA). The detailed content licenses can be found here.
![]() |
To download a package, it is recommended to be logged in to your "myst" account [1]. If, trying to download, you encounter a “403 error”, you could try to empty your browser cache to workaround the problem. We are working on the resolution of this problem. We apologize for this inconvenience |
For ecosystem release v3.1.0 :
- Download the STM32MP15-Ecosystem-v3.1.0 Developer Package Sources into the following directory:
$HOME/STM32MPU_workspace/STM32MP15-Ecosystem-v3.1.0/Developer-Package - Uncompress the tarball file to get the Linux® kernel tarball, ST patches and ST configuration fragments
PC $> cd $HOME/STM32MPU_workspace/STM32MP15-Ecosystem-v3.1.0/Developer-Package PC $> tar xvf en.SOURCES-kernel-stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17.tar.xzFor ecosystem release v3.0.0

- Download the STM32MP15-Ecosystem-v3.0.0 Developer Package Sources into the following directory:
$HOME/STM32MPU_workspace/STM32MP15-Ecosystem-v3.0.0/Developer-Package - Uncompress the tarball file to get the Linux® kernel tarball, ST patches and ST configuration fragments
PC $> cd $HOME/STM32MPU_workspace/STM32MP15-Ecosystem-v3.0.0/Developer-Package PC $> tar xvf en.SOURCES-kernel-stm32mp1-openstlinux-5.10-dunfell-mp1-21-03-31.tar.xz
3 Prepare the Linux® kernel source code[edit]
- Extract the Linux® kernel source
For ecosystem release v3.1.0 :
PC $> cd stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/linux-stm32mp-5.10.61-stm32mp-r2-r0 PC $> tar xvf linux-5.10.61.tar.xz
- Apply ST patches
PC $> cd linux-5.10.61 PC $> for p in `ls -1 ../*.patch`; do patch -p1 < $p; done
- Apply fragments
PC $> make ARCH=arm multi_v7_defconfig "fragment*.config" PC $> for f in `ls -1 ../fragment*.config`; do scripts/kconfig/merge_config.sh -m -r .config $f; done PC $> yes '' | make ARCH=arm oldconfigFor ecosystem release v3.0.0

PC $> cd stm32mp1-openstlinux-5.10-dunfell-mp1-21-03-31/sources/arm-ostl-linux-gnueabi/linux-stm32mp-5.10.10-r0 PC $> tar xvf linux-5.10.10.tar.xz
- Apply ST patches
PC $> cd linux-5.10.10 PC $> for p in `ls -1 ../*.patch`; do patch -p1 < $p; done
- Apply fragments
PC $> make ARCH=arm multi_v7_defconfig "fragment*.config" PC $> for f in `ls -1 ../fragment*.config`; do scripts/kconfig/merge_config.sh -m -r .config $f; done PC $> yes '' | make ARCH=arm oldconfig
4 Build the Linux® kernel source code for the first time[edit]
![]() |
Building the kernel for the first time can take several minutes. |
- Build kernel images (uImage and vmlinux) and device tree (dtbs)
PC $> make ARCH=arm uImage vmlinux dtbs LOADADDR=0xC2000040
- Build kernel module
PC $> make ARCH=arm modules
- Generate output build artifacts
PC $> mkdir -p $PWD/install_artifact/ PC $> make ARCH=arm INSTALL_MOD_PATH="$PWD/install_artifact" modules_install
5 Deploy the Linux® kernel on the board[edit]
5.1 Push the Linux® kernel onto the board[edit]
PC $> scp arch/arm/boot/uImage root@<board ip address>:/boot
5.2 Push the device tree onto the board[edit]
PC $> scp arch/arm/boot/dts/stm32mp157*.dtb root@<board ip address>:/boot
5.3 Push the kernel modules onto the board[edit]
For ecosystem release v3.1.0 :
- Remove the link created inside the install_artifact/lib/modules/<kernel version> directory
PC $> rm install_artifact/lib/modules/5.10.61/build install_artifact/lib/modules/5.10.61/source
- Optionally, strip kernel modules (to reduce the size of each kernel modules)
PC $> find install_artifact/ -name "*.ko" | xargs $STRIP --strip-debug --remove-section=.comment --remove-section=.note --preserve-dates
- Copy kernel modules
PC $> scp -r install_artifact/lib/modules/* root@<ip of board>:/lib/modules
- Using the Linux® console, regenerate the list of module dependencies (modules.dep) and the list of symbols provided by modules (modules.symbols)
Board $> /sbin/depmod -a
- Synchronize data on disk with memory
Board $> syncFor ecosystem release v3.0.0

- Remove the link created inside the install_artifact/lib/modules/<kernel version> directory
PC $> rm install_artifact/lib/modules/5.10.10/build install_artifact/lib/modules/5.10.10/source
- Optionally, strip kernel modules (to reduce the size of each kernel modules)
PC $> find install_artifact/ -name "*.ko" | xargs $STRIP --strip-debug --remove-section=.comment --remove-section=.note --preserve-dates
- Copy kernel modules
PC $> scp -r install_artifact/lib/modules/* root@<ip of board>:/lib/modules
- Using the Linux® console, regenerate the list of module dependencies (modules.dep) and the list of symbols provided by modules (modules.symbols)
Board $> /sbin/depmod -a
- Synchronize data on disk with memory
Board $> sync
5.4 Reboot the board[edit]
Board $> reboot
6 Modify a built-in Linux® kernel device driver[edit]
This simple example adds unconditional log information when the display driver is probed.
- Using the Linux® console, check that there is no log information when the display driver is probed
Board $> dmesg | grep -i stm_drm_platform_probe Board $>
For ecosystem release v3.1.0 :
- Go to the Linux® kernel source directory
PC $> cd $HOME/STM32MPU_workspace/STM32MP15-Ecosystem-v3.1.0/Developer-Package/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sources/arm-ostl-linux-gnueabi/linux-stm32mp-5.10.61-stm32mp-r2-r0/linux-5.10.61
- Edit the ./drivers/gpu/drm/stm/drv.c source file
- Add a log information in the stm_drm_platform_probe function as follows
static int stm_drm_platform_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct drm_device *ddev;
int ret;
[...]
DRM_INFO("Simple example - %s\n", __func__);
return 0;
[...]
}
- Save the file
- Rebuild the Linux® kernel
PC $> make uImage LOADADDR=0xC2000040
- Update the Linux kernel image into board
PC $> scp arch/arm/boot/uImage root@<board ip address>:/boot
- Reboot the board
Board $> reboot
- Check that log information is now present when the display driver is probed
Board $> dmesg | grep -i stm_drm_platform_probe [ 2.764080] [drm] Simple example - stm_drm_platform_probe

- Go to the Linux® kernel source directory
PC $> cd $HOME/STM32MPU_workspace/STM32MP15-Ecosystem-v3.0.0/Developer-Package/stm32mp1-openstlinux-5.10-dunfell-mp1-21-03-31/sources/arm-ostl-linux-gnueabi/linux-stm32mp-5.10.10-r0/linux-5.10.10
- Edit the ./drivers/gpu/drm/stm/drv.c source file
- Add a log information in the stm_drm_platform_probe function as follows
static int stm_drm_platform_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct drm_device *ddev;
int ret;
[...]
DRM_INFO("Simple example - %s\n", __func__);
return 0;
[...]
}
- Save the file
- Rebuild the Linux® kernel
PC $> make uImage LOADADDR=0xC2000040
- Update the Linux kernel image into board
PC $> scp arch/arm/boot/uImage root@<board ip address>:/boot
- Reboot the board
Board $> reboot
- Check that log information is now present when the display driver is probed
Board $> dmesg | grep -i stm_drm_platform_probe [ 2.764080] [drm] Simple example - stm_drm_platform_probe
![]() |
![]() |
![]() |
<bookshelf src="Book:Getting started" /> {| class="contenttablest-table" style="text-align:center; margin: auto" | colspan="7" style="text-align:center; border-color: white; background-color: whiteborder-style: hidden;" | [[Image:STM32MP157C-EV1.png | 65px | link=]] |- | colspan="4" style="text-align:left; border-color: white; background-color: whiteborder-style: hidden; text-align:left;" | [[Getting started/STM32MP1 boards/STM32MP157x-EV1/Develop on Arm® Cortex®-A7 | {{GSModuleCurrent|Develop on Arm® Cortex®-A7}}]] | colspan="3" style="text-align:right; border-color: white; background-color: whiteborder-style: hidden; text-align:right;" | [[Getting started/STM32MP1 boards/STM32MP157x-EV1/Develop on Arm® Cortex®-M4 | {{GSModuleNext|Develop on Arm® Cortex®-M4}}]] |- | style="border-color: white; background-color: whitestyle: hidden;" | [[Image:step_category_in.png|link=]] | style="width:150px; text-align:center; border-color: white; background-color: whiteborder-style: hidden; width:150px;" | [[Getting started/STM32MP1 boards/STM32MP157x-EV1/Develop on Arm® Cortex®-A7/Install the SDK | {{GSStepNext|Install the SDK}}]] | style="border-color: white; background-color: whitestyle: hidden;" | [[Image:step.png|link=]] | style="width:150px; margin-top:0px; text-align:center; border-color: white; background-color: whiteborder-style: hidden; width:150px;" | [[Getting started/STM32MP1 boards/STM32MP157x-EV1/Develop on Arm® Cortex®-A7/Create a simple hello-world application | {{GSStepNext|Create a simple hello-world application}}]] | style="border-color: white; background-color: whitestyle: hidden;" | [[Image:step.png|link=]] | style="width:150px; text-align:center; border-color: white; background-color: whiteborder-style: hidden; width:150px;" | [[Getting started/STM32MP1 boards/STM32MP157x-EV1/Develop on Arm® Cortex®-A7/Modify, rebuild and reload the Linux® kernel | {{GSStepCurrent|Modify, rebuild and reload the Linux® kernel}}]] | style="border-color: white; background-color: whitestyle: hidden;" | [[Image:step_category_out.png|link=]] |}<br> {{:Modify, rebuild and reload the Linux® kernel}} <br> {| class="contenttablest-table" style="margin: auto" | style="border-color: white; background-color: white; style: hidden; width:120px; text-align:left" | [[Image:back_button.png|link=Getting started/STM32MP1 boards/STM32MP157x-EV1/Develop on Arm® Cortex®-A7/Create a simple hello-world application]] | style="border-color: white; background-color: white; style: hidden; width:360px; text-align:center" | [[Image:overview_button.png|link=Getting started/STM32MP1 boards/STM32MP157x-EV1]] | style="border-color: white; background-color: white; style: hidden; width:120px; text-align:right" | [[Image:next_button.png|link=Getting started/STM32MP1 boards/STM32MP157x-EV1/Develop on Arm® Cortex®-M4]] |} <noinclude> {{DISPLAYTITLE:{{SUBPAGENAME}}}} __NOTOC__ [[Category:STM32MP157x-EV1 - develop on A7 | 03]] {{PublicationRequestId | Auto}}</noinclude>
Line 1: | Line 1: | ||
<bookshelf src="Book:Getting started" /> |
<bookshelf src="Book:Getting started" /> |
||
− | {| class=" |
+ | {| class="st-table" style="text-align:center; margin: auto" |
− | | colspan="7" style=" |
+ | | colspan="7" style="border-style: hidden;" | [[Image:STM32MP157C-EV1.png | 65px | link=]] |
|- |
|- |
||
− | | colspan="4" style="text-align:left; |
+ | | colspan="4" style="border-style: hidden; text-align:left;" | [[Getting started/STM32MP1 boards/STM32MP157x-EV1/Develop on Arm® Cortex®-A7 | {{GSModuleCurrent|Develop on Arm® Cortex®-A7}}]] |
− | | colspan="3" style="text-align:right; |
+ | | colspan="3" style="border-style: hidden; text-align:right;" | [[Getting started/STM32MP1 boards/STM32MP157x-EV1/Develop on Arm® Cortex®-M4 | {{GSModuleNext|Develop on Arm® Cortex®-M4}}]] |
|- |
|- |
||
− | | style="border- |
+ | | style="border-style: hidden;" | [[Image:step_category_in.png|link=]] |
− | | style=" |
+ | | style="border-style: hidden; width:150px;" | [[Getting started/STM32MP1 boards/STM32MP157x-EV1/Develop on Arm® Cortex®-A7/Install the SDK | {{GSStepNext|Install the SDK}}]] |
− | | style="border- |
+ | | style="border-style: hidden;" | [[Image:step.png|link=]] |
− | | style=" |
+ | | style="border-style: hidden; width:150px;" | [[Getting started/STM32MP1 boards/STM32MP157x-EV1/Develop on Arm® Cortex®-A7/Create a simple hello-world application | {{GSStepNext|Create a simple hello-world application}}]] |
− | | style="border- |
+ | | style="border-style: hidden;" | [[Image:step.png|link=]] |
− | | style=" |
+ | | style="border-style: hidden; width:150px;" | [[Getting started/STM32MP1 boards/STM32MP157x-EV1/Develop on Arm® Cortex®-A7/Modify, rebuild and reload the Linux® kernel | {{GSStepCurrent|Modify, rebuild and reload the Linux® kernel}}]] |
− | | style="border- |
+ | | style="border-style: hidden;" | [[Image:step_category_out.png|link=]] |
|} |
|} |
||
<br> |
<br> |
||
Line 19: | Line 19: | ||
<br> |
<br> |
||
− | {| class=" |
+ | {| class="st-table" style="margin: auto" |
− | | style="border- |
+ | | style="border-style: hidden; width:120px; text-align:left" | [[Image:back_button.png|link=Getting started/STM32MP1 boards/STM32MP157x-EV1/Develop on Arm® Cortex®-A7/Create a simple hello-world application]] |
− | | style="border- |
+ | | style="border-style: hidden; width:360px; text-align:center" | [[Image:overview_button.png|link=Getting started/STM32MP1 boards/STM32MP157x-EV1]] |
− | | style="border- |
+ | | style="border-style: hidden; width:120px; text-align:right" | [[Image:next_button.png|link=Getting started/STM32MP1 boards/STM32MP157x-EV1/Develop on Arm® Cortex®-M4]] |
|} |
|} |
||