blob: c424f7e617b3c9ad19720769ebfae7fd7446a26c [file] [log] [blame]
Cástor Muñoz346423c2016-02-04 23:05:17 +01001mks5lboot
2---------
3
4A tool to install/uninstall a dual bootloader into a s5l8702 based
5device:
6
7 - iPod Classic 6G
Cástor Muñozfbbba922017-05-04 10:52:03 +02008 - iPod Nano 3G (WIP)
Cástor Muñoz346423c2016-02-04 23:05:17 +01009
10
11Usage
12-----
13
14 mks5lboot --bl-inst <bootloader.ipod> [-p <pid>] [--single]
15 --bl-uninst <platform> [-p <pid>]
16 --dfuscan [--loop [<sec>]] [-p <pid>]
17 --dfusend <infile.dfu> [-p <pid>]
18 --dfureset [--loop [<sec>]] [-p <pid>]
19 --mkdfu-inst <bootloader.ipod> <outfile.dfu> [--single]
20 --mkdfu-uninst <platform> <outfile.dfu>
21 --mkdfu-raw <filename.bin> <outfile.dfu>
22
23Commands:
24 --bl-inst Install file <bootloader.ipod> into an iPod device
25 (same as --mkdfu-inst and --dfusend).
26 --bl-uninst Remove a bootloader from an iPod device (same as
27 --mkdfu-uninst and --dfusend).
28
29 --dfuscan scan for DFU USB devices and outputs the status.
30 --dfusend send DFU image <infile.dfu> to the device.
31 --dfureset reset DFU USB device bus.
32
33 --mkdfu-inst Build a DFU image containing an installer for
34 <bootloader.ipod>, save it as <outfile.dfu>.
35 --mkdfu-uninst Build a DFU image containing an uninstaler for
36 <platform> devices, save it as <outfile.dfu>.
37 --mkdfu-raw Build a DFU image containing raw executable
38 code, save it as <outfile.dfu>. <infile.bin>
39 is the code you want to run, it is loaded at
40 address 0x2200030c and executed.
41
42 <bootloader.ipod> is the rockbox bootloader that you want to
43 install (previously scrambled with tools/scramble utility).
44
45 <platform> is the name of the platform (type of device) for
46 which the DFU uninstaller will be built. Currently supported
47 platform names are:
48 ipod6g: iPod Classic 6G
49
50Options:
51 -p, --pid <pid> Use a specific <pid> (Product Id) USB device,
52 if this option is ommited then it uses the
53 first USB DFU device found.
54 -l, --loop <sec> Run the command every <sec> seconds, default
55 period (<sec> ommited) is 1 seconds.
56 -S, --single Be careful using this option. The bootloader
57 is installed for single boot, the original
58 Apple NOR boot is destroyed (if it exists),
59 and only Rockbox can be used.
60
61
62Dual bootloader installation
63----------------------------
64
65Prerequisites:
66
67 - An iPod Classic 6th with Apple firmware installed and running, current
68 supported FW versions for existing models:
69
70 Classic 6th 80/160 Late 2007 (1G): 1.1.2
71 Classic 6th 120 Late 2008 (2G): 2.0.1
72 Classic 6th 160 Late 2009 (3G): 2.0.4
73 Classic 6th 160 Late 2012 (4G): 2.0.5
74
75 - If your iPod is formated using Apple partitions you must convert this
76 ipod to FAT32 format (aka a "winpod"), see http://www.rockbox.org/
77 wiki/IpodConversionToFAT32
78
79 - It is recommended to install the RB firmware before installing the dual
80 bootloader for the first time. Install Rockbox using RockboxUtility or
81 download the latest daily build and uncompress it into the root folder
82 of the iPod.
83
84 Windows only:
85
86 - If iTunes is installed:
87 . Configure iTunes: Summary -> Options -> check "Enable disk use".
88
89 - If iTunes is not installed:
90 . You need a DFU USB driver for your device. To check if there is a
91 valid USB driver installed, put your device on DFU mode and choose
92 one of either:
93 a) Use Windows Device Manager to verify if you USB DFU device is
94 present.
95 b) Use mks5lboot tool running "mks5lboot --dfuscan", common output:
96 . When the DFU device is found and a valid driver is installed:
97 [INFO] DFU device state: 2
98 . When the device is found but there is no driver installed:
99 [ERR] Could not open USB device: LIBUSB_ERROR_NOT_SUPPORTED
Cástor Muñozfbbba922017-05-04 10:52:03 +0200100 . When the device is found but driver is not valid (probably a
Cástor Muñoz346423c2016-02-04 23:05:17 +0100101 libusb-win32 driver is installed):
102 [ERR] Could not set USB configuration: LIBUSB_ERROR_NOT_FOUND
103 . If there is no valid DFU driver installed, try one of these:
104 a) Use Zadig (http://zadig.akeo.ie/) to build and install a WinUSB
105 (libusb.info) or libusbK driver for your device. Note that
106 libusb-win32 (libusb0) drivers are not valid for mks5lboot.
Cástor Muñozfbbba922017-05-04 10:52:03 +0200107 b) Use Apple Mobile Device USB driver (included with iTunes). To
108 install this driver without iTunes see https://www.freemyipod.org
109 /wiki/EmCORE_Installation/iPodClassic/InstalliTunesDrivers
Cástor Muñoz346423c2016-02-04 23:05:17 +0100110
111Command line install:
112
113 - If you are using iTunes on Windows, close iTunes and kill (or pause)
114 iTunesHelper.exe before entering DFU mode.
115
Cástor Muñozfbbba922017-05-04 10:52:03 +0200116 - If you are using iTunes on Mac, quit iTunes and kill (or pause) the
117 iTunesHelper process before entering DFU mode.
118 You can use "ps x | grep iTunesHelper" to locate the process <PID>,
119 use "kill -STOP <PID>" to suspend the process and "kill -CONT <PID>"
120 to resume it once the bootloader is installed.
121
Cástor Muñoz346423c2016-02-04 23:05:17 +0100122 - Put you device on DFU mode by pressing and holding SELECT+MENU buttons
123 for about 12 seconds.
124
125 You can notice when the device enters DFU mode running the next command
126 to scan the USB bus every second (press Ctrl-C to abort the scan):
Cástor Muñozfbbba922017-05-04 10:52:03 +0200127 ./mks5lboot --dfuscan --loop
Cástor Muñoz346423c2016-02-04 23:05:17 +0100128
129 - To install or update a bootloader, build the DFU installer and send it
130 to the device:
Cástor Muñozfbbba922017-05-04 10:52:03 +0200131 ./mks5lboot --bl-inst path/to/bootloader-ipod6g.ipod
Cástor Muñoz346423c2016-02-04 23:05:17 +0100132
Cástor Muñozfbbba922017-05-04 10:52:03 +0200133 When the DFU image is loaded and executed, the device emits an 'alive'
Cástor Muñoz346423c2016-02-04 23:05:17 +0100134 tone (2000Hz/100ms). When the bootloader is successfully installed then
135 a dual tone beep sounds (1000Hz/100ms+2000Hz/150ms) and the device
136 reboots. If something went bad then 330Hz/500ms tone is emited and the
137 device reboots. When three 330Hz tones sounds, it means that the NOR
138 got corrupted and the device must be restored using iTunes (should not
139 happen).
140
141 - To remove a previously installed bootloader, build the DFU uninstaler
142 and send it to the device:
Cástor Muñozfbbba922017-05-04 10:52:03 +0200143 ./mks5lboot --bl-uninst ipod6g
Cástor Muñoz346423c2016-02-04 23:05:17 +0100144
Cástor Muñozfbbba922017-05-04 10:52:03 +0200145 Notes:
146
147 - If USB access is denied, try to run the mks5lboot tool using a privileged
148 user (i.e. Administrator or root).
149
150 - On Windows, use 'mks5lboot' or 'mks5lboot.exe' instead of './mks5lboot'.
151
Cástor Muñoz346423c2016-02-04 23:05:17 +0100152
153
154Dual-Boot
155---------
156
157The purpose of this program is to provide dual-boot between the original
158firmware and the new (rockbox) firmware.
159
160The button press check is done ~800 ms. after power-up or reboot, then:
161
162 SELECT + MENU: resets the device after ~5 seconds, then if SELECT+MENU
163 remains pressed the device enters DFU mode after an
164 additional period of ~8 seconds.
165 SELECT + LEFT: enter OF diagnostics (after ~7 seconds).
166 SELECT + PLAY: enter OF diskmode (after ~7 seconds).
167 SELECT + RIGHT: enter bootloader USB mode.
168 MENU: enter OF
169 Hold Switch locked: enter OF (see below for details).
170 Any other combination: launch Rockbox.
171
172Switch current firmware:
173
174 Tries to behave like ipod Video, see http://download.rockbox.org/manual/
175 rockbox-ipodvideo/rockbox-buildch3.html#x5-290003.1.3
176
177 Apple is the current FW:
178 - Stop playback and wait a few seconds for hard disk spin-down.
179 - Press and hold SELECT+MENU, after ~5 seconds the player hard resets,
180 release the buttons when the screen goes black.
181
182 Rockbox is the current FW:
183 - Shut down the device using "Long Play" key press.
184 - Once the device is powered off, there are three ways to enter OF:
185 1) Press and hold MENU button for at least ~800 ms.
186 2) Turn on the Hold switch immediately after turning the player on,
187 it must be done before "Loading Rockbox..." message appears (~3
188 seconds from power-on). Be careful, if the hold switch is locked
189 when Rockbox starts then your RB settings will be cleared!
190 3) You can also load the original firmware by shutting down the
191 device, then clicking the Hold switch on and connecting the iPod
192 to your computer.
193
194
195Single-Boot
196-----------
197
198Use --single option if the Apple firmware is not installed on your iPod
199and/or you want to force the installation of the bootloader to use Rockbox
200as unique firmware. The single-boot installer writes the bootloader on the
201NOR with no previous check, the original Apple NOR boot is destroyed if it
202exists.
203
204To build the DFU single-boot installer and send it to the device:
205 mks5lboot --bl-inst --single /path/to/bootloader-ipod6g.ipod
206
207
Cástor Muñozfbbba922017-05-04 10:52:03 +0200208Build
209-----
Cástor Muñoz346423c2016-02-04 23:05:17 +0100210
Cástor Muñozfbbba922017-05-04 10:52:03 +0200211To build type 'make'.
Cástor Muñoz346423c2016-02-04 23:05:17 +0100212
Cástor Muñozfbbba922017-05-04 10:52:03 +0200213Linux needs libusb >= 1.0, use your package manager to install libusb.
214
215For Windows, to build with libusb support type 'make USE_LIBUSBAPI=1'.
216
217Tested on:
218 Linux: gcc-4.9.2 + libusb-1.0.19
219 Windows XP: mingw32-gcc-4.8.1 + libusbx-1.0.15
220 OS X 10.11: clang-7.3.0 + libusb-1.0.20
221 MXE: i686-w64-mingw32.static-gcc 5.4.0 + libusb-1.0.21
Cástor Muñoz346423c2016-02-04 23:05:17 +0100222
223
224Hacking
225-------
226
227See comments in mkdfu.c, ipoddfu.c, dualboot.c and bootloader/ipod6g.c for
228more information.