[Buildroot] Issue Applying Patches to Package

Edgar Bonet bonet at grenoble.cnrs.fr
Wed Oct 1 19:47:43 UTC 2025


On 2025-10-01, Dylan wrote:
> Appending "a/" and "b/" to the headers in the patch files did the
> trick! I'm curious to know why my patch files did not include this.
> Checking my notes, I ran the diff command like:
>
>     diff -u "old_file" "new_file" > file.patch
>
> where "old_file" and "new_file" were in the same directory together. I
> ran the diff command from the same directory as these files, too. 

When creating patches with good old ‘diff’, it is customary to run it
across two full trees. For example, assuming you have the pristine
sources in a directory named “psplash”, you would do:

    cp -a psplash psplash.orig  # make a backup of the full tree
    cd psplash
    $EDITOR psplash-config.h    # hack, hack...
    $EDITOR psplash-colors.h    # hack, hack...
    cd ..
    diff -ruN psplash{.orig,} > customization.patch

The patch file would then start with:

    --- psplash.orig/psplash-colors.h	2025-10-01 ...
    +++ psplash/psplash-colors.h	2025-10-01 ...

It doesn't matter what you have in front of the ‘/’, as long as there is
a single ‘/’ before the file name.

If you want separate patches, you may do:

    diff -u psplash{.orig,}/psplash-config.h > 0001-psplash-config.patch
    diff -u psplash{.orig,}/psplash-colors.h > 0002-psplash-colors.patch

That being said, given that psplash is retrieved via git, it would make
more sense to use a git workflow:

    # Taken from buildroot/package/psplash/psplash.mk:
    PSPLASH_VERSION=53ae74a36bf17675228552abb927d2f981940a6a
    PSPLASH_SITE=https://git.yoctoproject.org/psplash

    # Retrieve a clone of the psplash repo, and work there.
    git clone $PSPLASH_SITE
    cd psplash

    # Create a branch off $PSPLASH_VERSION for our customizations.
    git switch -c customization $PSPLASH_VERSION

    # Commit a couple of changes.
    $EDITOR psplash-config.h    # hack, hack...
    git commit -a -m 'Default to full screen mode'
    $EDITOR psplash-colors.h    # hack, hack...
    git commit -a -m 'Set a black and white color theme'

    # Create one patch file for each of the last two commits.
    git format-patch -2

Regards,

Edgar.


More information about the buildroot mailing list