abi>>forums

abi>>forums (http://www.anythingbutipod.com/forum/index.php)
-   Sansa e200 Rockbox (http://www.anythingbutipod.com/forum/forumdisplay.php?f=72)
-   -   Apply Patches in Rockbox: Howto Request (http://www.anythingbutipod.com/forum/showthread.php?t=37089)

greenman 12-03-2008 08:55 AM

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?

Tri Nguyen 12-03-2008 10:29 AM

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.

kugel 12-03-2008 11:28 AM

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.

KCrimson 12-03-2008 04:23 PM

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!).

saratoga 12-03-2008 04:40 PM

Quote:

Originally Posted by KCrimson (Post 305012)
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).

KCrimson 12-03-2008 04:47 PM

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

saratoga 12-03-2008 04:50 PM

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

http://www.rockbox.org/twiki/bin/vie...velopmentGuide

KCrimson 12-03-2008 05:13 PM

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).

saratoga 12-03-2008 05:30 PM

Quote:

Originally Posted by KCrimson (Post 305032)
Does that mean that I'm going to need to use VMWare/Debian?

Not according to those instructions. Have you tried them yet?

KCrimson 12-03-2008 05:41 PM

Quote:

Originally Posted by saratoga (Post 305039)
Not according to those instructions. Have you tried them yet?

DOH! I missed the line about the cross-compiler. :o

KCrimson 12-03-2008 05:49 PM

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? :)

saratoga 12-03-2008 06:03 PM

Quote:

Originally Posted by KCrimson (Post 305050)
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.

KCrimson 12-03-2008 06:51 PM

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$

saratoga 12-03-2008 07:51 PM

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.

greenman 12-03-2008 09:37 PM

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?

Tri Nguyen 12-03-2008 11:56 PM

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.

KCrimson 12-04-2008 04:03 PM

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. :o

h8uthemost 07-26-2011 11:19 PM

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.

saratoga 07-27-2011 09:23 AM

Quote:

Originally Posted by h8uthemost (Post 565747)
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.

h8uthemost 07-29-2011 01:08 PM

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.


All times are GMT -5. The time now is 05:34 PM.