splash-screenyocto

Add custom splash screen image in Yocto (the best way)


I successfully changed the splash screen image on my embedded system, Toradex iMX6. I changed the kernel defconfig found in the sub-directory to the kernel *.bb file and added my image (logo_custom_clut224.ppm) to my pre-build kernel directory ./tmp-glibc/work-shared/colibri-imx6/kernel-source/drivers/video/logo/ and then re-compiled the kernel.

Is it possible to do this nicer? I would really like to change the step where I manually copy my image to the pre-build directory. Can I somehow change the *.bb file to include my image and use it as my custom splash image?

Or is it possible to do my own recipe that changes the defconfig file and includes my image in any way before the kernel is build?


Solution

  • I never got the Splash functionality to work. But I found a solution to change the static startup logo for both u-boot and kernel.

    Create boot images

    I created a script that converted a jpg image to the two different images that is needed for u-boot and kernel.

    #!/bin/bash
    IMAGE_JPG_INPUT=<YOUR_IMAGE_NAME>.jpg
    IMAGE_UBOOT=toradex.bmp
    IMAGE_KERNEL=logo_custom_clut224.ppm
    echo "Converting $IMAGE_JPG_INPUT" 
    jpegtopnm $IMAGE_JPG_INPUT | ppmquant 224 > tmp.ppm
    pnmnoraw tmp.ppm > $IMAGE_KERNEL
    echo ">> Kernel image created: $IMAGE_KERNEL" 
    ppmtobmp -bpp 8 tmp.ppm > $IMAGE_UBOOT
    echo ">> U-boot image created: $IMAGE_UBOOT" 
    rm tmp.ppm
    

    U-boot logo

    The solution is to replace the default boot image (toradex.bmp in my case) in u-boot/tools/logos. I created a bbappend file, u-boot-toradex_2016.11.bbappend, in <MY_CUSTOM_LAYER>/recipes-bsp/u-boot/u-boot-toradex/.

    FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
    
    SRC_URI += "file://toradex.bmp"
    
    do_unpack_append() {
        os.system("cp ${PWD}/toradex.bmp ${PWD}/git/tools/logos/")
    }
    

    The copy operation needs to be done in this function, because when you reach do_patch_prepend() the location of additional files is different if you run bitbake directly or working with devtool (then files are moved to sources/u-boot-toradex/oe-local-files/).

    According to the recipe I added the boot image to <MY_CUSTOM_LAYER>/recipes-bsp/u-boot/u-boot-toradex/u-boot-toradex

    Kernel logo

    For the kernel logo the solution is similar. I created a bbappend file, linux-toradex_4.1-2.0.x.bbappend, in <MY_CUSTOM_LAYER>/recipes-kernel/linux

    FILESEXTRAPATHS_prepend := "${THISDIR}/linux-toradex-4.1-2.0.x:"
    
    SRC_URI += "file://logo_custom_clut224.ppm \
                file://enable-custom-logo \
                "
    
    do_unpack_append() {
        os.system("cp ${PWD}/logo_custom_clut224.ppm ${PWD}/git/drivers/video/logo/")
        os.system("patch -s < enable-custom-logo")
    }
    

    Boot image is added to <MY_CUSTOM_LAYER>/recipes-kernel/linux/linux-toradex-4.1-2.0.x. I also added a patch to enable custom logo to the kernel config file and also disabled the other logo image options. In my case there was a default defconfig file from the original recipe in the $PWD directory that I had to patch.

    CONFIG_LOGO=y
    +# CONFIG_LOGO_LINUX_MONO is not set
    +# CONFIG_LOGO_LINUX_VGA16 is not set
    +# CONFIG_LOGO_LINUX_CLUT224 is not set
    +CONFIG_LOGO_CUSTOM_CLUT224=y
    

    U-boot and kernel was then updated on the target.