Droid 1 custom bootloader logos to replace Motorola logo

jlutz555

Member
Joined
Feb 10, 2010
Messages
238
Reaction score
0
Hi all. Well, I fell off the planet again for awhile -- very distracted with another mission at the moment. Catching up a little here.

First order of business is to post the completed CG42 maker script that I wrote (and mentioned) awhile back, but just finally got tested and finalized. This is an expansion and improvement of the more basic script I originally posted in the middle of this post.

Rather than attaching as a file I'll just make a CODE block and paste it. It's only like 121 lines. Copy this text to a text editor on your machine (notepad, gedit, etc.) and save as "MakeCG42FromBMP2.pl" (at least that is the name that the syntax screen will reference).

This script will take a normal, unmodified 480 x 182, 24 bit BMP file, remove the first 54 bytes (clip), mirror it left to right (mirror), flip it top to bottom (flip), and pad 64 bytes of 0xFF to the end (pad). These are the things that you normally have to do to the file manually to make it show correctly on the phone.

The script does some basic checking to make sure the input file is the right size based on the switches you use.

I tested and validated it and it works well for me. If you find any bugs, please let me know and I'll correct this post.

To use:

On Windows (at a command prompt, with Perl installed, with the script and the .bmp in the same directory you are presently "in"):
perl MakeCG42FromBMP.pl yourfile.bmp
On Linux (in a terminal window - be sure to adjust the shebang in the first line to point to your copy of Perl):
./MakeCG42FromBMP.pl yourfile.bmp
The Code

Code:
#!/usr/local/bin/perl
# MotoCache1 - take 480 x 182, 24 bit BMP file and make it into a CG42 code group
#
# Syntax: 
#    MakeCG42FromBMP.pl filename.bmp [/noclip] [/nomirror] [/noflip]
#
# Ordinarily the BMP file needs to have the first 54 bytes removed (clip), 
# the image needs to be mirrored (mirror), the image needs to be flipped (flip), 
# and 64 bytes of 0xFF needs to be padded to the end (pad). If any of these 
# steps have already been done to the supplied file, use the appropriate 
# switch to tell script not to do it again.
#
use strict;
my $file = shift(@ARGV);
my %switches = map {lc($_)=>1} @ARGV;
print "\nMakeCG42FromBMP v.2.0 - MotoCache1\n\n";
if (not -e $file) {
 print "Make Droid1 CG42 from a 480 x 182, 24 bit BMP file.\n\n";
 print "Syntax: MakeCG42FromBMP.pl filename.bmp [/noclip] [/nomirror] [/noflip]\n\n";
 print "        /noclip - first 54 bytes of BMP already removed, don't do it\n";
 print "        /nomirror - image already mirrored (or you want it to appear backwards)\n";
 print "        /noflip - image already flipped (or you want it to appear upside down)\n\n";
 exit;
}
print "Processing $file...\n\n";
# The most likely source of trouble would be if the input file isn't right, so we're going 
# to spend some code to make sure it is, and try to give useful messages if it is not.
# Fle size check
if ($switches{'/noclip'}) {
 # File should be 262080 bytes
 if (-s $file == 262134) {
  print "You specified the /noclip switch, but your file is 262134 bytes which means\n";
  print "it needs to be clipped. Cannot continue.\n\n";
  exit;
 } elsif (-s $file != 262080) {
  print "You specified the /noclip switch. A file that has already been clipped should\n";
  print "be 262080 bytes, but the your file is " . (-s $file) . " Cannot continue.\n\n";
  exit;
 } else {
  # File is good for /noclip - nothing special to do
 }
} else {
 # File should be 262134 bytes
 if (-s $file == 262080) {
  print "You did not specify the /noclip switch, but your file is 262080 bytes which means\n";
  print "it should not be clipped. Cannot continue.\n\n";
  exit;
 } elsif (-s $file != 262134) {
  print "An appropriate 480 x 182, 24 bit BMP should be 262134 bytes. Your file is \n";
  print (-s $file) . " bytes. Cannot continue.\n\n";
  exit;
 } else {
  # File is good
 }
}
print "   File $file is correct size (262134 bytes).\n";
# Open source file and read in binary mode
open (IN,$file) or die ("Can't open $file for input. Error: $!");
binmode IN;
# Open target file and write in binary mode
open (OUT,">$file.CG42.smg") or die ("Can't open $file.CG42.smg for output. Error: $!");
binmode OUT;
my ($imageData,$bytesRead);
if (not $switches{'/noclip'}) {
 print "   Clipping...\n";
 $bytesRead = read(IN,$imageData,54); # clip
}
# Read image data
$bytesRead = read(IN,$imageData,262080);
close IN;
if ($bytesRead == 262080) {
 print "   Read 262080 image bytes.\n";
} else {
 die ("\nFailed to read 262080 image bytes. Cannot continue.");
}
unless ($switches{'/nomirror'}) {
 print "   Mirroring...\n";
 $imageData = mirrorImage(3,480,182,\$imageData);
}
unless ($switches{'/noflip'}) {
 print "   Flipping...\n";
 $imageData = reverse(split(//,$imageData));
}
print "   Padding...\n";
$imageData .= "\xFF" x 64;
print "   Writing output file $file.CG42.smg...\n";
print OUT $imageData;
close OUT;
print "\nDone!\n\n";
sub mirrorImage {
 my $bytesPerPx = shift;
 my $widthPx = shift;
 my $heightPx = shift;
 my $imageRef = shift; # Reference to scalar holding image
 
 my $lineBytes = $bytesPerPx * $widthPx;
 
 my @array = unpack("(a$lineBytes)$heightPx", $$imageRef);
 for (my $row=0; $row <= ($heightPx-1); $row++) {
  $array[$row] = pack("(a$bytesPerPx)$widthPx",reverse(unpack("(a$bytesPerPx)$widthPx", $array[$row])));
 }
 $$imageRef = pack("(a$lineBytes)$heightPx",@array);
}

New script works like a champ! Now if we could only figure out how to generate correct checksums...
 
OP
MotoCache1

MotoCache1

Chief Droid Scientist
Joined
Jun 30, 2010
Messages
530
Reaction score
1
New script works like a champ! Now if we could only figure out how to generate correct checksums...
It can be done. Just a question of which of you does it first. :)
 
OP
MotoCache1

MotoCache1

Chief Droid Scientist
Joined
Jun 30, 2010
Messages
530
Reaction score
1
Of course it CAN be done, but has anyone figured it out yet? Including you? :icon_eek:
I'd love to answer that but I'm too distracted by your avatar. What were we talking about again?
 

Shibbey

Member
Joined
Dec 14, 2009
Messages
272
Reaction score
0
Location
NE Ohio
I'd love to answer that but I'm too distracted by your avatar. What were we talking about again?

LOL. I hear you there. I made it into a boot logo to stare at while I patiently wait for my phone to boot up. :icon_ banana:
 

raidzero

n00b.
Premium Member
Developer
Theme Developer
Joined
Apr 15, 2010
Messages
1,054
Reaction score
0
I, purely for the sake of learning a little perl, made a script from motocache1's MakeCG42FromBMP.pl script to extract bmp's from bootlogo-only SBF's

I wanted to try to get it to simply insert the cg42 code straight into a new SBF file then all you would have to do is hex the cehcksum but something's gone awry. Anyway here's the script:
Code:
#RZ_sbfExtract.pl - pull bmp out of bootlogo sbf file
#hacked together by raidzero with help from MotoCache1's MakeCG42FromBMP.pl script

use strict;
my $sbf = shift(@ARGV);
print "\nExtract BMP from SBF - hacked together from MotoCache1\n";
print "by raidzero\n\n\n";
if (not -e $sbf) {
 print "Extract 480 x 182, 24 bit BMP file from SBF BootLogo file.\n";
 print "Syntax: RZ_sbfExtract.pl filename.sbf \n\n";
 exit;
}
print "Reading $sbf...\n\n";
if (-s $sbf != 578428) {
  print "This SBF file is not 578,428 bytes\n";
  print "Boot Logo SBFs must be 578,428 bytes. Exit.\n\n";
  exit;
 } elsif (-s $sbf == 578428) {  
 # Continue
 }
print "$sbf is correct size (578,428 bytes).\n";
# Open source file and read in binary mode
open (INPUT,$sbf) or die ("Can't open $sbf for input. Error: $!");
binmode INPUT;
# Open target file and write in binary mode
open (OUTPUT,">$sbf.bmp") or die ("Can't open $sbf.bmp for output. Error: $!");
binmode OUTPUT;
my ($bmpData,$bytesRead);
seek INPUT, 316272, 0;
print "Moved 316272 bytes down in SBF (start of BMP data).\n";

$bytesRead = read(INPUT,$bmpData,262080);
close INPUT;
if ($bytesRead == 262080) {
 print "Read 262080 BMP bytes.\n";
} else {
 die ("\nFailed to read 262080 BMP bytes. Cannot continue.");
}
$bmpData = mirrorImage(3,480,182,\$bmpData);
$bmpData = reverse(split(//,$bmpData));
print "Creating BMP signature\n";
my $bmpHeader ="BM\366\377\3\0\0\0\0\0006\0\0\0(\0\0\0\340\1\0\0\266\0\0\0\1\0\30\0\0\0\0\0\300\377\3\0\23\13\0\0\23\13\0\0\0\0\0\0\0\0\0\0";
print "Writing bmp signature+data to $sbf.BMP";
print OUTPUT $bmpHeader;
print OUTPUT $bmpData;
close OUTPUT;
print "\nDone!\n";

sub mirrorImage {
 my $bytesPerPx = shift;
 my $widthPx = shift;
 my $heightPx = shift;
 my $imageRef = shift; # Reference to scalar holding image
 
 my $lineBytes = $bytesPerPx * $widthPx;
 
 my @array = unpack("(a$lineBytes)$heightPx", $$imageRef);
 for (my $row=0; $row <= ($heightPx-1); $row++) {
  $array[$row] = pack("(a$bytesPerPx)$widthPx",reverse(unpack("(a$bytesPerPx)$widthPx", $array[$row])));
 }
 $$imageRef = pack("(a$lineBytes)$heightPx",@array);
}
 

f0rkyou

New Member
Joined
Apr 8, 2010
Messages
18
Reaction score
0
Location
Norfolk, VA
You can change your Motorola Droid (Droid 1 Only) very fast and easily using this free program. It lets you pick the background color and any bitmap to replace the boring original black and white Motorola logo. It then generates a .sbf file that can be flashed to your phone using RSD Lite (Not Full Flash!) . Download links below!

Droid Boot Logo Generator v1.10.10.22
Download Boot Logo Generator v1.10.10.22.exe.

RSD Lite 4.9
Download RSD Lite 4.9.rar from uploading.com - Filestube.com - download everything
 

Jharmon12

Member
Joined
May 4, 2010
Messages
257
Reaction score
0
You can change your Motorola Droid (Droid 1 Only) very fast and easily using this free program. It lets you pick the background color and any bitmap to replace the boring original black and white Motorola logo. It then generates a .sbf file that can be flashed to your phone using RSD Lite (Not Full Flash!) . Download links below!

Droid Boot Logo Generator v1.10.10.22
Download Boot Logo Generator v1.10.10.22.exe.

RSD Lite 4.9
Download RSD Lite 4.9.rar from uploading.com - Filestube.com - download everything

I beta tested that program lol

Sent from my Droid using DroidForums App
 
Joined
May 14, 2010
Messages
295
Reaction score
0
Location
Shreve, Ohio
I know this is an old post but is there any way to make the second droidforums logo in a black background? The white is awsome but I think a black background would be better, thanks.
 

Keka_Umans

New Member
Joined
Sep 14, 2010
Messages
20
Reaction score
0
Location
P3X-888
Custom Boot Logo Maker

I see you already found the program..
for everyone else......
Boot Logo Generator v1.10.10.22
i found it through google sorry dont have the link
it works perfectly you can make whatever boot logo you want and pick a custom background color it makes the .SBF and you just flash it over with RSD lite
 
Top