In this tutorial we will use git to create a new patch for the package “u-boot”. The patch modifies the default environment of U-Boot, which results in the rootfilesystem of TQMa6x BSP Rev.0105 being mounted in read/write mode by default.

Please check that git is installed on your development host.
Keep in mind that any package you want to patch using this approach must be build with ptxdist --git

The first step is to change into the package's build directory.

embedded@ubuntu:~$ cd workspace/TQMa6x-BSP-REV.0105/platform-MBa6x/build-target/u-boot-2013.04

All further commands will be executed from within this directory.

To verify that the package was actually built with the --git option execute

embedded@ubuntu:~/workspace/TQMa6x-BSP-REV.0105/platform-MBa6x/build-target/u-boot-2013.04$ git status
On branch master
nothing to commit, working directory clean

You should see an output similar to that above (telling no changes have been made to the package (resp. git repo) yet).

The next step is to edit the appropriate file with the text editor of your choice.
In this tutorial we edit the file include/configs/TQMa6x.h using the nano text editor.

embedded@ubuntu:~/workspace/TQMa6x-BSP-REV.0105/platform-MBa6x/build-target/u-boot-2013.04$ nano include/configs/TQMa6x.h

For this tutorial we need to change line 452 as follows from




Save the file and exit the text editor.

Now let's verify that git has “taken notice” of our modification. We can do that by simply executing git status.

embedded@ubuntu:~/workspace/TQMa6x-BSP-REV.0105/platform-MBa6x/build-target/u-boot-2013.04$ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   include/configs/TQMa6x.h

no changes added to commit (use "git add" and/or "git commit -a")

To view the details of all modifications that have been made, we can use git diff.

embedded@ubuntu:~/workspace/TQMa6x-BSP-REV.0105/platform-MBa6x/build-target/u-boot-2013.04$ git diff
diff --git a/include/configs/TQMa6x.h b/include/configs/TQMa6x.h
index 4f24d6c008da..5521a40d3a2f 100644
--- a/include/configs/TQMa6x.h
+++ b/include/configs/TQMa6x.h
@@ -449,7 +449,7 @@ extern int tqma6x_get_mmc_env_dev(void);
        "addfb=setenv bootargs ${bootargs} "                                   \
                "${fbdrv}.legacyfb_depth=${fbdepth} consoleblank=0\0"          \
        "addcma=setenv bootargs ${bootargs} cma=${cma_size}\0"                 \
-       "rootfsmode=ro\0"                                                      \
+       "rootfsmode=rw\0"                                                      \
        "mmcpart=2\0"                                                          \
        "mmcargs=run addmmc addtty addfb addcma\0"                             \
        "addmmc=setenv bootargs ${bootargs} "                                  \

All changes we have made to the package's git repo are now displayed as a diff. This diff is suitable to be added to package's patch series.

To do that we need to redirect the output of git diff to a new file in the patches/ subdirectory (which actually is a symlink to the package's patch series provided by the BSP, cf. ls -la .ptxdist).

The patches/ subdirectory contains two different kinds of files:

  • a file called series, which describes the whole patch series for the package

(i.e. all the patches that should be applied)

  • several .patch files, the actual patches
embedded@ubuntu:~/workspace/TQMa6x-BSP-REV.0105/platform-MBa6x/build-target/u-boot-2013.04$ ll patches/
total 976
drwxrwxr-x 2 tq tq  12288 Jan  9  2015 ./
drwxrwxr-x 8 tq tq   4096 Jan  9  2015 ../
-rw-rw-r-- 1 tq tq   2334 Jan  9  2015 0001-arm-imx-Change-iomux-functions-to-void-type.patch
-rw-rw-r-- 1 tq tq   4724 Jan  9  2015 0002-iomux-v3-Place-pad-control-definitions-into-common-f.patch
-rw-rw-r-- 1 tq tq   3998 Jan  9  2015 0003-imx-iomux-v3-Fix-common-pad-control-definitions.patch
-rw-rw-r-- 1 tq tq  11608 Jan  9  2015 0134-TQMa6x-add-Support-for-TQMa6DL.patch
-rw-rw-r-- 1 tq tq   1445 Jan  9  2015 0135-tqma6x-make-fbdev-name-configurable.patch
-rw-rw-r-- 1 tq tq    644 Jan  9  2015 0136-prepare-release-to-BSP.patch
-rw-rw-r-- 1 tq tq   6726 Jan  9  2015 series
embedded@ubuntu:~/workspace/TQMa6x-BSP-REV.0105/platform-MBa6x/build-target/u-boot-2013.04$ tail -n 3 patches/series 

It's recommended that the filename of the new patch follows the naming convention of the patch series, so in this tutorial we will store the diff in a file called patches/0137-mount-rootfs-rw-by-default.patch:

embedded@ubuntu:~/workspace/TQMa6x-BSP-REV.0105/platform-MBa6x/build-target/u-boot-2013.04$ git diff > patches/0137-mount-rootfs-rw-by-default.patch

Finally we need to add the new patch to the series file:

embedded@ubuntu:~/workspace/TQMa6x-BSP-REV.0105/platform-MBa6x/build-target/u-boot-2013.04$ echo 0137-mount-rootfs-rw-by-default.patch >> patches/series
embedded@ubuntu:~/workspace/TQMa6x-BSP-REV.0105/platform-MBa6x/build-target/u-boot-2013.04$ tail -n 3 patches/series 

Now the patch has been permanently added to the BSP, i.e. it will be applied each time the package “u-boot” is (re-)build.