[Q] [Help] Problem with the .tar.md5 - Galaxy S 4 Q&A, Help & Troubleshooting

Hi! First, excuse me for my bad english, I'm making my best but I'm not very good at it
So I made a few ROMs for MTK phones in the past, where the ROM inside looks like this : http://img11.hostingpics.net/pics/96413520130823185012.jpg
But actually, I have some hard times with the samsung format, .tar.md5.
I downloaded the stock ROM as a base, and there's just one file inside. If I open it with 7-Zip, there are many .img etc, like thaht : http://i1056.photobucket.com/albums/t375/danielblasko67/Capture_zpsdfb0af1e.png
Also, if I try to use the stock ROM with kitchen, it says no system files found...
I downloaded a custom ROM for GS4, and it's in the good format like the first image.
If someone would help me, I'd be very graceful, thanks!

GhostReDo said:
Hi! First, excuse me for my bad english, I'm making my best but I'm not very good at it
So I made a few ROMs for MTK phones in the past, where the ROM inside looks like this : http://img11.hostingpics.net/pics/96413520130823185012.jpg
But actually, I have some hard times with the samsung format, .tar.md5.
I downloaded the stock ROM as a base, and there's just one file inside. If I open it with 7-Zip, there are many .img etc, like thaht : http://i1056.photobucket.com/albums/t375/danielblasko67/Capture_zpsdfb0af1e.png
Also, if I try to use the stock ROM with kitchen, it says no system files found...
I downloaded a custom ROM for GS4, and it's in the good format like the first image.
If someone would help me, I'd be very graceful, thanks!
Click to expand...
Click to collapse
I'm cooking a rom with linux... all works fine but after the flash with odin don't boot.
My commands are:
Code:
===============
===============
rm -fR /home/csh/models/android/
===============
rm -fR /home/csh/models/output/*
===============
mkdir /home/csh/models/android/
===============
tar -xvf /home/csh/Desktop/I9505XXUGNG8_I9505WINGNF2_I9505XXUGNG8_HOME.tar.md5 -C /home/csh/models/android/
sbl1.mbn
sbl2.mbn
sbl3.mbn
rpm.mbn
aboot.mbn
tz.mbn
boot.img
recovery.img
system.img.ext4
modem.bin
NON-HLOS.bin
cache.img.ext4
hidden.img.ext4
===============
simg2img /home/csh/models/android/system.img.ext4 /home/csh/models/android/system_extract.img
===============
mkdir /home/csh/models/android/mount_point/
===============
mount -o loop /home/csh/models/android/system_extract.img /home/csh/models/android/mount_point
===============
===============
/home/csh/ext4android/extras-build/ext4_utils/make_ext4fs -s -l $(ls -l --block-size=M /home/csh/models/android/system_extract.img | awk {'print $5'}| tr -d '\n') -a system /home/csh/models/android/system_changed.img /home/csh/models/android/mount_point/
Creating filesystem with parameters:
Size: 2894069760
Block size: 4096
Blocks per group: 32768
Inodes per group: 8032
Inode size: 256
Journal blocks: 11040
Label:
Blocks: 706560
Block groups: 22
Reserved block group size: 175
Created filesystem with 3478/176704 inodes and 607307/706560 blocks
===============
umount /home/csh/models/android/mount_point/
===============
rm -fR /home/csh/models/android/mount_point/
===============
rm -f /home/csh/models/android/system.img.ext4
===============
rm -f /home/csh/models/android/system_extract.img
===============
mv /home/csh/models/android/system_changed.img /home/csh/models/android/system.img.ext4
===============
cd /home/csh/models/android/ && tar -H ustar -c * > /home/csh/models/output/OUT.tar
===============
cd /home/csh/models/output/ && md5sum -t OUT.tar >> OUT.tar
===============
mv /home/csh/models/output/OUT.tar /home/csh/models/output/OUT.tar.md5
===============
rm -fR /home/csh/models/android/
You can use them and skip automate tools ...

Related

First things I did before and just after rooting

Hey all.
Tools I used for flashing and backup:
on PC linux box:
- heimdall - which does the flashing
- netcat - (nc, ncat or netcat) tool for writing to or reading from network.
- partx - assigns partitioned disk images as kernel's loop devices like: loop0p2...loop0p25
on s3 mini:
- busybox
- "Rooted SSH/SFTP Daemon"
Before rooting reboot the phone to the download mode and download
the pit file with:
Code:
heimdall download-pit --output goldenxx.pit --no--reboot
Root your phone and install busybox and ssh daemon on it.
Start sshd but close all other apps to keep filesystem activity so low as possible.
start netcat on your PC:
Code:
netcat -l 192.168.0.11 5050 > mmcblk0.gz
Now netcat is listening for input from your lan (Replace address to corresponding your PC's IP address)
Now try to connect to your phone with ssh. When you got an # prompt then:
Code:
sync
and send your whole internal storage from phone to your PC:
Code:
cat /dev/block/mmcblk0 | gzip | nc 192.168.0.11 5050
Do not start any apps on your phone before you got back the command prompts both on phone and PC.
when you got a command prompt again and no error messages was printed. you should have an
gzip compressed disk image of you phones mmc on your PC.
Check its integrity running
Code:
gzip -t mmcblk0.gz
If the package is ok, copy the goldenxx.pit and mmcblk0.gz to the sure location.
Now you can make an uncompressed copy of mmcblk0.gz for example:
Code:
zcat Backup/mmcblk0.gz > ~/mmcblk0
With partx you can use the image like any other partitioned disks running as root:
Code:
partx -v -a ~/mmcblk0
it should print something like this:
Code:
partition: none, disk: mmcblk0, lower: 0, upper: 0
Trying to use '/dev/loop0' for the loop device
/dev/loop0: partition table type 'gpt' detected
/dev/loop0: partition #2 added
/dev/loop0: partition #3 added
/dev/loop0: partition #4 added
...
/dev/loop0: partition #25 added
and print out the data of partitions associated within kernel:
Code:
partx -s ~/mmcblk0
Code:
3 1024 3071 2048 1M PIT 52444e41-494f-2044-5049-540000000000
4 6144 8191 2048 1M MD5HDR 52444e41-494f-2044-4d44-354844520000
5 8192 9215 1024 512K STEboot1 52444e41-494f-2044-5354-45626f6f7431
6 9216 10239 1024 512K STEboot2 52444e41-494f-2044-5354-45626f6f7432
7 10240 11263 1024 512K Dnt 52444e41-494f-2044-446e-740000000000
8 11264 12287 1024 512K reserved 52444e41-494f-2044-7265-736572766564
9 16384 18431 2048 1M CSPSAFS 52444e41-494f-2044-4353-505341465300
10 18432 20479 2048 1M CSPSAFS2 52444e41-494f-2044-4353-505341465332
11 20480 53247 32768 16M EFS 52444e41-494f-2044-4546-530000000000
12 53248 86015 32768 16M ModemFS 52444e41-494f-2044-4d6f-64656d465300
13 86016 118783 32768 16M ModemFS2 52444e41-494f-2044-4d6f-64656d465332
14 118784 221183 102400 50M Fota 52444e41-494f-2044-466f-746100000000
15 380928 381055 128 64K IPL Modem 52444e41-494f-2044-4950-4c204d6f6465
16 385024 413695 28672 14M Modem 52444e41-494f-2044-4d6f-64656d000000
17 417792 421887 4096 2M Loke4 52444e41-494f-2044-4c6f-6b6534000000
18 421888 425983 4096 2M 2ndLoke4 52444e41-494f-2044-326e-644c6f6b6534
19 425984 458751 32768 16M PARAM 52444e41-494f-2044-5041-52414d000000
20 458752 491519 32768 16M Kernel 52444e41-494f-2044-4b65-726e656c0000
21 491520 524287 32768 16M Kernel2 52444e41-494f-2044-4b65-726e656c3200
22 524288 2981887 2457600 1.2G SYSTEM 52444e41-494f-2044-5359-5354454d0000
23 2981888 4702207 1720320 840M CACHEFS 52444e41-494f-2044-4341-434845465300
24 4702208 5357567 655360 320M HIDDEN 52444e41-494f-2044-4849-4444454e0000
25 5357568 15249407 9891840 4.7G DATAFS 52444e41-494f-2044-4441-544146530000
now you can explore the partitions and make images of it. For example:
Code:
file -s /dev/loop0p11
/dev/loop0p11: Linux rev 1.0 ext4 filesystem data, UUID=1b70457a-e011-c65a-87c6-f346bd874821, volume name "efs" (extents) (large files)
Code:
cat /dev/loop0p11 > ~/efs.ext4
and...
Code:
file -s /dev/loop0p16
Code:
/dev/loop0p16: data
It is modem.bin so:
Code:
cat /dev/loop0p16 > ~/modem.bin
Note that ext4 images must be transformed to the right .img-file form with ext2simg tool before flashing.
Be careful before flash your phone with these files.
remember to unmount all /dev/loop0 -partitions and finally
Code:
partx -d /dev/loop0
losetup -d /dev/loop0
because the images was copied from running system,
all writeable filesystems are not clean. So you might want to e2fsck these partitions.
KrRain said:
Hey all.
Tools I used for flashing and backup:
on PC linux box:
- heimdall - which does the flashing
- netcat - (nc, ncat or netcat) tool for writing to or reading from network.
- partx - assigns partitioned disk images as kernel's loop devices like: loop0p2...loop0p25
on s3 mini:
- busybox
- "Rooted SSH/SFTP Daemon"
Before rooting reboot the phone to the download mode and download
the pit file with:
Code:
heimdall download-pit --output goldenxx.pit --no--reboot
Root your phone and install busybox and ssh daemon on it.
Start sshd but close all other apps to keep filesystem activity so low as possible.
start netcat on your PC:
Code:
netcat -l 192.168.0.11 5050 > mmcblk0.gz
Now netcat is listening for input from your lan (Replace address to corresponding your PC's IP address)
Now try to connect to your phone with ssh. When you got an # prompt then:
Code:
sync
and send your whole internal storage from phone to your PC:
Code:
cat /dev/block/mmcblk0 | gzip | nc 192.168.0.11 5050
Do not start any apps on your phone before you got back the command prompts both on phone and PC.
when you got a command prompt again and no error messages was printed. you should have an
gzip compressed disk image of you phones mmc on your PC.
Check its integrity running
Code:
gzip -t mmcblk0.gz
If the package is ok, copy the goldenxx.pit and mmcblk0.gz to the sure location.
Now you can make an uncompressed copy of mmcblk0.gz for example:
Code:
zcat Backup/mmcblk0.gz > ~/mmcblk0
With partx you can use the image like any other partitioned disks running as root:
Code:
partx -v -a ~/mmcblk0
it should print something like this:
Code:
partition: none, disk: mmcblk0, lower: 0, upper: 0
Trying to use '/dev/loop0' for the loop device
/dev/loop0: partition table type 'gpt' detected
/dev/loop0: partition #2 added
/dev/loop0: partition #3 added
/dev/loop0: partition #4 added
...
/dev/loop0: partition #25 added
and print out the data of partitions associated within kernel:
Code:
partx -s ~/mmcblk0
Code:
3 1024 3071 2048 1M PIT 52444e41-494f-2044-5049-540000000000
4 6144 8191 2048 1M MD5HDR 52444e41-494f-2044-4d44-354844520000
5 8192 9215 1024 512K STEboot1 52444e41-494f-2044-5354-45626f6f7431
6 9216 10239 1024 512K STEboot2 52444e41-494f-2044-5354-45626f6f7432
7 10240 11263 1024 512K Dnt 52444e41-494f-2044-446e-740000000000
8 11264 12287 1024 512K reserved 52444e41-494f-2044-7265-736572766564
9 16384 18431 2048 1M CSPSAFS 52444e41-494f-2044-4353-505341465300
10 18432 20479 2048 1M CSPSAFS2 52444e41-494f-2044-4353-505341465332
11 20480 53247 32768 16M EFS 52444e41-494f-2044-4546-530000000000
12 53248 86015 32768 16M ModemFS 52444e41-494f-2044-4d6f-64656d465300
13 86016 118783 32768 16M ModemFS2 52444e41-494f-2044-4d6f-64656d465332
14 118784 221183 102400 50M Fota 52444e41-494f-2044-466f-746100000000
15 380928 381055 128 64K IPL Modem 52444e41-494f-2044-4950-4c204d6f6465
16 385024 413695 28672 14M Modem 52444e41-494f-2044-4d6f-64656d000000
17 417792 421887 4096 2M Loke4 52444e41-494f-2044-4c6f-6b6534000000
18 421888 425983 4096 2M 2ndLoke4 52444e41-494f-2044-326e-644c6f6b6534
19 425984 458751 32768 16M PARAM 52444e41-494f-2044-5041-52414d000000
20 458752 491519 32768 16M Kernel 52444e41-494f-2044-4b65-726e656c0000
21 491520 524287 32768 16M Kernel2 52444e41-494f-2044-4b65-726e656c3200
22 524288 2981887 2457600 1.2G SYSTEM 52444e41-494f-2044-5359-5354454d0000
23 2981888 4702207 1720320 840M CACHEFS 52444e41-494f-2044-4341-434845465300
24 4702208 5357567 655360 320M HIDDEN 52444e41-494f-2044-4849-4444454e0000
25 5357568 15249407 9891840 4.7G DATAFS 52444e41-494f-2044-4441-544146530000
now you can explore the partitions and make images of it. For example:
Code:
file -s /dev/loop0p11
/dev/loop0p11: Linux rev 1.0 ext4 filesystem data, UUID=1b70457a-e011-c65a-87c6-f346bd874821, volume name "efs" (extents) (large files)
Code:
cat /dev/loop0p11 > ~/efs.ext4
and...
Code:
file -s /dev/loop0p16
Code:
/dev/loop0p16: data
It is modem.bin so:
Code:
cat /dev/loop0p16 > ~/modem.bin
Note that ext4 images must be transformed to the right .img-file form with ext2simg tool before flashing.
Be careful before flash your phone with these files.
remember to unmount all /dev/loop0 -partitions and finally
Code:
partx -d /dev/loop0
losetup -d /dev/loop0
because the images was copied from running system,
all writeable filesystems are not clean. So you might want to e2fsck these partitions.
Click to expand...
Click to collapse
Cool.... What for...?
S3miniFin said:
Cool.... What for...?
Click to expand...
Click to collapse
Because now I have a backup of all partitions of my S3 Mini.

[Q] Galaxy S4 Odin Package Invalid MD5 Hash

Hi XDA!
I managed to bebloat and odex some extra system apps on my Stock Touchwiz ROM, and wanted to make a backup in case something goes wrong again. I tried to follow this guide: http://forum.xda-developers.com/showthread.php?t=2277127, however, Odin always throws an error 'MD5 hash value is invalid'. I suspect there is something wrong with my image, as the developer that started that thread said his packages worked perfectly. I used the make_ext4fs binary from this link: http://web.djodjo.org/dwn.php?ff=211260&a=download/android/tools/x86_linux/ext4tools:make_ext4fs, and copied it to my device. Is the binary supposed to be for Android? Somehow when I used other images(boot.img, for example) using the same method to package into an Odin flashable, Odin do not give the error. I have managed to create a working package of the system.img.ext4 before, but could not remember how I did it. Can someone point out what I did wrong?
This is what I did to dump the system.img.ext4(it's only 2400M because I have debloated the ROM, is this the problem?):
Code:
su
make_ext4fs -s -l 2400M -a system /storage/extSdCard/system.img.ext4 /system
This is what I did to create the Odin package:
Code:
tar -H ustar -c boot.img recovery.img system.img.ext4 > test.tar
md5sum -t test.tar >> test.tar
mv test.tar test.tar.md5
I also tried this when creating Odin package:
Code:
tar -c boot.img recovery.img system.img.ext4 > test.tar
md5sum -t test.tar >> test.tar
mv test.tar test.tar.md5
But both doesn't work. I realized when I only include boot.img or recovery.img or both(without system.img.ext4) and package these files the package passes Odin's MD5 check. Does anyone know what is the issue? Thank you very much!

[SCRIPT] Fix partition table for Android 4.4

Since the gapps for 4.4 need very much space wee need bigger system partitions.
I've created a script which automates this process and increases them both to 840MB.
the space is taken from the userdata partition.
You should backup your whole phone before doing this(storage will not be touched but you shouldn't take the risk)
I tested it with 32GB version only so if you want to know if it will work for 16gb, too give me the output of this command:
parted -s /dev/block/mmcblk0 print
Download:
http://d-h.st/FWz
Instructions:
1) boot into CWM
2) adb push repartition.sh /tmp
3) adb shell chmod 0777 /tmp/repartition.sh
4) adb shell /tmp/repartition.sh
5) adb reboot recovery
6) now you can do all the usual stuff like enabling TDB and installing ROM's
Sounds great but I cannot test it, since I dont have any parted binaries (at least in my 4.1.1 Wajk Wiui ROM) ? Can you please tell me where I can get them.
Second Question:
Im currently running TDB:
System 1 latest WIUI 4.1.1 v5 ROM
System 2 MIUI v6 1.9.19
Both system partitions are completely full (usage 98 %) and the same with the data partitions ( usage 97 % )!
Would it be possible to decrease /sdcard space and repartition it like the following with TDB enabled:
system 800 mb
system1 800 mb
data 1500 mb
data1 1500 mb
sdcard *the rest*
thanks in advance
sounds like you tried to repartition from Android
You need to boot to CWM - you have parted there.
Sorry I hate people who just ask stupid questions before reading the instructions carefully ...silly me sorry for that...
What about the second question, is it possible to either increase the data partitions for less space on /sdcard ?
there isn't sth. like a data1 partition. we have one data partition only that's why we need the TDB hack.
other than that it's possible but you should backup all your data and restore it afterwards.
m11kkaa said:
there isn't sth. like a data1 partition. we have one data partition only that's why we need the TDB hack.
other than that it's possible but you should backup all your data and restore it afterwards.
Click to expand...
Click to collapse
Ok got it.
So following your instructions and editing script like the following should work ?
Code:
change_table() {
ui_print "parted: delete"
parted -s /dev/block/mmcblk0 rm 23 || return 1 # system
parted -s /dev/block/mmcblk0 rm 24 || return 1 # system1
parted -s /dev/block/mmcblk0 rm 25 || return 1 # cache
parted -s /dev/block/mmcblk0 rm 26 || return 1 # userdata
parted -s /dev/block/mmcblk0 rm 27 || return 1 # storage
ui_print "parted: create"
parted -s /dev/block/mmcblk0 mkpartfs primary ext2 336MB 1176MB || return 1
parted -s /dev/block/mmcblk0 mkpartfs primary ext2 1176MB 2016MB || return 1
parted -s /dev/block/mmcblk0 mkpartfs primary ext2 2016MB 2419MB || return 1
parted -s /dev/block/mmcblk0 mkpartfs primary ext2 2419MB 6515MB || return 1
parted -s /dev/block/mmcblk0 mkpartfs primary ext2 6515MB 31.3GB || return 1
ui_print "parted: name"
parted -s /dev/block/mmcblk0 name 23 system || return 1
parted -s /dev/block/mmcblk0 name 24 system1 || return 1
parted -s /dev/block/mmcblk0 name 25 cache || return 1
parted -s /dev/block/mmcblk0 name 26 userdata || return 1
parted -s /dev/block/mmcblk0 name 27 storage || return 1
return 0
}
Code:
ui_print "format partitions"
for NUM in 23 24 25 26 27
do
if ! format_partition "$NUM"; then
ui_print "Failed format partition $NUM"
exit 1
fi
done
already did full backup of sdcard, i just dont know if i should disable TDB before i stat repartitioning ... I dont know how TDB works to split the data partition thats my problem :/
yes that should work.
You don't need to disable TDB because your whole data partition will be wiped and it stores the TDB configuration(that means that TDB automatically gets disabled).
Had some errors but now its working fine ..thanks
unmount sdcard in CWM. It's a bug of this script.
Nice to hear it works now.
7 days ago Phone not start because partition corrupt
Hello
First do not panic is not the fault of your script but for you experience with mi2s and partitions are the few people in the world that can save my phone.
I'm playing a game phone(Xiaomi m2s 16GB) hang and one or more partitions are corrupt (I think this is the problem). But all de documentation than i find to delete o edit partition not work. Fastboot rom installation all ok but always only start with white logo. Mirecovery works perfectly and CWM by ivan works but temporally with this command sudo fastboot boot recovery.img
This is the result of your script
check environment
/sbin/mount
/sbin/umount
/sbin/parted
/sbin/tune2fs
/sbin/e2fsck
dump old table
unmount partitions
umount: can't umount /system: Invalid argument
umount: can't umount /system1: No such file or directory
umount: can't umount /data: Invalid argument
umount: can't umount /data_root: Invalid argument
umount: can't umount /sdcard: Invalid argument
change partition table
parted: delete
parted: create
Error: Unable to satisfy all constraints on the partition.
Failed changing table
OTHER TEST
/dev/block # e2fsck -fDp /dev/block/mmcblk0p24
e2fsck: Bad magic number in super-block while trying to open /dev/block/mmcblk0p24
/dev/block/mmcblk0p24:
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
/dev/block # tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p24
tune2fs 1.41.14 (22-Dec-2010)
tune2fs: Bad magic number in super-block while trying to open /dev/block/mmcblk0p24
Couldn't find valid filesystem superblock.
I try to delete partition and create a new one but fail.
(parted) rm 24
rm 24
(parted) mkpartfs primary ext2 872 1409
mkpartfs primary ext2 872 1409
Error: Unable to satisfy all constraints on the partition.
I FOUND THIS IN XDA FORUM BUT I HAVEN'T IMAGE TO TEST
adb push mmcblk0p19_repaired.img /tmp/
adb shell dd if=/tmp/mmcblk0p19_repaired.img of=/dev/block/mmcblk0p19
adb reboot bootloader
MY PARTITION TABLE SYSTEM1 NOT HAVE FILESYSTEM EXT4
[email protected]:~/Escritorio/recovery$ sudo adb shell parted -s /dev/block/mmcblk0 print
Model: MMC SEM16G (sd/mmc)
Disk /dev/block/mmcblk0: 15.8GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 17.4kB 89.1MB 89.1MB fat16 modem
2 89.1MB 178MB 89.1MB fat16 modem1
3 178MB 179MB 524kB sbl1
4 179MB 179MB 524kB sbl2
5 179MB 180MB 1049kB sbl3
6 180MB 181MB 1049kB rpm
7 181MB 182MB 1049kB tz
8 182MB 183MB 524kB DDR
9 183MB 187MB 4194kB aboot
10 187MB 188MB 1049kB misc
11 188MB 191MB 2990kB logo
12 191MB 192MB 799kB m9kefs1
13 192MB 193MB 799kB m9kefs2
14 193MB 193MB 1024B m9kefsc
15 193MB 201MB 8501kB bk1
16 201MB 202MB 799kB m9kefs3
17 202MB 268MB 66.3MB bk2
18 268MB 284MB 15.7MB boot
19 284MB 300MB 15.7MB boot1
20 300MB 316MB 15.7MB recovery
21 316MB 327MB 11.5MB bk3
22 327MB 336MB 8389kB ext4 persist
23 336MB 872MB 537MB ext4 system
24 872MB 1409MB 537MB system1
25 1409MB 1812MB 403MB ext4 cache
26 1812MB 5570MB 3758MB ext4 userdata
27 5570MB 15.8GB 10.2GB ext4 storage
Xiaomi Mi2 32GB
XIAOMI MI2 32GB ONLY
For those using a single MIUI ROM I've made a partition table with system1 set to 1024Mb.
Run the attached from CWM (in /tmp).
Aternus said:
XIAOMI MI2 32GB ONLY
For those using a single MIUI ROM I've made a partition table with system1 set to 1024Mb.
Run the attached from CWM (in /tmp).
Click to expand...
Click to collapse
Can you explain a little more? Does it only leave 1 system partition? Can I flash it like a regular zip?
Enviado desde mi MI 2S mediante Tapatalk
any step by step manual how to change partition? with all necessary downloads etc...
or.... is it possible to delete system2 with all its parts? - for me I'd to use system1 only
Why can not I change the size of the system partition?
Already tried several times, with disabled TDB and with enabled TDB.
Full wipe did and still no result.
P.S. I have already been able to do any repartitioning.
Code:
PS C:\Android> adb push repartition.sh /tmp
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
21 KB/s (3797 bytes in 0.169s)
PS C:\Android> adb shell chmod 0777 /tmp/repartition.sh
PS C:\Android> adb shell /tmp/repartition.sh
check environment
/sbin/mount
/sbin/umount
/sbin/parted
/sbin/tune2fs
/sbin/e2fsck
dump old table
__bionic_open_tzdata: couldn't find any tzdata when looking for localtime!
__bionic_open_tzdata: couldn't find any tzdata when looking for GMT!
__bionic_open_tzdata: couldn't find any tzdata when looking for posixrules!
unmount partitions
umount: can't umount /system: Invalid argument
umount: can't umount /system1: No such file or directory
umount: can't umount /data: Invalid argument
umount: can't umount /sdcard: Invalid argument
change partition table
parted: delete
parted: create
parted: name
format partitions
format: /dev/block/mmcblk0p23
tune2fs 1.41.14 (22-Dec-2010)
tune2fs: No such file or directory while trying to open /dev/block/mmcblk0p23
Couldn't find valid filesystem superblock.
e2fsck 1.41.14 (22-Dec-2010)
e2fsck: No such file or directory while trying to open /dev/block/mmcblk0p23
Possibly non-existent device?
tune2fs 1.41.14 (22-Dec-2010)
e2fsck 1.41.14 (22-Dec-2010)
Adding dirhash hint to filesystem.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 3A: Optimizing directories
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/block/mmcblk0p23: ***** FILE SYSTEM WAS MODIFIED *****
/dev/block/mmcblk0p23: 11/500856 files (0.0% non-contiguous), 62917/1000445 blocks
format: /dev/block/mmcblk0p24
tune2fs 1.41.14 (22-Dec-2010)
Creating journal inode: done
This filesystem will be automatically checked every 30 mounts or
0 days, whichever comes first. Use tune2fs -c or -i to override.
e2fsck 1.41.14 (22-Dec-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 3A: Optimizing directories
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/block/mmcblk0p24: ***** FILE SYSTEM WAS MODIFIED *****
/dev/block/mmcblk0p24: 11/262144 files (0.0% non-contiguous), 49386/524289 blocks
tune2fs 1.41.14 (22-Dec-2010)
e2fsck 1.41.14 (22-Dec-2010)
Adding dirhash hint to filesystem.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 3A: Optimizing directories
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/block/mmcblk0p24: ***** FILE SYSTEM WAS MODIFIED *****
/dev/block/mmcblk0p24: 11/262144 files (0.0% non-contiguous), 49386/524289 blocks
format: /dev/block/mmcblk0p25
tune2fs 1.41.14 (22-Dec-2010)
Creating journal inode: done
This filesystem will be automatically checked every 30 mounts or
0 days, whichever comes first. Use tune2fs -c or -i to override.
e2fsck 1.41.14 (22-Dec-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 3A: Optimizing directories
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/block/mmcblk0p25: ***** FILE SYSTEM WAS MODIFIED *****
/dev/block/mmcblk0p25: 11/196608 files (0.0% non-contiguous), 32935/393217 blocks
tune2fs 1.41.14 (22-Dec-2010)
e2fsck 1.41.14 (22-Dec-2010)
Adding dirhash hint to filesystem.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 3A: Optimizing directories
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/block/mmcblk0p25: ***** FILE SYSTEM WAS MODIFIED *****
/dev/block/mmcblk0p25: 11/196608 files (0.0% non-contiguous), 32935/393217 blocks
format: /dev/block/mmcblk0p26
tune2fs 1.41.14 (22-Dec-2010)
Creating journal inode: done
This filesystem will be automatically checked every 30 mounts or
0 days, whichever comes first. Use tune2fs -c or -i to override.
e2fsck 1.41.14 (22-Dec-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 3A: Optimizing directories
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/block/mmcblk0p26: ***** FILE SYSTEM WAS MODIFIED *****
/dev/block/mmcblk0p26: 11/399200 files (9.1% non-contiguous), 28951/798348 blocks
tune2fs 1.41.14 (22-Dec-2010)
e2fsck 1.41.14 (22-Dec-2010)
Adding dirhash hint to filesystem.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 3A: Optimizing directories
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/block/mmcblk0p26: ***** FILE SYSTEM WAS MODIFIED *****
/dev/block/mmcblk0p26: 11/399200 files (9.1% non-contiguous), 28951/798348 blocks
Done.
PS C:\Android> adb reboot recovery
PS C:\Android>
UPD. The problem was that I was using Windows Povershell
Run the script from the command line and everything turned out.
Thanks!
I have to format first system and system1 in recovery to apply this script, because I have and error :
tmp/repartition.sh lin 115 can´t create /sdcard/parted_12_06_2014_FDFD6F4CB043F4956D9CAD053C3738AA.
DO MOUNT your SDCARD
then Follow the instruction
duhh...
I modified the script a little bit for 1 ROM usage. System1 is 840MB as in the original and System2 is 5MB. The rest goes into userdata. This is for the 16GB version.
Ok! I did again and umount the sdcard abd it worked fine.
Thanks
I found a better way
If u reboot into dload mode, u can change the partition table from your computer
The problem is that most partition managers don't support changing the GPT Partition names and that's why I added support for that to GParted.
GParted supports booting from Live CD/USB so Windows/Mac users aren't left out.
http://i.imgur.com/3SwSXs2.png
I pushed the patch to GParted repo's and I'll inform u once there're any news.
from my point of view the best way for use is:
- system (system1) - let 1024 MB
- system1 (system2) - let 10 MB
- userdata (apps) - let 4096 MB (take it from sdcard) - but maybe more

How to fix bad Superblocks ?

Hello,
I have an Iconia A200 that I tried to flash with the latest Imni-Rom 4.4.4 .
So far I had a lot of obstacles cause of missing Knowledge, but status is now:
- Bootloader CWM 6.045 installed and unlocked
- Had issues with formatting/mounting, but fixed.
- Flashed Omnirom, but it doesnt boot up -> Unable to purge /Data
Now I cannot 'use' the Data Partition.
I tried the codeblock this Codeblock via ADB:
Code:
1) mke2fs -j -b 4096 /dev/block/mmcblk0p8
2) tune2fs -O extents,uninit_bg,dir_index -C 1 /dev/block/mmcblk0p8
3) e2fsck -fy /dev/block/mmcblk0p8
The first Command i had to repeat 20 times, cause it always stopped at
Code:
'Writing inode tables: 72/224'
The second Command does not work.
The third says me:
Code:
Code:
e2fsck 1.41.14 (22-Dec-2010)
e2fsck: Superblock invalid, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open /dev/block/mmcblk0p8
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
When i try the -b Option the result is the same.
Do I have bad Blocks in the internal Memory?
Any chance to fix this?
Thanks!

cannot lookup security context for /system/addon.d

So I'm trying to write up a simple system image patcher for my lineageOS rom (V20 Nougat).
When trying to pack the img after modification, I get this error:
Re-packing img.
Code:
/home/guy/Desktop/ROM_EXTRACT/file_contexts.bin: line 1 is missing fields, skipping
/home/guy/Desktop/ROM_EXTRACT/file_contexts.bin: line 21 is missing fields, skipping
/home/guy/Desktop/ROM_EXTRACT/file_contexts.bin: line 37 is missing fields, skipping
/home/guy/Desktop/ROM_EXTRACT/file_contexts.bin: line 38 is missing fields, skipping
/home/guy/Desktop/ROM_EXTRACT/file_contexts.bin: line 74 is missing fields, skipping
/home/guy/Desktop/ROM_EXTRACT/file_contexts.bin: line 76 is missing fields, skipping
/home/guy/Desktop/ROM_EXTRACT/file_contexts.bin: line 78 is missing fields, skipping
/home/guy/Desktop/ROM_EXTRACT/file_contexts.bin: line 79 is missing fields, skipping
/home/guy/Desktop/ROM_EXTRACT/file_contexts.bin: line 80 is missing fields, skipping
/home/guy/Desktop/ROM_EXTRACT/file_contexts.bin: line 81 is missing fields, skipping
/home/guy/Desktop/ROM_EXTRACT/file_contexts.bin: line 82 is missing fields, skipping
Creating filesystem with parameters:
Size: 2684190720
Block size: 4096
Blocks per group: 32768
Inodes per group: 8192
Inode size: 256
Journal blocks: 10239
Label:
Blocks: 655320
Block groups: 20
Reserved block group size: 159
error: build_directory_structure: cannot lookup security context for /system/addon.d
Any idea what I'm doing wrong?
Here is a whole copy of my script so far:
Code:
echo "Deleting old folder if it exists."
echo
rm -r ~/Desktop/ROM_EXTRACT
echo "Extracting ROM."
echo
unzip ~/Desktop/NULL_ROM.zip -d ~/Desktop/ROM_EXTRACT
echo "Changing directories"
echo
cd ~/Desktop/ROM_EXTRACT
echo "Copying Tools."
echo
mkdir ~/Desktop/ROM_EXTRACT/TOOLS
cp ~/Desktop/PATCH_TOOLS/* ~/Desktop/ROM_EXTRACT/TOOLS
chmod 0777 ~/Desktop/ROM_EXTRACT/TOOLS/*
echo "Extracting dat."
echo
mkdir ~/Desktop/ROM_EXTRACT/EXTRACT
./TOOLS/sdat2img.py system.transfer.list system.new.dat ./EXTRACT/system.img
echo "Mounting img."
echo
mkdir ~/Desktop/ROM_EXTRACT/EXTRACT/MODIFY
sudo mount -t ext4 -o loop ./EXTRACT/system.img ~/Desktop/ROM_EXTRACT/EXTRACT/MODIFY
sudo mount -o remount,rw ~/Desktop/ROM_EXTRACT/EXTRACT/MODIFY
echo "PATCH IMG"
echo
echo "Re-packing img."
echo
./TOOLS/make_ext4fs -T 0 -S ~/Desktop/ROM_EXTRACT/file_contexts.bin -l 2684190720 -a system ./system_new.img ~/Desktop/ROM_EXTRACT/EXTRACT/MODIFY
echo "Cleaning up."
echo
sudo umount ~/Desktop/ROM_EXTRACT/EXTRACT/MODIFY
sudo rmdir ~/Desktop/ROM_EXTRACT/EXTRACT/MODIFY
Hi There, did you resolve this issue at all? I have the exact same problem and same errors as this. System.img unpacks fine, I just tweaked the build.prop for a test and got the same "line xx is missing..." errors on the file_contexts and also
"Cannot lookup security context for /system/.build.prop.swp"
I am working on Ubuntu 16.4.3 inside virtualbox on W10 host machine.
Dave
OK, so i answered my own question!
Firstly I found that the file_contexts file in Android 7.x+ is now a binary file so the make_ext4fs script cannot read from it. I used a converter tool to get the text version and that solved the issue with not being able to read from the lines.
Secondly I resolved the issue with the permissions by checking the permission on my Ubuntu system. Stupidly I had not sudo'd correctly in creating the mount folder so my system.img in fact was empty. I checked the permissions on all the folders I have been using and that resolved the issue. Bingo the new system.img flashed no problem!
Hope this helps someone.

Categories

Resources