Thursday, December 22, 2022

Android Toolkit

 


 

ANDROID TOOLKIT:

The evolution of mobile phones comes with its complementary networks like 2G, GSM, UMTS, CDMA, GPRS, 3G, 4G and now 5G. Which further enhances the network stability, functionality and coverage. Now with this advanced network, only compatible handset or phones work. These smart phones are sleek and stylish in design, complex to program, interfacing functionality, sensors, health measures, informative with various OS options. Even phones can dual-boot. We can program, change OS, make dual-boot these phones. These phones come with regular OTA updates from their vendors as well from Linenette phone Come under AOSP (Android Opensource Project) with Custom or Stock ROM option. We can define or

Customize Custom ROMs. While Stock ROMs are company's (GO OGLE) redefined ROMs.  These phones are A/B update partitioned. Where, if A partition is active then B partition will boot into for new updates. There are number of partitions like boot, system, vendor, radio etc. All these partitions serve different means.

boot: The boot partition contains a kernel image and a RAM disk combined via mkbootimg. In order to flash the kernel directly without flashing a new boot partition, a virtual partition can be used:

kernel: The virtual kernel partition overwrites only the kernel (zimage, zImage-dtb, Image.gz-dtb) by writing the new image over the old one. To do this, it determines the start location of the existing kernel image in eMMC and copies to that location, keeping in mind that the new kernel image may be larger than the existing one. The bootloader can either make space by moving any data following it or abandoning the operation with an error. If the development kernel supplied is incompatible, you may need to update the dtb partition if present, or vendor or system partition with associated kernel modules.

ramdisk: The virtual ramdisk partition overwrites only the RAM disk by writing the new image over the old one. To do this, it determines the start location of the existing ramdisk.img in eMMC and copies to that location, keeping in mind that the new RAM disk maybe be larger than the existing one. The bootloader can either make space by moving any data following it or abandon the operation with an error. system: The system partition mainly contains the Android framework.

recovery: The recovery partition stores the recovery image, booted during the OTA process. If the device supports A/B updates, recovery can be a RAM disk contained in the boot image rather than a separate image.

userdata: The userdata partition contains user-installed applications and data, including customization data.

metadata: The metadata partition is used when device is encrypted and is 16MB or larger.

vendor: The vendor partition contains any binary that is not distributable to the Android Open-Source Project (AOSP). If there is no proprietary information, this partition may be omitted.

radio: The radio partition contains the radio image. This partition is only necessary for devices that include a radio that have radio-specific software in a dedicated partition.

tos: The tos partition stores the binary image of the Trusty OS and is only used if the device includes Trusty.

Flow:

       Here is how the bootloader operates:

       The bootloader gets loaded first.

       The bootloader initializes memory.

       If A/B updates are used, determine the current slot to boot.

       Determine whether recovery mode should be booted instead as described     in Supporting updates.

       The bootloader loads the image, which contains the kernel and RAM disk (and in Treble even more).

       The bootloader starts loading the kernel into memory as a self-executable compressed binary.

       The kernel decompresses itself and starts executing into memory.

       From there on, older devices load init from the RAM disk and newer devices load it from the /systempartition.

       From /system, init launches and starts mounting all the other partitions, such as /vendor, /oem, and/odm, and then starts executing code to start the device

Images

The bootloader relies upon these images.

Kernel images

Kernel images are created in a standard Linux format, such as zImage, Image, or Image.gz. Kernel images can be flashed independently, combined with RAM disk images, and flashed to the boot partition or booted from memory. When creating kernel images, concatenated device-tree binaries are recommended over using a separate partition for the device tree. When using multiple Device Tree Blobs (DTBs) for different board revisions, concatenate multiple DTBs in descending order of board revision.

RAM disk images

RAM disks should contain a root file system suitable for mounting as a rootfs. RAM disk images are combined with kernel images using mkbootfs and then flashed into the boot partition.

Boot images

Boot images should contain a kernel and RAM disk combined using an unmodified mkbootimg.

The mkbootimg implementation can be found at: system/core/mkbootimg

The bootloader reads the bootimg.h header file generated by mkbootimg and updates the kernel header to contain the correct location and size of the RAM disk in flash, base address of the kernel, command line parameters, and more. The bootloader then appends the command line specified in the boot image to the end of the bootloader-generated command line.

File system images (system, userdata, recovery)

YAFFS2 image format

If using raw NAND storage, these images must be YAFFS2, generated by an unmodified mkyaffs2image, as found in the Android Open-Source Project (AOSP)

TWRP:  

Team Win Recovery Project

The main method of installing ("flashing") this custom recovery on an Android device requires downloading a version made specifically for the device, and then using a tool such as Fastboot or Odin. Also, some custom ROMs come with TWRP as the default recovery image.

TWRP gives users the option to fully back up their device (including bootloader, system data, private applications, etc.) to revert to at any time, and a built-in file manager to delete files that may be causing problems on the device or add some to fix issues.

TWRP supports the installation of custom ROMs (i.e., custom operating systems such as LineageOS, or the latest Android release), kernels, add-ons (Google Apps, Magisk, themes, etc.), and other various mods.

Wiping, backing up, restoring, and mounting various device partitions, such as the system, boot, userdata, cache, and internal storage partitions are also supported. TWRP also features file transfer via MTP, as well as a basic file manager, and a terminal emulator. It is fully theme.

Magisk:

Magisk is a suite of open-source software for customizing Android, supporting devices higher than Android 5.0. Some highlight features. We can install modules to do just about anything you want senselessly, which means they won't permanently overwrite your system files. Once you uninstall them and reboot, you're right back to stock. 

GSI:

Gneric System Image is reachitect of android framework. There are number of Stock ROMs like, Linegae OS, Revenge OS, Bliss ROM, Evolution X etc.

ADB & Fastboot:

ADB and Fastboot are utilities that unlock access to the Android system while your phone is connected to a desktop computer via a USB cable. The computer and cable are integral to this—there's no app version, and while you can use ADB wirelessly, it's much more complicated to set up. Fastboot is a protocol and a tool of the same name. It is included with the Android SDK package used primarily to modify the flash filesystem via a USB connection from a host computer. It requires that the device be started in Fastboot mode.

 

GitHub:

GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere. It is resourceful tree of repositories, branches, commits, and pull requests. GitHub is a Git repository hosting service, but it adds many of its own features. While Git is a command line tool, GitHub provides a Web-based graphical interface. It also provides access control and several collaboration features, such as a wikis and basic task management tools for every project. 

XDA:

It is software development community of android. XDA Android, XDA Treble are responsible Android working mobile phone working environments by XDA.


No comments:

Post a Comment

Dark Matter

DARK MATTER: Dark matter hypothesis, we can try to justify using newtons universal law of gravity: There is a stronger gravitational field a...