cancel
Showing results for 
Search instead for 
Did you mean: 

Issues Upgrading to Latest Linux Kernel on STM32MP157F-DK2 using debian rootfs

abraxas4
Associate II

Hello,

I have been running Ubuntu on the STM32MP157F-DK2, guided by the following resources:

https://prog.world/stm32mp1-running-ubuntu-22-04gpu-and-wayland-graphics-server/

https://github.com/cvetaevvitaliy/stm32mp1-ubuntu

 

Previously, I successfully used the following configurations:

  • U-Boot: v2020.10-stm32mp-r2.2
  • TF-A: v2.8-stm32mp-r1.1
  • Linux Kernel: v2020.10-stm32mp-r2.2
  • Ubuntu RootFS: ubuntu-22.04-base-stm32mp1-armhf-16-05-2022.tar.gz


However, I am encountering issues with the latest setup:

  • U-Boot: v2022.10-stm32mp-r1
  • TF-A: v2.8-stm32mp-r1.1
  • Linux Kernel: v6.1-stm32mp-r1
  • Ubuntu RootFS: ubuntu-22.04-base-stm32mp1-armhf-16-05-2022.tar.gz

The main change I made was replacing stm32mp15_trusted_defconfig with stm32mp15_defconfig when building U-Boot.

Could anyone provide any insights or suggestions to troubleshoot this issue?

Thank you!

 

1 ACCEPTED SOLUTION

Accepted Solutions
abraxas4
Associate II

 

This may not be the final solution, but it could serve as a reference for others.
 
Start by following this build guide:
 
If you use only the commands from the page, here’s the process:

 

 

repo init -u https://github.com/STMicroelectronics/oe-manifest.git -b refs/tags/openstlinux-6.1-yocto-mickledore-mp1-v23.06.21
 
repo sync
 
DISTRO=openstlinux-weston MACHINE=stm32mp15-disco source layers/meta-st/scripts/envsetup.sh
 
bitbake st-image-weston

 

 

 
After completing these steps, you can replace the root filesystem (rootfs).
 
I downloaded "debian-12.1-minimal-armhf-2023-08-22.tar.xz" from 
 

 

 

 

#extract debian rootfs.
mkdir rootfs_extracted
sudo tar -xvf debian-12.1-minimal-armhf-2023-08-22.tar.xz -C rootfs_extracted/
#cd ....
mkdir extracted_rootfs
sudo tar -xvf armhf-rootfs-debian-bookworm.tar -C extracted_rootfs/

 

 

before proceeding, FYI,

The "FlashLayout_sdcard_stm32mp157f-dk2-optee.tsv" file references st-image-weston-openstlinux-weston-stm32mp15-disco.ext4.
(ex)
lrwxrwxrwx 1 abraxas4 abraxas4 77 May 2 16:53 st-image-weston-openstlinux-weston-stm32mp15-disco.ext4 -> st-image-weston-openstlinux-weston-stm32mp15-disco-20240511074134.rootfs.ext4
 
This ext4 file is a symbolic link pointing to another file.
You should rename your ext4 file to match the name of the target file indicated by this link.

extract st linux's rootfs.
ex)
cd ..../build-openstlinuxweston-stm32mp15-disco/tmp-glibc/deploy/images
sudo mount -o loop ./st-image-weston-openstlinux-weston-stm32mp15-disco-20240511074134.rootfs.ext4 ./st_linux_rootfs/

copy st linux's (sudo cp -r)
..../st_linux_rootfs/lib/modules 
and
..../st_linux_rootfs/lib/firmware
to extracted debian's folders accordingly.
..../extracted_rootfs/lib/modules
and
..../extracted_rootfs/lib/firmware
 
Convert your debian rootfs to an ext4 format.

 

 

dd if=/dev/zero of=debian-rootfs.img bs=1M count=4096
mkfs.ext4 -F debian-rootfs.img
mkdir mnt
sudo mount -o loop debian-rootfs.img mnt/
sudo cp -a extracted_rootfs/. mnt/
sudo umount mnt​

 

 


and rename "debian-rootfs.img " to match the name of the file specified in the script.
(this is simpler than modifying the script).

 

in my case, I deleted st-image-weston-openstlinux-weston-stm32mp15-disco-20240511074134.rootfs.ext4 and replaced it with the newly created image.
 
Set the partition sizes as needed:
..../build-openstlinuxweston-stm32mp15-disco/tmp-glibc/deploy/images/stm32mp15-disco/scripts/create_sdcard_from_flashlayout.sh

 

 

...
# Size of 8GB
DEFAULT_RAW_SIZE=${SDCARD_SIZE:-8192}

# size of 4GB
DEFAULT_ROOTFS_PARTITION_SIZE=4194304
...

 

 


(you can adjust the size)

Modify this file too if needed:
.../build-openstlinuxweston-stm32mp15-disco/tmp-glibc/deploy/images/stm32mp15-disco/flashlayout_st-image-weston/optee/FlashLayout_sdcard_stm32mp157f-dk2-optee.tsv
 
Increase the offset value of `0x13` if your rootfs is large.
 
 
Run the following to create the final image (*.raw) and use tools like Rufus or Pi Imager to burn the image to your SD card:

.../build-openstlinuxweston-stm32mp15-disco/tmp-glibc/deploy/images/stm32mp15-disco/scripts/
create_sdcard_from_flashlayout.sh ../flashlayout_st-image-weston/optee/FlashLayout_sdcard_stm32mp157f-dk2-optee.tsv
 
Ethernet, WiFi, and RPMSG are all working in my case.

you can stretch rootfs '/' to the end

 

 

 

sudo parted /dev/mmcblk0
(parted) rm 11
(parted) resizepart 10 95%
(parted) mkpart primary ext4 95% 100%
(parted) quit
sudo resize2fs /dev/mmcblk0p10
sudo mkfs.ext4 /dev/mmcblk0p11

 

 

 

I installed wayland for the GUI.
sudo apt-get update
sudo apt-get install weston
hit weston in the prompt then GUI will show up.

I also succeeded in launching xfce + lightdm combination for GUI.
There was a hiccup that there was no /dev/fb0.
So I had to follow the below.

 

 

sudo nano /etc/X11/xorg.conf.d/10-drm.conf
#insert the below and save and exit.

Section "Device"
	Identifier "DRM Device"
	Driver "modesetting"
	Option "kmsdev" "/dev/dri/card0"
	Option "SWCursor" "true"
EndSection

Section "Screen"
	Identifier "Screen0"
	Device "DRM Device"
	Monitor "Monitor0"
EndSection

Section "Monitor"
	Identifier "Monitor0"
EndSection

Section "ServerLayout"
	Identifier "DefaultLayout"
	Screen "Screen0"
EndSection

//execute the rest.
sudo apt-get update
sudo apt-get install dbus-x11
which dbus-launch # for checking
startx​

 

 

 
If you have any information or suggestions, please let me know.
moonjune.kim@gmail.com

View solution in original post

3 REPLIES 3
Olivier GALLIEN
ST Employee

Hi @abraxas4 ,

 

Could you please confirm clarified information given : 

 

Previously, I successfully used the following configurations:

  • U-Boot: v2020.10-stm32mp-r2.2 -> match ecosystem V3.1.3 ( kernel 5.10 ) 
  • TF-A: v2.8-stm32mp-r1.1 -> match ecosystem V5.0.x ( kernel 6.1) 
  • Linux Kernel: v2020.10-stm32mp-r2.2 -> is not a valid kernel version 
  • Ubuntu RootFS: ubuntu-22.04-base-stm32mp1-armhf-16-05-2022.tar.gz


However, I am encountering issues with the latest setup:

  • U-Boot: v2022.10-stm32mp-r1 
  • TF-A: v2.8-stm32mp-r1.1
  • Linux Kernel: v6.1-stm32mp-r1
  • Ubuntu RootFS: ubuntu-22.04-base-stm32mp1-armhf-16-05-2022.tar.gz

> above version looks consistent with a ecosystem V5.0.x ... but miss the OPTEE version which is now mandatory since stm32mp15_trusted_defconfig (sp_min) is no longer supported in this version. 

 

If this does not allow you to identify the problem, then please share further information about the issue you are facing ( logs ) 

 

Thanks

 

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.
abraxas4
Associate II

 

This may not be the final solution, but it could serve as a reference for others.
 
Start by following this build guide:
 
If you use only the commands from the page, here’s the process:

 

 

repo init -u https://github.com/STMicroelectronics/oe-manifest.git -b refs/tags/openstlinux-6.1-yocto-mickledore-mp1-v23.06.21
 
repo sync
 
DISTRO=openstlinux-weston MACHINE=stm32mp15-disco source layers/meta-st/scripts/envsetup.sh
 
bitbake st-image-weston

 

 

 
After completing these steps, you can replace the root filesystem (rootfs).
 
I downloaded "debian-12.1-minimal-armhf-2023-08-22.tar.xz" from 
 

 

 

 

#extract debian rootfs.
mkdir rootfs_extracted
sudo tar -xvf debian-12.1-minimal-armhf-2023-08-22.tar.xz -C rootfs_extracted/
#cd ....
mkdir extracted_rootfs
sudo tar -xvf armhf-rootfs-debian-bookworm.tar -C extracted_rootfs/

 

 

before proceeding, FYI,

The "FlashLayout_sdcard_stm32mp157f-dk2-optee.tsv" file references st-image-weston-openstlinux-weston-stm32mp15-disco.ext4.
(ex)
lrwxrwxrwx 1 abraxas4 abraxas4 77 May 2 16:53 st-image-weston-openstlinux-weston-stm32mp15-disco.ext4 -> st-image-weston-openstlinux-weston-stm32mp15-disco-20240511074134.rootfs.ext4
 
This ext4 file is a symbolic link pointing to another file.
You should rename your ext4 file to match the name of the target file indicated by this link.

extract st linux's rootfs.
ex)
cd ..../build-openstlinuxweston-stm32mp15-disco/tmp-glibc/deploy/images
sudo mount -o loop ./st-image-weston-openstlinux-weston-stm32mp15-disco-20240511074134.rootfs.ext4 ./st_linux_rootfs/

copy st linux's (sudo cp -r)
..../st_linux_rootfs/lib/modules 
and
..../st_linux_rootfs/lib/firmware
to extracted debian's folders accordingly.
..../extracted_rootfs/lib/modules
and
..../extracted_rootfs/lib/firmware
 
Convert your debian rootfs to an ext4 format.

 

 

dd if=/dev/zero of=debian-rootfs.img bs=1M count=4096
mkfs.ext4 -F debian-rootfs.img
mkdir mnt
sudo mount -o loop debian-rootfs.img mnt/
sudo cp -a extracted_rootfs/. mnt/
sudo umount mnt​

 

 


and rename "debian-rootfs.img " to match the name of the file specified in the script.
(this is simpler than modifying the script).

 

in my case, I deleted st-image-weston-openstlinux-weston-stm32mp15-disco-20240511074134.rootfs.ext4 and replaced it with the newly created image.
 
Set the partition sizes as needed:
..../build-openstlinuxweston-stm32mp15-disco/tmp-glibc/deploy/images/stm32mp15-disco/scripts/create_sdcard_from_flashlayout.sh

 

 

...
# Size of 8GB
DEFAULT_RAW_SIZE=${SDCARD_SIZE:-8192}

# size of 4GB
DEFAULT_ROOTFS_PARTITION_SIZE=4194304
...

 

 


(you can adjust the size)

Modify this file too if needed:
.../build-openstlinuxweston-stm32mp15-disco/tmp-glibc/deploy/images/stm32mp15-disco/flashlayout_st-image-weston/optee/FlashLayout_sdcard_stm32mp157f-dk2-optee.tsv
 
Increase the offset value of `0x13` if your rootfs is large.
 
 
Run the following to create the final image (*.raw) and use tools like Rufus or Pi Imager to burn the image to your SD card:

.../build-openstlinuxweston-stm32mp15-disco/tmp-glibc/deploy/images/stm32mp15-disco/scripts/
create_sdcard_from_flashlayout.sh ../flashlayout_st-image-weston/optee/FlashLayout_sdcard_stm32mp157f-dk2-optee.tsv
 
Ethernet, WiFi, and RPMSG are all working in my case.

you can stretch rootfs '/' to the end

 

 

 

sudo parted /dev/mmcblk0
(parted) rm 11
(parted) resizepart 10 95%
(parted) mkpart primary ext4 95% 100%
(parted) quit
sudo resize2fs /dev/mmcblk0p10
sudo mkfs.ext4 /dev/mmcblk0p11

 

 

 

I installed wayland for the GUI.
sudo apt-get update
sudo apt-get install weston
hit weston in the prompt then GUI will show up.

I also succeeded in launching xfce + lightdm combination for GUI.
There was a hiccup that there was no /dev/fb0.
So I had to follow the below.

 

 

sudo nano /etc/X11/xorg.conf.d/10-drm.conf
#insert the below and save and exit.

Section "Device"
	Identifier "DRM Device"
	Driver "modesetting"
	Option "kmsdev" "/dev/dri/card0"
	Option "SWCursor" "true"
EndSection

Section "Screen"
	Identifier "Screen0"
	Device "DRM Device"
	Monitor "Monitor0"
EndSection

Section "Monitor"
	Identifier "Monitor0"
EndSection

Section "ServerLayout"
	Identifier "DefaultLayout"
	Screen "Screen0"
EndSection

//execute the rest.
sudo apt-get update
sudo apt-get install dbus-x11
which dbus-launch # for checking
startx​

 

 

 
If you have any information or suggestions, please let me know.
moonjune.kim@gmail.com

Hello Olivier,

Thank you for seeking clarification.

Indeed, I've acknowledged the mandatory OPTEE issue and am therefore moving away from my previous combination towards the latest Linux kernel version 6.

However, I have a preference for the Debian environment due to its user-friendliness, so I am attempting to replace the root filesystem.

Regarding your question: I successfully updated to the latest TF-A as a try, which was compatible with the Linux kernel version v5.10. Unfortunately, it does not support kernel versions v5.15 or later,  as you noted regarding SP_MIN.

 

Thank you,