Related
Hi,
I know Android is based on Linux and I have good knowledge when it comes to Linux. I also have a good understanding when it comes to Android right from the first devices...flashing roms etc. Still I am just using it on a user level and I am just guessing from those experiences what basic elements are and how Android is structured.
For once I would like to know how a typical Android phone is partitioned?
First there is the boot-element. I can flash ROMs all I want and it stays the same (in my case LG Animation). I guess this is a separate partition where a little bootloader like GRUB is located? Or is this located in the system-partition? Maybe the file boot.img? What is this? Some Mini-Linux?
Then there is for example the ClockWorkMod Recovery. Where is it located? It isn't deleted when I flash new ROMs. Is it on a separate partition? And what is it? Some Mini-Linux you can boot into?
Then there is the OS-Partition I can see when I install a file-explorer app in Android. I am guessing the OS itself (is this Linux or Android?) resides in /system, the user data resides in /data. Can somebody explain the main folders in this partition and what they contain?
Then there are elements like the Baseband or the RIL. Where are they located? Are they on a separate partition? Are they a Mini-Linux themselves and why aren't they changed when I flash a ROM?
In summary: I would like to understand Android better. Maybe you can answer some of my questions above or know some articles describing exactly what I want to know. I used Google and the forum search but found nothing really useful.
Cheers,
sb
Nobody got anything?
Not sure if this helps, it applies to most (if not all) Android devices:
http://androidforums.com/evo-4g-all-things-root/278898-android-partitions-kernels-explained.html
Thanks! This helped a lot. I head a similar view in my head but nothing really confirmed. There are more links to read in your link...which I will do
I'm currently an Android developer and I would like to make an application that will enable and disable logcat.
The purpose would basically be to save battery for the standard user, and to fix logcat not working for developers.
I know of one method to disable/enable logcat which is:
logcat-disable
logcat-enable
Unfortunately, this does not work on all devices since it is based on the kernel.
Also, most (I believe all) devices have a /dev/log/main/ folder in which there is a file that has logs printed into it. I could also possibly attempt to delete the folder (which it will likely be re-created at reboot) or MAYBE change the file permissions for it to prevent the system from writing to it. This option may or may not work.
So, my question is more for kernel developers or those very familiar with kernel development/file structure.
Does anyone have any idea what file is generally modified when a kernel enable/disables logcat?
P.S. I was able to figure out the answer to my question on one kernel, but I doubt if it applies to all.
P.P.S. I'm aware that this is probably a pointless question since every kernel is different, but I'm not sure, so that's why I'm asking.
Thank you!
Hello,
I'm willing to try and build a custom rom, but I've been diving through the site for a few days and I still don't get it. I believe I do have the required background to do this: programming, linux, etc. and I have wide experience as a phone user, etc. It's just that either I'm not reading what I need or the way I want it. The problem, I believe, is that all I find are guides telling me to install this and those tools and then open this and that and voila! you got your rom. But they're not explaining WHAT exactly goes into those roms, or what is expected to go there, what's the purpose of those contents, etc., and I can't really catch with that. I feel at a loss and hate wasting my time turning around for nothing.
1. I don't understand the difference between a flashable rom and one that is meant to be installed through recovery, although I can see they're different. Do they both models contain the same kind of data? Is there any restriction to what one model can contain over the other one? If so, how would I convert from one to the other? But please, don't tell me to use this or that tool. I just need the theory behind it. Something of sorts like: "You need to extract this or that from this tarball, then mount this image, then the directory tree there goes in that directory over the other model of rom"
2. update-binary: Okay I guess this is run when installing from recovery, and this takes care of installing the rom, right?wrong?. Is this a per-rom thing, per-device thing? generic? If it's per-rom, how to generate it? do I need to compile something? Is there any generic source code that can be used as a start?
3. Although I have a basic understanding of how the Linux directory tree works, I know Android works on top of a heavily modified Linux. So can you explain briefly how the directory tree works? For instance, I believe /data/data is where Android apps install to, in /system/bin or xbin I can find busybox binaries/symlinks if present. /dev and /proc look the same as in Linux. I don't know about /sys. Also how are both rom models deployed to this tree? What is basically being copied?
4. If I were to compile a kernel, where do I find the Android kernel sources? or is it just a generic Linux kernel? where can i get a basic config for the device? Last time I checked my device hadn't /proc/config.gz but maybe I could get it from another rom with it enabled or something. What toolchain and where to get it? Oh and if you know of a native arm version of gcc or whatsnot, I'd prefer that. Setting up IDEs or toolchains is a nightmare. I don't like crosscompiling. But crosscompiling or not, a directory with all needed binaries without needing to set up system variables nor other stuff, would be amazing.
I surely have a lot more questions that I can't get from the back of my mind now, and I'll have yet more as you explain. But the point of my questions was mainly trying to explain the degree of the loss I'm at, so you can assist me better.
If it looks like a foolish petition, well, that's because I'm quite stubborn and can't catch things that don't go my way. I really need to understand the basics before I can move into actually doing something. I want to build a rom for the right reasons(to me). It's not just about packing a set of apps or themes with it, but about learning and doing other stuff like trying to fix things that are not supposed to work for the device in that Android version, etc.
If you can't help, congrats for reading through here anyways But any help is greatly appreciated :good:
oxiroxt said:
Hello,
I'm willing to try and build a custom rom, but I've been diving through the site for a few days and I still don't get it. I believe I do have the required background to do this: programming, linux, etc. and I have wide experience as a phone user, etc. It's just that either I'm not reading what I need or the way I want it. The problem, I believe, is that all I find are guides telling me to install this and those tools and then open this and that and voila! you got your rom. But they're not explaining WHAT exactly goes into those roms, or what is expected to go there, what's the purpose of those contents, etc., and I can't really catch with that. I feel at a loss and hate wasting my time turning around for nothing.
1. I don't understand the difference between a flashable rom and one that is meant to be installed through recovery, although I can see they're different. Do they both models contain the same kind of data? Is there any restriction to what one model can contain over the other one? If so, how would I convert from one to the other? But please, don't tell me to use this or that tool. I just need the theory behind it. Something of sorts like: "You need to extract this or that from this tarball, then mount this image, then the directory tree there goes in that directory over the other model of rom"
2. update-binary: Okay I guess this is run when installing from recovery, and this takes care of installing the rom, right?wrong?. Is this a per-rom thing, per-device thing? generic? If it's per-rom, how to generate it? do I need to compile something? Is there any generic source code that can be used as a start?
3. Although I have a basic understanding of how the Linux directory tree works, I know Android works on top of a heavily modified Linux. So can you explain briefly how the directory tree works? For instance, I believe /data/data is where Android apps install to, in /system/bin or xbin I can find busybox binaries/symlinks if present. /dev and /proc look the same as in Linux. I don't know about /sys. Also how are both rom models deployed to this tree? What is basically being copied?
4. If I were to compile a kernel, where do I find the Android kernel sources? or is it just a generic Linux kernel? where can i get a basic config for the device? Last time I checked my device hadn't /proc/config.gz but maybe I could get it from another rom with it enabled or something. What toolchain and where to get it? Oh and if you know of a native arm version of gcc or whatsnot, I'd prefer that. Setting up IDEs or toolchains is a nightmare. I don't like crosscompiling. But crosscompiling or not, a directory with all needed binaries without needing to set up system variables nor other stuff, would be amazing.
I surely have a lot more questions that I can't get from the back of my mind now, and I'll have yet more as you explain. But the point of my questions was mainly trying to explain the degree of the loss I'm at, so you can assist me better.
If it looks like a foolish petition, well, that's because I'm quite stubborn and can't catch things that don't go my way. I really need to understand the basics before I can move into actually doing something. I want to build a rom for the right reasons(to me). It's not just about packing a set of apps or themes with it, but about learning and doing other stuff like trying to fix things that are not supposed to work for the device in that Android version, etc.
If you can't help, congrats for reading through here anyways But any help is greatly appreciated :good:
Click to expand...
Click to collapse
I am not terribly knowledgeable about all of this, but I will take a crack at it. Others can feel free to correct me.
1. "Flashing" is usually done through the recovery from a zip with an update script inside. That script is in a language called "edify". Read more about Edify Here and Here.
The only other common way that I know of installing a ROM is through fastboot in the bootloader, but that is normally only used with official factory images. Also, I think Samsung ROMs are often flashed with a proprietary program called Odin.
2. I think that the update-binary is standard across all recent devices. I think it is just an interpreter for the Edify scripting language. Old versions of android used a somewhat different scripting language and required a different file. You can probably pull the binary out of another recent zip and use that. The main thing you have to worry about is the update script (instructions for what the zip does) and the folder structure of the zip.
3. I am not confident to explain much here, but the apps and their data are stored in different places. User apps are stored in /data/app with app data stored in /data/data, I think. System apps are installed in /system/app. There is more files stored on the "sdcard" partition which can be internal or external, depending on the device.
4. Kernel sources are usually provided in the source code from whatever repo you are using. Different ROMs use different bases. Here is some info about grabbing the AOSP kernel sources with git: http://source.android.com/source/building-kernels.html
Many of the more popular ROMS have specific build instructions on their individual github pages (Cyanogen, Paranoid Android, etc), so you might what to look at those, too. Also, depending on the individual devices, there might be proprietary binaries sourced from the device or hardware manufacturers for things like camera drivers, graphics chips, etc.
If you want a walk through of the basic build process google has a tutorial. The last time I checked there seemed to be some outdated info, but it might give you a general idea of the build process. http://source.android.com/source/initializing.html
Hopefully someone more knowledgeable can give you more info, but that is all I got
synesthete said:
I am not terribly knowledgeable about all of this, but I will take a crack at it. Others can feel free to correct me.
1. "Flashing" is usually done through the recovery from a zip with an update script inside. That script is in a language called "edify". Read more about Edify Here and Here.
The only other common way that I know of installing a ROM is through fastboot in the bootloader, but that is normally only used with official factory images. Also, I think Samsung ROMs are often flashed with a proprietary program called Odin.
2. I think that the update-binary is standard across all recent devices. I think it is just an interpreter for the Edify scripting language. Old versions of android used a somewhat different scripting language and required a different file. You can probably pull the binary out of another recent zip and use that. The main thing you have to worry about is the update script (instructions for what the zip does) and the folder structure of the zip.
3. I am not confident to explain much here, but the apps and their data are stored in different places. User apps are stored in /data/app with app data stored in /data/data, I think. System apps are installed in /system/app. There is more files stored on the "sdcard" partition which can be internal or external, depending on the device.
4. Kernel sources are usually provided in the source code from whatever repo you are using. Different ROMs use different bases. Here is some info about grabbing the AOSP kernel sources with git: http://source.android.com/source/building-kernels.html
Many of the more popular ROMS have specific build instructions on their individual github pages (Cyanogen, Paranoid Android, etc), so you might what to look at those, too. Also, depending on the individual devices, there might be proprietary binaries sourced from the device or hardware manufacturers for things like camera drivers, graphics chips, etc.
If you want a walk through of the basic build process google has a tutorial. The last time I checked there seemed to be some outdated info, but it might give you a general idea of the build process. http://source.android.com/source/initializing.html
Hopefully someone more knowledgeable can give you more info, but that is all I got
Click to expand...
Click to collapse
OMG Finally some light! THANK YOU, THANK YOU, THANK YOU for all the info. I didn't get much right now, I'll need to read through your post a few times before I get it all, haha. I'll be sure to check the links too. Thank you!
Hey, I hope this is the right place to ask this, as this is a general rooting question that is not relevant for the device
Anyway, I have a few questions I hope you guys could answer me
1. From what I've understood, when I want create my own ROM, downloading the source also includes the actual OS right?
2. Assuming I'm creating a costume ROM, will I be able to:
a. Have a complete control over connections? As in, create an app that will be able to (with out notifying the user) turn off/on any connection? (BT / wifi / GPS / NFC or anything else)?
b. Make an app that will have access to the OS's file system?
c. Make an app that will be able to control the content of the device, as in, add or remove any given app?
d. Will I have access to the OS drivers? As in, will I be able to remove drivers or add costume drivers?
danduson said:
Hey, I hope this is the right place to ask this, as this is a general rooting question that is not relevant for the device
Anyway, I have a few questions I hope you guys could answer me
1. From what I've understood, when I want create my own ROM, downloading the source also includes the actual OS right?
2. Assuming I'm creating a costume ROM, will I be able to:
a. Have a complete control over connections? As in, create an app that will be able to (with out notifying the user) turn off/on any connection? (BT / wifi / GPS / NFC or anything else)?
b. Make an app that will have access to the OS's file system?
c. Make an app that will be able to control the content of the device, as in, add or remove any given app?
d. Will I have access to the OS drivers? As in, will I be able to remove drivers or add costume drivers?
Click to expand...
Click to collapse
1. Yes, you will download the source to build the OS, as well as the Device Tree, Kernel, and Vendor Files.
2.
a. Yes, that is possible, if you know how to make an app.
b. Yes, that is possible, if you know how to make an app.
c. Yes, that is possible, if you know how to make an app.
d. I'm not sure that I understand the question, but yes, you will have access to the BLOBS (Binary Large OBjectS) that are the drivers for your device. You can substitute them or build other ones, depending on your phone or platform.
I recommend that you watch through my video tutorial on how to build Android, and how to make device trees from scratch, as well as other videos about upgrading and making changes to apps that are in your custom rom.
You can find a link to it here:
https://forum.xda-developers.com/android/general/guide-how-to-build-custom-roms-kernel-t3814251
Hope that helps! :good:
AlaskaLinuxUser said:
1. Yes, you will download the source to build the OS, as well as the Device Tree, Kernel, and Vendor Files.
2.
a. Yes, that is possible, if you know how to make an app.
b. Yes, that is possible, if you know how to make an app.
c. Yes, that is possible, if you know how to make an app.
d. I'm not sure that I understand the question, but yes, you will have access to the BLOBS (Binary Large OBjectS) that are the drivers for your device. You can substitute them or build other ones, depending on your phone or platform.
I recommend that you watch through my video tutorial on how to build Android, and how to make device trees from scratch, as well as other videos about upgrading and making changes to apps that are in your custom rom.
You can find a link to it here:
https://forum.xda-developers.com/android/general/guide-how-to-build-custom-roms-kernel-t3814251
Hope that helps! :good:
Click to expand...
Click to collapse
I see, thank you very much for the info
I will watch the tutorial you provided
Hi everyone,
as title suggests, I'd like to "port" clean AOSP to be able to install and run it on the custom device.
Basically, the situation is following: I got a custom device, based on rockchip rk3288 SoC. The device currently runs Android 5.1 successfully. I'd like to update Android to version 6 (got AOSP sources and AWS builder image up and running), but the company that created Android v5 for us no longer exists.
Thus I am here to ask for advice(s) on how to proceed (or whether it even is a good idea to do that myself, given the fact that I have zero experience with Android ROMs development), possibly a step-by-step guide on what to do.
The question is, do I just find drivers for hardware components present in the device (usb hub, ethernet, etc.) and just somehow "link" those to existing sources (of AOSP) and just run the build with different parameters? Or do I need to build a whole new kernel for the given device-OS combination?
Thank you for any advice or opinion!
Well this is an interesting one. There are several routes you can take here.
If you have the kernel source code, and the source code for the drivers, you could probably build the kernel from source and use it to boot Android, however, as that's unlikely, you're looking at a more regular porting process, which usually consists of pulling the vendor blobs from the existing Android system, building AOSP/Lineage with those blobs involved, and hacking together a new ramdisk that HOPEFULLY will be compatible. It's a very long and very tedious process, but it's certainly possible.
From that you'll then get in to the debugging stage of finding out what works out of the box, you'll very well need to make changes to AOSP for it to work on that SoC.
abtekk said:
Well this is an interesting one. There are several routes you can take here.
If you have the kernel source code, and the source code for the drivers, you could probably build the kernel from source and use it to boot Android, however, as that's unlikely, you're looking at a more regular porting process, which usually consists of pulling the vendor blobs from the existing Android system, building AOSP/Lineage with those blobs involved, and hacking together a new ramdisk that HOPEFULLY will be compatible. It's a very long and very tedious process, but it's certainly possible.
From that you'll then get in to the debugging stage of finding out what works out of the box, you'll very well need to make changes to AOSP for it to work on that SoC.
Click to expand...
Click to collapse
Thanks for pointing in the right (or at least some) direction! I found some guide on porting ROMs which I followed, basically like you said. So I just replaced some files in System image. Will flash later today, so maybe I will get some results!
abtekk said:
From that you'll then get in to the debugging stage of finding out what works out of the box, you'll very well need to make changes to AOSP for it to work on that SoC.
Click to expand...
Click to collapse
So I was following this tutorial, although found some irregularities, let's say: For example, none of those 2 folders contained init.d/ directory, thus I didn't update it. Also, I haven't found META-INF folder therefore haven't updated updater-script.
Basically, when I did (or at least what I think I was doing was that I took /system partition from our current ROM, that is working on that custom device and replaced stuff in there by stuff from the new system I wanted to port. My idea from what I've read was that i took kernel (and boot/recovery) from the original, working ROM and "injected" the new system onto it. Is that correct? Is that what I needed to do? Because the problem is, I cannot boot into the system (might as well be because of Kernel version, because I am trying to port Android 6 on Kernel 3.10. which was used in the current ROM running Android 5). It looks like the device is stuck in bootloader, or "somehow doesn't know what to start" (sorry, I can't put it better), displaying only my device's logo.
When I connect it to the computer via USB cable, running adb devices shows me that device, but when I try to access shell using adb shell I got error saying that /system/bin/sh wasn't found, which made me thinking that somehow the /system partition isn't "linked" properly, like I stated in the beginning.
Was I doing everything correctly? Do I need to do something above that? (maybe do you know about some tutorial). I am trying to port AOSP 6 Android.
Thank you!