Samsung Moment
Find Your Forum
  
Welcome, Guest. Please login or register.
Did you miss your activation email?

News: Do you like Samsung Moment?
Advanced search
Scratch-Proof your Samsung Moment        Best Price on Sprint Phones      Screen Protection Latest Ringtone for your mobile
Pages: [1]
Print
Topic: New info on filesystem, flashing, and the future  (Read 7430 times)
glitch77
Jr. Member
**

Cookies: -1
Posts: 55


View Profile
« on: December 15, 2009, 07:22:06 PM »

First, let me start off by thanking peeps for his help and guidance. He is the real brains here.


We have solved the problem of not being able to read the RFS filesystem, say /dev/bml5 where /system is mounted. If you dump /dev/stl5, you get a FAT16 filesystem stripped of RFS completely. It can be mounted under linux and read with no problems. RFS is no longer a big issue, it's still an issue, but not a huge one.

The next item up for bids is custom kernels. As peeps allready posted, anything can be changed and built in. I flashed a kernel that has the following changes to default.prop

Code:
ro.secure=0
ro.debuggable=1
persist.service.adb.enable=1

This basically removes all security from the phone, and enables adb in places not normally accessible. This is dangerous and shouldn't be used on phones that are in the wild, as any program or script could do anything with you phone, against your will.


The last, and possibly most harmful news is that from what I can tell from hex editing the SBL (secondary boot loader) is that odin DOES NOT come into contact with the linux kernel at all. The serial data connection (google gadget 1.0) is built into the SBL, and listens for odin.

This in itself wouldn't be bad, except the SBL (in my opinion) is the ONLY way to remove the "LockTight" on the Samsung ONENAND. This is why we can write to /dev/bml* and not get anywhere. Once LockTight is set, there can be NO direct writing to the nand, period, until it is unlocked by proprietary Samsung code in the SBL. Thats why there is no 'recovery' or 'fastboot' or any of the normal Android emergency reflashing modes.

My theory, is that Sprint is forced to not release OTA updates because the Moment CANT be written to while the kernel is running, because there is no program that can remove the 'LockTight" setting other than the SBL. In the ONENAND documents, you see that the nand has to be reset with the LockTight setting removed to be able to be written to, this would mean taking the entire filesystem offline during an OTA update which just isn't feasible. I honestly believe that there is no way to write to the onenand without going through the SBL.

This doesn't doom us, we could disassemble the SBL and find ways to unlock the nand and leave it that way, but messing with the SBL is bad news, as it contains the only way to restore the phone. Without source it is basically too risky to edit, and we will never have its source.

But even this doesn't doom the whole thing either! We can still (in theory) make our own yaffs2 images and have odin burn them to the phone, but this means we need to know what odin, and more specifically the SBL are doing with these files. More investigation into the SBL is needed.
Logged
zefie
Pro Member
****

Cookies: 29
Posts: 458


View Profile
« Reply #1 on: December 16, 2009, 06:28:22 AM »

OTA patches could still be released, like how the Hero had a small patch. After all, the NAND is not completely locked, considering you are storing apps and user data onto /data, which is a nand partition.
Logged
glitch77
Jr. Member
**

Cookies: -1
Posts: 55


View Profile
« Reply #2 on: December 16, 2009, 09:39:11 AM »

Well yes, but I don't think they could push a complete android update (unless they don't update the kernel maybe?). I don't think /system is locked tight (need to try and dd overwrite its stl/bml), but the others certainly are.

Hopefully I'm completely wrong but I don't think so. Sad
Logged
linckraker
Newbie
*

Cookies: 2
Posts: 32


View Profile
« Reply #3 on: December 16, 2009, 09:53:10 AM »

could they do an OTA update that gets downloaded/stored somewhere then upon reboot starts the install process?
Logged
orangesunshine
Newbie
*

Cookies: -3
Posts: 26


View Profile
« Reply #4 on: December 16, 2009, 12:17:41 PM »

Yeah, if all that you're concerned about is your inability to write to the /boot partition ... that's no different than many other phones.

Also they generated ota-keys and such for the release... The notes are in the source code.

Here's how an OTA update would work:

1. download update and check if it's valid against public keys.
2.  reboot with download flag set.
3.  now it boots from the proprietary rom and updates the system with the OTA update

We already have all the tools necessary and most of the information to load our own custom ROM.  What remains:

1.  Do we have match the stock MD5? or will ODIN load anything we give it?
2.  We need to figure out how to make a valid RFS image out of a FAT32 (/dev/stl5 are FAT32 with some extra sauce packaged in to make it 'RFS' ... MS should be all over this shortly unless Samsung made a deal) image.
  OR
3.  Will the boot-loader allow us to just flash anything we give it to the respective partitions... if so, all we have to do is package a release as YAFFS2 ... and bob's your uncle.


"could they do an OTA update that gets downloaded/stored somewhere?"

/cache/recovery maybe ... seems like a logical place, as that's where you download your .apk files to... and there's already a directory named /cache/recovery.


Brain idea regarding FAT32 vs. RFS ... are the BML5,6,7 images RFS ... and STL5,6,7 FAT32? If so we can do bindiffs and try and figure out what the headers look like.
« Last Edit: December 16, 2009, 12:21:16 PM by orangesunshine » Logged
peepsalot
Jr. Member
**

Cookies: 8
Posts: 90


View Profile
« Reply #5 on: December 16, 2009, 01:44:47 PM »

Some of my thoughts on this:

The fact that the dumps from stl5-7 do not match the .rfs files that Odin flashes leads me to believe that we can't just replace the rfs files with any other filesystem image.  I think either odin, or the code running on the phone in download mode is doing some kind of manipulation/translation of the data.  Since download mode seems to be entirely controlled by the second boot loader (Sbl.bin), there may not be any simple way to get around this.

Disassembling the Sbl.bin and rewriting it may be a possibility, but I think that's a pretty big undertaking, and very dangerous.  I wouldn't want to mess with that unless someone had already figured out a failproof recovery method via internal ports or solder pads like jtag.

Quote from: orangesunshine
1.  Do we have match the stock MD5? or will ODIN load anything we give it?
The md5 of the recovery tar is inconsequential.  The only reason it's important is for checking the integrity of your .tar download, and the correctness of the retar-moment tool.  As soon as you change the contents of the tar, the md5 no longer matches.

Quote from: orangesunshine
2.  We need to figure out how to make a valid RFS image out of a FAT32 (/dev/stl5 are FAT32 with some extra sauce packaged in to make it 'RFS' ... MS should be all over this shortly unless Samsung made a deal) image.
I wouldn't hold my breath on MS developing some awesome hacking tools for us.  Ans as for regenerating .rfs files, I doubt that's a very feasible idea either, since we know next to nothing about the filesystem format.

Quote from: orangesunshine
Brain idea regarding FAT32 vs. RFS ... are the BML5,6,7 images RFS ... and STL5,6,7 FAT32? If so we can do bindiffs and try and figure out what the headers look like.
The OneNAND documentation discusses some of the difference between the BML and STL layers.  BML is block management layer, and STL is sector translation layer.  I think that you need both these layers to read/write OneNAND, regardless of the filesystem.  I know that, due to bad blocks and wear leveling, flash data does not go in perfect order onto flash chips.  It seems that reading (and maybe writing if we can get that to work) from STL does that translation of jumbled data for you.

I repartitioned my sdcard yesterday and attempted to make init.rc mount /system /data and /cache from these partitions instead of from stl5-7.  It didn't work at all(froze at end of boot progress bar), but I'm going to do some more tests tonight, to see if I can get something working.
Logged
orangesunshine
Newbie
*

Cookies: -3
Posts: 26


View Profile
« Reply #6 on: December 16, 2009, 03:34:22 PM »

Quote
1.  Do we have match the stock MD5? or will ODIN load anything we give it?
The md5 of the recovery tar is inconsequential. 

The only reason it's important is for checking the integrity of your .tar download, and the correctness of the retar-moment tool.  As soon as you change the contents of the tar, the md5 no longer matches.

We should make a tar with YAFFS2 images in place of the RFS images.  We can either turn YAFFS support on in the kernel or use the modules/kernel they have already supplied and change the .rc files.  It looks like they had the MTD drivers working first, then switched to the YAFFS + XSR, then RFS + XSR.  We should first try to get the YAFFS + XSR working, then later maybe try and compile MTD-OneNAND support into the kernel if we want better access/documentation for the NAND chips.

There's no reason that won't work ... assuming that the boot-loader is just doing a straight copy over to the partitions.  There might be meta-data or something in the .rfs partitions though, so who knows.

Quote
MS should be all over this shortly unless Samsung made a deal
MS owns patents on the FAT32 system, and just recently went after another device manufacturer I believe.

Quote
Ans as for regenerating .rfs files, I doubt that's a very feasible idea either, since we know next to nothing about the filesystem format.

The RFS file is just a FAT32 image prepended with a custom header that includes the journaling data.  I can almost guarantee that.  I'd even wager that FAT32 -> RFS is seemless ... where-as RFS -> FAT32 breaks because the journaling data breaks from the regular formating.
Logged
peepsalot
Jr. Member
**

Cookies: 8
Posts: 90


View Profile
« Reply #7 on: December 17, 2009, 03:58:45 PM »

Yeah the more I look at it, MTD seems to be the way to go.  I didn't realize it supported the OneNAND chips till just recently.  It looks like Samsung's source already includes the code for it (see /linux-2.6.27/drivers/mtd ) in , and it may just need to be enabled in the kernel .config

I haven't had a chance yet to try this out, but here is some info I found:

http://wiki.davincidsp.com/index.php/Create_a_YAFFS_Target_Image
http://wiki.davincidsp.com/index.php/Put_YAFFS_Image_to_Flash
http://www.linux-mtd.infradead.org/doc/onenand.html

Since the init.rc file creates the basic directory structure already, I think the data and cache (stl6 and stl7) partitions can start as completely empty filesystems.  /system can be dd'd from stl5 to a file, pulled via adb, and then mounted on your desktop with -o loop, which could probably be used to create a yaffs2 image.
Logged
orangesunshine
Newbie
*

Cookies: -3
Posts: 26


View Profile
« Reply #8 on: December 17, 2009, 05:26:45 PM »

Yeah that's the plan...

Going to try and load just the /cache first as a YAFFS2 partition tonight... to make sure the YAFFS2 kernel module works.  Edit the .rc files and comment out the RFS stuff for just /cache and uncomment the YAFFS lines... also insmod the yaffs2.ko Wink

If that works we can probably start making our first distribution ... and expect it to work.
Logged
Pages: [1]
Print
Jump to:  

Got a new phone? Find the forum here


Related Topics
Subject Started by Replies Views Last post
bootloader info
Rooting
feld 4 3107 Last post December 11, 2009, 01:39:29 PM
by feld
Entire filesystem ported to SD card, EXT3
Rooting
glitch77 9 2936 Last post December 18, 2009, 04:24:41 PM
by oxsolid
Random OneNAND Info
Rooting
zefie 0 657 Last post December 30, 2009, 04:17:56 PM
by zefie
get my sprint info off phone
How To....
jogh 5 1119 Last post January 26, 2010, 03:07:19 PM
by lovinlissa1984
Personal Info with App downloads?
Apps, apps, apps
alpito 1 1996 Last post September 19, 2010, 09:48:05 AM
by yourm0m1




Galaxy S3 | Galaxy Note | Galaxy Nexus | Kindle Fire | Atrix 4G | Motorola Xoom | Windows Phone 7
Nokia Lumia | Tech Support Forum | Top Hosts | Samsung Galaxy Tab | Samsung Galaxy S2 | Samsung Galaxy S | Samsung Wave
HTC Evo 3D | HTC Evo 4G | HTC Incredible | HTC Incredible 2 | HTC Incredible S | HTC Thunderbolt
Motorola Droid Razr
| HTC Desire | HTC Desire HD | HTC Desire Z | HTC Desire S | HTC Wildfire
Motorola Droid | Galaxy Indulge | Nokia N8 | Droid Charge | Droid X | Droid X2 | Droid 2| Droid 3 | Fascinate
HTC Sensation | HTC Flyer | LG Revolution | Asus Transformer | Xperia Play | iPhone 4 | Nexus S | Droid Bionic
HTC One | HTC Wildfire S | HTC Droid Eris


This is an Un-Official fan based Website. The views expressed on this website are solely those of the proprietor, or contributors to the site, and do not necessarily reflect the views or opinions of the parties it covers, and is not affiliated with, endorsed or sponsored by parties involved.
If you have a problem with any of the content posted on this website, please contact "mobile@vssupportqueue.com"
Term of Use | Privacy Policy | BlackRain 2006 by, Crip



Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Sitemap