/system and /data file system of Android - android

When I build the Android sources, I end up with 3 images. They are ramdisk.img, system.img and userdata.img.
I'm trying to understand what these are made of and how they are used by Android. I came across articles which say "/system" is a yaffs2 file system.
1) If I want to make use of this on a real board, should the file system be yaffs2 or can it be any?
2) If I want to get the 3 images for another file system(say ext2), how do I do that?

You can modify the kernel to accept basically any filesystem you want (ext2 and ext4 are two examples), if you can make it compile. Then, it's just a matter of mounting and formatting the volume with the corresponding filesystem.
There are patches for different kernels in github and xda-developers. You will need to browse around to find the patch for your particular device. Unfortunately this is not something you can sole for all devices with a single hack.

Related

How to create bootable sd card from different img files

I have built cyanogenmod lollipop source for odroid-xu4 SBC and resulted into separate image files like system.img, boot.img, cache.img, kernel, ramdisk.img, ramdisk-recovery.img, recovery.img, userdata.img and other folders like install, root, system etc.
How do I make bootable sd card from these images? There are methods where we can write image to sd card using dd in linux or Win32DiskImager in windows but these tools require single image files and these tools might be extracting system, boot kernel images etc from single .img file. But since I am directly having extracted images, how do I achieve it?
Is the process board dependent, I mean do I need to worry about where exactly in memory space different images are written? There is guide given at write image to odroid-xu4 but it talks about pushing images to sdcard using adb. This means I need other android image previously flashed?

A Program for Transfering a folder from a Mac to an Android Phone

I've been trying to write a small program to copy a folder on my mac (10.10.3), containing a set of songs, into the music folder on my Galaxy S3 (GS3) when it is connected via USB. Clearly I could just use Android File Transfer (AFT), and copy the files in (manually), however this wouldn't teach me anything. My goal is thus to automate this act. Python seems like a good choice for this project, as it seems like mostly scripting (in fact a Bash script may suffice).
This should be simple, using a bash script like cp ~/../music_on_mac /.../music_target_on_android
However, the file structure of the GS3 doesn't show up in the finder (like you would expect from an ordinary USB drive). I can only see the file structure via Android File Transfer. From what I've read, this is expected behavior (I suppose due to formatting differences?). Thus I've been unable to find the target directory /.../music_target_on_android
My best guess (getting a bit out of my depth here), is that I need to copy the music folder, and then pipe it to AFT, and have AFT place it in/on top of the target Music folder on my GS3. Is this correct? If so, could anyone offer suggestions on implementing this? If not, alternative approaches or suggestions would also be appreciated.
I'd also note that I considered using ./adb push <local> <remote> to try to copy the files directly, however this pushed back that the device was read only. I'm also not familiar enough to find the proper directory on the GS3 (the one containing the target for the "Music" folder) using ./adb shell. There's also the added downside that in order to use a solution involving the ADT, one must have the ADT (which most people don't). Moreover, I want to keep it simple.
Research Update:
I've found that my phone will not show up in Finder because Google has disabled USB mass storage (aka mounting the phone as a disk) in favor of the Media Transfer Protocol (MTP). AFT is just an MTP client, needed because unlike Windows and Linux, OSX does not support MTP.
http://www.howtogeek.com/192732/android-usb-connections-explained-mtp-ptp-and-usb-mass-storage/
Based on tips, I've been able to implement an alternative based on creating an FTP server on my phone. Connecting to this gives me file system access and write privileges from my terminal, which is half the battle, however its quite slow. Thus I'd still like to find a way to automate instructions to Android File Transfer.

Need help about android mounting Sdcard

Im working on "mount ntfs sdcard"
That is problem:
- If i mount sdcard to another folder than /mtn/sdcard then my sdcard working find
- If i mount it to /mnt/sdcard then android not except it : " The SDcard is not currently mounted"
In adb shell i type mount command and see that my SDcard is mounted to /mnt/sdcard
But infact SDcard folder cannot accessable.
I think android doesnt except mount ntfs sdcard on /mnt/sdcard because it programed to mount vfat sdcard on /mnt/sdcard.
Now the question: where i can find mounting code or mounting procedure of android when we insert SDcard? i want to modify it to accept ntfs sdcard.
P/S: im on GB 2.3.6
This is a very specific question, I doubt you will get an answer here. You might want to try to locate it yourself from the source code which could be found here:
https://sites.google.com/a/android.com/opensource/download
I did some googling and found this:
http://cateee.net/lkddb/web-lkddb/NTFS_FS.html, you might need to modify it.
On Android, the mounting of the sdcard is managed by the vold daemon.
If you want a stable system, you likely need to either get vold to manage your custom mount, remove vold from the system and do it's entire job yourself, or somehow get it and your custom solution to stay out of each other's way.
Lots of custom ROMs have used vold in different ways - to partition an sdcard and add a unix-style filesystem for storing apps, to put an entire alternate android installation on an sdcard or tablet internal storage area, etc. You might get some ideas by looking at those, reading their development discussion history, etc.

Mount Second Partition on Android Device with vold

I want to have access to an ext4 partition, without using Data2SD yet, on the SD card of my HTC Vision running the Virtuous Unity 1.3.0 ROM. I modded my /system/etc/vold.fstab file from this:
dev_mount sdcard /mnt/sdcard auto /devices/platform/goldfish_mmc.0
/devices/platform/msm_sdcc.4/mmc_host/mmc2
To this:
#dev_mount sdcard /mnt/sdcard auto /devices/platform/goldfish_mmc.0
/devices/platform/msm_sdcc.4/mmc_host/mmc2
dev_mount sdcard /mnt/sdcard 1 /devices/platform/goldfish_mmc.0 /devices/platform/msm_sdcc.4/mmc_host/mmc2
dev_mount e4vol /mnt/sdcard2 2 /devices/platform/goldfish_mmc.0
/devices/platform/msm_sdcc.4/mmc_host/mmc2
So I can get my second partition, with label e4vol, mount and usable on my Android device. Two issues, and I think one obviously has to do with the other.
I have tried remounting the root read-write and creating the mount point /mnt/sdcard2, but it is gone on reboot. Seems like Android might have in the past created such mounts with mount.conf. Now it does not exist on Gingerbread ROMS. Thoughts?
Is this all I would have to do to get my second partition mounted in Android, or do I also need to create /sdcard2 like /sdcard? I presume both are created as symlinks by vold as specified in this conf file, but I have not had time to check yet.
I would ask forums, but this seems like a developer question and this is the most recent release of the OS. It seems to change a lot from version to version of the OS. Thanks in advance for your patience and help.
UPDATE: So, moved the test mount to sdcard, and it did not work, even with a persistent mount point. So, not sure where I am going wrong.
Maybe you'll have to have a look into /init.rc.
There are some "mkdir /mnt/..."-statements. You only have to add your "mkdir /mnt/sdcard2" and "ln -s /mnt/sdcard2 /sdcard2" to this file.
But be careful when editing this file!!!
I looked at the vold source up to including Icecream-Sandwich: it’s final mount() system call is hardcoded to the “vfat” file system type. – Even if you get it to try the mount, it would fail.
I myself actually want to mount my ext4 SD card to /sdcard, because I regularly suffer from SD card FAT file system corruptions (and I’m not the only one having those with Android).
The alternative is: modify the init/boot process to just mount the partition where you want, bypassing vold.

How to make a simulated SD card (an image) work together with a real one in Android 2.2?

I've managed to simulate a fake sdcard on Android 2.2, so that when I don't have a real sdcard, applications that need sdcard will still work. To achieve this, I borrowed some code from the Android-x86 project's extended version of `vold', and did the following:
# dd if=/dev/zero of=/data/sdcard.img bs=1024 count=1 seek=1000000 (1GB image, a sparse file)
# busybox losetup /dev/block/loop7 /data/sdcard.img
# newfs_msdos /dev/block/loop7
The problem is, when a real sdcard is inserted, I wish to use both of them without switching back and forth between them - namely, a `dual sdcard setup' on a system which only allows one sdcard. How can this be achieved?
Personally I'm not quite familiar with the Android system (actually today is my second day working on an Android project). I was told that the 2.2 version only supports one sdcard mounted on "/mnt/sdcard", applications that read/write sdcard will follow this path. I'm not quite sure about this. Can someone please shed me some light on the Android sdcard limitations and how its presence affects applications?

Categories

Resources