android
  #1  
Old 12-03-2008, 09:55 AM
greenman greenman is offline
Junior Member
 
Join Date: Apr 2008
Posts: 59
Default Apply Patches in Rockbox: Howto Request

Patching... I know it's simple, but I've never done it. I've set up a development environment using the VMWare development platform. I've used SVN to get the latest rockbox source code. I've successfully compiled and even made a zip.

I'm great at following recipes, and am grateful when hints are offered as to why I'm in a certain folder or need to use a certain command modifier. They did that in the above two links. However, the patch page leaves a something to be desired. I just want to apply patches. I've read and understood the man file for 'patch' and am still unsure why the -p(num) command modifier needs to be used, though it obviously has to do with file folder structure. Conceiveably you could download the patch file to the wrong place and never get the patch to work because you're in the wrong folder to begin with. So...

I assume that before I apply a patch I have to download it from the flyspray perhaps using wget, or maybe using svn. The file has to live somewhere specific. If I'm using SVN, that's likely taken care of. If I'm using wget, where is the most likely place for the patch file download to live? Like anything development-wise, there are probably a lot of ways to get around the barn. What's the shortest, easiest method just to download and apply a patch?

Here's a patch I want to apply: the Anti-Aliased Fonts Patch.
In my VMWare Player Debian 4 environment, using a recipe step format, what are the steps I would take to apply this patch?

Edit: I also notice that Eterm and bash do not allow copying and pasting with mouse select and right-click the way they do on a regular terminal. I can't copy from windows and paste into Debian, consequently. Apparently I have to type everything. Why is that, and is there something I'm missing?

Last edited by greenman; 12-03-2008 at 10:01 AM.
Reply With Quote

Advertisement [Remove Advertisement]

  #2  
Old 12-03-2008, 11:29 AM
Tri Nguyen Tri Nguyen is offline
Junior Member
 
Join Date: Dec 2007
Posts: 9
Default

It's simple. Just do this step-by-step:
- cd to your source root (the one that contains apps, firmware, etc. folders).
- do this command: patch -p# < path to your patch/diff file.

The -p0 works most of the time. But some patch need -p1 or -p2 etc.
Reply With Quote

  #3  
Old 12-03-2008, 12:28 PM
kugel's Avatar
kugel kugel is offline
Rockbox Developer
 
Join Date: Dec 2006
Location: Berlin, Germany
Posts: 1,153
Default

The p# option issues patch to ignore the # leading path parts of each hunk.

So if a hunk in the patchfile looks like
+++ a/apps/menu.c
--- b/apps/menu.c

and you want to apply the patch while being in the root of the source tree, you need to ignore the a and b respectively, so that patch finds the apps dir.

As a general note: Most of the time -p0 works, because that's what "svn diff" produces. Sometimes you need to use -p1, that's when the patch creator uses the git(-svn) version control system or just compared to source dirs using the ordinary diff program.
__________________
;;
Reply With Quote

  #4  
Old 12-03-2008, 05:23 PM
KCrimson's Avatar
KCrimson KCrimson is offline
Junior Member
 
Join Date: Sep 2008
Posts: 59
Help

First - thanks to the OP for starting this thread, I've been meaning to do the same.

I've been following the instructions, but using OS X. I (perhaps wrongly) didn't install the environment, figuring that OS X has Unix underpinnings. When it came to creating the compiled file I got this error:

sing source code root directory: /Users/Ayleen/rockbox
../tools/configure: line 2153: arm-elf-gcc: command not found
../tools/configure: line 2157: arm-elf-ld: command not found
WARNING: The compiler you must use (arm-elf-gcc) is not in your path!
WARNING: this may cause your build to fail since we cannot do the
WARNING: checks we want now.
Using arm-elf-ld
Created Makefile

You'll notice that a different version of the compiler was used - is this OK, or do I need to use the VMWare/Debian virtual machine environment that I'm currently downloading? I'd MUCH rather not have another VM installed on my machine - 2 OS's on here is more than enough already!).
Reply With Quote

  #5  
Old 12-03-2008, 05:40 PM
saratoga saratoga is offline
Rockbox Developer / Moderator
 
Join Date: Apr 2007
Posts: 3,628
Default

Quote:
Originally Posted by KCrimson View Post
First - thanks to the OP for starting this thread, I've been meaning to do the same.

I've been following the instructions, but using OS X. I (perhaps wrongly) didn't install the environment, figuring that OS X has Unix underpinnings.
OSX is unix based, but it does not come with arm-elf-gcc (in fact virtually no Unix systems do since its very rarely used for anything) so you'll still need to install it yourself. Follow the wiki instructions. I believe they explain what to do for MacOS (though I've never tried it myself since I don't have a Mac).
Reply With Quote

  #6  
Old 12-03-2008, 05:47 PM
KCrimson's Avatar
KCrimson KCrimson is offline
Junior Member
 
Join Date: Sep 2008
Posts: 59
Default

By any chance can you provide a link to the OS X compiling wiki? I've never come across it.
Reply With Quote

  #7  
Old 12-03-2008, 05:50 PM
saratoga saratoga is offline
Rockbox Developer / Moderator
 
Join Date: Apr 2007
Posts: 3,628
Default

Looks like I'm wrong and theres just one set of instructions for linux and macos:

http://www.rockbox.org/twiki/bin/vie...velopmentGuide
Reply With Quote

  #8  
Old 12-03-2008, 06:13 PM
KCrimson's Avatar
KCrimson KCrimson is offline
Junior Member
 
Join Date: Sep 2008
Posts: 59
Default

Does that mean that I'm going to need to use VMWare/Debian? I just booted it, tried both the root and "user" account - they booted, but I don't get anything except the Rockbox logo (on a nice black wallpaper background) and the toolbar (which has several options, none that help me). No command line, no menu bar at the top, etc. Could it be related to VmWare telling me that I have an outdated VMWare Tools, or is this the normal presentation of the environment? I'm running the 1.1 version of VMWare Fusion for OS X. It runs WinXP Pro just fine (in fact better than my Pentium 4 laptop).
Reply With Quote

  #9  
Old 12-03-2008, 06:30 PM
saratoga saratoga is offline
Rockbox Developer / Moderator
 
Join Date: Apr 2007
Posts: 3,628
Default

Quote:
Originally Posted by KCrimson View Post
Does that mean that I'm going to need to use VMWare/Debian?
Not according to those instructions. Have you tried them yet?
Reply With Quote

  #10  
Old 12-03-2008, 06:41 PM
KCrimson's Avatar
KCrimson KCrimson is offline
Junior Member
 
Join Date: Sep 2008
Posts: 59
Default

Quote:
Originally Posted by saratoga View Post
Not according to those instructions. Have you tried them yet?
DOH! I missed the line about the cross-compiler.
Reply With Quote

  #11  
Old 12-03-2008, 06:49 PM
KCrimson's Avatar
KCrimson KCrimson is offline
Junior Member
 
Join Date: Sep 2008
Posts: 59
Default

I'm having difficulty getting rockboxdev.sh to execute - do I have to change it permissions or attributes, or is there something else I haven't read properly?
Reply With Quote

  #12  
Old 12-03-2008, 07:03 PM
saratoga saratoga is offline
Rockbox Developer / Moderator
 
Join Date: Apr 2007
Posts: 3,628
Default

Quote:
Originally Posted by KCrimson View Post
I'm having difficulty getting rockboxdev.sh to execute - do I have to change it permissions or attributes, or is there something else I haven't read properly?
Post the logs and any other information you think is important from when you tried to execute it and if I see anything wrong I'll try and suggest a fix.
Reply With Quote

  #13  
Old 12-03-2008, 07:51 PM
KCrimson's Avatar
KCrimson KCrimson is offline
Junior Member
 
Join Date: Sep 2008
Posts: 59
Default

Here's the terminal session - the first time I executed rockboxdev.sh I had already navigated to the tools directory, but it wasn't even recognized (I haven't updated the path statement, and am unsure how/where/if its necessary).
The second time I executed, you'll see that it TRIED to execute, but you'll see the error.
I'm in $Bash (which I don't believe is the default shell in Leopard).

BTW - I started the manual method, but its daunting for the neophyte like me. All I'm trying to do is patch a current build with the Album Art Resize - thats it!

bash-3.2$ rockboxdev.sh
bash: rockboxdev.sh: command not found
bash-3.2$ ~/rockbox/tools/rockboxdev.sh
ROCKBOXDEV: gcc is required for this script to work.
ROCKBOXDEV: Please install gcc and re-run the script.
bash-3.2$
Reply With Quote

  #14  
Old 12-03-2008, 08:51 PM
saratoga saratoga is offline
Rockbox Developer / Moderator
 
Join Date: Apr 2007
Posts: 3,628
Default

Quote:
bash-3.2$ rockboxdev.sh
While that works on Windows, on most unix systems, the command would be ./rockboxdev.sh. The "." means "current directory".

Quote:
OCKBOXDEV: gcc is required for this script to work.
ROCKBOXDEV: Please install gcc and re-run the script.
I assumed you installed gcc since you mentioned it before, but if not, you will need to install it. The rockboxdev script uses gcc to compile the arm cross compilers. I believe you can download it from Apple's website.
Reply With Quote

  #15  
Old 12-03-2008, 10:37 PM
greenman greenman is offline
Junior Member
 
Join Date: Apr 2008
Posts: 59
Default Recipe by Example

Thanks for all the replies. They've been very helpful.
So for example, this might be a good way to go:

Start VMWare, Debian4

fluxbox -> XShells -> Eterm
Code:
Comments in red are not typed.
Stuff in black is typed.
Stuff in green is returned data.
Stuff in blue is the command prompt. Also not typed.
Go to folder 'rockbox'.
user@debian:~$ cd rockbox
Make a folder 'patches'.
user@debian:~/rockbox$ mkdir patches
Navigate to folder 'patches'.
user@debian:~/rockbox$ cd patches
Get file from rockbox flyspray.
user@debian:~/rockbox/patches$ wget http://www.rockbox.org/tracker/task/8961?getfile=16525
--04:44:57-- http://www.rockbox.org/tracker/task/8961?getfile=16525
               => '8961?getfile=16525'
HTTP request sent, awaiting response... 200 OK
Length: 14639 [text/plain]
100%[=====================================>] 14,693     69.40K/s

04:44:59 (69.32 KB/s) - '8961?getfile=16525' saved [14639/14639]
What files are in folder 'patches'? (Confirm that we downloaded the file.)
user@debian:~/rockbox/patches$ ls
8961?getfile=16525
The file is the a useless name. Let's rename it to something useful.
user@debian:~/rockbox/patches$ mv "8961?getfile=16525" anti-alias_fonts.patch 
Go back to the 'rockbox' folder.
user@debian:~/rockbox/patches$ cd ../
Confirm the change made to the file in the patches folder.
user@debian:~/rockbox$ ls patches
anti-alias_fonts.patch
Apply the patch.
user@debian:~/rockbox$ patch -p0 ./patches/anti-alias_fonts.patch
_
[^C] [nothing happening - stop the process]
user@debian:~/rockbox$ patch -p1 ./patches/anti-alias_fonts.patch
_
[^C] [nothing happening - stop the process]
user@debian:~/rockbox$
It stops there. I am likely missing something. Suggestions?
I guess I could have used firefox in windows to download and save the file to //debian/user/rockbox/patches more handily.

The file starts with this:
Code:
Index: tools/convbdf.c
===================================================================
--- tools/convbdf.c    (revision 17342)
+++ tools/convbdf.c    (working copy)
What have I missed?

###
Also, it's still really a pain to not be able to copy/paste in Eterm or bash using the unix mouse-select-then-right-click method. Is there a workaround for this?
Reply With Quote

  #16  
Old 12-04-2008, 12:56 AM
Tri Nguyen Tri Nguyen is offline
Junior Member
 
Join Date: Dec 2007
Posts: 9
Default

The command to patch should be this: patch -p0 < ./patches/anti-alias_fonts.patch

And about MacOSX, to build the toolchain you must install XCode to get Apple's fork of gcc.
Reply With Quote

  #17  
Old 12-04-2008, 05:03 PM
KCrimson's Avatar
KCrimson KCrimson is offline
Junior Member
 
Join Date: Sep 2008
Posts: 59
Default

THAT (XCode isn't installed on this machine) is why I got an error about missing GCC. When I regain the courage, or grow impatient waiting for the album art resize to appear in the daily or current builds I might try again. Until then I'm going to do without it for a while. Thanks though to all of those that helped.
Reply With Quote

  #18  
Old 07-27-2011, 12:19 AM
h8uthemost h8uthemost is offline
Junior Member
 
Join Date: Feb 2010
Posts: 43
Default

I know that this is a really old thread, but I thought I would ask here instead of opening a new one. I'm having trouble applying a patch myself.

I'm on Linux. So all I do is plug the device into the computer, open up a Terminal, cd to the root of my device then enter this command:

Quote:
patch -p# < (name of patch)
Does this look about right? Because I get this error when I do this:

Quote:
patch -p0 < as3525v2-enable-usb.diff
patching file b/firmware/export/config/sansaclipplus.h
Hunk #1 FAILED at 179.
1 out of 1 hunk FAILED -- saving rejects to file b/firmware/export/config/sansaclipplus.h.rej
And I have no idea what the error means. Any help will be appreciated. Thanks.

Last edited by h8uthemost; 07-27-2011 at 12:28 AM.
Reply With Quote

  #19  
Old 07-27-2011, 10:23 AM
saratoga saratoga is offline
Rockbox Developer / Moderator
 
Join Date: Apr 2007
Posts: 3,628
Default

Quote:
Originally Posted by h8uthemost View Post
And I have no idea what the error means. Any help will be appreciated. Thanks.
It means the patch is broken. Regardless, enabling USB just involves removing a single comment from one line. You should probably just copy and paste it using notepad.
__________________
Interested in Google's Summer of Code ? PM me.
Reply With Quote

  #20  
Old 07-29-2011, 02:08 PM
h8uthemost h8uthemost is offline
Junior Member
 
Join Date: Feb 2010
Posts: 43
Default

Would you be kind enough to elaborate a bit more on this, saratoga? I'm a bit new to patching and Rockbox in general. So any detailed instructions on how to get this going would be much appreciated.

Thanks.
Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 09:43 AM.