From: PALFFY D. <dpa...@ra...> - 2003-11-11 17:59:45
|
Hi! > Yeah I think those few optimisations would make things a little less painless. > In fact it would be nice to be able to switch either the Linux or the Apple > firmware first so you could choose your default for load speed :) Ok, here's the next version. It's optimized enough for our needs I think. It loads from 0x4400, so the first image doesn't have to be moved. However moving is optimized now, too. > I think you can just re-write the boot table completely though (e.g without > caring for the flashupd image). If you want to update the flash then dd in > the original and run the updater.exe... Assuming people screw up and don't > save a backup I think the updater.exe does the equivalent of a dd anyhow. Ok, I'm doing this. However the first 512 bytes still have to be copied in from an original firmware. Do you know the meaning of those few bytes at 0x100? The text before doesn't seem to be important, but the first dword seems to be some magic number (it's included as a literal in the loader right after 0x55aa - the PC boot sector magic. I haven't disassembled it further yet). The other values seem to be required, too. > The best location for the stack is 0x40000000+stack_size. Thats the fast ram. Ok, done. > I haven't looked at the arm memmove in Linux but something using the > ldmia/stdmia and 4 or more registers should be pretty quick :) I've converted the memmove to move multiplies of 16 bytes (all images are aligned to sector boundaries, so it doesn't hurt), this is optimized to ldmia/stmia by gcc, and seems to be much faster than the original version. > Anyhow I'll take a look see in a few hours and see about giving it a whirl. Try this instead! Oh, I've nearly forgotten: This version can load up to 5 images, any of which can be the default, the others are load for the four keys on the top (or around the wheel). PS: I should really read ARM documentation before writing a boot loader... It's really funny to find out the hard way that the address of the current instruction is (pc & ~3) - 8 -- Dani ...and Linux for all. |
From: PALFFY D. <dp...@ra...> - 2003-11-11 18:10:01
Attachments:
ipodloader-0.1.tar.gz
|
Again, with attachment :) -- Dani ...and Linux for all. |
From: Bernard L. <le...@bo...> - 2003-11-11 21:03:54
|
Hi Dani, On Tue, 2003-11-11 at 18:59, PALFFY Daniel wrote: > > > I think you can just re-write the boot table completely though (e.g without > > caring for the flashupd image). If you want to update the flash then dd in > > the original and run the updater.exe... Assuming people screw up and don't > > save a backup I think the updater.exe does the equivalent of a dd anyhow. > > Ok, I'm doing this. However the first 512 bytes still have to be copied in > from an original firmware. Do you know the meaning of those few bytes at > 0x100? The text before doesn't seem to be important, but the first dword > seems to be some magic number (it's included as a literal in the loader > right after 0x55aa - the PC boot sector magic. I haven't disassembled it > further yet). The other values seem to be required, too. That reference in the bootloader is for the pdisk command which I would assume to be a command to partition the disk. Its not called by the startup. I can't see any other references to it in the bootloader... > > Anyhow I'll take a look see in a few hours and see about giving it a whirl. > > Try this instead! > > Oh, I've nearly forgotten: This version can load up to 5 images, any of > which can be the default, the others are load for the four keys on the top > (or around the wheel). > > PS: I should really read ARM documentation before writing a boot loader... > It's really funny to find out the hard way that the address of the > current instruction is (pc & ~3) - 8 :) <http://www.arm.com/techdocs.nsf/html/ARM7Docs> The one called ARM7TDM_Rev4.pdf covers pretty much everything you need to know. cheers, bern. |
From: PALFFY D. <dpa...@ra...> - 2003-11-11 21:45:04
|
On Tue, 11 Nov 2003, Bernard Leach wrote: > That reference in the bootloader is for the pdisk command which I would > assume to be a command to partition the disk. Its not called by the > startup. I can't see any other references to it in the bootloader... Dunno, haven't looked at it much. However with an empty first sector I get the folder icon. I still think there's something between 0x100 and 0x110. There are some non-zero bytes that don't yet make me much sense. > > PS: I should really read ARM documentation before writing a boot loader... > > It's really funny to find out the hard way that the address of the > > current instruction is (pc & ~3) - 8 > > :) > > <http://www.arm.com/techdocs.nsf/html/ARM7Docs> > > The one called ARM7TDM_Rev4.pdf covers pretty much everything you need > to know. I know, I was just lazy to read all of it... -- Dani ...and Linux for all. |