最終更新:2016-07-15 (金) 03:11:44 (2836d)
boot.img
Top / boot.img
GRUB
- On PC BIOS systems, this image is the first part of GRUB to start. It is written to a master boot record (MBR) or to the boot sector of a partition. Because a PC boot sector is 512 bytes, the size of this image is exactly 512 bytes.
- The sole function of boot.img is to read the first sector of the core image from a local disk and jump to it. Because of the size restriction, boot.img cannot understand any file system structure, so grub-setup hardcodes the location of the first sector of the core image into boot.img when installing GRUB.
Android/システムイメージ
カーネルイメージと起動時に使う一時ファイルシステムを一つにまとめたイメージファイル
boot.img = Linuxカーネル + ramdisk.img
メモ
- kernel + ramdisk for normal boot
- ramdisk.imgは中間ファイル
Android/fastboot
fastboot flash boot boot.img
boot.imgのフォーマット
- https://github.com/xiaolu/mkbootimg_tools/blob/master/dtbtool.txt
=format (from bootimg.h) ** +-----------------+ ** | boot header | 1 page ** +-----------------+ ** | kernel | n pages ** +-----------------+ ** | ramdisk | m pages ** +-----------------+ ** | second stage | o pages ** +-----------------+
作り方
- mkbootimgで作る。
mkbootimg --kernel kernel.gz --ramdisk initramfs.cpio.gz -o new_boot.img
分解
カーネル
.configの抽出
- extract-ikconfig
./extract-ikconfig boot.img-kernel.gz > config
AOSP/build/core/Makefile
INTERNAL_BOOTIMAGE_ARGS := \ $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \ --kernel $(INSTALLED_KERNEL_TARGET) \ --ramdisk $(INSTALLED_RAMDISK_TARGET) $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET) $(BOOT_SIGNER) /boot $(INSTALLED_BOOTIMAGE_TARGET) $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGN
ramdisk
- CPIO形式
作成
- mkbootfsで作成。
mkbootfs ramdisk | gzip > custom-ramdisk.gz
- cpioで作成
find . | cpio -o -H newc | gzip > ../newramdisk.cpio.gz
展開
- gunzip
gunzip -c your-ramdisk-file | cpio -i
- extract_uImage.sh
その2
[TOOL] Boot.img tools [unpack, repack, ramdisk]
- http://forum.xda-developers.com/showthread.php?t=2319018
- boot_info?
- split_boot? (split_bootimg.pl)
- unpack_ramdisk?/repack_ramdisk?
- mkbootimg/unmkbootimg
関連
- recovery.img - kernel + ramdisk used to boot into recovery mode
- LK