Jump to content

Help Understanding Nexus One OS Structure / Bootstrapping?


Guest Michael Spencer Jr.

Recommended Posts

Guest Michael Spencer Jr.

This is my first post and I hope this isn't in the wrong place. (Then again I just donated 10 GBP to get access to the rom kitchen, so maybe I'm allowed one embarrassing newbie mistake. Just one.) I'm a Computer Science grad student, and I'm frustrated that I don't yet feel like a master of this device. I'd like to know what makes it tick, what failure recovery behaviors I can count on if I mess up, etc.

How is the device structured, and what parts do what when the phone boots?

I know my understanding is flawed but this is what I currently believe to be true. I invite corrections -- or even a link and a firm but polite "RTFM."

Flawed wild guess follows:

Memory areas are: read-only "boot" firmware and protected storage for the firmware; partitioned and variously-protected NAND flash; protected radio-controller flash; and unprotected microSD storage.

The phone's 1 GB of NAND flash is itself partitioned into memory areas for a recovery partition, a recovery kernel, a kernel for normal use, a normally-read-only system partition for core system services, and a read-write user data area.

If I was a complete moron, or I was as deliberately destructive as I could possibly be, then no matter what insanity I tried to write to NAND flash I can always connect a USB cable, hold the trackball and boot into fastboot, and reflash with fastboot. Right?

Or maybe: no matter what I do, as long as I don't corrupt the recovery partition, recovery kernel, and radio-controller flash I can always reflash with fastboot.

Or something else is true and I completely misunderstand.

In a normal factory-new configuration, the read-only firmware that manages "fastboot" will only write memory images containing a valid Google signature. After 'fastboot oem unlock' the firmware is willing to flash any memory image, corrupt or otherwise, regardless of signature.

Also in a normal factory-new configuration the recovery partition is loaded with a recovery system that will only flash update zip files bearing valid Google signatures. If you want to use recovery to flash unsigned packages you need a custom recovery image like Ra's.

The factory Linux kernel contains no known priviledge-escalation vulnerabilities that would allow someone to gain root without performing a modification, and all modifications at some level will require 'fastboot oem unlock'. A replacement operating system image would have setuid/setgid binaries, allowing root access, which allows loading arbitrary kernel modules that can change the phone's behavior in interesting ways. (Wifi driver with more features, loop device support, etc.)

There's more to learn about OS internals. I have Conder and Darcey's Android Wireless Application Development sitting here taunting me and I don't have enough time to spare to dig into it yet. I'm not trying to get someone to summarize the whole book in one forum post -- I'll learn more when I go through that book.

But functionally, for the end users here, it seems like there are interesting service mismatches possible if you do like I've just done and start flashing kernels and OS images from various projects without regard for what came from where made by whom.

-----------------

OK, I think in all I've said there, there are enough mistakes to keep someone busy for a while. How close to reality am I? Would you mind helping me correct my mistakes?

Ultimately what I want is a full Linux system in my pocket, a huge e3fs/e4fs loopback filesystem mounted, full of every tool under the sun. GCC, full storage-hungry memory-hungry versions of command line tools, the works. But I won't be able to properly use, let alone create, that kind of system until I understand what I have.

(Plus the phone is amazingly capable out of the box, and I can't seem to stop playing with it like an end user. There's not that much it can't already do. Other than, say, run Asterisk and auto answer all incoming calls with an IVR, and only ring the phone if people can prove they aren't telemarketers. (Solicitors? You know what I mean.))

Thanks in advance for your help!

Link to comment
Share on other sites

Guest Michael Spencer Jr.

I know everyone is busy with new roms and online kitchens and whatnot. Maybe I shouldn't ask such a demanding set of questions.

How about instead: does anyone know where I can go to learn about these things? Any reference threads you recommend? Any books to buy? I want to be told to "RTFM" but have been unable to find a FM to R. (F being Fine of course. :-) )

Link to comment
Share on other sites

Guest DistortedLoop
I know everyone is busy with new roms and online kitchens and whatnot. Maybe I shouldn't ask such a demanding set of questions.

How about instead: does anyone know where I can go to learn about these things? Any reference threads you recommend? Any books to buy? I want to be told to "RTFM" but have been unable to find a FM to R. (F being Fine of course. :-) )

Maybe the xda-developers forums?

Link to comment
Share on other sites

Guest Michael Spencer Jr.

I tried there first, actually, before I made an account here. I read all the stickied threads I could, tried to read through various development threads. It felt like much of what they wrote was intended to be understandable to their peers who had been following the many pages of threads up to that point, but not really understandable to someone wanting to bring themselves up to speed from nothing.

I've learned a lot here since then though -- I'll check again.

There aren't any non-forum FAQ's or information sources for what I want, are there? I'm probably asking for something that doesn't exist yet. Sorry. :-(

Edit: at least half of my questions are answered here: http://forum.xda-developers.com/showthread...561#post5381561

Leaving this here because I definitely deserve to be shamed publically for this. Wow. I'm positive I've read that once before and I must've not understood it or not retained some of the info.

Edited by Michael Spencer Jr.
Link to comment
Share on other sites

Guest DistortedLoop
Leaving this here because I definitely deserve to be shamed publically for this. Wow. I'm positive I've read that once before and I must've not understood it or not retained some of the info.

Don't leave it here for the public shame, leave it here to help others who follow and are having trouble where to look themselves.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.