#1 2010-11-03 17:35:24

Feeyo
New member
Registered: 2010-11-03
Posts: 5

Extracted SBF

Hi guys,

So I just started in the Milestone scene. I have extracted the .sbf into .hmg and .smg's. I also extracted these .hmg and .smg's. Giving me:

drwxr-xr-x 32 mali mali    4096 Nov  2 08:50 .
drwxr-xr-x  4 mali mali      34 Nov  2 08:50 ..
drwxr-xr-x  2 mali mali      29 Nov  2 08:49 12m
drwxr-xr-x  2 mali mali    4096 Nov  2 08:49 app
drwxr-xr-x  2 mali mali    4096 Nov  2 08:49 bin
-rw-r--r--  1 mali mali      18 Nov  2 08:49 bplogd.conf
drwxr-xr-x  2 mali mali    4096 Nov  2 08:49 bp_nvm_default
-rw-r--r--  1 mali mali    5127 Nov  2 08:49 build.prop
-rwxr-xr-x  1 mali mali 7655424 Nov  2 08:49 cdrom_vfat.bin
drwxr-xr-x  3 mali mali      52 Nov  2 08:49 com.android.browser
drwxr-xr-x  2 mali mali      46 Nov  2 08:49 com.android.providers.settings
drwxr-xr-x  2 mali mali    4096 Nov  2 08:49 comm_drv
drwxr-xr-x  3 mali mali      22 Nov  2 08:49 com.motorola.android.dm.service
drwxr-xr-x  2 mali mali      24 Nov  2 08:49 com.motorola.android.fota
drwxr-xr-x  2 mali mali      28 Nov  2 08:49 com.motorola.android.providers.settings
drwxr-xr-x  2 mali mali      32 Nov  2 08:49 com.motorola.dock
drwxr-xr-x  2 mali mali      25 Nov  2 08:49 com.motorola.mtlr
drwxr-xr-x  2 mali mali      30 Nov  2 08:49 com.motorola.providers.messaging
drwxr-xr-x  2 mali mali      29 Nov  2 08:49 com.motorola.providers.settings
drwxr-xr-x  2 mali mali      35 Nov  2 08:49 com.motorola.widget.weather.accuweather
-rw-r--r--  1 mali mali     276 Nov  2 08:49 default.prop
drwxr-xr-x 13 mali mali    4096 Nov  2 08:49 etc
drwxr-xr-x  2 mali mali    4096 Nov  2 08:49 fonts
drwxr-xr-x  2 mali mali    4096 Nov  2 08:49 framework
drwxr-xr-x  8 mali mali    4096 Nov  2 08:47 GOT_RTEU_2_2_1FULLCG35.smg-ramdisk
-rw-r--r--  1 mali mali  225408 Nov  2 08:47 GOT_RTEU_2_2_1FULLCG35.smg-ramdisk.cpio.gz
drwxr-xr-x 11 mali mali    4096 Nov  2 08:47 GOT_RTEU_2_2_1FULLCG47.smg-ramdisk
-rw-r--r--  1 mali mali  694564 Nov  2 08:47 GOT_RTEU_2_2_1FULLCG47.smg-ramdisk.cpio.gz
drwxr-xr-x  7 mali mali    8192 Nov  2 08:49 lib
drwxr-xr-x  2 mali mali      24 Nov  2 08:49 libskia
drwxr-xr-x  3 mali mali      16 Nov  2 08:49 local
drwxr-xr-x  2 mali mali       6 Nov  2 08:49 logger
drwxr-xr-x  3 mali mali      18 Nov  2 08:49 media
drwxr-xr-x  2 mali mali       6 Nov  2 08:49 opprof
drwxr-xr-x  4 mali mali      26 Nov  2 08:49 preinstall
drwxr-xr-x  4 mali mali      35 Nov  2 08:49 tts
drwxr-xr-x  7 mali mali      70 Nov  2 08:49 usr
drwxr-xr-x  2 mali mali      30 Nov  2 08:49 xbin

I also got the kernel and ramdisks now seperated from each other. How do we recreate everything back to .hmg and smg's? And could someone explain me why we got 2 ramdisks?
I tried extracting only the kernel and ramdisks and recreating it with the correct boot syntax. Only it is failing when flashing the .sbf with:

failed flashing progress. failed flashing progress. Phone(0000)checksum error in the Ram downloader for flash bootloader. file: 0x55f0, phone: 0x4b0b (0x702c)

Nadlabak you think we can hexedit that checksum?

Offline

#2 2010-11-04 16:14:34

nadlabak
Moderator
Registered: 2010-10-03
Posts: 3

Re: Extracted SBF

Offline

#3 2010-11-04 21:02:21

Feeyo
New member
Registered: 2010-11-03
Posts: 5

Re: Extracted SBF

Thanks for the information. I should do some more research about it smile

Offline

#4 2010-11-05 22:19:36

Skrilax_CZ
Moderator
Registered: 2010-10-03
Posts: 2

Re: Extracted SBF

You're using what to extract them? SBF Depacker should calculate the checksums correctly.

Offline

#5 2010-11-07 21:00:23

Feeyo
New member
Registered: 2010-11-03
Posts: 5

Re: Extracted SBF

I was using unyaffs. And 2 scripts:

#!/usr/bin/perl -W

use strict;
use bytes;
use File::Path;

die "did not specify boot img file\n" unless $ARGV[0];

my $bootimgfile = $ARGV[0];

my $slurpvar = $/;
undef $/;
open (BOOTIMGFILE, "$bootimgfile") or die "could not open boot img file: $bootimgfile\n";
binmode(BOOTIMGFILE);
my $bootimg = <BOOTIMGFILE>;
close BOOTIMGFILE;
$/ = $slurpvar;


my($bootMagic, $kernelSize, $kernelLoadAddr, $ram1Size, $ram1LoadAddr, $ram2Size, $ram2LoadAddr, $tagsAddr, $pageSize, $unused1, $unused2, $bootName, $cmdLine, $id) =
        unpack('a8 L L L L L L L L L L a16 a512 a8', $bootimg);

my($kernel) = substr($bootimg, $pageSize, $kernelSize);

open (KERNELFILE, ">$ARGV[0]-kernel");
binmode(KERNELFILE);
print KERNELFILE $kernel or die;
close KERNELFILE;

And:

#!/usr/bin/perl -W

use strict;
use bytes;
use File::Path;

die "did not specify boot img file\n" unless $ARGV[0];

my $bootimgfile = $ARGV[0];

my $slurpvar = $/;
undef $/;
open (BOOTIMGFILE, "$bootimgfile") or die "could not open boot img file: $bootimgfile\n";
binmode(BOOTIMGFILE);
my $bootimg = <BOOTIMGFILE>;
close BOOTIMGFILE;
$/ = $slurpvar;


my($bootMagic, $kernelSize, $kernelLoadAddr, $ram1Size, $ram1LoadAddr, $ram2Size, $ram2LoadAddr, $tagsAddr, $pageSize, $unused1, $unused2, $bootName, $cmdLine, $id) =
        unpack('a8 L L L L L L L L L L a16 a512 a8', $bootimg);


my($kernelAddr) = $pageSize;
my($kernelSizeInPages) = int(($kernelSize + $pageSize - 1) / $pageSize);

my($ram1Addr) = (1 + $kernelSizeInPages) * $pageSize;

my($ram1) = substr($bootimg, $ram1Addr, $ram1Size);

if (substr($ram1, 0, 2) ne "\x1F\x8B")
{
        die "The boot image does not appear to be a valid gzip file";
}

open (RAM1FILE, ">$ARGV[0]-ramdisk.cpio.gz");
binmode(RAM1FILE);
print RAM1FILE $ram1 or die;
close RAM1FILE;

if (-e "$ARGV[0]-ramdisk") {
        rmtree "$ARGV[0]-ramdisk";
        print "\nremoved old directory $ARGV[0]-ramdisk\n";
}

mkdir "$ARGV[0]-ramdisk" or die;
chdir "$ARGV[0]-ramdisk" or die;
system ("gzip -d -c ../$ARGV[0]-ramdisk.cpio.gz | cpio -i");

Did not know SBF Depacker existed. Thanks for the tip.

Offline

Registered users online in this topic: 0, guests: 1

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.019 seconds, 9 queries executed - Memory usage: 456.62 KiB (Peak: 458.41 KiB) ]