summaryrefslogtreecommitdiff
path: root/manual/advanced_topics/archos-flashing.tex
blob: 5b730820d2b6a83348b937e0eb7dd9b8d7981196 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
\section{\label{ref:Rockboxinflash}Rockbox in Flash}

\subsection{Introduction}

When you bought your \playertype, it came with the \playerman\ firmware in
flash ROM. When you power on your \dap, this \playerman\ firmware starts,
and then loads an updated firmware from disk if present (\firmwarefilename).
An ordinary Rockbox installation only replaces the on-disk firmware, leaving
the flash ROM contents intact. That means the \playerman\ firmware still
controls the boot process.

The main reason to change this is to improve the startup time of your player.
The \playerman\ bootloader is rather slow. With Rockbox in flash, your \dap\
will boot much faster, typically in three to five seconds. Furthermore you
might prefer a clean Rockbox environment, with as little remnants of the
\playerman\ software as possible.
\opt{rombox}{On your \dap\ it is also possible to execute Rockbox directly
  from flash ROM, increasing the amount of free RAM for buffering music. This
  is called \emph{Rombox}.
}

\warn{Flashing your \dap\ is somewhat dangerous, like programming a mainboard
  \emph{BIOS}, \emph{CD/DVD} drive firmware, mobile phone, etc. If the power
  fails, the chip breaks while programming or most of all the programming
  software malfunctions, you'll have a dead box. We take no responsibility of
  any kind, you do that at your own risk. However, we tried as carefully as
  possible to bulletproof this code. There are a lot of sanity checks. If any
  of them fails, it will not program.
}

\opt{ondio}{\warn{After flashing Rockbox, never try to ROLO the \playerman\
    firmware
    \opt{ondiofm}{versions 1.31f or 1.32b! These versions are flash updates
      themselves. If they are}
    \opt{ondiosp}{version 1.32b! This version is a flash update itself.
      If it is}
    applied when Rockbox is flashed, you'll end up with a garbled flash ROM
    and hence a dead box.
}}

There's an ultimate safety net to bring back boxes with even completely
garbled flash content: the \emph{UART} boot mod, which in turn requires the
\emph{serial} mod. With that it's possible to reflash independently from the
outside, even if the flash ROM is completely erased.
\nopt{ondio}{This won't work if you have one of the rare "ROMless" boxes. These
  have no boot ROM and boot directly from flash.
}
If the first $\approx$2KB of the flash ROM are flashed ok, \emph{Minimon} can
be used for the same purpose.

\subsection{Terminology and Basic operation}

\begin{description}
\item[Firmware:] The flash ROM contents as a whole.
\item[Image:] One operating software started from there.
\end{description}

The replacement firmware contains a bootloader and two images. The first image
is the \emph{permanent} rescue software, to be used in case something is wrong
with the second (main) image. In current firmware files this first image
contains \emph{Bootbox} (see wiki for details). The second image is what is
booted by default. The current firmware files contain a copy of Rockbox 3.0.1
in the main image. It can easily be updated/replaced later.

The bootloader allows to select which image to run. Pressing
\opt{RECORDER_PAD}{\ButtonFOne}\opt{PLAYER_PAD,ONDIO_PAD}{\ButtonLeft} at boot
selects the first image.
\opt{RECORDER_PAD}{\ButtonFTwo}\opt{PLAYER_PAD}{\ButtonPlay}\opt{ONDIO_PAD}{\ButtonUp}
selects the second image, which will also be booted if you don't press any
button. The button mapping is only there for completeness.
\opt{RECORDER_PAD}{\ButtonFThree}\opt{PLAYER_PAD,ONDIO_PAD}{\ButtonRight}
selects the built-in serial monitor called \emph{Minimon}. You should know this
in case you invoke it by accident. Minimon won't display anything on the
screen. To get out of it, perform a hardware shutdown of your \dap.

\subsection{Initial Flashing Procedure}

You only need to perform this procedure the first time you flash your
\playertype. You may also want to perform it in case the update procedure for
the second image recommends it. In the latter case do not perform the steps
listed under "Preparation".

\subsubsection{Preparation}

\nopt{ondio}{
  First, check whether your \playertype\ is flashable at all. Select
  \setting{System $\rightarrow$ Debug (Keep Out!) $\rightarrow$ View HW
  Info}. 
  \opt{lcd_charcell}{Cycle through the displayed values with \ButtonRight /
    \ButtonLeft\ until "Flash:" is displayed. If it shows question marks,
  }
  \opt{lcd_bitmap}{Check the values in the line starting with "Flash:". If it
    shows question marks after "M=" and "D=",
  }
  you're out of luck, your \dap\ is not flashable without modifying the
  hardware. You can stop here. Sorry.
}

\nopt{ondio}{If your \dap\ is flashable, you}\opt{ondio}{You} should perform a
backup of the current flash ROM contents, in case you want to restore it later.
Select \setting{System $\rightarrow$ Debug (Keep Out!) $\rightarrow$ Dump ROM
contents}. You'll notice a few seconds of disk activity. When you connect your
\dap\ to the PC afterwards, you'll find two files in the root of your \dap.
Copy the 256KB-sized file named \fname{internal\_rom\_2000000-203FFFF.bin} to
a safe place.

\subsubsection{Flashing}

\begin{enumerate}
\item Download the correct package for your \dap\ from
  \url{http://download.rockbox.org/bootloader/archos/}. It is named
  \fname{flash-{\textless}model{\textgreater}-{\textless}version{\textgreater}.zip}.
  The current packages are v2.
\item Unzip the flash package to the root of your \dap.
  \nopt{ondio}{This will extract two files to the root,
    \fname{firmware\_{\textless}model{\textgreater}.bin} and
    \fname{firmware\_{\textless}model{\textgreater}\_norom.bin}. The flash
    plugin will select the correct one for your \dap.
  }
  \opt{ondio}{This will extract one file to the root,
    \fname{firmware\_{\textless}model{\textgreater}.bin}.
  }
  \opt{recorder,recorderv2fm}{(The {\textless}model{\textgreater} part is
    slighty different from that in the .zip file name.)
  }
  Now safely disconnect USB.
\item
  \nopt{ondio}{Make sure your batteries are in good shape and fully charged.}
  \opt{ondio}{Make sure you use a set of fresh batteries.}
  Flashing doesn't need more power than normal operation, but you don't want
  your \dap\ to run out of power while flashing.
\item Select \setting{Plugins $\rightarrow$ Applications}, and run the
  \fname{firmware\_flash} plugin. It will tell you about your flash and
  which file it is going to program. After pressing
  \opt{RECORDER_PAD}{\ButtonFOne}\opt{PLAYER_PAD}{\ButtonMenu}\opt{ONDIO_PAD}{\ButtonLeft}
  it will check the file. If the file is OK, pressing
  \opt{RECORDER_PAD}{\ButtonFTwo}\opt{PLAYER_PAD}{\ButtonOn}\opt{ONDIO_PAD}{\ButtonUp}
  will give you a big warning. If we still didn't manage to scare you off, you
  need to press 
  \opt{RECORDER_PAD}{\ButtonFThree}\opt{PLAYER_PAD,ONDIO_PAD}{\ButtonRight}
  to actually program and verify. The programming takes just a few seconds.
\item In the unlikely event that the programming or verify steps should give
  you any error, \emph{do not switch off the box!} Otherwise you'll have seen
  it working for the last time. While Rockbox is still in RAM and operational,
  we could upgrade the plugin via USB and try again. If you switch it off,
  it's gone.
\end{enumerate}

\note{After successful flashing you may delete the \fname{.bin} files from the
  root of your \dap.
}

\subsection{Updating the Rockbox Image in Flash}

When Rockbox is booted from flash, it does not check for an updated firmware
on disk. This is one of the reasons why it boots faster than the \playerman\
firmware. It means that whenever you update Rockbox, you also need to update
the image in the flash. This is a simple and safe procedure:

\begin{enumerate}
\item Download (or build) the Rockbox build you want to use, and unzip it to
  the root of your \dap. Safely disconnect USB.
\item ROLO into the new rockbox version.
\item Go to the file browser, and enter the \fname{.rockbox} directory (you
  might need to set the \setting{File View} option to \setting{All}.)
\item Play the file \fname{rockbox.ucl}\opt{rombox}{, or preferably
  \fname{rombox.ucl}}, and follow the instructions. The plugin handling
  this is \fname{rockbox\_flash}, a viewer plugin.
\end{enumerate}

\subsection{Restoring the Original Flash ROM Contents}

In case you ever want to restore the original flash contents, you will need
the backup file. The procedure is very similar to initial flashing, with the
following differences:

\begin{enumerate}
\item Check that you do not have any \fname{firmware\_*.bin} files in your
  \dap's root.
\item Select \setting{Plugins $\rightarrow$ Applications}, and run the
  \fname{firmware\_flash} plugin. Write down the filename it displays in the
  first screen, then exit the plugin.
\item Connect USB, and copy the flash ROM backup file to the root of your
  \dap. \emph{Only use the backup file from that very box, otherwise you're
  asking for trouble!} Rename the file so that it matches the name requested
  by the \fname{firmware\_flash} plugin. Safely disconnect USB.
\end{enumerate}

Now follow the instructions given for initial flashing, starting with step 3.