admin / 23.08.2018

Boot img

Introduction

Typical Android system implementing fastboot (this includes FirefoxOS devices) uses so called images to run the kernel. It consist of the kernel itself and a ramdisk that it used to populate root () filesystem. Because it’s often useful to edit this filesystem (especially to modify file), let’s look how we can manipulate this image. I already briefly described how this can be done as part of my older post but now I’m going to describe more advanced and standalone (you don’t need Android sources for it) tool.

I assume that you have an image dump and it’s filename is . You can dump it using commands like:

$ adb shell cat /dev/mtd/mtd0 >/mnt/sdcard/boot.img $ adb pull /mnt/sdcard/boot.img /tmp/boot.img

You can read my older post to see how this can be done on Alcatel One Touch Fire.

Build abootimg tool

To do just about anything useful, you need proper tools. In this case, the tool is called . It’s quite easy to install:

git clone https://git.gitorious.org/ac100/abootimg.git cd abootimg make

This will create executable which can be used right away (you don’t have to copy it anywhere).

Extract boot.img content

In order to extract , use option followed with a path to the file. This will create few files in the current directory:

mkdir boot cd boot ../abootimg -x /tmp/boot.img

Edit ramdisk content

is a ramdisk file. It should be gzipped cpio file. To uncompress it, use following command:

mkdir initrd cd initrd cat ../initrd.img | gunzip | cpio -vid

Then edit the files you want, most probably . To recreate ramdisk image, use:

cd initrd find . | cpio —create —format='newc'| gzip > ../myinitd.img

Repack boot.img

You may create new boot image using option. You have to specify config file ( option), kernel image ( option), and ramdisk image ( option):

../abootimg —create myboot.img -f bootimg.cfg -k zImage -r myinitrd.img

If you extracted existing file, the config file was created for you. I explain this file later.

You may also change in place, using option combined with to change kernel image, to change ramdisk image, to change config file or to change specific config option only. For example to only change ramdisk and set config option, you could use:

../abootimg -u /tmp/boot.img -c "name=rooted" -r myinitrd.img

Now you can boot this image with command or flash it using .

Configuration file

You can get some basic information from the image without extracting it with option:

$ ../abootimg -i ~/BUILD/firefoxos/B2G-hamachi/hamachi-backup/boot.img Android Boot Image Info: * file name= /home/k/BUILD/firefoxos/B2G-hamachi/hamachi-backup/boot.img * image size=4616192 bytes (4.40 MB) page size=2048 bytes * Boot Name="" * kernel size=4274296 bytes (4.08 MB) ramdisk size=336854 bytes (0.32 MB) * load addresses: kernel: 0x00c5c004 ramdisk: 0x01f5c004 tags: 0x00c54104 * cmdline= androidboot.hardware=qcom loglevel=1 * id= 0x19964b91 0xd35aa078 0x953b011d 0x2804aab4 0xf7a3e4b3 0x00000000 0x00000000 0x00000000

Most of this information is stored in a file and it’s used when recreating the image file. In some cases, you may want to change them. Here’s its example content:

$ cat bootimg.cfg bootsize= 0xa00000 pagesize= 0x800 kerneladdr= 0xc5c004 ramdiskaddr= 0x1c54004 secondaddr= 0x1b54004 tagsaddr= 0xc54104 name=cmdline= androidboot.hardware=qcom loglevel=1
  • — size of the boot image; should be multiple of . It can never be smaller than the actual produced image file otherwise system won’t boot. You can remove this line and will calculate it for you. Of course, this can’t be bigger than your boot partition on the device.

  • — it’s the size of a NAND page. You probably don’t want to change that.

  • , , , — specifies where in memory should each image be put by when flashing the image. You may want to change this if you want to change kernel in your image.

Note that those addresses are only used when you flash the image ( command), if you boot it () they will be calculated like this (typical address is 0x10000000, it can be changed by parameter):

hdr->kernel_addr=base+0x00008000;hdr->ramdisk_addr=base+0x01000000;hdr->second_addr=base+0x00F00000;hdr->tags_addr=base+0x00000100;

I believe that the address should be the same as in your kernel config.

  • is not used by bootloader but it can be displayed with option so you may want to use it to specify the purpose of each image, for example.

  • contains command line passed to the kernel.

imgtool

The utility is another one of the tools I’m including in my book, this time to accompany the chapter about the Boot process.

Как в ядро Андроид добавить поддержку init.d

I deal a lot with the internal format of images there, and realized I needed a quick extractor. This became more important when I started to deal with the L preview, and Google Glass system images I used for research.

You can get the tool right here. Just unpack the tar. There’s a Mac OS X and Linux ELF32/64 binary, and the source. As usual, you might want to check out the RSS feed, or follow my company’s Twitter for more updates.

Why should I care?

Well, most users wouldn’t. But if you need a quick tool to unpack Android images, this is useful. Think of it as the inverse of mkbootimg (from the AOSP), coupled with simg2img (the sparse image extractor). Another bonus feature it provides is unpacking the Linux bzimage kernels.

Another reason — If you’re downloading a rooting tool — and you want to avoid getting malware. I just downloaded An NVIDIA Shield root image, for example — which is really nothing more than a bootimg. So it was trivial to run this tool to extract it — specifically, get to the ramdisk, then and make sure I can have a peek at it before installing.

So how do I use it?

Like So:

To obtain an Android system image, you can either get it from a zip (e.g. Google’s update, Amazon’s update.bin, etc), or by ‘ing for a device, then copying it over. Note that some devices (e.g. the HTC One M8) may need a bit of processing, in this case stripping the 256 header HBoot uses:

If you’re using the Google images, it’s easier:

You can also use it to extract the filesystem image (basically, do what does:

Lastly, you can use it for imgdata extraction as well (as the file format there is derived from that of the boot image:

Version 0.2 Changes

  • Supports offset= (for HTC and other boot.imgs where ANDROID! is wrapped)
  • Supports cmdline= (to override kernel command line)

Version 0.3 Changes

  • Supports making images (similar functionality to mkbootimg) with the «make» argument
  • Minor updates to support cases where kernel can’t be decompressed (notably, Samsung 6Edge — Thanks, Dan!)
  • Shameless plug for the book, and RFC

    The book has a TON of detail about the format of the boot images, as well as customizing the boot process by tinkering with the boot loader, system.img, and what not. The book has been out for a while, and you can get it on this very site, or on Amazon.

    Volume II — covering the deep internals of the frameworks and the runtime — will be out around the time N goes final. In the interim, I encourage you to try out the tool (as well as the even more powerful Dextra, and the simple but useful bindump) and, of course — JTrace. Shoot me an email (to j@) if you’ve any questions. Or comments. Or in general. All are welcome.

Описание файла .img на русскомОбраз диска Macintosh
Описание файла .img на английскомMacintosh Disk Image
Тип файлаОбразы дисков
Подробное описаниеОбраз диска может быть смонтирован на виртуальное устройство чтения компакт-дисков или как отдельный жесткий диск. Это позволяет использовать данный образ как обычный CD, DVD или дополнительный том.

Образ диска IMG широко использовался в Mac OS 9 и более ранних версиях операционной системы. В Mac OS X данный формат был заменен файлом .DMG.
Как, чем открыть файл .img?

Монтирование recovery, boot!?

MagicISO

Формат файла .img #2
Описание файла .img на русскомФайл данных образа диска CloneCD
Описание файла .img на английскомCloneCD Disk Image Data File
Тип файлаОбразы дисков
Подробное описаниеОбраз диска IMG содержит копию данных компакт-диска, выполненную с помощью программы CloneCD.

При прожиге нового диска с образа, данный файл должен находится в одной папке с соответсвующими файлами .CCD и .SUB.
Как, чем открыть файл .img?
SlySoft CloneCD
IsoBuster
EZB Systems UltraISO

Познавательно-практический экскурс в архитектуру Android

Boot.img содержит ядро ​​и ramdisk, критические файлы, необходимые для загрузки устройства, прежде чем монтировать файловую систему. Вы должны сами создать boot.img, используя mkbootimg, инструмент, предоставляемый AOSP.

Все необходимые данные доступны в этой ветке xda-developers.

Этот дискуссионный поток google также может быть полезен

Как Сделать Прошивку в Формате Img
http://tav.dukeb.ru/%D0%9A%D0%B0%D0%BA%20%D0%A1%D0%B4%D0%B5%D0%BB%D0%B0%D1%82%D1%8C%20%D0%9F%D1%80%D0%BE%D1%88%D0%B8%D0%B2%D0%BA%D1%83%20%D0%B2%20%D0%A4%D0%BE%D1%80%D0%BC%D0%B0%D1%82%D0%B5%20Img App Store для iPhone перешедших вПодписка на рассылку “как сделать прошивку в формате img”.

В процессе прошивки вы увидите множество сменяющихся образов в формате img, дольше всего найти на сайте поддержки устройства. Подписка на рассылку “как сделать прошивку в формате img”. Рассылка выходит раз в сутки и содержит список программ из App Store для iPhone перешедших. Прошивки в формате. Полный образ диска дополняется файлами SUB и CCD с такими же именами, находящимися в той же папке. Как сделать прошивку в формате. Как сделать прошивку в zip на android из img Android Club. Подробное как сделать файл img для прошивки андроид описаниеобраз диска img содержит копию данных компакт-диска, выполненную с помощью. В общем мне нужно сделать прошивку для Android в update. Чем распаковать формат. Img? Прошивка Как получить tar-файл для прошивки через ODIN создание. MD5? MD5 файлы, но далеко не все обновления представлены в таком виде например CWM RECOVERY, выкладываются в формате NAME.

Unpack/repack boot.img/ramdisk for Android

Все прошивки для планшетов на процессоре Allwinner имеют один и тот же формат img IMAGEWTY. После долгих поисков я все-таки нашел программу, которая позволяет разобрать и собрать прошивку для планшетов на базе Allwinner. Подписка на рассылку “как сделать прошивку в формате img”. Рассылка выходит раз в сутки и содержит список программ из App Store для iPhone перешедших в категорию бесплатные за последние 24 часа. Подписка на рассылку “как сделать прошивку в формате img”. Как Сделать Прошивку в Формате Img

FILED UNDER : IT

Submit a Comment

Must be required * marked fields.

:*
:*