I tried method from online tutorial which saying that using cpio and gzip will work for creating the ramdisk like following: You may have some changes to make for this directory. Now have a look at the contents of the ramdisk directory. The -i switch with cpio makes it work in copy-in mode – it copies files in from an archive, and outputs them as real files. This is then piped (the | symbol) to cpio. The -c switch on gunzip makes it send its output to the standard output (i.e. Here’s the commands: $ mkdir ramdiskĬharger file_contexts oem sbin service_contexts ueventd.rcĭata fstab.flo proc seapp_contexts sysĭefault.prop init property_contexts selinux_version systemĭev init.rc res sepolicy Then use a combination of gunzip and cpio to extract the file. So, to undo all this, we need to first gunzip the ramdisk and then use cpio to extract the files from the archive.
BOOT IMG FILE ARCHIVE
The files have first been concatenated into an archive using cpio (this means the files are all strung together into one single big file, but not compressed), then compressed using gzip. Mark command to re-build the boot.img later. Mkbootimg –base 0 –pagesize 2048 –kernel_offset 0x80208000 –ramdisk_offset 0x82200000 –second_offset 0x81100000 –tags_offset 0x80200100 –cmdline ‘console=ttyHSL0,115200,n8 androidboot.hardware=flo user_debug=31 msm_rtb.filter=0x3F ehci-hcd.park=3 vmalloc=340M’ –kernel kernel –ramdisk -o boot.img To rebuild this boot image, you can use the command: Kernel written to ‘kernel’ (6682776 bytes)
To decompress, modify and Re-compress the boot image you need following tools.
You can extract the image from the device or you can download it from manufacturer’s website.
BOOT IMG FILE ANDROID
Uncompress and extract the contents of the image in the /boot/ directory: xz -dc /dev/null | cpio -o -c -R root:root | xz -9 -format=lzma > /boot/new.Refer my previous article “HOW TO BUILD ANDROID KERNEL AND FLASH IT TO THE TARGET” to get the boot.img for device. | cpio -o -c -R root:root | gzip -9 > /boot/new.img Still in the working directory, find all files and add them to a new boot image file: find. Uncompress and extract the contents of the image in the /boot/ directory: zcat /boot/initrd-$(uname -r).img | cpio -idmv Select the appropriate instructions below to extract or repack the correct image type for your system. boot/initramfs-2.6.86_64.img: LZMA compressed data However, there may also be an XZ/LZMA-format image which displays as: # file /boot/initramfs-$(uname -r).img boot/initramfs-2.6.86_64.img: gzip compressed data The most common is a gzip-format image which displays as: # file /boot/initramfs-$(uname -r).img You may also specify a specific file, such as: file /boot/initramfs-2.6.86_64.img The $(uname -r) will use the file for the current kernel version. Use the file command on the initramfs/initrd to identify the compression format: file /boot/initramfs-$(uname -r).img This will be the location where the initramfs/initrd contents will be viewed, edited, and re-compressed if required: mkdir /tmp/initrd
BOOT IMG FILE HOW TO
Note: For RHEL7 and RHEL8, refer to How to extract the contents of initramfs image on RHEL7? Issue