Rockbox Development > Starting Development and Compiling
Repairing failed HUNKs
eK3eKyToPa:
Every patch I'm trying to put on my build have several hunks failed.
I get the latest patches from the tracker but still they failed some of the HUNKs
When I'm trying to -R the patch it again get failed.
And in the end if even one HUNK has failed I can't do the 'make' command and it failed too
When a HUNK failed I read the .rej fail but I cant understand anything in it, I'm not programer , how to repair the patch so that to work.
Please give some advice, so to get my build working.
Thanks eK3eKyToPa
GodEater:
The only way to fix them is to become a programmer, so that you can understand what they're doing, and what about the patch has caused it to fail. There simply isn't another way to do it.
eK3eKyToPa:
Does the patches uploaded in the tracker are able to use in the build of the same day ?
AlexP:
It depends on what version of the source code the patch was made against, but generally people will upload a patch straight after synching it to current source. Of course as the source code is changed many times per day, it might be that an incompatible change is made 5 minutes after a patch is synched.
If a patch fails to apply you can either fix it yourself, wait for someone else to resync it, or use a version of the source from when the patch was current. However the more patches you use the greater the likelyhood of some being out of sync or one breaking another. Also bear in mind that some patches are written to depend on other patches.
TheMono:
Disclaimer: Following instructions in this post may well result in breaking the source even worse than before.
Having said that,
The patch files are basically instructions to change parts of the source. If you read down the left hand side, you will notice most lines begin with a " ", a "+", or a "-". For example, one patch I use contains this text:
--- Code: --- if ( GPIOD_INPUT_VAL & 0x20 )
{
GPIOD_OUTPUT_VAL &=~ 0x40;
- udelay(50);
+ udelay(100);
data = adc_scan(ADC_SCROLLPAD);
--- End code ---
The lines starting with a space are a reference to the code as it stands. So, when you apply the patch, it will look for where in the code it contains
--- Code: --- if ( GPIOD_INPUT_VAL & 0x20 )
{
GPIOD_OUTPUT_VAL &=~ 0x40;-
--- End code ---
The next instruction is
--- Code: ---- udelay(50);
--- End code ---
When it reads this, it will remove that line, hence the "-". The line comes directly after that reference piece of code, hence the reference code being there to make sure it doesn't accidentally remove the wrong instance of that line.
The next instruction is
--- Code: ---+ udelay(100);
--- End code ---
When it reads this, it will add in that line. This is then followed with some more reference code.
So the net result is that this:
--- Code: --- if ( GPIOD_INPUT_VAL & 0x20 )
{
GPIOD_OUTPUT_VAL &=~ 0x40;
udelay(50);
data = adc_scan(ADC_SCROLLPAD);
--- End code ---
Gets changed to this:
--- Code: --- if ( GPIOD_INPUT_VAL & 0x20 )
{
GPIOD_OUTPUT_VAL &=~ 0x40;
udelay(100);
data = adc_scan(ADC_SCROLLPAD);
--- End code ---
The .rej files are just pieces of the patch that didn't apply - generally because the reference code is wrong, or a line it is supposed to remove is changed. As an example, again using the code above, if the line in the actual code was changed from this:
--- Code: --- udelay(50);
--- End code ---
To this:
--- Code: --- udelay(250);
--- End code ---
The patch would not apply correctly, as it would try to remove a line that does not exist. To sync the patch, just change the line in the patch from reading "50" to reading "250" so that it again matches up, and it will apply. To apply it manually, just do what the program does by interpreting the + and - signs yourself from the points provided by the reference code, and use discretion to see what will and will not work.
Sometimes patches can be so far out of sync that you really need to be able to program to get them to apply, but often they can apply cleanly with just a little tinkering and no programming knowledge.
Oh, and with regards to patches depending on each other - an example is album art and bitmap resize. The reference code in the bitmap resize patch is code that is only applied in the album art patch, so you need to have applied album art in order for the bitmap resize patch to be able to find the reference code it is looking for.
Navigation
[0] Message Index
[#] Next page
Go to full version