Move thread-sdl.[ch] into the target tree.
[kugel-rb.git] / manual / advanced_topics / archos-flashing.tex
blob82fe886c694c346a71480aad5e67efb0fe8d4d4e
1 \section{\label{ref:Rockboxinflash}Rockbox in Flash}
3 \subsection{Introduction}
5 When you bought your \playertype, it came with the \playerman\ firmware in
6 flash ROM. When you power on your \dap, this \playerman\ firmware starts,
7 and then loads an updated firmware from disk if present (\firmwarefilename).
8 An ordinary Rockbox installation only replaces the on-disk firmware, leaving
9 the flash ROM contents intact. That means the \playerman\ firmware still
10 controls the boot process.
12 The main reason to change this is to improve the startup time of your player.
13 The \playerman\ bootloader is rather slow. With Rockbox in flash, your \dap\
14 will boot much faster, typically in three to five seconds. Furthermore you
15 might prefer a clean Rockbox environment, with as little remnants of the
16 \playerman\ software as possible.
17 \opt{rombox}{On your \dap\ it is also possible to execute Rockbox directly
18 from flash ROM, increasing the amount of free RAM for buffering music. This
19 is called \emph{Rombox}.
22 \warn{Flashing your \dap\ is somewhat dangerous, like programming a mainboard
23 \emph{BIOS}, \emph{CD/DVD} drive firmware, mobile phone, etc. If the power
24 fails, the chip breaks while programming or most of all the programming
25 software malfunctions, you'll have a dead box. We take no responsibility of
26 any kind, you do that at your own risk. However, we tried as carefully as
27 possible to bulletproof this code. There are a lot of sanity checks. If any
28 of them fails, it will not program.
31 \opt{ondio}{\warn{After flashing Rockbox, never try to ROLO the \playerman\
32 firmware
33 \opt{ondiofm}{versions 1.31f or 1.32b! These versions are flash updates
34 themselves. If they are}
35 \opt{ondiosp}{version 1.32b! This version is a flash update itself.
36 If it is}
37 applied when Rockbox is flashed, you'll end up with a garbled flash ROM
38 and hence a dead box.
41 There's an ultimate safety net to bring back boxes with even completely
42 garbled flash content: the \emph{UART} boot mod, which in turn requires the
43 \emph{serial} mod. With that it's possible to reflash independently from the
44 outside, even if the flash ROM is completely erased.
45 \nopt{ondio}{This won't work if you have one of the rare ``ROMless'' boxes. These
46 have no boot ROM and boot directly from flash.
48 If the first $\approx$2~KB of the flash ROM are flashed ok, \emph{Minimon} can
49 be used for the same purpose.
51 \subsection{Terminology and Basic Operation}
53 \begin{description}
54 \item[Firmware:] The flash ROM contents as a whole.
55 \item[Image:] One operating software started from there.
56 \end{description}
58 The replacement firmware contains a bootloader and two images. The first image
59 is the \emph{permanent} rescue software, to be used in case something is wrong
60 with the second (main) image. In current firmware files this first image
61 contains \emph{Bootbox} (see wiki for details). The second image is what is
62 booted by default. The current firmware files contain a copy of Rockbox 3.2
63 in the main image. It can easily be updated/replaced later.
65 The bootloader allows to select which image to run. Pressing
66 \opt{RECORDER_PAD}{\ButtonFOne}\opt{PLAYER_PAD,ONDIO_PAD}{\ButtonLeft} at boot
67 selects the first image.
68 \opt{RECORDER_PAD}{\ButtonFTwo}\opt{PLAYER_PAD}{\ButtonPlay}\opt{ONDIO_PAD}{\ButtonUp}
69 selects the second image, which will also be booted if you don't press any
70 button. The button mapping is only there for completeness.
71 \opt{RECORDER_PAD}{\ButtonFThree}\opt{PLAYER_PAD,ONDIO_PAD}{\ButtonRight}
72 selects the built-in serial monitor called \emph{Minimon}. You should know this
73 in case you invoke it by accident. Minimon won't display anything on the
74 screen. To get out of it, perform a hardware shutdown of your \dap.
76 \subsection{Initial Flashing Procedure}
78 You only need to perform this procedure the first time you flash your
79 \playertype. You may also want to perform it in case the update procedure for
80 the second image recommends it. In the latter case do not perform the steps
81 listed under ``Preparation''.
83 \subsubsection{Preparation}
85 \nopt{ondio}{
86 First, check whether your \playertype\ is flashable at all. Select
87 \setting{System $\rightarrow$ Debug (Keep Out!) $\rightarrow$ View HW
88 Info}.
89 \opt{lcd_charcell}{Cycle through the displayed values with \ButtonRight /
90 \ButtonLeft\ until ``Flash:'' is displayed. If it shows question marks,
92 \opt{lcd_bitmap}{Check the values in the line starting with ``Flash:''. If it
93 shows question marks after ``M='' and ``D='',
95 you're out of luck, your \dap\ is not flashable without modifying the
96 hardware. You can stop here. Sorry.
99 \nopt{ondio}{If your \dap\ is flashable, you}\opt{ondio}{You} should perform a
100 backup of the current flash ROM contents, in case you want to restore it later.
101 Select \setting{System $\rightarrow$ Debug (Keep Out!) $\rightarrow$ Dump ROM
102 contents}. You'll notice a few seconds of disk activity. When you connect your
103 \dap\ to the PC afterwards, you'll find two files in the root of your \dap.
104 Copy the 256~KB-sized file named \fname{internal\_rom\_2000000-203FFFF.bin} to
105 a safe place.
107 \subsubsection{Flashing}
109 \begin{enumerate}
110 \item Download the correct package for your \dap\ from
111 \url{http://download.rockbox.org/bootloader/archos/}. It is named
112 \fname{flash-{\textless}model{\textgreater}-{\textless}version{\textgreater}.zip}.
113 The current packages are v3.
114 \item Unzip the flash package to the root of your \dap.
115 \nopt{ondio}{This will extract two files to the root,
116 \fname{firmware\_{\textless}model{\textgreater}.bin} and
117 \fname{firmware\_{\textless}model{\textgreater}\_norom.bin}.
118 \opt{recorder,recorderv2fm}{(The {\textless}model{\textgreater} part is
119 slighty different from that in the .zip file name.)
121 The flash plugin will select the correct one for your \dap.
123 \opt{ondio}{This will extract one file to the root,
124 \fname{firmware\_{\textless}model{\textgreater}.bin}.
126 Now safely disconnect USB.
127 \item
128 \nopt{ondio}{Make sure your batteries are in good shape and fully charged.}
129 \opt{ondio}{Make sure you use a set of fresh batteries.}
130 Flashing doesn't need more power than normal operation, but you don't want
131 your \dap\ to run out of power while flashing.
132 \item Select \setting{Plugins $\rightarrow$ Applications}, and run the
133 \fname{firmware\_flash} plugin. It will tell you about your flash and
134 which file it is going to program. After pressing
135 \opt{RECORDER_PAD}{\ButtonFOne}\opt{PLAYER_PAD}{\ButtonMenu}\opt{ONDIO_PAD}{\ButtonLeft}
136 it will check the file. If the file is OK, pressing
137 \opt{RECORDER_PAD}{\ButtonFTwo}\opt{PLAYER_PAD}{\ButtonOn}\opt{ONDIO_PAD}{\ButtonUp}
138 will give you a big warning. If we still didn't manage to scare you off, you
139 need to press
140 \opt{RECORDER_PAD}{\ButtonFThree}\opt{PLAYER_PAD,ONDIO_PAD}{\ButtonRight}
141 to actually program and verify. The programming takes just a few seconds.
142 \item In the unlikely event that the programming or verify steps should give
143 you any error, \emph{do not switch off the box!} Otherwise you'll have seen
144 it working for the last time. While Rockbox is still in RAM and operational,
145 we could upgrade the plugin via USB and try again. If you switch it off,
146 it's gone.
147 \end{enumerate}
149 \note{After successful flashing you may delete the \fname{.bin} files from the
150 root of your \dap.
153 \note{There are no separate flash packages for {\dap}s modified to have 8~MB
154 of RAM. You need to use the corresponding package for non-modified
155 \playertype. You should then install a Rockbox image that makes use of all
156 available RAM as described in the following section.
159 \subsection{Updating the Rockbox Image in Flash}
161 When Rockbox is booted from flash, it does not check for an updated firmware
162 on disk. This is one of the reasons why it boots faster than the \playerman\
163 firmware. It means that whenever you update Rockbox, you also need to update
164 the image in the flash. This is a simple and safe procedure:
166 \begin{enumerate}
167 \item Download (or build) the Rockbox build you want to use, and unzip it to
168 the root of your \dap. Safely disconnect USB.
169 \item ROLO into the new Rockbox version.
170 \item Go to the file browser, and enter the \fname{.rockbox} directory (you
171 might need to set the \setting{File View} option to \setting{All}.)
172 \item Play the file \fname{rockbox.ucl}\opt{rombox}{, or preferably
173 \fname{rombox.ucl}}, and follow the instructions. The plugin handling
174 this is \fname{rockbox\_flash}, a viewer plugin.
175 \end{enumerate}
177 \subsection{Restoring the Original Flash ROM Contents}
179 In case you ever want to restore the original flash contents, you will need
180 the backup file. The procedure is very similar to initial flashing, with the
181 following differences:
183 \begin{enumerate}
184 \item Check that you do not have any \fname{firmware\_*.bin} files in your
185 \dap's root.
186 \item Select \setting{Plugins $\rightarrow$ Applications}, and run the
187 \fname{firmware\_flash} plugin. Write down the filename it displays in the
188 first screen, then exit the plugin.
189 \item Connect USB, and copy the flash ROM backup file to the root of your
190 \dap. \emph{Only use the backup file from that very box, otherwise you're
191 asking for trouble!} Rename the file so that it matches the name requested
192 by the \fname{firmware\_flash} plugin. Safely disconnect USB.
193 \end{enumerate}
195 Now follow the instructions given for initial flashing, starting with step 3.