Mood: :borg:

Update: The latest ipodpatcher.exe doesn’t seem to work properly with this batch file, so I suggest using the Rockbox Installer X to install the boot loader into your iPod.

I recently installed Rockbox on my iPod, which allows for skinning, playing of GameBoy games, and lots of other options. It’s not perfect, but I can dual-boot back into the original Apple firmware, which is nice.

The installation of the Rockbox bootloader on your iPod is a very manual procedure, so I dusted off the old school DOS skills and made a batch file that will handle steps 1b through 1g of the Rockbox iPod installation. It works in WinXP with my iPod Photo, but I followed the instructions for all supported models so it should work for everyone (crosses fingers).

Here are the batch file contents. Please copy and paste it into Notepad, then save the file as install.bat in your C:\Rockbox folder. It assumes you’ve already followed step 1a and put the required files in the same folder.



@echo off
REM Rockbox iPod install batch file
REM By Jim Allison (jim@holycow.com)

REM Clear the variables
set device=
set ipod=

cls

REM Check for the executables. If either not found, exit.
if not exist C:\Rockbox\ipodpatcher.exe goto error_ipodpatcher
if not exist C:\Rockbox\ipod_fw.exe goto error_ipod_fw

echo -------------------------------------------------------------------
echo This is a batch file to help install Rockbox on an iPod in Windows.
echo _
echo Please plug in your iPod now, and press any key once
echo it appears as a drive in your Windows Explorer.
echo _
echo Press Ctrl-C to exit
echo _
pause

C:
cd \Rockbox

REM Check for the bin files. If none found, exit. If any found, assume the last one, but ask to make sure.
if exist bootloader-color.bin (
set ipod=Color/Photo
) else (
if exist bootloader-4g.bin (
set ipod=4G-Grayscale
) else (
if exist bootloader-nano.bin (
set ipod=Nano
) else (
if exist bootloader-video.bin (
set ipod=Video/5G
) else (
goto error_nobins
)
)
)
)

cls
echo --------------------------------------------------------------
echo You have the bin file for the
echo _
echo iPod %ipod%.
echo _
echo If this is not your iPod model, please press Ctrl-C to
echo terminate this batch file and make sure only the bin
echo file for your particular iPod model is in C:\Rockbox:
echo _
echo iPod Color/Photo: bootloader-color.bin
echo iPod 4G (Grayscale): bootloader-4g.bin
echo iPod Nano: bootloader-nano.bin
echo iPod Video/5G: bootloader-video.bin
echo _
pause

del temp*.txt

REM Run through drives 0-5 via iPodPatcher
ipodpatcher 0 > temp0.txt
ipodpatcher 1 > temp1.txt
ipodpatcher 2 > temp2.txt
ipodpatcher 3 > temp3.txt
ipodpatcher 4 > temp4.txt
ipodpatcher 5 > temp5.txt

REM Parse temp files for signs of an iPod
for /F "tokens=1,2,3" %%l in (temp0.txt) do if "%%l"=="Part" if "%%m"=="Start" if "%%n"=="Sector" set device=0
for /F "tokens=1,2,3" %%l in (temp1.txt) do if "%%l"=="Part" if "%%m"=="Start" if "%%n"=="Sector" set device=1
for /F "tokens=1,2,3" %%l in (temp2.txt) do if "%%l"=="Part" if "%%m"=="Start" if "%%n"=="Sector" set device=2
for /F "tokens=1,2,3" %%l in (temp3.txt) do if "%%l"=="Part" if "%%m"=="Start" if "%%n"=="Sector" set device=3
for /F "tokens=1,2,3" %%l in (temp4.txt) do if "%%l"=="Part" if "%%m"=="Start" if "%%n"=="Sector" set device=4
for /F "tokens=1,2,3" %%l in (temp5.txt) do if "%%l"=="Part" if "%%m"=="Start" if "%%n"=="Sector" set device=5

if "%device%"=="" goto error_nopod

REM Create backup of original firmware
ipodpatcher -r %device% bootpartition.bin

if not exist bootpartition.bin goto error_backupfailed

REM Extract Apple's firmware from the bootpartition.bin image file
ipod_fw -o apple_os.bin -e 0 bootpartition.bin

if not exist apple_os.bin goto error_backupfailed

REM The iPod Video/5G has an extra firmware for the video decoder chip. This needs to be extracted:
if "%ipod%"=="Video/5G" ipod_fw -o apple_sw_5g_rcsc.bin -e 1 bootpartition.bin

REM Create Rockboot.bin, depending on the iPod model
if "%ipod%"=="4G-Grayscale" ipod_fw -g 4g -o rockboot.bin -i apple_os.bin bootloader-4g.bin
if "%ipod%"=="Color/Photo" ipod_fw -g color -o rockboot.bin -i apple_os.bin bootloader-color.bin
if "%ipod%"=="Nano" ipod_fw -g nano -o rockboot.bin -i apple_os.bin bootloader-nano.bin
if "%ipod%"=="Video/5G" ipod_fw -g video -o rockboot.bin -i apple_os.bin bootloader-video.bin

REM Install the bootloader!
ipodpatcher -w %device% rockboot.bin

cls
echo ---------------------------------------------------------------------------
echo Testing
echo _
echo You can now disconnect your ipod from your PC in the normal way.
echo This should cause your iPod to reboot.
echo _
echo You should now see a light blue screen with some tiny writing - this is the
echo Rockbox bootloader. Because you haven't yet installed Rockbox itself, the
echo bootloader will fail to start Rockbox and should then default to start the
echo original Apple firmware. If this happens, then all has gone well.
echo _
echo Do not delete C:\Rockbox\bootpartition.bin! It can be used
echo to restore your iPod to its original configuration.
echo _
echo Please complete the installation by following the instructions at
echo www.rockbox.org/twiki/bin/view/Main/IpodInstallation#Step_2_Install_Rockbox
echo _

goto end

:error_ipodpatcher
cls
echo -----------------------------------------------------------------
echo C:\Rockbox\iPodPatcher.exe not found!
echo This batch file assumes that your Rockbox files are in C:\Rockbox
echo Exiting...
goto end

:error_ipod_fw
cls
echo -----------------------------------------------------------------
echo C:\Rockbox\iPod_FW.exe not found!
echo This batch file assumes that your Rockbox files are in C:\Rockbox
echo Exiting...
goto end

:error_nobins
cls
echo -------------------------------------------------------------------------
echo No bin files found! Please download the appropriate bin file
echo for your iPod from http://www.rockbox.org/twiki/pub/Main/IpodInstallation
echo and save it into your C:\Rockbox folder.
echo _
echo iPod Color/Photo: bootloader-color.bin
echo iPod 4G (Grayscale): bootloader-4g.bin
echo iPod Nano: bootloader-nano.bin
echo iPod Video/5G: bootloader-video.bin
goto end

:error_backupfailed
echo Oops! Something went wrong with the backup process.
echo I'm not going to continue. Please try the manual procedure.
goto end

:error_nopod
cls
echo -----------------------------------------------------
echo ERROR!
echo I can't find your iPod! Please make sure your iPod is
echo plugged in and appears as a drive in Windows Explorer,
echo then try this batch file again. If it keeps failing
echo then try the manual procedure.
goto end

:end
del temp*.txt
pause



 

3 Comments to “Batch file to install the Rockbox bootloader for iPods”


  1. kenny — February 7, 2007 @ 2:30 am

    hey didnt work for me.
    i set all the files in the proper directory and hit run on the bat, but the command prompt just closes on me after the “press any key to continue”

  2. kenny — February 7, 2007 @ 2:31 am

    re update: oh, yea its probably cause of that

  3. Toby — July 17, 2007 @ 12:01 pm

    hey i copied this complete batch file into the rockbox but the same thing happened with me as it did with kenny. when i loaded the batch file up it said the ipodpatcher.exe was not found and then blah blah blah and it said press any key to continue which i did and it jus exited out.



Write a comment

Name