Two methods exist by which you can create the patch: Git workflow and Quilt workflow. For kernel patches, the Git workflow is more appropriate. This section assumes the Git workflow and shows the steps specific to this example.
Change the working directory:
Change to where the kernel source code is before making
your edits to the calibrate.c
file:
$ cd ~/poky/build/tmp/work/qemux86-poky-linux/linux-yocto-${PV}-${PR}/linux
Because you are working in an established Git repository, you must be in this directory in order to commit your changes and create the patch file.
Edit the source file:
Edit the init/calibrate.c
file to have the
following changes:
void __cpuinit calibrate_delay(void) { unsigned long lpj; static bool printed; int this_cpu = smp_processor_id(); printk("*************************************\n"); printk("* *\n"); printk("* HELLO YOCTO KERNEL *\n"); printk("* *\n"); printk("*************************************\n"); if (per_cpu(cpu_loops_per_jiffy, this_cpu)) { . . .
Stage and commit your changes: These Git commands display the modified file, stage it, and then commit the file:
$ git status $ git add init/calibrate.c $ git commit -m "calibrate: Add printk example"
Generate the patch file:
This Git command creates the a patch file named
0001-calibrate-Add-printk-example.patch
in the current directory.
$ git format-patch -1