What is boot.img file in android? - android

I am building the android source code and getting new system.img . I try to flash the new system.img on a device and I see that I need another file called boot.img. What is this file ? what is used for ? how can I get it for my device ?

boot.img contains the kernel and ramdisk, critical files necessary to load the device before the filesystem can be mounted. You have to generate the boot.img yourself using mkbootimg, a tool provided by AOSP.
All the details you need are available at this xda-developers thread.
This google discussion thread may also be useful

Related

Building Android APK which includes another file that will be ran

I am trying to build a app that after it is installed, will drop another binary that I will execute from within the app. It is basically the command ifconfig but my own version that has some other additions.
Ideally when the single APK file is moved to the device and installed, I would like for the ifconfig file to be dropped in the apps local folder where it will then be used with ProcessBuilder to execute.
Is this something that can be done with Android? The other option would be to download the file but I prefer to have it included with the APK.
You can't quite get that, but you can get the same effect. You can put the file in as an asset, and write the file to the filesystem on first boot of your application. Just check if its already on the filesystem, and if not read it in from assets and write it to the filesystem.
I do question why you're going this route though. Why are you using a C binary rather than writing it in Java/Kotlin? Or using a C library linked via the NDK? Running it via ProcessBuilder is a definite code smell.

Android Kernel Compilation - Files

Good day for you. I just started to learn and work with android kernel development or internals. I purchased a development board on-line that uses AM3359 - TI Processor. Works fine with factory Images and I booted from SD_CARD.
Later I read the documentation and I tried to compile the kernel. Everything went well as expected. I do have a little questions that I would like to clear it regarding the files that were created.
I had a section in documentation in which I was asked to Create a Root FileSystem which gave me a file called ubi.img - What is this file ?
Later I was asked to create a tarball file providing the roots path which created me an other file rootfs.tar.bz2 - What is this file ?
My question is... both the files used the files from rootfs directory to create these files. What are these files for? What exactly ubi.img does and what is it used for? Is it used for flashing it to nand and rootfs.tar.bz2 is to boot if I am booting from SD_CARD ???
Thanks & Regards
I don't know much about AM3359 - TI Processor, but on most smartphones and also in the linux kernel requires a ramdisk which is usually compressed mostly it's a .gz file.
According to my experience when the file is decompressed and usually it contains hardware initialization routines which the kernel runs first during startup.
The .img files are where everything is stored.
Most commonly :
BOOT.img - Read Only Contains ramdisk and
the rootfs this are usually zImage + rootfs.tar.bz2
System.img- Also read only although can be remounted as read+write Contains
the operating system files e.g binaries like su, busybox etc.
Userdata.img- This is where all the users data and settings are stored.
The above are all that's necessary to get a system up and running.But we might have others such as Uboot.img Preloader etc, it varies depending on the platform.

Android, Java, running an Executable resource

Environment
Windows (x64) Host
Android 5.0 USB connected to the Windows machine
Un-rooted Samsung Galaxy 5
Use-case
Java APK Application
Native C++ executable packed as a raw resource part of the APK
Upon startup executable is to be ~extracted~ to a temp folder where it would execute
Questions/Discussion
Is the above use-case supported by the Android OS?
To the best of my knowledge, '/data/local/tmp' is not accessible to a running app ( but to shell & root ), Is there a directory where the file can be extracted too and executed? ( dir must have execution rights )
What would be the best approach to achieve the above mentioned?
Yes, you can do this. You will need to make sure that the native executable is for the appropriate target architecture (some type of ARM processor, usually).
But you shouldn't extract it to /data/local/tmp. You will need to extract it to /data/data/application.package.name/lib, which is a directory to which your app has read/write permissions.
There are more details in this question and its accepted answer. It looks as though you can have the executable extracted automatically for you if you name it as if it were a library file rather than a standalone executable.

Android binary executable file

I'm trying to push executable file to the phone, file was compiled by NDK.
But after copying files to the device they lost their permission (became no excecutable).
Is there any solution to fix kernel sources, or other sources in Android to fix this problem (lost permissions)? I'm pretty sure that it can be ext4 problem...
Note:
I don't want use chmod each time.
If you can wrap your executable in an installable APK, here is the simple trick: https://stackoverflow.com/a/17384650/192373. It has been tested to work up to JellyBean 4.3, but please be aware that it relies on some undocumented behaviours of the PackageManager.

Android ROM building from AOSP... do I need to worry about drivers?

I need to build my own rom for a specific device. I get how how to download and build the AOSP stuff, but wonder if flashing the system.img file over an existing one on a device will work without issue or if I need to do something with drivers? Where exactly are the drivers? Should I be pulling out specific folders from a rooted devices system folder and copy them into the new AOSP system file??
Just looking for some clarity on the process.

Categories

Resources