Something helpful for those who are interested (but don't know where to start) in the "porting openiboot to other devices" task under "Jobs for Reverse Engineers".....
Base addresses, GPIO ports, i2c slave addresses, interrupt numbers, clock gates, etc. will all be available from ioreg -l on your jailbroken device. Check your ioreg -l output with the ioreg -l / device tree outputs of already ported platforms to see quickly which drivers are likely to be compatible with merely some constants changed, and which will need to be rewritten.
If you have an iPhone uart cable, you can port the uart driver early… it’s very simple. This will save you a lot of pain debugging.
Step 1. Figure out how to reboot the device. This is usually done by writing a value into a WDT register, but could be verified by reversing cmd_reboot in iBoot.
Step 2. Change the “Constants” in includes/hardware/s5l8900.h to reflect the basic memory layout of your hardware if necessary. Most likely this does not need to be changed provided the MIU was properly configured before openiboot is called.
Step 3. Make sure PeripheralPort in includes/hardware/s5l8900.h is set to the right place. You can find out by reversing iBoot and finding where it sets the peripheral port remap register early on.
Step 4. Figure out where the MIU configuration register is and which MIU setting to use to make sure SDRAM is mapped to 0×0. This can also be most likely found in iBoot. The MIU is one of the devices labeled /arm-io/clkrstgen in the iPhone’s device tree. Change the instructions at the beginning of entry.S, miu_setup, and clock_set_bottom_bits_38100000 with this new information. You may attempt to make the assumption that the MIU is still at the same place and/or has the same register offsets/values.
Step 5. Put a reboot early on in entry.S and progressively move it back, troubleshooting as you go, until you reach C code (OpenIBootStart). This is the first major landmark.
Step 6. Port over clock.c, power.c, timer.c, interrupt.c and the interrupt handling code in entry.S. Most likely you just need to change the base addresses in their respective includes/hardware/*.h. Use the event.c code (which is platform independent) to try to schedule a reboot 10 seconds after you launch openiboot. (make sure you comment out everything you haven’t ported and add a while(1); at the end of your code). If this works, the timer, clock and interrupts all work. These are very important basic services for the other drivers. Use a combination of the reboot code you worked out in step 1 and while(1)s to troubleshoot, they will be your only form of feedback for now.
Step 7. Port over usb.c. Again, you can probably just change the base address of the USB code and it will work. Once that is done, you can re-enable all the command line parsing code. If the openiboot command line code works, then you have a basic bring-up!
Step 8. Port over the GPIO driver. You can test its workings by checking the button states. You need this for a whole bunch of devices.
Step 9. Port over the i2c driver. Test with the accelerometer. This is needed for the PMU and LCD among other things.
Step 10. Port over the pmu driver. This is a good application of the i2c driver, and you need it to control the backlight.
Step 11. Port over the SPI driver. Most notably, this is used for the LCD driver and probably NOR on new ports. No easy way to test this in isolation so you’ll want to do it concurrently with step 13.
Step 13. Port over the NOR driver. It might “just work” when the SPI driver does.
Step 14. Port over the LCD driver. This is probably one of the trickier parts. I had to check the actual iBoot disassembly for my ports here. However, it only took an hour or so to get working.
Step 15. Port over the DMA controller. There probably won’t be any changes, but who knows.
Step 16. Port the rest. There aren’t any surprise dependencies. sdio → wan, radio → uart and that’s about it.
Popular Posts
- 199 iphone wall paper
- Scanbuy Announces Addition to Its Board of Directors
- Millions of Names Available for .Co Open Registration
- YouTube Mobile 3G Enhancements & Java Beta Launchd.
- What a wonderful Second Life!
- Google Wave: First impressions
- Nokia N8 + Bluetooth Keyboard + Mouse
- Developers unhappy over Oracle Android suit
- Caribou Coffee to Use Cellfire for Mobile Coupon Offer
- Catching up: 8 random things about me
0 comments:
Post a Comment