Introducing XDA:DevCon – A Conference For Developers By Developers
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
3dak
Old
(Last edited by 3dak; 29th April 2011 at 12:08 PM.)
#1  
3dak's Avatar
Senior Member - OP
Thanks Meter 343
Posts: 209
Join Date: Jul 2010
Location: Ang Mo Kio

 
DONATE TO ME
Default HD2 SD/MALDR System.ext2 Auto Builder V1.0

1. purpose just speeding up the system.ext2 file making.I'm lazy....
2. use it in Ubuntu O.S. with root account
3. decompress this auto builder and put it in folder /root or else place
4. put the CWM ROM's zip file in the folder "cwm_rom" and put the kernel modules *.ko files in the folder " kernel"
5.open terminal, cd the folder of this scripts, and execute it.
bash systemext2builder.sh then it will auto build the system.ext2 for SD ROM.
here is a demo how to use http://www.mediafire.com/?3lj5iuiv6ddcppi or http://dl.dbank.com/c0xn7ck608

Code:
#!/bin/bash
####################################################
# HD2 Android SD/MAGLDR ROM system.ext2 Auto builder.
#        version 1.0    
#   By 3dak on 2011-04-29
##################################################

# to get current script's path

script_dir=`dirname $(readlink -f $0)`
extract_dir=$script_dir/extract
mount_dir=/mnt/system

#check the $mount_dir folder and ensure it is unmount and it's a fresh empty folder
if [ -d "$mount_dir" ] ; then
 umount $mount_dir
 rm -rf $mount_dir
 mkdir $mount_dir
else
 mkdir $mount_dir
fi

#to ensure there is no old extract folder or system.ext2
if [ -d "$extract_dir" ] ; then
 rm -rf $extract_dir
fi

if [ -f $script_dir/system.ext2 ]; then
   rm -f $script_dir/system.ext2
fi


#to get the main file name of the latest MIUI CWM ROM (*.zip) and decompress it!
# Please put the latest MIUI CWM ROM in the folder $script_dir/cwm_rom

build=`ls $script_dir/cwm_rom/*.zip | tail -1`
unzip $build -d $extract_dir/

#now change the cwm_rom kernel to SD version's kernel
#Please put all kernel modules *.ko files in the folder  $script_dir/kernel
rm  $extract_dir/system/lib/modules/*.ko
cp  $script_dir/kernel/*.ko  $extract_dir/system/lib/modules/


# Now create a fresh empty 250MB system.ext2 image file and format it.
dd if=/dev/zero of=$script_dir/system.ext2 bs=1048576 count=250
mke2fs -F $script_dir/system.ext2

#Now mount this fresh system.ext2


mount -o loop $script_dir/system.ext2 $mount_dir
#Now copy the CWM ROM's system folder to the $mount_dir (/mnt/system )
cp -ar $extract_dir/system/* $mount_dir/


############################################################
# Read CWM ROM's updater-script
# Createa Symlinks and set permissions of folders and files
#############################################################

updater_script=$extract_dir/META-INF/com/google/android/updater-script

# create symbolic links

SYMLINKS=`grep "symlink" $updater_script | cut -d'"' -f2`
for SYMLINK in $SYMLINKS; do
    echo "Creating symolic links for $SYMLINK..."
     if [ "$SYMLINK" = "busybox" -o "$SYMLINK" = "iwmulticall" ]; then
         LINK_DIR='/system/xbin/'
     elif [ "$SYMLINK" = "toolbox" ]; then
         LINK_DIR='/system/bin/'
     fi
     MATCHES=`awk '/symlink\(\"'"$SYMLINK"'/,/\);/ {print}' $updater_script | \
              sed "s/symlink(\"$SYMLINK\",//g" | \
              sed 's/);//g' | \
              sed 's/"//g' | \
              sed 'N;s/\n//g' | \
              sed 's/ //g' | \
              sed 's/,/ /g' | \
              sed "s@$LINK_DIR@@g"`
     cd /mnt/$LINK_DIR
     for LINK in $MATCHES; do
         echo -n "Linking $SYMLINK to $LINK... "
         ln -sf $SYMLINK $LINK && echo "done"
     done
 done
# set permissions
 grep "set_perm_recursive" $updater_script | grep -v "tmp" | grep -v "recovery" | \
 while read LINE; do
     PERM=`echo $LINE | sed 's/set_perm_recursive(//g' | sed 's/);//g' | sed 's/"//g' | sed 's/ //g'`
     USER=`echo $PERM | cut -d',' -f1`;
     GROUP=`echo $PERM | cut -d',' -f2`;
     DIR_PERM=`echo $PERM | cut -d',' -f3`;
     FILE_PERM=`echo $PERM | cut -d',' -f4`;
     TARGET=`echo $PERM | cut -d',' -f5`;
     echo -n "Setting permissions for $TARGET... "
     chown -R $USER:$GROUP /mnt$TARGET
     chmod -R $DIR_PERM /mnt$TARGET
     find /mnt$TARGET -type f -exec chmod $FILE_PERM {} \; && echo "done"
 done
 grep "set_perm" $updater_script | grep -v "recursive" | grep -v "tmp" | grep -v "recovery" | \
 while read LINE; do
     PERM=`echo $LINE | sed 's/set_perm(//g' | sed 's/);//g' | sed 's/"//g' | sed 's/ //g'`
     USER=`echo $PERM | cut -d',' -f1`;
     GROUP=`echo $PERM | cut -d',' -f2`;
     FILE_PERM=`echo $PERM | cut -d',' -f3`;
     TARGET=`echo $PERM | cut -d',' -f4`;
     echo -n "Setting permissions for $TARGET... "
     chown $USER:$GROUP /mnt$TARGET
     chmod $FILE_PERM /mnt$TARGET && echo "done"
 done

#now unmount system.ext2
umount $mount_dir

#cleanup
rm -rf $extract_dir

echo " All Done!"
# EOF by 3dak :) 2011-04-29
if you wanna a system.img file too for DAF ROM, add the follwoing line before this line #now unmount system.ext2

Code:
mkyaffs2image $mount_dir  $script_dir/system.img
tools.zip is some tools for rom making. put them in the foloer
/usr/local/bin
Attached Files
File Type: zip tools.zip - [Click for QR Code] (289.8 KB, 711 views)
File Type: zip 3daksystemext2builder.zip - [Click for QR Code] (1.8 KB, 487 views)
The Following 21 Users Say Thank You to 3dak For This Useful Post: [ Click to Expand ]
 
jaguaralani
Old
#2  
jaguaralani's Avatar
Senior Member
Thanks Meter 473
Posts: 1,868
Join Date: Aug 2007
Location: Perth

 
DONATE TO ME
Wonderful !
Would love to see such an application for Windows OS ....
 
Krendelrus
Old
#3  
Senior Member
Thanks Meter 414
Posts: 594
Join Date: Nov 2010
that's very cool! now we can make new sd builds by ourselves
thanks 3dak!
 
sgunf
Old
#4  
Member
Thanks Meter 14
Posts: 59
Join Date: Dec 2008
Location: Amongst the mountains
Quote:
Originally Posted by 3dak View Post
1. purpose just speeding up the system.ext2 file making.I'm lazy....
Man this way you take away all the fun!!

Joking... I'm lazy, too!
 
vua777
Old
(Last edited by vua777; 30th April 2011 at 06:10 AM.) Reason: 5 stars
#5  
vua777's Avatar
Senior Member
Thanks Meter 72
Posts: 533
Join Date: Jun 2005
great tool, work great to build miui 1.4.29
Thanks 3dak
* Phone: O2 Mini (Magician) ► O2 trion (Hermes) ► HTC Touch HD (Blackstone) & HD2 (Leo) ► White HTC One X (Endeavor)

* Tablet: Galaxy Tab Plus (P6200)
 
kimquypticc
Old
#6  
Member
Thanks Meter 1
Posts: 30
Join Date: Feb 2008
It's so bad that I don't use Ubuntu OS!
I am looking for some tool like this for a long time but running in Windows OS!
 
dugiteddy
Old
#7  
Member
Thanks Meter 3
Posts: 30
Join Date: Dec 2010
Location: Los Angeles
Quote:
Originally Posted by kimquypticc View Post
It's so bad that I don't use Ubuntu OS!
I am looking for some tool like this for a long time but running in Windows OS!
Use ubuntu.
Just make a live cd or live flash drive. It's worth it

Sent from my HD2 using XDA app
 
peter_fuchs1
Old
(Last edited by peter_fuchs1; 1st May 2011 at 10:48 AM.) Reason: added link to virtualbox
#8  
Senior Member
Thanks Meter 1
Posts: 112
Join Date: Dec 2007
Quote:
Originally Posted by kimquypticc View Post
It's so bad that I don't use Ubuntu OS!
I am looking for some tool like this for a long time but running in Windows OS!
Or use it in a VirtualBox.
It's rather easy
peter
HTC HD2 (Leo)
Cheetah 3.2 WWE
SD: Desire HD 7.01
Radio 2.15.50.14

HTC HD2 (Leo)
Energy™ Sense 3.5 RCMix ker v6
Radio 2.15.50.14
Always do the task 29!!
 
white-energy
Old
#9  
white-energy's Avatar
Senior Member
Thanks Meter 195
Posts: 554
Join Date: Apr 2010
Location: Ariana
this is just Awesome!




ˇʇɐɥʇ ǝʞıl pɐǝɥ ɹnoʎ ɥʇıʍ pıdnʇs ʞool noʎ

 
GuimbardePower
Old
#10  
GuimbardePower's Avatar
Member
Thanks Meter 3
Posts: 72
Join Date: Dec 2008
Location: Somewhere in France
Awesome, I will test this soon!

 
Post Reply+
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Go to top of page...