Details on individual partitions

jackie_gnu發表於2011-07-08

 Details on individual partitions

Boot.img details

The boot.img is generated using umulti.sh script (also shown below)

   ./mkbootimg --kernel zImage --ramdisk ramdisk.img --base 0x80000000 
               --cmdline "console=ttyO2,115200n8 mem=456M@0x80000000 mem=512M@0xA0000000 init=/init vram=10M omapfb.vram=0:4M androidboot.console=ttyO2" 
               --board omap4 -o boot.img

As you see in the line above, the kernel image used is zImage instead of uImage that we usually use.

TIP: If you have a uImage, you can create a zImage from it using the following command

    dd if=uImage bs=64 skip=1 of=zImage

The zImage is combined with ramdisk.img, which contains all the initial boot up programs (init, init.rc etc).

If you have to edit ramdisk.img, it can be done by following this

Opening and changing files in ramdisk.img for debugging

A ramdisk is basically a small filesystem containing the core files needed to initialize the system. It includes the critical init process, as well as init.rc, which is where you can set many system-wide properties. If you really want to know more about it, here is the documentation. Here's a list of files on a typical ramdisk:

data
default.prop
dev
env.txt
init
init.goldfish.rc
init.omapzoom2.rc
init.rc
proc
sbin\
sbin\adbd
sbin\hotplug

Here are the steps to open, edit and create a new ramdisk.img

  • Copy the ramdisk.img to your UBuntu (Linux) machine
  • Back up ramdisk.img and Create a temporary folder, say tmp
       # cp ramdisk.img ramdisk.img.bkup
       # mkdir tmp && cd tmp
  • Extract the ramdisk using the command below
       # gunzip -c ../ramdisk.img | cpio -i
  • Modify the contents of tmp folder. The contents of tmp folder will get into the ramdisk.img
       Modify the contents of file in tmp folder eg. init.rc
  • Recreate the ramdisk.cpio with command:
        # find . | cpio -o -H newc | gzip > ../ramdisk.img


Once the ramdisk.img is re-generated, you need to regenerate the boot.img using mkbootimg command shown above, and flash it for your init.rc changes to get reflected. Similarly, for updating the kernel you should regenerate boot.img with new zImage and flash it using fastboot command in earlier section.

TIP: If you want to just test your boot.img, without flashing you can use the command below

     ./fastboot boot ./boot.img
System.img details

System image is a sparsed ext4 loop mounted file system. To open (mount) system image use the commands below

      ./simg2img system.img system.img.raw
      mkdir tmp 
      sudo mount -t ext4 -o loop system.img.raw tmp/

After this, all your system image files are part of tmp folder.

Make any changes you need in the tmp folder. To re-create the parsed system image (system.img.new) use the command below. This can be individually flashed using fastboot command

      sudo ./make_ext4fs -s -l 512M -a system system.img.new tmp/
      sudo umount tmp
      rm -rf tmp

Userdata.img details

This partition contains user-installed applications and data, including customization data

Again this is a sparsed ext4 loop mounted filesystem. To extract the sparesed image, use the command below

   ./simg2img userdata.img userdata.img.raw
   ./mkdir tmp
   sudo mount -t ext4 -o loop userdata.img.raw tmp/

Now you can make any changed in the tmp folder. To re-create a new userdata.img, use the command below to generate userdata.img.new, which can be flashed using fastboot.

   sudo ./make_ext4fs -s -l 512M -a userdata userdata.img.new tmp/
   sudo umount tmp
   rm -rf tmp

Cache.img details

This partition can be used to store temporary data. It is currently an empty ext4 image.

Commands to create this image

  mkdir tmp/
  sudo ./make_ext4fs -s -l 256M -a cache cache.img tmp/

Frequently used Commands for eMMC

To remount system partition in R/W mode for OMAP4

    adb remount                  - remounts the /system partition on the device read-write

To remount rootfs as R/W mode

   mount -o rw,remount -t auto /dev/block/mmcblk0p1 /

To add busybox run the commands below

   adb shell 'chmod 0755 /data/busybox/bin/* /data/busybox/sbin/*'
   adb shell '/data/busybox/bin/mount -oremount,rw /'
   adb shell '/data/busybox/bin/mount -oremount,rw /system'
   adb shell 'ln -s /data/busybox/bin /system/vendor/bin'
   adb shell 'ln -s /data/busybox/sbin /system/vendor/sbin'


 

 

 

相關文章