FORUMS
Remove All Ads from XDA

[HOWTO + BLACKHAWK ROM] Galaxy Ace firmware in ext4 format

4,905 posts
Thanks Meter: 14,103
 
By ketut.kumajaya, Recognized Developer on 4th August 2011, 12:18 PM
Post Reply Email Thread
Just want to share my command list to convert Galaxy Ace firmware from rfs to ext4.

Code:
cd /home/user/rfs2ext4

dd if=/dev/zero of=system.rfs bs=4096 count=53696
losetup /dev/loop0 system.rfs
mkfs.ext4 -T ext4 -b 4096 -m 0 -J size=4 -O ^resize_inode,^ext_attr,^huge_file,^has_journal /dev/loop0
tune2fs -c 100 -i 100d -m 0 /dev/loop0
mkdir /tmp/ext4
sudo mount /dev/loop0 /tmp/ext4
chmod 755 fix-*.sh
cp fix-*.sh /tmp
mkdir /tmp/rfs
sudo mount -o loop source/system.rfs /tmp/rfs
sudo cp -a /tmp/rfs/* /tmp/ext4
cd /tmp/ext4
sudo ../fix-system.sh
cd /home/user/rfs2ext4
sudo umount /tmp/ext4
sudo umount /tmp/rfs

dd if=/dev/zero of=data.rfs bs=4096 count=46400
losetup /dev/loop0 data.rfs
mkfs.ext4 -T ext4 -b 4096 -m 0 -J size=16 -O ^resize_inode,^ext_attr,^huge_file /dev/loop0
tune2fs -c 100 -i 100d -m 0 /dev/loop0
mount /dev/loop0 /tmp/ext4
sudo mount -o loop source/data.rfs /tmp/rfs
sudo cp -a /tmp/rfs/* /tmp/ext4
cd /tmp/ext4
sudo ../fix-data.sh
cd /home/user/rfs2ext4
sudo umount /tmp/ext4
sudo umount /tmp/rfs

dd if=/dev/zero of=csc.rfs bs=4096 count=6464
losetup /dev/loop0 csc.rfs
mkfs.ext4 -T ext4 -b 4096 -m 0 -J size=4 -O ^resize_inode,^ext_attr,^huge_file /dev/loop0
tune2fs -c 100 -i 100d -m 0 /dev/loop0
mount /dev/loop0 /tmp/ext4
sudo mount -o loop source/csc.rfs /tmp/rfs
sudo cp -a /tmp/rfs/* /tmp/ext4
cd /tmp/ext4
sudo ../fix-csc.sh
cd /home/user/rfs2ext4
sudo umount /tmp/ext4
sudo umount /tmp/rfs

tar -H ustar -c boot.img recovery.img data.rfs system.rfs > CODE_S5830XWKPN_CL375596_REV03_blackhawk.tar
md5sum -t CODE_S5830XWKPN_CL375596_REV03_blackhawk.tar >> CODE_S5830XWKPN_CL375596_REV03_blackhawk.tar
mv CODE_S5830XWKPN_CL375596_REV03_blackhawk.tar CODE_S5830XWKPN_CL375596_REV03_blackhawk.tar.md5

tar -H ustar -c csc.rfs > CSC_S5830OXXKP7_CL375596_REV03_blackhawk.tar
md5sum -t CSC_S5830OXXKP7_CL375596_REV03_blackhawk.tar >> CSC_S5830OXXKP7_CL375596_REV03_blackhawk.tar
mv CSC_S5830OXXKP7_CL375596_REV03_blackhawk.tar CSC_S5830OXXKP7_CL375596_REV03_blackhawk.tar.md5

tar -H ustar -c arm11boot mibib oemsbl qcsbl > APBOOT_S5830XWKPN_CL375596_REV03.tar
md5sum -t APBOOT_S5830XWKPN_CL375596_REV03.tar >> APBOOT_S5830XWKPN_CL375596_REV03.tar
mv APBOOT_S5830XWKPN_CL375596_REV03.tar CAPBOOT_S5830XWKPN_CL375596_REV03.tar.md5

tar -H ustar -c amss > MODEM_S5830XWKP6_CL375596_REV03.tar
md5sum -t MODEM_S5830XWKP6_CL375596_REV03.tar >> MODEM_S5830XWKP6_CL375596_REV03.tar
mv MODEM_S5830XWKP6_CL375596_REV03.tar MODEM_S5830XWKP6_CL375596_REV03.tar.md5
The Following 19 Users Say Thank You to ketut.kumajaya For This Useful Post: [ View ]
 
 
4th August 2011, 12:19 PM |#2  
OP Recognized Developer
Flag Bekasi
Thanks Meter: 14,103
 
Donate to Me
More
fix-system.sh script, not perfect but work
Code:
#!/bin/sh

rm -f bin/cat
rm -f bin/chmod
rm -f bin/chown
rm -f bin/cmp
rm -f bin/date
rm -f bin/dd
rm -f bin/df
rm -f bin/dmesg
rm -f bin/getevent
rm -f bin/getprop
rm -f bin/hd
rm -f bin/id
rm -f bin/ifconfig
rm -f bin/iftop
rm -f bin/insmod
rm -f bin/ioctl
rm -f bin/ionice
rm -f bin/kill
rm -f bin/ln
rm -f bin/log
rm -f bin/ls
rm -f bin/lsmod
rm -f bin/lsof
rm -f bin/mkdir
rm -f bin/mount
rm -f bin/mv
rm -f bin/nandread
rm -f bin/netstat
rm -f bin/newfs_msdos
rm -f bin/notify
rm -f bin/printenv
rm -f bin/ps
rm -f bin/reboot
rm -f bin/renice
rm -f bin/rm
rm -f bin/rmdir
rm -f bin/rmmod
rm -f bin/route
rm -f bin/schedtop
rm -f bin/sendevent
rm -f bin/setconsole
rm -f bin/setprop
rm -f bin/sleep
rm -f bin/smd
rm -f bin/start
rm -f bin/stop
rm -f bin/sync
rm -f bin/top
rm -f bin/umount
rm -f bin/uptime
rm -f bin/vmstat
rm -f bin/watchprops
rm -f bin/wipe
rm -f bin/dumpmesg

mkdir -p etc/init.d
mkdir -p sd

chown -R 0:0 .
for i in $( find . ); do
  if [ -d $i ]; then
    chmod 755 $i
  else
    chmod 644 $i
  fi
done

chown -R 0:0 etc/init.d
chmod -R 777 etc/init.d

chown -R 0:2000 bin
chmod -R 755 bin

chown 0:3003 bin/ip
chmod 6755 bin/ip

chown 0:3003 bin/netcfg
chmod 2750 bin/netcfg

chown 0:3004 bin/ping
chmod 2755 bin/ping

chown 0:2000 bin/run-as
chmod 6750 bin/run-as

chown -R 1002:1002 etc/bluetooth
chmod -R 440 etc/bluetooth
chown 0:0 etc/bluetooth
chmod 755 etc/bluetooth

chown 1000:1000 etc/bluetooth/auto_pairing.conf
chmod 640 etc/bluetooth/auto_pairing.conf

chown 3002:3002 etc/bluetooth/blacklist.conf
chmod 444 etc/bluetooth/blacklist.conf

chown 1002:1002 etc/dbus.conf
chmod 440 etc/dbus.conf

chown 1014:2000 etc/dhcpcd/dhcpcd-run-hooks
chmod 550 etc/dhcpcd/dhcpcd-run-hooks

chown 0:2000 etc/init.goldfish.sh
chmod 550 etc/init.goldfish.sh

chown -R 0:0 etc/ppp
chmod -R 555 etc/ppp
chmod 0755 etc/ppp

chown -R 0:2000 xbin
chmod -R 755 xbin

# For pre-rooted firmware
if [ -f xbin/su ]; then
  chmod 4755 xbin/su
fi

if [ -f xbin/sqlite3 ]; then
  chmod 4755 xbin/sqlite3
fi

if [ -f bin/su ]; then
  chmod 4755 bin/su
fi

if [ -f bin/sqlite3 ]; then
  chmod 4755 bin/sqlite3
fi

cd bin
ln -s toolbox cat
ln -s toolbox chmod
ln -s toolbox chown
ln -s toolbox cmp
ln -s toolbox date
ln -s toolbox dd
ln -s toolbox df
ln -s toolbox dmesg
ln -s toolbox getevent
ln -s toolbox getprop
ln -s toolbox hd
ln -s toolbox id
ln -s toolbox ifconfig
ln -s toolbox iftop
ln -s toolbox insmod
ln -s toolbox ioctl
ln -s toolbox ionice
ln -s toolbox kill
ln -s toolbox ln
ln -s toolbox log
ln -s toolbox ls
ln -s toolbox lsmod
ln -s toolbox lsof
ln -s toolbox mkdir
ln -s toolbox mount
ln -s toolbox mv
ln -s toolbox nandread
ln -s toolbox netstat
ln -s toolbox newfs_msdos
ln -s toolbox notify
ln -s toolbox printenv
ln -s toolbox ps
ln -s toolbox reboot
ln -s toolbox renice
ln -s toolbox rm
ln -s toolbox rmdir
ln -s toolbox rmmod
ln -s toolbox route
ln -s toolbox schedtop
ln -s toolbox sendevent
ln -s toolbox setconsole
ln -s toolbox setprop
ln -s toolbox sleep
ln -s toolbox smd
ln -s toolbox start
ln -s toolbox stop
ln -s toolbox sync
ln -s toolbox top
ln -s toolbox umount
ln -s toolbox uptime
ln -s toolbox vmstat
ln -s toolbox watchprops
ln -s toolbox wipe
ln -s dumpstate dumpmesg
cd ../
fix-data.sh script:
Code:
#!/bin/sh

if [ -d data_test ]; then
  rm -rf data_test
fi

if [ -d kernel-tests ]; then
  rm -rf kernel-tests
fi

if [ -d local ]; then
  rm -rf local
fi

if [ -d qmi_test ]; then
  rm -rf qmi_test
fi

chown -R 1013:1000 .
chmod -R 777 .
fix-csc.sh script:
Code:
#!/bin/sh

chown -R 0:0 .
for i in $( find . ); do
  if [ -d $i ]; then
    chmod 755 $i
  else
    chmod 644 $i
  fi
done

chown 1000:2001 recovery
CSC updater script:
Code:
#!/sbin/busybox sh

usage="usage: sec_csc <sales code>"

if [ "$(id | grep -c root)" != "1" ]; then
  echo "You have no permission to run sec_csc."
  exit 1;
fi

if ! [ "$1" = "" ]; then
  if [ -d /system/csc/$1 ]; then
    echo -n "Apply $1 sales code? y/N: "
    read answer
    if [ "$answer" = "y" ]; then
      /sbin/busybox mount -o rw,remount /system
      cp -f /system/csc/$1/system/CSCFiles.txt /system/
      cp -f /system/csc/$1/system/CSCVersion.txt /system/
      cp -f /system/csc/$1/system/csc/* /system/csc/
      rm -f /data/property/persist.sys.country
      rm -f /data/property/persist.sys.language
      rm -f /data/property/persist.sys.localevar
      echo -n $1 > /proc/LinuStoreIII/efs_info
      setprop ril.sales_code $1
      /sbin/busybox mount -o ro,remount /system
      echo "Turn off and then turn on your phone"
      echo "using the dedicated power button to"
      echo "apply the new CSC."
    fi
  else
    echo "$1 sales code not found."
  fi
else
  echo $usage
fi
Q: What's really above scripts do?
A: I do not directly use system.rfs (in rfs format) but making a new system.rfs in ext4 format. Copying the whole contents of the old system.rfs (rfs) into the new system.rfs (ext4), make modifications in the system.rfs (ext4) mount point, and then fix the access rights. Using ext3 format is also not problems as long as you use boot and recovery image that support ext3 and ext4 filesystems. After all the modifications, do not forget to umount both image.
Q: Why?
A: RFS filesystem in linux read as FAT filesystem. FAT filesystem permissions can not be set correctly according to the needs of the operating system (in this case Android). You're lucky if you modify the firmware and do not occur bootloop
Q: Is Odin support *.rfs formatted in ext4?
A: Odin raw writes the filesystem partition, no matter the form as long as *.rfs no larger than the physical partition.
Q: Does this really work?
A: You can try If you want to take the risk why not try XWKPN firmware already formatted to ext4 in ODIN package as follows:

S5830XWKPN_S5830XWKP6_S5830OXXKP7_blackhawk.rar (137.59 MB)
Password: ketut.kumajaya

Inside the package:
  • CF-Root-S5830 v3.7 b81 candidate
  • deodexed and zipaligned /system/app and /system/framework, thanks to dsixda
  • cifs (Samba/Windows share) and tun (openVPN) kernel modules included
  • BLN service support, modified services.jar. Thanks to neldar
  • Android Scribble 2.0 boot animation from here, thanks to GLa'DOS
  • multi CSC taken from XWKPN (Europe?) and DXKC1 (Asia?), XSE sales code (Indonesia as default country)
  • csc.rfs, data.rfs and system.rfs in ext4 format, no need to convert filesystem manually using ext4 Manager
  • keep application and themes as a plain XWPKN
  • DT apps2sd included, a modified version special for CF-Root-S5830. You can find the original Darktremor apps2sd here, thanks to tkirton.
  • ODIN fullpack, the safest way to flash Samsung firmware

Instructions:
Follow these instructions to the letter. Do not touch any buttons or checkboxes that are not listed below to touch!
  1. Decompress S5830XWKPN_S5830XWKP6_S5830OXXKP7_blackhawk.rar
  2. (USB) Disconnect your phone from your computer
  3. Start ODIN v4.38
  4. Click the OPS button, and select Cooper_v1.0.ops
  5. Click the BOOT button, and select APBOOT_S5830XWKPN_CL375596_REV03.tar.md5
  6. Click the Phone button, and select MODEM_S5830XWKP6_CL375596_REV03.tar.md5
  7. Click the PDA button, and select CODE_S5830XWKPN_CL375596_REV03_blackhawk.tar.md5
  8. Click the CSC button, and select CSC_S5830OXXKP7_CL375596_REV03_blackhawk.tar.md5
  9. Put your phone in download mode
  10. (USB) Connect the phone to your computer
  11. Click the START button
  12. Wait for the phone to reboot
  13. No need to wipe the /data and /cache partitions, has been automatically when flashing.
  14. Done

If you expect a better benchmark results. Enable "Media: Stagefright" on "Tweak Manager" and make sure you do not select "CPU: Conservative gov.".

UPDATE:
- Samsung keyboard have more language
- A new script to apply your CSC, run it over "adb shell" or Terminal Emulator or ConnectBot. For example to apply SER (Russia?) sales code:
Code:
sec_csc SER
To activate your new sales code, you must power off and then power on your phone using the dedicated power button.

Apply this update over CWM or CWM Manager app.
Attached Files
File Type: zip update_blackhawk.zip - [Click for QR Code] (5.23 MB, 4648 views)
The Following 35 Users Say Thank You to ketut.kumajaya For This Useful Post: [ View ]
5th August 2011, 04:51 AM |#4  
OP Recognized Developer
Flag Bekasi
Thanks Meter: 14,103
 
Donate to Me
More
Script updated for pre-rooted firmware.

Maybe I should show the results to get people interested
The Following 4 Users Say Thank You to ketut.kumajaya For This Useful Post: [ View ]
5th August 2011, 07:25 AM |#5  
fla.sh's Avatar
Senior Member
Flag <b>Location:</b>
Thanks Meter: 423
 
More
You are the real dev, ketut.kumajaya!
Thanks for sharing such a great guide to us...

Hey, I think this guide can be applied to build a CWM-flashable ROM
5th August 2011, 07:58 AM |#6  
OP Recognized Developer
Flag Bekasi
Thanks Meter: 14,103
 
Donate to Me
More
Quote:
Originally Posted by fla.sh

You are the real dev, ketut.kumajaya!
Thanks for sharing such a great guide to us...

Hey, I think this guide can be applied to build a CWM-flashable ROM

Your welcome!

fix-system.sh and fix-csc.sh updated for better/faster recursive chmod.

CWM flashable? Of course yes, my fix-*.sh scripts is a bash port of dsixda/tools/update_files
The Following 5 Users Say Thank You to ketut.kumajaya For This Useful Post: [ View ]
5th August 2011, 12:18 PM |#7  
OP Recognized Developer
Flag Bekasi
Thanks Meter: 14,103
 
Donate to Me
More
Examples of ROM which all *.rfs formatted as ext4 filesystem. Do not expect too much from a ROM made in two short days after work But read the features

Password: ketut.kumajaya
The Following 2 Users Say Thank You to ketut.kumajaya For This Useful Post: [ View ]
5th August 2011, 02:36 PM |#8  
LeimRen's Avatar
Member
Flag Jakarta
Thanks Meter: 0
 
More
ask how to flash?
wow..what a great work...i gotta try this...do i need to flash KPN 2.3.3 first then i can use this? can i flash this one from froyo for example? is this ROM already included check RAM script or something like that?
sorry for my bad english
5th August 2011, 06:11 PM |#9  
OP Recognized Developer
Flag Bekasi
Thanks Meter: 14,103
 
Donate to Me
More
Quote:
Originally Posted by LeimRen

wow..what a great work...i gotta try this...do i need to flash KPN 2.3.3 first then i can use this? can i flash this one from froyo for example? is this ROM already included check RAM script or something like that?
sorry for my bad english

You have to full flash (BOOT, Phone, PDA, CSC) your phone using ODIN. You can flash your own sec_csc.zip (extracted from csc.rfs using WinImage or MagicISO or linux) then. This firmware have all CF-Root- S5830 have, incl. CF-Root-S5830 CWM4 recovery b79 (b78 have CSC flashing error). The boot image using a modified version CF-Root-S5830 b80 for fast boot and apply ondemand CPU governer after boot complete. Fast boot but better battery life. If you need more efficient battery usage, set CPU governer to conservative using Tweak Manager. CF-Root-S5830 installed by default, /res/misc cleared so the boot image freeing some memory.
The Following 4 Users Say Thank You to ketut.kumajaya For This Useful Post: [ View ]
5th August 2011, 07:53 PM |#10  
LeimRen's Avatar
Member
Flag Jakarta
Thanks Meter: 0
 
More
Quote:
Originally Posted by ketut.kumajaya

You have to full flash (BOOT, Phone, PDA, CSC) your phone using ODIN. You can flash your own sec_csc.zip (extracted from csc.rfs using WinImage or MagicISO or linux) then. This firmware have all CF-Root- S5830 have, incl. CF-Root-S5830 CWM4 recovery b79 (b78 have CSC flashing error). The boot image using a modified version CF-Root-S5830 b80 for fast boot and apply ondemand CPU governer after boot complete. Fast boot but better battery life. If you need more efficient battery usage, set CPU governer to conservative using Tweak Manager. CF-Root-S5830 installed by default, /res/misc cleared so the boot image freeing some memory.

okay...thanks for the explanation, sir...downloading now....
5th August 2011, 08:28 PM |#11  
OP Recognized Developer
Flag Bekasi
Thanks Meter: 14,103
 
Donate to Me
More
Quote:
Originally Posted by LeimRen

okay...thanks for the explanation, sir...downloading now....

You're welcome! For ROM modificator (what I have call you), feel free to use my ROM as your template. I purposely did not make many changes in the userspace, but the core only. A proper credit for me is enough
The Following 6 Users Say Thank You to ketut.kumajaya For This Useful Post: [ View ]
Post Reply Subscribe to Thread

Tags
blackhawk rom, ketu.kamajaya rom, ketut.kumajaya rom

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes