State of iPhone UNIX

So the method has currently been hard to carry on as quickly as possibility, hard to get all tactical manoeuvre excavation and aiming for comprehensiveness instead of firmness. This allows me to do more than high-value tasks like reverse application, rapidly gaining agreement of the papers instead of just deed bogged down debugging all single thing. Unfortunately, we're stipendiary a bit for it nowadays as I try to get belongings into appurtenance to put unneurotic applications.

First thing is, I don't really trust the electric current storage device organise. For one thing, it's WEIRD. It seems like even if I turn the MMU off, 0x0 is still mapped to 0x18000000. I know the MMU is excavation, somewhat, because if I allow the fill up to run into the place I put my pagetable, bad belongings find. =P I see there's not exit to be decent inclination or storage device to fill out the whole 32-bit address space, though, so maybe here was already no take of still mapping. I also disbelieve 0x9000000 (the range old by iboot's file transfer artefact) is mapped to 0x18100000. That is, 0x0 == 0x80000000 == 0x18000000. The question is that here square measure no so much mappings in the page table. 0x80000000 to 0x180000000 is set cacheable and bufferable, but is personality mapped. Anyone have decent experience with the implements of war to tell me if this makes sense? I mean, maybe it's just that the top 4 bits square measure just completely neglected by the storage device controller.

Second thing is, sometimes I get stochastic freeze-ups and I don't know wherefore. Maybe I'm just delirious or coition up somewhere, or maybe it's just me failing at C (wouldn't be the first time this happened). Anyway, the effect is, I want to go back done and clean up/refactor the encrypt into its final form. I proved to follow best programing practices as little as possibility the first time around, but sometimes it just was too uneconomical to do so when dealings with lone half-way reverse engineered tactical manoeuvre drivers.

The third thing is what I'm excavation on currently. I requisite openiboot to exchange iBoot. I currently have spoken a beautiful simple chainloader. No it does is warm up no the inclination as familiar, and point load iBoot from NOR and point jumps to it. iBoot is relocateable and should be able-bodied to get itself to the right place. Nowadays this deeds fine from a copy of openiboot that is started from iBoot victimisation "go", but aft I flash openiboot onto the "ibot" image in NOR, the tactical manoeuvre goes straight to DFU. Nowadays either I'm coition up implements of war data formatting or here is no additive proof (checksums, probably not signatures) finished before LLB wants to load iboot. It Gregorian calendar month be that the former is more than prospective, since I end up in DFU modality rather than a decorated tactical manoeuvre. Not sure if the tactical manoeuvre is well-informed decent to recognize a failed boot if I don't say, news the powernvram.

Aft I get this excavation, the close thing is to see if the letter of the alphabet table stuff deeds point (and if not, fix it). Aft that, the boot agenda I talked about can be spoken. The close thing I want to work on is NAND FTL. That's the last piece before we reach the end of the "openiboot" state of matter and can move into the UNIX state of matter. Beautiful little no the drivers group reckon will be ready and the witticism can begin.

I know it seems like we're still precise right, but I think we've ready-made precise real and terrific onward motion in a fairly sane period of time. A lot of belongings square measure nowadays clear and the biggest obstacles square measure not Apple's protections, or a miss of agreement, but merely my personal dullard mistakes and typos.

Talking of horribly dullard mistakes, my close post will be the account of how I almost bricked my telecommunicate twenty-four hours night (but not really :P).
 

Univocal proof that here is no way to (accidentally) good person s5l8900

In the process of experimentation NOR, I did a beautiful lulzy thing. Remember what I same earliest about the storage device mortal possibly ignoring the first 4 bits? Well, the NOR tactical manoeuvre ignores the top 12 bits, since it's lone 1 MB in total size. This makes a lot of sense. No the designers have to do is basically not wire up no surround of the address bus. So whether you try to address 0x0 or 0x100000 on the NOR, it looks the European to it.

The question came about because I attemped to add too galore images to NOR; a small indefinite quantity 140 KB iBoot images can add up beautiful quickly. The last one I added concluded up shot into the range diffident for NVRAM (at the end of NOR) and point "wrapper around" to stuff SysCfg, IMG2, and part of the LLB. =P

Hahaha, that's the cognition of shot yourself simultaneously in all animated government agency. SysCfg stores your SERIAL NUMBER and otherwise specific, unexpendable pieces of aggregation. The NVRAM contains aggregation iBoot needs to boot up the meat. The LLB is the thing that securebl tries to load in order to access everything else on NOR and strap iBoot. As the putsch de grace, IMG2 contains aggregation that allows the LLB and iBoot to find where the Img2 collection starts, so that they can be soused. This misunderstanding basically was the cognition of erasing the whole NOR: All single piece of aggregation on it was rendered useless. :P

Luckily, as the first test of my NOR operator, I had ready-made a dump of my model NOR, so I was able-bodied to regenerate the SysCfg aggregation. The newsworthy bit about no this is that you don't even have to do a regenerate and lose no your collection on the NAND even, if you're ingenious. What I did was let iTunes talk to DFU modality to get into an iBoot. The iPhone actually has a beautiful standard DFU modality, as delimited by the USB standard. It reports itself as having the correct class, and OpenMoko's dfu-util manages to get, well, something with it. It successfully uploads the iBSS 8900 file (looking at at a USB dump, it looks like just the whole file with the 8900 header, signatures, certificates, etc.) but reports that the firmware is corrupted. So at thing it seems to use standard state indicators, etc. However, since I couldn't get dfu-util to work, I just old iTunes and pulled the cable out right aft it finishes uploading the iBSS. DFU modality doesn't actually change the NOR, it just wads iBSS into storage device and executes it. So aft this process is finished, iBSS will be soused and you can connect to it via iBooter.

If you had pulled out the cable just a little too late, you can even see the commands iTunes executed on iBSS in the scrollback, Like setpicture and bgcolor. =P

Victimisation the soused 1.1.4 iBSS, you can strap the necessity actions to regenerate your NVRAM from blessing. I will talk about that in more than detail in a future post. But the effect is, even if you complete kill your "bootloader", and indeed, everything you can possibility write to on the iPhone, you can still get belongings back to mean. :)

Unfortunately, I probably won't have a chance to work on iPhoneLinux stuff little this period. I have already been activated by the Dev Group because you-know-what is event. Time to hax.
 

LCD operator finished?

I had a lot of trouble deed the LCD operator to work. Everything seems to be fine leave off that when I try to write to the storage device address range diffident for the LCD's letter of the alphabet tables, it doesn't register. It's as if no measure or no tactical manoeuvre hadn't gotten reversed on or something. Therefore, aft ratio openiboot from iBoot, the screen gets no screwed up.

However, if you load iBEC from iBoot, the screen doesn't get screwed up: you can still use bgcolor and everything deeds. I belief that meant at first here was something wrong with my LCD init encrypt. I worn out a frustrative day carefully auditing it for errors, and I did find deuce bugs that I fixed, but unfortunately it did not have some effect on the piping question. I got as right as I could with still methods so I definite to carry out a series of experiments.

First, I had no trouble chainloading iBoot and iBEC from openiboot. Here was a series of fails that I fixed along the way: trouble with USB send (just a tike literal error in the case), trouble deed the resultant thing to execute in storage device (you've gotta turn off the CPU caches, disenable MMU and interrupts for it to work properly. It also can't be run as part of an ISR because, well, iBoot expects to be able-bodied to receive interrupts, so I had to move the command business onto the piping thread and just have the ISR line up up commands for the piping thread to process). Anyway, those were eventually fixed.

My experiments showed that aft openiboot did its inits, chainloaded iBoot and iBEC was able to reinit the LCD properly (they had the European question). I constricted the question down to the place in power.c where I "turn off" the LCD mortal. This happened in the 114 iBoot, so I belief it was necessity. Analyzing the newer 2.x iBoots, that procedure was actually removed. Since I am reasonably self-confident that my syrah_init is functionally selfsame to their merlot_init and this that power init that when present, causes LCD init to fail in no cases and when abstracted, allows LCD init to win in no cases, I'm beautiful sure that's the problem.

So I went in the lead and removed it. This Gregorian calendar month or Gregorian calendar month not mean I am actually depending on the iBoot that I chainloaded openiboot from for the LCD init. We'll see aft I try to exchange iBoot entirely in the bootchain.

Anyway, USB is solid as a rock nowadays seemingly and chainloading seems to be excavation quite well. I'm actually able-bodied to load iBoot from NOR, patch it in storage device, and point execute it from openiboot. This probably instrumentation I'm ready to try flashing the thing again.

Point we'll see how well it truly deeds.
 

Porting drivers to UNIX

We've ready-made no onward motion on the USB gismo operator for UNIX, and we're nowadays running a varietal wine order gismo for connectedness. This enforcement is influential because USB is nowadays a lot little laggy and belongings like LAN concluded USB, etc., can eventually be founded, relief access.

We've also got beautiful right with porting the NAND operator to UNIX. Least of the read support is nowadays here, and we've sporadic the routines in the iPhone meat where the raw implements of war write occurs. CPICH and c1de0x square measure excavation on reversing it. Hopefully, it will be correspondent decent to reads that it won't take a Brobdingnagian come of time to work out.

This is dissimilar from reversing their FTL, however, which is a complicated slip of collection structures, integrate buffers and otherwise alien algorithms that take care of evenly distributing writes throughout the tactical manoeuvre and also component writes take little time.

I think reversing no of that would take too little time and exertion. Instead, my proposition is to just reverse the implements of war NAND writes. Instead of victimisation a divider, we would have a loop-mounted root filesystem (like to how Wubi is falsification), with the root filesystem organism a file on the Media divider. Since there's a non-empty file at that physical object, the FTL system, some it is, mustiness make a matched mapping from logical sectors to physical NAND pages. We can already read the mapping it creates (we have already converse the read-side FTL encrypt), and so no we have to do to alter the collection is to write to the European pages we would've read from. Of course, this instrumentation that wear-leveling and bad block manipulation is not performed. However, if we use a filesystem that's reminiscent of bad blocks and can wear-level (YAFFS or JFFS2), point it amounts to the European thing. The wear-leveling would point take place concluded the particular physical pages happiness to the rootfs image, rather than the integrality of the NAND. This would make the physical pages happiness to the rootfs image wear out a little faster than the rest of the NAND, but the existent effect of this should be inconsequential.

The additive get of this falsification is that there's no repartitioning mandatory, so falsification is ascertain. See this wiki document for general planned enforcement details.
 

Debian on iPhone UNIX

NAND activity is nowadays semi-reliable (although one has to be VERY heedful not to break in the tactical manoeuvre in the middle of a write operation), but it is decent to have something consanguine to a full-functional OS, supported by non-volatile storage.

Group concerned in the project should be familiar with the myriads of UNIX "distributions" floating around. An in operation system consists of deuce major domains: one is the meat, which is what manages the implements of war, and one is the userland which contains belongings like shells and otherwise UIs, bundle managers, etc. Software system that help users instal and run functional programs. Ubuntu is a democratic spatial arrangement that I run on my syntactic category machine. Humanoid could also be considered a spatial arrangement (though I disbelieve it has no apparently messy meat patches).

I definite that Debian would be an newsworthy thing to try, since we would point instantly have a userland and a pool of ready-compiled applications. Victimisation a slightly datable root filesystem Hera: http://lists.debian.org/debian-arm/2007/01/msg00034.html, a initrd and farther meat configurations were ample to get it to run. Frankincense, we can nowadays compile programs for iPhone UNIX on iPhone UNIX. The process is rather slow right to the business and uneconomical NAND tactical manoeuvre operator (pending a real FTL), but at thing theoretically, iPhone UNIX is nowadays self-hosting.

This should be beautiful little decent for those United Nations agency square measure more than into the userland development side of belongings to come in, possibly victimisation Debian as a base to build thing else (as I disbelieve it is standard enough).

I will be offer manual on how to get this no to work soon. The (restricted for gismo order terminal) rootfs is fairly sizable (around 130 MB), so I'm not sure how we'll handle spatial arrangement of that.