From 0a8d88228baf68c3bc515ca4a1add44aac7e5617 Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Sun, 10 Dec 2006 13:33:12 +0000 Subject: Remove unused code in (and hence simplify) the ipod bootloader - the image header parsing and memmove isn't used in Rockbox, it was just leftover from the original ipodlinux loader. Note that we still need the empty space in the bootloader (400 bytes starting at 0x100 - the 'boot_table' definition in firmware/target/arm/crt0-pp.S) to maintain compatibility with ipod_fw/make_fw (which will write information there that we have always ignored). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11704 a1c6a512-1295-4272-9138-f99709370657 --- bootloader/ipod.c | 57 +++++++------------------------------------------------ firmware/boot.lds | 4 ---- 2 files changed, 7 insertions(+), 54 deletions(-) diff --git a/bootloader/ipod.c b/bootloader/ipod.c index 26e5ae2937..878ef105b3 100644 --- a/bootloader/ipod.c +++ b/bootloader/ipod.c @@ -65,44 +65,8 @@ char version[] = APPSVERSION; -typedef struct _image { - unsigned type; /* '' */ - unsigned id; /* */ - unsigned pad1; /* 0000 0000 */ - unsigned devOffset; /* byte offset of start of image code */ - unsigned len; /* length in bytes of image */ - void *addr; /* load address */ - unsigned entryOffset; /* execution start within image */ - unsigned chksum; /* checksum for image */ - unsigned vers; /* image version */ - unsigned loadAddr; /* load address for image */ -} image_t; - -extern image_t boot_table[]; - int line=0; -static void memmove16(void *dest, const void *src, unsigned count) -{ - struct bufstr { - unsigned _buf[4]; - } *d, *s; - - if (src >= dest) { - count = (count + 15) >> 4; - d = (struct bufstr *) dest; - s = (struct bufstr *) src; - while (count--) - *d++ = *s++; - } else { - count = (count + 15) >> 4; - d = (struct bufstr *)(dest + (count <<4)); - s = (struct bufstr *)(src + (count <<4)); - while (count--) - *--d = *--s; - } -} - #if CONFIG_KEYPAD == IPOD_4G_PAD && !defined(IPOD_MINI) /* check if number of seconds has past */ int timer_check(int clock_start, unsigned int usecs) @@ -318,12 +282,8 @@ unsigned char loadbuffer[MAX_LOADSIZE]; void* main(void) { char buf[256]; - int imageno=0; int i; int rc; - int padding = 0x4400; - image_t *tblp = boot_table; - void* entry; struct partinfo* pinfo; unsigned short* identify_info; @@ -447,17 +407,14 @@ void* main(void) lcd_puts(0, line, "Loading original firmware..."); lcd_update(); - /* Pause for 5 seconds so we can see what's happened */ -// udelay(5000000); - - entry = tblp->addr + tblp->entryOffset; - if (imageno || ((int)tblp->addr & 0xffffff) != 0) { - memmove16(tblp->addr, tblp->addr + tblp->devOffset - padding, - tblp->len); - } + /* The original firmware should already be at the correct location + in RAM - the Rockbox bootloader has been appended to the end of + it, and the "entryOffset" in the firmware header modified to + tell the Apple bootloader to pass execution to our bootloader, + rather than the start of the original firmware - which is + always at the start of RAM. */ - /* Return the start address in loaded image */ - return entry; + return (void*)DRAM_START; } /* These functions are present in the firmware library, but we reimplement diff --git a/firmware/boot.lds b/firmware/boot.lds index f361e45e9e..556e8db990 100644 --- a/firmware/boot.lds +++ b/firmware/boot.lds @@ -7,15 +7,11 @@ INPUT(target/coldfire/crt0.o) #elif defined (CPU_ARM) OUTPUT_FORMAT(elf32-littlearm) OUTPUT_ARCH(arm) -#ifndef IPOD_ARCH -/* the ipods can't have the crt0.o mentioned here, but the others can't do - without it! */ #ifdef CPU_PP INPUT(target/arm/crt0-pp.o) #else INPUT(target/arm/crt0.o) #endif -#endif #else OUTPUT_FORMAT(elf32-sh) INPUT(target/sh/crt0.o) -- cgit v1.2.3