[Noob Friendly][Guide] How to extract .ext4 file while using linux ! - Sony Xperia Miro, Tipo (Dual), J, E

There may be alot of guides out there how to make flashable zip of your ftf released by Sony ! But extracting ext4 files can be a headache !
I tried searching alot ! learned alot ! there were so many information that a Noob(like me) can be so much confused !
You can extract .ext4 file on windows also but that may cause BOOTLOOP also ! [PERSONAL EXPERIENCE]
So here are the simple steps to extract .ext4 files easily in linux !
1) open terminal
2) type
sudo nautilus
Click to expand...
Click to collapse
this will open dialogue box with admin privilage
3) place ext4 file on the desktop and create a folder named mounted in the same directory
4)than type following in terminal,
sudo mount -o loop /root/desktop/system.ext4 /home/USERNAME/Desktop/mounted
Click to expand...
Click to collapse
(Basic Structure of that command is: sudo mount flag loop ext4 directory mounted directory !)
HERE;
/root/desktop/system.ext4 is the directory of .ext4 file
/home/USERNAME/Desktop/mounted is the directory of destination folder !
AND DONE ! You can grab those files and put in system folder of your zip file !
NOTE THAT: THIS EXTRACTED DATA WILL BE ODEXED !

ShivangDave said:
...
Click to expand...
Click to collapse
Hi, This was the guide which i was really looking for but unfortunately the code is not working for me in can you please check it again ?
Edit: Thanks it worked ! Great. The explanation for the code given by you helped me solving it ! Thanks a lot bro

M4ST3R-V said:
Hi, This was the guide which i was really looking for but unfortunately the code is not working for me in can you please check it again ?
Edit: Thanks it worked ! Great. The explanation for the code given by you helped me solving it ! Thanks a lot bro
Click to expand...
Click to collapse
Glad to hear that

ShivangDave said:
Glad to hear that
Click to expand...
Click to collapse
desktop is spelled with a capital D

thank you! using today this noob guide, very helpfull!!!

Buddy..I wanna try making a zip from ftf.
So I have extracted the system.sin into a folder system...
Now I need meta-inf to be kept along with system into a zip right....
So if I go wrong somewhere will I brick my phone..
Also can I simply delete all the unwanted apps from apps folder?
Please..I know you are a guy who knows all these stuff..I saw many guides,yet I am afraid if somethin bad will happen to my device..
Plz help me... I need you badly.
Hit the thanks button..it does not cost you anything.
it's worth something for me...
sent from my Sony Xperia e dual

mathewsj114 said:
Buddy..I wanna try making a zip from ftf.
So I have extracted the system.sin into a folder system...
Now I need meta-inf to be kept along with system into a zip right....
So if I go wrong somewhere will I brick my phone..
Also can I simply delete all the unwanted apps from apps folder?
Please..I know you are a guy who knows all these stuff..I saw many guides,yet I am afraid if somethin bad will happen to my device..
Plz help me... I need you badly.
Hit the thanks button..it does not cost you anything.
it's worth something for me...
sent from my Sony Xperia e dual
Click to expand...
Click to collapse
http://forum.xda-developers.com/showthread.php?t=2183077

ShivangDave said:
There may be alot of guides out there how to make flashable zip of your ftf released by Sony ! But extracting ext4 files can be a headache !
I tried searching alot ! learned alot ! there were so many information that a Noob(like me) can be so much confused !
You can extract .ext4 file on windows also but that may cause BOOTLOOP also ! [PERSONAL EXPERIENCE]
So here are the simple steps to extract .ext4 files easily in linux !
1) open terminal
2) type
this will open dialogue box with admin privilage
3) place ext4 file on the desktop and create a folder named mounted in the same directory
4)than type following in terminal,
(Basic Structure of that command is: sudo mount flag loop ext4 directory mounted directory !)
HERE;
/root/desktop/system.ext4 is the directory of .ext4 file
/home/USERNAME/Desktop/mounted is the directory of destination folder !
AND DONE ! You can grab those files and put in system folder of your zip file !
NOTE THAT: THIS EXTRACTED DATA WILL BE ODEXED !
Click to expand...
Click to collapse
nautilus is just for ubuntu, mention that you need to swap nautilus with your file manager if you're using a different distro other than ubuntu(e.g lubuntu= pcmanfm )
Also when using GUI and sudo, it's best to use gksudo instead of sudo.

Hi,
It works fine, so thanks for that, but I end up with a ''volume of 682 MB''. Unmounting and ejecting doesn't work and simply deleting it, also won't work. Does anyone have any idea how to remove this ''device'' from my system? It's quite annoying and takes in space.
Thanks!

Never mind , a reboot fixed it...
Sent from my C1505 using XDA Premium 4 mobile app

ShivangDave said:
1) open terminal
2) type
Code:
sudo nautilus
this will open dialogue box with admin privilage
3) place ext4 file on the desktop and create a folder named mounted in the same directory
4)than type following in terminal,
Code:
sudo mount -o loop /root/desktop/system.ext4 /home/USERNAME/Desktop/mounted
Click to expand...
Click to collapse
First off let me say that I am in no way a Linux user, but I tend to be quite resourceful when it comes to researching. This one is beginning to stump me. Second, I am using crunchbang {a Debian (Wheezy)} build and therefore I had to modify the coding a little bit.
This is what I did just to even get it to accept my query without issues
Code:
sudo nautilus
This pulled up my Desktop in File Manager with root privileges. I created the mounted folder and put the system.img.ext4 in the Desktop location. Debian, or crunchbang, does not have a physical Desktop for placing files, as far as I have learned, just this folder located in the root folder. Anyways, after doing those two things I did this
Code:
sudo mount -t ext4 /root/Desktop/system.img.ext4 /root/Desktop/mounted
This was the first code I tried that didn't return any error about the location, fs, or anything. Feeling hopeful that I had finally figured out and was going to be able to access my system.img I look at my Desktop folder and open up the mounted folder, what do I see? Lost+Found folder with nothing in it, and a hidden folder called .Trash-0 which contains two folders "files" and "info". "files" contains a folder just like the non-hidden lost+found with nothing in it and the "info" folder which contains an 0byte file titled lost+foundinfo. My system file is over 2GB in size, so I am at a standstill because I do not know how to proceed.

jacodaburr said:
First off let me say that I am in no way a Linux user, but I tend to be quite resourceful when it comes to researching. This one is beginning to stump me. Second, I am using crunchbang {a Debian (Wheezy)} build and therefore I had to modify the coding a little bit.
This is what I did just to even get it to accept my query without issues
Code:
sudo nautilus
This pulled up my Desktop in File Manager with root privileges. I created the mounted folder and put the system.img.ext4 in the Desktop location. Debian, or crunchbang, does not have a physical Desktop for placing files, as far as I have learned, just this folder located in the root folder. Anyways, after doing those two things I did this
Code:
sudo mount -t ext4 /root/Desktop/system.img.ext4 /root/Desktop/mounted
This was the first code I tried that didn't return any error about the location, fs, or anything. Feeling hopeful that I had finally figured out and was going to be able to access my system.img I look at my Desktop folder and open up the mounted folder, what do I see? Lost+Found folder with nothing in it, and a hidden folder called .Trash-0 which contains two folders "files" and "info". "files" contains a folder just like the non-hidden lost+found with nothing in it and the "info" folder which contains an 0byte file titled lost+foundinfo. My system file is over 2GB in size, so I am at a standstill because I do not know how to proceed.
Click to expand...
Click to collapse
change the directory if possible, and change the command according to it.. Because I'm in no way a crunchbang user let me know if i can help in any other way though...
sudo mount flag loop ext4directory mounteddirectory

ShivangDave said:
change the directory if possible, and change the command according to it.. Because I'm in no way a crunchbang user let me know if i can help in any other way though...
sudo mount flag loop ext4directory mounteddirectory
Click to expand...
Click to collapse
trying to use that code with flag and/or loop returns this
Code:
Usage: mount -V : print version
mount -h : print this help
mount : list mounted filesystems
mount -l : idem, including volume labels
So far the informational part. Next the mounting.
The command is `mount [-t fstype] something somewhere'.
Details found in /etc/fstab may be omitted.
mount -a [-t|-O] ... : mount all stuff from /etc/fstab
mount device : mount device at the known place
mount directory : mount known device here
mount -t type dev dir : ordinary mount command
Note that one does not really mount a device, one mounts
a filesystem (of the given type) found on the device.
One can also mount an already visible directory tree elsewhere:
mount --bind olddir newdir
or move a subtree:
mount --move olddir newdir
One can change the type of mount containing the directory dir:
mount --make-shared dir
mount --make-slave dir
mount --make-private dir
mount --make-unbindable dir
One can change the type of all the mounts in a mount subtree
containing the directory dir:
mount --make-rshared dir
mount --make-rslave dir
mount --make-rprivate dir
mount --make-runbindable dir
A device can be given by name, say /dev/hda1 or /dev/cdrom,
or by label, using -L label or by uuid, using -U uuid .
Other options: [-nfFrsvw] [-o options] [-p passwdfd].
For many more details, say man 8 mount .

Related

Few EXt2 questions

Is it possible to veiw the files in the EXt2 partition from our G1 terminal? If so, can we also delete files? If so, someone explain how, thanks.
asuming is mounted on /system/sd
just
cd /system/sd
ls -la /system/sd
to list the files
is their a way to erase those files
There are commands for deleting files on Android. Look up the Linux Command prompt commands for performing those functions.
If you've rooted your phone and don't know the commands already, you haven't been paying attention to the instructions.
ls = directory listing
cp = copy
mv = move/rename
rm = remove
Those are the very basics. Remember that Unix-like operating systems are case-sensitive and file.txt is different from File.txt or file.TXT.
If you're using wildcards to delete everything, take a precaution and use the dot-slash. It could save you a lot of trouble by ensuring you're only deleting files in the current working directory. To remove all text files in a directory, for example, you'd type rm ./*.txt
god, i hate how rude people are. I grew up with DOS, so dir, and del come more naturally to me than linux commands. So just ease up on the ppl that don't know linux. I didn't know linux til i started to IRC and wanted to run an eggdrop bot. Not like everyone has irc'd or compiled, or whatever. Heck, it has been so long now, I could not write an irc script or egg addon, and I think i was the first to develop some scripts in IRC 20 years ago. So all I can say is chill.
Shaggy
??huh??
whats the beef all about?
you can google the command and linux and probably have a ton of sites that list and explain the usage and stuff like that for *nix commands unix is a very old OS linus torvalds just woke up 1 day at age 15 or sumthin and said im gonna make a unix kernal that runs on my intel based pc and then instead of selling it and making a fortune I'll give it away and still make a fortune.
LINUS is the greatest man of our time, when the other OS was charging BIG $ to run Apache web servers in the .com boom (even more so now) linux was FREE and gave better throughput on the same hardware
Now if you want a pretty box booklet and packaging as you have become accustomed they have them to, some just feel better if they pay for it, free must not be as good as the one that costs right?
why did I bother just rambling, please ignore the babbling lunatic in the corner he is harmless
bhang
beartard said:
If you've rooted your phone and don't know the commands already, you haven't been paying attention to the instructions.
ls = directory listing
cp = copy
mv = move/rename
rm = remove
Those are the very basics. Remember that Unix-like operating systems are case-sensitive and file.txt is different from File.txt or file.TXT.
If you're using wildcards to delete everything, take a precaution and use the dot-slash. It could save you a lot of trouble by ensuring you're only deleting files in the current working directory. To remove all text files in a directory, for example, you'd type rm ./*.txt
Click to expand...
Click to collapse
if you dontknow how to be polite to the noobz then dont say anything at all. let someone else answer their questions.
Hi Beartard,
Thanks for the info.
This site has such a wealth of information, that it can be overwhelming to many members.
Can you tell me how to copy my apps-private from my ext2 partition to my sd card partition so I can back them up?
Thanks
beartard said:
If you've rooted your phone and don't know the commands already, you haven't been paying attention to the instructions.
ls = directory listing
cp = copy
mv = move/rename
rm = remove
Those are the very basics. Remember that Unix-like operating systems are case-sensitive and file.txt is different from File.txt or file.TXT.
If you're using wildcards to delete everything, take a precaution and use the dot-slash. It could save you a lot of trouble by ensuring you're only deleting files in the current working directory. To remove all text files in a directory, for example, you'd type rm ./*.txt
Click to expand...
Click to collapse
uh you wan't to copy your "app-private" folder as a backup in to yoru sdcard correct? well try this
busybox cp -a /system/sd/app-private /sdcard/app-private
if it don't allows you to copy do this command to re mount the system as read-write
mount -oremount,rw /dev/block/mtdblock3 /system
Hi Nitro .
I tried it both ways and it says operation not permitted.
-------------------
Update:
But wait, I connected my phone to the computer and the app-private is copied to the sdcard.
Your procedure worked!
I erased the folder that was copied to test it again.
Then I used just this set of commands and it worked again:
busybox cp -a /system/sd/app-private /sdcard/app-private
So you still get the same error, but it works.
Thanks alot Nitro!!!
Nitro212 said:
uh you wan't to copy your "app-private" folder as a backup in to yoru sdcard correct? well try this
busybox cp -a /system/sd/app-private /sdcard/app-private
if it don't allows you to copy do this command to re mount the system as read-write
mount -oremount,rw /dev/block/mtdblock3 /system
Click to expand...
Click to collapse
u tried it as root? what error u got?
well glad it worked.
Hi,
The error says:
"cannot preserve ownership of ... cannot preserve permissions of ... operation not permitted"
for every file it tries to transfer.
But then when you look in your sdcard the app-private is there.
So it is a false error.
Thanks again.
Nitro212 said:
uh you wan't to copy your "app-private" folder as a backup in to yoru sdcard correct? well try this
busybox cp -a /system/sd/app-private /sdcard/app-private
if it don't allows you to copy do this command to re mount the system as read-write
mount -oremount,rw /dev/block/mtdblock3 /system
Click to expand...
Click to collapse
It's not working for me...
My error is this:
cp: cannot stat '/system/sd/app-private': No such file or directory
Hi,
Use terminal emulator jf 1.41 or better
type su enter
then the busybox commands
Connect your phone to your computer and look on your memory card.
app-private is there
Proxin said:
It's not working for me...
My error is this:
cp: cannot stat '/system/sd/app-private': No such file or directory
Click to expand...
Click to collapse
bestwebs said:
Hi,
Use terminal emulator jf 1.41 or better
type su enter
then the busybox commands
Connect your phone to your computer and look on your memory card.
app-private is there
Click to expand...
Click to collapse
hey guys need some help here i have the same problem, (as far as the error saying 'no such file or dir') and i tried your suggestion about typing su first then the busybox commands.
i have the most current terminal emulator, unfortunately i still continue to get the same error every time i try to run the busybox commands. it just simply say 'no such file or directory"
you guys have any suggestions for me to try ?
any help would be great.
the error i get is "cannot preserve permissions of" i think that error is not something harmful im n o *nix expert but is just saying it wont save the permision of that folder i think...
Code:
# mkdir /sdcard/bk
mkdir /sdcard/bk
# busybox cp -rf /data/app-private/ /sdcard/bk
busybox cp -rf /data/app-private/ /sdcard/bk
cp: cannot preserve permissions of '/sdcard/bk/app-private': Operation not permi
tted
# ls /sdcard/bk
ls /sdcard/bk
app-private
thats what i did.. worked for me.. moved the app-private in to a folder named bk inside the sdcard
Hi,
We are assuming that you have already moved your apps and caches to the memory in a ext2 partition, correct?
Otherwise this will not work.
I 1st followed all the instructions in this post:
http://forum.xda-developers.com/showthread.php?t=468959
All this has to be done 1st including the 2 step 13's
onikus said:
hey guys need some help here i have the same problem, (as far as the error saying 'no such file or dir') and i tried your suggestion about typing su first then the busybox commands.
i have the most current terminal emulator, unfortunately i still continue to get the same error every time i try to run the busybox commands. it just simply say 'no such file or directory"
you guys have any suggestions for me to try ?
any help would be great.
Click to expand...
Click to collapse
nitro all i can say is thank you very much, i was looking through a 15 yr old unix book looking up commands, and it's just been so damn long ago i couldn't put it together.
thanks a ton. i'm sure you saved me at least a few hours.
@bestwebs ya i have done everything else including moving things to the ext2 partition i was just stuck on a few comands here and there.
but again thanks to both of you, and i'm all setup up now.
Hi,
Nitro is a real blast!
Glad it's working.

[HOW-TO] ROM-HACKING: init.rc ext2-auto-mount / ROM Signing / ROM Kitchen

AS MENTIONED IN THE INTRODUCTION TEXT THIS HAS ONLY BEEN TESTED ON AMON RA ROM 1.6.2 BUT SHOULD REALLY WORK ON ANY ROM THAT HAS NO EXT2 AUTO-MOUNT. AND YEAH THIS WHOLE PROCESS HAS BEEN DONE ON A 32a BOARD. FOR THOSE THAT TRY THIS ON OTHER ROMS LET ME KNOW HOW IT GOES.
I've searched and shuffled through the entire forum and made inquiries to ROM authors without much light being shed on this issue. I doubt I am the only one who has been looking for a way of doing this so I decided to do a small HOW-TO. Here I will explain step by step as to how you can implement a script to be part of your ROM that will auto mount an ext2 partition on boot up if such partition is present. I have included all the tools I've used in order to pull this off, and as the title suggests this has only been done on Amon Ra's latest 1.6.2 ROM. In order to follow these instructions you are expected to allready have set up an adb enviroment on your linux box and for the signing process to work you must have sun-java present, the gnu java wont work. And of course a microSD card with an ext2 partition
1. Download install.sh to your home directory
Code:
wget http://www.grindhouse.no/androidtools/install.sh
chmod a+x install.sh
2. Now execute the install.sh script which will create a directory to work in and download a tool and script package and unpack it.
Code:
./install.sh
When the install.sh script is done you need to move the mkbootimg preferebly to your tools directory of your SDK.
Code:
mv toolstomove/mkbootimg <path/to/sdk/tools/mkbootimg>
3. Unpack the RA1.6.2 ROM into a directory in your home dir. In this HOW-TO we will use directory name "ra1.6.2" as an example through out the entire process.
4. Copy the boot.img from ra1.6.2 to the ROM-cooker dir
Code:
cp $HOME/ra1.6.2/boot.img $HOME/ROM-cooker/boot.img
cd $HOME/ROM-cooker
5. Use unpack.pl to extract the ramdisk from the boot image. I've modified the script a little so it automates the entire process and decompresses the ramdisk to a directory
Code:
./unpack boot.img
6. Now you can either replace the init.rc file here with the one I've included in this package or you can add these lines by yourself. In wich case do the following
Code:
cd boot.img-ramdisk
pico init.rc
Press CTRL+w and then CTRL+t and input 27. hit enter. This will take you to line 27 of init.rc so you can add a line right before the init process remounts the rootfs in read-only mode. Add following line:
Code:
mkdir /sdext2 0771 system system
Now scroll down to the end of the init.rc file and add the following:
Code:
service mountsdext2 /system/bin/mountsd
user root
group root
oneshot
7. You have now edited (or replaced) your init.rc file and prepared it to execute a script on boot that will detect an ext2 partition and boot it if there is one to be found. Now you have to make the mountsd script a part of the ROM. Do the following:
Code:
cd $HOME/ROM-cooker
mv toolstomove/mountsd $HOME/ra1.6.2/system/bin/mountsd
rm -rf toolstomove
8. Now that the init.rc file is sorted out and mountsd has been placed in /system/bin of the ROM so it is time to re-pack the boot.img:
Code:
cd $HOME/ROM-cooker
./repack boot.img-kernel boot.img-ramdisk boot.img
rm $HOME/ra1.6.2/boot.img
mv boot.img $HOME/ra1.6.2/boot.img
9. Your ROM now has a new boot image with an updated init.rc and the /system/bin dir has the script needed to auto-mount the microsd ext2. Now you must re-zip the ROM and sign it. Do the following:
Code:
cd $HOME/ra1.6.2
zip -r update.zip *
mv update.zip $HOME/ROM-cooker/update.zip
cd $HOME/ROM-cooker
./sign.pl update.zip
10. The ROM is now signed and you now have a file called update-signed.zip. Connect the phone to your computer and execute thus:
Code:
./push update-signed.zip
11. Now you are ready to flash the modified ROM which will auto-mount an ext2 partition on your microSD. There is no need to wipe before flashing. If you have no prior experience with ROM flashing or whatever just backup your current install. If you're using OpenHOME or anything similar, nothing will be changed or damaged but if you're using MontAlbert's themes with the ROM you will have to flash them again after flashing this modified ROM.
Code:
adb reboot recovery
12. Flash from choose zip and of course choose update-signed.zip. Reboot. After the system boots up again you can now check whats what with either one of the commands:
Code:
[email protected]:~$ adb shell mount | grep sdext2
/dev/block/mmcblk0p2 on /sdext2 type ext2 (rw,noatime,nodiratime,errors=continue)
[email protected]:~/boot$ adb shell busybox df -h | grep sdext2
/dev/block/mmcblk0p2 893.7M 13.0K 846.0M 0% /sdext2
13. Voila! Your RA 1.6.2 ROM now detects and mounts your microSD ext2 partition on boot. Woohoo?
I hope the HOW-TO was easy reading and that you have succeeded in hacking up your ROM. I know that certain ROMs have this as a built-in function but Amon Ra's does not. But since alot of people including myself use his ROM because of the high speed and stability I thought I should contribute to his project and add a cool (and missed?) function to it.
Mind you that you can use the ROM-cooker set to further adjust and hack up the ROM as you see fit. Happy learning!
Very nice!
Now the question many people will ask : why would you automount ext2 if you don't use apps2sd ?
I personally have ubuntu on my ext2 And besides this approach can be used for a number of things, people who have had the need, or wanted to experiment with init.rc doing things on boot, the mountsd script can easily be altered to do what ever needed.
For me its been a learning curve finding these things out, so by sharing it I may spare some people breaking their backs over this whole init.rc thing. people may want to modify init.rc for whatever reason, so I'm sure people wont have a problem finding a way of putting this to use, and its a subject that isnt all that covered on the forum .. and hey .. at least they get a rom kitchen out of the whole shabang
Very interesting! Thank you.
I used your unpack-program to unpack a recovery-image. It seems to work fine. What I am trying to do is change the state the recovery-image returns the phone to. Would it be possible to just replace your mountsd-script with, for example, a script that installs apps? Or is there a better way to do what Im trying to achieve?
Cheers,
edit: I noticed that on the emulator it is sufficient to just place an apk-file in "data/app" to get it installed. Could it be possible that this is all I need a script to do? :O or could I hurt my poor phone by doing so you think?
sandis84 said:
edit: I noticed that on the emulator it is sufficient to just place an apk-file in "data/app" to get it installed. Could it be possible that this is all I need a script to do? :O or could I hurt my poor phone by doing so you think?
Click to expand...
Click to collapse
That's indeed all you need to do.
Hi!
So I tried to create a signed update.zip, but it failed. It didnt create a "update-script"-file, so my device refused to install it. I wrote my own "update-script"-file, but then it complained "no digest" for the file. How do I solve this?
post the contents of your script people might see whats up
so is this all on linux?
also where are the script files for your tutorial
thanks for the time to put together
sitimber said:
so is this all on linux?
also where are the script files for your tutorial
thanks for the time to put together
Click to expand...
Click to collapse
Says where its at in the first line : )
Code:
wget http://www.grindhouse.no/androidtools/install.sh
But now that I checked, I have to apologize, I see I have a missed payment with my hosting, I'll fix that within the day. Also sorry I havent been answering the few questions here I've been afk cause of surgery.
sitimber said:
post the contents of your script people might see whats up
Click to expand...
Click to collapse
well, I looked in another "update-script" file and found this:
assert compatible_with("0.2") == "true"
assert getprop("ro.product.device") == "dream" || getprop("ro.build.product") == "dream"
show_progress 0.5 0
write_radio_image PACKAGE:radio.img
show_progress 0.5 10
Click to expand...
Click to collapse
So I figured that nothing was essential other then the line "write_radio_image PACKAGE:radio.img". Also ofcourse I made sure it contained the name of my image-file instead of "radio.img". This gave me the "no digest" message, so now I feel unsure on how to create a working update.zip.
edit:
SOLVED! How silly of me. When you sign the update, a hash of each file is put in manifest.mf. Since I added the update-script after signing the file, ofcourse the digest(hash) was missing. Now everything works alot better and I can proceed... until I get stuck again
Cheers,
edit2:
Just to get a better understanding, what exactly does each line do here? Or where can I read about this?
Code:
service mountsdext2 /system/bin/mountsd
user root
group root
oneshot
edit3:
Ok, so I have experimentet, but I still dont manage to solve those last steps. I tried to edit init.rc and just add "mkdir /testdir 0000 system system" where the other directories were created. I then repacked it, zipped it, signed it, put it on my sdcard, started up a custom recovery, installed the update and rebooted. Everything seems to work fine. But when I start adb and check around, I dont see the "testdir"-directory. Also when I check in init.rc my line is gone. Do you guys have an idea of where I went wrong?
sitimber said:
so is this all on linux?
also where are the script files for your tutorial
thanks for the time to put together
Click to expand...
Click to collapse
it doesnot necesarily have to be linux ...you can also do it in windows using cygwin and dsxda's android rom kitchen

[Q] Anyone have Linux/Ubuntu/Fedora Working Currently On GB?

Problem:
I've worked with every available distribution of Linux, trying to get the damn thing working on my phone. Troubleshooting the ***t out of it, and no deal. Constant errors/files not found etc. So, rather than post my logs and ask for help troubleshooting them (as I've obviously been unable to do), I thought I'd just ask:
Does anybody have a Linux build (besides android!) working on their phone that's running Gingerbread or ICS? If yes, can you post your software specs?
Here are mine currently:
Busybox- v1.19.3-Stericson in /system/xbin
Firmware Version- 2.3.5
Baseband Version- T959VUVKG6
Kernel- 2.6.35.7-T959VUVKI3-CL611444
Build Number- Gingerbread.VUVKI3
Mod Version- Octaine Team Acid
Thanks, this has been a pain in my **s for too long now!
S
I had both Fedora and Ubuntu working on Froyo at one point through lots of modifying and editing of the scripts.
What do you need them for anyway? I think it's more of a hassle to set them up than it's worth.
Well, I am working quite a bit now with linux for servers and such, and it's good to have a system (even minimal) that I can use/reference, plus it helps me get better at it.
Get this: I was so frustrated that I went back to BlackIce (keeping my gb bootloaders) and the damn thing loads right up, ubuntu 11.04, no problem. So, I then loaded up Valhalla's GB build and, sure enough, that works too. So, going with my luck I load octane 2.x GB which i've been digging of late and no deal, ubuntu just won't load.
Now, trying the same trick I cannot get it to work. It just won't load now when I SH it. Here's the instructions that worked before (and I've tried them all!):
http://www.nerd65536.com/2011/07/installing-ubuntu-in-android-version-2.html
Also, I hard bricked again (corrupted bootloaders from a Parallels Windows stallout) but did Adam's UnBrickable Mod and that's all better. Everybody needs to check it out, it's awesome:
http://forum.xda-developers.com/showthread.php?t=1333424
So FBI, any idea why linux is so temperamental? Once it SH's properly, it always works.
(Thanks to all the developers for their great roms!)
Yeah I noticed that slight changes from different ROMs based on the same kernel base had that effect too. I'm thinking it had to do something with the busybox installations since I had to edit the script sometimes. For some reason on some installs running mount won't work unless you use it as busybox mount. It was very iffy like that. I haven't even tried it again because of how frustrating it is to get even a boot. The other thing is that if you try to do a shutdown from ubutu/fedora it doesn't even kill the processes all the way so the only way you can clear some ram up with with a reboot.
Yeah man, I was figuring Busybox myself. I've tried old installs, new installs, xbin only, bin only, xbin & bin, etc. It's so frustrating because I can't figure it out. When it was working it was great, pretty stable.
So the first problem always lists as:
Remounting /system rw...
Mount: no such file or directory
Usage: mount [-r] [-w] etc, etc
So does this tell us that the system is not mounted rw? I used the Mount/system r/w application, but I cannot verify it's doing it's job. Everything is rooted properly, CWM also.
In Terminal on the phone I ran:
"mount | grep system"
which gave me
"/dev/block/st19 on /system type ext4 (rw,relatime,barrier=0,data=writeback)"
which leads me to believe the system is r/w.
I'm converting the system back from ext4 using CWM Voodoo to disable Lagfix and system Lagfix to see if this has any effect. Will report.
No deal. Didn't do a damn thing. I'm going to crack this if it's the last thing I do....
I'm using Better Terminal Pro, Bash shell, and under command line in options it lists the Shell as: /system/bin/sh-
The sh install.sh also tells me:
"Mounting: Loopback mount
mknod: /dev/block/loop254: File exists"
Does this mean that all (255) of my loops are used? Do I need to remove programs?
The available loop device thing never got resolved. Nameless originally fixed it by making it use 254 so that there was a low chance of the loop device being available, but the phone's OS is very iffy about letting a new loop device get assigned to a system image file. Can't really help you out since I never got it to consistently mount with different roms.
Linux on SGS4G Working! Done and Done!
Figured it out.
I can get Ubuntu 11.04, 11.10 & Debian 6 to mount repeatedly in all sorts of ui updatable configurations using this information:
http://www.nerd65536.com/2011/07/installing-ubuntu-in-android-version-2.html
It's a friggin Christmas Miracle! Can't tell you how much time I've wasted working this out, and it all boils down to the sh and run scripts.
So, without further ado, here goes.
!!Make sure you're rooted!!
!!The quotes just tell you what to type. Don't type them!!
1.
Download one of the three builds on the website listed above (or build your own, it should work fine). Extract it from tar.bz2, they should all extract to a linux file, this includes the necessary scripts. Put it on the sd-card on your phone.
2.
Download the new scripts that (Nerd) listed found here: http://ohm.nerd65536.com/android-linux/scripts-latest.tar.bz2
And extract them. You'll have another file that says linux. Open it, take the three files inside (install.sh, root-scripts & scripts) and paste them in the linux folder you moved to your sd-card. They will overwrite the ones currently there. These scripts work for sgs4g, the originals did not.
3.
Install the latest BusyBox in xbin if it's not already installed (must be rooted). Latest is 1.19.3
4.
Download a terminal client, like Better Terminal Emulator or Android Terminal Emulator. I use the first. The terminal needs to run the commands as root, especially the linux vnc command as it didn't want to work for me no matter if I started by typing su. Better Terminal Emulator has a check box to always start in root.
5.
Open up your terminal emulator and type su if you are not rooted there. Then change directory to the linux file on the sd-card. run the sh file there.
Like this:
"su"
"cd /sdcard/linux"
"sh install.sh"
If it works, the resulting dialog in terminal won't throw up any problems.
6.
Get back to / on sd by typing in terminal:
"cd /"
You should then have a: / # prompt, which means you are still rooted.
Enter:
"linux"
Which should result in a: [email protected]:/#
This means Linux is running. Congratulations. It should continue to run unless you shut down your phone.
7.
Download a VNC client, like Android VNC Viewer (free) or Remote VNC Pro, which I use. Add a new entry in it, with the following settings:
Host: localhost
Port: 5901
Password: cheesecake
Color: 24-bit
Name: Linux
When that's done save if you can or back out if you can't, and go back to your terminal emulator.
8.
It should still say: [email protected]:/#
If it doesn't, fine, if it does, just go back to root prompt by typing:
"exit"
Which should get you: / #. Then type:
"linux vnc"
Which should run itself and mount the chroot environment. It should tell you your new 'X' desktop is localhost:1, and have a: / # prompt again.
It might also ask you for a password, if so then put whatever password you'll remember in that's longer than 6 characters and verify it. This only happens once.
9.
Go back to your VNC client and if you entered a password in step 8. then edit your listing to your password instead of cheesecake, if not then don't.
Click on the Linux link and BAM! (shameless Emerilism), you're at your Linux desktop which should be running a iceWM desktop interface, which is fast. The LXDE desktop is nicer and if you want that then go into you're terminal and get into the linux shell by typing:
"linux"
And then switch to LXDE by typing:
"apt-get autoremove icewm- lxde+"
Which will run through the removal/ installation, and verify you want to download the <400mb files. Type:
"y"
And give it time to finish. When finished, just go back to your VNC client and hit Linux again, and you will have a nice looking functional desktop, with a cpu load graph on the bottom. I tried using Gnome desktop and Unity 2d, but both of these would install and not fully run with all options. They are heavier and slower, but cool non-the-less. Let me know if anyone has luck with these on Android.
Notes-
You only have to type "linux vnc" once in terminal to start linux every time you boot your phone. Otherwise, just open your VNC client and click on Linux to use it. Easy!
You will want to update and upgrade your linux after install, do so by typing in terminal:
"apt-get update"
"apt-get upgrade"
Also, you might run across a problem if you try to add-apt-repository, that's because that python command is not present. To use it, enable by typing:
"apt-get install python-software-properties"
Also of note, the downloadable linux builds are sized to about 2.15gig on your sd, which is big enough for most. There is a way to resize them which I tried but it gave me trouble in loading. I will try again and see if I can get it to work.
Here's the link from Dangermouse:
http://www.androidfanatic.com/community-forums.html?func=view&catid=9&id=1610
Thanks to Nerd65536 for the info, write-up and files. He fixed my problem.
sconsylman said:
Also of note, the downloadable linux builds are sized to about 2.15gig on your sd, which is big enough for most. There is a way to resize them which I tried but it gave me trouble in loading. I will try again and see if I can get it to work.
Here's the link from Dangermouse:
Click to expand...
Click to collapse
You're welcome.
It's actually a lot easier than that to make the image larger. Just pop the SD card into a Linux machine and:
(Assuming the original file is: /media/phone/linux/linux.img)
Code:
resize2fs /media/phone/linux/linux.img 4095M
And you're done. resize2fs is made of magic!
Note: Most SD cards are FAT32, which has a filesize limit of 4GiB. The above instructions will make the file a megabyte less than that.
nerd65536:
Thanks! Worked like a charm. Had to e2fsck -f /media/SDCARD/linux/linux.img (phone plugged in to Mint) before i did it to check over the file system, but then it ran immediately. Much appreciated.
Have you had any luck on native boot? I've been working a little on this, as I can't run BackTrack arm well virtually, it gets buggy. Granted the telephony systems won't work during, but the functionality should be pretty good if we could run it standard.
Also, while I'm thinking of it, is it possible to run the img from an ext4 partition on the card? I have an existing one being used for link2sd files and would much prefer using it as it's a far superior file system to fat32, without the 4G limits. Vnc should have no problem graphically, but would the linux.img chroot properly?
It would probably work but you would have to alter the script to mount the other partition if it doesn't do it automatically and change the path. Shouldn't be too hard.
I'm getting an error when I try running sh install.sh:
Code:
# sh install.sh
readlink: applet not found
Remounting /system rw ...
sh: Can't open /linux/scripts/fsrw
Installing scripts in /system/bin ...
cd: can't cd to /linux/scripts
cp: write error: No space left on device
cp: omitting directory 'root-scripts'
Unable to chmod /system/bin/root-scripts: No such file or directory
cp: omitting directory 'scripts'
Unable to chmod /system/bin/scripts: No such file or directory
cp: omitting directory 'tmp'
Unable to chmod /system/bin/tmp: No such file or directory
Mounting the Linux image ...
install.sh: /system/bin/linux: not found
Customizing the image ...
install.sh: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
install.sh: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
Installing root-scripts ...
mkdir failed for /data/local/mnt/root/scripts, No such file or directory
Unable to chmod /data/local/mnt/root/scripts: No such file or directory
cp: can't stat '/linux/root-scripts/*': No such file or directory
Unable to chmod /data/local/mnt/root/scripts/*: No such file or directory
Install finished
# linux
linux: not found
NuVanDibe said:
I'm getting an error when I try running sh install.sh:
Code:
# sh install.sh
readlink: applet not found
Remounting /system rw ...
sh: Can't open /linux/scripts/fsrw
Installing scripts in /system/bin ...
cd: can't cd to /linux/scripts
cp: write error: No space left on device
cp: omitting directory 'root-scripts'
Unable to chmod /system/bin/root-scripts: No such file or directory
cp: omitting directory 'scripts'
Unable to chmod /system/bin/scripts: No such file or directory
cp: omitting directory 'tmp'
Unable to chmod /system/bin/tmp: No such file or directory
Mounting the Linux image ...
install.sh: /system/bin/linux: not found
Customizing the image ...
install.sh: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
install.sh: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
Installing root-scripts ...
mkdir failed for /data/local/mnt/root/scripts, No such file or directory
Unable to chmod /data/local/mnt/root/scripts: No such file or directory
cp: can't stat '/linux/root-scripts/*': No such file or directory
Unable to chmod /data/local/mnt/root/scripts/*: No such file or directory
Install finished
# linux
linux: not found
Click to expand...
Click to collapse
cp: write-error.. no space left on device? You need more space dude

[Guide] How to create EXT4 images.

Since most of the high-end devices are using now EXT4 partitions i decided to make a guide.
I am doing this because this is the easiest way to create an EXT4 image.
This is not my guide I am just adapting and make it clear to everybody; someone showed me how to do this (I will mention him at the end of the guide).
Let's assume that you dumped the system.img from your own device and you want to add something to it.
We will create a new system.img and we will name it system_new.img, the size will be 240 Mb.
Step 1
Linux Machine (I used Ubuntu)
We prepare the directories and copy the system.img in the folder in which we will work.
mkdir system (here we will mount the old system.img
mkdir system_new (here we will mount the system_new.img)
Step 2 – Creation of the actual EXT4.img
dd if=/dev/zero of=system_new.img bs=4k count=60000
Translation of the terms,
bs =blocksize, 4k= the size of the block`s which in this case is 4kb
count=60000, the number of block`s, in our case will result an image of 240 Mb.
The blocksize can be 1k/2k/4k/16k
To get the exact size of the image that you create use simple maths.
60000 * 4 = 240000
Step 3 Formating the system_new.img with EXT4
mkfs.ext4 system_new.img
It will be a question where you will select yes (Y)
We override the file system check (If you don`t do this, the image will not work)
tune2fs -c0 -i0 system_new.img
Step 4 We mount the directories that we previous created.
mount -o loop system_new.img system_new/
mount -o loop system_new.img system/
Step 5 We copy the content from the old system.img in the system_new.img
cp -v -r -p system/* system_new/
We sync the files
sync
Step 6 Unmounting the partitons.
umount system_new/
umount system/
Step 7 Enjoy your new ext4 system.img
Tips:
If you are using Ubuntu just type
sudo su
And you will be root and no more sudo at each command.
You can add new files in the new created system.img but you need to set the permissions and ownership properly, otherwise it will not work.
Credits: arctablet.com administrator.
work perfect!
I managed to create a new system img for huawei phone.
Errors in Step 3 and 4: Unable to proceed
Hi There,
I am getting errors in step 3 and 4.
Step 3 Formating the system_new.img with EXT4
mkfs.ext4 system_new.img
It will be a question where you will select yes (Y) -- after this below error comes
Device size reported to be zero. Invalid partition specified, or partition table wasn't reread after running fdisk, due to a modified partition being busy and in use. You may need to reboot to re-read your partition table.
We override the file system check (If you don`t do this, the image will not work)
tune2fs -c0 -i0 system_new.img -- after this below error comes
Attempt to read block from filesystm resulted in short read while trying to open system.img
Step 4 We mount the directories that we previous created.
mount -o loop system_new.img system_new/ -- after this below error comes
unknown filesystem type 'ext4'
Could you please help.
i whant to create and system.img.ext4 for my android ! ! But i saw that image which is created is just system.img ! I`m using ubuntu and i whant to know what is need it to create that system.img.ext4 ! I don`t see that img to be ext4 file ! Thanks
jabarel said:
i whant to create and system.img.ext4 for my android ! ! But i saw that image which is created is just system.img ! I`m using ubuntu and i whant to know what is need it to create that system.img.ext4 ! I don`t see that img to be ext4 file ! Thanks
Click to expand...
Click to collapse
I'm not sure but it's probably just a matter of file extenstion.
By the way, great tuto. May be someting to add :
Android ext4 don't seem to be the exact standart of linux ext4 file systems.
To make it fully compatible and usable with fastboot, the use of "ext2simg" can be useful.
So it will be something like this :
ext2simg fs2convert.img fsconverted.img
ext2simg can be found in android-tools in debian repository.
I am porting a rom ,i extracted "system.new.dat" into "sytem" folder , applied changes according to this guide to port a ROM -->> http://forum.xda-developers.com/showthread.php?p=65933478#post65933478
can you tell me how to reconstruct the "system.new.dat" from "sytem" folder ?
is mkfs.ext4 applet available to arm devices..??
you can do it faster...
Great if you create a new image, but to edit no need to create all these steps ...
Just copy the system.img to system_new.img and mount that one and edit..
There's no clear instruction!
Hours of researching many places and no good instruction about how to create or edit an EXT4 with or without Linux!
I know this is an old post but I just wanted to try, might get a reply!
Frank2406 said:
Hours of researching many places and no good instruction about how to create or edit an EXT4 with or without Linux!
I know this is an old post but I just wanted to try, might get a reply!
Click to expand...
Click to collapse
what is not clear?
this has been tested by me and it works.
there are more refined ways in doing it, it just depends on what you need to to with the ext4 image.
globula_neagra said:
what is not clear?
this has been tested by me and it works.
there are more refined ways in doing it, it just depends on what you need to to with the ext4 image.
Click to expand...
Click to collapse
Step 1: "We prepare the directories" you said. What directories?
"mkdir system"
"mkdir system_new" which, what or where are they?
Step 2: The whole step 2 for a newbie in Linux like me is bla bla bla except the title "Creation of the actual EXT4.img"!
And the rest of your guide is as the same as step 2 which I mentioned.
And if this guide is for Ubuntu experts then maybe in the beginning you could mention so people don't get their hopes up dear globula_neagra!!
Long story short, I just wanted to try a custom Rom on my Zenwatch 1, but I've forgot to make backup, so the official Rom was gone. Asus itself didn't help to get a copy of the official one, so I tried Anthias custom Rom instead, but that made the watch even worse.
Then I started to research how to fix it, so I found this article.
It s not a step by step guide on how to use ubuntu.
I assume that wheen you want to learn something you do use google too. For this instance i would google in this way "what does mkdir command in ubuntu"
After i understood the purpose of the command and how to use it i would try to apply it using the guide and after that you will see that things will start to make sense.
My guide was written with the idea that if you use android you have an idea of linux too and in this case ubuntu.
The command line in linux is somewhat similar to the one in windows commander there are some extra things that you need to learn but those can t be put in a guide like this.
In regards to your watch. My advice is to find another one and take a system dump from that one and flash it to yours if you have an unlocked bootloader.
Here you cand find some good reads on how to dump the files from the watch. And a bit more details on what is the business with the ext4 creation. Topic is5 years old but still relevant.
http://www.arctablet.com/blog/forum/arnova-7c-g3/arnova-7c-g3-dev-topic/

Creating asystem.tar

Hi!
I need help Regardin to this thread, hope someone could help me regarding it https://forum.xda-developers.com/showthread.php?t=2195858 Im stuck at making a system.tar in Xperia XZ Nougat.
Im trying to run this
Code:
tar -c system/* >> sdcard/system.tar
Im getting
Code:
Tar: /sdcard/system.tar no such a file or directory
Im on rooted device with systemless su.
Otherwise Im getting permission denied
Code:
tar: cant open ´system/bin/run-as´: permission denied
Code:
tar: cant open ´system/bin/uncrypt´: permission denied
Code:
tar: no system/lost+found: permission denied
or
Code:
tar: system/* no such a file or directory
I cant get it to work, googled it but with no luck.
Edit:
System.tar somehow got created to sdcard and the size is about 4.3gib but there is nothing in there
I really do not know why you want to do this.
For backup you are better off (and with compressed archives) using TWRP.
system.tar could easily fill your userspace...
Do a web search on "man tar". You really screwed up the syntax.
Probably you want to do something like:
tar -cf /sdcard/system.tar /system/*
Hint: "sdcard" is a path name for the internal storage of your phone.
You probably want to use the micro-sdcard plugged into your device.
You will find it via ls /storage
Then use something simalar to
tar -cf /storage/3032-6330/system.tar /system/*
If you are prohibited by SELinux to write there, write into an existing directory on the sdcard instead or create one with a capable filemanager or via adb shell
DHGE said:
I really do not know why you want to do this.
For backup you are better off (and with compressed archives) using TWRP.
system.tar could easily fill your userspace...
Do a web search on "man tar". You really screwed up the syntax.
Probably you want to do something like:
tar -cf /sdcard/system.tar /system/*
Hint: "sdcard" is a path name for the internal storage of your phone.
You probably want to use the micro-sdcard plugged into your device.
You will find it via ls /storage
Then use something simalar to
tar -cf /storage/3032-6330/system.tar /system/*
If you are prohibited by SELinux to write there, write into an existing directory on the sdcard instead or create one with a capable filemanager or via adb shell
Click to expand...
Click to collapse
Yepp, I screwd it up. Thanks for the replay, reflashing it now "AGAIN". Im a newbie, trying to learn how to create a rom. I dont have access to micro-sdcard right now, will try it tomorrow

Categories

Resources