• Cheatsheet - Linux, Yocto & Git
    • FitImage
      • GPIO handling at i.MX8M Mini
        • PHYTEC VM
          • RAM Configuration at PHYTEC i.MX8M Mini
            • Setup qbee Device Management on phyBOARD-Polis
              • Start video at boottime
                • Using phyLinux to build a yocto BSP with a build-container
                  • Using thingsboard.io to connect phyBOARD-Polis to the Cloud

                    Start video at boottime

                    07 21, 2026 09:05

                    You can implement autostart scripts and services for example to start a video automatically at boot.

                    Example - Autostart video

                    Hardware: phyBOARD Pollux i.MX8MP

                    Additional Hardware used: 10" LVDS Display

                    BSP: BSP-Yocto-NXP-i.MX8MP-PD26.1.0

                    Yocto: 5.2.4 (Walnascar) 

                    Kernel: Linux NXP Vendor Kernel v6.12.49-2.2.0-phy11

                    Bootloader: U-boot v2025.04-2.2.0-phy9

                    Image: phytec-qt6demo-image

                    Buildsystem: Ubuntu 24.04 64-bit


                    For PD26.1.0 with the phytec-qt6demo-image (Wayland/Qt6, Weston active), you can use the NXP GStreamer sample pipelines directly with waylandsink and configure them for automatic startup via systemd,.

                    In the BSP release PD26.1.0 for the i.MX8MP, a Wayland-based Qt6 demo image is provided. It includes Weston, GStreamer 1.0 and i.MX‑accelerated plugins (vpudec, imxvideoconvertg2d, waylandsink).

                    The i.MX 8 GStreamer User Guide describes pipelines that match this image exactly, enabling hardware-accelerated decoding through the Hantro VPU on the i.MX8MP.

                    Test the pipeline

                    Depending on which display is connected to the Pollux, the weston.ini needs to be adjusted so that the output is displayed in the correct location. With the QTimage, if everything is configured correctly, the QTdemo should load after bootup. If the screen stays black, or only shows a white bar in the top left corner, further adjustments need to be made in the weston.ini. If Display connected to PEB-AV-010, change weston.ini:

                    target:~$ vi /etc/xdg/weston/weston.ini
                    ...
                    [output]
                    name=HDMI-A-1
                    mode=preffered		# Change to off
                    
                    [output]
                    name=LVDS-1
                    mode=off			# Change to current

                    If you boot now, the qtdemo should appear at the lvds-display connected to PEB-AV-10.

                    target:~$ systemctl stop qtphy			# stop qtphy demo

                    On your board (PD26.1.0, phytec‑qt6demo‑image), first test manually:

                    target:~$ gst-launch-1.0 -v filesrc location=/usr/share/qtphy/videos/caminandes_3_llamigos_720p_vp9.webm ! decodebin name=d ! videoconvert ! waylandsink

                    The elements filesrcqtdemuxh264parsevpudecand waylandsink are described in the plugin reference.

                    • vpudec is an i.MX‑proprietary plugin for hardware video decoding 
                    • waylandsink is the Wayland video sink

                    This structure corresponds to the i.MX 8M decode examples (H.264/H.265/VP8) documented by NXP.

                    Autostart

                    Bash script

                    Create a bash script that executes the pipeline.

                    start-video-loop.sh
                    #!/bin/sh
                    
                    VIDEO_FILE="/usr/share/qtphy/videos/caminandes_3_llamigos_720p_vp9.webm"
                    LOG_FILE="/var/log/video-autostart.log"
                    while true; do
                            gst-launch-1.0 -v \
                                    filesrc location="$VIDEO_FILE" ! \
                                    decodebin name=d ! videoconvert ! \
                                    waylandsink
                            sleep 1
                    done

                    Save the script and change the permission to make it executable.

                    change permission
                    target:~$ cp start-video-loop.sh /usr/bin/. 
                    target:~$ chmod +x /usr/bin/start-video-loop.sh

                    Systemd

                    Systemd man

                    Create a video-autostart.service file under /usr/lib/systemd/system/:

                    autovideo.service
                    [Unit]
                    Description=Autostart video loop on phyCORE-i.MX8MP (PD26.1.0 qt6demo)
                    Requires=graphical.target
                    After=graphical.target
                    
                    [Service]
                    Environment=QT_QPA_PLATFORM=wayland WAYLAND_DISPLAY=/run/wayland-0 QT_SCALE_FACTOR=2
                    ExecStart=/usr/bin/start-video-loop.sh
                    Restart=always
                    RestartSec=3
                    # Select default pulseaudio sink
                    
                    [Install]
                    WantedBy=graphical.target

                    The service will start right after grafical.target is loaded. You can schedule the service as you wish. Be aware of some dependencies.


                    All that remains to be done is to activate the systemd-service to run it at system startup.

                    enable bash-script service
                    target:~$ systemctl daemon-reload 
                    target:~$ systemctl enable video-autostart.service 
                    target:~$ systemctl start video-autostart.service

                    At the next boot, Weston and qtdemo starts automatically (as provided by the image), followed by your service, which starts the video loop.

                    Yocto integration

                    For PD26.1.0 with the phytec‑qt6demo‑image, the cleanest way to integrate the script and systemd service is through a dedicated custom meta‑layer with a small recipe that follows PHYTEC’s Yocto guidelines.

                    Integration into the PHYTEC BSP

                    The BSP release BSP‑Yocto‑NXP‑i.MX8MP‑PD26.1.0 is built with phyLinux/Yocto.
                    Custom extensions such as additional services should be implemented in a separate meta‑layer or as a bbappend, not directly within meta‑phytec.

                    Since the phytec‑qt6demo‑image already uses systemd as the init system, systemd units can be integrated into a recipe cleanly by using inherit systemd and SYSTEMD_SERVICE_${PN}.

                     Create a Custom Layer

                    One‑time Setup

                    In your existing PD26.1.0 workspace, for example:

                    host:~$ cd ~/yocto/pd26.1.0-imx8mp  						# example path
                    host:~$ source sources/poky/oe-init-build-env build		# reload build environment (only needed at new terminal)
                    host:~$ bitbake-layers create-layer ../meta-myproject 	# create your meta-layer
                    host:~$ bitbake-layers add-layer ../meta-myproject		# add you newly created meta-layer to the build
                    host:~$ mkdir -p ../meta-myproject/recipes-demo/video-autostart/files \	# create a filestructure at your meta-layer

                    We recommend placing all customer-specific extensions in a custom meta-layer.

                    Copy Script and Service into the meta-layer

                    Copy the above created script and service into the layer.

                    Place:

                    • copy or create start-video-loop.sh into meta-myproject/recipes-demo/video-autostart/files/

                    • copy or create video-autostart.service into the same directory

                    Create a Yocto recipe

                    Create a file meta-myproject/recipes-demo/video-autostart/video-autostart_1.0.bb

                    SUMMARY = "Autostart video demo on phyCORE-i.MX8MP"
                    LICENSE = "CLOSED"
                    
                    SRC_URI = " \
                    	file://start-video-loop.sh \					# Shell script located at files/
                    	file://video-autostart.service \				# systemd unit located at files/
                    "
                    
                    S = "${WORKDIR}"									# Working directory for this recipe
                    
                    inherit systemd										# Enable systemd integration (SYSTEMD_* variables)
                    
                    SYSTEMD_PACKEAGES = "${PN}"							# Main package contains the unit
                    SYSTEMD_SERVICE:${PN} = "video-autostart.service"	# Call your service
                    SYSTEMD_AUTO_ENABLE = "enable"						# Enable the unit automatically at install time
                    
                    do_install() {
                    	install -d ${D}${bindir}						
                    	install -m 0755 ${WORKDIR}/start-video-loop.sh \
                    		${D}${bindir}/start-video-loop.sh			# Copy script to /usr/bin
                    
                    	install -d ${D}${systemd_system_unitdir}		
                    	install -m 0644 ${WORKDIR}/video-autostart.service \
                    		${D}/video-autostart.service
                    }
                    
                    FILES:${PN} += " \
                    	${bindir}/start-video-loop.sh \					# Include the script in the package
                    	${systemd_system_unitdir}/video-autostart.service \		# Include the systemd unit into the package
                    "

                    Add the package to your phytec-qt6demo-image

                    You can either add the following line to the yocto/../build/conf/local.conf or in an image bbappend:

                    IMAGE_INSTALL:append = "video-autostart"	# Include the video-autostart package in the root filesystem

                    Build your image

                    host:~$ source sources/poky/oe-init-build-env build   # (If using a new terminal) reinitialize build environment
                    host:~$ bitbake phytec-qt6demo-image					# Build the qt6demo image with the video-autostart recipe

                    The resulting image contains the script, the systemd service, and all GStreamer plugins as described in the PD26.1.0 BSP manual.

                    Notes and Limitations

                    • The shown pipeline is optimized for MP4/H.264. For other containers/codecs, refer to the i.MX 8 GStreamer User Guide (H.265, VP8, MPEG‑2/4) and adjust demuxer/parser elements accordingly.

                    • For headless or DRM/framebuffer setups, replace waylandsink with kmssink or fbdevsink and disable Weston, as described in the plug‑in reference for those sinks.