blob: 58535c968a94cb16344a4b6069121f4901f8582a [file] [log] [blame]
Martin Arverd3d3e342006-03-15 10:56:14 +00001\section{\label{ref:Rockboxinflash}Rockbox in flash}
Martin Arver186bb512006-06-19 08:41:53 +00002\fixme{These instructions are outdated!!. This section is a copy of the wikipage FlashingRockbox revision r.1.19.}
3
Martin Arver30b0e662006-06-15 11:56:50 +00004\warn{Flashing Rockbox is optional. It is not required for using Rockbox on your
5 \playername. Please read the whole section thoroughly before flashing.
6}
Martin Arverd3d3e342006-03-15 10:56:14 +00007
Martin Arver30b0e662006-06-15 11:56:50 +00008\subsection{Introduction}
9Flashing in the sense used here and elsewhere in regard to Rockbox means
10reprogramming the flash memory of the \playerman\ unit.
Martin Arverd3d3e342006-03-15 10:56:14 +000011
Martin Arver30b0e662006-06-15 11:56:50 +000012When you bought your \playerman, it came with the \playerman\ firmware flashed.
13Now, you can add Rockbox to the built-in software.
Martin Arverd3d3e342006-03-15 10:56:14 +000014
Martin Arver30b0e662006-06-15 11:56:50 +000015\subsection{Terminology}
16\begin{description}
17\item[Firmware: ] The flash ROM content as a whole.
18\item[Image: ] Means one operating software started from there
19\end{description}
Martin Arverd3d3e342006-03-15 10:56:14 +000020
Martin Arver30b0e662006-06-15 11:56:50 +000021By reprogramming the firmware, we can boot much faster. \playerman\ has an
22unnecessary slow boot loader, versus the boot time for Rockbox is much faster
23than the disk spinup, in fact it has to wait for the disk. Your boot time will
24be as quick as a disk spinup (e.g. 4 seconds from powerup until resuming
25playback).
Martin Arverd3d3e342006-03-15 10:56:14 +000026
Martin Arver30b0e662006-06-15 11:56:50 +000027\subsection{Method}
Martin Arverd3d3e342006-03-15 10:56:14 +000028
Martin Arver30b0e662006-06-15 11:56:50 +000029The replaced firmware will host a bootloader and 2 images. This is possible by
30compression. The first is the \emph{permanent} backup, not to be changed any
31more.The second is the default one to be started, the first is only used when
32you hold the \opt{recorder,recorderv2fm}{\ButtonFOne}\opt{ondio}{\ButtonLeft}\opt{player}{\ButtonLeft} -key during start. Like supplied here, the first image
33is the original Archos firmware, the second is empty, left for you to program
34and update. It can contain anything you like. If you prefer, you can program
35the Archos firmware to there, too.
36
37\note{For now, the binary contained in the brand new player flash package does
38contain rockbox built from current cvs in the second image slot. This is to
39lower the risk of flashing (at least one of the images will hopefully work) in
40case you don't program a second image yourself in the first step. Of course the
41second image can be replaced like with the other models.}
42
43There are two programming tools supplied:
Martin Arverd3d3e342006-03-15 10:56:14 +000044
45\begin{itemize}
Martin Arver30b0e662006-06-15 11:56:50 +000046\item The first one is called \fname{firmware\_flash.rock} and is used to
47 program the whole flash with a new content. You can also use it to revert
48 back to the original firmware you've hopefully backup-ed. In the ideal case,
49 you'll need this tool only once. You can view this as "formatting" the flash
50 with the desired image structure.
51\item The second one is called \fname{rockbox\_flash.rock} and is used to
52 reprogram only the second image. It won't touch any other byte, should be
53 safe to fool around with. If the programmed firmware is inoperational, you
54 can still use the \opt{recorder,recorderv2fm}{\ButtonFOne}\opt{ondio}{\ButtonLeft}\opt{player}{\ButtonLeft} start with the Archos firmware and Rockbox booted
55 from disk to try better.
Martin Arverd3d3e342006-03-15 10:56:14 +000056\end{itemize}
57
Martin Arver30b0e662006-06-15 11:56:50 +000058The non-user tools are in the \fname{flash} subdirectory of the cvs source
59files. There's an authoring tool which composed the firmware file with the
60bootloader and the 2 images. The bootloader project, a firmware extraction
61tool, the plugin sources, and the tools for the UART boot feature: a monitor
62program for the box and a PC tool to drive it. Feel free to review the sources
63for all of it, but be careful when fooling around with powerful toys!
Martin Arverd3d3e342006-03-15 10:56:14 +000064
Martin Arver30b0e662006-06-15 11:56:50 +000065\subsection{Risks}
66Well, is it dangerous? Yes, certainly, like programming a mainboard
67\emph{BIOS}, \emph{CD/DVD} drive firmware, mobile phone, etc. If the power
68fails, your chip breaks while programming or most of all the programming
69software malfunctions, you'll have a dead box. We take no responsibility of any
70kind, you do that at your own risk. However, we tried as carefully as possible
71to bulletproof this code. The new firmware file is completely read before it
72starts programming, there are a lot of sanity checks. If any fails, it will not
73program. Before releasing this, we have checked the flow with exactly these
74files supplied here, starting from the original firmware in flash. It worked
75reliably, there's no reason why such low level code should behave different on
76your box.
Martin Arverd3d3e342006-03-15 10:56:14 +000077
Martin Arver30b0e662006-06-15 11:56:50 +000078\opt{player}{
79 \warn{The risk is slightly higher for player flashing, because:
80 \begin{itemize}
81 \item This is brand new
82 \item It could not be tested with all hardware versions.
83 \end{itemize}
84 Refer to this e-mail:
85 \url{http://www.rockbox.org/mail/archive/rockbox-archive-2004-12/0245.shtml}
86 }
87}
Martin Arverd3d3e342006-03-15 10:56:14 +000088
Martin Arver30b0e662006-06-15 11:56:50 +000089There's one ultimate safety net to bring back boxes with even completely
90garbled flash content: the \emph{UART} boot mod, which in turn requires the
91serial mod. It can bring the dead back to life, with that it's possible to
92reflash independently from the outside, even if the flash is completely erased.
93It has been used that during development, else Rockbox in flash wouldn't have
94been possible. Extensive development effort went into the exploitation of the
95UART boot mod. Mechanically adept users with good soldering skills can easily
96perform these mods. Others may feel uncomfortable using the first tool
97(\fname{firmware\_flash.rock}) for reflashing the firmware.
Martin Arverd3d3e342006-03-15 10:56:14 +000098
Martin Arverd3d3e342006-03-15 10:56:14 +000099
Martin Arver30b0e662006-06-15 11:56:50 +0000100To comfort you a bit again: If you are starting with a known-good image, you
101are unlikely to experience problems. The flash tools have been stable for quite
102a while. Several users have used them extensively, even flashing while playing!
103Although it worked, it's not the recommended method.
Martin Arverd3d3e342006-03-15 10:56:14 +0000104
Martin Arver30b0e662006-06-15 11:56:50 +0000105About the safety of operation: Since we have dual boot, you're not giving up
106the Archos firmware. It's still there when you hold
107\opt{recorder,recorderv2fm}{\ButtonFOne}\opt{ondio}{\ButtonLeft}\opt{player}{\ButtonLeft} during startup. So even if Rockbox from flash is not 100\% stable for
108everyone, you can still use the box, reflash the second image with an updated
109Rockbox copy, etc.
Martin Arverd3d3e342006-03-15 10:56:14 +0000110
Martin Arver30b0e662006-06-15 11:56:50 +0000111The flash chip being used by Archos is specified for 100,000 cycles, so you don't need to worry about that wearing out.
112
113\subsection{Requirements}
114You need two things:
115\begin{itemize}
116\item The first is a \playername. Be sure you're using the correct package,
117 they are different!
118\item Second, you need an in-circuit programmable flash. \opt{recorder,recorderv2fm,player}{The older chips are not flashable.}\opt{ondio}{This should always
119 be flashable on Ondios, because Archos does itself provide flash updates for
120 these.} You can find out via Rockbox (\setting{Info $\rightarrow$ Debug $\rightarrow$ Hardware Info}). If the flash info gives you question marks (Flash M=?? D=??),
121 you're out of luck. The only chance then is to solder in the right chip
122 (SST39VF020), at best with the firmware already in. If the chip is blank,
123 you'll need the UART boot mod as well.
124\end{itemize}
125
126\subsection{Flashing procedure}
127Short explanation: copy the \fname{firmware\_*.bin} files for your model from the
128distribution to the root directory of your \dap, then run the
129\fname{firmware\_flash.rock} plugin.
130Long version, step by step procedure:
131\begin{enumerate}
132\item Completely install the Rockbox version you want to have in flash, from a
133 full \fname{.zip} distribution, including all the plugins, etc.
134\item Back up the current firmware, using the first option of the debug menu
135 (\setting{Info $\rightarrow$ Debug $\rightarrow$ Dump ROM Contents}).
136 This creates 2 files in the root directory, which you may not immediately see
137 in the Rockbox browser. The 256kB-sized \fname{internal\_rom\_2000000-203FFFF.bin} one is your present firmware. Back both up to your PC. You will need them if
138 you want to restore the flash contents.
139\item Download the correct package for you model. Copy one or two files of it to
140 your box: \fname{firmware\_*.bin} (name depends on your model) into the root
141 directory (the initial firmware for your model, with the bootloader and the
142 Archos image). There now is also a \_norom variant, copy both, the plugin will
143 decide which one is required for your box.
144\item Enter the debug menu and select the hardware info screen. Check your flash
145 IDs (bottom line), and please make a note about your \opt{recorder,recorderv2fm,ondio}{hardware mask value}\opt{player}{ROM version}. The latter is just for our
146 curiosity, not needed for the flow. If the flash info shows question marks,
147 you can stop here, sorry.
148\item Use the \opt{recorder,recorderv2fm}{\ButtonFTwo\ settings or }the menu (\setting{General settings $\rightarrow$ File view $\rightarrow$ Show files}) to
149 configure seeing all files within the browser.
150\item Connect the charger and make sure your batteries are also in good shape.
151 That's just for security reasons, it's not that flashing needs more power.
152\item Run the \fname{firmware\_flash.rock} plugin. It again tells you about your
153 flash and the file it's gonna program. After \opt{recorder,recorderv2fm}{\ButtonFOne}\opt{ondio}{\ButtonLeft}\opt{player}{\ButtonLeft} it checks the file. Your
154 hardware mask value will be kept, it won't overwrite it. Hitting \opt{recorder,recorderv2fm}{\ButtonFTwo}\opt{ondio}{\ButtonUp}\opt{player}{\ButtonOn} gives you
155 a big warning. If we still didn't manage to scare you off, you can hit\opt{recorder,recorderv2fm}{\ButtonFThree}\opt{ondio}{\ButtonRight}\opt{player}{\ButtonRight} to actually program and verify. The programming takes just a few seconds. If
156 the sanity check fails, you have the wrong kind of boot ROM and are out of luck
157 by now, sorry.
158\item In the unlikely event that the programming should give you any error, don't
159 switch off the box! Otherwise you'll have seen it working for the last time.
160 While Rockbox is still in DRAM and operational, we could upgrade the plugin via
161 USB and try again. If you switch it off, it's gone.
162\end{enumerate}
163
164\nopt{player}{
165Now the initial procedure is done. Since the second half of the flash is still
166empty, there is ``just'' the Archos image starting when you reboot now. Not much
167has changed yet. The Archos software starts a bit quicker than usual, then loads
168Rockbox from disk. The fun really starts when you add Rockbox to the flash, as
169described in the next section.
170}
171
172\note{You may delete the \fname{.bin} files now.}
173
174\subsection{Bringing in a Rockbox build}
175Short version: very easy, just play an \fname{.ucl} file like
176\fname{rockbox.ucl} from a release or build:
Martin Arverd3d3e342006-03-15 10:56:14 +0000177
178\begin{itemize}
Martin Arver30b0e662006-06-15 11:56:50 +0000179\item Make sure you are running the same version that you are trying to flash:
180 play the \fname{ajbrec.ajz} file.
181\item Enter the \fname{.rockbox} directory in the file browser (you might need
182 to set the \setting{File View} option to \setting{All Files}).
183\item Play the \fname{rockbox.ucl} file (or \fname{rombox.ucl} if you want to
184 flash ROMBox)
Martin Arverd3d3e342006-03-15 10:56:14 +0000185\end{itemize}
Martin Arverd3d3e342006-03-15 10:56:14 +0000186
Martin Arver30b0e662006-06-15 11:56:50 +0000187Long version:
Martin Arverd3d3e342006-03-15 10:56:14 +0000188
Martin Arver30b0e662006-06-15 11:56:50 +0000189The second image is the working copy, the \fname{rockbox\_flash.rock} plugin from
190this package reprograms it. The plugins needs to be consistant with the Rockbox
191plugin API version, otherwise it will detect mismatch and won't run.
Martin Arverd3d3e342006-03-15 10:56:14 +0000192
Martin Arver30b0e662006-06-15 11:56:50 +0000193It requires an exotic input, a UCL-compressed image, because that's the internal
194format. UCL is a nice open-source compression library. The decompression is very
195fast and less than a page of C-code. The efficiency is even better than Zip with
196maximum compression, reduces file size to about 58\% of the original size. For
197details on UCL, see \url{http://www.oberhumer.com/opensource/ucl/}.
Martin Arverd3d3e342006-03-15 10:56:14 +0000198
Martin Arver30b0e662006-06-15 11:56:50 +0000199Rockbox developers using Linux will have to download it from there and compile
200it. For Win32 and Cygwin the executables are next to the packages. The sample
201program from that download is called \fname{uclpack}. We'll use that to compress
202\fname{rockbox.bin} which is the result of the compilation. This is a part of the
203build process meanwhile. If you compile Rockbox yourself, you should copy
204\fname{uclpack} to a directory which is in the path, we recommend placing it in
205the same dir as SH compiler.
Martin Arverd3d3e342006-03-15 10:56:14 +0000206
Martin Arverd3d3e342006-03-15 10:56:14 +0000207
Martin Arver30b0e662006-06-15 11:56:50 +0000208Here are the steps:
Martin Arverd3d3e342006-03-15 10:56:14 +0000209
Martin Arver30b0e662006-06-15 11:56:50 +0000210\begin{enumerate}
211\item Normally, you'll simply download a \fname{.zip} distribution. Copy all the
212 content to the USB drive, replacing the old.
213\item Force a disk boot by holding \opt{recorder,recorderv2fm}{\ButtonFOne}\opt{ondio}{\ButtonLeft}\opt{player}{\ButtonLeft} during power-up, or at least rolo into
214 the new Rockbox version by \emph{Playing} the \fname{ajbrec.ajz}/fname{archos.mod} file. This may not always be necessary, but it's better to first run the
215 version you're about to flash. It is required if you are currently running
216 RomBox.
217\item Just \emph{play} the \fname{.ucl} file in the \fname{.rockbox} directory,
218 this will kick off the \fname{rockbox\_flash.rock} plugin. It's a bit similar
219 to the other one, but it's made different to make the user aware. It will check
220 the file, available size, etc. With \opt{recorder,recorderv2fm}{\ButtonFTwo}\opt{ondio}{\ButtonUp}\opt{player}{\ButtonOn} it's being programmed. No need for
221 warning this time. If it goes wrong, you'll still have the permanent image.
222\item When done, you can restart the box and hopefully your new Rockbox image.
223\end{enumerate}
Martin Arverd3d3e342006-03-15 10:56:14 +0000224
Martin Arver30b0e662006-06-15 11:56:50 +0000225You may find two \fname{.ucl} files in the \fname{.rockbox} folder. The
226classical, compressed one is \fname{rockbox.ucl}. If your model has enough flash
227space left, there may be an additional \fname{rombox.ucl}, which is uncompressed
228and can run directly from flash ROM, saving some RAM. The second way is the newer
229and now preferred one. Use this if available.
Martin Arverd3d3e342006-03-15 10:56:14 +0000230
Martin Arver30b0e662006-06-15 11:56:50 +0000231If you like or have to, you can also flash the Archos image as the second one.
232E.g. in case Rockbox from flash doesn't work for you. This way you keep the dual
233bootloader and you can easily try different later. The \fname{.ucl} of the Archos
234firmware is included in the package.
Martin Arverd3d3e342006-03-15 10:56:14 +0000235
Martin Arver30b0e662006-06-15 11:56:50 +0000236\subsection{Restoring the original firmware}
237If you'd like to revert to the original firmware, you can do like you did when
238you flashed Rockbox for the first time. You simply use the backup files you saved
239when flashing Rockbox for the first time and rename \fname{internal\_rom\_2000000-203FFFF.bin} to \fname{firmware\_*.bin} (name varies per model, use the filename that \fname{firmware\_flash.rock} asks for) and put it in the root.
Martin Arverd3d3e342006-03-15 10:56:14 +0000240
Martin Arver30b0e662006-06-15 11:56:50 +0000241\subsection{Known issues and limitations}
242Rockbox has a charging screen, but it is not 100\% perfect. You'll get it when
243the unit is off and you plug in the charger. The Rockbox charging algorithm is
244first measuring the battery voltage for about 40 seconds, after that it only
245starts charging when the capacity is below 85\%.
246\opt{recorder,recorderv2fm}{You can use the Archos charging (which always tops off) by holding \ButtonFOne\ while plugging in.}\opt{recorderv2fm}{Some FM users reported charging problems even with \ButtonFOne, they had to revert to the original flash content.}
Martin Arverd3d3e342006-03-15 10:56:14 +0000247
Martin Arver30b0e662006-06-15 11:56:50 +0000248If the plugin API is changed, new builds may render the plugins incompatible.
249When updating, make sure you grab those too, and ROLO or \opt{recorder,recorderv2fm}{\ButtonFOne}\opt{ondio}{\ButtonLeft}\opt{player}{\ButtonLeft} boot into the
250new version before flashing it.
Martin Arverd3d3e342006-03-15 10:56:14 +0000251
Martin Arver30b0e662006-06-15 11:56:50 +0000252There are two variants of how the boxes starts, therefore the normal and the
253\_norom firmware files. The vast majority of the \daps\ all have the same boot
254ROM content, differentiation comes later by flash content. Rockbox identifies
255this boot ROM with a CRC value of 0x222F in the hardware info screen. \opt{recorder,recorderv2fm}{Some recorders have the boot ROM disabled (it might be unprogrammed) and start directly from a flash mirror at address zero. They need the new
256 \_norom firmware that has a slightly different bootloader.}
257Without a boot ROM there is no UART boot safety net. To compensate for that as
Martin Arvercd699962006-06-16 08:57:55 +0000258much as possible the MiniMon monitor is included, it starts with \opt{recorder,recorderv2fm}{\ButtonFThree+\ButtonOn}\opt{ondio}{\ButtonRight+\ButtonOff}\opt{player}{\ButtonRight+\ButtonOn}.
Martin Arver30b0e662006-06-15 11:56:50 +0000259Using that the box can be reprogrammed via serial if the first 2000 bytes of the
260flash are OK.
Martin Arverd3d3e342006-03-15 10:56:14 +0000261
Martin Arver30b0e662006-06-15 11:56:50 +0000262\subsection{Download the new flash content file to your box}
Martin Arver186bb512006-06-19 08:41:53 +0000263\fixme{These links are not valid. Refer to the wikipage BootBox for further
264 instructions}
Martin Arver30b0e662006-06-15 11:56:50 +0000265Jens Arnold hosts flash content for download. Use the following url:
266\opt{player}{\url{http://www.jens-arnold.net/Rockbox/flash\_player.zip}}
267\opt{recorder}{\url{http://www.jens-arnold.net/Rockbox/flash\_rec.zip}}
268\opt{recorderv2fm}{\url{http://www.jens-arnold.net/Rockbox/flash\_fm.zip},
269 \url{http://www.jens-arnold.net/Rockbox/flash\_v2.zip}}
270\opt{ondiofm}{\url{http://www.jens-arnold.net/Rockbox/flash\_ondiofm.zip}}
271\opt{ondiosp}{\url{http://www.jens-arnold.net/Rockbox/flash\_ondiosp.zip}}