2013年11月12日 星期二

mount a HDD image under Linux

(1). determine the offset of the partition

# fdisk -l 3.4.61.img

Disk linaro-quantal-developer-20130422-342-A20-3.4.61.img: 944 MB, 944766976 bytes
58 heads, 20 sectors/track, 1590 cylinders, total 1845248 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Device      Boot      Start         End      Blocks   Id  System
3.4.61.img  1          2048     1845247      921600   83  Linux

From the example, the offset of the only partition is
2048*512=1048576

(2). setup the loopback device

# losetup -o 1048576 /dev/loop0 3.4.61.img

(3). mount the partition

# mount /dev/loop0 /mnt/temp

(4). umount the partition and detach the loopback device

# umount /mnt/temp
# losetup -d /dev/loop0

2013年11月6日 星期三

Android build system trace

整個 Android build 的主體,都放在
build 底下, 開始的第一個指令

source build/envsetup.sh

會"建立"幾個 shell 的 function,
在 shell 底下下 set 指令就會印出來,
之後就可以下 lunch, cgrep, godir 等"指令".